/* WorkBuddy2API console — Claude-inspired: warm ivory canvas, clay accent, serif display
   type, hairline borders and calm neutral controls. All assets are local (strict CSP). */
:root, [data-theme="light"] {
  color-scheme: light;
  --bg: #faf9f5;
  --bg-2: #f5f4ee;
  --surface: #ffffff;
  --surface-2: #f5f4ee;
  --surface-3: #ece9e0;
  --raise: #ffffff;
  --line: rgba(31, 30, 29, .14);
  --line-soft: rgba(31, 30, 29, .085);
  --line-strong: rgba(31, 30, 29, .28);
  --ink: #141413;
  --ink-2: #3d3d3a;
  --ink-3: #73726c;
  --ink-4: #a3a19a;
  --hover: rgba(31, 30, 29, .045);
  --active: rgba(31, 30, 29, .08);
  --accent: #c96442;
  --accent-2: #b2532f;
  --accent-soft: #f7ebe4;
  --accent-line: #ecccbd;
  --accent-ink: #ffffff;
  --btn: #1f1e1d;
  --btn-hover: #3d3d3a;
  --btn-ink: #faf9f5;
  --ok: #3b7547;
  --ok-soft: #e9f1e6;
  --ok-line: #c9dcc4;
  --warn: #93630f;
  --warn-soft: #f8efdc;
  --warn-line: #e9d4a8;
  --bad: #b23a30;
  --bad-soft: #f9e6e2;
  --bad-line: #efc5be;
  --ring: rgba(201, 100, 66, .24);
  --scrim: rgba(20, 20, 19, .34);
  --shadow-xs: 0 1px 2px rgba(20, 20, 19, .035);
  --shadow-sm: 0 1px 2px rgba(20, 20, 19, .04), 0 4px 16px rgba(20, 20, 19, .04);
  --shadow-md: 0 2px 6px rgba(20, 20, 19, .05), 0 12px 32px rgba(20, 20, 19, .09);
  --shadow-lg: 0 6px 18px rgba(20, 20, 19, .07), 0 28px 72px rgba(20, 20, 19, .18);
  --chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%2373726c' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m3 4.5 3 3 3-3'/%3E%3C/svg%3E");
  --r-xl: 20px;
  --r-lg: 14px;
  --r-md: 11px;
  --r-sm: 8px;
  --r-xs: 6px;
  --sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --serif: "Iowan Old Style", Charter, "Palatino Linotype", Georgia, "Songti SC", "Noto Serif SC", "Source Han Serif SC", STSong, serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --view-max: 1240px;
}
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #262624;
  --bg-2: #1f1e1d;
  --surface: #30302e;
  --surface-2: #2b2b29;
  --surface-3: #3b3b38;
  --raise: #30302e;
  --line: rgba(232, 230, 220, .14);
  --line-soft: rgba(232, 230, 220, .085);
  --line-strong: rgba(232, 230, 220, .26);
  --ink: #faf9f5;
  --ink-2: #c8c6bc;
  --ink-3: #9c9a92;
  --ink-4: #75736c;
  --hover: rgba(250, 249, 245, .05);
  --active: rgba(250, 249, 245, .085);
  --accent: #d97757;
  --accent-2: #e5906f;
  --accent-soft: #42312a;
  --accent-line: #6b4636;
  --accent-ink: #1f1e1d;
  --btn: #faf9f5;
  --btn-hover: #e8e6dc;
  --btn-ink: #141413;
  --ok: #92c49b;
  --ok-soft: #2d3a2f;
  --ok-line: #42574a;
  --warn: #e3b768;
  --warn-soft: #3d3426;
  --warn-line: #5d4d31;
  --bad: #ee9184;
  --bad-soft: #47302c;
  --bad-line: #68443d;
  --ring: rgba(217, 119, 87, .32);
  --scrim: rgba(0, 0, 0, .52);
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .18);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .2), 0 4px 16px rgba(0, 0, 0, .16);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, .28), 0 14px 36px rgba(0, 0, 0, .34);
  --shadow-lg: 0 8px 22px rgba(0, 0, 0, .34), 0 30px 80px rgba(0, 0, 0, .5);
  --chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%239c9a92' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m3 4.5 3 3 3-3'/%3E%3C/svg%3E");
}

/* ── Base ───────────────────────────────────────────────────────────── */
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html, body { min-height: 100%; }
html { -webkit-text-size-adjust: 100%; }
body { background: var(--bg); color: var(--ink); font: 14px/1.55 var(--sans); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; }
::selection { background: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
a { color: var(--accent); text-underline-offset: 2px; }
b, strong { font-weight: 600; }
code, kbd, samp { font-family: var(--mono); font-size: .92em; }
button, input, select, textarea { -webkit-tap-highlight-color: transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--ink-3) 30%, transparent); border: 3px solid transparent; background-clip: content-box; border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background-color: color-mix(in srgb, var(--ink-3) 50%, transparent); }
::-webkit-scrollbar-track { background: transparent; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
.skip-link { position: fixed; top: -90px; left: 18px; z-index: 200; padding: 10px 16px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--raise); box-shadow: var(--shadow-md); color: var(--ink); font-weight: 600; text-decoration: none; }
.skip-link:focus { top: 14px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ── Shell ──────────────────────────────────────────────────────────── */
.shell { display: grid; grid-template-columns: 256px minmax(0, 1fr); min-height: 100vh; }
.nav-ready .shell { transition: grid-template-columns .2s var(--ease); }
.main { min-width: 0; display: flex; flex-direction: column; }
.main:focus { outline: none; }
.views { width: 100%; }

/* Sidebar */
.nav { position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; padding: 14px 10px 12px; background: var(--bg-2); border-right: 1px solid var(--line-soft); scrollbar-width: thin; }
.brand { display: flex; align-items: center; gap: 11px; padding: 6px 4px 20px 8px; }
.brand-mark { width: 30px; height: 30px; flex: none; display: grid; place-items: center; border-radius: 9px; background: var(--accent); color: #fff; font: 500 18px/1 var(--serif); box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .12); }
.brand-copy { min-width: 0; }
.brand .name { color: var(--ink); font: 600 15px/1.25 var(--sans); letter-spacing: -.01em; white-space: nowrap; }
.brand .name span { margin-left: 4px; color: var(--ink-3); font-weight: 500; }
.brand .sub { margin-top: 1px; color: var(--ink-3); font-size: 12px; }
.nav-collapse { flex: none; width: 30px; min-height: 30px; margin-left: auto; color: var(--ink-3); }
.nav-collapse:hover:not(:disabled) { color: var(--ink); }
.nav-collapse svg { transition: transform .2s var(--ease); }
.nav-list { list-style: none; flex: 1; }
.nav-caption { padding: 4px 10px 6px; color: var(--ink-3); font-size: 12px; font-weight: 500; }
.nav-caption-system { margin-top: 16px; }
.nav a { display: flex; align-items: center; gap: 10px; min-height: 36px; margin-bottom: 1px; padding: 6px 10px; border-radius: 9px; color: var(--ink-2); text-decoration: none; font-size: 14px; font-weight: 450; transition: background .12s var(--ease), color .12s var(--ease); }
.nav a:hover { background: var(--hover); color: var(--ink); }
.nav a.on { background: var(--active); color: var(--ink); font-weight: 560; }
.nav a svg { width: 18px; height: 18px; flex: none; color: var(--ink-3); }
.nav a.on svg, .nav a:hover svg { color: var(--ink); }
.nav-badge { margin-left: auto; min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: #fff; font: 600 11px/18px var(--sans); text-align: center; font-variant-numeric: tabular-nums; }
.nav-foot.sig { margin-top: 16px; padding: 12px 4px 0; border-top: 1px solid var(--line-soft); }
.nav-status { padding: 0 6px 10px; }
.status-pill { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); font-size: 13px; font-weight: 500; }
.nav-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; margin-top: 3px; padding-left: 15px; color: var(--ink-3); font-size: 12px; overflow-wrap: anywhere; }
.dot-sep { opacity: .6; }
.nav-preferences { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.nav-pref { display: flex; align-items: center; justify-content: center; gap: 7px; min-width: 0; height: 34px; padding: 0 8px; border: 0; background: transparent; box-shadow: none; color: var(--ink-2); font-size: 13px; font-weight: 450; }
.nav-pref:hover:not(:disabled) { background: var(--hover); color: var(--ink); }
.nav-pref svg { flex: none; color: var(--ink-3); }

/* Collapsed sidebar (desktop icon rail). Labels stay in the DOM for screen readers;
   shell.js copies them into title attributes for pointer users. */
@media (min-width: 761px) {
  :root[data-nav="collapsed"] .shell { grid-template-columns: 64px minmax(0, 1fr); }
  :root[data-nav="collapsed"] .nav { padding: 14px 10px 12px; overflow-x: hidden; }
  :root[data-nav="collapsed"] .brand { flex-direction: column; gap: 10px; padding: 6px 0 16px; }
  :root[data-nav="collapsed"] .brand-copy,
  :root[data-nav="collapsed"] .nav-status .status-pill > span:not(.pulse),
  :root[data-nav="collapsed"] .nav-meta { display: none; }
  :root[data-nav="collapsed"] .nav-collapse { margin: 0; }
  :root[data-nav="collapsed"] .nav-collapse svg { transform: scaleX(-1); }
  :root[data-nav="collapsed"] .nav-caption { height: 1px; margin: 10px 8px; padding: 0; overflow: hidden; background: var(--line-soft); color: transparent; font-size: 0; }
  :root[data-nav="collapsed"] .nav-caption:first-child { display: none; }
  :root[data-nav="collapsed"] .nav a { position: relative; justify-content: center; width: 44px; height: 40px; min-height: 40px; margin: 0 auto 2px; padding: 0; }
  :root[data-nav="collapsed"] .nav a > span:not(.nav-badge) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  :root[data-nav="collapsed"] .nav-badge { position: absolute; top: 3px; right: 2px; min-width: 16px; padding: 0 4px; font-size: 10px; line-height: 15px; }
  :root[data-nav="collapsed"] .nav-foot.sig { padding: 12px 0 0; }
  :root[data-nav="collapsed"] .nav-status { display: flex; justify-content: center; padding: 0 0 10px; }
  :root[data-nav="collapsed"] .nav-preferences { grid-template-columns: 1fr; justify-items: center; }
  :root[data-nav="collapsed"] .nav-pref { width: 40px; padding: 0; }
  :root[data-nav="collapsed"] .nav-pref > span { display: none; }
  :root[data-nav="collapsed"] .job-banner { max-width: calc(var(--view-max) - 64px); }
}

/* Top bar */
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 10px 28px; border-bottom: 1px solid var(--line-soft); background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: saturate(1.2) blur(14px); -webkit-backdrop-filter: saturate(1.2) blur(14px); }
.crumb { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1 1 auto; }
.topbar h2 { color: var(--ink); font-size: 14px; font-weight: 600; line-height: 1.3; white-space: nowrap; }
.topbar .meta { flex: none; color: var(--ink-3); font-size: 12.5px; white-space: nowrap; }
.topbar .meta::before { content: ""; display: inline-block; width: 3px; height: 3px; margin: 0 10px 3px 0; border-radius: 50%; background: var(--ink-4); vertical-align: middle; }
.refresh-state { min-width: 0; overflow: hidden; color: var(--ink-3); font-size: 12.5px; text-overflow: ellipsis; white-space: nowrap; }
.refresh-state::before { content: ""; display: inline-block; width: 3px; height: 3px; margin: 0 10px 3px 0; border-radius: 50%; background: var(--ink-4); vertical-align: middle; }
.refresh-state.stale { padding: 3px 9px; border-radius: var(--r-xs); background: var(--warn-soft); color: var(--warn); }
.refresh-state.stale::before { display: none; }
.topbar-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; flex: none; }
.nav-btn { display: none !important; }

/* Views */
.view { width: 100%; max-width: var(--view-max); margin: 0 auto; padding: 36px 32px 80px; animation: viewIn .22s var(--ease); }
@keyframes viewIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.page-heading { display: flex; align-items: flex-end; gap: 16px; margin: 0 0 26px; }
.ph-icon, .eyebrow { display: none; }
.ph-text { min-width: 0; }
.page-heading h1 { color: var(--ink); font: 400 32px/1.2 var(--serif); letter-spacing: -.012em; }
.page-heading p { max-width: 70ch; margin-top: 8px; color: var(--ink-3); font-size: 14.5px; line-height: 1.6; }

/* ── Controls ───────────────────────────────────────────────────────── */
button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 34px; padding: 6px 14px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); box-shadow: var(--shadow-xs); color: var(--ink); font: 500 13.5px/1.25 var(--sans); white-space: nowrap; cursor: pointer; transition: background .12s var(--ease), border-color .12s var(--ease), color .12s var(--ease), box-shadow .12s var(--ease); }
button:hover:not(:disabled) { border-color: var(--line-strong); background: var(--surface-2); }
button:active:not(:disabled) { transform: translateY(.5px); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.primary { border-color: var(--btn); background: var(--btn); color: var(--btn-ink); box-shadow: var(--shadow-xs); }
button.primary:hover:not(:disabled) { border-color: var(--btn-hover); background: var(--btn-hover); }
button.ghost, button.quiet { border-color: transparent; background: transparent; box-shadow: none; color: var(--ink-2); }
button.ghost:hover:not(:disabled), button.quiet:hover:not(:disabled) { border-color: transparent; background: var(--hover); color: var(--ink); }
button.danger { color: var(--bad); }
button.danger:hover:not(:disabled) { border-color: var(--bad-line); background: var(--bad-soft); color: var(--bad); }
button.primary.danger { border-color: var(--bad); background: var(--bad); color: var(--accent-ink); }
button.primary.danger:hover:not(:disabled) { border-color: transparent; background: color-mix(in srgb, var(--bad) 88%, var(--ink)); color: var(--accent-ink); }
button.icon { width: 34px; padding: 0; }
button.xs { min-height: 30px; padding: 4px 11px; border-radius: 7px; font-size: 13px; }
.plus { font-size: 15px; font-weight: 400; line-height: 1; }

input, select, textarea { width: 100%; min-width: 0; min-height: 36px; padding: 7px 11px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); color: var(--ink); font: inherit; font-size: 14px; transition: border-color .12s var(--ease), box-shadow .12s var(--ease); }
textarea { min-height: 0; line-height: 1.55; resize: vertical; }
select { appearance: none; -webkit-appearance: none; padding-right: 30px; background-image: var(--chev); background-repeat: no-repeat; background-position: right 10px center; background-size: 12px; cursor: pointer; }
input:hover, select:hover, textarea:hover { border-color: var(--line-strong); }
input:focus, select:focus, textarea:focus { outline: none; border-color: color-mix(in srgb, var(--accent) 70%, var(--line-strong)); box-shadow: 0 0 0 3px var(--ring); }
input::placeholder, textarea::placeholder { color: var(--ink-4); opacity: 1; }
input.invalid { border-color: var(--bad); background: var(--bad-soft); }
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; min-height: 0; padding: 0; accent-color: var(--accent); cursor: pointer; box-shadow: none; }
input[type=file] { min-height: 0; padding: 8px; border-style: dashed; background: var(--surface-2); color: var(--ink-2); font-size: 13px; cursor: pointer; }
input[type=file]::file-selector-button { margin-right: 10px; padding: 5px 12px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--ink); font: 500 13px var(--sans); cursor: pointer; }
input[type=search]::-webkit-search-cancel-button { cursor: pointer; }
label.fld { display: block; margin-bottom: 20px; }
label.fld > .lb, .switch .lb { display: block; margin-bottom: 6px; color: var(--ink); font-size: 13.5px; font-weight: 500; }
label.fld > .hint { display: block; margin-top: 6px; color: var(--ink-3); font-size: 12.5px; line-height: 1.6; }
.hint { color: var(--ink-3); font-size: 13px; line-height: 1.65; }
.hint-gap { margin-top: 10px; }
.note { color: var(--ink-3); font-size: 13px; white-space: nowrap; }
.note.stale { color: var(--warn); }
.src-off { color: var(--warn); }
.muted { color: var(--ink-4); }
.grow { flex: 1 1 auto; min-width: 0; }
.inline { display: flex; align-items: center; gap: 8px; }
.inline > input { flex: 1; }
.sel-note { display: inline-flex; align-items: center; gap: 8px; flex: none; color: var(--ink-3); font-size: 13px; white-space: nowrap; }
.sel-note select, select.xs { width: auto; min-height: 30px; padding: 4px 28px 4px 10px; border-radius: 7px; font-size: 13px; }

.switch { display: flex; align-items: center; justify-content: space-between; gap: 18px; min-height: 44px; padding: 6px 0; }
.switch .lb { margin: 0; font-weight: 500; }
.switch input[type=checkbox] { appearance: none; -webkit-appearance: none; position: relative; flex: none; width: 36px; height: 20px; border: 0; border-radius: 999px; background: var(--surface-3); box-shadow: inset 0 0 0 1px var(--line); cursor: pointer; transition: background .16s var(--ease); }
.switch input[type=checkbox]::after { content: ""; position: absolute; left: 2px; top: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); transition: transform .16s var(--ease); }
.switch input[type=checkbox]:checked { background: var(--accent); box-shadow: none; }
.switch input[type=checkbox]:checked::after { transform: translateX(16px); }
.switch input[type=checkbox]:focus { box-shadow: 0 0 0 3px var(--ring); }

/* Segmented controls */
.vtabs, .chips, .dlg .tabs { display: inline-flex; align-items: center; gap: 2px; padding: 3px; border-radius: 10px; background: var(--surface-3); }
.vtabs button, .chips .chip, .dlg .tabs .tab { min-height: 28px; padding: 3px 12px; border: 0; border-radius: 7px; background: transparent; box-shadow: none; color: var(--ink-3); font-size: 13px; font-weight: 500; }
.vtabs button:hover:not(:disabled), .chips .chip:hover:not(:disabled), .dlg .tabs .tab:hover:not(:disabled) { border: 0; background: transparent; color: var(--ink); }
.vtabs button.on, .chips .chip.on, .dlg .tabs .tab.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(20, 20, 19, .08), 0 0 0 .5px var(--line); }
[data-theme="dark"] .vtabs button.on, [data-theme="dark"] .chips .chip.on, [data-theme="dark"] .dlg .tabs .tab.on { background: var(--surface-2); }
.vtabs .cnt { margin-left: 5px; color: var(--ink-4); font-weight: 400; font-variant-numeric: tabular-nums; }

/* Dropdown (header "更多操作") and shared row menu */
.action-menu { position: relative; flex: none; }
.action-menu > summary { display: inline-flex; align-items: center; gap: 7px; min-height: 30px; padding: 4px 11px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); box-shadow: var(--shadow-xs); color: var(--ink); cursor: pointer; font-size: 13px; font-weight: 500; list-style: none; user-select: none; }
.action-menu > summary::-webkit-details-marker { display: none; }
.action-menu > summary::after { content: ""; width: 12px; height: 12px; background: var(--chev) center / 12px no-repeat; }
.action-menu[open] > summary, .action-menu > summary:hover { border-color: var(--line-strong); background: var(--surface-2); }
.action-menu-list, .row-menu { display: flex; flex-direction: column; gap: 1px; padding: 5px; border: 1px solid var(--line); border-radius: 12px; background: var(--raise); box-shadow: var(--shadow-md); animation: menuIn .12s var(--ease); }
@keyframes menuIn { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }
.action-menu-list { position: absolute; top: calc(100% + 6px); right: 0; z-index: 40; width: 236px; }
.row-menu { position: fixed; z-index: 120; width: 220px; max-height: min(70vh, 420px); overflow-y: auto; }
.action-menu-list button, .row-menu button { justify-content: flex-start; gap: 10px; width: 100%; min-height: 34px; padding: 6px 10px; border: 0; border-radius: 8px; background: transparent; box-shadow: none; color: var(--ink); font-size: 13.5px; font-weight: 450; text-align: left; white-space: normal; }
.action-menu-list button:hover:not(:disabled), .row-menu button:hover:not(:disabled), .row-menu button:focus-visible { border: 0; background: var(--hover); outline: none; }
.action-menu-list button.danger, .row-menu button.danger { color: var(--bad); }
.action-menu-list button.danger:hover:not(:disabled), .row-menu button.danger:hover:not(:disabled), .row-menu button.danger:focus-visible { background: var(--bad-soft); }
.action-menu-list .danger { margin-top: 5px; position: relative; }
.action-menu-list .danger::before, .row-menu .menu-sep { content: ""; display: block; height: 1px; margin: 4px 6px; background: var(--line-soft); }
.action-menu-list .danger::before { position: absolute; top: -8px; left: 0; right: 0; }
.row-menu .menu-title { padding: 6px 10px 4px; overflow: hidden; color: var(--ink-3); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.row-menu .menu-note { margin-left: auto; color: var(--ink-3); font-size: 12px; }

/* ── Cards ──────────────────────────────────────────────────────────── */
.box { margin-bottom: 20px; overflow: hidden; border: 1px solid var(--line-soft); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-xs); }
.box > header { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-height: 56px; padding: 11px 18px; border-bottom: 1px solid var(--line-soft); }
.box > header h3 { display: flex; align-items: baseline; flex-wrap: wrap; min-width: 0; color: var(--ink); font-size: 15px; font-weight: 600; letter-spacing: -.005em; }
.box > header h3 .hint { margin-left: 10px; color: var(--ink-3); font-size: 13px; font-weight: 400; letter-spacing: 0; }
.box > header select, .box > header input { width: auto; }
.box .pad { padding: 20px; }
.hr { height: 1px; margin: 10px 0 20px; background: var(--line-soft); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 28px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 20px; }
.grid2 > *, .grid3 > * { min-width: 0; }
fieldset { margin-bottom: 6px; border: none; }
legend { padding-bottom: 10px; color: var(--ink-3); font-size: 13px; font-weight: 600; }

/* Account overview */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.stat { position: relative; display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-start; gap: 0; min-width: 0; min-height: 0; padding: 16px 18px 15px; border: 1px solid var(--line-soft); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-xs); color: var(--ink); text-align: left; white-space: normal; font-weight: 400; }
.stat:hover:not(:disabled) { border-color: var(--line-soft); background: var(--surface); }
.stat .k { display: flex; align-items: center; gap: 7px; color: var(--ink-3); font-size: 13px; font-weight: 450; }
.stat-unit { margin-left: 4px; color: var(--ink-4); font-size: 12px; }
.stat .v { display: block; margin: 8px 0 4px; color: var(--ink); font: 450 30px/1.1 var(--sans); letter-spacing: -.025em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stat-caption { display: block; color: var(--ink-3); font-size: 12.5px; }
.stat.good .v { color: var(--ok); }
.stat-credits .v { font-size: clamp(24px, 2.2vw, 30px); }
.stat-clickable { cursor: pointer; transition: border-color .14s var(--ease), box-shadow .14s var(--ease); }
.stat-clickable:hover:not(:disabled) { border-color: var(--line); box-shadow: var(--shadow-sm); }
.stat-clickable::after { content: "筛选"; position: absolute; top: 14px; right: 14px; color: var(--ink-4); font-size: 12px; opacity: 0; transition: opacity .14s var(--ease); }
.stat-clickable:hover::after { opacity: 1; }
.stat-clickable.active-filter { border-color: var(--ink-3); box-shadow: inset 0 0 0 1px var(--ink-3); }
.stat-clickable.active-filter::after { content: "已筛选"; opacity: 1; color: var(--ink-2); }
.health-strip { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 2px 0 24px; }
.health-label { margin-right: 2px; color: var(--ink-3); font-size: 13px; }
.health-chip { gap: 7px; min-height: 30px; padding: 4px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); box-shadow: none; color: var(--ink-2); font-size: 13px; font-weight: 450; }
.health-chip:hover:not(:disabled) { border-color: var(--line-strong); background: var(--surface); color: var(--ink); }
.health-chip.active-filter { border-color: var(--ink); background: var(--btn); color: var(--btn-ink); }
.health-chip.active-filter b { color: var(--btn-ink); }
.health-chip b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.health-dot { width: 7px; height: 7px; flex: none; border-radius: 50%; background: var(--ink-3); }
.health-dot.cooling { background: var(--warn); }
.health-dot.disabled { background: var(--bad); }
.health-dot.paused { background: var(--ink-4); }
.pulse { width: 7px; height: 7px; flex: none; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 18%, transparent); }
.pulse.bad { background: var(--bad); box-shadow: 0 0 0 3px color-mix(in srgb, var(--bad) 18%, transparent); }
.pulse.warn { background: var(--warn); box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn) 20%, transparent); }

/* ── Tables ─────────────────────────────────────────────────────────── */
.tbl-wrap { overflow-x: auto; }
.acc { width: 100%; min-width: 660px; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.account-box { overflow: visible; }
.account-box .tbl-wrap { border-radius: 0 0 var(--r-lg) var(--r-lg); }
.account-box .acc { min-width: 900px; }
.acc th { padding: 10px 14px; border-bottom: 1px solid var(--line-soft); background: transparent; color: var(--ink-3); text-align: left; font-size: 12.5px; font-weight: 500; white-space: nowrap; }
.acc td { padding: 13px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.acc tbody tr:last-child td { border-bottom: none; }
.acc tbody tr { transition: background .1s var(--ease); }
.acc tbody tr:hover { background: color-mix(in srgb, var(--surface-2) 70%, transparent); }
.acc .mark { width: 1px; padding: 0 0 0 16px; }
.acc .mark i { display: block; width: 8px; height: 8px; border-radius: 3px; background: var(--ok); }
.acc tbody tr.cool .mark i { background: var(--warn); }
.acc tbody tr.off .mark i { background: var(--bad); }
#accountBox .mark, .acc.md .mark { display: none; }
#accBody tr.off .who .nm, #accBody tr.off .cred .n { color: var(--ink-3); }
.acc .c-acts { width: 1px; }
.acc .efs { min-width: 150px; }
.acc .efs .tag { margin: 2px 4px 2px 0; }
.acc.md { min-width: 760px; }
.acc.zebra tbody tr:nth-child(even) { background: color-mix(in srgb, var(--surface-2) 40%, transparent); }
.acc.zebra tbody tr:nth-child(even):hover { background: color-mix(in srgb, var(--surface-2) 70%, transparent); }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.acc td.num { color: var(--ink-2); }
.who { min-width: 140px; max-width: 250px; }
.who .nm { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; overflow: hidden; color: var(--ink); font-weight: 550; text-overflow: ellipsis; white-space: nowrap; }
.who .id { margin-top: 3px; overflow: hidden; color: var(--ink-3); font: 12px/1.45 var(--mono); text-overflow: ellipsis; white-space: nowrap; }
.who .id.egress { font-size: 11.5px; color: var(--ink-4); }
#taskTable .who { max-width: 380px; }
#taskTable .who .nm, #taskTable .who .id { white-space: normal; word-break: break-word; }
.acc.md .who .nm { min-width: 0; font-weight: 550; }
.acc.md .who > .id { font-family: var(--sans); font-size: 12.5px; }
.acc.md .who .nm .mid { min-width: 0; overflow: hidden; font-family: var(--mono); font-size: 13px; text-overflow: ellipsis; }
.realm-tag { display: inline-flex; align-items: center; padding: 0 6px; border: 1px solid var(--line); border-radius: 5px; color: var(--ink-3); font-size: 11px; font-weight: 500; line-height: 17px; }
.realm-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 0 0 12px; }
.realm-label { margin-right: 4px; color: var(--ink); font-size: 13.5px; font-weight: 500; }
.realm-opt { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 14px 0 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink-2); font-size: 13.5px; cursor: pointer; }
.realm-opt:has(input:checked) { border-color: var(--ink); color: var(--ink); box-shadow: inset 0 0 0 .5px var(--ink); }
.cred { min-width: 110px; }
.cred .n { color: var(--ink); font-size: 13.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cred .n .of { margin-left: 1px; color: var(--ink-3); font-size: 12px; }
.bar { height: 4px; max-width: 104px; margin-top: 7px; overflow: hidden; border-radius: 999px; background: var(--surface-3); }
.bar i { display: block; height: 100%; border-radius: 999px; background: var(--accent); }
.tag { display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px; border: 0; border-radius: 6px; background: var(--surface-3); color: var(--ink-2); font-size: 12px; font-weight: 500; line-height: 20px; white-space: nowrap; }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.bad { background: var(--bad-soft); color: var(--bad); }
.tag.mute { background: var(--surface-3); color: var(--ink-3); }
#accBody td:nth-child(3) > .tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.md-avail { flex: none; }
.usage-cell { min-width: 150px; }
.usage-line { display: flex; flex-direction: column; gap: 2px; }
.usage-main, .usage-sub { display: flex; align-items: baseline; flex-wrap: wrap; }
.usage-sub { color: var(--ink-3); font-size: 12.5px; }
.usage-item { display: inline-flex; align-items: baseline; gap: 2px; white-space: nowrap; }
.usage-item + .usage-item::before { content: "·"; margin: 0 6px; color: var(--ink-4); }
.usage-main .usage-item b { color: var(--ink); font-weight: 500; }
.usage-sub .usage-item b { font-weight: 400; }
.usage-item em { color: var(--ink-3); font-size: 12px; font-style: normal; }
.rate-limits { display: flex; flex-direction: column; gap: 6px; max-width: 330px; margin-top: 8px; }
.rate-limit { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 1px 10px; padding: 7px 8px 7px 11px; border-radius: 9px; background: var(--warn-soft); font-size: 12.5px; line-height: 1.45; }
.rate-limit.model-unavailable { background: var(--surface-2); }
.rate-limit b { grid-column: 1; min-width: 0; overflow: hidden; color: var(--ink); font: 500 12.5px/1.4 var(--mono); text-overflow: ellipsis; white-space: nowrap; }
.rate-limit span { grid-column: 1; color: var(--ink-2); font-size: 12px; }
.rate-limit .rl-clear { grid-column: 2; grid-row: 1 / span 2; min-height: 26px; padding: 2px 9px; border: 1px solid var(--warn-line); background: var(--surface); color: var(--ink); font-size: 12px; }
.rate-limit.model-unavailable .rl-clear { border-color: var(--line); }
.acc-reason { max-width: 300px; margin-top: 4px; font-size: 12.5px; line-height: 1.5; }
.err-n { color: var(--bad); }
.ml-reason { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
td.acts { text-align: right; white-space: nowrap; }
td.acts button { margin-left: 4px; vertical-align: middle; }
#accBody td.acts button { min-height: 30px; padding: 4px 11px; border-radius: 7px; font-size: 13px; }
#accBody td.acts button.ghost { color: var(--ink-2); }
#accBody td.acts .row-more { width: 30px; padding: 0; color: var(--ink-3); }
#accBody td.acts .row-more svg { width: 16px; height: 16px; }
#accBody td.acts .row-more[aria-expanded="true"] { background: var(--active); color: var(--ink); }
/* The actions column stays reachable when the table scrolls sideways (narrow laptops, collapsed
   browser windows). The divider shadow appears only while columns are hidden behind it. */
@media (min-width: 761px) {
  #accBody > tr > td:nth-child(3) { min-width: 200px; }
  #accBody td.acts { padding-left: 8px; padding-right: 12px; }
  .account-box .acc th.c-acts, #accBody td.acts { position: sticky; right: 0; z-index: 1; background: var(--surface); }
  #accBody tr:hover td.acts { background: color-mix(in srgb, var(--surface-2) 70%, var(--surface)); }
  .account-box .tbl-wrap.overflowing th.c-acts, .account-box .tbl-wrap.overflowing #accBody td.acts { box-shadow: inset 1px 0 0 var(--line-soft), -10px 0 12px -10px rgba(20, 20, 19, .18); }
}
.cell-sub { margin-top: 2px; color: var(--ink-3); font-size: 12px; font-variant-numeric: tabular-nums; }
.chk-all { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: 13px; cursor: pointer; user-select: none; white-space: nowrap; }
.acc-chk { margin-right: 6px; flex: none; }
.batch-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 10px 16px; border-bottom: 1px solid var(--line-soft); background: var(--accent-soft); }
.batch-count { color: var(--ink); font-size: 13.5px; font-weight: 550; white-space: nowrap; }
.batch-acts { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.uid-copy { cursor: copy; text-decoration: underline dotted var(--ink-4); text-underline-offset: 3px; }
.uid-copy:hover { color: var(--ink); }

/* States */
.empty { padding: 44px 20px; color: var(--ink-3); text-align: center; font-size: 13.5px; line-height: 1.8; }
.empty .big { margin-bottom: 4px; color: var(--ink); font: 400 20px/1.35 var(--serif); }
td.empty { padding: 32px 14px; }
.state { display: flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: 13.5px; line-height: 1.6; }
.state.ok { color: var(--ok); }
.state.err { color: var(--bad); }
.state.warn { color: var(--warn); }
.state.ok, .state.err { padding: 10px 12px; border-radius: var(--r-sm); }
.state.ok { background: var(--ok-soft); }
.state.err { background: var(--bad-soft); }
.dots::after { content: "…"; animation: blink 1.2s steps(4, end) infinite; }
@keyframes blink { 50% { opacity: .28; } }
.capability-note { max-width: 280px; margin-top: 5px; color: var(--ink-3); font-size: 12px; }
.capability-note summary { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; list-style: none; }
.capability-note summary::-webkit-details-marker { display: none; }
.capability-note summary::after { content: ""; width: 10px; height: 10px; background: var(--chev) center / 10px no-repeat; transition: transform .14s var(--ease); }
.capability-note[open] summary::after { transform: rotate(180deg); }
.capability-note summary:hover { color: var(--ink); }
.capability-note > div { margin-top: 3px; padding-left: 8px; border-left: 2px solid var(--line-soft); line-height: 1.6; }

/* Filters */
.fbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); }
.fbar > input, .fbar > select { width: auto; min-height: 34px; padding-top: 5px; padding-bottom: 5px; border-radius: var(--r-sm); font-size: 13.5px; }
.fbar > select { max-width: 180px; }
.fbar > input[type=search] { min-width: 220px; flex: 0 1 300px; }
.trange { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.trange .tr-custom { display: inline-flex; align-items: center; gap: 6px; }
.trange .tr-sep { color: var(--ink-3); font-size: 12px; }
.trange select, .trange input { width: auto; min-height: 30px; padding-top: 4px; padding-bottom: 4px; border-radius: 7px; font-size: 13px; }
.trange input[type=datetime-local] { font-size: 12.5px; color-scheme: light; }
[data-theme="dark"] .trange input[type=datetime-local] { color-scheme: dark; }
.trange .tr-bad { border-color: var(--bad); background: var(--bad-soft); }

/* ── Usage ──────────────────────────────────────────────────────────── */
.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; padding: 18px 18px 4px; }
.kpis.k4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpis.k5 { grid-template-columns: repeat(5, minmax(0, 1fr)); padding-bottom: 18px; border-bottom: 1px solid var(--line-soft); }
.kpi { position: relative; min-width: 0; padding: 14px 15px; border-radius: var(--r-md); background: var(--surface-2); }
.kpi .k { overflow: hidden; color: var(--ink-3); font-size: 12.5px; text-overflow: ellipsis; white-space: nowrap; }
.kpi .v { margin-top: 6px; color: var(--ink); font-size: 24px; font-weight: 450; line-height: 1.15; letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.kpi .s { margin-top: 5px; overflow: hidden; color: var(--ink-3); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.kpi.c-warn .v { color: var(--warn); }
.kpi.c-bad .v { color: var(--bad); }
.kpi .kbar { display: flex; height: 4px; margin-top: 9px; overflow: hidden; border-radius: 999px; background: var(--surface-3); }
.kpi .kbar i { display: block; height: 100%; min-width: 2px; }
.uschart { overflow: hidden; border: 1px solid var(--line-soft); border-radius: var(--r-md); }
.uschart-hd { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 11px 14px; border-bottom: 1px solid var(--line-soft); font-size: 13px; }
.uschart-hd .lb { color: var(--ink); font-weight: 550; }
.uschart-hd .legend { display: flex; align-items: center; gap: 7px; color: var(--ink-3); font-size: 12.5px; }
.uschart-hd .legend .sep { width: 1px; height: 12px; margin: 0 3px; background: var(--line); }
.uschart-hd .sw { width: 9px; height: 9px; display: inline-block; border-radius: 3px; }
.uschart-hd .sw-p, .uschart-body .usbar-p { background: var(--accent); fill: var(--accent); }
.uschart-hd .sw-c, .uschart-body .usbar-c { background: var(--ok); fill: var(--ok); }
.uschart-hd .sw-t { width: 12px; height: 0; border-top: 2px dashed var(--ink-3); border-radius: 0; }
.uschart-body { padding: 12px 12px 8px; }
.uschart-body svg { display: block; width: 100%; height: auto; }
.uschart-body .ax { stroke: var(--line-strong); stroke-width: 1; }
.uschart-body .gl { stroke: var(--line-soft); stroke-width: 1; }
.uschart-body .avg { stroke: var(--ink-3); stroke-width: 1.2; stroke-dasharray: 4 4; opacity: .7; }
.uschart-body .tk { fill: var(--ink-3); font: 11px var(--sans); }
.uschart-body .tk-avg { fill: var(--ink-3); font: 11px var(--sans); }
.uschart-body .tk-peak { fill: var(--ink); font: 600 11px var(--sans); }
.uschart-body rect.usbar:hover { opacity: .78; }
.uschart-body .us-empty, .us-empty { padding: 40px 0; color: var(--ink-3); text-align: center; font-size: 13.5px; }
.us-mix { display: flex; height: 4px; min-width: 64px; margin-top: 6px; overflow: hidden; border-radius: 999px; background: var(--surface-3); }
.us-mix i { display: block; height: 100%; }
.us-mix .p { background: var(--accent); }
.us-mix .c { background: var(--ok); }

/* ── Credits / packages ─────────────────────────────────────────────── */
.pk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.pk-card { padding: 16px; border: 1px solid var(--line-soft); border-radius: var(--r-md); background: var(--surface); }
.pk-card .who { display: flex; align-items: center; gap: 8px; max-width: none; margin-bottom: 8px; }
.pk-card .nm { font-size: 14px; font-weight: 600; }
.pk-card .realm { padding: 0 6px; border: 1px solid var(--line); border-radius: 5px; color: var(--ink-3); font-size: 11px; line-height: 17px; }
.pk-card .big { font: 400 28px/1.1 var(--serif); letter-spacing: -.01em; font-variant-numeric: lining-nums tabular-nums; }
.pk-card .sub { margin-top: 5px; color: var(--ink-3); font-size: 12.5px; }
.pk-card .mixbar, .pk-card .expirybar { display: flex; gap: 2px; height: 6px; margin-top: 10px; overflow: hidden; border-radius: 999px; background: var(--surface-3); }
.pk-card .mixbar i, .pk-card .expirybar i { display: block; height: 100%; min-width: 2px; }
.pk-card .err { display: -webkit-box; overflow: hidden; color: var(--warn); font-size: 13px; line-height: 1.6; -webkit-box-orient: vertical; -webkit-line-clamp: 4; overflow-wrap: anywhere; }
.pk-legend, .pk-expiry-legend { display: flex; flex-wrap: wrap; gap: 5px 14px; margin-top: 10px; color: var(--ink-3); font-size: 12.5px; }
.pk-legend span, .pk-expiry-legend span { display: inline-flex; align-items: center; gap: 6px; }
.pk-legend i, .pk-expiry-legend i { width: 8px; height: 8px; display: inline-block; border-radius: 3px; }
.pk-group-summary td { padding: 6px 14px; background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.pk-group-toggle { width: 100%; justify-content: flex-start; min-height: 30px; padding: 4px 0; border: 0; background: transparent; box-shadow: none; color: var(--ink-2); font-size: 13px; text-align: left; }
.pk-group-toggle:hover:not(:disabled) { border: 0; background: transparent; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.pk-hidden-row td { color: var(--ink-3); }
.pk-expiry-chart { max-height: 280px; padding-right: 10px; overflow-x: hidden; overflow-y: auto; scrollbar-gutter: stable; scrollbar-width: thin; overscroll-behavior: contain; }
.pk-expiry-hdr, .pk-expiry-row { display: grid; grid-template-columns: 70px minmax(90px, 1fr) 80px; align-items: center; gap: 12px; }
.pk-expiry-hdr { margin-bottom: 6px; color: var(--ink-3); font-size: 12px; }
.pk-expiry-hdr > b, .pk-expiry-row > b { text-align: right; }
.pk-expiry-hdr > b { font-weight: 400; }
.pk-expiry-row { min-height: 32px; }
.pk-expiry-row > span { color: var(--ink-2); font-size: 13px; }
.pk-expiry-row > b { color: var(--ink); font-size: 13px; font-weight: 500; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.pk-expiry-track { display: flex; align-items: stretch; gap: 2px; height: 10px; overflow: hidden; border-radius: 999px; background: var(--surface-3); }
.pk-expiry-seg { display: block; min-width: 3px; height: 100%; background: var(--seg-color, var(--accent)); }
.pk-expiry-seg:hover { filter: brightness(1.08); }
.pk-expiry-foot { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line-soft); color: var(--ink-3); font-size: 12.5px; }
.pk-expiry-empty { padding: 28px 0; color: var(--ink-3); text-align: center; font-size: 13.5px; }
.pk-inline-acts { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin-top: 6px; }
.pk-inline-acts button { min-height: 26px; padding: 2px 8px; font-size: 12px; }
.pk-picker-list { display: flex; flex-direction: column; gap: 2px; max-height: 360px; padding-right: 4px; overflow-y: auto; }
.pk-picker-item { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 9px 10px; border-radius: var(--r-sm); cursor: pointer; font-size: 13.5px; overflow-wrap: anywhere; }
.pk-picker-item:hover { background: var(--hover); }
.pk-picker-item:has(input:checked) { background: var(--accent-soft); }
.pk-picker-item code { margin-left: auto; color: var(--ink-3); font-size: 12px; word-break: break-all; }
.picker-fbar { margin: -2px 0 10px; padding: 0 0 12px; }
.picker-fbar > input[type=search] { flex: 1 1 auto; min-width: 0; }

/* Expiry reminder and compensation (account pool) */
.exp-row { display: grid; grid-template-columns: 8px minmax(7em, 11em) minmax(0, 1fr); align-items: start; gap: 12px; padding: 11px 0; font-size: 13.5px; }
.exp-row + .exp-row { border-top: 1px solid var(--line-soft); }
.exp-dot { width: 8px; height: 8px; margin-top: 7px; border-radius: 50%; }
.exp-nm { overflow: hidden; color: var(--ink); font-weight: 550; text-overflow: ellipsis; white-space: nowrap; }
.exp-main { color: var(--ink-2); line-height: 1.6; }
.exp-main b { color: var(--ink); font-weight: 550; font-variant-numeric: tabular-nums; }
.exp-main .note { display: block; margin-top: 2px; font-size: 12.5px; white-space: normal; }
.exp-main.err { color: var(--bad); }
.comp-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 0; border-bottom: 1px solid var(--line-soft); font-size: 13.5px; }
.comp-row > span:first-child { min-width: 7em; color: var(--ink); font-weight: 550; }
.comp-row:last-child { border-bottom: none; }
.comp-row button { margin-left: auto; }
.rm-ghost { margin-left: .4em; color: var(--ink-3); font-weight: 400; }
.rm-list { display: flex; flex-direction: column; gap: 10px; }
.rm-row { display: flex; align-items: center; gap: 12px; }
.rm-row .rm-who { flex: 0 0 170px; overflow: hidden; color: var(--ink-2); font-size: 13.5px; text-overflow: ellipsis; white-space: nowrap; }
.rm-row input { flex: 1; }

/* ── Tasks & jobs ───────────────────────────────────────────────────── */
.tc-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 52px 22px 56px; color: var(--ink-3); }
.tc-empty svg { width: 42px; height: 42px; margin-bottom: 6px; color: var(--ink-4); }
.tc-empty .t { color: var(--ink); font: 400 21px/1.35 var(--serif); }
.tc-empty .d { max-width: 40em; font-size: 13.5px; line-height: 1.75; text-align: center; }
.qprog { display: flex; align-items: center; gap: 12px; padding: 14px 18px 0; }
.qprog .qbar { flex: 1; height: 6px; overflow: hidden; border-radius: 999px; background: var(--surface-3); }
.qprog .qbar i { display: block; width: 0; height: 100%; border-radius: 999px; background: var(--accent); transition: width .4s var(--ease); }
.qprog .qbar i.indeterminate { width: 30% !important; animation: indet 1.3s var(--ease) infinite; }
@keyframes indet { from { transform: translateX(-110%); } to { transform: translateX(340%); } }
.qprog .note { font-variant-numeric: tabular-nums; }
.qgroup { padding: 4px 0 10px; }
.qgroup + .qgroup { border-top: 1px solid var(--line-soft); }
.qgroup header { display: flex; align-items: baseline; gap: 10px; padding: 12px 18px 6px; }
.qgroup header .nm { font-size: 14px; font-weight: 600; }
.qgroup header .cnt { color: var(--ink-3); font-size: 12.5px; }
.qrow { display: grid; grid-template-columns: 130px 1fr 60px 92px minmax(130px, 260px); gap: 12px; align-items: center; padding: 8px 18px; font-size: 13.5px; }
.qrow:hover { background: var(--hover); }
.qrow .code { overflow: hidden; color: var(--ink-3); font: 12px/1.4 var(--mono); text-overflow: ellipsis; white-space: nowrap; }
.qrow .name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.qrow .name .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qrow .prog { color: var(--ink-2); font-variant-numeric: tabular-nums; text-align: right; }
.qrow .st { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.qrow .msg { overflow: hidden; color: var(--ink-3); font-size: 12.5px; text-overflow: ellipsis; white-space: nowrap; }
.qdot { width: 7px; height: 7px; flex: none; border-radius: 50%; }
.qdot.done { background: var(--ok); }
.qdot.run { background: var(--accent); animation: qpulse 1.2s ease-in-out infinite; }
.qdot.wait { border: 1.5px solid var(--ink-4); }
.qdot.err { background: var(--bad); }
.qdot.skip { background: var(--ink-4); }
@keyframes qpulse { 50% { opacity: .35; } }
.stask { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); font-size: 13px; }
.stask .mark { width: 14px; flex: none; text-align: center; }
.stask.ok .mark { color: var(--ok); }
.stask.warn, .stask.warn .fr { color: var(--warn); }
.stask.todo { color: var(--ink-3); }

.job-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; width: calc(100% - 64px); max-width: calc(var(--view-max) - 64px); margin: 18px auto 0; padding: 12px 14px 12px 16px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); box-shadow: var(--shadow-sm); color: var(--ink-2); font-size: 13px; overflow-wrap: anywhere; }
.job-banner.in-dialog { width: auto; max-width: none; margin: 0 0 14px; box-shadow: none; }
.job-banner .jb-main { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.job-banner .jb-main b { color: var(--ink); font-weight: 550; }
.job-banner .jb-acts { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.job-banner .state.err { flex: 1 1 100%; }
.jb-progress { display: flex; align-items: center; gap: 10px; flex: 1 1 220px; min-width: 160px; }
.jb-progress-track { flex: 1; height: 5px; overflow: hidden; border-radius: 999px; background: var(--surface-3); }
.jb-progress-track i { display: block; height: 100%; border-radius: 999px; background: var(--accent); transition: width .4s var(--ease); }
.jb-progress.indeterminate .jb-progress-track i { width: 30%; animation: indet 1.3s var(--ease) infinite; }
.job-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--line-soft); overflow-wrap: anywhere; }
.job-row:last-child { border-bottom: 0; }
.job-row > div { min-width: 0; flex: 1; }
.job-row > div > b { font-weight: 550; }
.job-row .tag { margin-left: 6px; }
.job-row button { flex-shrink: 0; }
.job-row .jb-progress { margin-top: 8px; max-width: 420px; }
.job-row .state.err { margin-top: 8px; }
#jobList > .note { display: block; padding: 22px 18px; }
.job-results { margin-top: 8px; color: var(--ink-3); font-size: 12.5px; }
.job-results summary { color: var(--ink-2); cursor: pointer; }
.job-results summary:hover { color: var(--ink); }
.job-results > div { padding: 5px 0 5px 10px; border-left: 2px solid var(--line-soft); }

/* ── Config ─────────────────────────────────────────────────────────── */
.config-nav { position: sticky; top: 66px; z-index: 12; display: flex; align-items: center; gap: 12px; margin: -6px 0 20px; padding: 5px; border: 1px solid var(--line-soft); border-radius: 12px; background: var(--surface); box-shadow: 0 -11px 0 var(--bg), var(--shadow-sm); }
.config-nav-label { flex: none; padding: 0 4px 0 9px; color: var(--ink-3); font-size: 12.5px; white-space: nowrap; }
.config-nav-links { display: flex; align-items: center; gap: 2px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.config-nav-links::-webkit-scrollbar { display: none; }
.config-nav-links button { flex: none; min-height: 30px; padding: 4px 12px; border: 0; border-radius: 8px; background: transparent; box-shadow: none; color: var(--ink-2); font-size: 13px; font-weight: 450; }
.config-nav-links button:hover:not(:disabled) { border: 0; background: var(--hover); color: var(--ink); }
.config-nav-links button.on { background: var(--active); color: var(--ink); font-weight: 550; }
.config-section { scroll-margin-top: 124px; }
#cfgPath { display: block; max-width: 440px; overflow: hidden; font-family: var(--mono); font-size: 12px; text-overflow: ellipsis; }
#cfgForm .pad > .hint { max-width: 100ch; }
#cfgForm .switch + .hint { margin: -2px 0 12px; }
.savebar { display: flex; align-items: center; gap: 12px; margin-top: 4px; padding: 10px 10px 10px 18px; border: 1px solid transparent; border-radius: 14px; transition: box-shadow .16s var(--ease), background .16s var(--ease); }
.savebar.floating { position: sticky; bottom: 16px; z-index: 15; border-color: var(--line); background: color-mix(in srgb, var(--raise) 92%, transparent); box-shadow: var(--shadow-md); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.draft-state { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-3); font-size: 13px; }
.draft-state::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.draft-state.is-dirty, .draft-state.dirty, .draft-state[data-dirty="true"] { color: var(--warn); font-weight: 500; }
.draft-state.is-dirty::before, .draft-state.dirty::before, .draft-state[data-dirty="true"]::before { background: var(--warn); }
.restart-note { color: var(--warn); font-size: 13px; }
.project-keys-wrap { margin: 14px 0 12px; overflow-x: auto; border: 1px solid var(--line-soft); border-radius: var(--r-md); }
.project-keys-wrap table { width: 100%; min-width: 960px; border-collapse: collapse; }
.project-keys-wrap th { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); color: var(--ink-3); text-align: left; font-size: 12.5px; font-weight: 500; white-space: nowrap; }
.project-keys-wrap td { padding: 10px 12px; border-top: 1px solid var(--line-soft); vertical-align: top; }
.project-keys-wrap tr:first-child td { border-top: 0; }
.project-keys-wrap input:not([type=checkbox]) { min-height: 32px; font-size: 13px; }
.project-keys-wrap td .hint { margin-top: 4px; font-family: var(--mono); font-size: 11.5px; }
.project-keys-wrap table:has(tbody:empty) { display: none; }

/* ── Logs ───────────────────────────────────────────────────────────── */
#logBox { max-height: 460px; margin: 0; padding: 14px 18px; overflow: auto; background: var(--surface-2); color: var(--ink-2); font: 12.5px/1.75 var(--mono); white-space: pre-wrap; word-break: break-word; }
#logBox .ln { display: block; padding: 1px 6px; margin: 0 -6px; border-radius: 4px; }
#logBox .ln.e { color: var(--bad); }
#logBox .ln.w { color: var(--warn); }
#logBox .ln:hover { background: var(--hover); }
.ln .lch { display: inline-block; min-width: 30px; margin-right: 8px; padding: 0 5px; border-radius: 4px; font: 500 11px/18px var(--sans); font-style: normal; text-align: center; vertical-align: 1px; }
.ln .lch.c-task { background: var(--accent-soft); color: var(--accent); }
.ln .lch.c-chat { background: var(--ok-soft); color: var(--ok); }
.ln .lch.c-sys { background: var(--surface-3); color: var(--ink-3); }
#reqSummary, #reqNote { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
#reqSummary { flex: 1 1 300px; }
#reqNote { flex: 0 1 260px; text-align: right; }
.clip { display: block; max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clip.acct { max-width: 160px; }
.clip.ip { max-width: 150px; font: 12.5px var(--mono); }
.egress, .id.egress { margin-top: 2px; color: var(--ink-3); font: 12px/1.4 var(--mono); }
.egress.off { color: var(--warn); }
.clip.rid { max-width: 112px; color: var(--ink-3); font: 12px var(--mono); }
.acc.req { min-width: 980px; }
.acc.req th, .acc.req td { padding: 9px 10px; }
.acc.req tbody tr { cursor: pointer; }
.acc.req tbody tr.req-selected, .acc.req tbody tr.req-selected:hover { background: var(--accent-soft); }
.req-wrap { max-height: 480px; overflow: auto; }
.req-wrap thead th { position: sticky; top: 0; z-index: 2; background: var(--surface); }
.req-detail-box { padding: 16px 18px; border-top: 1px solid var(--line); background: var(--surface-2); font-size: 13px; overflow-wrap: anywhere; }
.req-detail-box > div:first-child b { font-weight: 600; }
.req-detail-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.req-detail-acts { display: flex; gap: 6px; }
.req-detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px 20px; margin-top: 12px; }
.req-detail-item { min-width: 0; }
.req-detail-item.wide { grid-column: 1 / -1; }
.req-detail-item .k { display: block; margin-bottom: 1px; color: var(--ink-3); font-size: 12px; }
.req-detail-item .v { color: var(--ink); font: 12.5px var(--mono); word-break: break-all; }
.md-caps { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.md-inline-bar { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin-top: 6px; }
.md-act { min-height: 26px !important; padding: 2px 8px !important; font-size: 12px !important; }
.md-inline-bar .tag { margin-left: 2px; }

/* ── Overlays ───────────────────────────────────────────────────────── */
.veil { position: fixed; inset: 0; z-index: 100; display: none; background: var(--scrim); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }
.veil.on { display: flex; align-items: center; justify-content: center; padding: 24px; animation: fadeIn .14s var(--ease); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.dlg { display: flex; flex-direction: column; width: 580px; max-width: 100%; max-height: min(88vh, 900px); overflow: hidden; border: 1px solid var(--line-soft); border-radius: var(--r-xl); background: var(--raise); box-shadow: var(--shadow-lg); animation: dlgIn .18s var(--ease); }
@keyframes dlgIn { from { opacity: 0; transform: translateY(8px) scale(.985); } to { opacity: 1; transform: none; } }
.dlg-wide { width: 980px; }
.dlg-narrow { width: 560px; }
.dlg-confirm { width: 440px; }
.dlg header { padding: 22px 24px 14px; }
.dlg-wide header { border-bottom: 1px solid var(--line-soft); }
.dlg header h3 { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; color: var(--ink); font: 400 22px/1.3 var(--serif); letter-spacing: -.005em; }
.dlg header h3 .hint { font: 13px/1.5 var(--sans); }
.dlg header .hint { margin-top: 6px; }
.dlg .body { padding: 6px 24px 20px; overflow: auto; }
.dlg-wide .body { padding-top: 18px; }
.dlg footer { display: flex; align-items: center; gap: 8px; padding: 14px 20px 18px; border-top: 1px solid var(--line-soft); }
.dlg-confirm footer { border-top: 0; padding-top: 4px; }
#confirmBody { color: var(--ink-2); font-size: 14px; line-height: 1.7; white-space: pre-line; }
.dlg .tabs { margin-top: 14px; }
.tab-panel { padding-top: 6px; }
.url { margin: 10px 0 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2); color: var(--ink); font: 12.5px/1.6 var(--mono); word-break: break-all; user-select: all; }
.task-fbar { margin: 0 0 12px; padding: 0 0 12px; }
.task-block-note { margin: 0 0 12px; padding: 10px 12px; border-radius: var(--r-sm); background: var(--warn-soft); line-height: 1.6; }
.task-fbar > input[type=search] { flex: 1 1 200px; }
.import-step { padding: 4px 0 18px; }
.import-step + .import-step { padding-top: 18px; border-top: 1px solid var(--line-soft); }
.import-lb { color: var(--ink); font-size: 14px; font-weight: 550; }
.import-step .hint { margin: 2px 0 10px; }
.import-step textarea { font: 12.5px/1.6 var(--mono); }
.import-acts { display: flex; justify-content: flex-end; margin-top: 10px; }
#addVeil[data-tab="import"] .login-only { display: none !important; }
#addDone, #addErr, #importDone, #importErr { margin-top: 12px; }

/* Login gate */
#keyVeil { background: var(--bg); backdrop-filter: none; -webkit-backdrop-filter: none; }
#keyDlg.login-dlg { width: 400px; border: 0; border-radius: 0; background: transparent; box-shadow: none; overflow: visible; }
.login-dlg header { padding: 0 0 26px; text-align: center; }
.login-emblem { display: grid; place-items: center; width: 46px; height: 46px; margin: 0 auto 26px; border-radius: 13px; background: var(--accent); color: #fff; font: 500 26px/1 var(--serif); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .12), var(--shadow-sm); }
#keyDlg.login-dlg h3 { display: block; margin: 0 0 8px; color: var(--ink); font: 400 40px/1.15 var(--serif); letter-spacing: -.02em; text-align: center; }
.login-dlg header .hint { font-size: 15px; }
.login-dlg .body { padding: 0; overflow: visible; }
.login-form { display: block; }
.login-label { display: block; margin-bottom: 7px; color: var(--ink-2); font-size: 13.5px; font-weight: 500; }
#keyInput { min-height: 46px; padding: 10px 14px; border-radius: 11px; font-size: 15px; box-shadow: var(--shadow-xs); }
#keyErr { margin-top: 12px; }
.login-dlg footer { flex-direction: column; align-items: stretch; gap: 14px; padding: 14px 0 0; border: 0; }
#btnKey { width: 100%; min-height: 46px; border-radius: 11px; font-size: 15px; }
.login-help { color: var(--ink-3); font-size: 12.5px; line-height: 1.6; text-align: center; }

/* Vouchers */
.vc-acct { display: flex; align-items: baseline; gap: 8px; margin: 18px 2px 8px; color: var(--ink-3); font-size: 12.5px; }
.vc-acct .nm { color: var(--ink); font-size: 14px; font-weight: 600; }
.vc { margin-bottom: 10px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.vc .hd { display: flex; align-items: center; gap: 8px; padding: 12px 14px 4px; }
.vc .hd .nm { font-size: 14px; font-weight: 600; }
.vc .hd .tag { margin-left: auto; }
.vc .meta { padding: 2px 14px 10px; color: var(--ink-3); font-size: 12.5px; }
.vc .sep { margin: 0 14px; border-top: 1px dashed var(--line); }
.vc .ft { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 14px; }
.vc .ft .lab { flex: none; color: var(--ink-3); font-size: 12px; }
.vc .ft code { padding: 7px 11px; border-radius: var(--r-xs); background: var(--surface-2); font-size: 14px; font-weight: 600; letter-spacing: 1px; user-select: all; }
.vc .ft .acts { display: flex; gap: 4px; margin-left: auto; flex: none; }
.vc .vc-qr { display: flex; justify-content: center; padding: 14px; border-top: 1px dashed var(--line); }
.vc.expired { border-style: dashed; }
.vc.expired .hd, .vc.expired .meta { opacity: .55; }

/* Toasts */
#toasts { position: fixed; right: 20px; bottom: 20px; z-index: 140; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; pointer-events: none; }
.tst { display: flex; align-items: flex-start; gap: 10px; max-width: 400px; padding: 11px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--raise); box-shadow: var(--shadow-md); color: var(--ink); font-size: 13.5px; line-height: 1.5; pointer-events: auto; cursor: pointer; animation: tstIn .2s var(--ease); }
.tst::before { content: ""; flex: none; width: 7px; height: 7px; margin-top: 7px; border-radius: 50%; background: var(--ink-4); }
.tst.ok::before { background: var(--ok); }
.tst.err::before { background: var(--bad); }
.tst.warn::before { background: var(--warn); }
.tst.out { animation: tstOut .18s var(--ease) forwards; }
@keyframes tstIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes tstOut { to { opacity: 0; transform: translateY(5px); } }

/* ── Tablet ─────────────────────────────────────────────────────────── */
@media (min-width: 761px) and (max-width: 1180px) {
  .shell { grid-template-columns: 220px minmax(0, 1fr); }
  .view { padding: 28px 24px 64px; }
  .topbar { padding: 10px 24px; }
  .job-banner { width: calc(100% - 48px); }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis, .kpis.k5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .box > header h3 { flex: 1 1 100%; }
  .qrow { grid-template-columns: 110px 1fr 54px 84px minmax(120px, 200px); }
  #cfgPath { max-width: 100%; }
  .grid3 { grid-template-columns: 1fr 1fr; }
  .refresh-state { max-width: 32vw; }
}
