/* =============================================================
   Hermes Console — Colors & Type
   --------------------------------------------------------------
   Adapted from satnaing/shadcn-admin theme.css (oklch slate-based).
   Use these tokens directly. All colors use the OKLCH color space
   so light/dark variants stay perceptually balanced.
   ============================================================= */

:root {
  /* ---------- Radii ---------- */
  --radius: 0.625rem;          /* 10px — default card / button */
  --radius-sm: calc(var(--radius) - 4px);
  --radius-md: calc(var(--radius) - 2px);
  --radius-lg: var(--radius);
  --radius-xl: calc(var(--radius) + 4px);

  /* ---------- Surfaces ---------- */
  --background:           oklch(1 0 0);                       /* page bg            */
  --foreground:           oklch(0.129 0.042 264.695);         /* primary text       */
  --card:                 oklch(1 0 0);                       /* card surface       */
  --card-foreground:      oklch(0.129 0.042 264.695);
  --popover:              oklch(1 0 0);
  --popover-foreground:   oklch(0.129 0.042 264.695);

  /* ---------- Brand / Primary ---------- */
  --primary:              oklch(0.208 0.042 265.755);         /* near-black slate   */
  --primary-foreground:   oklch(0.984 0.003 247.858);

  /* ---------- Secondary / Muted / Accent (all slate-tinted neutrals) ---------- */
  --secondary:            oklch(0.968 0.007 247.896);
  --secondary-foreground: oklch(0.208 0.042 265.755);
  --muted:                oklch(0.968 0.007 247.896);
  --muted-foreground:     oklch(0.554 0.046 257.417);
  --accent:               oklch(0.968 0.007 247.896);
  --accent-foreground:    oklch(0.208 0.042 265.755);

  /* ---------- Semantic ---------- */
  --destructive:          oklch(0.577 0.245 27.325);          /* red                */
  --success:              oklch(0.62  0.16  155);              /* green (running)   */
  --warning:              oklch(0.77  0.16  84);               /* amber (stale)     */
  --info:                 oklch(0.60  0.14  240);              /* blue (info)       */

  /* ---------- Lines & Inputs ---------- */
  --border:               oklch(0.929 0.013 255.508);
  --input:                oklch(0.929 0.013 255.508);
  --ring:                 oklch(0.704 0.04  256.788);

  /* ---------- Chart palette ---------- */
  --chart-1: oklch(0.646 0.222 41.116);
  --chart-2: oklch(0.6   0.118 184.704);
  --chart-3: oklch(0.398 0.07  227.392);
  --chart-4: oklch(0.828 0.189 84.429);
  --chart-5: oklch(0.769 0.188 70.08);

  /* ---------- Sidebar (mirrors base, can diverge) ---------- */
  --sidebar:                       var(--background);
  --sidebar-foreground:            var(--foreground);
  --sidebar-primary:               var(--primary);
  --sidebar-primary-foreground:    var(--primary-foreground);
  --sidebar-accent:                var(--accent);
  --sidebar-accent-foreground:     var(--accent-foreground);
  --sidebar-border:                var(--border);
  --sidebar-ring:                  var(--ring);

  /* ---------- Type ---------- */
  --font-sans:    'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Manrope', 'Inter', ui-sans-serif, sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --font-cn:      'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;

  /* sizes (rem) */
  --text-xs:   0.75rem;   /* 12 */
  --text-sm:   0.875rem;  /* 14 — table body, labels */
  --text-base: 1rem;      /* 16 — body */
  --text-lg:   1.125rem;  /* 18 */
  --text-xl:   1.25rem;   /* 20 — card titles */
  --text-2xl:  1.5rem;    /* 24 — page H1 */
  --text-3xl:  1.875rem;  /* 30 — KPI numbers */
  --text-4xl:  2.25rem;   /* 36 — display */

  /* weights */
  --fw-regular:  400;
  --fw-medium:   500;
  --fw-semibold: 600;
  --fw-bold:     700;

  /* ---------- Spacing scale (4px base) ---------- */
  --s-1:  0.25rem;
  --s-2:  0.5rem;
  --s-3:  0.75rem;
  --s-4:  1rem;
  --s-5:  1.25rem;
  --s-6:  1.5rem;
  --s-8:  2rem;
  --s-10: 2.5rem;
  --s-12: 3rem;
  --s-16: 4rem;

  /* ---------- Shadows ---------- */
  --shadow-xs: 0 1px 2px 0   oklch(0 0 0 / 0.04);
  --shadow-sm: 0 1px 3px 0   oklch(0 0 0 / 0.06), 0 1px 2px -1px oklch(0 0 0 / 0.06);
  --shadow:    0 4px 6px -1px oklch(0 0 0 / 0.07), 0 2px 4px -2px oklch(0 0 0 / 0.06);
  --shadow-md: 0 10px 15px -3px oklch(0 0 0 / 0.08), 0 4px 6px -4px oklch(0 0 0 / 0.06);
  --shadow-lg: 0 20px 25px -5px oklch(0 0 0 / 0.10), 0 8px 10px -6px oklch(0 0 0 / 0.06);
}

.dark {
  --background:           oklch(0.129 0.042 264.695);
  --foreground:           oklch(0.984 0.003 247.858);
  --card:                 oklch(0.14  0.04  259.21);
  --card-foreground:      oklch(0.984 0.003 247.858);
  --popover:              oklch(0.208 0.042 265.755);
  --popover-foreground:   oklch(0.984 0.003 247.858);
  --primary:              oklch(0.929 0.013 255.508);
  --primary-foreground:   oklch(0.208 0.042 265.755);
  --secondary:            oklch(0.279 0.041 260.031);
  --secondary-foreground: oklch(0.984 0.003 247.858);
  --muted:                oklch(0.279 0.041 260.031);
  --muted-foreground:     oklch(0.704 0.04  256.788);
  --accent:               oklch(0.279 0.041 260.031);
  --accent-foreground:    oklch(0.984 0.003 247.858);
  --destructive:          oklch(0.704 0.191 22.216);
  --border:               oklch(1 0 0 / 10%);
  --input:                oklch(1 0 0 / 15%);
  --ring:                 oklch(0.551 0.027 264.364);
  --chart-1: oklch(0.488 0.243 264.376);
  --chart-2: oklch(0.696 0.17  162.48);
  --chart-3: oklch(0.769 0.188 70.08);
  --chart-4: oklch(0.627 0.265 303.9);
  --chart-5: oklch(0.645 0.246 16.439);
}

/* =============================================================
   Semantic element styles — apply by class to skip Tailwind.
   ============================================================= */
html, body {
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.h-display { font-family: var(--font-display); font-size: var(--text-4xl); font-weight: var(--fw-bold);  letter-spacing: -0.02em; line-height: 1.1; }
.h1        { font-family: var(--font-display); font-size: var(--text-2xl); font-weight: var(--fw-bold);  letter-spacing: -0.015em; line-height: 1.2; }
.h2        { font-family: var(--font-display); font-size: var(--text-xl);  font-weight: var(--fw-semibold); letter-spacing: -0.01em; line-height: 1.3; }
.h3        { font-size: var(--text-lg);  font-weight: var(--fw-semibold); line-height: 1.4; }
.p         { font-size: var(--text-base); font-weight: var(--fw-regular); line-height: 1.55; }
.p-sm      { font-size: var(--text-sm);  color: var(--muted-foreground); line-height: 1.5; }
.label     { font-size: var(--text-xs);  font-weight: var(--fw-medium); text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted-foreground); }
.kpi       { font-family: var(--font-display); font-size: var(--text-3xl); font-weight: var(--fw-bold);  letter-spacing: -0.02em; }
.code, .mono { font-family: var(--font-mono); font-size: 0.85em; }

/* Hai浏览器 — UI kit styles
   Layers on top of ../../colors_and_type.css */

* { box-sizing: border-box; }
html, body, #app { height: 100%; margin: 0; }
body { background: var(--background); color: var(--foreground); font-family: var(--font-sans); }

/* ============ Layout shell ============ */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.shell.with-sheet { grid-template-columns: 240px 1fr 380px; }

/* ============ Sidebar ============ */
.sidebar {
  position: sticky; top: 0; align-self: start;
  height: 100vh; padding: 14px 10px;
  background: var(--sidebar); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 4px; overflow-y: auto;
}
.sb-brand { display: flex; align-items: center; gap: 9px; padding: 6px 8px 14px; margin-bottom: 6px; border-bottom: 1px solid var(--border); }
.sb-wm   { font-family: var(--font-display); font-weight: 600; font-size: 15px; letter-spacing: -0.01em; color: var(--foreground); }
.sb-wm span { color: var(--muted-foreground); font-weight: 400; }
.sb-group-label {
  font-size: 11px; font-weight: 500; color: var(--muted-foreground);
  text-transform: uppercase; letter-spacing: 0.06em;
  padding: 10px 8px 4px;
}
.sb-item {
  display: flex; align-items: center; gap: 10px; padding: 7px 8px;
  border-radius: var(--radius-md); font-size: 13px; color: var(--foreground);
  cursor: pointer; transition: background 120ms; -webkit-user-select: none; -moz-user-select: none; user-select: none;
}
.sb-item:hover { background: var(--accent); }
.sb-item.active { background: var(--accent); font-weight: 500; }
.sb-item .ic { color: var(--muted-foreground); flex-shrink: 0; }
.sb-item.active .ic { color: var(--foreground); }
.sb-badge {
  margin-left: auto; background: var(--primary); color: var(--primary-foreground);
  font-size: 10px; font-weight: 600; padding: 1px 6px; border-radius: 999px; line-height: 1.4;
}
.sb-foot { margin-top: auto; padding: 10px 6px 0; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 8px; }
.sb-foot .avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--primary); color: var(--primary-foreground); display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 11px; }
.sb-foot .name { font-size: 12px; font-weight: 500; }
.sb-foot .role { font-size: 11px; color: var(--muted-foreground); }

/* ============ Main column ============ */
.main { display: flex; flex-direction: column; min-width: 0; }
.header {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 10px;
  height: 56px; padding: 0 24px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in oklch, var(--background) 80%, transparent);
  backdrop-filter: blur(12px);
}
.crumb { font-size: 13px; color: var(--muted-foreground); display: flex; align-items: center; gap: 6px; }
.crumb b { color: var(--foreground); font-weight: 500; }
.crumb-sep { opacity: 0.4; }
.search-input {
  display: flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 10px; border: 1px solid var(--border); border-radius: var(--radius-md);
  background: var(--background); color: var(--muted-foreground); font-size: 13px; width: 220px;
}
.kbd { margin-left: auto; font-family: var(--font-mono); font-size: 10px; background: var(--muted); padding: 1px 5px; border-radius: 3px; }
.icon-btn { width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--background); color: var(--foreground); cursor: pointer; transition: background 120ms; }
.icon-btn:hover { background: var(--accent); }

.page { padding: 24px; flex: 1; min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.page-h1 { font-family: var(--font-display); font-size: 24px; font-weight: 700; letter-spacing: -0.015em; margin: 0 0 4px; }
.page-sub { font-size: 13px; color: var(--muted-foreground); margin: 0; }
.page-actions { display: flex; gap: 8px; }

/* ============ Atoms ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 14px; border-radius: var(--radius-md);
  font-family: var(--font-sans); font-size: 13px; font-weight: 500; line-height: 1;
  border: 1px solid transparent; cursor: pointer; transition: all 120ms; white-space: nowrap;
}
.btn-primary    { background: var(--primary); color: var(--primary-foreground); }
.btn-primary:hover    { background: oklch(from var(--primary) calc(l + 0.06) c h); }
.btn-secondary  { background: var(--background); color: var(--foreground); border-color: var(--border); }
.btn-secondary:hover  { background: var(--accent); }
.btn-ghost      { background: transparent; color: var(--foreground); }
.btn-ghost:hover      { background: var(--accent); }
.btn-destructive{ background: var(--destructive); color: white; }
.btn-destructive:hover{ background: oklch(from var(--destructive) calc(l - 0.04) c h); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12px; }
.btn:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }

.pill { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: var(--radius-sm); font-size: 11.5px; font-weight: 500; border: 1px solid; line-height: 1; }
.pill .dot  { width: 6px; height: 6px; border-radius: 50%; }
.pill .ring { width: 6px; height: 6px; border-radius: 50%; border: 1.5px solid currentColor; }
.pill-run  { background: color-mix(in oklch, var(--success) 12%, transparent); color: oklch(0.4 0.16 155); border-color: color-mix(in oklch, var(--success) 35%, transparent); }
.pill-warn { background: color-mix(in oklch, var(--warning) 18%, transparent); color: oklch(0.45 0.16 84);  border-color: color-mix(in oklch, var(--warning) 45%, transparent); }
.pill-err  { background: color-mix(in oklch, var(--destructive) 12%, transparent); color: oklch(0.46 0.22 27); border-color: color-mix(in oklch, var(--destructive) 35%, transparent); }
.pill-info { background: color-mix(in oklch, var(--info) 12%, transparent); color: oklch(0.4 0.14 240); border-color: color-mix(in oklch, var(--info) 35%, transparent); }
.pill-idle { background: var(--muted); color: var(--muted-foreground); border-color: var(--border); }
.pill-tag  { background: var(--background); color: var(--foreground); border-color: var(--border); font-family: var(--font-mono); font-size: 11px; }

.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.card-pad  { padding: 18px; }
.card-pad-sm { padding: 14px; }
.card-head { padding: 16px 18px 0; display: flex; align-items: center; justify-content: space-between; }
.card-title { font-size: 14px; font-weight: 600; margin: 0; }
.card-body { padding: 14px 18px 18px; }

.mono { font-family: var(--font-mono); }
.muted { color: var(--muted-foreground); }

/* ============ Tables ============ */
.tbl { width: 100%; border-collapse: collapse; }
.tbl thead th { text-align: left; font-size: 11px; font-weight: 500; color: var(--muted-foreground); text-transform: uppercase; letter-spacing: 0.05em; padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--background); }
.tbl tbody td { padding: 11px 16px; font-size: 13px; color: var(--foreground); border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr { cursor: pointer; transition: background 100ms; }
.tbl tbody tr:hover td { background: color-mix(in oklch, var(--accent) 50%, transparent); }
.tbl tbody tr.selected td { background: color-mix(in oklch, var(--accent) 100%, transparent); }
.tbl .chk { width: 16px; height: 16px; border: 1px solid var(--input); border-radius: 4px; display: inline-flex; align-items: center; justify-content: center; }
.tbl .chk.on { background: var(--primary); border-color: var(--primary); color: white; }

/* ============ KPI ============ */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.kpi { padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.kpi-head { display: flex; align-items: center; justify-content: space-between; }
.kpi-label { font-size: 12px; font-weight: 500; color: var(--muted-foreground); }
.kpi-icon  { color: var(--muted-foreground); }
.kpi-num   { font-family: var(--font-display); font-size: 28px; font-weight: 700; letter-spacing: -0.02em; line-height: 1; }
.kpi-sub   { font-size: 12px; color: var(--muted-foreground); }
.delta-up   { color: oklch(0.45 0.15 155); font-weight: 500; }
.delta-down { color: var(--destructive); font-weight: 500; }

/* ============ Tabs ============ */
.tablist { display: inline-flex; padding: 3px; background: var(--muted); border-radius: var(--radius-md); gap: 2px; }
.tab { padding: 6px 14px; border-radius: calc(var(--radius-md) - 2px); font-size: 13px; font-weight: 500; color: var(--muted-foreground); cursor: pointer; -webkit-user-select: none; -moz-user-select: none; user-select: none; transition: color 120ms; }
.tab.active { background: var(--background); color: var(--foreground); box-shadow: var(--shadow-xs); }
.tab[data-disabled="true"] { color: color-mix(in oklch, var(--muted-foreground) 50%, transparent); cursor: not-allowed; }

/* ============ Side sheet ============ */
.sheet { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--card); border-left: 1px solid var(--border); }
.sheet-head { padding: 18px 22px 14px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.sheet-title { font-family: var(--font-display); font-size: 16px; font-weight: 600; margin: 0 0 4px; }
.sheet-sub   { font-size: 12px; color: var(--muted-foreground); margin: 0; font-family: var(--font-mono); }
.sheet-body  { padding: 18px 22px; display: flex; flex-direction: column; gap: 22px; }

.kv-block { display: flex; flex-direction: column; gap: 4px; }
.kv-label { font-size: 11px; font-weight: 500; color: var(--muted-foreground); text-transform: uppercase; letter-spacing: 0.05em; }
.kv-val   { font-size: 13px; color: var(--foreground); }
.kv-val.mono { font-size: 12px; }

.section-h { font-size: 12px; font-weight: 600; color: var(--muted-foreground); text-transform: uppercase; letter-spacing: 0.06em; margin: 0 0 8px; }

/* ============ Toast ============ */
.toast-stack { position: fixed; bottom: 24px; right: 24px; display: flex; flex-direction: column; gap: 10px; z-index: 50; }
.toast { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-md); min-width: 280px; max-width: 360px; animation: toast-in 200ms ease-out; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.toast .ic-wrap { flex-shrink: 0; margin-top: 1px; }
.toast .body { flex: 1; }
.toast .title { font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.toast .desc  { font-size: 12px; color: var(--muted-foreground); line-height: 1.45; }
.toast.success .ic-wrap { color: var(--success); }
.toast.error   .ic-wrap { color: var(--destructive); }

/* ============ Chart ============ */
.chart { position: relative; height: 220px; padding: 8px 0; }
.chart-grid { position: absolute; inset: 8px 0; pointer-events: none; }
.chart-grid div { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--border); }
.chart svg { width: 100%; height: 100%; overflow: visible; }
.chart-axis { font-family: var(--font-mono); font-size: 10px; fill: var(--muted-foreground); }

/* ============ Misc ============ */
.divider { height: 1px; background: var(--border); margin: 0; }
.tag-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.avatar-sm { width: 24px; height: 24px; border-radius: 50%; background: var(--muted); color: var(--foreground); display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: 11px; flex-shrink: 0; }
.quota-bar { width: 60px; height: 4px; border-radius: 999px; background: var(--muted); overflow: hidden; }
.quota-bar > div { height: 100%; border-radius: inherit; transition: width 200ms; }

/* ============ Form atoms ============ */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.form-field { display: flex; flex-direction: column; gap: 5px; }
.form-label { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 12px; font-weight: 500; color: var(--foreground); }

.form-input { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px; background: var(--background); border: 1px solid var(--input); border-radius: var(--radius-md); transition: border-color 120ms, box-shadow 120ms; }
.form-input.mono input { font-family: var(--font-mono); font-size: 12.5px; }
.form-input:focus-within { border-color: var(--ring); box-shadow: 0 0 0 2px color-mix(in oklch, var(--ring) 30%, transparent); }
.form-input input { flex: 1; border: 0; outline: 0; background: transparent; font: inherit; color: var(--foreground); font-size: 13px; min-width: 0; padding: 0; }
.form-input input::-moz-placeholder { color: var(--muted-foreground); }
.form-input input::placeholder { color: var(--muted-foreground); }
.form-input .ic { color: var(--muted-foreground); flex-shrink: 0; }
.form-input select { width: 100%; -moz-appearance: none; appearance: none; -webkit-appearance: none; }

.form-textarea { width: 100%; padding: 8px 10px; background: var(--background); border: 1px solid var(--input); border-radius: var(--radius-md); font-family: var(--font-sans); font-size: 13px; color: var(--foreground); resize: vertical; box-sizing: border-box; line-height: 1.5; }
.form-textarea.mono { font-family: var(--font-mono); font-size: 12px; }
.form-textarea:focus { outline: 0; border-color: var(--ring); box-shadow: 0 0 0 2px color-mix(in oklch, var(--ring) 30%, transparent); }

.form-switch-row { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; -webkit-user-select: none; -moz-user-select: none; user-select: none; }
.switch { width: 36px; height: 20px; background: var(--primary); border-radius: 999px; position: relative; transition: background 150ms; flex-shrink: 0; }
.switch.off { background: var(--muted); border: 1px solid var(--border); }
.switch::after { content: ''; position: absolute; top: 2px; right: 2px; width: 16px; height: 16px; background: white; border-radius: 50%; box-shadow: var(--shadow-xs); transition: right 150ms, left 150ms; }
.switch.off::after { right: auto; left: 2px; }

.form-radio-row { display: inline-flex; padding: 3px; background: var(--muted); border-radius: var(--radius-md); gap: 2px; }
.form-radio { padding: 6px 14px; border-radius: calc(var(--radius-md) - 2px); font-size: 12px; color: var(--muted-foreground); cursor: pointer; -webkit-user-select: none; -moz-user-select: none; user-select: none; }
.form-radio.active { background: var(--background); color: var(--foreground); box-shadow: var(--shadow-xs); font-weight: 500; }

.form-section { padding: 12px 0; border-bottom: 1px solid var(--border); }
.form-section:last-child { border-bottom: 0; }
.form-section-h { font-size: 12px; font-weight: 600; color: var(--muted-foreground); text-transform: uppercase; letter-spacing: 0.06em; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }

/* ============ Fingerprint section (collapsible) ============ */
.fp-section { border: 1px solid var(--border); border-radius: var(--radius-md); margin-bottom: 10px; background: var(--background); overflow: hidden; }
.fp-section > summary { cursor: pointer; padding: 10px 14px; font-size: 12px; font-weight: 600; color: var(--foreground); display: flex; align-items: center; gap: 8px; list-style: none; -webkit-user-select: none; -moz-user-select: none; user-select: none; background: var(--muted); }
.fp-section > summary::-webkit-details-marker { display: none; }
.fp-section > summary::before { content: '▸'; color: var(--muted-foreground); transition: transform 120ms; display: inline-block; font-size: 10px; }
.fp-section[open] > summary::before { transform: rotate(90deg); }
.fp-section[open] > summary { background: color-mix(in oklch, var(--muted) 50%, var(--background)); border-bottom: 1px solid var(--border); }
.fp-section .form-grid { padding: 12px 14px 14px; }

/* ============ Dialog ============ */
.dlg-backdrop {
  position: fixed; inset: 0; background: oklch(0 0 0 / 0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 60; padding: 24px;
  animation: dlg-bk-in 150ms ease-out;
}
@keyframes dlg-bk-in { from { opacity: 0; } to { opacity: 1; } }
.dlg {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  max-height: calc(100vh - 48px); display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: dlg-in 180ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes dlg-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
.dlg-head { padding: 18px 22px 14px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.dlg-title { font-family: var(--font-display); font-size: 18px; font-weight: 600; margin: 0; letter-spacing: -0.01em; }
.dlg-sub   { font-size: 12.5px; color: var(--muted-foreground); margin: 4px 0 0; }
.dlg-body { padding: 18px 22px; overflow-y: auto; flex: 1; }
.dlg-foot { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; background: var(--background); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }

/* ============ Profile menu ============ */
.profile-menu-wrap { position: relative; }
.profile-trigger { display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 6px; border: 1px solid var(--border); border-radius: var(--radius-md); cursor: pointer; background: var(--background); }
.profile-trigger:hover { background: var(--accent); }
.profile-menu { position: absolute; top: calc(100% + 6px); right: 0; min-width: 220px; background: var(--popover); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 4px; z-index: 20; animation: dlg-in 120ms ease-out; }
.profile-menu-head { padding: 10px 12px; }
.profile-menu-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; font-size: 13px; border-radius: var(--radius-md); cursor: pointer; }
.profile-menu-item:hover { background: var(--accent); }
.profile-menu-item.danger { color: var(--destructive); }
.profile-menu-item.danger .muted { color: color-mix(in oklch, var(--destructive) 70%, transparent); }

/* ============ Row menu (table action ⋯) ============ */
.row-menu-wrap { position: relative; display: inline-block; }
.row-menu {
  position: absolute; top: calc(100% + 4px); right: 0;
  min-width: 180px; background: var(--popover); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); padding: 4px; z-index: 25;
  animation: dlg-in 120ms ease-out;
}
.row-menu-item { display: flex; align-items: center; gap: 10px; padding: 7px 10px; font-size: 13px; border-radius: var(--radius-md); cursor: pointer; -webkit-user-select: none; -moz-user-select: none; user-select: none; }
.row-menu-item:hover { background: var(--accent); }
.row-menu-item.danger { color: var(--destructive); }
.row-menu-item.danger:hover { background: color-mix(in oklch, var(--destructive) 8%, transparent); }
.row-menu-item.disabled { opacity: 0.45; cursor: not-allowed; }
.row-menu-item.disabled:hover { background: transparent; }

/* ============ API Key reveal ============ */
.apikey-box { display: flex; align-items: center; gap: 8px; padding: 12px 14px; background: var(--muted); border: 1px solid var(--border); border-radius: var(--radius-md); }
.apikey-box .key { font-family: var(--font-mono); font-size: 13px; color: var(--foreground); flex: 1; word-break: break-all; }
.warn-banner { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; background: color-mix(in oklch, var(--warning) 12%, transparent); border: 1px solid color-mix(in oklch, var(--warning) 35%, transparent); border-radius: var(--radius-md); }
.warn-banner .ic { color: oklch(0.55 0.16 84); flex-shrink: 0; margin-top: 1px; }
.warn-banner .body { font-size: 12.5px; line-height: 1.5; color: var(--foreground); }
.warn-banner .body b { color: oklch(0.45 0.16 84); }

/* ============ Asset picker (in dialogs) ============ */
.asset-pick-row { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--background); }
.asset-pick { padding: 4px; border-radius: var(--radius-sm); cursor: pointer; border: 2px solid transparent; display: inline-flex; align-items: center; justify-content: center; transition: border-color 120ms; }
.asset-pick:hover { background: var(--accent); }
.asset-pick.on { border-color: var(--primary); }
.asset-pick.more { width: 48px; height: 48px; border: 1.5px dashed var(--border); color: var(--muted-foreground); }
.asset-pick.more:hover { border-color: var(--ring); color: var(--foreground); }

/* ============ Asset type picker (in BatchImport dialog) ============ */
.asset-type-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.asset-type-card {
  display: flex; flex-direction: column; gap: 6px;
  padding: 16px 14px; border: 1px solid var(--border); border-radius: var(--radius-md);
  background: var(--background); cursor: pointer; transition: all 120ms;
}
.asset-type-card:hover { border-color: var(--primary); background: color-mix(in oklch, var(--primary) 4%, var(--background)); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.asset-type-icon { width: 40px; height: 40px; border-radius: var(--radius-md); background: var(--muted); display: flex; align-items: center; justify-content: center; color: var(--foreground); margin-bottom: 4px; }
.asset-type-name { font-size: 14px; font-weight: 600; color: var(--foreground); }
.asset-type-hint { font-size: 12px; color: var(--muted-foreground); line-height: 1.4; }

/* ============ Task type + action picker (NewTaskDialog) ============ */
.task-type-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.task-type-card {
  display: flex; flex-direction: column; gap: 4px;
  padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius-md);
  background: var(--background); cursor: pointer; transition: all 120ms; color: var(--foreground);
}
.task-type-card:hover { border-color: var(--primary); }
.task-type-card.active { border-color: var(--primary); background: color-mix(in oklch, var(--primary) 8%, var(--background)); }
.task-type-card .t-name { font-size: 14px; font-weight: 600; }
.task-type-card .t-desc { font-size: 12px; color: var(--muted-foreground); line-height: 1.4; }

.action-pick-grid { display: flex; flex-direction: column; gap: 8px; }
.action-pick {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-md);
  cursor: pointer; transition: all 120ms; background: var(--background);
}
.action-pick:hover { border-color: color-mix(in oklch, var(--primary) 50%, var(--border)); }
.action-pick.active { border-color: var(--primary); background: color-mix(in oklch, var(--primary) 6%, var(--background)); }
.action-pick .ap-icon { width: 32px; height: 32px; border-radius: var(--radius-sm); background: var(--muted); display: flex; align-items: center; justify-content: center; color: var(--foreground); flex-shrink: 0; }
.action-pick.active .ap-icon { background: var(--primary); color: var(--primary-foreground); }
.action-pick .ap-body { flex: 1; min-width: 0; }
.action-pick .ap-name { font-size: 13px; font-weight: 500; }
.action-pick .ap-desc { font-size: 11.5px; color: var(--muted-foreground); }
.action-pick .ap-check { color: var(--primary); flex-shrink: 0; }

/* ============ CS Agent — account scope picker ============ */
.cs-agent-account-pick {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
  max-height: 200px; overflow-y: auto;
  padding: 8px; border: 1px solid var(--border); border-radius: var(--radius-md);
  background: var(--background);
}
.cs-agent-acc {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 8px; border-radius: var(--radius-sm);
  font-size: 12px; cursor: pointer; -webkit-user-select: none; -moz-user-select: none; user-select: none;
  border: 1px solid transparent;
}
.cs-agent-acc:hover { background: var(--accent); }
.cs-agent-acc.active { background: color-mix(in oklch, var(--primary) 8%, transparent); border-color: var(--primary); }

/* ============ Customer Service module ============ */
.cs-page { padding-bottom: 0; }
.cs-page .page-head .page-actions { align-self: stretch; align-items: flex-end; }

/* === 会话布局 === */
.cs-inbox {
  display: grid;
  grid-template-columns: 320px 1fr 320px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--card);
  overflow: hidden;
  height: calc(100vh - 220px);
  min-height: 520px;
}

/* 左栏 */
.cs-col-left   { display: flex; flex-direction: column; border-right: 1px solid var(--border); min-width: 0; }
.cs-account-tabs { display: flex; flex-direction: column; padding: 8px; gap: 2px; border-bottom: 1px solid var(--border); max-height: 220px; overflow-y: auto; }
.cs-account-tab { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: var(--radius-md); font-size: 12.5px; color: var(--foreground); cursor: pointer; }
.cs-account-tab:hover { background: var(--accent); }
.cs-account-tab.active { background: var(--accent); font-weight: 500; }
.cs-account-tab .count, .cs-account-tab .badge { margin-left: auto; font-size: 10px; font-family: var(--font-mono); padding: 1px 6px; border-radius: 999px; }
.cs-account-tab .count { color: var(--muted-foreground); background: var(--muted); }
.cs-account-tab .badge { color: white; background: var(--destructive); font-weight: 600; }

.cs-tag-filter { display: flex; flex-wrap: wrap; gap: 4px; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.cs-tag { font-size: 11px; padding: 3px 8px; border-radius: 999px; background: var(--muted); color: var(--muted-foreground); cursor: pointer; }
.cs-tag:hover { background: var(--accent); }
.cs-tag.active { background: var(--primary); color: var(--primary-foreground); }
.cs-tag .count { margin-left: 4px; font-family: var(--font-mono); opacity: 0.6; }

.cs-conv-list { flex: 1; overflow-y: auto; }
.cs-conv { display: flex; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); cursor: pointer; position: relative; transition: background 100ms; }
.cs-conv:hover  { background: color-mix(in oklch, var(--accent) 50%, transparent); }
.cs-conv.active { background: var(--accent); }
.cs-conv-avatar { position: relative; flex-shrink: 0; }
.online-dot { position: absolute; bottom: 0; right: 0; width: 8px; height: 8px; border-radius: 50%; background: var(--success); border: 2px solid var(--card); }
.cs-conv-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cs-conv-head { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.cs-conv-name { font-size: 13px; font-weight: 600; color: var(--foreground); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cs-conv-time { font-size: 11px; color: var(--muted-foreground); flex-shrink: 0; font-family: var(--font-mono); }
.cs-conv-preview { font-size: 12px; color: var(--muted-foreground); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cs-conv-foot { display: flex; justify-content: space-between; align-items: center; gap: 6px; margin-top: 4px; }
.cs-unread-badge { position: absolute; top: 14px; right: 10px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--destructive); color: white; font-size: 10px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; font-family: var(--font-mono); }

/* 中栏 */
.cs-col-mid { display: flex; flex-direction: column; min-width: 0; background: var(--background); }
.cs-chat-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 18px; border-bottom: 1px solid var(--border); background: var(--card); }
.cs-chat-head-left { display: flex; align-items: center; gap: 10px; }
.cs-chat-body { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 10px; background:
  repeating-linear-gradient(0deg, var(--background) 0 24px, color-mix(in oklch, var(--muted) 30%, var(--background)) 24px 25px); }

.cs-msg { display: flex; flex-direction: column; max-width: 70%; }
.cs-msg.them { align-self: flex-start; }
.cs-msg.me   { align-self: flex-end; align-items: flex-end; }
.cs-msg-bubble { padding: 10px 14px; border-radius: 14px; font-size: 13.5px; line-height: 1.5; box-shadow: var(--shadow-xs); }
.cs-msg.them .cs-msg-bubble { background: var(--card); color: var(--foreground); border: 1px solid var(--border); border-top-left-radius: 4px; }
.cs-msg.me   .cs-msg-bubble { background: var(--primary); color: var(--primary-foreground); border-top-right-radius: 4px; }
.cs-msg-meta { font-size: 10px; color: var(--muted-foreground); margin-top: 3px; font-family: var(--font-mono); display: flex; align-items: center; gap: 4px; }

.cs-compose { border-top: 1px solid var(--border); background: var(--card); padding: 10px 14px 12px; }
.cs-compose-toolbar { display: flex; align-items: center; gap: 14px; padding-bottom: 6px; }
.cs-compose-toolbar svg { cursor: pointer; }
.cs-compose textarea {
  width: 100%; min-height: 60px; resize: none;
  border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 8px 10px; font: inherit; font-size: 13.5px;
  background: var(--background); color: var(--foreground);
  box-sizing: border-box;
}
.cs-compose textarea:focus { outline: 0; border-color: var(--ring); box-shadow: 0 0 0 2px color-mix(in oklch, var(--ring) 30%, transparent); }
.cs-compose-actions { display: flex; align-items: center; gap: 8px; margin-top: 8px; }

/* 右栏 */
.cs-col-right { border-left: 1px solid var(--border); display: flex; flex-direction: column; min-width: 0; background: var(--card); }
.cs-side-panel { display: flex; flex-direction: column; height: 100%; }
.cs-side-head { padding: 14px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.cs-side-body { padding: 14px 16px; flex: 1; overflow-y: auto; }

.cs-kv-list { display: flex; flex-direction: column; gap: 10px; padding: 12px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.cs-kv { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.cs-kv .k { font-size: 12px; color: var(--muted-foreground); }
.cs-kv .v { font-size: 12.5px; color: var(--foreground); text-align: right; }

/* === 知识库卡片 (chat side panel + dedicated page) === */
.cs-kb-card { padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--card); cursor: pointer; transition: all 120ms; }
.cs-kb-card:hover { border-color: var(--primary); background: color-mix(in oklch, var(--primary) 4%, var(--card)); }
.cs-kb-card.lg { cursor: default; }
.cs-kb-card.lg:hover { border-color: var(--border); background: var(--card); }
.cs-kb-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.cs-kb-q { font-size: 13px; font-weight: 600; color: var(--foreground); margin-bottom: 4px; line-height: 1.4; }
.cs-kb-a { font-size: 12px; color: var(--muted-foreground); line-height: 1.5; }

/* ============ Table toolbar (search + export) ============ */
.tbl-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.tbl-toolbar-left  { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tbl-toolbar-right { display: flex; align-items: center; gap: 10px; }

.search-box { display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px; background: var(--background); border: 1px solid var(--border); border-radius: var(--radius-md); }
.search-box .ic { color: var(--muted-foreground); flex-shrink: 0; }
.search-box input { flex: 1; border: 0; background: transparent; outline: 0; font-family: var(--font-sans); font-size: 13px; color: var(--foreground); min-width: 0; padding: 0; }
.search-box input::-moz-placeholder { color: var(--muted-foreground); }
.search-box input::placeholder { color: var(--muted-foreground); }
.search-box:focus-within { border-color: var(--ring); box-shadow: 0 0 0 2px color-mix(in oklch, var(--ring) 30%, transparent); }

.bulk-bar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: color-mix(in oklch, var(--accent) 60%, transparent); border-bottom: 1px solid var(--border); }

/* ============ Group tree (left rail) ============ */
.with-tree { display: grid; grid-template-columns: 220px 1fr; gap: 16px; }
.group-tree { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); height: -moz-fit-content; height: fit-content; padding: 8px; position: sticky; top: 72px; }
.group-tree-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px 8px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.group-tree-list { display: flex; flex-direction: column; gap: 1px; }
.group-item { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: var(--radius-md); cursor: pointer; font-size: 13px; }
.group-item:hover { background: var(--accent); }
.group-item.active { background: var(--accent); font-weight: 500; }
.group-item .count { margin-left: auto; font-family: var(--font-mono); font-size: 11px; color: var(--muted-foreground); }

/* ============ Group chips (above the table) ============ */
.group-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.g-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; height: 26px; border: 1px solid var(--border); border-radius: 999px; background: var(--background); font-size: 12px; color: var(--foreground); cursor: pointer; -webkit-user-select: none; -moz-user-select: none; user-select: none; transition: background 120ms, border-color 120ms; line-height: 1; }
.g-chip:hover { background: var(--accent); }
.g-chip.active { background: var(--primary); color: var(--primary-foreground); border-color: var(--primary); }
.g-chip.active .count { color: color-mix(in oklch, var(--primary-foreground) 70%, transparent); }
.g-chip.active .ic { color: color-mix(in oklch, var(--primary-foreground) 80%, transparent); }
.g-chip .count { font-family: var(--font-mono); font-size: 10.5px; color: var(--muted-foreground); }
.g-chip.add { border-style: dashed; color: var(--muted-foreground); }
.g-chip.add:hover { color: var(--foreground); border-color: var(--ring); }

/* ============ Method pill (API) ============ */
.method-pill { font-family: var(--font-mono); font-size: 11px; font-weight: 600; padding: 3px 6px; border-radius: 4px; min-width: 52px; text-align: center; display: inline-block; }

/* ============ Login screen ============ */
.login-shell { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.login-art { background: oklch(0.18 0.04 264); color: oklch(0.984 0.003 248); padding: 56px 56px 40px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-art::before { content: ''; position: absolute; right: -80px; top: 80px; width: 360px; height: 360px; border-radius: 50%; background: radial-gradient(circle, oklch(0.4 0.08 264 / 0.6), transparent 70%); }
.login-art .brand { display: flex; align-items: center; gap: 10px; }
.login-art .brand .wm { font-family: var(--font-display); font-weight: 600; font-size: 18px; letter-spacing: -0.01em; }
.login-art .brand .wm span { color: oklch(0.704 0.04 256.788); font-weight: 400; }
.login-art .blurb { max-width: 380px; position: relative; z-index: 1; }
.login-art .blurb h1 { font-family: var(--font-display); font-size: 36px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; margin: 0 0 12px; }
.login-art .blurb p { font-size: 14px; color: oklch(0.75 0.02 256); line-height: 1.6; margin: 0 0 24px; }
.login-art .foot   { font-size: 12px; color: oklch(0.6 0.02 256); position: relative; z-index: 1; }
.login-pane { display: flex; align-items: center; justify-content: center; padding: 40px; }
.login-form { width: 100%; max-width: 360px; }
.login-form h2 { font-family: var(--font-display); font-size: 24px; font-weight: 700; margin: 0 0 6px; }
.login-form .sub { color: var(--muted-foreground); font-size: 13px; margin: 0 0 24px; }
.login-form .field { margin-bottom: 14px; }
.login-form .field .lbl { font-size: 12px; font-weight: 500; margin-bottom: 5px; }
.login-form .input { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; background: var(--background); border: 1px solid var(--input); border-radius: var(--radius-md); }
.login-form .input input { flex: 1; border: 0; outline: 0; background: transparent; font: inherit; color: var(--foreground); font-size: 14px; }
.login-form .input:focus-within { border-color: var(--ring); box-shadow: 0 0 0 2px color-mix(in oklch, var(--ring) 30%, transparent); }
.login-form .full-btn { width: 100%; height: 40px; margin-top: 6px; font-size: 14px; }
.login-form .alt-link { font-size: 12px; color: var(--muted-foreground); margin-top: 14px; text-align: center; }
.login-form .alt-link a { color: var(--foreground); font-weight: 500; }

/* ============ API explorer ============ */
.api-filter-bar { display: flex; align-items: center; gap: 16px; padding: 14px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.api-method-tabs { display: inline-flex; gap: 2px; padding: 3px; background: var(--muted); border-radius: var(--radius-md); }
.api-method-tab { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: calc(var(--radius-md) - 2px); font-family: var(--font-mono); font-size: 12px; font-weight: 600; color: var(--muted-foreground); cursor: pointer; -webkit-user-select: none; -moz-user-select: none; user-select: none; }
.api-method-tab.active { background: var(--background); color: var(--foreground); box-shadow: var(--shadow-xs); }
.api-method-tab .count { font-size: 10.5px; font-weight: 500; opacity: 0.7; }

.api-domain-section { margin-bottom: 28px; }
.api-domain-section:last-child { margin-bottom: 0; }
.api-domain-header { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.api-domain-header h3 { font-family: var(--font-display); font-size: 16px; font-weight: 600; margin: 0; letter-spacing: -0.01em; }

.api-card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.api-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 14px; cursor: pointer; transition: box-shadow 120ms, border-color 120ms, transform 120ms; display: flex; flex-direction: column; gap: 8px; }
.api-card:hover { box-shadow: var(--shadow-sm); border-color: color-mix(in oklch, var(--ring) 50%, var(--border)); }
.api-card:active { transform: translateY(1px); }
.api-card-top { display: flex; align-items: center; gap: 8px; }
.api-card-path { font-family: var(--font-mono); font-size: 13px; font-weight: 500; color: var(--foreground); word-break: break-all; line-height: 1.4; }
.api-card-summary { font-size: 12px; color: var(--muted-foreground); line-height: 1.45; min-height: 32px; }
.api-card-foot { display: flex; align-items: center; justify-content: space-between; padding-top: 8px; border-top: 1px solid var(--border); margin-top: 2px; }

.api-input { width: 100%; height: 32px; padding: 0 10px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--background); color: var(--foreground); font-family: var(--font-mono); font-size: 12px; box-sizing: border-box; }
.api-input:focus { outline: 0; border-color: var(--ring); box-shadow: 0 0 0 2px color-mix(in oklch, var(--ring) 30%, transparent); }

.code-block { background: oklch(0.16 0.03 260); color: oklch(0.92 0.01 255); border-radius: var(--radius-md); padding: 12px 14px; font-family: var(--font-mono); font-size: 11.5px; line-height: 1.55; overflow-x: auto; white-space: pre; }

/* ============ Asset library (素材库) ============ */
.asset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.asset-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 8px; display: flex; flex-direction: column; gap: 6px; cursor: pointer; transition: box-shadow 120ms; position: relative; }
.asset-card:hover { box-shadow: var(--shadow-sm); }
.asset-card.selected { border-color: var(--primary); box-shadow: 0 0 0 2px color-mix(in oklch, var(--primary) 25%, transparent); }
.asset-thumb { aspect-ratio: 1 / 1; background: linear-gradient(135deg, oklch(0.96 0.01 250), oklch(0.92 0.01 250)); border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; color: var(--muted-foreground); position: relative; overflow: hidden; }
.asset-thumb.bg { aspect-ratio: 3 / 1; }
.asset-meta { display: flex; align-items: center; justify-content: space-between; font-size: 11px; }
.asset-meta .name { font-family: var(--font-mono); color: var(--foreground); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.asset-meta .used { color: var(--muted-foreground); font-family: var(--font-mono); }
.asset-check { position: absolute; top: 12px; left: 12px; }
.dropzone { border: 2px dashed var(--border); border-radius: var(--radius-lg); padding: 32px; display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--muted-foreground); background: var(--background); transition: border-color 120ms, background 120ms; cursor: pointer; }
.dropzone:hover { border-color: var(--ring); background: var(--muted); }
.dropzone .ic-wrap { color: var(--muted-foreground); }
.dropzone strong { color: var(--foreground); font-size: 14px; font-weight: 500; }
.dropzone p { margin: 0; font-size: 12px; }

/* ============ Snapshot inspector ============ */
.snap-pane { display: grid; grid-template-columns: 1fr 360px; gap: 14px; }
.snap-screenshot { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px; }
.snap-frame { background: linear-gradient(135deg, oklch(0.97 0.005 250), oklch(0.94 0.008 250)); border: 1px solid var(--border); border-radius: var(--radius-md); aspect-ratio: 16/10; display: flex; align-items: center; justify-content: center; color: var(--muted-foreground); position: relative; overflow: hidden; }
.url-bar { display: flex; align-items: center; gap: 6px; padding: 6px 10px; background: var(--muted); border-radius: var(--radius-md); margin-bottom: 10px; font-family: var(--font-mono); font-size: 12px; color: var(--foreground); }
.url-bar .ic { color: var(--muted-foreground); }
.refs-pane { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); display: flex; flex-direction: column; max-height: 540px; }
.refs-head { padding: 14px 16px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.refs-body { padding: 6px; overflow-y: auto; flex: 1; }
.ref-row { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: var(--radius-sm); font-size: 12px; cursor: pointer; }
.ref-row:hover { background: var(--accent); }
.ref-key { font-family: var(--font-mono); font-size: 11px; color: var(--muted-foreground); width: 28px; flex-shrink: 0; }
.ref-sel { font-family: var(--font-mono); color: var(--foreground); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
