/* Compendium — TCM redesign */

@import url('https://fonts.googleapis.com/css2?family=Newsreader:ital,opsz,wght@0,6..72,400;0,6..72,500;0,6..72,600;1,6..72,400&family=IBM+Plex+Sans:wght@300;400;500;600&family=IBM+Plex+Mono:wght@400;500&family=Noto+Serif+SC:wght@400;500;600&display=swap');

:root {
  --bg: #FBF9F4;
  --paper: #F4EFE3;
  --paper-2: #EDE6D2;
  --surface: #FFFFFF;
  --ink: #1B1F1A;
  --ink-2: #3F4A3A;
  --ink-3: #6B7461;
  --ink-4: #9AA194;
  --line: #E4DECD;
  --line-2: #D5CDB7;

  --green-900: oklch(0.30 0.06 150);
  --green-700: oklch(0.42 0.09 148);
  --green-600: oklch(0.50 0.10 148);
  --green-300: oklch(0.82 0.07 140);
  --green-100: oklch(0.94 0.04 135);
  --green-50:  oklch(0.97 0.025 130);

  --amber-600: oklch(0.72 0.15 78);
  --amber-500: oklch(0.78 0.14 78);
  --amber-100: oklch(0.95 0.06 85);

  --terra: oklch(0.62 0.13 45);
  --plum:  oklch(0.50 0.10 350);

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --r-xl: 22px;

  --shadow-1: 0 1px 0 rgba(27,31,26,0.04), 0 1px 2px rgba(27,31,26,0.04);
  --shadow-2: 0 1px 0 rgba(27,31,26,0.04), 0 4px 14px rgba(27,31,26,0.06);
}

* { box-sizing: border-box; }

html { overflow-x: clip; }
html, body { max-width: 100%; width: 100%; overflow-x: clip; margin: 0; padding: 0; }

.tcm {
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 14.5px;
  line-height: 1.5;
  letter-spacing: -0.005em;
  max-width: 100vw;
  overflow-x: clip;
}
.tcm h1, .tcm h2, .tcm h3 { overflow-wrap: anywhere; word-break: break-word; }
.tcm .latin, .tcm .pinyin-roman { overflow-wrap: anywhere; word-break: break-word; }
.tcm .crumbs { overflow: hidden; }
.tcm .crumbs > :last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.tcm .btn { min-width: 0; }
.tcm h1, .tcm h2, .tcm h3, .tcm .serif {
  font-family: 'Newsreader', Georgia, serif;
  font-weight: 500;
  letter-spacing: -0.015em;
  color: var(--ink);
}
.tcm .zh { font-family: 'Noto Serif SC', 'Newsreader', serif; }
.tcm .mono { font-family: 'IBM Plex Mono', ui-monospace, monospace; }

.tcm a { color: var(--green-700); text-decoration: none; }
.tcm a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ─── header ─── */
.t-topbar {
  height: 64px;
  display: flex; align-items: center;
  padding: 0 32px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.t-logo { display: flex; align-items: center; gap: 10px; font-family: 'Newsreader', serif; font-size: 22px; font-weight: 500; color: var(--green-900); }
.t-logo-mark {
  width: 30px; height: 30px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, var(--green-300), var(--green-700));
  display: grid; place-items: center; color: white; font-family: 'Noto Serif SC', serif; font-size: 16px;
}
.t-nav { display: flex; gap: 28px; margin-left: 48px; font-size: 14px; color: var(--ink-2); }
.t-nav a { color: var(--ink-2); }
.t-nav a.active { color: var(--green-900); position: relative; }
.t-nav a.active::after {
  content:''; position:absolute; left:0; right:0; bottom:-22px; height:2px; background: var(--green-700);
}
.t-spacer { flex: 1; }
.t-pill { display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 999px; font-size: 13px; }
.t-pill.ghost { color: var(--ink-2); border: 1px solid var(--line); background: var(--surface); }
.t-pill.solid { background: var(--ink); color: white; }
.t-pill.amber { background: var(--amber-500); color: #2A1E0A; font-weight: 500; }

/* ─── buttons ─── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px; border-radius: var(--r-md);
  font: inherit; font-size: 14px; font-weight: 500;
  border: 1px solid transparent; cursor: pointer;
  transition: all 120ms ease;
}
.btn-primary { background: var(--green-700); color: white; border-color: var(--green-700); }
.btn-primary:hover { background: var(--green-900); }
.btn-amber { background: var(--amber-500); color: #2A1E0A; }
.btn-amber:hover { background: var(--amber-600); }
.btn-ghost { background: transparent; color: var(--ink-2); border-color: var(--line-2); }
.btn-ghost:hover { background: var(--paper); }
.btn-soft { background: var(--paper); color: var(--ink); border-color: var(--line); }
.btn-soft:hover { background: var(--paper-2); }
.btn-sm { padding: 6px 10px; font-size: 12.5px; border-radius: var(--r-sm); }
.btn-lg { padding: 14px 22px; font-size: 15px; }

.icon { width: 16px; height: 16px; flex: none; }
.icon-sm { width: 14px; height: 14px; }
.icon-lg { width: 20px; height: 20px; }

/* ─── search hero ─── */
.t-hero {
  background:
    radial-gradient(1100px 380px at 50% -10%, var(--green-50), transparent 70%),
    var(--bg);
  border-bottom: 1px solid var(--line);
  padding: 56px 32px 36px;
  position: sticky;
  top: 0;
  z-index: 30;
  transition: padding 180ms ease, background 180ms ease;
}
/* Stuck (compact) hero — triggered by JS once the page has scrolled. */
.t-hero.stuck {
  padding: 10px 32px 10px;
  background: var(--surface);
  box-shadow: var(--shadow-2);
}
.t-hero.stuck .t-eyebrow,
.t-hero.stuck h1,
.t-hero.stuck .sub {
  display: none;
}
.t-hero.stuck .searchbar {
  padding: 4px;
  box-shadow: none;
}
.t-hero.stuck .searchbar input {
  padding: 8px 12px; font-size: 14.5px;
}
.t-hero.stuck .searchbar .btn-amber.btn-lg {
  padding: 8px 14px; font-size: 13.5px;
}
.t-hero.stuck .t-chips { margin-top: 8px; }
.t-hero.stuck .t-chips > .chip { display: none; }
/* keep the advanced-filter toggle, the scope chip(s), and the "Neuer Artikel" button visible */
.t-hero.stuck .t-chips > span:first-child { display: none; }     /* "Schnellfilter" label */
.t-hero.stuck .t-chips .chip.active { display: inline-flex; }    /* keep the active scope chip */
.t-hero.stuck .adv-panel {
  position: absolute; left: 32px; right: 32px; top: 100%;
  margin-top: 0; border-top-left-radius: 0; border-top-right-radius: 0;
  max-height: calc(100vh - 120px); overflow-y: auto;
}
.t-hero-inner { max-width: none; margin: 0; }
.t-eyebrow { font-family: 'IBM Plex Mono', monospace; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--green-700); margin-bottom: 14px; }
.t-hero h1 {
  font-size: 38px; line-height: 1.1; margin: 0 0 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.t-hero .sub { color: var(--ink-3); font-size: 15px; max-width: 560px; margin-bottom: 28px; }

.searchbar {
  display: flex; align-items: stretch;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-lg);
  padding: 6px; box-shadow: var(--shadow-2); max-width: 820px;
}
.searchbar input {
  flex: 1; border: 0; outline: 0; padding: 14px 16px; background: transparent;
  font: inherit; font-size: 16px; color: var(--ink);
}
.searchbar input::placeholder { color: var(--ink-4); }
.searchbar .scope {
  display: flex; align-items: center; gap: 6px; padding: 0 14px;
  border: 0; border-right: 1px solid var(--line);
  background: transparent; color: var(--ink-3); font: inherit; font-size: 13px;
  cursor: pointer; user-select: none; position: relative;
}
.searchbar .scope:hover { color: var(--ink); }
.searchbar .scope svg { transition: transform 140ms ease; }
.searchbar .scope[aria-expanded="true"] svg { transform: rotate(180deg); }

.scope-menu {
  position: absolute; top: calc(100% + 8px); left: 0; z-index: 20;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); box-shadow: var(--shadow-2);
  padding: 4px; min-width: 200px;
}
.scope-menu button {
  display: flex; width: 100%; align-items: center; justify-content: space-between;
  gap: 10px; padding: 8px 12px; border: 0; background: transparent;
  font: inherit; font-size: 13.5px; color: var(--ink-2);
  cursor: pointer; border-radius: var(--r-sm); text-align: left;
}
.scope-menu button:hover { background: var(--paper); color: var(--ink); }
.scope-menu button.active { color: var(--green-900); font-weight: 500; }
.scope-menu button.active::after {
  content: ''; width: 6px; height: 6px; border-radius: 999px; background: var(--green-700); flex: none;
}
.scope-backdrop { position: fixed; inset: 0; z-index: 10; background: transparent; }

.t-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; align-items: center; }

/* advanced filters */
.adv-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line);
  font: inherit; font-size: 12.5px; color: var(--ink-2);
  cursor: pointer;
}
.adv-toggle:hover { border-color: var(--line-2); color: var(--ink); }
.adv-toggle.active {
  background: var(--green-50); border-color: var(--green-100); color: var(--green-900);
}
.adv-toggle .pill {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 6px; border-radius: 999px;
  background: var(--green-700); color: white;
  font-family: 'IBM Plex Mono', monospace; font-size: 10.5px;
}
.adv-toggle svg { transition: transform 160ms ease; }
.adv-toggle[aria-expanded="true"] svg.chev { transform: rotate(180deg); }

.adv-panel {
  margin-top: 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 22px 24px;
  box-shadow: var(--shadow-1);
  animation: adv-rise 160ms ease;
}
@keyframes adv-rise { from { transform: translateY(-4px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.adv-grid {
  display: grid; gap: 22px 28px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}
.adv-section { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.adv-section .head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
}
.adv-section .eyebrow {
  font-family: 'IBM Plex Mono', monospace; font-size: 11px;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--green-700);
}
.adv-section .meta {
  font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--ink-4);
}
.adv-section .hint { font-size: 12.5px; color: var(--ink-3); margin: 0; }

.adv-pills { display: flex; flex-wrap: wrap; gap: 6px; }

/* per-section type-to-filter for tag pills */
.adv-pill-search {
  position: relative; display: flex; align-items: center; margin-bottom: 8px;
}
.adv-pill-search svg:first-child {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  color: var(--ink-4); pointer-events: none;
}
.adv-pill-search input {
  width: 100%; border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface); padding: 6px 26px 6px 28px;
  font: inherit; font-size: 12.5px; color: var(--ink); outline: 0;
}
.adv-pill-search input:focus { border-color: var(--green-300); }
.adv-pill-search input::placeholder { color: var(--ink-4); }
.adv-pill-search-clear {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 20px; height: 20px; border: 0; background: transparent;
  color: var(--ink-4); cursor: pointer; display: grid; place-items: center;
  border-radius: 999px;
}
.adv-pill-search-clear:hover { background: var(--paper); color: var(--ink-2); }

.adv-pill-scroll {
  max-height: 196px; overflow-y: auto;
  padding-right: 6px; margin-right: -6px;
  scrollbar-width: thin; scrollbar-color: var(--line-2) transparent;
}
.adv-pill-scroll::-webkit-scrollbar { width: 6px; }
.adv-pill-scroll::-webkit-scrollbar-track { background: transparent; }
.adv-pill-scroll::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 999px; }
.adv-pill-scroll::-webkit-scrollbar-thumb:hover { background: var(--ink-4); }

.adv-pills-selected {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 0 0 8px;
  border-bottom: 1px dashed var(--line);
  margin-bottom: 8px;
}
.adv-empty {
  font-size: 12.5px; color: var(--ink-4); font-style: italic;
  padding: 8px 0;
}
.adv-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  background: var(--paper); border: 1px solid var(--line);
  font: inherit; font-size: 12px; color: var(--ink-2);
  font-family: 'IBM Plex Mono', monospace; letter-spacing: 0.04em;
  cursor: pointer; transition: all 120ms ease;
}
.adv-pill:hover { border-color: var(--line-2); color: var(--ink); }
.adv-pill.active {
  background: var(--green-700); color: white; border-color: var(--green-700);
}
.adv-pill .x {
  display: inline-grid; place-items: center;
  width: 10px; height: 10px; opacity: 0.8;
}

.adv-placeholder {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border: 1px dashed var(--line); border-radius: var(--r-md);
  background: var(--paper); color: var(--ink-3); font-size: 13px;
}

.cf-filter-list { display: flex; flex-direction: column; gap: 10px; }
.cf-filter-row {
  display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 10px; align-items: center;
}
.cf-filter-row > label {
  font-family: 'IBM Plex Mono', monospace; font-size: 11px;
  letter-spacing: 0.10em; text-transform: uppercase; color: var(--ink-3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cf-filter-row .field-input,
.cf-filter-row .field-select { font-size: 13.5px; padding: 8px 12px; }

@media (max-width: 600px) {
  .cf-filter-row { grid-template-columns: 1fr; gap: 4px; }
}
.adv-placeholder .tag {
  font-family: 'IBM Plex Mono', monospace; font-size: 10.5px;
  letter-spacing: 0.10em; text-transform: uppercase; color: var(--green-700);
  background: var(--green-50); border: 1px solid var(--green-100);
  padding: 2px 8px; border-radius: 999px; flex: none;
}

.adv-foot {
  margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--line);
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
}
.adv-foot .summary {
  font-family: 'IBM Plex Mono', monospace; font-size: 11.5px; color: var(--ink-3);
  letter-spacing: 0.06em;
}
.adv-foot .summary em { font-style: normal; color: var(--green-700); }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line);
  font-size: 12.5px; color: var(--ink-2); cursor: pointer;
}
.chip:hover { border-color: var(--line-2); }
.chip.active { background: var(--ink); color: white; border-color: var(--ink); }
.chip .count { color: var(--ink-4); font-family: 'IBM Plex Mono', monospace; font-size: 11px; }
.chip.active .count { color: rgba(255,255,255,0.6); }

/* ─── results layout ─── */
.t-results { max-width: none; margin: 0; padding: 32px; display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 36px; }
.t-rail h4 { font-size: 12px; font-family: 'IBM Plex Mono', monospace; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); margin: 24px 0 10px; font-weight: 500; display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.t-rail h4:first-child { margin-top: 0; }
.t-rail h4 .rail-count { font-size: 11px; color: var(--ink-4); letter-spacing: 0.06em; }
.t-rail .rail-filter {
  position: relative; display: flex; align-items: center;
  margin-bottom: 6px;
}
.t-rail .rail-filter svg:first-child {
  position: absolute; left: 8px; top: 50%; transform: translateY(-50%);
  color: var(--ink-4); pointer-events: none;
}
.t-rail .rail-filter input {
  width: 100%; border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface); padding: 6px 26px 6px 26px;
  font: inherit; font-size: 12.5px; color: var(--ink); outline: 0;
  transition: border-color 120ms ease;
}
.t-rail .rail-filter input:focus { border-color: var(--green-300); }
.t-rail .rail-filter input::placeholder { color: var(--ink-4); }
.t-rail .rail-filter-clear {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 20px; height: 20px; border: 0; background: transparent;
  color: var(--ink-4); cursor: pointer; display: grid; place-items: center;
  border-radius: 999px;
}
.t-rail .rail-filter-clear:hover { background: var(--paper); color: var(--ink-2); }
.t-rail ul, .t-rail .rail-list { list-style: none; padding: 0; margin: 0; }
.t-rail .rail-list {
  max-height: calc(100vh - 280px); overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: var(--line-2) transparent;
  padding-right: 6px; margin-right: -6px;
}
.t-rail .rail-list::-webkit-scrollbar { width: 6px; }
.t-rail .rail-list::-webkit-scrollbar-track { background: transparent; }
.t-rail .rail-list::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 999px; }
.t-rail .rail-list::-webkit-scrollbar-thumb:hover { background: var(--ink-4); }
.t-rail li { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; font-size: 13.5px; color: var(--ink-2); cursor: pointer; min-width: 0; }
.t-rail li > span:first-child { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-rail li .n { flex: none; }
.t-rail li:hover { color: var(--green-700); }
.t-rail li.active { color: var(--green-900); font-weight: 500; }
.t-rail li .n { color: var(--ink-4); font-family: 'IBM Plex Mono', monospace; font-size: 12px; }

.t-results-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 18px; }
.t-results-head .count { font-family: 'Newsreader', serif; font-size: 22px; }
.t-results-head .count em { font-style: normal; color: var(--green-700); }
.t-toggle { display: inline-flex; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-md); padding: 3px; gap: 2px; }
.t-toggle button { border:0; background: transparent; padding: 6px 12px; border-radius: 6px; font-size: 13px; color: var(--ink-2); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.t-toggle button.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }

/* ─── cards ─── */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 18px 20px 16px;
  display: flex; flex-direction: column; gap: 10px;
  transition: all 160ms ease;
  cursor: pointer; position: relative;
}
.card:hover { border-color: var(--green-300); transform: translateY(-1px); box-shadow: var(--shadow-2); }
.card .id { position: absolute; top: 14px; right: 16px; font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--ink-4); }
.card .specimen {
  width: 56px; height: 56px; border-radius: 12px;
  background: var(--green-50); border: 1px solid var(--line);
  display: grid; place-items: center; font-family: 'Noto Serif SC', serif;
  font-size: 22px; color: var(--green-700);
  flex: none; overflow: hidden;
}
.card .specimen.has-img { background: var(--paper); padding: 4px; }
.card .specimen.has-img img {
  width: 100%; height: 100%; object-fit: contain;
}
.card-head { display: flex; gap: 14px; align-items: flex-start; }
.card-head .titles { min-width: 0; }
.card .pinyin { font-family: 'Newsreader', serif; font-size: 19px; line-height: 1.2; color: var(--ink); }
.card .latin { font-style: italic; color: var(--ink-3); font-size: 13px; margin-top: 2px; }
.card .han { font-family: 'Noto Serif SC', serif; font-size: 14px; color: var(--ink-2); margin-top: 6px; letter-spacing: 0.05em; }
.card .tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 6px;
  background: var(--green-50); color: var(--green-900);
  font-size: 12px; border: 1px solid var(--green-100);
  align-self: flex-start;
}
.card .tag.amber { background: var(--amber-100); color: #6B4A0F; border-color: rgba(0,0,0,0.06); }
.card .tag.terra { background: oklch(0.96 0.04 50); color: var(--terra); border-color: rgba(0,0,0,0.06); }
.card-foot {
  margin-top: auto; padding-top: 12px; border-top: 1px dashed var(--line);
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12.5px; color: var(--ink-3);
}
.card-foot .arrow { color: var(--green-700); display: inline-flex; align-items: center; gap: 4px; }

/* list view rows */
.row {
  display: grid; grid-template-columns: 64px 2fr 1.4fr 1fr 100px 28px;
  gap: 16px; align-items: center;
  padding: 14px 16px; background: var(--surface);
  border: 1px solid var(--line); border-bottom: none;
}
.row:first-child { border-radius: var(--r-md) var(--r-md) 0 0; }
.row:last-child { border-radius: 0 0 var(--r-md) var(--r-md); border-bottom: 1px solid var(--line); }
.row:hover { background: var(--paper); }
.row .num { font-family: 'IBM Plex Mono', monospace; font-size: 12px; color: var(--ink-4); }

/* ─── detail page ─── */
.detail-wrap { max-width: none; margin: 0; padding: 28px 32px 80px; }
.crumbs { font-size: 13px; color: var(--ink-3); margin-bottom: 22px; display:flex; align-items:center; gap:8px; }
.crumbs .sep { color: var(--ink-4); }

.detail-hero {
  display: grid; grid-template-columns: 220px minmax(0, 1fr) auto; gap: 36px;
  padding: 28px 0 32px;
  border-bottom: 1px solid var(--line);
}
.detail-hero > * { min-width: 0; max-width: 100%; }
.detail-id { overflow: hidden; min-width: 0; max-width: 100%; }
.detail-actions { overflow: visible; min-width: 0; max-width: 100%; }
.detail-id > * { max-width: 100%; }
.detail-id .pinyin-roman { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.detail-id .han { overflow-wrap: anywhere; word-break: break-word; max-width: 100%; }
.detail-id .latin { overflow-wrap: anywhere; word-break: break-word; max-width: 100%; }
.detail-id h1 { overflow-wrap: anywhere; word-break: break-word; max-width: 100%; }
.tcm * { max-width: 100%; }
.tcm img, .tcm svg { max-width: 100%; height: auto; }
.specimen-large {
  width: 220px; height: 220px; border-radius: var(--r-lg);
  background: linear-gradient(160deg, var(--paper) 0%, var(--paper-2) 100%);
  border: 1px solid var(--line);
  display: grid; place-items: center;
  font-family: 'Noto Serif SC', serif; font-size: 88px; color: var(--green-700);
  position: relative; overflow: hidden;
}
.specimen-large::after {
  content: ''; position: absolute; inset: 0;
  background-image: repeating-linear-gradient(45deg, rgba(0,0,0,0.02) 0 1px, transparent 1px 9px);
  pointer-events: none;
}
.specimen-large .label {
  position: absolute; bottom: 10px; left: 12px; right: 12px;
  font-family: 'IBM Plex Mono', monospace; font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink-4);
}

.detail-id .kicker { font-family: 'IBM Plex Mono', monospace; font-size: 11.5px; letter-spacing: 0.16em; color: var(--green-700); text-transform: uppercase; }
.detail-id h1 { font-size: 36px; margin: 8px 0 4px; line-height: 1.1; }
.detail-id .latin { font-style: italic; color: var(--ink-3); font-size: 16px; }
.detail-id .han { font-family: 'Noto Serif SC', serif; font-size: 26px; color: var(--green-900); margin-top: 16px; letter-spacing: 0.04em; }
.detail-id .pinyin-roman { color: var(--ink-3); font-size: 13.5px; margin-top: 4px; font-family: 'IBM Plex Mono', monospace; }
.detail-id .meta-row { display: flex; gap: 18px; margin-top: 18px; flex-wrap: wrap; font-size: 13px; color: var(--ink-3); }
.detail-id .meta-row b { color: var(--ink); font-weight: 500; }

.detail-actions { display: flex; flex-direction: column; gap: 10px; align-items: stretch; min-width: 0; width: 200px; }

.detail-tags { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }

/* tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 32px 0 24px; }
.tabs button {
  background: transparent; border: 0; padding: 12px 18px; font: inherit;
  font-size: 14px; color: var(--ink-3); cursor: pointer; position: relative;
  border-radius: var(--r-sm) var(--r-sm) 0 0;
}
.tabs button:hover { color: var(--ink); }
.tabs button.active { color: var(--green-900); font-weight: 500; }
.tabs button.active::after {
  content:''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--green-700);
}

/* sections */
.sect-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 24px 28px; margin-bottom: 16px;
}
.sect-title { font-family: 'Newsreader', serif; font-size: 20px; margin: 0 0 4px; }
.sect-sub { color: var(--ink-3); font-size: 13.5px; margin-bottom: 16px; }
.sect-card p { color: var(--ink-2); margin: 0 0 12px; }

.related-strip { display: flex; gap: 12px; overflow-x: auto; padding: 4px 2px 8px; }
.related-card {
  flex: none; width: 220px;
  border: 1px solid var(--line); background: var(--surface);
  border-radius: var(--r-md); padding: 14px;
  display: flex; gap: 12px; align-items: center;
  cursor: pointer;
}
.related-card.current { background: var(--amber-100); border-color: rgba(0,0,0,0.08); }
.related-card .specimen { width: 40px; height: 40px; border-radius: 8px; background: var(--green-50); display: grid; place-items: center; font-family: 'Noto Serif SC', serif; color: var(--green-700); font-size: 18px; flex: none; }
.related-card .nm { font-size: 13px; line-height: 1.3; min-width: 0; }
.related-card .nm .pin { font-family: 'Newsreader', serif; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.related-card .nm .id { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--ink-4); }

/* indications grid */
.indications {
  display: grid; grid-template-columns: 200px 1fr; gap: 24px; align-items: start;
}
.indications .label { font-family: 'IBM Plex Mono', monospace; font-size: 11.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); padding-top: 4px; }
.indications p { color: var(--ink-2); margin: 0; max-width: 64ch; }
.div-line { height: 1px; background: var(--line); margin: 22px 0; }

/* contraindication tiles */
.warn-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.warn-tile {
  border: 1px solid var(--line); border-radius: var(--r-md); padding: 16px;
  background: var(--paper); 
}
.warn-tile h5 { margin: 0 0 4px; font-size: 14px; font-weight: 500; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.warn-tile p { margin: 0; font-size: 13px; color: var(--ink-3); }
.warn-tile.empty { background: var(--surface); border-style: dashed; }

/* composition */
.comp-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 24px; align-items: start; }
.comp-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.comp-table th { text-align: left; font-weight: 500; font-family: 'IBM Plex Mono', monospace; font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); padding: 0 0 10px; border-bottom: 1px solid var(--line); }
.comp-table td { padding: 14px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.comp-table .ing-name { font-family: 'Newsreader', serif; font-size: 16px; color: var(--ink); }
.comp-table .ing-han { font-family: 'Noto Serif SC', serif; color: var(--ink-3); font-size: 13px; margin-top: 2px; }
.comp-table .pct { font-family: 'IBM Plex Mono', monospace; color: var(--green-900); font-weight: 500; }
.comp-table tr.total td { border-bottom: 0; padding-top: 16px; }
.comp-table tr.total .lbl { font-weight: 500; }

/* legend variant: full ingredient detail in the donut sidebar */
.comp-stack { display: flex; justify-content: center; }
.comp-stack .donut-wrap {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 36px;
  align-items: center; max-width: 820px; width: 100%;
  flex-direction: row;          /* override default column flex on .donut-wrap */
  align-items: center;          /* keep both centered */
}
.comp-stack .donut { flex: none; }
.donut-legend.rich {
  display: flex; flex-direction: column; gap: 0;
  border-top: 1px dashed var(--line);
}
.donut-legend.rich .lg-row {
  display: grid; grid-template-columns: 12px minmax(0, 1fr) auto;
  gap: 12px; align-items: start;
  padding: 12px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 13.5px;
}
.donut-legend.rich .lg-row:last-child { border-bottom: 0; }
.donut-legend.rich .sw {
  width: 10px; height: 10px; border-radius: 3px; flex: none; margin-top: 7px;
}
.donut-legend.rich .lg-text { min-width: 0; }
.donut-legend.rich .lg-line {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  min-width: 0;
}
.donut-legend.rich .lg-name {
  font-family: 'Newsreader', serif; font-size: 16px; color: var(--ink); line-height: 1.2;
}
.donut-legend.rich .lg-han {
  font-family: 'Noto Serif SC', serif; font-size: 14px; color: var(--ink-2);
  letter-spacing: 0.04em;
}
.donut-legend.rich .lg-sub {
  font-family: 'IBM Plex Mono', monospace; font-size: 12px; color: var(--ink-3);
  letter-spacing: 0.04em; margin-top: 2px;
}
.donut-legend.rich .lg-pct {
  font-family: 'IBM Plex Mono', monospace; color: var(--green-900);
  font-weight: 500; font-size: 13px; letter-spacing: 0.04em;
  align-self: center; white-space: nowrap;
}
.donut-legend.rich .lg-row.total .lg-name { font-weight: 500; }

@media (max-width: 700px) {
  .comp-stack .donut-wrap { grid-template-columns: 1fr; gap: 18px; }
}

.donut-wrap {
  background: var(--paper); border-radius: var(--r-lg); padding: 24px;
  display: flex; flex-direction: column; align-items: center;
}
.donut { position: relative; width: 280px; height: 280px; }
.donut .center { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.donut .center .lab { font-family: 'IBM Plex Mono', monospace; font-size: 10px; letter-spacing: 0.16em; color: var(--ink-3); text-transform: uppercase; }
.donut .center .val { font-family: 'Newsreader', serif; font-size: 28px; color: var(--green-900); }
.donut-legend { width: 100%; margin-top: 18px; display: grid; gap: 8px; }
.donut-legend .lg-row { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--ink-2); }
.donut-legend .sw { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.donut-legend .name { flex: 1; }
.donut-legend .pct { font-family: 'IBM Plex Mono', monospace; color: var(--ink-3); font-size: 12px; }

/* misc */
.kbd { font-family: 'IBM Plex Mono', monospace; font-size: 11px; padding: 2px 6px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; background: var(--surface); color: var(--ink-3); }

.divider-soft { height: 1px; background: linear-gradient(90deg, transparent, var(--line), transparent); margin: 36px 0; }

/* card variant: with image */
.card.with-image .image-band {
  margin: -18px -20px 12px;
  height: 140px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  display: grid; place-items: center;
  position: relative; overflow: hidden;
}
.card.with-image .image-band img {
  width: 100%; height: 100%; object-fit: contain;
  padding: 10px;
  transition: transform 200ms ease;
}
.card.with-image:hover .image-band img { transform: scale(1.03); }

/* mobile-only category dropdown — replaces the .t-rail on small screens */
.mobile-filters, .mobile-tabs { display: none; }
.mobile-filter-label {
  display: block;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 6px;
  font-weight: 500;
}
.mobile-filter-select {
  width: 100%;
  padding: 11px 36px 11px 14px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  -webkit-appearance: none;
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--ink-3) 50%),
    linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 16px,
    calc(100% - 13px) 16px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.mobile-filter-select:focus { outline: 2px solid var(--green-700); outline-offset: -1px; }

/* dense list rows */
.dense-row {
  display: grid; grid-template-columns: 80px 2fr 1.6fr 1fr 100px;
  gap: 16px; padding: 12px 16px;
  border-bottom: 1px solid var(--line); align-items: center;
  font-size: 13.5px;
}
.dense-row:hover { background: var(--paper); }
.dense-row .pin { font-family: 'Newsreader', serif; font-size: 15px; }
.dense-row .han { font-family: 'Noto Serif SC', serif; color: var(--ink-3); }
.dense-row .lat { font-style: italic; color: var(--ink-3); }
.dense-thumb {
  width: 44px; height: 44px; border-radius: 8px;
  background: var(--green-50); border: 1px solid var(--line);
  display: grid; place-items: center; flex: none;
  font-family: 'Noto Serif SC', serif; color: var(--green-700);
  font-size: 18px; overflow: hidden;
}
.dense-thumb.has-img { background: var(--paper); padding: 3px; }
.dense-thumb.has-img img { width: 100%; height: 100%; object-fit: contain; }

/* ─── responsive: tablet (≤ 1024px) ─── */
@media (max-width: 1024px) {
  .t-topbar { padding: 0 20px; height: auto; min-height: 56px; flex-wrap: wrap; gap: 8px 12px; padding-top: 10px; padding-bottom: 10px; }
  .t-nav { margin-left: 0; gap: 18px; flex-wrap: wrap; }
  .t-nav a.active::after { bottom: -10px; }

  .t-hero { padding: 36px 20px 28px; }
  /* Below tablet, the long hero claim no longer fits on one line — let it wrap. */
  .t-hero h1 { font-size: 28px; line-height: 1.15; white-space: normal; }
  .t-hero .sub { font-size: 14px; margin-bottom: 20px; }

  .t-results {
    grid-template-columns: 1fr;
    gap: 24px;
    padding: 24px 20px;
  }
  .t-rail { display: none; }
  .mobile-filters { display: block; margin-bottom: 18px; }

  .detail-wrap { padding: 20px 20px 60px; }
  .detail-hero {
    grid-template-columns: 160px minmax(0, 1fr);
    gap: 22px;
    padding: 20px 0 24px;
  }
  .specimen-large { width: 160px; height: 160px; font-size: 64px; }
  .detail-id h1 { font-size: 28px; }
  .detail-id .han { font-size: 22px; margin-top: 12px; }
  .detail-actions { grid-column: 1 / -1; width: 100%; flex-direction: row; flex-wrap: wrap; min-width: 0; }
  .detail-actions > * { flex: 1 1 calc(50% - 6px); min-width: 0; }
  .detail-actions .btn { width: 100%; min-width: 0; justify-content: center; }

  .indications { grid-template-columns: 1fr; gap: 8px; }
  .indications .label { padding-top: 0; }

  .comp-grid { grid-template-columns: 1fr; gap: 20px; }
  .donut-wrap { padding: 18px; }
  .donut { width: 240px; height: 240px; }
}

/* ─── responsive: phone (≤ 640px) ─── */
@media (max-width: 640px) {
  .tcm { font-size: 14px; }

  .t-topbar { padding: 8px 14px; }
  .t-logo { font-size: 18px; }
  .t-logo-mark { width: 26px; height: 26px; font-size: 13px; }
  .t-nav { gap: 14px; font-size: 13px; }

  .t-hero { padding: 28px 16px 22px; }
  .t-eyebrow { font-size: 10px; margin-bottom: 10px; }
  .t-hero h1 { font-size: 23px; }
  .t-hero .sub { font-size: 13px; margin-bottom: 16px; }

  .searchbar {
    flex-direction: column;
    border-radius: var(--r-md);
    padding: 8px;
    gap: 6px;
  }
  .searchbar .scope {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 8px 10px;
    width: 100%;
    justify-content: space-between;
  }
  .searchbar input { padding: 10px 12px; font-size: 15px; }
  .searchbar .btn-amber { width: 100%; justify-content: center; }
  .btn-lg { padding: 11px 16px; font-size: 14px; }

  .t-chips { gap: 6px; margin-top: 14px; }
  .chip { padding: 5px 10px; font-size: 11.5px; }

  .t-results { padding: 20px 14px; gap: 18px; }
  .t-rail ul { grid-template-columns: 1fr; }

  .t-results-head { flex-direction: column; align-items: flex-start; gap: 10px; }
  .t-results-head .count { font-size: 18px; }

  .cards-grid { grid-template-columns: 1fr; gap: 12px; }
  .card { padding: 14px 16px 12px; }
  .card .pinyin { font-size: 17px; }

  .dense-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px 12px;
    padding: 12px 14px;
    align-items: start;
  }
  .dense-row > :nth-child(1) { grid-column: 1; grid-row: 1; }
  .dense-row > :nth-child(2) { grid-column: 1 / -1; grid-row: 2; }
  .dense-row > :nth-child(3) { grid-column: 1 / -1; grid-row: 3; }
  .dense-row > :nth-child(4) { grid-column: 1 / -1; grid-row: 4; color: var(--ink-3); font-size: 12.5px; }
  .dense-row > :nth-child(5) { grid-column: 2; grid-row: 1; text-align: right; }

  .detail-wrap { padding: 16px 14px 40px; }
  .crumbs { margin-bottom: 14px; flex-wrap: wrap; }

  .detail-hero {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
    padding: 12px 0 20px;
  }
  .specimen-large {
    width: 100%; height: 180px;
    font-size: 72px;
    border-radius: var(--r-md);
  }
  .detail-id .kicker { font-size: 10.5px; }
  .detail-id h1 { font-size: 24px; margin-top: 6px; }
  .detail-id .latin { font-size: 14px; }
  .detail-id .han { font-size: 20px; margin-top: 10px; }
  .detail-id .meta-row { gap: 10px; font-size: 12.5px; }
  .detail-actions { flex-direction: column; align-items: stretch; min-width: 0; width: 100%; }
  .detail-actions > * { flex: 0 0 auto; width: 100%; min-width: 0; }
  .detail-actions .btn { width: 100%; min-width: 0; justify-content: center; }

  .tabs { display: none; }
  .mobile-tabs { display: block; margin: 18px 0 14px; }

  .sect-card { padding: 18px 16px; border-radius: var(--r-md); }
  .sect-title { font-size: 18px; }

  .warn-grid { grid-template-columns: 1fr; }

  .related-strip {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    overflow-x: visible;
    padding: 0;
  }
  .related-card { width: 100%; padding: 12px; }
  .related-card .nm .pin { white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; word-break: break-word; }

  .comp-table th, .comp-table td { font-size: 13px; }
  .comp-table .ing-name { font-size: 15px; }
  .donut { width: 220px; height: 220px; }
  .donut-legend .lg-row { font-size: 12.5px; }
}

/* ─── auth pages ─── */
.t-auth {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  padding: 64px 24px;
  background:
    radial-gradient(900px 320px at 50% -10%, var(--green-50), transparent 70%),
    var(--bg);
}
.auth-shell { width: 100%; max-width: 440px; }

.auth-head { text-align: center; margin-bottom: 28px; }
.auth-mark {
  width: 60px; height: 60px; border-radius: 14px;
  background: var(--green-50); border: 1px solid var(--line);
  display: grid; place-items: center;
  font-family: 'Noto Serif SC', serif; font-size: 30px; color: var(--green-700);
  margin: 0 auto 18px;
}
.auth-eyebrow {
  font-family: 'IBM Plex Mono', monospace; font-size: 11px;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--green-700); margin-bottom: 10px;
}
.auth-head h1 {
  font-family: 'Newsreader', serif; font-size: 30px; line-height: 1.15;
  margin: 0 0 8px; color: var(--ink); font-weight: 500;
}
.auth-head p { color: var(--ink-3); font-size: 14.5px; margin: 0; }

.auth-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 28px;
  box-shadow: var(--shadow-2);
}

.auth-field { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.auth-field-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.auth-label {
  font-family: 'IBM Plex Mono', monospace; font-size: 11px;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3);
}
.auth-link { color: var(--green-700); font-size: 13px; text-decoration: none; }
.auth-link:hover { color: var(--green-900); text-decoration: underline; }

.auth-input {
  width: 100%; border: 1px solid var(--line-2); border-radius: var(--r-md);
  background: var(--surface); padding: 11px 14px;
  font: inherit; font-size: 15px; color: var(--ink);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.auth-input:focus {
  outline: 0; border-color: var(--green-600);
  box-shadow: 0 0 0 3px var(--green-100);
}
.auth-input::placeholder { color: var(--ink-4); }
.auth-validation { color: oklch(0.55 0.18 25); font-size: 12.5px; }

.auth-check {
  display: flex; align-items: center; gap: 10px;
  margin: 4px 0 22px; font-size: 13.5px; color: var(--ink-2);
  cursor: pointer; user-select: none;
}
.auth-check input[type="checkbox"] {
  width: 16px; height: 16px; accent-color: var(--green-700);
  cursor: pointer; margin: 0;
}

.auth-submit { width: 100%; justify-content: center; }

.auth-divider {
  display: flex; align-items: center; gap: 14px;
  margin: 22px 0 18px; color: var(--ink-4);
  font-family: 'IBM Plex Mono', monospace; font-size: 11px;
  letter-spacing: 0.12em; text-transform: uppercase;
}
.auth-divider::before, .auth-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--line);
}

.auth-providers { display: flex; flex-direction: column; gap: 8px; }
.auth-providers .btn { width: 100%; justify-content: center; }

.auth-alert {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px; border-radius: var(--r-md);
  background: oklch(0.97 0.04 28); border: 1px solid oklch(0.86 0.09 28);
  color: oklch(0.42 0.14 28); font-size: 13.5px; margin-bottom: 18px;
}
.auth-alert svg { flex: none; margin-top: 2px; }

.auth-foot {
  margin-top: 22px; text-align: center; font-size: 13.5px; color: var(--ink-3);
}
.auth-foot .auth-link { font-weight: 500; }

.auth-aside {
  margin-top: 16px; padding-top: 16px;
  border-top: 1px dashed var(--line);
  text-align: center; font-size: 12.5px; color: var(--ink-4);
}
.auth-aside a { color: var(--ink-3); text-decoration: none; }
.auth-aside a:hover { color: var(--green-700); }

.auth-trust {
  margin-top: 22px; display: flex; justify-content: center; gap: 18px;
  font-family: 'IBM Plex Mono', monospace; font-size: 10.5px;
  letter-spacing: 0.10em; text-transform: uppercase; color: var(--ink-4);
}
.auth-trust span { display: inline-flex; align-items: center; gap: 6px; }

@media (max-width: 560px) {
  .t-auth { padding: 36px 16px; }
  .auth-card { padding: 22px 18px; }
  .auth-head h1 { font-size: 26px; }
  .auth-mark { width: 52px; height: 52px; font-size: 26px; }
}

/* ─── admin dashboard ─── */
.t-admin {
  max-width: 1280px; margin: 0 auto; padding: 36px 32px 56px;
}

.admin-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 24px; margin-bottom: 24px; flex-wrap: wrap;
}
.admin-head .titles { min-width: 0; }
.admin-head .eyebrow {
  font-family: 'IBM Plex Mono', monospace; font-size: 11px;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--green-700); margin-bottom: 6px;
}
.admin-head h1 {
  font-family: 'Newsreader', serif; font-size: 34px; line-height: 1.1;
  margin: 0 0 6px; font-weight: 500; color: var(--ink);
}
.admin-head p { color: var(--ink-3); font-size: 14.5px; margin: 0; }
.admin-head .meta { text-align: right; min-width: 200px; }
.admin-head .meta .l {
  font-family: 'IBM Plex Mono', monospace; font-size: 11px;
  letter-spacing: 0.10em; text-transform: uppercase; color: var(--ink-4);
}
.admin-head .meta .v { color: var(--ink-2); font-size: 14px; margin-top: 2px; }

.section { margin-top: 36px; }
.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 14px; gap: 12px;
}
.section-eyebrow {
  font-family: 'IBM Plex Mono', monospace; font-size: 11px;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-3);
}
.section-title {
  font-family: 'Newsreader', serif; font-size: 20px; color: var(--ink);
  margin: 0; font-weight: 500;
}

/* stat strip */
.stat-strip {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px;
}
.stat-tile {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; min-width: 0;
}
.stat-tile .label {
  font-family: 'IBM Plex Mono', monospace; font-size: 11px;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3);
}
.stat-tile .value {
  font-family: 'Newsreader', serif; font-size: 30px; line-height: 1.05;
  color: var(--ink); font-variant-numeric: tabular-nums; font-weight: 500;
}
.stat-tile .value.sm { font-size: 18px; line-height: 1.25; }
.stat-tile .delta {
  font-size: 12.5px; color: var(--ink-3); margin-top: 2px;
  display: inline-flex; align-items: center; gap: 6px;
}
.stat-tile .delta.pos { color: var(--green-700); }

/* quick action grid */
.quick-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.quick-tile {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 14px 16px; display: flex; align-items: center; gap: 12px;
  font-size: 13.5px; color: var(--ink); cursor: pointer;
  transition: all 140ms ease; text-align: left;
  font-family: inherit;
}
.quick-tile:hover { border-color: var(--green-300); transform: translateY(-1px); box-shadow: var(--shadow-2); }
.quick-tile:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }
.quick-tile .qmark {
  width: 32px; height: 32px; flex: none; border-radius: 8px;
  background: var(--green-50); color: var(--green-700);
  display: grid; place-items: center;
}
.quick-tile.amber .qmark { background: var(--amber-100); color: #6B4A0F; }
.quick-tile.plum .qmark { background: oklch(0.94 0.04 350); color: var(--plum); }

/* admin two-up cards */
.admin-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.admin-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 22px 24px;
}
.admin-card .ac-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; margin-bottom: 14px;
}
.admin-card .ac-head h3 {
  font-family: 'Newsreader', serif; font-size: 19px; font-weight: 500;
  color: var(--ink); margin: 0 0 4px;
}
.admin-card .ac-head .desc { color: var(--ink-3); font-size: 13.5px; margin: 0; }
.admin-card .ac-head .ac-pill {
  flex: none;
  display: inline-flex; align-items: center; gap: 6px;
  font-family: 'IBM Plex Mono', monospace; font-size: 11px;
  letter-spacing: 0.10em; text-transform: uppercase; color: var(--green-700);
}
.admin-card .ac-head .ac-pill .dot {
  width: 7px; height: 7px; border-radius: 999px; background: var(--green-600);
}

.kpi-row {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px; padding: 14px; border: 1px dashed var(--line);
  background: var(--paper); border-radius: var(--r-md); margin-bottom: 18px;
}
.kpi-row .k { text-align: center; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.kpi-row .k .v {
  font-family: 'Newsreader', serif; font-size: 22px; color: var(--ink);
  font-variant-numeric: tabular-nums; font-weight: 500;
}
.kpi-row .k .l {
  font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--ink-3);
  letter-spacing: 0.08em; text-transform: uppercase;
}

.admin-alert {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px 16px; border-radius: var(--r-md); margin-bottom: 18px;
  background: oklch(0.97 0.04 28); border: 1px solid oklch(0.86 0.09 28);
  color: oklch(0.42 0.14 28); font-size: 13.5px;
}
.admin-alert svg { flex: none; margin-top: 2px; }
.admin-alert h4 {
  font-family: 'IBM Plex Mono', monospace; text-transform: uppercase;
  letter-spacing: 0.10em; font-size: 11px; margin: 0 0 4px; font-weight: 500;
}

.field-stack { display: flex; flex-direction: column; gap: 10px; }
.field-input,
.field-select {
  width: 100%; border: 1px solid var(--line-2); border-radius: var(--r-md);
  background: var(--surface); padding: 10px 12px;
  font: inherit; font-size: 14px; color: var(--ink);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.field-input:focus,
.field-select:focus {
  outline: 0; border-color: var(--green-600);
  box-shadow: 0 0 0 3px var(--green-100);
}
.field-input::placeholder { color: var(--ink-4); }

/* status list */
.status-list { display: flex; flex-direction: column; }
.status-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0; border-bottom: 1px dashed var(--line);
  font-size: 13.5px; color: var(--ink-2);
}
.status-row:last-child { border-bottom: 0; }
.status-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px; font-size: 11.5px;
  font-family: 'IBM Plex Mono', monospace; letter-spacing: 0.06em;
}
.status-pill.ok { background: var(--green-50); color: var(--green-900); border: 1px solid var(--green-100); }
.status-pill.warn { background: var(--amber-100); color: #6B4A0F; border: 1px solid rgba(0,0,0,0.06); }
.status-pill.err { background: oklch(0.96 0.04 28); color: oklch(0.45 0.16 28); border: 1px solid oklch(0.85 0.08 28); }
.status-pill .dot { width: 7px; height: 7px; border-radius: 999px; }
.status-pill.ok .dot { background: var(--green-600); }
.status-pill.warn .dot { background: var(--amber-600); }
.status-pill.err .dot { background: oklch(0.55 0.20 28); }

/* perf grid */
.perf-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.perf-cell {
  text-align: center; padding: 14px 12px; border: 1px dashed var(--line);
  background: var(--paper); border-radius: var(--r-md);
}
.perf-cell .v {
  font-family: 'Newsreader', serif; font-size: 24px; color: var(--green-700);
  font-variant-numeric: tabular-nums; font-weight: 500;
}
.perf-cell .l {
  font-family: 'IBM Plex Mono', monospace; font-size: 10.5px; color: var(--ink-3);
  letter-spacing: 0.10em; text-transform: uppercase; margin-top: 2px;
}

/* activity list */
.activity-list { display: flex; flex-direction: column; }
.activity-item {
  display: flex; gap: 12px; padding: 14px 0;
  border-bottom: 1px dashed var(--line);
}
.activity-item:last-child { border-bottom: 0; padding-bottom: 0; }
.activity-item:first-child { padding-top: 0; }
.activity-item .a-mark {
  width: 30px; height: 30px; border-radius: 8px; flex: none;
  display: grid; place-items: center; border: 1px solid transparent;
}
.activity-item .a-mark.ok { background: var(--green-50); color: var(--green-700); border-color: var(--green-100); }
.activity-item .a-mark.info { background: oklch(0.96 0.03 230); color: oklch(0.45 0.13 230); border-color: oklch(0.90 0.05 230); }
.activity-item .a-mark.warn { background: var(--amber-100); color: #6B4A0F; }
.activity-item .a-mark.err { background: oklch(0.96 0.04 28); color: oklch(0.45 0.16 28); border-color: oklch(0.88 0.07 28); }
.activity-item .a-body { min-width: 0; flex: 1; }
.activity-item .a-msg { font-size: 13.5px; color: var(--ink); line-height: 1.4; }
.activity-item .a-time {
  font-size: 11px; color: var(--ink-4);
  font-family: 'IBM Plex Mono', monospace; letter-spacing: 0.06em;
  text-transform: uppercase; margin-top: 3px;
}
.activity-empty {
  text-align: center; padding: 36px 0; color: var(--ink-4); font-size: 13.5px;
}

.admin-content-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }

.admin-loading {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 80px 0; gap: 14px; color: var(--ink-3);
}
.admin-loading .spinner {
  width: 28px; height: 28px; border-radius: 999px;
  border: 2px solid var(--line); border-top-color: var(--green-700);
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 1024px) {
  .stat-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quick-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .admin-grid-2 { grid-template-columns: 1fr; }
  .admin-content-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .t-admin { padding: 24px 16px 36px; }
  .admin-head h1 { font-size: 26px; }
  .stat-strip { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-tile { padding: 14px 16px; }
  .stat-tile .value { font-size: 24px; }
  .quick-grid { grid-template-columns: 1fr 1fr; }
  .admin-card { padding: 18px; }
  .kpi-row .k .v { font-size: 19px; }
}

/* ─── content pages (list views) ─── */
.t-page { max-width: 1280px; margin: 0 auto; padding: 36px 32px 56px; }

.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 24px; margin-bottom: 24px; flex-wrap: wrap;
}
.page-head .titles { min-width: 0; }
.page-head .eyebrow {
  font-family: 'IBM Plex Mono', monospace; font-size: 11px;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--green-700); margin-bottom: 6px;
}
.page-head h1 {
  font-family: 'Newsreader', serif; font-size: 32px; line-height: 1.1;
  margin: 0 0 6px; font-weight: 500; color: var(--ink);
}
.page-head p { color: var(--ink-3); font-size: 14.5px; margin: 0; max-width: 580px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* link-coverage panel */
.link-status {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 20px 24px; margin-bottom: 18px;
}
.link-status .ls-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; margin-bottom: 14px; flex-wrap: wrap;
}
.link-status .ls-head h3 {
  font-family: 'Newsreader', serif; font-size: 17px; font-weight: 500;
  color: var(--ink); margin: 0;
}
.link-status .ls-head .total {
  font-family: 'IBM Plex Mono', monospace; font-size: 11.5px;
  color: var(--ink-3); letter-spacing: 0.04em;
}
.link-bar {
  display: flex; height: 10px; border-radius: 999px; overflow: hidden;
  background: var(--paper-2); border: 1px solid var(--line); margin-bottom: 12px;
}
.link-bar .seg-ok { background: var(--green-600); }
.link-bar .seg-bad { background: oklch(0.65 0.18 28); }
.ls-legend {
  display: flex; flex-wrap: wrap; gap: 22px; align-items: center;
  font-size: 13px; color: var(--ink-2);
}
.ls-legend .lg { display: inline-flex; align-items: center; gap: 8px; }
.ls-legend .swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.ls-legend .swatch.ok { background: var(--green-600); }
.ls-legend .swatch.bad { background: oklch(0.65 0.18 28); }
.ls-legend .pct { color: var(--ink-4); font-family: 'IBM Plex Mono', monospace; font-size: 11.5px; }
.ls-legend .grow { flex: 1; }

.completion-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: 999px;
  font-family: 'IBM Plex Mono', monospace; font-size: 11px;
  letter-spacing: 0.08em; text-transform: uppercase;
  border: 1px solid transparent;
}
.completion-pill.full { background: var(--green-50); color: var(--green-900); border-color: var(--green-100); }
.completion-pill.near { background: var(--amber-100); color: #6B4A0F; }
.completion-pill.partial { background: oklch(0.95 0.06 50); color: var(--terra); border-color: rgba(0,0,0,0.06); }
.completion-pill.low { background: oklch(0.96 0.04 28); color: oklch(0.45 0.16 28); border-color: oklch(0.86 0.07 28); }

/* filter bar */
.filter-bar {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 18px 22px; margin-bottom: 18px;
}
.filter-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 14px; }
.filter-grid .field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.filter-grid label {
  font-family: 'IBM Plex Mono', monospace; font-size: 11px;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3);
}
.filter-grid .with-icon { position: relative; }
.filter-grid .with-icon svg {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--ink-4); pointer-events: none;
}
.filter-grid .with-icon .field-input { padding-left: 36px; }
.filter-clear {
  margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line);
}

/* results bar */
.results-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 14px; flex-wrap: wrap;
}
.results-bar .count {
  font-family: 'Newsreader', serif; font-size: 18px; color: var(--ink);
}
.results-bar .count em { font-style: normal; color: var(--green-700); }
.results-bar .ctrls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* product cards */
.pa-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}
.pa-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 14px; display: flex; flex-direction: column; gap: 10px;
  transition: all 160ms ease; min-width: 0;
}
.pa-card:hover { border-color: var(--green-300); box-shadow: var(--shadow-2); transform: translateY(-1px); }
.pa-image {
  height: 140px; background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--r-md);
  display: grid; place-items: center; overflow: hidden;
}
.pa-image img { max-width: 100%; max-height: 100%; object-fit: contain; }
.pa-image .placeholder { color: var(--ink-4); }
.pa-link-tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: 'IBM Plex Mono', monospace; font-size: 10.5px;
  letter-spacing: 0.10em; text-transform: uppercase;
}
.pa-link-tag.linked { color: var(--green-700); }
.pa-link-tag.unlinked { color: oklch(0.55 0.18 28); }
.pa-link-tag .dot { width: 7px; height: 7px; border-radius: 999px; }
.pa-link-tag.linked .dot { background: var(--green-600); }
.pa-link-tag.unlinked .dot { background: oklch(0.65 0.18 28); }
.pa-name {
  font-family: 'Newsreader', serif; font-size: 16px; line-height: 1.3;
  color: var(--ink); margin: 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.pa-num {
  font-family: 'IBM Plex Mono', monospace; font-size: 12px; color: var(--ink-3);
}
.pa-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.pa-tag {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 4px; font-size: 11px;
  border: 1px solid transparent;
  font-family: 'IBM Plex Mono', monospace; letter-spacing: 0.04em;
}
.pa-tag.unav { background: oklch(0.96 0.04 28); color: oklch(0.45 0.16 28); border-color: oklch(0.86 0.07 28); }
.pa-tag.rx { background: var(--amber-100); color: #6B4A0F; }
.pa-tag.disc { background: var(--paper-2); color: var(--ink-3); border-color: var(--line); }
.pa-price {
  font-family: 'Newsreader', serif; font-size: 18px; color: var(--green-700);
  font-variant-numeric: tabular-nums; font-weight: 500;
}
.pa-foot {
  margin-top: auto; padding-top: 10px; border-top: 1px dashed var(--line);
  display: flex; gap: 8px;
}

/* product list */
.pa-table {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  overflow: hidden;
}
.pa-table .pa-grid-row {
  display: grid;
  grid-template-columns: 40px 56px minmax(0, 1fr) 160px 180px 110px 100px;
  gap: 14px; align-items: center; padding: 12px 20px;
}
.pa-table .pa-head {
  background: var(--paper); border-bottom: 1px solid var(--line);
  font-family: 'IBM Plex Mono', monospace; font-size: 11px;
  letter-spacing: 0.10em; text-transform: uppercase; color: var(--ink-3);
}
.pa-table .pa-row { border-bottom: 1px dashed var(--line); font-size: 14px; }
.pa-table .pa-row:last-child { border-bottom: 0; }
.pa-table .pa-row:hover { background: var(--bg); }
.pa-thumb {
  width: 40px; height: 40px; border-radius: 8px;
  background: var(--paper); border: 1px solid var(--line);
  display: grid; place-items: center; overflow: hidden;
}
.pa-thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.pa-row .pa-name { font-size: 15px; }

.empty-state {
  text-align: center; padding: 60px 24px;
  background: var(--surface); border: 1px dashed var(--line); border-radius: var(--r-lg);
}
.empty-state .ic {
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--paper); display: grid; place-items: center;
  color: var(--ink-4); margin: 0 auto 14px;
}
.empty-state h3 {
  font-family: 'Newsreader', serif; font-size: 19px; font-weight: 500;
  margin: 0 0 6px; color: var(--ink);
}
.empty-state p { color: var(--ink-3); font-size: 14px; margin: 0 0 16px; }

@media (max-width: 1024px) {
  .filter-grid { grid-template-columns: 1fr; }
  .pa-table .pa-grid-row {
    grid-template-columns: 32px 48px minmax(0, 1fr) 120px 100px;
  }
  .pa-table .col-num,
  .pa-table .col-actions { display: none; }
}
@media (max-width: 640px) {
  .t-page { padding: 24px 16px 36px; }
  .page-head h1 { font-size: 26px; }
  .pa-table .pa-head { display: none; }
  .pa-table .pa-row {
    grid-template-columns: 40px 1fr;
    grid-auto-flow: row;
    gap: 8px 14px;
    padding: 14px 16px;
  }
  .pa-table .col-status { display: none; }
}

/* ─── breadcrumb ─── */
.breadcrumb {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 12px; color: var(--ink-3); margin-bottom: 18px;
  font-family: 'IBM Plex Mono', monospace; letter-spacing: 0.06em;
}
.breadcrumb a { color: var(--ink-3); text-decoration: none; }
.breadcrumb a:hover { color: var(--green-700); }
.breadcrumb .sep { color: var(--ink-4); }
.breadcrumb .current { color: var(--ink-2); text-transform: none; letter-spacing: 0; font-family: 'Newsreader', serif; font-size: 13px; }

/* ─── mode banner ─── */
.mode-banner {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 16px; border-radius: var(--r-md);
  background: var(--amber-100); border: 1px solid rgba(0,0,0,0.06);
  color: #5C3D08; font-size: 13.5px; margin-bottom: 18px;
}
.mode-banner svg { flex: none; margin-top: 2px; }
.mode-banner h4 {
  margin: 0 0 2px; font-family: 'IBM Plex Mono', monospace; font-size: 11px;
  letter-spacing: 0.12em; text-transform: uppercase; font-weight: 500;
}
.mode-banner.ok { background: var(--green-50); border-color: var(--green-100); color: var(--green-900); }

/* ─── form card ─── */
.form-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 28px;
}
.form-rows { display: flex; flex-direction: column; gap: 18px; }
.form-row { min-width: 0; }
.form-row .row-label {
  display: flex; align-items: baseline; gap: 10px;
  font-family: 'IBM Plex Mono', monospace; font-size: 11px;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3);
  margin-bottom: 8px;
}
.form-row .row-label .req { color: oklch(0.55 0.18 28); font-family: inherit; }
.form-row .row-label .source-tag {
  font-family: 'IBM Plex Mono', monospace; font-size: 10px;
  color: var(--green-700); letter-spacing: 0.10em;
  border: 1px solid var(--green-100); background: var(--green-50);
  padding: 1px 6px; border-radius: 4px;
}
.form-row .row-label .han {
  font-family: 'Noto Serif SC', serif; font-size: 12px; color: var(--ink-4);
  letter-spacing: 0.08em; text-transform: none;
}
.input-row { display: flex; gap: 8px; align-items: stretch; min-width: 0; }
.input-row .field-input { flex: 1; min-width: 0; }
.static-value {
  padding: 11px 14px; border-radius: var(--r-md);
  background: var(--paper); border: 1px solid var(--line);
  color: var(--ink); font-size: 14.5px; min-height: 44px;
}
.static-value.empty { color: var(--ink-4); font-style: italic; }

.translate-all-row {
  margin-top: 4px; padding-top: 14px;
  border-top: 1px dashed var(--line);
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.translate-all-row .hint {
  font-family: 'IBM Plex Mono', monospace; font-size: 11px;
  letter-spacing: 0.06em; color: var(--ink-4);
}

/* translate icon button */
.btn-translate {
  flex: none; padding: 0; width: 44px; min-width: 44px; justify-content: center;
}

/* generic spinner (small) */
.btn-spinner {
  width: 14px; height: 14px; border-radius: 999px;
  border: 2px solid currentColor; border-top-color: transparent;
  animation: spin 0.7s linear infinite; flex: none;
}

/* action bar */
.action-bar {
  margin-top: 26px; padding-top: 20px; border-top: 1px dashed var(--line);
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  flex-wrap: wrap;
}
.action-bar .left, .action-bar .right { display: flex; gap: 8px; flex-wrap: wrap; }

@media (max-width: 640px) {
  .form-card { padding: 20px; }
  .action-bar .left, .action-bar .right { width: 100%; }
  .action-bar .right .btn { flex: 1; justify-content: center; }
}

/* ─── compare grid (/compare page) ─── */
.compare-grid {
  display: grid;
  grid-template-columns: 180px repeat(var(--cols), minmax(0, 1fr));
  gap: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.compare-rail-spacer {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.compare-id-card {
  background: var(--paper); padding: 22px 18px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  text-align: center; min-width: 0;
  border-left: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  position: relative;
}
.compare-id-card:first-child { border-left: 0; }
.compare-id-card .specimen { width: 64px; height: 64px; font-size: 26px; }
.compare-id-card .pinyin {
  font-family: 'Newsreader', serif; font-size: 19px; line-height: 1.2;
  color: var(--ink); font-weight: 500; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%;
}
.compare-id-card .latin { font-style: italic; color: var(--ink-3); font-size: 12.5px; }
.compare-id-card .han {
  font-family: 'Noto Serif SC', serif; font-size: 13px; color: var(--ink-2);
  letter-spacing: 0.05em; margin-top: 2px;
}
.compare-id-card .compare-open {
  margin-top: 6px;
  font-family: 'IBM Plex Mono', monospace; font-size: 11px;
  letter-spacing: 0.06em; color: var(--green-700); text-decoration: none;
}
.compare-id-card .compare-open:hover { color: var(--green-900); text-decoration: underline; }
.compare-remove {
  position: absolute; top: 8px; right: 8px;
  width: 22px; height: 22px; border: 0; background: transparent;
  color: var(--ink-4); cursor: pointer; display: grid; place-items: center;
  border-radius: 999px;
}
.compare-remove:hover { background: var(--paper-2); color: oklch(0.55 0.18 28); }

.compare-section-label {
  grid-column: 1;
  background: var(--paper); padding: 14px 18px;
  border-top: 1px solid var(--line);
  font-family: 'IBM Plex Mono', monospace; font-size: 11px;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3);
  align-self: stretch;
}
.compare-cell {
  padding: 14px 18px; min-width: 0;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
  font-size: 13.5px; color: var(--ink); line-height: 1.55;
  overflow-wrap: anywhere; word-break: break-word;
}
.compare-cell.empty { background: oklch(0.99 0.01 90); color: var(--ink-4); }
.compare-cell .placeholder {
  font-family: 'IBM Plex Mono', monospace; font-size: 13px; color: var(--ink-4);
}
.compare-cell .tcm-tag-row { display: flex; flex-wrap: wrap; gap: 4px; margin: 0; padding: 0; border: 0; }
.compare-cell .tcm-tag { font-size: 12px; padding: 2px 9px; }

/* article-number list inside a compare cell */
.article-number-list { display: flex; flex-wrap: wrap; gap: 6px; }
.article-number {
  font-family: 'IBM Plex Mono', monospace; font-size: 12px;
  color: var(--ink-2); background: var(--paper);
  border: 1px solid var(--line); border-radius: 4px;
  padding: 2px 8px;
}

/* compact composition (donut + list) inside a compare cell */
.comp-mini { display: flex; flex-direction: column; gap: 10px; }
.comp-mini-head { display: flex; align-items: center; gap: 12px; }
.comp-mini-donut {
  position: relative; width: 78px; height: 78px;
  border-radius: 50%;
  flex: none;
}
.comp-mini-donut .hole {
  position: absolute; inset: 16px; border-radius: 50%;
  background: var(--surface);
}
.comp-mini-meta { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.comp-mini-num {
  font-family: 'IBM Plex Mono', monospace; font-size: 12px; color: var(--ink-3);
  letter-spacing: 0.04em;
}
.comp-mini-count {
  font-family: 'IBM Plex Mono', monospace; font-size: 10.5px;
  color: var(--ink-4); letter-spacing: 0.06em; text-transform: uppercase;
}
.comp-mini-list {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 3px;
  font-size: 12.5px; color: var(--ink-2);
}
.comp-mini-list li {
  display: grid; grid-template-columns: 8px minmax(0, 1fr) auto;
  align-items: center; gap: 8px;
  padding: 2px 0;
  border-bottom: 1px dashed transparent;
}
.comp-mini-list .sw {
  width: 8px; height: 8px; border-radius: 2px; flex: none;
}
.comp-mini-list .nm {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0;
}
.comp-mini-list .pct {
  font-family: 'IBM Plex Mono', monospace; font-size: 11.5px; color: var(--ink-3);
}

/* compact modifications list inside a compare cell */
.mod-mini-list {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 6px;
}
.mod-mini-list li {
  display: flex; flex-direction: column; gap: 2px;
  padding: 6px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 12.5px;
}
.mod-mini-list li:last-child { border-bottom: 0; }
.mod-mini-list .diff {
  font-family: 'IBM Plex Mono', monospace; font-size: 11.5px; color: var(--ink-3);
}
.mod-mini-list .diff.add { color: var(--green-700); }
.mod-mini-list .diff.del { color: oklch(0.55 0.16 28); }

@media (max-width: 900px) {
  .compare-grid {
    grid-template-columns: 1fr;
  }
  .compare-rail-spacer { display: none; }
  .compare-id-card { border-left: 0; border-bottom: 1px solid var(--line); }
  .compare-section-label { padding-bottom: 6px; }
  .compare-cell {
    border-left: 0;
    padding-top: 6px; padding-bottom: 12px;
  }
  .compare-cell::before {
    content: attr(data-article); display: block;
    font-family: 'IBM Plex Mono', monospace; font-size: 10.5px;
    color: var(--ink-4); letter-spacing: 0.06em; margin-bottom: 4px;
  }
}

/* search result highlighting (used inside cards/list rows) */
mark {
  background: var(--amber-100); color: inherit;
  padding: 0 2px; border-radius: 3px;
}

/* infinite scroll sentinel + status row */
.infinite-scroll-trigger {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  margin: 22px 0 8px; padding: 18px;
  border: 1px dashed var(--line); border-radius: var(--r-md);
  background: transparent; color: var(--ink-3); font-size: 13px;
}
.infinite-scroll-trigger .spinner {
  width: 16px; height: 16px;
  border: 2px solid var(--line); border-top-color: var(--green-700);
  border-radius: 999px; animation: spin 0.7s linear infinite;
}
.infinite-scroll-end {
  text-align: center; padding: 18px; margin: 22px 0 8px;
  color: var(--ink-4); font-size: 12.5px;
  font-family: 'IBM Plex Mono', monospace; letter-spacing: 0.06em;
}

/* duplicate-detection warning in CreateArticleModal */
.dup-warning {
  display: flex; gap: 10px; align-items: flex-start;
  margin-top: 10px;
  padding: 10px 14px; border-radius: var(--r-md);
  background: var(--amber-100); color: #6B4A0F;
  border: 1px solid rgba(0,0,0,0.06);
  font-size: 13px;
}
.dup-warning svg { flex: none; margin-top: 2px; color: #6B4A0F; }
.dup-warning ul { list-style: none; margin: 4px 0 0; padding: 0; }
.dup-warning li { padding: 2px 0; }
.dup-warning a { color: #5C3D08; text-decoration: none; font-weight: 500; }
.dup-warning a:hover { text-decoration: underline; }
.dup-warning a .lat { color: #8a6620; font-style: italic; font-weight: 400; margin-left: 4px; }

/* ─── symptom search (/symptoms) ─── */
.symptom-input-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 18px 20px; box-shadow: var(--shadow-1);
}
.symptom-input-row {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  padding: 8px 10px; min-height: 48px;
  border: 1px solid var(--line-2); border-radius: var(--r-md);
  background: var(--surface);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.symptom-input-row:focus-within {
  border-color: var(--green-300); box-shadow: 0 0 0 3px var(--green-50);
}
.symptom-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 6px 4px 12px; border-radius: 999px;
  background: var(--green-50); color: var(--green-900);
  border: 1px solid var(--green-100);
  font-size: 13.5px;
}
.symptom-chip button {
  width: 18px; height: 18px; border: 0; border-radius: 999px;
  background: transparent; color: var(--green-900); opacity: 0.6;
  display: grid; place-items: center; cursor: pointer;
}
.symptom-chip button:hover { opacity: 1; background: oklch(0.92 0.05 135); }
.symptom-input {
  flex: 1; min-width: 200px; border: 0; outline: 0; background: transparent;
  font: inherit; font-size: 14.5px; color: var(--ink); padding: 4px 6px;
}
.symptom-input::placeholder { color: var(--ink-4); }
.symptom-input-foot {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-top: 12px;
}
.symptom-input-foot .hint {
  font-size: 12px; color: var(--ink-4); flex: 1;
  font-family: 'IBM Plex Mono', monospace; letter-spacing: 0.04em;
}

/* ─── symptom search · redesigned shell ─── */
.sym-page { background: var(--bg); min-height: 100vh; }
.sym-shell {
  max-width: 760px; margin: 0 auto;
  padding: 64px 32px 24px;
}
.sym-shell-results {
  max-width: 1200px;
  padding: 0 32px 80px;
}
.sym-page .crumbs {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 13px; color: var(--ink-3); margin-bottom: 8px;
}
.sym-page .crumbs .crumbs-l { display: flex; align-items: center; gap: 8px; }
.sym-page .crumbs .sep { color: var(--ink-4); }
.sym-page .crumbs span:last-child { color: var(--ink); }
.sym-page .crumbs-back {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px;
}
.sym-eyebrow { margin-top: 4px; }
.sym-title {
  font-size: 40px; line-height: 1.08; margin: 6px 0 8px;
  max-width: 600px;
}
.sym-sub {
  color: var(--ink-3); font-size: 15.5px;
  max-width: 540px; margin: 0 0 32px;
}

/* Stepper */
.sym-stepper {
  display: flex; gap: 0; margin-bottom: 24px;
  font-size: 12.5px; font-family: 'IBM Plex Mono', monospace;
  letter-spacing: 0.06em; text-transform: uppercase;
}
.sym-step {
  display: flex; align-items: center; gap: 10px;
  padding: 0 16px 0 0; margin-right: 16px;
  border-right: 1px solid var(--line);
  color: var(--ink-4);
}
.sym-step:last-child { border-right: 0; margin-right: 0; }
.sym-step .n {
  width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center;
  background: transparent;
  color: var(--ink-4);
  border: 1px solid var(--line-2);
  font-size: 11px; font-weight: 500;
}
.sym-step.active,
.sym-step.done { color: var(--green-900); }
.sym-step.active .n,
.sym-step.done .n {
  background: var(--green-700); color: white; border: 0;
}
.sym-step.active .lbl { font-weight: 500; }
.sym-step.last { border-right: 0; margin-right: 0; }

/* Main card */
.sym-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 28px;
  box-shadow: var(--shadow-1);
}
.sym-card-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 14px;
}
.sym-card-head h3 {
  margin: 0; font-size: 18px;
  font-family: 'Newsreader', serif; font-weight: 500;
  color: var(--ink); letter-spacing: -0.015em;
}
.sym-count { font-size: 12px; color: var(--ink-3); }

/* Häufige Symptome chip-toggles */
.sym-frequent { margin-top: 18px; }
.sym-frequent-label {
  font-size: 11.5px; font-family: 'IBM Plex Mono', monospace;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink-3); margin-bottom: 10px;
}
.sym-frequent-chips {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.sym-pill {
  all: unset;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px;
  font-size: 12.5px;
  border: 1px solid var(--line);
  background: var(--surface); color: var(--ink-2);
  transition: border-color 120ms ease, background 120ms ease, color 120ms ease;
}
.sym-pill:hover { border-color: var(--line-2); }
.sym-pill .n {
  font-size: 11px; color: var(--ink-4);
}
.sym-pill.on {
  background: var(--ink); color: #fff; border-color: var(--ink);
}
.sym-pill.on .n { color: rgba(255,255,255,0.6); }

.sym-card-foot {
  border-top: 1px solid var(--line);
  margin-top: 22px; padding-top: 18px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap;
}
.sym-card-foot .hint {
  font-size: 13px; color: var(--ink-3);
  font-family: inherit; letter-spacing: normal;
}
.sym-card-actions { display: flex; gap: 8px; }

/* Single hint banner below the card */
.sym-hint-single {
  margin-top: 18px;
  padding: 14px 18px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border: 1px dashed var(--line-2); border-radius: var(--r-md);
  background: var(--paper);
  font-size: 13.5px; color: var(--ink-2);
}
.sym-hint-single a {
  font-size: 13px; display: inline-flex; align-items: center; gap: 4px;
  white-space: nowrap;
}

/* Results section */
.sym-results { margin-top: 32px; }
.sym-results-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 14px;
}
.sym-results-head h2 {
  font-family: 'Newsreader', serif; font-size: 26px; font-weight: 500;
  letter-spacing: -0.015em; margin: 0; color: var(--ink);
}
.sym-results-head h2 em {
  font-style: normal; color: var(--green-700);
}
.sym-results-sort { font-size: 13px; color: var(--ink-3); }
.sym-results-sort b { color: var(--ink); font-weight: 500; }

.sym-results-grid {
  display: grid; grid-template-columns: 260px 1fr; gap: 24px;
}

/* Aside · symptom-bar breakdown */
.sym-aside-label {
  font-size: 11px; font-family: 'IBM Plex Mono', monospace;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink-3); margin-bottom: 12px;
}
.sym-aside-bars { display: grid; gap: 12px; }
.sym-bar { display: grid; gap: 6px; }
.sym-bar-row {
  display: flex; justify-content: space-between; font-size: 12.5px;
}
.sym-bar-row .lbl { color: var(--ink-2); }
.sym-bar-row .n { color: var(--ink-4); }
.sym-bar-track {
  height: 4px; background: var(--paper-2);
  border-radius: 2px; overflow: hidden;
}
.sym-bar-fill {
  height: 100%; background: var(--green-300);
  border-radius: 2px;
  transition: width 200ms ease;
}
.sym-bar-fill.primary { background: var(--green-700); }

/* Result rows */
.sym-rows { display: grid; gap: 10px; }
.sym-row {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 16px 18px;
  display: grid; grid-template-columns: 52px 1fr auto;
  gap: 14px; align-items: center;
  text-decoration: none; color: var(--ink);
  cursor: pointer; transition: border-color 120ms ease, transform 120ms ease, box-shadow 120ms ease;
}
.sym-row:hover {
  border-color: var(--green-300); transform: translateY(-1px);
  box-shadow: var(--shadow-2);
}
.sym-row .thumb {
  width: 52px; height: 52px; border-radius: 10px;
  background: var(--green-50); border: 1px solid var(--line);
  display: grid; place-items: center;
  font-family: 'Noto Serif SC', serif; font-size: 22px;
  color: var(--green-700);
  overflow: hidden;
}
.sym-row .thumb.has-img { padding: 3px; background: var(--paper); }
.sym-row .thumb.has-img img {
  width: 100%; height: 100%; object-fit: contain;
}
.sym-row .ident { min-width: 0; }
.sym-row .line1 {
  display: flex; align-items: baseline; gap: 10px;
  flex-wrap: wrap;
}
.sym-row .pinyin {
  font-family: 'Newsreader', serif; font-size: 17px;
  letter-spacing: -0.015em; color: var(--ink);
}
.sym-row .zh {
  font-family: 'Noto Serif SC', serif; font-size: 13px;
  color: var(--ink-3);
}
.sym-row .latin {
  font-style: italic; color: var(--ink-3);
  font-size: 13px; margin-bottom: 6px;
}
.sym-row .muster {
  display: flex; gap: 6px; align-items: center; flex-wrap: wrap;
}
.sym-row .muster-lbl {
  font-size: 10.5px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--ink-4);
}
.sym-row .muster-val {
  font-size: 12.5px; color: var(--green-900);
}
.sym-row .meta {
  display: flex; flex-direction: column; align-items: flex-end; gap: 8px;
}
.sym-row .num {
  font-size: 11px; color: var(--ink-4);
}

/* 5-pip score indicator */
.pips { display: flex; gap: 3px; }
.pip {
  width: 14px; height: 4px; border-radius: 2px;
  background: var(--paper-2);
}
.pip.on { background: var(--green-700); }

@media (max-width: 720px) {
  .sym-shell { padding: 36px 18px 16px; }
  .sym-title { font-size: 30px; }
  .sym-card { padding: 20px; }
  .sym-stepper { flex-wrap: wrap; row-gap: 10px; }
  .sym-results-grid { grid-template-columns: 1fr; }
  .sym-row { grid-template-columns: 44px 1fr auto; padding: 12px 14px; }
  .sym-row .thumb { width: 44px; height: 44px; }
  .sym-hint-single { flex-direction: column; align-items: flex-start; }
}

.symptom-results {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 14px;
}
.symptom-result {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 16px 18px;
  display: flex; flex-direction: column; gap: 10px;
  text-decoration: none; color: var(--ink);
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}
.symptom-result:hover {
  border-color: var(--green-300); box-shadow: var(--shadow-2); transform: translateY(-1px);
}
.symptom-result-head {
  display: flex; gap: 12px; align-items: flex-start;
}
.symptom-result-head .specimen { width: 48px; height: 48px; font-size: 19px; flex: none; }
.symptom-result-id { min-width: 0; flex: 1; }
.symptom-result-id .pinyin {
  font-family: 'Newsreader', serif; font-size: 18px; line-height: 1.2; color: var(--ink); font-weight: 500;
}
.symptom-result-id .latin { font-style: italic; color: var(--ink-3); font-size: 12.5px; margin-top: 2px; }
.symptom-result-id .han {
  font-family: 'Noto Serif SC', serif; font-size: 13px; color: var(--ink-2);
  letter-spacing: 0.05em; margin-top: 2px;
}
.symptom-score {
  flex: none; text-align: center;
  background: var(--green-50); border: 1px solid var(--green-100);
  border-radius: var(--r-md); padding: 6px 10px; min-width: 56px;
}
.symptom-score .score-num {
  font-family: 'Newsreader', serif; font-size: 20px; color: var(--green-900); font-weight: 500;
  line-height: 1.1;
}
.symptom-score .score-lbl {
  font-family: 'IBM Plex Mono', monospace; font-size: 10.5px; color: var(--green-700);
  letter-spacing: 0.06em;
}

.symptom-matches { display: flex; flex-wrap: wrap; gap: 4px; }
.symptom-match-chip {
  font-size: 12px; padding: 2px 9px; border-radius: 999px;
  background: var(--amber-100); color: #6B4A0F;
  border: 1px solid rgba(0,0,0,0.06);
}

.symptom-fields {
  font-family: 'IBM Plex Mono', monospace; font-size: 11px;
  letter-spacing: 0.06em; color: var(--ink-3);
  display: flex; flex-wrap: wrap; gap: 4px; align-items: center;
}
.symptom-field-pill {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: 4px; padding: 1px 7px; color: var(--ink-2);
}
.symptom-category {
  font-size: 12px; color: var(--ink-3);
  padding-top: 8px; border-top: 1px dashed var(--line);
}

/* ─── references tab (article detail) ─── */
.ref-tab { display: flex; flex-direction: column; gap: 28px; }
.ref-section { display: flex; flex-direction: column; gap: 12px; }
.ref-section-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.ref-section-title {
  display: flex; align-items: center; gap: 10px; min-width: 0;
}
.ref-section-title svg { color: var(--green-700); flex: none; }
.ref-section-title h3 {
  font-family: 'Newsreader', serif; font-size: 18px; font-weight: 500;
  color: var(--ink); margin: 0;
}
.ref-section-title .count {
  font-family: 'IBM Plex Mono', monospace; font-size: 11px;
  letter-spacing: 0.10em; color: var(--ink-4);
  background: var(--paper); border: 1px solid var(--line);
  border-radius: 999px; padding: 1px 8px;
}

.ref-empty {
  padding: 14px 16px; border: 1px dashed var(--line); border-radius: var(--r-md);
  background: var(--paper); color: var(--ink-3); font-size: 13px;
}

.ref-list {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 8px;
}
.ref-list-item {
  display: flex; align-items: stretch; gap: 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 14px 16px;
  transition: border-color 120ms ease;
}
.ref-list-item:hover { border-color: var(--line-2); }

a.ref-link {
  display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1;
  text-decoration: none; color: var(--ink);
}
.ref-link-title {
  font-family: 'Newsreader', serif; font-size: 16px; line-height: 1.3;
  overflow: hidden; text-overflow: ellipsis; word-break: break-word;
}
a.ref-link:hover .ref-link-title { color: var(--green-700); }
.ref-link-url {
  font-family: 'IBM Plex Mono', monospace; font-size: 11.5px;
  color: var(--ink-3); letter-spacing: 0.04em;
}
.ref-link-desc { color: var(--ink-2); font-size: 13px; line-height: 1.5; }

a.ref-doc {
  display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1;
  text-decoration: none; color: var(--ink);
}
.ref-doc-mark {
  width: 36px; height: 36px; flex: none;
  border-radius: 8px; background: var(--paper); color: var(--green-700);
  display: grid; place-items: center;
  border: 1px solid var(--line);
}
.ref-doc-meta { min-width: 0; flex: 1; }
.ref-doc-name {
  font-family: 'Newsreader', serif; font-size: 15px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
a.ref-doc:hover .ref-doc-name { color: var(--green-700); }
.ref-doc-info {
  font-family: 'IBM Plex Mono', monospace; font-size: 11px;
  letter-spacing: 0.06em; color: var(--ink-4); margin-top: 2px;
}

/* edit-mode link row */
.ref-row-edit {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 8px; flex: 1;
}
.ref-row-edit textarea { grid-column: 1 / span 2; resize: vertical; }
.ref-row-actions { grid-column: 3; grid-row: 1 / span 2; align-self: start; }

@media (max-width: 720px) {
  .ref-row-edit { grid-template-columns: 1fr auto; }
  .ref-row-edit textarea { grid-column: 1 / span 1; }
}

/* ─── card compare-selection toggle (search page) ─── */
.card-compare-toggle {
  position: absolute; top: 12px; left: 12px;
  width: 22px; height: 22px; padding: 0;
  border: 1.5px solid var(--line-2); border-radius: 6px;
  background: rgba(255,255,255,0.85); backdrop-filter: blur(2px);
  display: grid; place-items: center;
  cursor: pointer; opacity: 0; transition: opacity 120ms ease, background 120ms ease, border-color 120ms ease;
  z-index: 2;
}
.card:hover .card-compare-toggle,
.card-compare-toggle.active { opacity: 1; }
.card-compare-toggle:hover { border-color: var(--green-700); }
.card-compare-toggle.active {
  background: var(--green-700); border-color: var(--green-700); color: white;
}
.card-compare-selected {
  border-color: var(--green-700); box-shadow: 0 0 0 1px var(--green-700);
}

/* ─── compare floating action bar ─── */
.compare-bar {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  z-index: 50;
  display: flex; align-items: center; gap: 10px;
  background: var(--ink); color: white;
  border-radius: 999px; padding: 8px 8px 8px 18px;
  box-shadow: 0 16px 40px rgba(27,31,26,0.30);
  max-width: 92vw;
  animation: compare-rise 180ms ease;
}
.compare-bar-label {
  font-size: 13.5px; color: rgba(255,255,255,0.92); white-space: nowrap;
  font-family: 'IBM Plex Sans', sans-serif;
}
.compare-bar-label strong { color: var(--amber-500); }
.compare-bar-spacer { width: 8px; }
.compare-bar .btn-ghost {
  background: transparent; color: rgba(255,255,255,0.85); border-color: transparent;
}
.compare-bar .btn-ghost:hover { background: rgba(255,255,255,0.10); color: white; }
.compare-bar .btn-primary {
  background: var(--amber-500); color: #2A1E0A; border-color: var(--amber-500);
}
.compare-bar .btn-primary:hover { background: var(--amber-600); border-color: var(--amber-600); }
.compare-bar .btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

@keyframes compare-rise {
  from { transform: translate(-50%, 16px); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

/* ─── article-detail feedback CTA ─── */
.feedback-cta {
  margin-top: 32px; padding-top: 22px;
  border-top: 1px dashed var(--line);
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.feedback-cta-thanks {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--green-700);
  font-family: 'IBM Plex Mono', monospace; letter-spacing: 0.04em;
}

/* ─── admin feedback list ─── */
.feedback-list { display: flex; flex-direction: column; gap: 12px; }
.feedback-row {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 18px 22px;
  display: flex; flex-direction: column; gap: 10px;
}
.feedback-meta {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.feedback-type-pill, .feedback-status-pill {
  display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px;
  font-family: 'IBM Plex Mono', monospace; font-size: 11px;
  letter-spacing: 0.08em; text-transform: uppercase;
  border: 1px solid transparent;
}
.feedback-type-pill.err { background: oklch(0.96 0.04 28); color: oklch(0.45 0.16 28); border-color: oklch(0.86 0.07 28); }
.feedback-type-pill.ok { background: var(--green-50); color: var(--green-900); border-color: var(--green-100); }
.feedback-type-pill.info { background: oklch(0.96 0.03 230); color: oklch(0.42 0.13 230); border-color: oklch(0.90 0.05 230); }

.feedback-status-pill.open { background: var(--amber-100); color: #6B4A0F; border-color: rgba(0,0,0,0.06); }
.feedback-status-pill.review { background: oklch(0.96 0.04 270); color: oklch(0.42 0.13 270); border-color: oklch(0.90 0.05 270); }
.feedback-status-pill.ok { background: var(--green-50); color: var(--green-900); border-color: var(--green-100); }
.feedback-status-pill.dismissed { background: var(--paper-2); color: var(--ink-3); border-color: var(--line); }

.feedback-field {
  font-family: 'IBM Plex Mono', monospace; font-size: 11px;
  color: var(--ink-3); letter-spacing: 0.04em;
}
.feedback-when {
  margin-left: auto;
  font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--ink-4);
}

.feedback-article a {
  font-family: 'Newsreader', serif; font-size: 17px; color: var(--ink); text-decoration: none;
}
.feedback-article a:hover { color: var(--green-700); }

.feedback-message {
  font-size: 14px; color: var(--ink-2); line-height: 1.5; margin: 0;
  white-space: pre-wrap; word-break: break-word;
}

.feedback-note {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 14px; border-radius: var(--r-md);
  background: var(--paper); border: 1px dashed var(--line);
  font-size: 13px; color: var(--ink-2);
}
.feedback-note .label {
  font-family: 'IBM Plex Mono', monospace; font-size: 10.5px;
  letter-spacing: 0.10em; text-transform: uppercase; color: var(--ink-3);
  flex: none;
}

.feedback-foot {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding-top: 10px; border-top: 1px dashed var(--line);
}
.feedback-foot .reporter {
  font-size: 12.5px; color: var(--ink-3);
}
.feedback-foot .actions {
  display: flex; gap: 6px; margin-left: auto; flex-wrap: wrap;
}

/* quick-tile open-feedback badge */
.quick-tile { position: relative; }
.quick-tile-badge {
  position: absolute; top: 8px; right: 10px;
  min-width: 18px; height: 18px; padding: 0 5px;
  display: inline-flex; align-items: center; justify-content: center;
  background: oklch(0.55 0.18 28); color: white;
  font-family: 'IBM Plex Mono', monospace; font-size: 10.5px;
  border-radius: 999px;
}

/* ─── tag picker (article edit, tcm tab) ─── */
.tag-picker {
  margin-bottom: 16px;
  position: relative;
}
.tag-picker-selected {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-bottom: 8px;
}
.tag-picker-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px 4px 12px; border-radius: 999px;
  font: inherit; font-size: 13px; line-height: 1.4;
  background: var(--green-50); color: var(--green-900);
  border: 1px solid var(--green-100);
  cursor: pointer; transition: background 120ms ease;
}
.tag-picker-pill:hover {
  background: oklch(0.94 0.04 135 / 0.6);
  border-color: var(--green-300);
}
.tag-picker-pill .x { opacity: 0.6; }
.tag-picker-pill:hover .x { opacity: 1; }

.tag-picker-input-row {
  position: relative; display: flex; align-items: center;
}
.tag-picker-input-row svg:first-child {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--ink-4); pointer-events: none;
}
.tag-picker-input-row input {
  width: 100%; border: 1px solid var(--line-2); border-radius: var(--r-md);
  background: var(--surface); padding: 8px 32px 8px 32px;
  font: inherit; font-size: 14px; color: var(--ink); outline: 0;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.tag-picker-input-row input:focus {
  border-color: var(--green-300);
  box-shadow: 0 0 0 3px var(--green-50);
}
.tag-picker-clear {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 22px; height: 22px; border: 0; background: transparent;
  color: var(--ink-4); cursor: pointer; display: grid; place-items: center;
  border-radius: 999px;
}
.tag-picker-clear:hover { background: var(--paper); color: var(--ink-2); }

.tag-picker-backdrop { position: fixed; inset: 0; z-index: 10; background: transparent; }

.tag-picker-dropdown {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 20;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); box-shadow: var(--shadow-2);
  max-height: 240px; overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: var(--line-2) transparent;
}
.tag-picker-dropdown::-webkit-scrollbar { width: 6px; }
.tag-picker-dropdown::-webkit-scrollbar-track { background: transparent; }
.tag-picker-dropdown::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 999px; }

.tag-picker-create {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 9px 14px; border: 0; background: var(--green-50);
  font: inherit; font-size: 13.5px; color: var(--green-900);
  cursor: pointer; text-align: left;
  border-bottom: 1px solid var(--green-100);
}
.tag-picker-create:hover { background: oklch(0.92 0.05 135); }
.tag-picker-create svg { color: var(--green-700); flex: none; }

.tag-picker-options {
  display: flex; flex-direction: column;
  padding: 4px;
}
.tag-picker-option {
  display: block; width: 100%; padding: 7px 10px;
  border: 0; background: transparent; border-radius: var(--r-sm);
  font: inherit; font-size: 13.5px; color: var(--ink-2);
  cursor: pointer; text-align: left;
}
.tag-picker-option:hover { background: var(--paper); color: var(--ink); }
.tag-picker-more {
  font-family: 'IBM Plex Mono', monospace; font-size: 11px;
  letter-spacing: 0.06em; color: var(--ink-4);
  padding: 8px 10px 4px;
}
.tag-picker-noresults {
  padding: 12px 14px; font-size: 13px; color: var(--ink-3);
}

.tag-picker-empty {
  display: flex; gap: 10px; align-items: center;
  padding: 10px 12px; border: 1px dashed var(--line); border-radius: var(--r-md);
  background: var(--paper); color: var(--ink-3); font-size: 13px;
  margin-bottom: 8px;
}
.tag-picker-empty a { color: var(--green-700); }

/* ─── tcm diagnostic tag chips on detail page ─── */
.tcm-section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 22px 24px;
}
.tcm-section + .tcm-section { margin-top: 16px; }
.tcm-section-head {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 14px;
}
.tcm-section-head h3 {
  font-family: 'Newsreader', serif; font-size: 19px; font-weight: 500;
  color: var(--ink); margin: 0;
}
.tcm-tag-row {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin: 0 0 14px;
  padding: 0 0 14px;
  border-bottom: 1px dashed var(--line);
}
.tcm-tag {
  display: inline-flex; align-items: center;
  padding: 4px 12px; border-radius: 999px;
  background: var(--green-50); color: var(--green-900);
  border: 1px solid var(--green-100);
  font-size: 13px; line-height: 1.4;
}
a.tcm-tag-link {
  text-decoration: none; cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, transform 120ms ease;
}
a.tcm-tag-link:hover {
  background: oklch(0.92 0.05 135); border-color: var(--green-300);
  color: var(--green-900); transform: translateY(-1px);
}

/* ─── list-view inline filter bar (above list) ─── */
.list-filterbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px 14px;
  margin-bottom: 14px;
  align-items: center;
}
.list-filterbar .lang-pills {
  grid-column: 1 / span 2;
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  padding-top: 4px;
}
.list-filterbar .lang-pills .label {
  font-family: 'IBM Plex Mono', monospace; font-size: 11px;
  letter-spacing: 0.10em; text-transform: uppercase; color: var(--ink-3);
  margin-right: 4px;
}
.list-search {
  position: relative; min-width: 0;
}
.list-search svg:first-child {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--ink-4); pointer-events: none;
}
.list-search input {
  width: 100%; border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface); padding: 8px 30px 8px 32px;
  font: inherit; font-size: 13.5px; color: var(--ink); outline: 0;
}
.list-search input:focus { border-color: var(--green-300); }
.list-search input::placeholder { color: var(--ink-4); }
.list-search-clear {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 22px; height: 22px; border: 0; background: transparent;
  color: var(--ink-4); cursor: pointer; display: grid; place-items: center;
  border-radius: 999px;
}
.list-search-clear:hover { background: var(--paper); color: var(--ink-2); }

/* ─── tag domain tabs ─── */
.tag-domain-tabs {
  display: flex; gap: 4px; flex-wrap: wrap;
  margin: 0 0 18px;
  border-bottom: 1px solid var(--line);
}
.tag-domain-tab {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px; border: 0; background: transparent;
  font: inherit; font-size: 14px; color: var(--ink-3);
  cursor: pointer; position: relative;
  border-bottom: 2px solid transparent;
}
.tag-domain-tab:hover { color: var(--ink); }
.tag-domain-tab.active {
  color: var(--green-900); border-bottom-color: var(--green-700);
  font-weight: 500;
}
.tag-domain-tab .count {
  font-family: 'IBM Plex Mono', monospace; font-size: 11px;
  background: var(--paper); border: 1px solid var(--line);
  border-radius: 999px; padding: 1px 8px; color: var(--ink-3);
}
.tag-domain-tab.active .count {
  background: var(--green-50); border-color: var(--green-100); color: var(--green-700);
}

/* ─── category list ─── */
.cat-list { display: flex; flex-direction: column; gap: 10px; }
.cat-row {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 16px 20px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px 18px;
  align-items: center;
  transition: all 140ms ease;
}
.cat-row:hover { border-color: var(--green-300); box-shadow: var(--shadow-1); }
.cat-row .name {
  grid-column: 1; grid-row: 1;
  font-family: 'Newsreader', serif; font-size: 19px; line-height: 1.25;
  color: var(--ink); font-weight: 500;
  overflow: hidden; text-overflow: ellipsis;
}
.cat-row .coverage {
  grid-column: 2; grid-row: 1;
  font-family: 'IBM Plex Mono', monospace; font-size: 11px;
  letter-spacing: 0.10em; text-transform: uppercase; color: var(--ink-3);
  white-space: nowrap;
}
.cat-row .coverage.full { color: var(--green-700); }
.cat-row .coverage.partial { color: oklch(0.55 0.16 60); }
.cat-row .coverage.low { color: oklch(0.55 0.18 28); }
.cat-row .actions {
  grid-column: 3; grid-row: 1 / span 2;
  display: flex; gap: 6px; align-self: center;
}
.cat-row .langs {
  grid-column: 1 / span 2; grid-row: 2;
  display: flex; flex-wrap: wrap; gap: 6px;
}

.lang-tag {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 10px; border-radius: 6px;
  background: var(--paper); border: 1px solid var(--line);
  font-size: 13px; color: var(--ink-2); min-width: 0;
  max-width: 100%;
}
.lang-tag .code {
  font-family: 'IBM Plex Mono', monospace; font-size: 10.5px;
  letter-spacing: 0.10em; color: var(--green-700); text-transform: uppercase;
  flex: none;
}
.lang-tag.han .code { font-family: 'Noto Serif SC', serif; letter-spacing: 0.05em; text-transform: none; font-size: 12px; }
.lang-tag .val {
  color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0;
}

/* icon-only button */
.icon-btn {
  width: 36px; height: 36px; border-radius: var(--r-sm);
  display: inline-grid; place-items: center;
  background: var(--paper); border: 1px solid var(--line); color: var(--ink-2);
  cursor: pointer; transition: all 120ms ease;
  font-family: inherit;
}
.icon-btn:hover { background: var(--paper-2); color: var(--ink); border-color: var(--line-2); }
.icon-btn.danger:hover {
  background: oklch(0.96 0.04 28); border-color: oklch(0.86 0.07 28);
  color: oklch(0.55 0.18 28);
}

/* ─── modal ─── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(27,31,26,0.45);
  display: grid; place-items: center; padding: 24px;
  animation: modal-fade 120ms ease;
}
.modal-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 24px;
  max-width: 480px; width: 100%;
  box-shadow: 0 20px 60px rgba(27,31,26,0.20);
  animation: modal-rise 160ms ease;
}
.modal-card .eyebrow {
  font-family: 'IBM Plex Mono', monospace; font-size: 11px;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: oklch(0.55 0.18 28); margin-bottom: 6px;
}
.modal-card h3 {
  font-family: 'Newsreader', serif; font-size: 20px; font-weight: 500;
  margin: 0 0 8px; color: var(--ink);
}
.modal-card p { font-size: 14px; color: var(--ink-2); line-height: 1.5; margin: 0; }
.modal-card .modal-warn {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 12px; border-radius: var(--r-md);
  background: oklch(0.96 0.04 28); border: 1px solid oklch(0.86 0.07 28);
  color: oklch(0.45 0.16 28); font-size: 13px;
  margin-top: 14px;
}
.modal-card .modal-warn svg { flex: none; margin-top: 1px; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 8px;
  margin-top: 20px; padding-top: 16px; border-top: 1px dashed var(--line);
}
.btn-danger {
  background: oklch(0.55 0.18 28); color: white; border-color: oklch(0.55 0.18 28);
}
.btn-danger:hover { background: oklch(0.48 0.18 28); border-color: oklch(0.48 0.18 28); }

@keyframes modal-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-rise { from { transform: translateY(8px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

@media (max-width: 640px) {
  .cat-row { grid-template-columns: minmax(0, 1fr) auto; }
  .cat-row .coverage { grid-column: 1; grid-row: 2; }
  .cat-row .langs { grid-column: 1 / span 2; grid-row: 3; }
  .cat-row .actions { grid-column: 2; grid-row: 1; align-self: start; }
}

/* ─── multi-section form (page-level edit forms) ─── */
.form-stack { display: flex; flex-direction: column; gap: 14px; }

.form-card .card-head {
  margin-bottom: 18px; padding-bottom: 14px; border-bottom: 1px dashed var(--line);
}
.form-card .card-head .eyebrow {
  font-family: 'IBM Plex Mono', monospace; font-size: 11px;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--green-700);
  margin-bottom: 4px;
}
.form-card .card-head h2 {
  font-family: 'Newsreader', serif; font-size: 19px; font-weight: 500;
  margin: 0; color: var(--ink);
}

.form-grid {
  display: grid; gap: 16px 18px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid .field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.form-grid .col-2 { grid-column: span 2; }
.form-grid .col-3 { grid-column: span 3; }
.form-grid .field > label {
  font-family: 'IBM Plex Mono', monospace; font-size: 11px;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3);
}
.form-grid .field .req { color: oklch(0.55 0.18 28); margin-left: 4px; }
.form-grid .field .hint { font-size: 11.5px; color: var(--ink-4); margin-top: 2px; }
.form-grid .field input[readonly] {
  background: var(--paper); color: var(--ink-3); cursor: not-allowed;
}

.input-group { display: flex; gap: 8px; min-width: 0; }
.input-group .field-input { flex: 1; min-width: 0; }
.input-group .field-select { flex: none; width: auto; }

.check-list { display: flex; flex-direction: column; gap: 12px; }
.check-row {
  display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none;
  font-size: 14px; color: var(--ink-2);
}
.check-row input[type="checkbox"] {
  width: 16px; height: 16px; accent-color: var(--green-700);
  cursor: pointer; margin: 0;
}
.check-row:hover { color: var(--ink); }

.subfield {
  margin-left: 26px; padding: 12px 14px;
  border-left: 2px solid var(--green-100);
  display: flex; flex-direction: column; gap: 6px; max-width: 320px;
}
.subfield > label {
  font-family: 'IBM Plex Mono', monospace; font-size: 11px;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3);
}

.page-actions {
  margin-top: 18px; padding: 18px 0;
  display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap;
  position: sticky; bottom: 0; z-index: 5;
  background: linear-gradient(to bottom, transparent 0, var(--bg) 30%);
}

@media (max-width: 720px) {
  .form-grid, .form-grid.cols-3 { grid-template-columns: 1fr; }
  .form-grid .col-2, .form-grid .col-3 { grid-column: auto; }
  .page-actions { justify-content: stretch; }
  .page-actions .btn { flex: 1; justify-content: center; }
}

/* ─── chat ─── */
.t-chat-page {
  height: calc(100vh - 64px);
  display: flex; flex-direction: column;
  background: var(--bg);
}
.t-chat-head {
  padding: 24px 32px 8px;
  max-width: 980px; width: 100%; margin: 0 auto;
}
.t-chat-head h1 {
  font-family: 'Newsreader', serif; font-size: 28px;
  font-weight: 500; letter-spacing: -0.015em;
  color: var(--ink); margin: 6px 0 4px;
}
.t-chat-head p {
  font-size: 13.5px; color: var(--ink-3); margin: 0;
}
.t-chat-shell {
  flex: 1; min-height: 0;
  max-width: 980px; width: 100%; margin: 0 auto;
  padding: 12px 32px 24px;
  display: flex; flex-direction: column; gap: 0;
}
.t-chat-stream {
  flex: 1; min-height: 0; overflow-y: auto;
  padding: 12px 4px 28px;
  scrollbar-width: thin;
}
.t-chat-stream::-webkit-scrollbar { width: 8px; }
.t-chat-stream::-webkit-scrollbar-thumb {
  background: var(--line-2); border-radius: 4px;
}

/* user message */
.t-chat-msg { margin-bottom: 22px; display: flex; }
.t-chat-msg.user { justify-content: flex-end; }
.t-chat-msg.user .bubble {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: 14px 14px 4px 14px;
  padding: 12px 16px; max-width: 560px;
  font-size: 14.5px; color: var(--ink);
}
.t-chat-msg.user .ts {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10.5px; color: var(--ink-4);
  margin-top: 4px; text-align: right;
}

/* AI message */
.t-chat-msg.ai .bubble {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 4px 14px 14px 14px;
  padding: 18px 20px; max-width: 100%;
  flex: 1;
}
.t-chat-msg.ai { gap: 12px; align-items: flex-start; }
.t-chat-msg.ai .avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, var(--green-300), var(--green-700));
  display: grid; place-items: center;
  color: white; font-family: 'Noto Serif SC', serif; font-size: 13px;
  flex: none; margin-top: 4px;
}
.t-chat-msg.ai .ts {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10.5px; color: var(--ink-4);
  margin-top: 6px;
}

/* AI summary block (the answer) */
.t-chat-summary {
  background: var(--green-50); border: 1px solid var(--green-100);
  border-left: 3px solid var(--green-700);
  border-radius: var(--r-md);
  padding: 14px 18px; margin-bottom: 18px;
}
.t-chat-summary .label {
  font-family: 'IBM Plex Mono', monospace; font-size: 10.5px;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--green-700); margin-bottom: 6px;
}
.t-chat-summary p {
  font-family: 'Newsreader', serif; font-size: 16px;
  line-height: 1.55; color: var(--ink); margin: 0;
}

/* AI references header */
.t-chat-refs-head {
  display: flex; align-items: baseline; gap: 10px;
  font-family: 'IBM Plex Mono', monospace; font-size: 11px;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-3); margin: 0 0 12px;
}
.t-chat-refs-head .count {
  font-family: 'IBM Plex Mono', monospace; font-size: 11px;
  color: var(--ink-4);
}

/* result card — extends .card */
.t-chat-result {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 16px 18px;
  margin-bottom: 12px;
  transition: border-color 120ms ease;
}
.t-chat-result:hover { border-color: var(--green-300); }
.t-chat-result-head {
  display: flex; gap: 14px; align-items: flex-start;
  cursor: pointer;
}
.t-chat-result .specimen {
  width: 48px; height: 48px; border-radius: 10px;
  background: var(--green-50); border: 1px solid var(--line);
  display: grid; place-items: center;
  font-family: 'Noto Serif SC', serif;
  font-size: 20px; color: var(--green-700);
  flex: none;
}
.t-chat-result .titles { min-width: 0; flex: 1; }
.t-chat-result .pinyin {
  font-family: 'Newsreader', serif; font-size: 18px;
  line-height: 1.2; color: var(--ink);
}
.t-chat-result .latin {
  font-style: italic; color: var(--ink-3); font-size: 13px; margin-top: 2px;
}
.t-chat-result .han {
  font-family: 'Noto Serif SC', serif; font-size: 14px;
  color: var(--ink-2); margin-top: 4px; letter-spacing: 0.05em;
}
.t-chat-result .actions {
  display: flex; gap: 8px; align-items: center; flex: none;
}
.t-chat-result .chev {
  width: 28px; height: 28px; border-radius: 6px;
  display: grid; place-items: center;
  border: 1px solid var(--line); background: var(--surface);
  cursor: pointer; color: var(--ink-3);
  transition: all 120ms ease;
}
.t-chat-result .chev:hover { background: var(--paper); color: var(--ink); }
.t-chat-result .chev.open svg { transform: rotate(180deg); }
.t-chat-result .chev svg { transition: transform 160ms ease; }

.t-chat-result-body {
  margin-top: 14px; padding-top: 14px;
  border-top: 1px dashed var(--line);
  display: flex; flex-direction: column; gap: 14px;
}
.t-chat-result-section .label {
  font-family: 'IBM Plex Mono', monospace; font-size: 10.5px;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-3); margin-bottom: 6px;
}
.t-chat-result-section .body {
  font-size: 14px; color: var(--ink-2); line-height: 1.55;
}
.t-chat-result-section.warn .label { color: var(--terra); }
.t-chat-result-section.warn .body {
  background: oklch(0.97 0.025 50);
  border-left: 2px solid var(--terra);
  padding: 8px 12px; border-radius: 0 6px 6px 0;
}

.t-chat-products {
  display: flex; flex-direction: column; gap: 6px;
}
.t-chat-product {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border: 1px solid var(--line);
  border-radius: var(--r-sm); background: var(--paper);
  font-size: 13px;
}
.t-chat-product img { width: 22px; height: 22px; object-fit: contain; flex: none; }
.t-chat-product .num {
  font-family: 'IBM Plex Mono', monospace; font-size: 11.5px;
  color: var(--ink-3);
}
.t-chat-product .name {
  font-family: 'Newsreader', serif; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* welcome */
.t-chat-welcome {
  max-width: 720px; margin: 60px auto 0;
  text-align: center;
}
.t-chat-welcome .eyebrow {
  font-family: 'IBM Plex Mono', monospace; font-size: 11px;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--green-700); margin-bottom: 14px;
}
.t-chat-welcome h2 {
  font-family: 'Newsreader', serif; font-size: 30px;
  font-weight: 500; color: var(--ink); margin: 0 0 10px;
}
.t-chat-welcome p {
  color: var(--ink-3); font-size: 14.5px; margin: 0 0 28px;
}
.t-chat-prompts {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px; text-align: left;
}
.t-chat-prompt {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 14px 16px;
  cursor: pointer; transition: all 120ms ease;
  font-family: inherit; font-size: 14px;
  color: var(--ink-2); text-align: left;
}
.t-chat-prompt:hover {
  border-color: var(--green-300); background: var(--paper);
  color: var(--ink);
}
.t-chat-prompt .kicker {
  font-family: 'IBM Plex Mono', monospace; font-size: 10px;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-4); margin-bottom: 6px; display: block;
}

/* loading */
.t-chat-loading {
  display: flex; gap: 12px; align-items: flex-start;
}
.t-chat-loading .bubble {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 4px 14px 14px 14px;
  padding: 14px 18px; min-width: 280px; flex: 1;
}
.t-chat-loading .step {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 0; font-size: 13px;
}
.t-chat-loading .dot {
  width: 14px; height: 14px; border-radius: 50%;
  flex: none; display: grid; place-items: center;
}
.t-chat-loading .dot.pending { background: var(--line); }
.t-chat-loading .dot.active {
  border: 2px solid var(--green-700);
  border-top-color: transparent;
  animation: chat-spin 800ms linear infinite;
}
.t-chat-loading .dot.done { background: var(--green-700); color: white; }
.t-chat-loading .dot.done svg { width: 9px; height: 9px; }
.t-chat-loading .step-label { color: var(--ink-3); }
.t-chat-loading .step.active .step-label { color: var(--ink); font-weight: 500; }
.t-chat-loading .step.done .step-label { color: var(--green-900); }
.t-chat-loading .sub {
  font-family: 'IBM Plex Mono', monospace; font-size: 10.5px;
  color: var(--ink-4); margin-left: 24px; margin-top: -2px; padding-bottom: 4px;
}
.t-chat-loading .bar {
  height: 3px; background: var(--line); border-radius: 2px;
  margin-top: 12px; overflow: hidden;
}
.t-chat-loading .bar > div {
  height: 100%; background: var(--green-700);
  transition: width 240ms ease;
}
@keyframes chat-spin { to { transform: rotate(360deg); } }

/* input */
.t-chat-input {
  flex: none; padding: 14px 4px 4px;
}
.t-chat-input .row {
  display: flex; gap: 10px; align-items: stretch;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 6px 6px 6px 16px;
  transition: border-color 120ms ease;
}
.t-chat-input .row:focus-within { border-color: var(--green-300); }
.t-chat-input input {
  flex: 1; border: none; background: transparent;
  font: inherit; font-size: 15px; color: var(--ink);
  padding: 10px 0; outline: none;
}
.t-chat-input input::placeholder { color: var(--ink-4); }
.t-chat-input input:disabled { color: var(--ink-3); }
.t-chat-input .btn {
  border-radius: var(--r-sm);
}
.t-chat-input .hint {
  font-family: 'IBM Plex Mono', monospace; font-size: 10.5px;
  color: var(--ink-4); margin-top: 6px; padding-left: 4px;
  letter-spacing: 0.04em;
}

.spinning { animation: chat-spin 0.7s linear infinite; }

/* ─── translation coverage pill (admin) ─── */
.t-cov-pill {
  display: inline-flex; align-items: baseline; gap: 2px;
  padding: 3px 10px; border-radius: 999px;
  font-family: 'IBM Plex Mono', monospace; font-size: 11.5px;
  border: 1px solid;
  min-width: 56px; justify-content: center;
}
.t-cov-pill .sep { color: var(--ink-4); margin: 0 1px; }
.t-cov-pill-full {
  background: var(--green-50); color: var(--green-900);
  border-color: var(--green-100);
}
.t-cov-pill-partial {
  background: var(--amber-100); color: #6B4A0F;
  border-color: rgba(0,0,0,0.06);
}
.t-cov-pill-empty {
  background: oklch(0.96 0.04 30); color: var(--terra);
  border-color: oklch(0.85 0.06 30);
}

/* ─── markdown rendering (.prose) ─── */
/* Used by LocalizedContentSection + UsageTab dosage block. Keep tokens, lean spacing. */
.prose { color: var(--ink-2); line-height: 1.65; max-width: 64ch; }
.prose p { margin: 0 0 0.85em; color: var(--ink-2); }
.prose p:last-child { margin-bottom: 0; }
.prose h1, .prose h2, .prose h3, .prose h4 {
  font-family: 'Newsreader', serif; font-weight: 500;
  letter-spacing: -0.01em; color: var(--ink);
  margin: 1.4em 0 0.4em;
}
.prose h1 { font-size: 22px; }
.prose h2 { font-size: 19px; }
.prose h3 { font-size: 16.5px; }
.prose h4 { font-size: 15px; color: var(--ink-2); }
.prose ul, .prose ol { margin: 0 0 0.85em; padding-left: 1.4em; }
.prose ul li, .prose ol li { margin: 0 0 0.25em; }
.prose ul { list-style: disc; }
.prose ul ul { list-style: circle; margin-top: 0.25em; }
.prose strong { font-weight: 600; color: var(--ink); }
.prose em { font-style: italic; }
.prose a { color: var(--green-700); text-decoration: underline; text-underline-offset: 2px; }
.prose a:hover { color: var(--green-900); }
.prose code {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 0.92em; padding: 1px 5px; border-radius: 4px;
  background: var(--paper); border: 1px solid var(--line);
  color: var(--ink);
}
.prose pre {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 12px 14px;
  overflow-x: auto; font-size: 12.5px;
  margin: 0.85em 0;
}
.prose pre code { background: none; border: none; padding: 0; }
.prose blockquote {
  margin: 0.85em 0; padding: 8px 14px;
  border-left: 3px solid var(--green-300);
  background: var(--green-50); border-radius: 0 var(--r-md) var(--r-md) 0;
  color: var(--ink-2); font-style: italic;
}
.prose blockquote p { margin-bottom: 0; }
.prose hr {
  border: 0; border-top: 1px dashed var(--line);
  margin: 1.4em 0;
}
.prose table {
  width: 100%; border-collapse: collapse; margin: 0.85em 0;
  font-size: 13.5px;
}
.prose table th, .prose table td {
  padding: 7px 10px; border-bottom: 1px solid var(--line);
  text-align: left;
}
.prose table th {
  font-family: 'IBM Plex Mono', monospace; font-size: 11px;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3);
  font-weight: 500;
}

/* ─── overview meta cards (botanical / origin) ─── */
.t-meta-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px;
}
.t-meta-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 14px 16px;
  display: flex; flex-direction: column; gap: 8px;
}
.t-meta-card-label {
  font-family: 'IBM Plex Mono', monospace; font-size: 10.5px;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-3); display: inline-flex; align-items: center; gap: 7px;
}
.t-meta-card-label svg { color: var(--green-700); flex: none; }
.t-meta-card-value {
  font-family: 'Newsreader', serif; font-size: 16px; color: var(--ink);
  line-height: 1.3; overflow-wrap: anywhere;
}
.t-meta-card-input {
  width: 100%; padding: 8px 12px; font: inherit; font-size: 14px;
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--r-sm); color: var(--ink);
  transition: border-color 120ms ease, background 120ms ease;
}
.t-meta-card-input:focus {
  outline: none; border-color: var(--green-300); background: var(--surface);
}

/* ─── tcm section icon (replaces the FA icons in the section heads) ─── */
.tcm-section-icon {
  display: inline-grid; place-items: center;
  width: 28px; height: 28px; border-radius: 8px;
  background: var(--paper); border: 1px solid var(--line); flex: none;
}

/* ─── physical article selection modal ─── */
.t-pa-search-row {
  display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px;
}
.t-pa-search {
  flex: 1; min-width: 220px;
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 8px 12px;
  transition: border-color 120ms ease;
}
.t-pa-search:focus-within { border-color: var(--green-300); }
.t-pa-search svg { color: var(--ink-3); flex: none; }
.t-pa-search input {
  flex: 1; border: none; outline: none; background: transparent;
  font: inherit; font-size: 14px; color: var(--ink);
}
.t-pa-search input::placeholder { color: var(--ink-4); }

.t-pa-selected {
  background: var(--green-50); border: 1px solid var(--green-100);
  border-left: 3px solid var(--green-700);
  border-radius: var(--r-md); padding: 12px 14px; margin-bottom: 16px;
}
.t-pa-selected-head {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px;
}
.t-pa-selected-chips {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.t-pa-selected-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 8px 5px 12px;
  background: var(--surface); border: 1px solid var(--green-100);
  border-radius: 999px; color: var(--ink);
}
.t-pa-selected-chip button {
  background: none; border: none; color: var(--ink-3); cursor: pointer;
  font-size: 16px; line-height: 1; padding: 0 4px;
  transition: color 120ms ease;
}
.t-pa-selected-chip button:hover { color: var(--terra); }

.t-pa-list {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 10px;
  max-height: 420px; overflow-y: auto;
  padding: 2px;
}
.t-pa-row {
  display: grid; grid-template-columns: 40px minmax(0, 1fr) auto 24px;
  gap: 14px; align-items: center;
  padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); cursor: pointer;
  transition: all 140ms ease;
}
.t-pa-row:hover { border-color: var(--green-300); transform: translateY(-1px); box-shadow: var(--shadow-1); }
.t-pa-row.selected {
  border-color: var(--green-700); background: var(--green-50);
}
.t-pa-row.added {
  background: var(--paper); cursor: not-allowed; opacity: 0.7;
}
.t-pa-icon {
  width: 40px; height: 40px; border-radius: 8px;
  background: var(--paper); border: 1px solid var(--line);
  display: grid; place-items: center; flex: none;
}
.t-pa-icon img { width: 22px; height: 22px; object-fit: contain; }
.t-pa-info { min-width: 0; }
.t-pa-name {
  font-family: 'Newsreader', serif; font-size: 14.5px; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.t-pa-num {
  font-family: 'IBM Plex Mono', monospace; font-size: 11px;
  color: var(--ink-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.t-pa-pkg {
  font-family: 'IBM Plex Mono', monospace; font-size: 10.5px;
  color: var(--ink-4);
}
.t-pa-meta { text-align: right; flex: none; }
.t-pa-price {
  font-family: 'IBM Plex Mono', monospace; font-size: 12.5px;
  color: var(--green-900); font-weight: 500;
}
.t-pa-badges {
  display: flex; gap: 4px; justify-content: flex-end; margin-top: 4px; flex-wrap: wrap;
}
.t-pa-badge {
  font-family: 'IBM Plex Mono', monospace; font-size: 10px;
  letter-spacing: 0.05em; padding: 2px 7px; border-radius: 999px;
  border: 1px solid;
}
.t-pa-badge.rx          { background: var(--amber-100); color: #6B4A0F; border-color: rgba(0,0,0,0.06); }
.t-pa-badge.unavailable { background: oklch(0.96 0.04 30); color: var(--terra); border-color: oklch(0.85 0.06 30); }
.t-pa-badge.added       { background: var(--green-50); color: var(--green-900); border-color: var(--green-100); }
.t-pa-check { display: grid; place-items: center; flex: none; }
.t-pa-empty {
  text-align: center; padding: 36px 16px;
  color: var(--ink-3); font-size: 13.5px;
}
.t-pa-empty p { margin: 0; }

/* ─── image management modal ─── */
.t-image-dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 28px 20px; gap: 6px; cursor: pointer;
  background: var(--paper); border: 1.5px dashed var(--line-2);
  border-radius: var(--r-md);
  transition: all 160ms ease;
}
.t-image-dropzone:hover {
  border-color: var(--green-300); background: var(--paper-2);
}
.t-image-dropzone-title {
  font-family: 'Newsreader', serif; font-size: 15px; color: var(--ink);
  margin-top: 6px;
}
.t-image-dropzone-hint {
  font-family: 'IBM Plex Mono', monospace; font-size: 11px;
  letter-spacing: 0.05em; color: var(--ink-3);
}
.t-image-upload-progress {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 12px; padding: 6px 14px;
  background: var(--green-50); border: 1px solid var(--green-100);
  border-radius: 999px; font-size: 12.5px; color: var(--green-900);
}
.t-image-upload-progress .dot {
  width: 9px; height: 9px; border-radius: 50%;
  border: 2px solid var(--green-700); border-top-color: transparent;
  animation: chat-spin 700ms linear infinite;
}
.t-image-gallery {
  max-height: 380px; overflow-y: auto;
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 16px;
  display: flex; flex-wrap: wrap; gap: 14px;
}
.t-image-tile {
  position: relative; flex: none;
}
.t-image-tile img {
  height: 120px; width: auto; object-fit: cover;
  border-radius: var(--r-md); border: 1px solid var(--line);
  background: var(--surface); cursor: pointer;
  box-shadow: var(--shadow-1);
  transition: transform 120ms ease, box-shadow 120ms ease;
}
.t-image-tile:hover img {
  transform: translateY(-1px); box-shadow: var(--shadow-2);
}
.t-image-tile-delete {
  position: absolute; top: -8px; right: -8px;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--line);
  color: var(--terra); cursor: pointer;
  display: grid; place-items: center;
  opacity: 0; transition: all 160ms ease;
  box-shadow: var(--shadow-2);
}
.t-image-tile:hover .t-image-tile-delete { opacity: 1; }
.t-image-tile-delete:hover {
  background: var(--terra); color: white; border-color: var(--terra);
}
.t-image-empty {
  height: 240px;
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--r-md);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--ink-3); font-size: 13.5px;
}
.t-image-empty p { margin: 0; }

.t-image-preview-backdrop {
  position: fixed; inset: 0; z-index: 10000;
  background: rgba(27,31,26,0.78);
  display: grid; place-items: center;
  padding: 32px;
}
.t-image-preview-backdrop img {
  max-width: 92vw; max-height: 88vh;
  object-fit: contain; border-radius: var(--r-md);
  box-shadow: 0 24px 60px rgba(0,0,0,0.4);
}
.t-image-preview-close {
  position: absolute; top: 24px; right: 24px;
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.18);
  color: white; cursor: pointer;
  display: grid; place-items: center;
  transition: background 120ms ease;
}
.t-image-preview-close:hover { background: rgba(255,255,255,0.22); }

/* ─── modals (shared base) ─── */
.t-modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(27, 31, 26, 0.42);
  backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
  padding: 24px;
}
.t-modal-dialog {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: 0 24px 60px -16px rgba(27,31,26,0.25), var(--shadow-2);
  width: 100%; max-height: 92vh;
  display: flex; flex-direction: column;
  overflow: hidden;
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  color: var(--ink);
}
.t-modal-sm  { max-width: 460px; }
.t-modal-md  { max-width: 720px; }
.t-modal-lg  { max-width: 960px; }
.t-modal-xl  { max-width: 1200px; }
.t-modal-2xl { max-width: 1440px; }

.t-modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px; border-bottom: 1px solid var(--line);
  flex: none;
}
.t-modal-title {
  font-family: 'Newsreader', serif; font-size: 21px; font-weight: 500;
  color: var(--ink); margin: 0; letter-spacing: -0.01em;
}
.t-modal-close {
  width: 32px; height: 32px; border-radius: 8px;
  display: grid; place-items: center;
  background: transparent; border: 1px solid transparent;
  color: var(--ink-3); cursor: pointer;
  transition: all 120ms ease;
}
.t-modal-close:hover {
  background: var(--paper); color: var(--ink); border-color: var(--line);
}
.t-modal-body {
  padding: 22px 24px;
  overflow-y: auto; flex: 1; min-height: 0;
}
.t-modal-foot {
  padding: 14px 24px;
  border-top: 1px solid var(--line);
  background: var(--paper);
  display: flex; justify-content: flex-end; gap: 10px;
  flex: none;
}

/* ─── kpi tile (admin dashboards) ─── */
.kpi-tile {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 14px 16px;
  border-left-width: 3px;
}
.kpi-tile .label {
  font-family: 'IBM Plex Mono', monospace; font-size: 10.5px;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-3); margin-bottom: 6px;
}
.kpi-tile .value {
  font-family: 'Newsreader', serif; font-size: 22px;
  color: var(--ink); line-height: 1.1;
  overflow-wrap: anywhere; word-break: break-word;
}
.kpi-tile-neutral { border-left-color: var(--line-2); }
.kpi-tile-green   { border-left-color: var(--green-700); }
.kpi-tile-amber   { border-left-color: var(--amber-500); }
.kpi-tile-terra   { border-left-color: var(--terra); }

/* ─── rag admin ─── */
.t-rag-section {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); margin-bottom: 22px; overflow: hidden;
}
.t-rag-section header {
  padding: 14px 22px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
}
.t-rag-section header h2 {
  font-family: 'Newsreader', serif; font-size: 19px; font-weight: 500;
  margin: 0; color: var(--ink);
}
.t-rag-section .body { padding: 22px; }
.t-rag-section .row-actions {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
}
.t-rag-section .row-actions .spacer { flex: 1; }
.t-rag-section .progress {
  margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--line);
}
.t-rag-section .progress .meta {
  display: flex; justify-content: space-between;
  font-family: 'IBM Plex Mono', monospace; font-size: 11.5px;
  color: var(--ink-3); margin-bottom: 6px;
}
.t-rag-section .progress .bar {
  height: 4px; background: var(--paper-2); border-radius: 2px; overflow: hidden;
}
.t-rag-section .progress .bar > div {
  height: 100%; transition: width 240ms ease;
}
.t-rag-section .progress .bar > div.running   { background: var(--green-700); }
.t-rag-section .progress .bar > div.done      { background: var(--green-900); }
.t-rag-section .progress .bar > div.cancelled { background: var(--ink-4); }
.t-rag-section .progress .bar > div.error     { background: var(--terra); }
.t-rag-section .progress .msg {
  font-family: 'IBM Plex Mono', monospace; font-size: 11px;
  color: var(--ink-3); margin-top: 6px;
}
.t-rag-section .progress .err {
  color: var(--terra); margin-top: 4px; font-size: 12px;
}

.t-rag-status-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px; margin-bottom: 18px;
}
.t-rag-status-meta {
  font-family: 'IBM Plex Mono', monospace; font-size: 11.5px;
  color: var(--ink-3); display: flex; gap: 6px; align-items: center;
}
.t-rag-langlist {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px; margin-top: 14px;
}
.t-rag-langlist > div {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px; background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--r-sm);
}
.t-rag-langlist .lang {
  font-family: 'Newsreader', serif; font-size: 14px; color: var(--ink);
}
.t-rag-langlist .stat {
  font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--ink-3);
}

.t-rag-list-head {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  padding: 12px 22px; border-bottom: 1px solid var(--line);
  background: var(--paper);
  font-family: 'IBM Plex Mono', monospace; font-size: 11px;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3);
}
.t-rag-search {
  display: flex; align-items: center; gap: 6px; flex: 1; min-width: 220px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 4px 10px;
}
.t-rag-search input {
  flex: 1; border: none; outline: none; background: transparent;
  font: inherit; font-size: 13px; color: var(--ink);
  text-transform: none; letter-spacing: normal;
}
.t-rag-list {
  max-height: 60vh; overflow-y: auto;
}
.t-rag-row {
  display: grid; grid-template-columns: 36px minmax(0, 2fr) minmax(0, 2fr) 140px;
  gap: 14px; align-items: center;
  padding: 10px 22px; border-top: 1px solid var(--line);
  font-size: 13.5px;
}
.t-rag-row:hover { background: var(--paper); }
.t-rag-row .nm { min-width: 0; }
.t-rag-row .nm .pin {
  font-family: 'Newsreader', serif; font-size: 14.5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.t-rag-row .nm .id {
  font-family: 'IBM Plex Mono', monospace; font-size: 10px; color: var(--ink-4);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.t-rag-row .lang-chips {
  display: flex; flex-wrap: wrap; gap: 4px;
}
.t-rag-row .lang-chips > span {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 8px; border-radius: 999px;
  background: var(--green-50); border: 1px solid var(--green-100);
  font-family: 'IBM Plex Mono', monospace; font-size: 10.5px;
  color: var(--green-900);
}
.t-rag-row .lang-chips > span .c { color: var(--ink-3); }
.t-rag-row .none {
  font-family: 'IBM Plex Mono', monospace; font-size: 10.5px;
  color: var(--ink-4); padding: 2px 8px; border-radius: 999px;
  background: var(--paper); border: 1px dashed var(--line-2);
  display: inline-flex; align-items: center;
}
.t-rag-row .actions { text-align: right; }
.t-rag-row .actions a {
  font-family: inherit; font-size: 13px;
  color: var(--green-700); cursor: pointer;
  display: inline-flex; align-items: center; gap: 4px;
}
.t-rag-row .actions a:hover { color: var(--green-900); }
.t-rag-empty {
  padding: 36px 22px; text-align: center;
  color: var(--ink-3); font-size: 13.5px;
}

.btn-danger {
  background: oklch(0.96 0.04 30); color: var(--terra);
  border-color: oklch(0.85 0.06 30);
}
.btn-danger:hover { background: oklch(0.93 0.05 30); }

/* ─── admin toggle row ─── */
.t-toggle-row {
  display: flex; align-items: center; gap: 24px;
  padding: 18px 22px; border-bottom: 1px solid var(--line);
}
.t-toggle-row.is-last { border-bottom: none; }
.t-toggle-row.is-disabled { opacity: 0.55; }
.t-toggle-text { flex: 1; min-width: 0; }
.t-toggle-text h4 {
  font-family: 'Newsreader', serif; font-size: 17px; font-weight: 500;
  margin: 0 0 4px; color: var(--ink);
}
.t-toggle-text p {
  margin: 0; font-size: 13px; color: var(--ink-3); line-height: 1.45;
}
.t-switch {
  flex: none; width: 44px; height: 24px;
  border-radius: 999px; border: 1px solid var(--line);
  background: var(--paper-2); cursor: pointer;
  position: relative; transition: all 160ms ease;
  padding: 0;
}
.t-switch:hover { border-color: var(--line-2); }
.t-switch.on { background: var(--green-700); border-color: var(--green-700); }
.t-switch .thumb {
  position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--surface); box-shadow: var(--shadow-1);
  transition: transform 160ms ease;
}
.t-switch.on .thumb { transform: translateX(20px); }
.t-switch:disabled { cursor: not-allowed; }

/* citation badges inside summary */
.t-chat-cite {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 18px; padding: 0 5px;
  margin: 0 1px; vertical-align: 1px;
  border-radius: 4px;
  background: var(--green-700); color: white;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10.5px; font-weight: 500; line-height: 1;
  cursor: pointer; border: none;
  transition: background 120ms ease;
}
.t-chat-cite:hover { background: var(--green-900); }
.t-chat-cite:focus { outline: 2px solid var(--green-300); outline-offset: 1px; }

/* result card highlight when scrolled-to from a citation */
.t-chat-result.flash {
  border-color: var(--green-700);
  box-shadow: 0 0 0 3px var(--green-50);
  animation: chat-flash 1200ms ease-out;
}
@keyframes chat-flash {
  0%   { box-shadow: 0 0 0 6px var(--green-100); }
  100% { box-shadow: 0 0 0 3px var(--green-50); }
}

/* follow-up suggestion chips */
.t-chat-followups {
  margin-top: 14px;
  display: flex; flex-wrap: wrap; gap: 8px;
}
.t-chat-followup {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 14px; font-size: 13px; color: var(--ink-2);
  cursor: pointer; font-family: inherit;
  transition: all 120ms ease;
  display: inline-flex; align-items: center; gap: 6px;
}
.t-chat-followup::before {
  content: '↳'; color: var(--green-700); font-size: 13px;
}
.t-chat-followup:hover {
  border-color: var(--green-300); background: var(--paper);
  color: var(--ink);
}

/* error toast */
.t-chat-error {
  background: oklch(0.96 0.04 30);
  border: 1px solid oklch(0.85 0.06 30);
  border-left: 3px solid var(--terra);
  border-radius: var(--r-md);
  padding: 12px 16px;
  display: flex; gap: 10px; align-items: flex-start;
  color: var(--ink); font-size: 13.5px;
}
.t-chat-error strong {
  font-family: 'Newsreader', serif; font-weight: 500;
  color: var(--terra); display: block; margin-bottom: 2px;
}
.t-chat-error svg { flex: none; color: var(--terra); margin-top: 2px; }

/* ─── print stylesheet ─── */
/* TCM practitioners print monographs. Hide all chrome; flatten the article body
   into a clean black-on-white document. The currently-active tab prints; multi-tab
   print would require Razor changes (deferred). */
@media print {
  /* Reset everything to high-contrast B/W. Drop animations, shadows, gradients. */
  html, body, .tcm {
    background: white !important;
    color: black !important;
    font-size: 11pt;
    line-height: 1.4;
  }
  *, *::before, *::after {
    box-shadow: none !important;
    text-shadow: none !important;
    animation: none !important;
    transition: none !important;
  }

  /* Hide app chrome */
  .t-topbar,
  .t-nav,
  .t-pill,
  .t-rail,
  .scope-menu,
  .crumbs,
  .feedback-cta,
  .t-scoped-chat,
  .t-chat-page,
  .t-modal-backdrop,
  .tabs,
  .mobile-tabs,
  .page-actions,
  .compare-toolbar,
  .card-compare-toggle,
  .btn,
  .t-toggle,
  .pagination,
  .scrollbar-thin,
  .t-hero-search,
  .search-bar,
  .t-pa-search-row,
  .related-card .arrow,
  /* Anything that's interactive-only on the article page */
  .t-image-tile-delete,
  /* Don't print the "Ähnliche Mittel" recommendation strip */
  section[style*="Ähnliche Mittel"]
  { display: none !important; }

  /* Article detail layout — full-width single column */
  .detail-wrap, .detail-hero, .tcm {
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  .detail-hero {
    grid-template-columns: 160px minmax(0, 1fr) !important;
    gap: 24px !important;
    border-bottom: 1px solid #aaa !important;
    padding-bottom: 16px !important;
    page-break-after: avoid;
  }
  .specimen-large {
    width: 160px !important; height: 160px !important;
    background: white !important; border: 1px solid #888 !important;
    font-size: 64px !important;
  }
  .specimen-large::after { display: none !important; }
  .detail-id .han { color: black !important; }
  .detail-id .pinyin-roman, .detail-id .kicker { color: #444 !important; }

  /* Tab content — make sure the active tab prints fully */
  .tab-content, [class*="tab-pane"] { display: block !important; }

  /* Article content blocks */
  .sect-card, .t-meta-card, .card {
    background: white !important;
    border: 1px solid #888 !important;
    box-shadow: none !important;
    page-break-inside: avoid;
    margin-bottom: 12px !important;
  }
  .sect-title, h1, h2, h3, h4 {
    color: black !important;
    page-break-after: avoid;
  }
  .indications p, .prose p, .prose li { color: black !important; }
  .prose a { color: black !important; text-decoration: underline; }
  .prose a::after { content: " (" attr(href) ")"; font-size: 9pt; color: #555; }
  .prose blockquote {
    background: white !important;
    border-left: 2px solid #888 !important;
    color: #333 !important;
  }
  .prose code, .prose pre {
    background: white !important;
    border: 1px solid #aaa !important;
    color: black !important;
  }

  /* TCM tag chips remain visible but B/W */
  .tcm-tag, .tag {
    background: white !important;
    color: black !important;
    border: 1px solid #888 !important;
  }

  /* Image embedding on the hero — keep it at print-friendly size */
  .specimen-large img,
  .specimen.has-img img,
  .card .specimen img {
    filter: grayscale(0.15);
  }

  /* Page breaks */
  h1 { page-break-before: auto; }
  h2, h3 { page-break-after: avoid; page-break-inside: avoid; }
  .sect-card, .t-meta-card { page-break-inside: avoid; }

  /* Show page header with article identifier on every page */
  @page {
    margin: 18mm 16mm;
  }
}


/* ─── demo-mode gate ─── */
.demo-gate {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 64px 24px;
  background:
    radial-gradient(900px 360px at 50% -10%, var(--green-50), transparent 70%),
    var(--bg);
}
.demo-gate-card {
  max-width: 480px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 36px 32px;
  box-shadow: var(--shadow-2);
}
.demo-gate-card h1 {
  font-family: 'Newsreader', serif;
  font-size: 30px;
  font-weight: 500;
  letter-spacing: -0.015em;
  margin: 6px 0 8px;
  color: var(--ink);
}
.demo-gate-card p {
  color: var(--ink-3);
  font-size: 15px;
  margin: 0 0 24px;
}
.demo-gate-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
}


/* ─── admin demo-toggle ─── */
.demo-toggle {
  display: inline-flex;
  align-items: flex-start;
  gap: 14px;
  cursor: pointer;
  user-select: none;
}
.demo-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.demo-toggle-track {
  width: 44px; height: 24px; flex: none;
  background: var(--paper-2);
  border-radius: 999px;
  position: relative;
  transition: background 160ms ease;
  margin-top: 2px;
}
.demo-toggle-knob {
  position: absolute;
  top: 2px; left: 2px;
  width: 20px; height: 20px;
  background: var(--surface);
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0,0,0,0.15);
  transition: transform 160ms ease;
}
.demo-toggle input:checked + .demo-toggle-track { background: var(--green-700); }
.demo-toggle input:checked + .demo-toggle-track .demo-toggle-knob { transform: translateX(20px); }
.demo-toggle input:disabled + .demo-toggle-track { opacity: 0.5; cursor: progress; }
.demo-toggle-label {
  display: flex; flex-direction: column; gap: 2px;
}
.demo-toggle-label strong {
  font-family: 'Newsreader', serif;
  font-size: 16px; font-weight: 500;
  color: var(--ink);
  letter-spacing: -0.015em;
}
.demo-toggle-label span {
  font-size: 13px; color: var(--ink-3);
}


/* ─── admin · MCP fresh-key card ─── */
.mcp-fresh-card {
  margin-top: 18px;
  padding: 18px 20px;
  background: var(--green-50);
  border: 1px solid var(--green-100);
  border-radius: var(--r-md);
}
.mcp-fresh-card p { margin: 0; color: var(--ink-2); font-size: 13px; }
.mcp-fresh-row {
  display: grid;
  grid-template-columns: 80px 1fr auto;
  gap: 10px; align-items: center;
  margin-top: 10px;
}
.mcp-fresh-row .lbl {
  font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink-3);
}
.mcp-fresh-row .val {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 6px 10px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12.5px;
  color: var(--ink);
  overflow-x: auto;
  white-space: nowrap;
}
