/*
 * Tradevane design system (loaded last).
 * Warm ivory surfaces, clay actions and plum ink. Workspaces share
 * typography and controls, with page styles setting their own density.
 */
:root {
  /* ---------- 字体 ---------- */
  --tv-font: "Aptos", "Segoe UI Variable Text", "Segoe UI", "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", system-ui, sans-serif;
  --tv-font-editorial: Georgia, "Songti SC", SimSun, serif;
  --tv-numerals: lining-nums tabular-nums;
  --tv-weight-data: 500;
  --tv-weight-data-strong: 650;
  --tv-mono: "JetBrains Mono", "Cascadia Mono", Consolas, ui-monospace, monospace;

  /* ---------- Warm neutral surfaces and outlines ---------- */
  --tv-bg: #f8f6f0;
  --tv-rail: #f0eee6;
  --tv-surface: #fffefa;
  --tv-subtle: #f6f3eb;
  --tv-surface-hover: #f2efe7;
  --tv-border: #e4dfd4;
  --tv-border-strong: #c9c1b4;
  --tv-control-border: #ae9a93;
  --tv-text: #2c2329;
  --tv-text-2: #64565c;
  --tv-text-3: #6f6066;
  --tv-text-4: var(--tv-text-3);
  --tv-line: var(--tv-border);

  /* ---------- 品牌色：全站唯一彩色 ---------- */
  --tv-brand: #98412e;
  --tv-brand-hover: #7d3324;
  --tv-brand-soft: #f2dbd1;
  --tv-on-brand: #fffdf9;
  --tv-brand-ring: rgba(152, 65, 46, .24);
  --tv-plum: #3e2839;
  --tv-plum-ink: #fff8f4;
  --tv-plum-muted: #f3dedc;
  --tv-clay-light: #b46c55;

  /* V2 trade workspaces: warm ivory, mint and deep teal. */
  --tv-trade-bg: var(--tv-bg);
  --tv-trade-surface: var(--tv-surface);
  --tv-trade-surface-hover: #edf6ef;
  --tv-trade-subtle: #edf5ee;
  --tv-trade-mint-sage: #bfd7c7;
  --tv-trade-brand: #08695f;
  --tv-trade-brand-hover: #064d47;
  --tv-trade-brand-soft: #dff4f1;
  --tv-trade-brand-ring: #08695f35;
  --tv-trade-forest: #193d36;
  --tv-trade-text: #172d32;
  --tv-trade-text-2: #365159;
  --tv-trade-text-3: #526663;
  --tv-trade-border: #dce5de;
  --tv-trade-border-strong: #a5bcb1;
  --tv-trade-shadow: 0 8px 24px -18px #193d3666;

  /* ---------- 语义色：只有三支（暗红 / 琥珀 / 深绿） ---------- */
  --tv-danger: #a32e22;
  --tv-danger-bg: #fbf3f1;
  --tv-danger-border: #e7c9c3;
  --tv-warning: #8a5300;
  --tv-warning-bg: #fbf4e9;
  --tv-warning-border: #e3cfa9;
  --tv-success: #2c6950;
  --tv-success-bg: #eaf1ed;
  --tv-success-border: #c2d6cd;
  --tv-info: #644864;
  --tv-info-bg: #f1e7ef;
  --tv-info-border: var(--tv-border);

  /* ---------- 字号：8 档以内，行高在 theme.css 尾部统一 ---------- */
  --tv-fs-xs: 11px;
  --tv-fs-sm: 12px;
  --tv-fs-md: 13px;
  --tv-fs-body: 15px;
  --tv-fs-lg: 16px;
  --tv-fs-xl: 20px;
  --tv-fs-title: 24px;
  --tv-fs-display: 30px;
  /* 兼容别名：落到上面 8 档里，不再另开新档 */
  --tv-fs-small: var(--tv-fs-md);
  --tv-fs-section: var(--tv-fs-lg);

  /* ---------- 间距：9 档 ---------- */
  --tv-s1: 4px; --tv-s2: 8px; --tv-s3: 12px; --tv-s4: 16px; --tv-s5: 20px;
  --tv-s6: 24px; --tv-s7: 32px; --tv-s8: 40px; --tv-s9: 48px;

  /* ---------- 圆角：4 / 6 / 8，只留 full 给圆形 ---------- */
  --tv-radius-xs: 6px;
  --tv-radius-sm: 8px;
  --tv-radius: 10px;
  --tv-radius-lg: 16px;
  --tv-radius-feature: 20px;
  --tv-radius-full: 999px;

  /* ---------- 阴影：3 级，绿灰，不发光 ---------- */
  --tv-shadow-sm: 0 2px 5px #402b350d;
  --tv-shadow: 0 8px 20px -14px #402b3559;
  --tv-shadow-lg: 0 18px 32px -20px #402b3580;

  /* ---------- 控件与容器 ---------- */
  --tv-control-h-sm: 30px; --tv-control-h-md: 36px; --tv-control-h-lg: 40px; --tv-control-h: 36px;
  --tv-scrim: rgba(45, 31, 42, .48);
  --tv-motion: 160ms cubic-bezier(.2, .65, .25, 1);
  --sidebar-width: 242px;
  --tv-gutter: clamp(16px, 2.2vw, 32px);

  /* ---------- 旧名别名（模块样式表还在用，全部指向上面 ---------- */
  --ink: var(--tv-text); --muted: var(--tv-text-3); --paper: var(--tv-bg); --line: var(--tv-border);
  --teal: var(--tv-brand); --lime: var(--tv-brand); --font: var(--tv-font); --panel: var(--tv-surface);
}

html { -webkit-text-size-adjust: 100%; }
body { font-family: var(--tv-font); font-size: var(--tv-fs-body); line-height: 1.55; color: var(--tv-text); background: var(--tv-bg); font-variant-numeric: var(--tv-numerals); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
body:before { display: none; }
h1, h2, h3, h4 { font-family: var(--tv-font); color: var(--tv-text); letter-spacing: -.012em; font-weight: 600; }
::selection { background: var(--tv-brand-soft); color: var(--tv-text); }
a { color: var(--tv-brand); }
.workspace-back {
  place-items: center;
  flex: 0 0 40px;
  inline-size: 40px;
  block-size: 40px;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  border: 1px solid var(--tv-trade-border);
  border-radius: var(--tv-radius-sm);
  background: var(--tv-trade-surface);
  color: var(--tv-trade-brand);
  text-decoration: none;
  line-height: 1;
  cursor: pointer;
}
.workspace-back:not([hidden]) { display: grid; }
.workspace-back .ph { font-size: 18px; }
.workspace-back:hover:not(:disabled) { background: var(--tv-trade-brand-soft); border-color: var(--tv-trade-brand); }
.workspace-back:focus-visible { outline: 2px solid var(--tv-trade-brand); outline-offset: 2px; }

/* ---------- Sidebar ---------- */
.sidebar { background: var(--tv-rail); color: var(--tv-text); border: 0; border-radius: var(--tv-radius-lg); padding: 14px 12px; scrollbar-width: thin; scrollbar-color: var(--tv-border-strong) transparent; }
.brand { gap: 10px; margin: 0 4px 16px; min-height: 38px; padding: 0; border: 0; }
.brand-mark { display: block; width: 148px; max-width: 100%; height: auto; border-radius: 0; background: transparent; }
.brand strong { color: var(--tv-text); font-size: var(--tv-fs-xl); font-weight: 700; letter-spacing: -.02em; line-height: 1.15; }
.brand small { color: var(--tv-text-3);font: 400 var(--tv-fs-sm) var(--tv-font); margin-top: 1px; }
.sidebar nav { display: flex; flex-direction: column; gap: 0; }
.sidebar nav a { display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 6px 10px; border-radius: var(--tv-radius); color: var(--tv-text-2); font-size: var(--tv-fs-body); font-weight: 500; box-shadow: none; border: 0; transition: background var(--tv-motion), color var(--tv-motion); }
.sidebar nav a:hover { background: var(--tv-surface-hover); color: var(--tv-text); }
/* ---------- Sidebar navigation groups ----------
 * The destinations are ordered by the action a salesperson is taking: find a
 * customer, talk to them, quote, deliver, get support, manage the workspace.
 * A group label is a span, not a link, and it has no tabindex, so Tab walks the
 * 19 destinations only. The label sits 10px below the previous link and 2px
 * above its own first link: the only spacing in the column that is not a row.
 * Rows are 32px so the whole flow still fits a 900px-tall window.
 */
.sidebar nav .nav-group { display: flex; flex-direction: column; gap: 1px; margin-top: 8px; }
.sidebar nav .nav-group-label { display: block; margin: 0 0 2px; padding: 0 10px; color: var(--tv-text-4); font-family: var(--tv-font); font-size: var(--tv-fs-md); font-weight: 600; line-height: 1.25; letter-spacing: .04em; }
/* Narrow windows turn the sidebar into a top bar; there the nav is one scrolling row
   again and the captions step aside, because a horizontal strip has no room for a label
   between two links. */
@media (max-width: 800px) {
  .sidebar nav { flex-direction: row; flex-wrap: nowrap; overflow-x: auto; gap: 4px; }
  .sidebar nav > a, .sidebar nav .nav-group { flex: 0 0 auto; }
  .sidebar nav .nav-group { flex-direction: row; flex-wrap: nowrap; gap: 4px; margin-top: 0; }
  .sidebar nav .nav-group-label { display: none; }
  .sidebar nav a { min-height: 36px; }
}
.status-dot { background: var(--tv-brand); box-shadow: none; }

/* ---------- Main and top bar ---------- */
.main { padding: 0 32px 56px; max-width: 1600px; }
.topbar { position: sticky; top: 0; z-index: 8; min-height: 56px; margin: 0 -32px 24px; padding: 10px 32px; background: var(--tv-surface); border-bottom: 1px solid var(--tv-border); align-items: center; }
.topbar h1 { font-size: var(--tv-fs-md); font-weight: 500; color: var(--tv-text-3); letter-spacing: 0; }
.top-actions { gap: 8px; }
.top-actions .pill { background: var(--tv-surface); color: var(--tv-text-2); border: 1px solid var(--tv-border);font: 500 var(--tv-fs-sm) var(--tv-font); letter-spacing: 0; text-transform: none; padding: 4px 9px; }
.section-head { margin-bottom: 20px; }
.section-head h2, .view > header h2 { font-size: var(--tv-fs-display); font-weight: 680; letter-spacing: -.024em; line-height: 1.2; }
.section-head p { color: var(--tv-text-3); font-size: var(--tv-fs-md); }
.eyebrow {font: 600 var(--tv-fs-xs) var(--tv-font); letter-spacing: .06em; color: var(--tv-text-3); }

/* ---------- Buttons ---------- */
button, .button, .ghost { font-family: var(--tv-font); }
.button, button.primary, .kb-primary, .qd-primary, .ql-tabs a[aria-selected="true"] { background: var(--tv-brand); color: var(--tv-on-brand); border: 1px solid var(--tv-brand); box-shadow: none; }
.button { min-height: var(--tv-control-h); padding: 0 16px; gap: 8px; border-radius: var(--tv-radius); font-size: var(--tv-fs-md); font-weight: 600; box-shadow: none; }
.button:hover, .kb-primary:hover, .qd-primary:hover { background: var(--tv-brand-hover); border-color: var(--tv-brand-hover); box-shadow: var(--tv-shadow-sm); }
.ghost, .kb-secondary { min-height: var(--tv-control-h); padding: 0 14px; border-radius: var(--tv-radius); background: var(--tv-surface); color: var(--tv-text-2); border: 1px solid var(--tv-border-strong); font-size: var(--tv-fs-md); font-weight: 500; box-shadow: none; }
.ghost:hover, .kb-secondary:hover { background: var(--tv-subtle); color: var(--tv-text); border-color: var(--tv-control-border); }
button:focus-visible, a:focus-visible, .button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 2px solid var(--tv-brand); outline-offset: 2px; }
.button, .ghost, .tv-btn, .tv-btn--ghost, .kb-primary, .kb-secondary { transition: background var(--tv-motion), border-color var(--tv-motion), color var(--tv-motion), box-shadow var(--tv-motion), transform var(--tv-motion); }
.button:active:not(:disabled), .ghost:active:not(:disabled), .tv-btn:active:not(:disabled), .tv-btn--ghost:active:not(:disabled) { transform: translateY(1px); }
button:disabled, .button[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }

/* ---------- Form controls ---------- */
label { color: var(--tv-text-2);font: 500 var(--tv-fs-md) var(--tv-font); }
input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]), select, textarea {font: var(--tv-fs-body) var(--tv-font); line-height: 18px; color: var(--tv-text); background: var(--tv-surface); border: 1px solid var(--tv-border-strong); border-radius: var(--tv-radius); min-height: var(--tv-control-h); padding: 8px 11px; box-shadow: none; transition: border-color .12s, box-shadow .12s; }
input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]), select { height: var(--tv-control-h); }
input:not([type=checkbox]):not([type=radio]):hover, select:hover, textarea:hover { border-color: var(--tv-control-border); }
input:not([type=checkbox]):not([type=radio]):focus, select:focus, textarea:focus { border-color: var(--tv-brand); box-shadow: 0 0 0 3px var(--tv-brand-ring); outline: none; }
input::placeholder, textarea::placeholder { color: var(--tv-text-3); }
input[type=checkbox], input[type=radio] { accent-color: var(--tv-brand); }

/* ---------- Cards and panels ---------- */
.form-card, .garden-panel, .hero, .metric-grid article, .module-card, .search-outcome,
.kb-root .kb-card, .kb-panel, .ql-panel > div > section, .pp-card, .fc-card, .qd-profile fieldset, .qd-table-wrap,
.settings-panel, .settings-card, .provider-card, .dori-settings-card, .trade-card, .translator-card, .radar-card {
  background: var(--tv-surface); border: 1px solid var(--tv-border); border-radius: var(--tv-radius-lg); box-shadow: var(--tv-shadow);
}

/* ---------- Tables ---------- */
table, time, input[type="number"], input[type="date"], input[type="datetime-local"], output { font-variant-numeric: var(--tv-numerals); }
th { color: var(--tv-text-3);font: 600 var(--tv-fs-sm) var(--tv-font); letter-spacing: .02em; text-transform: none; background: var(--tv-subtle); }
td { color: var(--tv-text); }
tbody tr { transition: background .1s; }
tbody tr:hover { background: #fafbfa; }

/* ---------- Tabs (quote library, knowledge base, settings) ---------- */
.ql-tabs { gap: 2px; padding: 3px; background: #eceeed; border-radius: var(--tv-radius); border: 0; width: max-content; max-width: 100%; overflow-x: auto; }
.ql-tabs a { min-height: 30px; padding: 5px 14px; border-radius: var(--tv-radius-sm); color: var(--tv-text-2); font-size: var(--tv-fs-md); font-weight: 500; background: transparent; border: 0; box-shadow: none; white-space: nowrap; }
.ql-tabs a:hover { color: var(--tv-text); }
.ql-tabs a[aria-selected="true"] { background: var(--tv-surface); color: var(--tv-text); border: 0; box-shadow: var(--tv-shadow); }
.settings-nav { padding: 6px; border-radius: var(--tv-radius-lg); background: var(--tv-surface); border: 1px solid var(--tv-border); box-shadow: var(--tv-shadow); }
.settings-nav a { border-radius: var(--tv-radius-sm); padding: 8px 12px; color: var(--tv-text-2); font-size: var(--tv-fs-md); box-shadow: none; }
.settings-nav a.active { background: var(--tv-brand-soft); color: var(--tv-brand); box-shadow: none; font-weight: 600; }

/* ---------- Badges ---------- */
.pill { border-radius: var(--tv-radius-xs); }
.kb-status, .qd-status { display: inline-flex; align-items: center; gap: 6px; font-size: var(--tv-fs-sm); font-weight: 500; }
.kb-status:before, .qd-status:before { content: ""; width: 6px; height: 6px; border-radius: var(--tv-radius-full); background: currentColor; opacity: .85; }
.kb-status.good, .qd-status.good { color: var(--tv-success); }
.kb-status.pending, .qd-status.pending { color: var(--tv-warning); }
.kb-status.bad, .qd-status.bad { color: var(--tv-danger); }

/* ---------- Dashboard ----------
 * One page title: the overview header owns the greeting, the date and today's
 * summary, and the garden below starts on its first panel. The dashboard stack
 * uses the same rhythm as the overview cards: 24px between blocks, 16px inside
 * one. The garden keeps a slim line for the daily tip and the browser-local
 * preferences; the greeting and the clock that used to live here are gone.
 */
body[data-view=dashboard] .main { background: none; }
body[data-view=dashboard] .topbar { position: sticky; margin: 0 -32px 8px; padding: 10px 32px; justify-content: flex-end; border-bottom: 1px solid var(--tv-border); }
#dashboard { display: flex; flex-direction: column; gap: 24px; }
.garden-meta { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; min-height: 34px; }
.garden-tip { display: inline-flex; align-items: center; gap: 8px; margin: 0; color: var(--tv-text-3); font-size: var(--tv-fs-md); line-height: 1.5; }
.garden-tip .ph { color: var(--tv-brand); font-size: var(--tv-fs-lg); }
.workspace-preferences { position: relative; margin: 0; color: var(--tv-text-3); font-size: var(--tv-fs-md); line-height: 1.5; }
.workspace-preferences summary { display: inline-flex; align-items: center; min-height: 30px; padding: 0 8px; border-radius: var(--tv-radius-sm); cursor: pointer; list-style: none; }
.workspace-preferences summary::-webkit-details-marker { display: none; }
.workspace-preferences summary:hover { background: var(--tv-surface-hover); color: var(--tv-text); }
.workspace-preferences[open] { padding: 12px 14px; border: 1px solid var(--tv-border); border-radius: var(--tv-radius); background: var(--tv-surface); box-shadow: var(--tv-shadow); }
.workspace-preferences label { display: flex; align-items: center; gap: 8px; margin: 8px 0; font-size: var(--tv-fs-md); }
.workspace-preferences input:not([type=checkbox]) { min-height: 34px; width: 180px; }
.workspace-preferences small { display: block; color: var(--tv-text-3); font-size: var(--tv-fs-md); }
.metric-icon { width: 40px; height: 40px; border-radius: var(--tv-radius); background: var(--tv-brand-soft); color: var(--tv-brand); }
.metric-icon .ph { font-size: var(--tv-fs-xl); }
.garden-panel { padding: 18px 20px; }
.panel-heading h3 { font-size: var(--tv-fs-lg); }
.panel-heading h3 .ph { font-size: var(--tv-fs-xl); color: var(--tv-text-3); }
.empty-plant { background: var(--tv-subtle); border: 1px solid var(--tv-border); color: var(--tv-text-3); width: 52px; height: 52px; border-radius: var(--tv-radius); }
.empty-plant .ph { font-size: var(--tv-fs-title); }
.garden-empty { min-height: 260px; }
.garden-empty h4 { font-size: var(--tv-fs-lg); font-weight: 600; }


/* ---------- Scrollbars ---------- */
* { scrollbar-width: thin; scrollbar-color: var(--tv-border-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--tv-border-strong); border-radius: var(--tv-radius); border: 3px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background-color: var(--tv-control-border); }

@media (max-width: 1080px) {
  :root { --sidebar-width: 207px; }
  .main { padding: 0 20px 40px; }
  .topbar, body[data-view=dashboard] .topbar { margin: 0 -20px 20px; padding: 10px 20px; }
}
@media (max-width: 800px) {
  .sidebar { background: var(--tv-surface); }
  .topbar { position: static; }
}

/* ---------- Refinements after visual review ---------- */
/* Search boxes that wrap an icon: the label is the box, the input is borderless inside it. */
.kb-search input, .kb-search input:hover, .kb-search input:focus { border: 0 !important; box-shadow: none !important; background: transparent !important; min-height: 34px; }
.kb-search { border: 1px solid var(--tv-border-strong); border-radius: var(--tv-radius); background: var(--tv-surface); box-shadow: var(--tv-shadow-sm); }
.kb-search:focus-within { border-color: var(--tv-brand); box-shadow: 0 0 0 3px var(--tv-brand-ring); }
.kb-text[data-kb-folder] { white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
/* Price list: full-width readable table */
.pp-table { width: 100%; font-size: var(--tv-fs-md); }
.pp-table th { padding: 9px 10px;font: 600 var(--tv-fs-sm) var(--tv-font); color: var(--tv-text-3); background: var(--tv-subtle); border-bottom: 1px solid var(--tv-border); }
.pp-table td { padding: 10px; border-bottom: 1px solid #eef0ef; }
.pp-table td:nth-child(n+3) { white-space: nowrap; font-variant-numeric: tabular-nums; }
/* Settings sub-navigation: no stray radio-like circles */
.settings-nav a:before { display: none !important; }
.settings-nav a { display: flex; align-items: center; gap: 8px; }
/* Section headings inside panels */
.kb-head h2, .ql-head h2, .settings-head h2 { font-size: var(--tv-fs-xl); letter-spacing: -.02em; }
/* Code-style placeholder in the CSV box stays mono, everything else uses the UI font */
textarea[placeholder*="sku,"] { font-family: var(--tv-mono); font-size: var(--tv-fs-sm); }
/* ---------- Full-width layout ----------
 * The content column fills the space beside the fixed sidebar. Earlier layers
 * capped it (1500px, 1600px, 1780px) and centred it, which left an empty band
 * on the right of every page. Content now uses the full width, with a comfortable
 * maximum line length only for reading-width text blocks.
 */
.shell { display: block; }
.sidebar { position: fixed; inset: 12px auto 12px 12px; width: calc(var(--sidebar-width) - 12px); height: auto; max-height: none; z-index: 10; }
.sidebar + .main, .main { width: calc(100% - var(--sidebar-width)); max-width: none !important; margin-left: var(--sidebar-width); margin-right: 0; min-width: 0; box-sizing: border-box; }
.main { padding: 22px var(--tv-gutter) 48px !important; }
body[data-view=whatsapp] .main, body[data-view=mail] .main, body[data-view=ai-workbench] .main { padding: 12px 16px 16px !important; }
.topbar { margin-left: -36px; margin-right: -36px; padding-left: 36px; padding-right: 36px; }
body[data-view=whatsapp] .topbar { margin-left: 0; margin-right: 0; padding-left: 0; padding-right: 0; }
/* Narrow screens: sidebar becomes a top bar and the content takes the full width. */
@media (max-width: 800px) {
  .sidebar { position: static; width: auto; height: auto; max-height: none; margin: 8px 8px 0; background: var(--tv-rail); }
  .sidebar + .main, .main { width: 100%; margin-left: 0; padding: 14px 12px 40px !important; }
  .topbar { margin-left: -18px; margin-right: -18px; padding-left: 18px; padding-right: 18px; }
}

/* ---------- Page-level refinement pass ----------
 * Type scale, control sizes and icon sizes are set once here and applied to
 * every module. Specific fixes: checkbox rows, action button groups and the
 * metric/card rhythm. No feature markup or behaviour changes.
 */
body { font-size: var(--tv-fs-body); line-height: 1.6; }
h1 { font-size: var(--tv-fs-title); line-height: 1.25; }
h2 { font-size: var(--tv-fs-section); }
h3, h4 { font-size: var(--tv-fs-lg); }
p, li, td, th, label, .hint, .muted, small { font-size: var(--tv-fs-small); }
td, li, p { font-size: var(--tv-fs-body); }
/* Table headers hold the 13px floor; pages may style their own header band on top. */
th { font-size: var(--tv-fs-md); }
small, .eyebrow, .kb-status, .qd-status { font-size: var(--tv-fs-sm); }
input:not([type=checkbox]):not([type=radio]), select, textarea { font-size: var(--tv-fs-body); min-height: var(--tv-control-h); }
button, .button, .ghost, .kb-primary, .kb-secondary, .qd-primary { font-size: var(--tv-fs-body); min-height: 36px; }
.button, .kb-primary, .qd-primary { min-height: var(--tv-control-h); padding: 0 16px; font-size: var(--tv-fs-md); font-weight: 600; }
.ghost, .kb-secondary { padding: 7px 14px; }

/* Icons: one size for inline and toolbar icons, one for empty-state glyphs. */
.ph { font-size: var(--tv-fs-lg); line-height: 1; }
button .ph, .button .ph, .ghost .ph, a .ph { font-size: var(--tv-fs-lg); }
.empty-plant .ph, .empty-state .ph { font-size: var(--tv-fs-display); }

/* Checkbox rows: label sits next to the box, never pushed to a far edge. */
label:has(> input[type=checkbox]) { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
label:has(> input[type=checkbox]) input[type=checkbox] { margin: 0; width: 16px; height: 16px; flex: 0 0 auto; }
.manual-fx-confirm, .fx-confirm { display: flex; align-items: center; gap: 10px; }

/* Button groups in card headers and toolbars keep one baseline and wrap cleanly. */
.card-actions, .panel-actions, .row-actions, .ql-actions, .kb-actions, .head-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row-actions .ghost, .card-actions .ghost { white-space: nowrap; }

/* Cards and their headers: consistent padding and a quiet divider. */
.garden-panel, .form-card, .qd-profile fieldset, .kb-root .kb-card { padding: 20px; }
.panel-heading, .card-head, .section-head { padding-bottom: 14px; margin-bottom: 16px; border-bottom: 1px solid var(--tv-border); }

/* Tables: taller rows, tabular numbers, quiet hover, readable links. */
table { font-size: var(--tv-fs-body); }
td { height: 44px; padding: 0 14px; vertical-align: middle; }
th { padding: 10px 14px; }
td a { color: var(--tv-brand); text-decoration: none; font-weight: 500; }
td a:hover { text-decoration: underline; }

/* Search and filter bars share one height. */
.search-bar, .filter-bar, .toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.search-bar input, .filter-bar input, .toolbar input, .filter-bar select, .toolbar select { min-height: var(--tv-control-h); }

/* Badges in lists read as status chips, not text. */
.badge, .pill, .tag { font-size: var(--tv-fs-sm); font-weight: 500; line-height: 1; padding: 4px 8px; border-radius: var(--tv-radius-xs); }
/* The top bar carries a short context line, not a page title. */
.topbar h1, .topbar p, .topbar .context { font-size: var(--tv-fs-md) !important; font-weight: 500; color: var(--tv-text-3); letter-spacing: 0; line-height: 1.4; }

/* ---------- Final review fixes ---------- */
/* Pagination sits in its own row with clear space above and the cards. */
.pager, .pagination, .pp-pager, .cp-pager, .list-pager { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 18px; padding-top: 4px; }
.pager button, .pagination button, .list-pager button { min-width: 72px; }
/* Filter bars: the search button aligns with the inputs, not on its own line. */
.filter-grid, .filters, .cp-filters, .pp-filters { align-items: end; }
.filter-grid > button, .filters > button, .cp-filters > button, .pp-filters > button { align-self: end; min-height: var(--tv-control-h); }
/* Placeholder text needs enough contrast to read as a hint. */
::placeholder { color: var(--tv-text-3); opacity: 1; }
/* Footer disclaimers breathe. */
.translator-footer, .tool-footer, .disclaimer { padding: 14px 0 0; line-height: 1.6; color: var(--tv-text-3); }
/* Secondary buttons beside a primary action read as a group, not as stray boxes. */
.query-actions, .form-actions { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
/* The top bar holds status controls only: no page title or context line. */
.topbar > div:first-child:not(.top-actions) { display: none; }
.topbar { justify-content: flex-end; min-height: 56px; }
