:root {
  --bg: #f6f1e7;
  --surface: #fffdf8;
  --surface-2: #fbf6ec;
  --text: #241f18;
  --muted: #756c5d;
  --faint: #9b907e;
  --line: #e7dcc8;
  --gold: #a66a00;
  --gold-deep: #825100;
  --gold-fill: #e5ad3a;
  --gold-soft: #f3e3bd;
  --on-gold: #241800;
  --success: #1c6b4d;
  --danger: #ad3345;
  --warning: #96600d;
  --serif: "Songti SC", "Noto Serif SC", "Source Han Serif SC", Georgia, serif;
  --sans: Inter, "SF Pro Display", "PingFang SC", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font: 14px/1.55 var(--sans); }
body { background-image: radial-gradient(circle at 78% 0%, #fffaf0 0, transparent 46%); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
h1, h2, h3, p { margin-top: 0; }
h1, h2 { font-family: var(--serif); font-weight: 650; letter-spacing: -.02em; }
h1 { font-size: 34px; line-height: 1.18; margin-bottom: 8px; }
h2 { font-size: 20px; margin-bottom: 12px; }
p { color: var(--muted); line-height: 1.6; }

.eyebrow { display: block; color: var(--gold); font-size: 10px; font-weight: 750; letter-spacing: .16em; margin-bottom: 8px; }
.user-cell { display:flex; align-items:center; gap:10px; min-width:230px; }
.user-avatar { width:38px; height:38px; flex:none; border-radius:50%; object-fit:cover; border:1px solid var(--line); background:var(--surface-2); }
.form-error { color: var(--danger); font-size: 12px; min-height: 18px; margin: 8px 0 0; }

/* Login */
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 32px; }
.login-card { width: min(430px, 100%); padding: 42px; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: 0 30px 90px #3a2a1018; }
.login-card h1 { font-size: 34px; margin-bottom: 8px; }
.login-card > p { font-size: 13px; margin-bottom: 28px; }
label { display: grid; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 650; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--text); padding: 10px 12px; outline: none; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px #a66a0012; }
.login-card label { margin-bottom: 15px; }
.login-card .primary { width: 100%; margin-top: 4px; }
.primary, .secondary, .ghost { min-height: 40px; border-radius: 10px; padding: 9px 16px; font-weight: 700; border: 1px solid transparent; }
.primary { background: var(--gold-fill); color: var(--on-gold); border-color: var(--gold-fill); }
.primary:hover { filter: brightness(.96); }
.secondary { background: var(--surface); border-color: var(--line); color: var(--text); }
.secondary:hover { border-color: var(--gold); color: var(--gold); }
.ghost { background: transparent; color: var(--muted); border-color: transparent; }
.ghost:hover { background: var(--surface-2); color: var(--gold); }
.primary:disabled, .secondary:disabled { opacity: .5; cursor: not-allowed; }
.text-button { border: 0; background: none; color: var(--gold); font-size: 11px; font-weight: 700; padding: 0; }

/* Shell */
.admin-shell { display: grid; grid-template-columns: 258px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 26px 18px 18px; background: linear-gradient(180deg, #fffdf8 0%, #fbf5e8 100%); border-right: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px; font-size: 18px; font-weight: 800; letter-spacing: .05em; }
.brand small { display: block; margin-top: 3px; color: var(--faint); font-size: 9px; font-weight: 650; letter-spacing: .17em; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; background: var(--gold-fill); color: var(--on-gold); font-family: var(--serif); font-size: 22px; box-shadow: 0 8px 20px #c58f241f; }
.nav { display: flex; flex-direction: column; gap: 3px; margin-top: 44px; flex: 1; overflow-y: auto; }
.nav-item { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 42px; padding: 9px 12px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); text-align: left; font-size: 13px; font-weight: 600; }
.nav-item:hover { background: #f5ecdb; color: var(--text); }
.nav-item.active { background: var(--surface); color: var(--gold-deep); box-shadow: 0 8px 22px #6b4b1212; }
.nav-index { width: 20px; flex: none; color: var(--faint); font-family: var(--serif); font-size: 11px; letter-spacing: .06em; }
.nav-item.active .nav-index { color: var(--gold); }
.nav-label { flex: 1; }
.nav-count { min-width: 20px; padding: 2px 6px; border-radius: 999px; background: var(--gold-soft); color: var(--gold-deep); font-size: 10px; text-align: center; }
.sidebar-foot { display: flex; align-items: center; gap: 9px; padding: 16px 8px 4px; border-top: 1px solid var(--line); }
.avatar { display: grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: 50%; background: var(--gold-soft); color: var(--gold-deep); font-family: var(--serif); font-weight: 700; }
.identity { min-width: 0; flex: 1; }
.identity strong, .identity small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.identity strong { font-size: 11px; }
.identity small { margin-top: 2px; color: var(--faint); font-size: 10px; }
.workspace { min-width: 0; }
.topbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; padding: 38px 44px 24px; border-bottom: 1px solid var(--line); }
.topbar h1 { margin-bottom: 0; }
.topbar-note { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
.topbar-actions { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 11px; padding-bottom: 4px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px #1c6b4d16; }
.status-dot[data-health="degraded"], .status-dot[data-health="limited"] { background: var(--warning); box-shadow: 0 0 0 4px #96600d18; }
.status-dot[data-health="down"], .status-dot[data-health="unreachable"] { background: var(--danger); box-shadow: 0 0 0 4px #ad334518; }
.status-dot[data-health="unknown"], .status-dot[data-health="checking"] { background: var(--faint); box-shadow: 0 0 0 4px #9b907e18; }
.status-link { border: 0; background: transparent; padding: 3px 2px; color: inherit; font-size: inherit; font-weight: 700; }
.status-link:hover { color: var(--gold-deep); text-decoration: underline; }
.content { padding: 30px 44px 64px; max-width: 1480px; }

/* Shared blocks */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.page-head p { font-size: 13px; margin: 0; max-width: 680px; }
.page-head .actions { display: flex; gap: 8px; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; margin-bottom: 22px; }
.metric { padding: 19px 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.metric span { display: block; color: var(--muted); font-size: 11px; }
.metric strong { display: block; margin-top: 6px; font-family: var(--serif); font-size: 28px; font-weight: 650; letter-spacing: -.03em; }
.metric small { display: block; margin-top: 4px; color: var(--faint); font-size: 10px; }
.panel { margin-bottom: 18px; padding: 22px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.panel-head h2 { margin: 0; }
.panel-head p { margin: 4px 0 0; font-size: 12px; }
.panel-grid { display: grid; grid-template-columns: 1.25fr 1fr; gap: 18px; }
.ops-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 20px; padding: 20px 24px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.ops-head h2 { display: flex; align-items: center; gap: 10px; margin: 0 0 7px; }
.ops-head p { margin: 0; font-size: 12px; }
.ops-resource { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.ops-resource > div { min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); font-size: 11px; }
.ops-resource strong, .ops-resource small { display: block; color: var(--text); }
.ops-resource strong { font-size: 22px; line-height: 1.2; margin: 7px 0; }
.ops-resource small { color: var(--faint); }
.ops-trend { display: block; width: 100%; height: 38px; margin-top: 8px; }
.ops-trend polyline { fill: none; stroke: var(--gold); stroke-width: 1.4; vector-effect: non-scaling-stroke; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { padding: 9px 10px; border-bottom: 1px solid var(--line); color: var(--faint); font-size: 10px; font-weight: 700; letter-spacing: .08em; text-align: left; text-transform: uppercase; white-space: nowrap; }
td { padding: 12px 10px; border-bottom: 1px solid #f0e8d9; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fdf9f1; }
.cell-main { font-weight: 650; }
.cell-sub { display: block; margin-top: 3px; color: var(--faint); font-size: 10px; }
.badge { display: inline-flex; align-items: center; padding: 3px 8px; border-radius: 999px; background: #f1ebdf; color: var(--muted); font-size: 10px; font-weight: 700; white-space: nowrap; }
.badge.success { background: #e8f3ed; color: var(--success); }
.badge.warning { background: #f8efd9; color: var(--warning); }
.badge.danger { background: #f8e7e9; color: var(--danger); }
.badge.gold { background: var(--gold-soft); color: var(--gold-deep); }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.row-actions button, .mini { min-height: 28px; padding: 4px 9px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--text); font-size: 10px; font-weight: 650; }
.row-actions button:hover, .mini:hover { border-color: var(--gold); color: var(--gold); }
.row-actions .danger:hover { border-color: var(--danger); color: var(--danger); }
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar input { width: min(310px, 100%); min-height: 36px; }
.toolbar .spacer { flex: 1; }
.tabs { display: flex; gap: 5px; margin-bottom: 18px; padding: 4px; border-radius: 11px; background: var(--surface-2); width: fit-content; }
.tabs button { min-height: 32px; padding: 6px 13px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 11px; font-weight: 650; }
.tabs button.active { background: var(--surface); color: var(--gold-deep); box-shadow: 0 2px 8px #6b4b1214; }
.empty { padding: 50px 20px; border: 1px dashed var(--line); border-radius: 14px; text-align: center; color: var(--muted); }
.skeleton { min-height: 180px; border-radius: 14px; background: linear-gradient(90deg, #f6efe3, #fbf7ef, #f6efe3); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Showcase */
.showcase-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; }
.showcase-card { overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.showcase-card img { display: block; width: 100%; aspect-ratio: 4/3; object-fit: cover; background: #eee; }
.showcase-body { padding: 14px; }
.showcase-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.showcase-body h3 { margin: 8px 0 4px; font-size: 14px; }
.showcase-body p { margin: 0; font-size: 11px; min-height: 17px; }
.upload-preview { display: flex; flex-direction: column; justify-content: center; gap: 8px; min-height: 260px; padding: 12px; border: 1px dashed var(--line); border-radius: 11px; background: var(--surface-2); color: var(--muted); font-size: 12px; text-align: center; }
.upload-preview img { width: 100%; max-height: 300px; object-fit: contain; border-radius: 8px; }
.form-grid { display: grid; gap: 12px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* AI cards */
.provider-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.provider-card { padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.provider-card h3 { margin: 8px 0 4px; font-size: 16px; }
.provider-card p { margin: 0; font-size: 11px; word-break: break-all; }
.provider-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }

/* Modal */
.modal { width: min(780px, 92vw); max-height: 92vh; border: 0; border-radius: 18px; padding: 0; background: var(--surface); box-shadow: 0 35px 110px #2b1d0b3d; }
.modal::backdrop { background: #2b1d0b66; backdrop-filter: blur(3px); }
.modal-inner { padding: 24px; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.modal-head h2 { margin: 0; }
.modal-close { border: 0; background: none; color: var(--muted); font-size: 24px; line-height: 1; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.modal .form-grid { max-height: 62vh; overflow-y: auto; padding-right: 4px; }
.modal-upload { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 50; padding: 12px 17px; border-radius: 10px; background: var(--text); color: #fff; font-size: 12px; box-shadow: 0 14px 40px #0003; }

@media (max-width: 1100px) {
  .admin-shell { grid-template-columns: 78px minmax(0, 1fr); }
  .brand > span:last-child, .nav-label, .nav-count, .identity, .sidebar-foot .text-button { display: none; }
  .sidebar { padding: 22px 12px; }
  .brand { justify-content: center; padding: 0; }
  .nav-item { justify-content: center; padding: 9px; }
  .nav-index { width: auto; }
  .sidebar-foot { justify-content: center; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panel-grid, .provider-grid { grid-template-columns: 1fr; }
  .showcase-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .admin-shell { display: block; }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; padding: 12px 16px; overflow-x: auto; }
  .brand { display: none; }
  .nav { flex-direction: row; margin: 0; flex: 1; overflow: visible; }
  .nav-item { width: auto; min-height: 34px; }
  .nav-item .nav-label { display: block; white-space: nowrap; }
  .nav-item .nav-index { display: none; }
  .sidebar-foot { display: none; }
  .topbar { align-items: flex-start; flex-direction: column; padding: 24px 20px 18px; }
  .content { padding: 22px 20px 50px; }
  .metrics, .showcase-grid, .form-row, .modal-upload { grid-template-columns: 1fr; }
  h1 { font-size: 27px; }
}
.model-section-title{margin:22px 0 10px;font-family:var(--serif);font-size:17px}
.model-section-title:first-of-type{margin-top:6px}

/* User activity */
.modal:has(.activity-modal) { width: min(1080px, 94vw); }
.activity-modal { display: flex; flex-direction: column; max-height: 90vh; padding: 0; }
.activity-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 22px 24px 14px; border-bottom: 1px solid var(--line); }
.activity-head h2 { margin: 2px 0 3px; }
.activity-head p { margin: 0; font-size: 11px; }
.activity-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; padding: 14px 24px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.activity-summary div { display: grid; gap: 2px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); }
.activity-summary small { color: var(--muted); font-size: 10px; }
.activity-summary strong { color: var(--gold-deep); font-family: var(--serif); font-size: 21px; font-weight: 500; }
.activity-summary span { color: var(--faint); font-size: 10px; }
.activity-body { overflow-y: auto; padding: 4px 24px 10px; scrollbar-width: thin; }
.activity-section { padding-top: 12px; }
.activity-section h3 { margin: 4px 0 8px; font-size: 13px; }
.activity-section .table-wrap { max-height: 220px; overflow: auto; border: 1px solid var(--line); border-radius: 9px; }
.activity-section table { min-width: 760px; }
.activity-section th { position: sticky; top: 0; z-index: 1; }
.activity-section .muted { padding: 18px; text-align: center; }
.activity-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 24px; border-top: 1px solid var(--line); }
.activity-loading { padding: 40px 24px; color: var(--muted); text-align: center; font-size: 12px; }
.ip { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }
.ua { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--faint); font-size: 10px; }
.negative { color: var(--danger); font-variant-numeric: tabular-nums; }
.positive { color: var(--success); font-variant-numeric: tabular-nums; }
@media (max-width: 760px) {
  .ops-head { align-items: flex-start; flex-direction: column; }
  .ops-resource { grid-template-columns: 1fr; }
  .activity-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .activity-head, .activity-summary, .activity-body, .activity-actions { padding-left: 14px; padding-right: 14px; }
}

/* AI Studio 概览告警 */
.alert-row { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid rgba(0,0,0,.08); }
.alert-row:last-child { border-bottom: none; }
.alert-row .badge { flex: 0 0 auto; }
.model-health-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(200px,1fr));gap:10px}.model-health{display:flex;flex-direction:column;align-items:flex-start;gap:4px;padding:12px;border:1px solid var(--line);border-left:4px solid var(--success);border-radius:10px;background:var(--surface);text-align:left;cursor:pointer;color:var(--text)}.model-health.warning{border-left-color:var(--warning)}.model-health.danger{border-left-color:var(--danger)}.model-health small{color:var(--muted);font-size:11px}.model-health em{font-style:normal;font-size:11px;font-weight:600;color:var(--danger)}.model-health.warning em{color:var(--warning)}
.sub-tabs button small{color:var(--muted);margin-left:2px}
.purpose-checks{display:flex;flex-wrap:wrap;gap:6px 12px;margin:8px 0}.purpose-checks label{display:flex;align-items:center;gap:4px;font-size:12px;font-weight:500}.purpose-checks.compact{gap:4px 8px;max-width:340px}
.more-menu{position:relative}.more-menu summary{list-style:none;cursor:pointer;padding:5px 9px;border:1px solid var(--line);border-radius:7px;font-size:12px}.more-menu[open] div{position:absolute;right:0;top:calc(100% + 4px);z-index:20;display:grid;min-width:150px;padding:6px;border:1px solid var(--line);border-radius:10px;background:var(--surface);box-shadow:0 10px 30px #0002}.more-menu div button{text-align:left;border:0;background:none;padding:7px 8px;border-radius:6px}.more-menu div button:hover{background:var(--gold-soft)}
.log-filters{display:flex;gap:8px;flex-wrap:wrap}.log-summary{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;margin:12px 0}.log-summary h3{font-size:12px;margin:0 0 6px;color:var(--muted)}.log-chip{display:inline-flex;gap:4px;margin:0 6px 6px 0;padding:4px 8px;border:1px solid var(--line);border-radius:999px;background:var(--surface);font-size:12px;cursor:pointer}.log-chip.bad{border-color:var(--danger);color:var(--danger)}
.alert-row .spacer{flex:1}.test-results p{margin:4px 0;font-size:13px}.discover-modal{width:min(1100px,96vw)}.discover-modal input[name=display],.discover-modal input[name=logical]{display:block;width:180px;margin:2px 0}
@media (max-width:900px){.log-summary{grid-template-columns:1fr}}

/* ===== 2026-10 visual refresh =====
   Calmer warm-neutral palette, sans-serif data, a dark grouped sidebar,
   consistent 8px rhythm, and light motion. Overrides the rules above. */
:root {
  --bg: #f5f3ee;
  --surface: #ffffff;
  --surface-2: #f8f6f1;
  --surface-3: #f1ede4;
  --text: #1f1c17;
  --muted: #6b6457;
  --faint: #9a9284;
  --line: #e9e4d9;
  --line-strong: #dcd5c6;
  --gold: #a46a06;
  --gold-deep: #7d5003;
  --gold-fill: #e3a93a;
  --gold-soft: #f7ecd3;
  --on-gold: #2a1c02;
  --success: #17795a;
  --success-soft: #e4f3ec;
  --danger: #c0384c;
  --danger-soft: #fbe9ec;
  --warning: #a7650c;
  --warning-soft: #fbf0dc;
  --info: #3b62c4;
  --info-soft: #e9eefb;
  --side: #1d1a16;
  --side-2: #2a2620;
  --side-text: #c9c0b0;
  --side-faint: #8a8172;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow-1: 0 1px 2px rgba(31, 28, 23, .05), 0 1px 1px rgba(31, 28, 23, .03);
  --shadow-2: 0 10px 30px rgba(31, 28, 23, .08);
  --shadow-3: 0 30px 80px rgba(31, 28, 23, .22);
  --ease: cubic-bezier(.2, .7, .2, 1);
}
html, body { font: 14px/1.55 var(--sans); -webkit-font-smoothing: antialiased; }
body { background: var(--bg); background-image: none; }
h1, h2 { font-family: var(--sans); letter-spacing: -.01em; }
h1 { font-size: 24px; font-weight: 650; }
h2 { font-size: 16px; font-weight: 650; }
h3 { font-size: 14px; font-weight: 650; }
p { color: var(--muted); }
::selection { background: var(--gold-soft); }
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }

/* Login */
.login-shell { background: radial-gradient(1200px 600px at 10% -10%, #fbefd6 0, transparent 60%), radial-gradient(900px 500px at 110% 110%, #efe6d4 0, transparent 60%), var(--bg); }
.login-card { padding: 40px; border-radius: 20px; box-shadow: var(--shadow-3); animation: rise .5s var(--ease); }
.login-card h1 { font-size: 26px; }

/* Controls */
label { color: var(--muted); font-size: 12px; font-weight: 600; }
input, select, textarea { min-height: 38px; border-color: var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); transition: border-color .15s, box-shadow .15s, background .15s; }
input:hover, select:hover, textarea:hover { border-color: #cfc6b4; }
input:focus, select:focus, textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(164, 106, 6, .12); }
input[type=checkbox] { width: 16px; height: 16px; min-height: 0; accent-color: var(--gold); }
.primary, .secondary, .ghost { min-height: 36px; padding: 7px 14px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; transition: transform .12s var(--ease), box-shadow .15s, background .15s, border-color .15s, color .15s; }
.primary { background: var(--text); border-color: var(--text); color: #fff; box-shadow: var(--shadow-1); }
.primary:hover { filter: none; background: #34302a; transform: translateY(-1px); box-shadow: var(--shadow-2); }
.primary:active, .secondary:active { transform: translateY(0); }
.secondary { box-shadow: var(--shadow-1); }
.secondary:hover { border-color: var(--line-strong); color: var(--text); background: var(--surface-2); }
.login-card .primary { background: var(--gold-fill); border-color: var(--gold-fill); color: var(--on-gold); }
.row-actions button, .mini { min-height: 28px; padding: 4px 10px; border-color: var(--line); border-radius: 8px; font-size: 12px; font-weight: 600; transition: background .15s, border-color .15s, color .15s; }
.row-actions button:hover, .mini:hover { background: var(--surface-2); border-color: var(--line-strong); color: var(--text); }
.row-actions .danger, .more-menu .danger { color: var(--danger); }

/* Shell */
.admin-shell { grid-template-columns: 236px minmax(0, 1fr); }
.sidebar { padding: 18px 12px 14px; background: var(--side); border-right: 0; color: var(--side-text); }
.brand { padding: 4px 10px 0; color: #fff; font-size: 16px; letter-spacing: .06em; }
.brand small { color: var(--side-faint); letter-spacing: .14em; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; font-size: 19px; box-shadow: 0 6px 18px rgba(227, 169, 58, .25); }
.nav { gap: 1px; margin-top: 22px; padding-right: 2px; }
.nav-group { margin: 16px 10px 6px; color: var(--side-faint); font-size: 11px; font-weight: 600; letter-spacing: .08em; }
.nav-group:first-child { margin-top: 4px; }
.nav-item { position: relative; gap: 10px; min-height: 36px; padding: 7px 10px; border-radius: 9px; color: var(--side-text); font-size: 13px; font-weight: 500; transition: background .15s, color .15s; }
.nav-item .icon { width: 17px; height: 17px; flex: none; opacity: .8; }
.nav-item:hover { background: var(--side-2); color: #fff; }
.nav-item.active { background: rgba(227, 169, 58, .14); color: #f5d79a; box-shadow: none; }
.nav-item.active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--gold-fill); }
.nav-item.active .icon { opacity: 1; }
.nav-count { background: var(--side-2); color: #f5d79a; }
.sidebar-foot { border-top-color: var(--side-2); }
.sidebar-foot .identity strong { color: #fff; }
.sidebar-foot .avatar { background: var(--side-2); color: #f5d79a; }
.sidebar-foot .text-button { color: var(--side-faint); }
.sidebar-foot .text-button:hover { color: #fff; }

.topbar { position: sticky; top: 0; z-index: 10; align-items: center; padding: 12px 32px; background: rgba(245, 243, 238, .82); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.crumbs { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--faint); }
.crumbs strong { color: var(--text); font-weight: 600; }
.crumb-sep { color: var(--line-strong); }
.topbar-actions { padding: 0; gap: 10px; font-size: 12px; }
.status-link { display: inline-flex; align-items: center; padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-weight: 600; }
.status-link:hover { text-decoration: none; border-color: var(--line-strong); }
#refresh { min-height: 30px; padding: 4px 12px; font-size: 12px; }
.content { padding: 26px 32px 64px; max-width: 1440px; animation: fade .25s var(--ease); }

/* Page head */
.page-head { align-items: flex-end; margin-bottom: 20px; }
.page-head h1 { margin-bottom: 4px; }
.page-head p { font-size: 13px; }

/* Metrics */
.metrics { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 18px; }
.metric { position: relative; padding: 16px 18px; border-radius: var(--radius); box-shadow: var(--shadow-1); transition: transform .18s var(--ease), box-shadow .18s; overflow: hidden; }
.metric::after { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: linear-gradient(90deg, var(--gold-fill), transparent); opacity: .55; }
.metric:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
.metric span { font-size: 12px; font-weight: 500; }
.metric strong { margin-top: 6px; font-family: var(--sans); font-size: 26px; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.metric small { font-size: 11px; }

/* Panels */
.panel, .ops-head { padding: 0; border-radius: var(--radius); box-shadow: var(--shadow-1); }
.panel { overflow: visible; }
.panel-head { margin: 0; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.panel-head h2 { font-size: 15px; }
.panel-head p { font-size: 12px; }
.panel > :not(.panel-head) { margin-left: 20px; margin-right: 20px; }
.panel > :last-child { margin-bottom: 18px; }
.panel > .panel-head + * { margin-top: 14px; }
.panel > .table-wrap { margin-left: 0; margin-right: 0; }
.panel > .table-wrap:last-child { margin-bottom: 0; }
.ops-head { padding: 18px 20px; }
.panel-grid { gap: 16px; }

/* Tables */
.table-wrap { border-radius: 0 0 var(--radius) var(--radius); }
table { font-size: 13px; }
th { padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: 0; text-transform: none; }
td { padding: 12px 14px; border-bottom-color: #f1ede5; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: #fbf9f4; }
td:first-child, th:first-child { padding-left: 20px; }
td:last-child, th:last-child { padding-right: 20px; }
.cell-main { font-weight: 600; }
.cell-sub { font-size: 12px; }
.table-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }

/* Badges: soft fill with a status dot */
.badge { gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; background: var(--surface-3); }
.badge.success::before, .badge.warning::before, .badge.danger::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.success { background: var(--success-soft); }
.badge.warning { background: var(--warning-soft); }
.badge.danger { background: var(--danger-soft); }

/* Tabs: page-level underline, filters stay segmented */
.tabs { gap: 2px; margin-bottom: 16px; padding: 3px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); box-shadow: var(--shadow-1); }
.tabs button { min-height: 30px; padding: 5px 14px; font-size: 13px; font-weight: 500; transition: background .15s, color .15s; }
.tabs button:hover { color: var(--text); }
.tabs button.active { background: var(--text); color: #fff; box-shadow: none; }
.sub-tabs { box-shadow: none; background: var(--surface-2); flex-wrap: wrap; }
.sub-tabs button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); }
.sub-tabs button.active small { color: var(--muted); }

.toolbar input { min-height: 34px; padding-left: 34px; background: var(--surface) url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="none" stroke="%239a9284" stroke-width="2" stroke-linecap="round"><circle cx="7" cy="7" r="5"/><path d="M11 11l3.5 3.5"/></svg>') no-repeat 11px center; }
.log-filters input, .log-filters select { min-height: 34px; width: auto; padding-left: 12px; background-image: none; }
.empty { padding: 44px 20px; border-color: var(--line-strong); border-radius: var(--radius); background: var(--surface-2); }
.skeleton { border-radius: var(--radius); background: linear-gradient(90deg, #efebe2, #f8f6f1, #efebe2); background-size: 200% 100%; }

/* Alerts and health cards */
.alert-row { align-items: center; padding: 12px 20px; margin: 0 !important; border-bottom: 1px solid var(--line); font-size: 13px; transition: background .12s; }
.alert-row:hover { background: var(--surface-2); }
.model-health { border-radius: 12px; box-shadow: var(--shadow-1); transition: transform .18s var(--ease), box-shadow .18s; }
.model-health:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
.model-health strong { font-size: 13px; }

/* Showcase, provider cards */
.showcase-card, .provider-card { border-radius: var(--radius); box-shadow: var(--shadow-1); transition: transform .18s var(--ease), box-shadow .18s; }
.showcase-card:hover, .provider-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }

/* Dialogs */
.modal { border-radius: 18px; box-shadow: var(--shadow-3); }
.modal[open] { animation: pop .22s var(--ease); }
.modal::backdrop { background: rgba(24, 20, 14, .45); backdrop-filter: blur(4px); animation: fade .2s; }
.modal-inner { padding: 22px 24px; }
.modal-head { padding-bottom: 14px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 18px; }
.modal-close { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; font-size: 20px; transition: background .15s; }
.modal-close:hover { background: var(--surface-3); color: var(--text); }
.activity-head { padding: 20px 24px 14px; }
.activity-actions { background: var(--surface-2); border-radius: 0 0 18px 18px; }
.activity-section .table-wrap { border-radius: var(--radius-sm); }
.activity-summary strong { font-family: var(--sans); font-weight: 650; }

/* Toast */
.toast { display: flex; align-items: center; gap: 8px; padding: 11px 16px; border-radius: 12px; background: #1f1c17; font-size: 13px; animation: slide .25s var(--ease); }
.toast::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--gold-fill); }

/* More menu and endpoint form */
.more-menu summary { min-height: 28px; display: inline-flex; align-items: center; padding: 4px 10px; border-color: var(--line); border-radius: 8px; font-weight: 600; transition: background .15s; }
.more-menu summary::-webkit-details-marker { display: none; }
.more-menu summary:hover { background: var(--surface-2); }
.more-menu[open] div { animation: pop .15s var(--ease); border-radius: 12px; box-shadow: var(--shadow-2); }
.endpoint-fields { display: grid; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.endpoint-note { margin: 0; font-size: 12px; }
.crumbs + .topbar-actions { margin-left: auto; }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes slide { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

@media (max-width: 1100px) {
  .admin-shell { grid-template-columns: 68px minmax(0, 1fr); }
  .nav-group { height: 1px; margin: 10px 8px; overflow: hidden; color: transparent; background: var(--side-2); }
  .nav-item { justify-content: center; }
  .nav-item.active::before { left: -12px; }
  .topbar, .content { padding-left: 22px; padding-right: 22px; }
}
@media (max-width: 760px) {
  .sidebar { background: var(--side); }
  .nav-group { display: none; }
  .nav-item .icon { display: none; }
  .nav-item.active::before { display: none; }
  .topbar { flex-direction: row; padding: 10px 16px; }
  .content { padding: 18px 16px 48px; }
  .panel-head { flex-wrap: wrap; }
}

/* Dark theme: app.js sets data-theme from the 主题 setting (跟随系统 resolves to the OS choice) */
:root[data-theme="dark"] {
    --bg: #141310; --surface: #1c1a16; --surface-2: #221f1a; --surface-3: #2a2620;
    --text: #f2ede3; --muted: #b3aa9a; --faint: #8a8172; --line: #2e2a23; --line-strong: #3b362d;
    --gold: #e7b75a; --gold-deep: #f0c674; --gold-soft: #3a2f1a;
    --success: #4fca97; --success-soft: #16302a; --danger: #ff7b8b; --danger-soft: #3a1d22; --warning: #e9b158; --warning-soft: #33281a; --info: #8aa7ff; --info-soft: #1d2540;
    --side: #0f0e0b; --side-2: #1f1c17;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .3); --shadow-2: 0 10px 30px rgba(0, 0, 0, .35); --shadow-3: 0 30px 80px rgba(0, 0, 0, .55);
  }
:root[data-theme="dark"] .topbar { background: rgba(20, 19, 16, .82); }
:root[data-theme="dark"] input, :root[data-theme="dark"] select, :root[data-theme="dark"] textarea { background: var(--surface-2); color: var(--text); }
:root[data-theme="dark"] tbody tr:hover, :root[data-theme="dark"] .alert-row:hover { background: var(--surface-2); }
:root[data-theme="dark"] td { border-bottom-color: var(--line); }
:root[data-theme="dark"] .primary { background: var(--gold-fill); border-color: var(--gold-fill); color: var(--on-gold); }
:root[data-theme="dark"] .primary:hover { background: #efbb52; }
:root[data-theme="dark"] .tabs button.active { background: var(--gold-fill); color: var(--on-gold); }
:root[data-theme="dark"] .sub-tabs button.active { background: var(--surface-3); color: var(--text); }
:root[data-theme="dark"] .toast { background: var(--surface-3); color: var(--text); }
:root[data-theme="dark"] .login-shell { background: var(--bg); }
:root[data-theme="dark"] .skeleton { background: linear-gradient(90deg, #1f1c17, #2a2620, #1f1c17); background-size: 200% 100%; }

.metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.panel-grid td, .activity-section td { white-space: nowrap; }
.panel-grid .table-wrap { overflow-x: auto; }
@media (max-width: 1100px) { .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) { .metrics { grid-template-columns: 1fr; } }
td .row-actions { flex-wrap: nowrap; }
td .badge { white-space: nowrap; }
.log-filters select { width: auto; min-width: 110px; max-width: 220px; }
.log-filters input { width: 140px; }

/* Theme switcher */
.theme-switch { display: inline-flex; gap: 2px; padding: 2px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.theme-switch button { display: grid; place-items: center; width: 28px; height: 24px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); transition: background .15s, color .15s; }
.theme-switch button:hover { color: var(--text); }
.theme-switch button.active { background: var(--text); color: var(--surface); }
.theme-switch .icon { width: 14px; height: 14px; }
:root[data-theme="dark"] .theme-switch button.active { background: var(--gold-fill); color: var(--on-gold); }
:root[data-theme="dark"] { color-scheme: dark; }
.io { display: inline-block; padding: 2px 8px; border-radius: 6px; background: var(--surface-3); font-size: 12px; white-space: nowrap; }
.purpose-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin: 8px 0; }
.purpose-group { margin: 0; padding: 8px 10px 10px; border: 1px solid var(--line); border-radius: 10px; }
.purpose-group legend { padding: 0 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
.purpose-group label { display: flex; align-items: center; gap: 6px; padding: 3px 0; font-size: 13px; font-weight: 500; color: var(--text); }
.purpose-group label small { margin-left: auto; color: var(--faint); font-size: 11px; }
.field-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px; }
.io-preview { margin: 0; font-weight: 600; color: var(--text); }
.purpose-pick summary { cursor: pointer; font-size: 12px; color: var(--text); }
.purpose-pick[open] .purpose-checks { margin-top: 6px; }
/* Page-level additions */
.danger-button { min-height: 36px; padding: 7px 14px; border: 1px solid var(--danger); border-radius: var(--radius-sm); background: var(--danger); color: #fff; font-weight: 600; }
.danger-button:hover { filter: brightness(.95); }
.confirm-modal { width: min(440px, 92vw); }
.confirm-inner { display: grid; grid-template-columns: auto 1fr; gap: 14px 16px; padding: 22px 24px; }
.confirm-inner h2 { margin: 2px 0 6px; font-size: 16px; }
.confirm-inner p { margin: 0; font-size: 13px; }
.confirm-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--warning-soft); color: var(--warning); font-weight: 800; }
.confirm-icon.danger { background: var(--danger-soft); color: var(--danger); }
.confirm-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.search-input { width: min(300px, 100%); min-height: 34px; padding-left: 34px; background: var(--surface) url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="none" stroke="%239a9284" stroke-width="2" stroke-linecap="round"><circle cx="7" cy="7" r="5"/><path d="M11 11l3.5 3.5"/></svg>') no-repeat 11px center; }
.panel-head .sub-tabs { flex-wrap: wrap; }
.code-list { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; align-items: center; padding: 4px 0 14px; }
.code-list .log-chip { margin: 0; justify-self: start; }
.code-help { font-size: 12px; color: var(--muted); }
.hero-metrics .metric strong { font-size: 28px; }
.rate-cell { display: flex; align-items: center; gap: 10px; min-width: 160px; }
.rate { flex: 1; height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.rate span { display: block; height: 100%; border-radius: 999px; background: var(--success); transition: width .4s var(--ease); }
.rate span.warn { background: var(--warning); }
.rate span.bad { background: var(--danger); }
.rate-label { width: 48px; text-align: right; font-variant-numeric: tabular-nums; font-size: 12px; }
.appearance-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.appearance-option { display: grid; justify-items: start; gap: 4px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text); text-align: left; transition: border-color .15s, box-shadow .15s; }
.appearance-option .icon { width: 20px; height: 20px; color: var(--muted); }
.appearance-option small { color: var(--muted); font-size: 12px; }
.appearance-option:hover { border-color: var(--line-strong); }
.appearance-option.active { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(164, 106, 6, .15); }
.appearance-option.active .icon { color: var(--gold); }
@media (max-width: 760px) { .appearance-options { grid-template-columns: 1fr; } .code-list { grid-template-columns: 1fr; } }

/* ===== Login: split layout ===== */
.login-shell { display: grid; grid-template-columns: minmax(380px, 46%) 1fr; place-items: stretch; min-height: 100vh; padding: 0; background: var(--bg); }
.login-brand { position: relative; display: flex; flex-direction: column; justify-content: space-between; gap: 40px; padding: 40px 48px; overflow: hidden; color: #efe7d8; background: radial-gradient(900px 520px at -10% -10%, rgba(227, 169, 58, .28), transparent 60%), radial-gradient(700px 420px at 110% 110%, rgba(164, 106, 6, .22), transparent 60%), #17140f; }
.login-brand::after { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(255, 255, 255, .035) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .035) 1px, transparent 1px); background-size: 44px 44px; mask-image: radial-gradient(ellipse at 30% 40%, #000 20%, transparent 75%); pointer-events: none; }
.login-brand > * { position: relative; z-index: 1; }
.login-brand-top { display: flex; align-items: center; gap: 12px; }
.login-wordmark { font-size: 16px; font-weight: 800; letter-spacing: .08em; color: #fff; }
.login-wordmark small { display: block; margin-top: 2px; color: #a59a87; font-size: 9px; font-weight: 600; letter-spacing: .18em; }
.login-brand-body { max-width: 440px; animation: rise .6s var(--ease); }
.login-brand h2 { margin: 0 0 12px; color: #fff; font-size: clamp(30px, 3.2vw, 42px); line-height: 1.15; font-weight: 700; letter-spacing: -.02em; }
.login-brand-body > p { margin: 0 0 32px; color: #c4b9a5; font-size: 15px; }
.login-points { display: grid; gap: 14px; margin: 0; padding: 0; list-style: none; }
.login-points li { display: flex; gap: 14px; align-items: flex-start; padding: 14px 16px; border: 1px solid rgba(255, 255, 255, .08); border-radius: 14px; background: rgba(255, 255, 255, .03); backdrop-filter: blur(6px); transition: border-color .2s, background .2s, transform .2s var(--ease); }
.login-points li:hover { border-color: rgba(227, 169, 58, .35); background: rgba(227, 169, 58, .06); transform: translateX(4px); }
.login-points span { color: var(--gold-fill); font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; padding-top: 2px; }
.login-points strong { display: block; color: #fff; font-size: 14px; font-weight: 600; }
.login-points small { display: block; margin-top: 2px; color: #a59a87; font-size: 12px; }
.login-brand-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: #8f8573; font-size: 12px; }
.login-status { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border: 1px solid rgba(255, 255, 255, .1); border-radius: 999px; background: rgba(0, 0, 0, .2); color: #d8cfbf; }
.login-status i { width: 8px; height: 8px; border-radius: 50%; background: #8f8573; }
.login-status[data-state="checking"] i { animation: blink 1.2s infinite; }
.login-status[data-state="ok"] i { background: #4fca97; box-shadow: 0 0 0 4px rgba(79, 202, 151, .18); }
.login-status[data-state="down"] i { background: #ff7b8b; box-shadow: 0 0 0 4px rgba(255, 123, 139, .18); }
.login-main { position: relative; display: grid; place-items: center; align-content: center; gap: 18px; padding: 48px 24px; }
.login-theme { position: absolute; top: 20px; right: 24px; }
.login-card { width: min(400px, 100%); display: grid; gap: 0; padding: 0; border: 0; background: transparent; box-shadow: none; animation: rise .5s var(--ease); }
.login-card .eyebrow { margin-bottom: 10px; }
.login-card h1 { margin: 0 0 6px; font-size: 28px; font-weight: 700; }
.login-sub { margin: 0 0 26px; font-size: 14px; }
.login-card > label, .label-row label { margin: 0 0 7px; color: var(--text); font-size: 13px; font-weight: 600; }
.login-card > input, .password-field { margin-bottom: 16px; }
.login-card input { min-height: 44px; padding: 10px 14px; font-size: 14px; border-radius: 10px; }
.login-card input.invalid { border-color: var(--danger); box-shadow: 0 0 0 4px rgba(192, 56, 76, .12); }
.label-row { display: flex; align-items: center; justify-content: space-between; }
.caps-hint { padding: 2px 8px; border-radius: 999px; background: var(--warning-soft); color: var(--warning); font-size: 11px; font-weight: 600; margin-bottom: 7px; }
.password-field { position: relative; }
.password-field input { padding-right: 64px; }
.password-toggle { position: absolute; top: 50%; right: 6px; transform: translateY(-50%); min-height: 30px; padding: 4px 10px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 600; }
.password-toggle:hover { background: var(--surface-3); color: var(--text); }
.login-options { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: -2px 0 6px; font-size: 12px; }
.login-options .check { display: inline-flex; align-items: center; gap: 7px; margin: 0; color: var(--muted); font-size: 12px; font-weight: 500; cursor: pointer; }
.login-options .muted { font-size: 12px; }
.login-error { min-height: 20px; margin: 6px 0 10px; }
.login-card .login-submit { width: 100%; min-height: 46px; margin: 0; border-radius: 11px; font-size: 15px; background: var(--text); border-color: var(--text); color: var(--surface); }
.login-card .login-submit:hover { background: #34302a; }
.login-advanced { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }
.login-advanced summary { display: flex; align-items: center; justify-content: space-between; cursor: pointer; list-style: none; color: var(--muted); font-size: 13px; font-weight: 600; }
.login-advanced summary::-webkit-details-marker { display: none; }
.login-advanced summary::after { content: "›"; margin-left: 8px; transition: transform .2s; }
.login-advanced[open] summary::after { transform: rotate(90deg); }
.login-advanced #apiHostLabel { margin-left: auto; color: var(--faint); font-weight: 500; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.login-advanced label { margin: 14px 0 7px; color: var(--text); font-size: 13px; }
.login-advanced small { display: block; margin-top: 8px; font-size: 12px; }
.login-legal { margin: 0; color: var(--faint); font-size: 12px; }
.shake { animation: shake .4s var(--ease); }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
@keyframes blink { 50% { opacity: .35; } }
:root[data-theme="dark"] .login-card .login-submit { background: var(--gold-fill); border-color: var(--gold-fill); color: var(--on-gold); }
:root[data-theme="dark"] .login-card .login-submit:hover { background: #efbb52; }
@media (max-width: 900px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-brand { padding: 22px 24px; gap: 0; }
  .login-brand-body, .login-brand-foot { display: none; }
  .login-main { place-items: start center; padding: 36px 20px 40px; }
  .login-theme { top: -50px; right: 20px; }
}
.login-error:empty { min-height: 0; margin: 10px 0; }
.showcase-card { position: relative; } .showcase-pick { position: absolute; top: 8px; left: 8px; z-index: 1; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: color-mix(in srgb, var(--surface) 85%, transparent); } .showcase-top { flex-wrap: wrap; gap: 4px; }

/* Keep model actions legible; narrow viewports scroll within the table. */
.model-catalog-table { max-width: 100%; overflow-x: auto; }
.model-catalog-table table { min-width: 1450px; }
.model-catalog-table th:last-child,
.model-catalog-table td:last-child { min-width: 190px; white-space: nowrap; }
.model-catalog-table .row-actions { flex-wrap: nowrap; }
.model-catalog-table .row-actions button { flex-shrink: 0; white-space: nowrap; }

/* C3: warm sidebar and always reachable model actions. */
:root:not([data-theme="dark"]) .sidebar { background:#FBFAF6; border-right:1px solid #E4DED2; color:#5E594F; }
:root:not([data-theme="dark"]) .nav-item { color:#5E594F; }
:root:not([data-theme="dark"]) .nav-item:hover { background:#F3EEDF; color:#403b33; }
:root:not([data-theme="dark"]) .nav-item.active { background:#fff; border:1px solid #E4DED2; color:#403b33; }
.nav-item.active { position:relative; }
.nav-item.active::before { content:""; position:absolute; width:6px; height:6px; border-radius:50%; left:5px; top:calc(50% - 3px); background:#D69B20; }
:root:not([data-theme="dark"]) .sidebar small,
:root:not([data-theme="dark"]) .sidebar .nav-group { color:#655e52; }
:root[data-theme="dark"] .sidebar { background:var(--surface); border-right:1px solid var(--line); }
.brand span { color:#9b6b09; }
.model-catalog-table th:last-child,.model-catalog-table td:last-child { position:sticky; right:0; z-index:2; background:var(--surface); box-shadow:-5px 0 9px #00000008; width:190px; }
.model-catalog-table th:last-child { z-index:3; }

.content {position:relative;isolation:isolate;}
.content::before,.content::after {content:"";position:absolute;inset:0;pointer-events:none;z-index:-1;}
.content::before {content:"";position:absolute;left:0;top:0;width:2px;height:2px;border-radius:50%;box-shadow:0px 0px #bb841b,137px 193px #bb841b,274px 386px #bb841b,411px 579px #bb841b,548px 772px #bb841b,685px 965px #bb841b,822px 1158px #bb841b,959px 51px #bb841b,1096px 244px #bb841b,1233px 437px #bb841b,1370px 630px #bb841b,107px 823px #bb841b,244px 1016px #bb841b,381px 1209px #bb841b,518px 102px #bb841b,655px 295px #bb841b,792px 488px #bb841b,929px 681px #bb841b,1066px 874px #bb841b,1203px 1067px #bb841b,1340px 1260px #bb841b,77px 153px #bb841b,214px 346px #bb841b,351px 539px #bb841b,488px 732px #bb841b,625px 925px #bb841b,762px 1118px #bb841b,899px 11px #bb841b,1036px 204px #bb841b,1173px 397px #bb841b,1310px 590px #bb841b,47px 783px #bb841b,184px 976px #bb841b,321px 1169px #bb841b,458px 62px #bb841b,595px 255px #bb841b,732px 448px #bb841b,869px 641px #bb841b,1006px 834px #bb841b,1143px 1027px #bb841b;pointer-events:none;z-index:-1;animation:adminStars 3s ease-in-out infinite alternate;}
.content::after {content:"";position:absolute;left:0;top:0;width:3px;height:3px;border-radius:50%;box-shadow:71px 97px #bb841b,208px 290px #bb841b,345px 483px #bb841b,482px 676px #bb841b,619px 869px #bb841b,756px 1062px #bb841b,893px 1255px #bb841b,1030px 148px #bb841b,1167px 341px #bb841b,1304px 534px #bb841b,41px 727px #bb841b,178px 920px #bb841b,315px 1113px #bb841b,452px 6px #bb841b,589px 199px #bb841b,726px 392px #bb841b,863px 585px #bb841b,1000px 778px #bb841b,1137px 971px #bb841b,1274px 1164px #bb841b,11px 57px #bb841b,148px 250px #bb841b,285px 443px #bb841b,422px 636px #bb841b,559px 829px #bb841b,696px 1022px #bb841b,833px 1215px #bb841b,970px 108px #bb841b,1107px 301px #bb841b,1244px 494px #bb841b,1381px 687px #bb841b,118px 880px #bb841b,255px 1073px #bb841b,392px 1266px #bb841b,529px 159px #bb841b,666px 352px #bb841b,803px 545px #bb841b,940px 738px #bb841b,1077px 931px #bb841b,1214px 1124px #bb841b;pointer-events:none;z-index:-1;animation:adminStars 5s ease-in-out infinite alternate;}
.content > .page-head::before {content:"";position:absolute;left:0;top:0;width:4px;height:4px;border-radius:50%;box-shadow:142px 194px #bb841b,279px 387px #bb841b,416px 580px #bb841b,553px 773px #bb841b,690px 966px #bb841b,827px 1159px #bb841b,964px 52px #bb841b,1101px 245px #bb841b,1238px 438px #bb841b,1375px 631px #bb841b,112px 824px #bb841b,249px 1017px #bb841b,386px 1210px #bb841b,523px 103px #bb841b,660px 296px #bb841b,797px 489px #bb841b,934px 682px #bb841b,1071px 875px #bb841b,1208px 1068px #bb841b,1345px 1261px #bb841b,82px 154px #bb841b,219px 347px #bb841b,356px 540px #bb841b,493px 733px #bb841b,630px 926px #bb841b,767px 1119px #bb841b,904px 12px #bb841b,1041px 205px #bb841b,1178px 398px #bb841b,1315px 591px #bb841b,52px 784px #bb841b,189px 977px #bb841b,326px 1170px #bb841b,463px 63px #bb841b,600px 256px #bb841b,737px 449px #bb841b,874px 642px #bb841b,1011px 835px #bb841b,1148px 1028px #bb841b,1285px 1221px #bb841b;pointer-events:none;z-index:-1;animation:adminStars 7s ease-in-out infinite alternate;}
@keyframes adminStars {from {opacity:.15;transform:translateY(0)}to{opacity:.45;transform:translateY(-8px)}}
[data-theme="dark"] .content::before,[data-theme="dark"] .content::after {opacity:.2;}
.admin-hidden .content::before,.admin-hidden .content::after,.admin-hidden .page-head::before {animation-play-state:paused;}
@media(prefers-reduced-motion:reduce){.content::before,.content::after,.content > .page-head::before{animation:none;opacity:.2}}

.brand-ops{color:#966300}[data-theme="dark"] .brand-ops{color:#edc36c}

:root:not([data-theme="dark"]) .sidebar-foot .identity strong,:root:not([data-theme="dark"]) .sidebar-foot .text-button{color:#403b33}

/* 方案 B: seven sections, a tab bar per section, the inbox and the customer drawer. */
.section-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 18px; }
.section-head h1 { margin: 0; font-size: 26px; }
.section-head .section-tabs { margin: 0; flex-wrap: wrap; }
.section-body.tabbed > .page-head h1 { display: none; }
.section-body.tabbed > .page-head { margin-bottom: 16px; align-items: center; }
.nav-item .nav-count { margin-left: auto; min-width: 20px; padding: 1px 7px; border-radius: 999px; background: color-mix(in srgb, var(--gold) 22%, var(--surface)); color: var(--gold-deep, #875500); font-size: 11px; font-weight: 700; text-align: center; }
.today-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.today-grid .inbox .alert-row .primary { min-height: 30px; padding: 0 12px; }
@media (max-width: 1100px) { .today-grid { grid-template-columns: 1fr; } }
.modal.drawer { margin: 0 0 0 auto; height: 100vh; max-height: 100vh; width: min(640px, 100vw); border-radius: 18px 0 0 18px; animation: drawerIn .2s cubic-bezier(.2,.8,.2,1); }
.modal.drawer .modal-inner { max-height: none; }
.drawer-summary { display: grid; gap: 12px; margin: 4px 0 18px; }
.drawer-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.drawer-facts div { padding: 10px 12px; border-radius: 10px; background: var(--surface-2); }
.drawer-facts span { display: block; font-size: 12px; color: var(--muted); }
.drawer-facts strong { font-size: 18px; font-variant-numeric: tabular-nums; }
@keyframes drawerIn { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .modal.drawer { animation: none; } }
.drawer-summary .row-actions button { min-height: 34px; padding: 0 12px; font-size: 12px; }
.drawer-summary .row-actions button.primary { background: var(--gold-fill); color: var(--on-gold); border-color: var(--gold-fill); }
.today-failures { list-style: none; margin: 0; padding: 0; }
.today-failures li { display: flex; align-items: center; gap: 10px; padding: 10px 2px; border-top: 1px solid var(--line); font-size: 13px; }
.today-failures li div { flex: 1; min-width: 0; }
.today-failures .cell-sub { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ===================================================================
   方向二 · 专业紧凑 (2026-11-03). The final layer: white ground, 1px lines,
   dense tables, gold only for primary actions and the active marker.
   Every rule below reads tokens, so light and dark share one set.
   =================================================================== */
:root, :root[data-theme="light"] {
  --bg: #FFFFFF; --surface: #FFFFFF; --surface-2: #FAFAF8; --surface-3: #F3F3EF;
  --text: #16161A; --muted: #55555C; --faint: #6E6E76; --line: #ECECE8; --line-strong: #DCDCD6;
  --gold: #8A5A00; --gold-deep: #7A4E00; --gold-fill: #D69B20; --gold-soft: #FBEFD2; --on-gold: #1A1200;
  --success: #17603F; --success-dot: #1E9E62; --danger: #A8233A; --danger-dot: #D8384E; --warning: #7A4E00; --warning-dot: #D69B20; --info: #2F5BB8; --info-dot: #3A6FD8;
  --row-hover: #FAFAF6; --row-sel: #FFF8E6; --nav-active: #EFEFEA;
  --d2-radius: 6px; --d2-radius-lg: 8px;
}
:root[data-theme="dark"] {
  --bg: #121214; --surface: #18181B; --surface-2: #1E1E22; --surface-3: #26262B;
  --text: #EDEDEF; --muted: #B4B4BC; --faint: #9A9AA3; --line: #2A2A2F; --line-strong: #3A3A41;
  --gold: #E6B554; --gold-deep: #F0C674; --gold-fill: #E0AA3B; --gold-soft: #3A2F1A; --on-gold: #1A1200;
  --success: #5BD3A0; --success-dot: #3FB97F; --danger: #FF8A99; --danger-dot: #F0566B; --warning: #F0C674; --warning-dot: #E0AA3B; --info: #9DB6FF; --info-dot: #6F95F2;
  --row-hover: #1D1D21; --row-sel: #2A2416; --nav-active: #26262B;
}
html, body { background: var(--bg); }
body { background-image: none; font-size: 13px; }
h1, h2, h3 { font-family: var(--sans); letter-spacing: 0; }
h1 { font-size: 20px; font-weight: 600; margin-bottom: 2px; }
h2 { font-size: 14px; font-weight: 600; margin-bottom: 0; }
p { color: var(--muted); }

/* Shell */
.admin-shell { grid-template-columns: 200px minmax(0, 1fr); }
:root .sidebar, :root:not([data-theme="dark"]) .sidebar, :root[data-theme="dark"] .sidebar { padding: 14px 10px; background: var(--surface-2); border-right: 1px solid var(--line); color: var(--muted); }
.brand { color: var(--text); font-size: 14px; }
.brand small, .brand span { color: var(--gold); }
.brand-mark { width: 28px; height: 28px; border-radius: 6px; font-size: 15px; box-shadow: none; }
:root .nav-item, :root:not([data-theme="dark"]) .nav-item { min-height: 32px; padding: 0 10px; border: 0; border-radius: var(--d2-radius); color: var(--muted); font-size: 13px; font-weight: 500; }
:root .nav-item:hover, :root:not([data-theme="dark"]) .nav-item:hover { background: var(--nav-active); color: var(--text); }
:root .nav-item.active, :root:not([data-theme="dark"]) .nav-item.active { background: var(--nav-active); color: var(--text); font-weight: 600; border: 0; box-shadow: none; }
.nav-item.active::before { display: none; }
.nav-item .nav-count { background: var(--gold-soft); color: var(--gold-deep); }
.sidebar-foot { border-top-color: var(--line); }
.sidebar-foot .identity strong { color: var(--text); }
.sidebar-foot .avatar { background: var(--surface-3); color: var(--gold); }
.sidebar-foot .text-button { color: var(--faint); }
.sidebar-foot .text-button:hover { color: var(--text); }
.topbar, :root[data-theme="dark"] .topbar { padding: 10px 24px; background: color-mix(in srgb, var(--bg) 88%, transparent); border-bottom: 1px solid var(--line); }
.content { padding: 20px 24px 64px; max-width: none; }
.page-head { margin-bottom: 14px; align-items: center; }
.page-head p { font-size: 12px; }
.section-head { margin-bottom: 14px; }
.section-head h1 { font-size: 20px; }

/* Buttons: 32px, 13px — no more 10px row buttons */
.primary, .secondary, .ghost { min-height: 32px; padding: 0 12px; border-radius: var(--d2-radius); font-size: 13px; font-weight: 600; box-shadow: none; transform: none; }
.primary { background: var(--gold-fill); border-color: var(--gold-fill); color: var(--on-gold); }
.primary:hover { background: color-mix(in srgb, var(--gold-fill) 88%, #000); transform: none; box-shadow: none; }
.secondary { background: var(--surface); border: 1px solid var(--line-strong); color: var(--text); }
.secondary:hover { background: var(--surface-2); color: var(--text); }
.row-actions button, .mini { min-height: 30px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: var(--d2-radius); background: var(--surface); color: var(--text); font-size: 12px; font-weight: 600; }
.row-actions button:hover, .mini:hover { background: var(--surface-2); border-color: var(--line-strong); color: var(--text); }
.row-actions { gap: 6px; }

/* Inputs */
input, select, textarea { min-height: 32px; padding: 6px 10px; border: 1px solid var(--line-strong); border-radius: var(--d2-radius); background: var(--surface); color: var(--text); font-size: 13px; }
input:focus, select:focus, textarea:focus { border-color: var(--gold-fill); box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold-fill) 22%, transparent); }
label { color: var(--muted); font-size: 12px; font-weight: 500; }

/* KPI strip replaces the big metric cards */
.metrics, .metrics.hero-metrics { display: flex; flex-wrap: wrap; row-gap: 10px; gap: 0; margin-bottom: 14px; padding: 12px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.metric, .hero-metrics .metric { flex: 0 1 auto; min-width: 120px; padding: 0 20px; border: 0; border-left: 1px solid var(--line); border-radius: 0; background: none; box-shadow: none; }
.metric:first-child { border-left: 0; padding-left: 0; }
.metric::before, .metric::after { display: none !important; }
.metric span { font-size: 12px; color: var(--muted); }
.metric strong { margin-top: 2px; font-family: var(--sans); font-size: 20px; font-weight: 600; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.metric small { margin-top: 0; font-size: 11px; color: var(--faint); }

/* Panels: plain bordered boxes */
.panel { margin-bottom: 14px; padding: 0; border: 1px solid var(--line); border-radius: var(--d2-radius-lg); background: var(--surface); box-shadow: none; }
.panel > .panel-head { margin: 0; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.panel > .panel-head p { margin-top: 2px; }
.panel > :not(.panel-head):not(.table-wrap):not(.alert-row):not(table) { margin-left: 14px; margin-right: 14px; }
.panel > :last-child:not(.table-wrap):not(.alert-row) { margin-bottom: 14px; }
.panel > .panel-head + :not(.table-wrap):not(.alert-row) { margin-top: 14px; }
.panel-grid { gap: 14px; }

/* Tables: 44px rows, sticky header, tabular numbers */
table { font-size: 13px; }
th, :root th { position: sticky; top: 0; z-index: 1; padding: 8px 12px; background: var(--surface-2); border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12px; font-weight: 500; letter-spacing: 0; text-transform: none; }
td, :root td, :root[data-theme="dark"] td { height: 44px; padding: 6px 12px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
td:first-child, th:first-child { padding-left: 14px; }
td:last-child, th:last-child { padding-right: 14px; }
tbody tr:hover, :root[data-theme="dark"] tbody tr:hover { background: var(--row-hover); }
.cell-main { font-weight: 600; }
.cell-sub { color: var(--faint); font-size: 12px; }
.user-avatar { width: 28px; height: 28px; }

/* Status: coloured dot + text; neutral badges stay small grey tags */
.badge { padding: 2px 7px; border-radius: 4px; background: var(--surface-3); color: var(--muted); font-size: 11px; font-weight: 600; }
.badge.success, .badge.warning, .badge.danger, .badge.info { gap: 6px; padding: 0; background: none; color: var(--text); font-size: 12px; font-weight: 500; }
.badge.success::before, .badge.warning::before, .badge.danger::before, .badge.info::before { content: ""; width: 7px; height: 7px; border-radius: 50%; flex: none; }
.badge.success::before { background: var(--success-dot); }
.badge.warning::before { background: var(--warning-dot); }
.badge.danger::before { background: var(--danger-dot); }
.badge.info::before { background: var(--info-dot); }
.badge.gold { background: var(--gold-soft); color: var(--gold-deep); }

/* Tabs: underline; filter tabs: chips */
.tabs, :root .tabs { width: auto; gap: 18px; margin-bottom: 14px; padding: 0; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: none; box-shadow: none; }
.tabs button, :root .tabs button { min-height: 34px; padding: 0; border: 0; border-radius: 0; background: none; color: var(--muted); font-size: 13px; font-weight: 500; box-shadow: none; }
.tabs button.active, :root .tabs button.active { background: none; color: var(--text); font-weight: 600; box-shadow: inset 0 -2px 0 var(--text); }
.section-head .section-tabs { border-bottom: 0; }
.sub-tabs, :root .sub-tabs { gap: 6px; border-bottom: 0; flex-wrap: wrap; }
.sub-tabs button, :root .sub-tabs button { min-height: 28px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: var(--d2-radius); font-size: 12px; }
.sub-tabs button.active, :root .sub-tabs button.active { background: var(--text); color: var(--bg); box-shadow: none; border-color: var(--text); }
.sub-tabs button.active small { color: inherit; opacity: .7; }
.toolbar { gap: 6px; margin-bottom: 12px; }
.toolbar input, .toolbar select { min-height: 30px; }

/* Inbox, alerts */
.alert-row { align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.today-grid { gap: 14px; }

/* Dialogs: forms and details open as right drawers; confirmations stay centred */
.modal { border-radius: var(--d2-radius-lg); border: 1px solid var(--line); box-shadow: 0 20px 60px rgba(0,0,0,.18); background: var(--surface); color: var(--text); }
.modal.drawer { border-radius: 0; border-width: 0 0 0 1px; }
.modal-inner { padding: 20px; }
.toast { border-radius: var(--d2-radius); font-size: 13px; }

/* Unsaved-changes bar, shown when a page form is edited */
.save-bar { position: sticky; bottom: 12px; z-index: 5; display: flex; align-items: center; gap: 10px; margin-top: 14px; padding: 10px 14px; border: 1px solid color-mix(in srgb, var(--gold-fill) 50%, var(--line)); border-radius: var(--d2-radius-lg); background: color-mix(in srgb, var(--gold-soft) 60%, var(--surface)); font-size: 13px; }
.save-bar .spacer { flex: 1; }

/* Margin colour blocks on 价格与成本 */
.margin-pill { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 4px; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.margin-pill.good { background: color-mix(in srgb, var(--success-dot) 16%, var(--surface)); color: var(--success); }
.margin-pill.mid { background: var(--gold-soft); color: var(--gold-deep); }
.margin-pill.low { background: color-mix(in srgb, var(--danger-dot) 14%, var(--surface)); color: var(--danger); }
.inbox-group { border-bottom: 1px solid var(--line); }
.inbox-group:last-child { border-bottom: 0; }
.inbox-title, .inbox-group summary { padding: 10px 14px; font-size: 13px; font-weight: 600; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.inbox-group summary { display: flex; gap: 10px; cursor: pointer; list-style: none; }
.inbox-group summary::-webkit-details-marker { display: none; }
.inbox-group .alert-row:last-child { border-bottom: 0; }
tr.row-link { cursor: pointer; }
td .badge + .badge, td .badge + span.badge { margin-left: 10px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* 调用日志 / 模型 / 渠道 under 方向二 */
.log-summary > div { padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--d2-radius-lg); }
.log-summary h3 { color: var(--muted); font-weight: 500; }
.log-chip { min-height: 26px; padding: 0 8px; border: 1px solid var(--line-strong); border-radius: var(--d2-radius); background: var(--surface); color: var(--text); font-size: 12px; margin: 0 4px 4px 0; }
.log-chip.bad { border-color: color-mix(in srgb, var(--danger-dot) 45%, var(--line)); color: var(--danger); }
.log-filters input, .log-filters select { min-height: 30px; }
.model-catalog-table th:last-child, .model-catalog-table td:last-child { background: var(--surface); }
.model-catalog-table tbody tr:hover td:last-child { background: var(--row-hover); }
.panel .tabs { margin: 0 14px 12px; }
/* 内容 / 系统 / 登录 under 方向二 */
.showcase-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.showcase-card { border-radius: var(--d2-radius-lg); box-shadow: none; }
#storageForm, #clientConfigForm { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 14px; }
#storageForm > :is(.row-actions, p, .form-row, .muted, div:not([class])), #clientConfigForm > :is(.row-actions, p, .form-row, .muted, label:has(textarea)) { grid-column: 1 / -1; }
#storageForm > .row-actions, #clientConfigForm > .row-actions, #assistantForm > .row-actions { justify-content: flex-end; }
#pricingSettingsForm { grid-template-columns: repeat(3, minmax(0, 1fr)) auto; align-items: end; column-gap: 14px; }
#pricingSettingsForm > :not(label) { grid-column: auto; }
@media (max-width: 900px) { #pricingSettingsForm, #storageForm, #clientConfigForm { grid-template-columns: 1fr; } }
:root[data-theme="dark"] .tabs button.active { background: none; color: var(--text); box-shadow: inset 0 -2px 0 var(--text); }
:root[data-theme="dark"] .sub-tabs button.active { background: var(--text); color: var(--bg); border-color: var(--text); }
:root[data-theme="dark"] .primary { background: var(--gold-fill); border-color: var(--gold-fill); color: var(--on-gold); }
:root[data-theme="dark"] .primary:hover { background: color-mix(in srgb, var(--gold-fill) 88%, #fff); }
:root[data-theme="dark"] .alert-row:hover { background: var(--row-hover); }
:root[data-theme="dark"] input, :root[data-theme="dark"] select, :root[data-theme="dark"] textarea { background: var(--surface-2); border-color: var(--line-strong); color: var(--text); }
/* The login page keeps its original warm two-column design: restore the
   tokens it was drawn with, scoped to the login view only. */
:root:not([data-theme="dark"]) .login-shell { --bg: #f5f3ee; --surface: #ffffff; --surface-2: #f8f6f1; --surface-3: #f1ede4; --text: #1f1c17; --muted: #6b6457; --faint: #9a9284; --line: #e9e4d9; --line-strong: #dcd5c6; --gold: #a46a06; --gold-deep: #7d5003; --gold-fill: #e3a93a; --gold-soft: #f7ecd3; --on-gold: #2a1c02; }
:root[data-theme="dark"] .login-shell { --bg: #141310; --surface: #1c1a16; --surface-2: #221f1a; --surface-3: #2a2620; --text: #f2ede3; --muted: #b3aa9a; --faint: #8a8172; --line: #2e2a23; --line-strong: #3b362d; --gold: #e7b75a; --gold-deep: #f0c674; --gold-fill: #e3a93a; --gold-soft: #3a2f1a; }
.login-shell .primary { min-height: 46px; border-radius: 11px; }
.login-shell input { border-radius: 10px; }
/* 渠道与 Key split view */
.channel-split { display: grid; grid-template-columns: minmax(220px, 280px) minmax(0, 1fr); min-height: 360px; }
.channel-list { display: flex; flex-direction: column; border-right: 1px solid var(--line); }
.channel-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 14px; border: 0; border-bottom: 1px solid var(--line); background: none; color: var(--text); text-align: left; font-size: 13px; }
.channel-item:hover { background: var(--row-hover); }
.channel-item.active { background: var(--row-sel); }
.channel-item .badge { font-size: 0; }
.channel-item-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.channel-item small { color: var(--faint); font-size: 12px; }
.channel-detail { min-width: 0; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.channel-detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.channel-detail-head h3 { margin: 0; font-size: 16px; }
.channel-detail-head p { margin: 2px 0 0; }
.channel-alert { border: 1px solid color-mix(in srgb, var(--danger-dot) 35%, var(--line)); border-radius: var(--d2-radius-lg); background: color-mix(in srgb, var(--danger-dot) 7%, var(--surface)); }
.channel-keys { border: 1px solid var(--line); border-radius: var(--d2-radius-lg); overflow: hidden; }
.channel-keys-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); }
@media (max-width: 900px) { .channel-split { grid-template-columns: 1fr; } .channel-list { border-right: 0; } }
/* 调用日志: filters and error summaries in a left panel */
.log-layout { display: grid; grid-template-columns: minmax(220px, 260px) minmax(0, 1fr); border-top: 1px solid var(--line); }
.log-side { display: flex; flex-direction: column; gap: 12px; padding: 14px; border-right: 1px solid var(--line); background: var(--surface-2); }
.log-side .log-filters { flex-direction: column; align-items: stretch; margin: 0; }
.log-side .log-filters select, .log-side .log-filters input { width: 100%; max-width: none; }
.log-side .log-summary { grid-template-columns: 1fr; margin: 0; }
.log-side .log-summary > div { background: var(--surface); }
.log-main { min-width: 0; }
.panel .log-layout { margin: 0 !important; }
@media (max-width: 900px) { .log-layout { grid-template-columns: 1fr; } .log-side { border-right: 0; } }
/* 专业规则: three columns */
.pro-layout { display: grid; grid-template-columns: 180px 260px minmax(0, 1fr); min-height: 420px; }
.pro-kinds { display: flex; flex-direction: column; gap: 2px; padding: 8px; border-right: 1px solid var(--line); background: var(--surface-2); }
.pro-kind { display: flex; justify-content: space-between; align-items: center; min-height: 34px; padding: 0 10px; border: 0; border-radius: var(--d2-radius); background: none; color: var(--muted); font-size: 13px; text-align: left; }
.pro-kind.active { background: var(--nav-active); color: var(--text); font-weight: 600; }
.pro-kind small { color: var(--faint); }
.pro-items { display: flex; flex-direction: column; border-right: 1px solid var(--line); overflow-y: auto; max-height: 70vh; }
.pro-item { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border: 0; border-bottom: 1px solid var(--line); background: none; color: var(--text); font-size: 13px; text-align: left; }
.pro-item:hover { background: var(--row-hover); }
.pro-item.active { background: var(--row-sel); font-weight: 600; }
.pro-detail { min-width: 0; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.pro-detail-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.pro-detail-head h3 { margin: 0; font-size: 16px; }
.pro-block h4 { margin: 0 0 6px; font-size: 12px; color: var(--muted); font-weight: 600; }
.pro-block ol { margin: 0; padding-left: 18px; display: grid; gap: 4px; font-size: 13px; line-height: 1.6; }
.pro-block p { margin: 0; font-size: 13px; color: var(--text); }
.pro-params { display: grid; grid-template-columns: 60px 1fr; gap: 4px 12px; margin: 0; font-size: 13px; }
.pro-params dt { color: var(--muted); }
.pro-params dd { margin: 0; }
@media (max-width: 1000px) { .pro-layout { grid-template-columns: 1fr; } .pro-kinds { flex-direction: row; flex-wrap: wrap; border-right: 0; } .pro-items { border-right: 0; max-height: none; } }
#routeOrder tr[draggable] { cursor: grab; }
#routeOrder tr.dragging { opacity: .5; background: var(--row-sel); }
.drag-handle { display: inline-block; margin-right: 8px; color: var(--faint); letter-spacing: -2px; }
/* 趋势 charts */
.trend-grid { margin-bottom: 0; }
.chart { display: block; width: calc(100% - 28px); height: auto; margin: 10px 14px 14px; }
.chart-grid { stroke: var(--line); stroke-width: 1; }
.chart-tick { fill: var(--faint); font-size: 10px; }
.chart-line { fill: none; stroke-width: 2; stroke-linejoin: round; }
.chart-line.revenue { stroke: var(--text); }
.chart-line.cost { stroke: var(--gold-fill); }
.chart-bar.b0 { fill: var(--text); }
.chart-bar.b1 { fill: var(--gold-fill); }
.chart-bar.b2 { fill: var(--faint); }
.chart-legend { display: flex; gap: 10px; font-size: 12px; color: var(--muted); }
.chart-legend .lg::before { content: ""; display: inline-block; width: 10px; height: 3px; margin-right: 5px; vertical-align: middle; border-radius: 2px; background: var(--faint); }
.chart-legend .lg.revenue::before, .chart-legend .lg.b0::before { background: var(--text); }
.chart-legend .lg.cost::before, .chart-legend .lg.b1::before { background: var(--gold-fill); }
td.num, th.num { text-align: right; }
.drawer-tabs { margin: 0 0 12px; }
#customerNote { width: 100%; min-height: 110px; resize: vertical; }
