/* Nova AI — portal & console styles.
   Copyright (c) 2026. All rights reserved. */

:root {
  color-scheme: light;
  --bg: #f6f6f4;
  --surface: #ffffff;
  --surface-2: #fafaf8;
  --surface-3: #f1f1ee;
  --border: #e6e5e0;
  --border-strong: #d4d2cb;
  --text: #16161a;
  --text-2: #52514e;
  --muted: #86847d;
  --brand: #2a5bd7;
  --brand-hover: #2350c2;
  --brand-ink: #ffffff;
  --brand-soft: #edf2fd;
  --ok: #117a3d;
  --ok-soft: #e8f6ee;
  --warn: #9a6100;
  --warn-soft: #fff5e1;
  --danger: #c02b2b;
  --danger-soft: #fdeeee;
  --info: #2a5bd7;
  --info-soft: #edf2fd;
  --code-bg: #f4f4f1;
  --shadow-sm: 0 1px 2px rgba(20, 20, 24, .05);
  --shadow: 0 1px 3px rgba(20, 20, 24, .06), 0 4px 12px rgba(20, 20, 24, .04);
  --radius: 10px;
  --radius-sm: 7px;
  --chart-1: #2a78d6;
  --chart-grid: #e1e0d9;
  --chart-axis: #86847d;
  --font: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0f0f10;
    --surface: #18181a;
    --surface-2: #1c1c1f;
    --surface-3: #232326;
    --border: #2a2a2e;
    --border-strong: #3a3a3f;
    --text: #ededee;
    --text-2: #b9b8b3;
    --muted: #8b8a85;
    --brand: #5b8def;
    --brand-hover: #6f9cf2;
    --brand-ink: #0b1020;
    --brand-soft: #1b2440;
    --ok: #3fbf72;
    --ok-soft: #13291c;
    --warn: #e0a53a;
    --warn-soft: #2d2412;
    --danger: #ef6b6b;
    --danger-soft: #331819;
    --info: #7aa5f5;
    --info-soft: #172139;
    --code-bg: #131315;
    --shadow-sm: none;
    --shadow: none;
    --chart-1: #3987e5;
    --chart-grid: #2c2c2a;
    --chart-axis: #8b8a85;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font-family: var(--font);
  font-size: 14px; line-height: 1.55; -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 22px; }
h2 { font-size: 15px; }
h3 { font-size: 14px; }
p { margin: 0 0 8px; }
code, pre, .mono { font-family: var(--mono); font-size: 12.5px; }
hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.text-2 { color: var(--text-2); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.danger-text { color: var(--danger); }
.ok-text { color: var(--ok); }
.warn-text { color: var(--warn); }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------------------------------------------------------------- shell */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 236px; flex: 0 0 236px; background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; padding: 14px 10px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 14px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: inline-grid; place-items: center; min-width: 38px; height: 30px; padding: 0 6px; border-radius: 8px;
  background: linear-gradient(135deg, #2a5bd7, #6a4bd8); color: #fff; font-weight: 700; font-size: 13px;
  letter-spacing: .04em; box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .15);
}
.brand-text { font-weight: 600; font-size: 13px; line-height: 1.3; color: var(--text); }
.sidebar-tenant {
  margin: 0 8px 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2); font-size: 12px; color: var(--text-2);
}
.sidebar-tenant strong { display: block; color: var(--text); font-size: 13px; }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--radius-sm);
  color: var(--text-2); font-size: 13.5px; background: none; border: 0; width: 100%; text-align: left;
  cursor: pointer; font-family: inherit;
}
.nav-item:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.nav-item svg { flex: 0 0 16px; }
.sidebar-foot { border-top: 1px solid var(--border); padding-top: 10px; display: flex; flex-direction: column; gap: 2px; }
.sidebar-foot form { margin: 0; }
.main { flex: 1; min-width: 0; padding: 22px 28px 40px; max-width: 1360px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); margin: 4px 0 0; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.foot { margin-top: 36px; color: var(--muted); font-size: 12px; text-align: center; }

/* ---------------------------------------------------------------- banners & alerts */
.banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 10px 14px; border-radius: var(--radius); margin-bottom: 14px; font-size: 13px; border: 1px solid;
}
.banner form { margin: 0; }
.banner-info { background: var(--info-soft); border-color: transparent; color: var(--text); }
.banner-warn { background: var(--warn-soft); border-color: transparent; color: var(--text); }
.banner-viewas { background: var(--surface); border-color: var(--brand); border-style: dashed; }
.alert { padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 14px; font-size: 13px; border: 1px solid transparent; }
.alert-ok { background: var(--ok-soft); color: var(--ok); }
.alert-warn { background: var(--warn-soft); color: var(--warn); }
.alert-danger { background: var(--danger-soft); color: var(--danger); }
.alert-info { background: var(--info-soft); color: var(--info); }
.alert strong { color: inherit; }

/* ---------------------------------------------------------------- cards & grids */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 16px 18px; min-width: 0;
}
.content > * + *, .content > form > * + * { margin-top: 16px; }
.card + .card, .card + .grid, .grid + .card, .grid + .grid, section + section { margin-top: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head h2 { display: flex; align-items: center; gap: 8px; }
.card-head .hint { color: var(--muted); font-size: 12px; }
.card-flush { padding: 0; }
.card-flush .card-head { padding: 14px 18px 0; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-hero { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
.grid-main { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }

.stat { display: flex; flex-direction: column; gap: 2px; }
.stat-label { color: var(--muted); font-size: 12px; }
.stat-value { font-size: 22px; font-weight: 600; letter-spacing: -.01em; }
.stat-sub { color: var(--text-2); font-size: 12px; }

.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 16px; margin: 0; }
.kv dt { color: var(--muted); font-size: 13px; }
.kv dd { margin: 0; font-size: 13.5px; min-width: 0; overflow-wrap: anywhere; }

/* quota card */
.quota-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.quota-big { font-size: 34px; font-weight: 650; letter-spacing: -.02em; }
.quota-big small { font-size: 14px; font-weight: 500; color: var(--muted); margin-left: 6px; }
.progress { height: 10px; background: var(--surface-3); border-radius: 999px; overflow: hidden; margin: 14px 0 12px; }
.progress > span { display: block; height: 100%; border-radius: 999px; background: var(--brand); min-width: 2px; }
.progress.tone-warn > span { background: var(--warn); }
.progress.tone-danger > span { background: var(--danger); }
.progress-sm { height: 6px; margin: 6px 0 0; }
.quota-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.quota-foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--border); color: var(--text-2); font-size: 13px; }
.countdown { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text); }

/* ---------------------------------------------------------------- badges */
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; font-size: 12px;
  font-weight: 500; line-height: 20px; white-space: nowrap; border: 1px solid transparent;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }
.badge-plain::before { display: none; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-muted { background: var(--surface-3); color: var(--muted); }
.badge-info { background: var(--info-soft); color: var(--info); }

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.card-flush .table-wrap { margin-top: 10px; }
table.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { color: var(--muted); font-weight: 500; font-size: 12px; background: var(--surface-2); white-space: nowrap; }
.table tbody tr:hover td { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .row-muted td { color: var(--muted); }
.table .actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.table .actions form { margin: 0; }
.table-compact th, .table-compact td { padding: 6px 10px; }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); }
.share-bar { display: inline-block; height: 6px; border-radius: 3px; background: var(--chart-1); vertical-align: middle; margin-right: 6px; opacity: .85; }

/* ---------------------------------------------------------------- buttons & forms */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 12px;
  border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap; text-decoration: none;
}
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn:focus-visible, .input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: var(--brand-hover); }
.btn-danger { color: var(--danger); border-color: var(--border-strong); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger-solid:hover { filter: brightness(.95); background: var(--danger); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-sm { height: 26px; padding: 0 9px; font-size: 12px; }
.btn[disabled], .btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-block { width: 100%; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.form-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field-wide { grid-column: 1 / -1; }
.field label, .label { font-size: 12.5px; font-weight: 500; color: var(--text-2); }
.field .hint { font-size: 12px; color: var(--muted); }
.input, select, textarea {
  width: 100%; height: 34px; padding: 0 10px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font: inherit; font-size: 13.5px;
}
textarea { height: auto; min-height: 76px; padding: 8px 10px; resize: vertical; }
select { padding-right: 28px; }
.input::placeholder, textarea::placeholder { color: var(--muted); }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--brand); }
.check-list { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
.inline-form { display: inline-flex; gap: 6px; align-items: center; margin: 0; }
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.filter-bar .field { min-width: 140px; flex: 1 1 140px; max-width: 220px; }
.filter-bar .btns { display: flex; gap: 6px; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; margin: 0; min-width: 0; }
legend { padding: 0 6px; font-size: 12.5px; color: var(--text-2); font-weight: 600; }
details.more > summary { cursor: pointer; color: var(--brand); font-size: 13px; list-style: none; margin: 8px 0; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::before { content: "▸ "; }
details.more[open] > summary::before { content: "▾ "; }
details.rowedit > summary { list-style: none; cursor: pointer; }
details.rowedit > summary::-webkit-details-marker { display: none; }
details.rowedit[open] { background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px; }

/* ---------------------------------------------------------------- code */
.code-block { position: relative; margin: 8px 0 14px; }
.code-block pre {
  margin: 0; padding: 12px 14px; padding-right: 76px; background: var(--code-bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); overflow-x: auto; line-height: 1.6; white-space: pre;
}
.code-block .copy-btn { position: absolute; top: 8px; right: 8px; }
.code-label { font-size: 12px; color: var(--muted); margin-top: 12px; }
.inline-code { background: var(--code-bg); border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px; overflow-wrap: anywhere; }
.secret-box {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--code-bg); border: 1px dashed var(--brand);
  border-radius: var(--radius-sm); font-family: var(--mono); font-size: 14px; overflow-wrap: anywhere; flex-wrap: wrap;
}
.secret-box code { flex: 1; min-width: 0; font-size: 14px; word-break: break-all; }
.callout-key { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }

/* ---------------------------------------------------------------- docs */
.doc { max-width: 920px; }
.doc h2 { margin: 6px 0 10px; font-size: 16px; }
.doc h3 { margin: 16px 0 6px; }
.doc p, .doc li { color: var(--text-2); }
.doc ul, .doc ol { padding-left: 20px; margin: 6px 0 10px; }
.toc { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.toc a { padding: 4px 10px; border: 1px solid var(--border); border-radius: 999px; font-size: 12.5px; color: var(--text-2); background: var(--surface); }
.toc a:hover { color: var(--brand); border-color: var(--brand); text-decoration: none; }

/* ---------------------------------------------------------------- chart */
.chart-box { position: relative; height: 240px; }
.chart-box canvas { width: 100% !important; height: 100% !important; }

/* ---------------------------------------------------------------- pagination */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 18px; flex-wrap: wrap; color: var(--muted); font-size: 12.5px; border-top: 1px solid var(--border); }
.pager .btns { display: flex; gap: 6px; }

/* ---------------------------------------------------------------- login */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background:
  radial-gradient(1200px 500px at 20% -10%, var(--brand-soft), transparent 60%), var(--bg); }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); padding: 28px 26px; }
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.auth-brand .brand-mark { height: 36px; min-width: 46px; font-size: 15px; }
.auth-title { font-size: 18px; font-weight: 600; margin: 0 0 4px; }
.auth-sub { color: var(--muted); font-size: 13px; margin-bottom: 18px; }
.auth-card .field { margin-bottom: 14px; }
.auth-card .input { height: 38px; }
.auth-card .btn { height: 38px; font-size: 14px; }
.auth-foot { margin-top: 18px; color: var(--muted); font-size: 12px; text-align: center; }

/* ---------------------------------------------------------------- dialog */
dialog.modal {
  border: 1px solid var(--border); border-radius: 14px; padding: 0; width: min(520px, calc(100vw - 32px));
  background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
}
dialog.modal::backdrop { background: rgba(10, 10, 12, .45); }
.modal-body { padding: 20px 22px; }
.modal-body h2 { margin-bottom: 8px; font-size: 16px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 22px 18px; }
.modal pre.output { max-height: 50vh; overflow: auto; background: var(--code-bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; white-space: pre-wrap; word-break: break-word; }
dialog.modal.wide { width: min(860px, calc(100vw - 32px)); }
.critical-warn { background: var(--danger-soft); color: var(--danger); border-radius: var(--radius-sm); padding: 10px 12px; margin: 10px 0; font-size: 13px; }

/* ---------------------------------------------------------------- misc */
.tag { display: inline-block; padding: 0 6px; border-radius: 4px; background: var(--surface-3); color: var(--text-2); font-size: 11.5px; margin: 1px 2px 1px 0; }
.dot-crit { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--danger); margin-right: 6px; vertical-align: middle; }
.split { display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; }
.stack > * + * { margin-top: 8px; }
pre.json { margin: 0; max-height: 220px; overflow: auto; background: var(--code-bg); border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; font-size: 11.5px; white-space: pre-wrap; word-break: break-word; }
.test-result { font-size: 12.5px; margin-left: 8px; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-hero, .grid-main { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .sidebar {
    position: static; width: auto; flex: none; height: auto; border-right: 0; border-bottom: 1px solid var(--border);
    padding: 10px 12px 8px; flex-direction: column;
  }
  .brand { padding: 2px 4px 8px; }
  .sidebar-tenant { display: none; }
  .nav { flex-direction: row; overflow-x: auto; gap: 4px; padding-bottom: 4px; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav-item { width: auto; white-space: nowrap; padding: 6px 10px; }
  .nav-item svg { display: none; }
  .sidebar-foot { flex-direction: row; border-top: 0; padding-top: 4px; gap: 4px; }
  .sidebar-foot .nav-item { width: auto; font-size: 12.5px; }
  .main { padding: 16px 16px 32px; }
  .grid-2, .grid-3, .form-grid, .form-grid-3 { grid-template-columns: minmax(0, 1fr); }
  h1 { font-size: 19px; }
  .quota-big { font-size: 28px; }
  .filter-bar .field { max-width: none; }
}
@media (max-width: 520px) {
  .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .quota-row { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .stat-value { font-size: 18px; }
  .kv { grid-template-columns: minmax(0, 1fr); gap: 2px 0; }
  .kv dd { margin-bottom: 8px; }
}
@media print {
  .sidebar, .page-actions, .btn, .foot, .banner { display: none !important; }
  .main { padding: 0; }
  .card { box-shadow: none; }
}

/* Nova workspace refinement — scoped visual release, 2026-09-30.
   Local assets only. Quota data, permissions and form contracts are unchanged. */
:root {
  --bg: #f4f7f6; --surface-2: #f8faf9; --surface-3: #edf2ef;
  --border: #dfe7e3; --border-strong: #c8d4ce;
  --text: #172b26; --text-2: #4d625a; --muted: #64776f;
  --brand: #08745b; --brand-hover: #065a47; --brand-soft: #e2f2eb;
  --info: #29654f; --info-soft: #eaf3ee; --code-bg: #f1f5f3;
  --chart-1: #16856a; --chart-grid: #e4ebe7; --chart-axis: #64776f;
  --radius: 16px; --radius-sm: 9px;
  --shadow-sm: 0 2px 4px rgba(18, 43, 34, .025);
  --shadow: 0 16px 48px rgba(18, 43, 34, .07);
  --sidebar-bg: #102c27; --sidebar-ink: #c6d8d0; --sidebar-line: #2e4a41;
  --quota-bg: #e5f2eb; --quota-line: #c6dfd0;
}
body { line-height: 1.65; }
::selection { background: #b9e3d0; color: #102c27; }
h1 { font-size: 29px; letter-spacing: -.035em; font-weight: 650; }
h2 { font-size: 15px; font-weight: 650; }
.skip-link { position: fixed; left: 16px; top: -100px; padding: 12px 18px; z-index: 100; background: var(--surface); border: 2px solid var(--brand); border-radius: 8px; }
.skip-link:focus { top: 12px; }
a:focus-visible, button:focus-visible, summary:focus-visible { outline: 3px solid var(--brand); outline-offset: 3px; }
.sidebar { width: 224px; flex-basis: 224px; padding: 28px 16px 18px; background: var(--sidebar-bg); border-color: var(--sidebar-line); }
.brand { gap: 12px; padding: 0 10px 30px; }
.brand-mark { min-width: 36px; height: 36px; padding: 0; background: #c5ecd7; color: #113d2e; border-radius: 11px; font-size: 22px; font-weight: 750; box-shadow: none; letter-spacing: -.06em; }
.brand-text { font-size: 19px; font-weight: 650; letter-spacing: -.03em; }
.sidebar .brand-text { color: #f6fbf8; }
.brand-text small { display: block; font-size: 8px; font-weight: 500; letter-spacing: .18em; margin-top: 5px; color: #aec7bc; }
.sidebar-tenant { margin: 0 0 26px; padding: 13px 14px; background: #1b3931; border: 1px solid var(--sidebar-line); color: #b2cbbf; border-radius: 10px; }
.sidebar-tenant strong { font-size: 13px; color: #f0f8f3; margin-bottom: 3px; }
.nav { gap: 5px; }
.nav-item { min-height: 44px; padding: 10px 13px; font-size: 13px; color: var(--sidebar-ink); position: relative; transition: background-color .16s ease, color .16s ease; }
.nav-item:hover { background: #24463b; color: #fff; }
.nav-item.active { background: #2a4e40; color: #def7e9; }
.nav-item.active::before { position: absolute; content: ''; width: 3px; height: 16px; border-radius: 3px; background: #a1dfbb; left: 0; }
.nav-item svg { opacity: .85; }
.sidebar-foot { border-color: var(--sidebar-line); padding-top: 14px; }
.sidebar a:focus-visible, .sidebar button:focus-visible { outline-color: #b5e9cb; }
.main { padding: 0 36px 36px; max-width: 1580px; }
.workspace-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 66px; margin-bottom: 25px; border-bottom: 1px solid var(--border); color: var(--muted); font-size: 11px; }
.workspace-separator { padding: 0 11px; color: var(--border-strong); }
.workspace-zone { white-space: nowrap; font-size: 10px; letter-spacing: .03em; }
.page-head { align-items: center; margin-bottom: 24px; }
.page-head .sub { font-size: 12px; margin-top: 6px; }
.page-actions { gap: 9px; }
.card { padding: 22px 24px; }
.card-head { margin-bottom: 16px; }
.card-head .hint { font-size: 10px; }
.card-flush { padding: 0; }
.card-flush .card-head { padding: 22px 24px 0; }
.content > * + *, .content > form > * + * { margin-top: 20px; }
.grid { gap: 20px; }
/* Adjacent-card rhythm applies to document flow, never to grid siblings. */
.grid > .card, .grid > section { margin-top: 0; }
.quota-card { border-color: var(--border); position: relative; }
.quota-month { background: var(--quota-bg); border-color: var(--quota-line); }
.quota-card .card-head h2 { font-size: 13px; }
.quota-card .card-head h2 svg { display: none; }
.quota-card .card-head { gap: 6px; }
.quota-big { font-size: clamp(29px, 3vw, 42px); font-weight: 650; letter-spacing: -.045em; line-height: 1.35; }
.quota-big small { font-size: 11px; letter-spacing: 0; margin-left: 8px; }
.quota-card .badge { font-size: 10px; padding: 1px 8px; }
.quota-month .badge-ok { background: #cee8d9; color: #255e42; }
.progress { height: 5px; margin: 22px 0 20px; background: #dce6e0; }
.quota-month .progress { background: #c7ded0; }
.progress > span { background: var(--brand); }
.quota-row .stat-label { font-size: 10px; }
.quota-row .stat-value { font-size: clamp(14px, 1.6vw, 20px); font-weight: 600; }
.quota-foot { margin-top: 20px; padding-top: 14px; border-top-style: solid; font-size: 10px; gap: 6px; }
.quota-month .quota-foot { border-color: var(--quota-line); }
.countdown { font-weight: 550; margin-left: 3px; }
.quota-notice { display: flex; align-items: flex-start; gap: 9px; background: transparent; color: var(--text-2); padding: 0 0 0 2px; margin-bottom: 0; font-size: 11px; }
.quota-notice svg { flex-shrink: 0; margin-top: 2px; }
.service-strip .service-card { display: flex; align-items: flex-start; gap: 28px; background: transparent; box-shadow: none; border-width: 0 0 1px; border-radius: 0; padding: 18px 2px 23px; }
.service-strip .card-head { margin: 0; flex: 0 0 auto; padding-top: 2px; }
.service-strip .card-head h2 { font-size: 12px; }
.service-strip .card-head svg { display: none; }
.service-strip .kv { flex: 1; grid-template-columns: 55px minmax(0, 1fr) 55px minmax(0, 1.2fr); gap: 9px 12px; }
.service-strip .kv dt, .service-strip .kv dd { font-size: 11px; }
.grid-4 > .stat { padding: 17px 20px; gap: 7px; border-radius: 12px; box-shadow: none; }
.stat-label { font-size: 11px; }
.stat-value { font-size: 25px; font-weight: 600; letter-spacing: -.035em; }
.stat-sub { font-size: 10px; }
.btn { height: 38px; border-radius: 8px; font-size: 12px; padding: 0 14px; transition: background-color .16s ease, border-color .16s ease; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 11px; }
.btn-primary { box-shadow: 0 2px 3px rgba(4,70,48,.08); }
.input, select, textarea { height: 39px; font-size: 13px; border-radius: 8px; }
textarea { height: auto; }
.field label { font-size: 12px; }
.table th, .table td { padding: 13px 16px; }
.table th { font-size: 11px; letter-spacing: .015em; }
.table td { font-size: 12px; }
.table-compact th, .table-compact td { padding: 9px 12px; }
.filter-bar .field { max-width: 320px; }
.code-block pre { padding: 18px 82px 18px 18px; line-height: 1.9; }
.inline-code { line-height: 1.9; }
.toc a { padding: 8px 13px; }
.foot { text-align: left; border-top: 1px solid var(--border); padding-top: 18px; margin-top: 30px; font-size: 10px; }
.auth-wrap { padding: 0; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(400px, 1fr); background: var(--bg); min-height: 100svh; }
.auth-intro { width: 100%; justify-self: stretch; align-self: stretch; background: var(--sidebar-bg); color: #ecf7ef; display: flex; flex-direction: column; padding: 48px clamp(32px, 6vw, 96px); min-height: 100svh; }
.auth-wordmark { display: flex; gap: 12px; align-items: center; font-size: 22px; font-weight: 600; }
.auth-message { margin: auto 0; padding: 64px 0; }
.eyebrow { font-size: 10px; letter-spacing: .2em; color: #b0d5bf; margin-bottom: 24px; }
.auth-message h2 { font-size: clamp(38px, 4.2vw, 62px); line-height: 1.3; letter-spacing: -.045em; margin-bottom: 24px; }
.auth-message > p:not(.eyebrow) { color: #b7cfc2; font-size: 14px; }
.auth-features { list-style: none; padding: 0; margin: 36px 0 0; display: flex; flex-direction: column; gap: 16px; color: #d4e7da; font-size: 12px; }
.auth-features li { display: flex; gap: 12px; align-items: center; }
.auth-intro-foot { font-size: 10px; color: #acc7b6; margin: 0; }
.auth-card { width: calc(100% - 64px); max-width: 420px; border: none; padding: 38px 28px; box-shadow: none; background: transparent; }
.auth-brand { margin-bottom: 30px; }
.auth-brand .brand-mark { min-width: 36px; height: 36px; font-size: 22px; }
.auth-brand .brand-text { color: var(--text); }
.auth-title { font-size: 28px; margin-bottom: 12px; letter-spacing: -.04em; }
.auth-sub { margin-bottom: 28px; line-height: 1.8; font-size: 12px; }
.auth-card .field { margin-bottom: 20px; gap: 8px; }
.auth-card .input, .auth-card .btn { height: 46px; }
.auth-card .btn { margin-top: 4px; }
.auth-foot { text-align: left; font-size: 10px; margin-top: 22px; line-height: 1.8; }
@media (prefers-color-scheme: dark) {
  :root { --bg: #111d19; --surface: #182921; --surface-2: #1d3027; --surface-3: #263c30;
    --border: #30483a; --border-strong: #486453; --text: #edf6ee; --text-2: #c0d1c5; --muted: #a0b5a6;
    --brand: #8cd1af; --brand-hover: #a7e5c5; --brand-ink: #0f2e20; --brand-soft: #294a37;
    --info: #aedcba; --info-soft: #203d2b; --code-bg: #13241b;
    --quota-bg: #234232; --quota-line: #365e46; --chart-1: #8cd1af; --chart-grid: #30483a; --chart-axis: #a0b5a6; }
  .quota-card .progress { background: #3c5c48; }
  .quota-month .badge-ok { background: #365d45; color: #d1f2da; }
}
@media (min-width: 861px) and (max-width: 1180px) {
  .sidebar { width: 196px; flex-basis: 196px; padding-left: 12px; padding-right: 12px; }
  .main { padding-left: 24px; padding-right: 24px; }
  .quota-card { padding: 20px; }
  .quota-card .card-head { align-items: flex-start; flex-direction: column; }
}
@media (max-width: 860px) {
  .sidebar { padding: 16px 16px 8px; width: auto; flex-basis: auto; height: auto; }
  .brand { padding: 0 4px 16px; }
  .brand-text { font-size: 18px; }
  .brand-text small { display: none; }
  .nav { flex: none; padding-bottom: 5px; }
  .nav-item { padding: 10px 14px; min-height: 44px; }
  .nav-item.active::before { width: 16px; height: 2px; left: 14px; bottom: 3px; }
  .sidebar-foot { padding-top: 0; justify-content: flex-end; }
  .sidebar-foot .nav-item { font-size: 11px; padding: 8px 10px; }
  .main { padding: 0 20px 28px; }
  .workspace-bar { min-height: 48px; margin-bottom: 20px; }
  h1 { font-size: 26px; }
  .page-head { gap: 16px; margin-bottom: 22px; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; min-height: 44px; }
  .quota-big { font-size: 36px; }
  .quota-row .stat-value { font-size: 20px; }
  .card { padding: 22px; }
  .card-flush { padding: 0; }
  .service-strip .service-card { display: block; padding: 16px 2px; }
  .service-strip .card-head { margin-bottom: 12px; }
  .service-strip .kv { grid-template-columns: 60px minmax(0, 1fr); gap: 10px; }
  .service-strip .kv dd { margin-bottom: 0; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .grid-4 > .stat { padding: 16px; }
  .btn-sm { min-height: 38px; }
  .input, select, textarea { font-size: 16px; }
  .auth-wrap { display: block; min-height: 100svh; padding: 32px 20px; }
  .auth-intro { display: none; }
  .auth-card { width: 100%; max-width: 420px; margin: 0 auto; padding: 20px 8px; }
}
@media (max-width: 420px) {
  .main { padding-left: 16px; padding-right: 16px; }
  .workspace-zone { font-size: 9px; }
  .quota-big { font-size: 32px; }
  .quota-row .stat-value { font-size: 17px; }
  .quota-card .card-head { align-items: flex-start; flex-direction: column; }
  .quota-card { padding: 20px; }
  .quota-foot { font-size: 10px; }
  .stat-value { font-size: 23px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media print {
  .workspace-bar, .skip-link { display: none; }
  .main { max-width: none; padding: 0; }
  .quota-month { background: white; color: black; }
}

/* Mobile-first navigation and readable workspaces — release 2. */
:root { --radius: 14px; --muted: #526b60; --font: "SF Pro Text", "PingFang SC", "Segoe UI", "Microsoft YaHei", sans-serif; }
body { font-size: 15px; }
.page-head .sub { font-size: 14px; line-height: 1.7; }
.card-head .hint, .stat-label, .stat-sub, .quota-card .badge, .quota-row .stat-label { font-size: 12px; }
.quota-notice { font-size: 12px; line-height: 1.8; }
.quota-big { font-size: clamp(32px, 3.5vw, 46px); letter-spacing: -.045em; }
.quota-big small { font-size: 12px; }
.quota-row { grid-template-columns: repeat(2,minmax(0,1fr)); }
.quota-row .stat-value { font-size: 23px; }
.quota-card .card-head { flex-direction: column; align-items: flex-start; gap: 5px; }
.quota-card .card-head h2 { font-size: 15px; }
.quota-foot { font-size: 12px; line-height: 1.8; display: grid; gap: 6px; }
.quota-foot > span:last-child { font-size: 11px; }
.progress { margin: 18px 0; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 30px !important; }
.section-heading h2 { font-size: 16px; }
.section-heading > span { color: var(--muted); font-size: 12px; }
.metrics-strip { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; gap: 0; margin-top: 12px !important; }
.metrics-strip > .card.stat { border: 0; border-radius: 0; box-shadow: none; background: transparent; padding: 22px; }
.metrics-strip > .card.stat + .card.stat { border-left: 1px solid var(--border); }
.metrics-strip .stat-value { font-size: 28px; }
.service-strip .kv dt, .service-strip .kv dd { font-size: 12px; }
.table th { font-size: 12px; }.table td { font-size: 13px; }
.input, select { height: 44px; }.btn { height: 40px; font-size: 13px; }.btn-sm { height: 34px; }
.field label, .field .hint { font-size: 13px; }
.foot { font-size: 12px; }
.mobile-header, .mobile-tabs, .mobile-records { display: none; }
.filter-panel > summary { display: flex; align-items: center; gap: 8px; cursor: pointer; min-height: 44px; list-style: none; font-size: 14px; font-weight: 600; }
.filter-panel > summary::-webkit-details-marker { display: none; }
.filter-panel > summary::after { content: '+'; margin-left: auto; font-size: 22px; font-weight: 400; }
.filter-panel[open] > summary::after { content: '−'; }
.filter-panel > summary > span { color: var(--muted); font-size: 12px; font-weight: 400; }
.filter-panel[open] > .filter-bar { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--border); }
.usage-filter { padding-top: 12px; padding-bottom: 12px; }
html { scroll-padding-top: 90px; }
@media (prefers-color-scheme: dark) { :root { --muted: #adc6b5; } }
@media (max-width: 1100px) and (min-width: 861px) {
 .metrics-strip > .card.stat:nth-child(3) { border-left: 0; }
 .metrics-strip > .card.stat:nth-child(n+3) { border-top: 1px solid var(--border); }
}
@media (max-width: 860px) {
 .sidebar { display: none; }
 .mobile-header { position: sticky; top: 0; z-index: 40; display: flex; justify-content: space-between; align-items: center; min-height: 64px; padding: calc(10px + env(safe-area-inset-top)) 18px 10px; background: var(--surface); border-bottom: 1px solid var(--border); }
 .mobile-brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-size: 18px; font-weight: 650; letter-spacing: -.03em; }
 .mobile-brand:hover { text-decoration: none; }
 .mobile-brand .brand-mark { width: 32px; min-width: 32px; height: 32px; border-radius: 9px; font-size: 20px; }
 .mobile-menu { position: relative; }
 .mobile-menu > summary { display: flex; align-items: center; gap: 7px; justify-content: center; min-width: 76px; min-height: 44px; list-style: none; color: var(--text-2); cursor: pointer; border: 1px solid var(--border); border-radius: 9px; font-size: 13px; }
 .mobile-menu > summary::-webkit-details-marker { display: none; }
 .mobile-menu[open] > summary { background: var(--brand-soft); border-color: var(--brand); }
 .mobile-menu-panel { position: absolute; right: 0; top: calc(100% + 10px); width: min(320px, calc(100vw - 36px)); max-height: calc(100dvh - 150px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); overflow-y: auto; padding: 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); box-shadow: 0 16px 40px rgba(5,25,16,.18); }
 .mobile-identity { padding: 5px 10px 14px; border-bottom: 1px solid var(--border); margin-bottom: 8px; display: flex; flex-direction: column; gap: 3px; }
 .mobile-identity span { font-size: 12px; color: var(--muted); }
 .mobile-menu-panel nav { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 4px; }
 .mobile-menu-panel a, .mobile-account button { display: flex; align-items: center; gap: 9px; min-height: 46px; padding: 10px; border-radius: 8px; color: var(--text-2); font-size: 13px; text-decoration: none; }
 .mobile-menu-panel a[aria-current="page"] { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
 .mobile-account { border-top: 1px solid var(--border); margin-top: 8px; padding-top: 8px; }
 .mobile-account form { margin: 0; }.mobile-account button { width: 100%; background: transparent; border: 0; font-family: inherit; cursor: pointer; }
 .mobile-tabs { position: fixed; bottom: 0; left: 0; right: 0; display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); z-index: 35; background: var(--surface); border-top: 1px solid var(--border); padding: 7px 8px calc(7px + env(safe-area-inset-bottom)); }
 .mobile-tabs a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 49px; color: var(--muted); font-size: 11px; text-decoration: none; border-radius: 10px; }
 .mobile-tabs a[aria-current="page"] { color: var(--brand); font-weight: 650; background: var(--brand-soft); }
 .has-mobile-tabs .main { padding-bottom: calc(90px + env(safe-area-inset-bottom)); }
 .shell { min-height: calc(100svh - 64px); }
 .workspace-bar { display: none; }
 .main { padding-top: 24px; }
 .page-head { margin-bottom: 20px; gap: 14px; }
 .page-head .sub { font-size: 13px; }
 .page-head h1 { font-size: 28px; }
 .page-actions:empty { display: none; }
 .card { padding: 20px; }.card-flush { padding: 0; }
 .quota-card .card-head { margin-bottom: 14px; }
 .quota-big { font-size: 36px; }.quota-big small { display: inline; font-size: 11px; }
 .quota-top { align-items: center; gap: 6px; }
 .quota-card .badge { font-size: 11px; }
 .quota-row .stat-value { font-size: 22px; }
 .quota-card .card-head .hint { font-size: 11px; }
 .quota-foot { margin-top: 16px; padding-top: 12px; }
 .quota-notice { font-size: 12px; }
 .grid { gap: 16px; }
 .section-heading { align-items: baseline; }.section-heading > span { font-size: 11px; }
 .metrics-strip { gap: 0; }.metrics-strip > .card.stat { padding: 18px 16px; }
 .metrics-strip > .card.stat:nth-child(3) { border-left: 0; }
 .metrics-strip > .card.stat:nth-child(n+3) { border-top: 1px solid var(--border); }
 .metrics-strip .stat-sub { font-size: 11px; }.metrics-strip .stat-label { font-size: 12px; }
 .metrics-strip .stat-value { font-size: 25px; }
 .service-strip .service-card { padding: 12px 0; }
 .service-strip .kv { grid-template-columns: 60px minmax(0,1fr); }
 .btn, .btn-sm, details.more > summary, details.rowedit > summary { min-height: 44px; }
 details.more > summary { display: flex; align-items: center; }
 .form-actions .btn { flex: 1; }
 .filter-panel > summary > span { display: none; }
 .filter-bar .field { flex-basis: calc(50% - 6px); min-width: 0; }
 .filter-bar .btns { width: 100%; }.filter-bar .btns .btn { flex: 1; }
 .desktop-records { display: none; }
 .mobile-records { display: block; }
 .usage-record { padding: 20px; border-bottom: 1px solid var(--border); }
 .usage-record:last-child { border-bottom: 0; }
 .record-title, .record-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
 .record-title strong { font-size: 15px; overflow-wrap: anywhere; min-width: 0; }
 .record-cost { font-size: 17px; font-weight: 650; white-space: nowrap; }.record-cost small { font-size: 11px; }
 .record-meta { font-size: 12px; color: var(--muted); margin: 10px 0; }
 .record-meta .badge { font-size: 11px; }
 .record-details summary { display: flex; align-items: center; gap: 6px; min-height: 44px; color: var(--brand); font-size: 12px; cursor: pointer; list-style: none; }
 .record-details summary::before { content: '+'; font-size: 18px; }.record-details[open] summary::before { content: '−'; }
 .record-details summary span { margin-left: auto; color: var(--muted); text-align: right; max-width: 65%; overflow-wrap: anywhere; }
 .record-details .kv { background: var(--surface-2); border-radius: 10px; padding: 14px; grid-template-columns: 80px minmax(0,1fr); gap: 10px; }
 .record-details .kv dt,.record-details .kv dd { font-size: 12px; margin: 0; }
 .pager { padding: 14px; }.pager .btns { width: 100%; justify-content: space-between; }
 .table-wrap { position: relative; border-top: 1px solid var(--border); }
 .doc p, .doc li { font-size: 15px; line-height: 1.85; }
 .auth-wrap { padding-top: 28px; }.auth-sub { font-size: 14px; }.auth-foot { font-size: 12px; }
}
@media (max-width: 360px) {
 .main { padding-left: 12px; padding-right: 12px; }
 .quota-card { padding: 18px; }.quota-big { font-size: 30px; }.quota-row .stat-value { font-size: 20px; }
 .quota-card .badge { padding-left: 6px; padding-right: 6px; }
 .mobile-tabs a { font-size: 10px; }.stat-sub { overflow-wrap: anywhere; }
 .record-meta { flex-wrap: wrap; }
}
@media print { .mobile-header, .mobile-tabs, .mobile-records { display: none !important; } .desktop-records { display: block; } }

@media (max-width: 860px) {
 .quota-top .badge { position: absolute; top: 20px; right: 20px; }
 .quota-big { font-size: 34px; }
 .quota-top { min-height: 46px; }
}
@media (max-width: 360px) { .quota-big { font-size: 30px; } }
