:root {
  color-scheme: light;
  font-family:
    system-ui,
    -apple-system,
    "Segoe UI",
    sans-serif;
  color: #18332f;
  background: #f3f6f3;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

button,
input,
textarea {
  font: inherit;
}

button,
summary {
  cursor: pointer;
}

.page {
  max-width: 1240px;
  margin: 0 auto;
  padding: 48px 24px;
}

.page-header,
.collection-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.page-header {
  margin-bottom: 32px;
}

.eyebrow {
  color: #55746b;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  letter-spacing: -0.05em;
}

h2 {
  margin-bottom: 14px;
  font-size: 1.15rem;
}

.subtitle,
.hint,
.footnote,
.term-context,
.date-cell,
.result-count,
.read-only-label,
.empty-state p {
  color: #61736b;
}

.subtitle {
  margin-bottom: 0;
}

.local-badge {
  flex-shrink: 0;
  padding: 9px 13px;
  border: 1px solid #d3e3d8;
  border-radius: 999px;
  color: #38634e;
  background: #eaf3eb;
  font-size: 0.8rem;
}

.workspace {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  align-items: start;
  gap: 24px;
}

.panel {
  min-width: 0;
  padding: 24px;
  border: 1px solid #e0e8e0;
  border-radius: 18px;
  background: white;
  box-shadow: 0 6px 24px #223e3010;
}

.hint,
.footnote {
  line-height: 1.55;
  font-size: 0.85rem;
}

.footnote {
  margin-top: 20px;
  margin-bottom: 0;
}

label {
  display: block;
  margin-bottom: 7px;
  font-size: 0.85rem;
  font-weight: 600;
}

input,
textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid #cddad0;
  border-radius: 9px;
  color: #18332f;
  background: #fcfdfb;
}

input:focus,
textarea:focus {
  border-color: #398867;
  outline: 3px solid #39886725;
}

textarea {
  resize: vertical;
}

#add-term-form input,
#add-term-form textarea,
#unlock-editing-form input,
.editor input,
.editor textarea {
  margin-bottom: 16px;
}

#auth-status {
  margin-top: 16px;
}

#lock-editing-button {
  margin-bottom: 20px;
}

.read-only-label {
  font-size: 0.8rem;
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

button,
.export-link {
  padding: 10px 14px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-weight: 600;
}

.primary-button {
  width: 100%;
  color: white;
  background: #21634e;
}

.primary-button:hover {
  background: #174c3b;
}

.secondary-button {
  color: #264e40;
  border-color: #d0ddd2;
  background: #f1f6f0;
}

.secondary-button:hover {
  background: #e3eee1;
}

.delete-button {
  margin-top: 10px;
  padding: 7px 10px;
  color: #a13c32;
  background: #fff1ed;
}

.delete-button:hover {
  background: #ffe4dc;
}

.collection-heading {
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.collection-heading h2 {
  margin-bottom: 0;
}

.collection-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.export-link {
  font-size: 0.8rem;
  text-decoration: none;
}

.api-link {
  color: #386b56;
  font-size: 0.8rem;
}

.search-row {
  display: flex;
  gap: 8px;
}

.search-row input {
  min-width: 0;
}

.result-count {
  margin: 20px 0 12px;
  font-size: 0.8rem;
}

.notice {
  margin: 18px 0 0;
  padding: 12px;
  border-radius: 9px;
  overflow-wrap: anywhere;
  font-size: 0.85rem;
}

.notice-success {
  color: #235b3c;
  background: #eaf6e9;
}

.notice-info {
  color: #315d7b;
  background: #edf5fd;
}

.notice-error {
  color: #9a352e;
  background: #fff0ed;
}

.table-scroll {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

th {
  padding: 11px 10px;
  border-bottom: 1px solid #dce6dc;
  color: #61736b;
  font-size: 0.75rem;
  font-weight: 600;
}

td {
  padding: 17px 10px;
  border-bottom: 1px solid #edf1eb;
  vertical-align: top;
}

.term-cell {
  min-width: 130px;
}

.term-text,
.term-context {
  overflow-wrap: anywhere;
}

.term-context {
  max-width: 360px;
  margin: 7px 0 0;
  line-height: 1.5;
  white-space: pre-wrap;
  font-size: 0.85rem;
}

.date-cell {
  white-space: nowrap;
  font-size: 0.8rem;
}

.actions-cell {
  min-width: 105px;
}

.editor summary {
  color: #386b56;
  font-size: 0.85rem;
  font-weight: 600;
}

.editor[open] {
  min-width: 220px;
}

.editor form {
  margin-top: 16px;
}

.empty-state {
  padding: 42px 16px;
  border: 1px dashed #d5e1d5;
  border-radius: 12px;
  text-align: center;
}

.empty-state h3 {
  margin-bottom: 8px;
  font-size: 1rem;
}

.empty-state p {
  margin-bottom: 0;
  font-size: 0.85rem;
}

.htmx-request .primary-button,
.htmx-request .secondary-button {
  opacity: 0.65;
  pointer-events: none;
}

@media (max-width: 900px) {
  .workspace {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 550px) {
  .page {
    padding: 28px 14px;
  }

  .page-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .panel {
    padding: 18px;
  }
}
