:root {
  --bg: #f7f8fc;
  --surface: #ffffff;
  --surface-soft: #fbfbfe;
  --line: #e8e8f0;
  --line-strong: #d9d9e6;
  --ink: #191a28;
  --muted: #77798e;
  --muted-2: #a2a3b2;
  --purple: #6d4aff;
  --purple-dark: #5231e8;
  --purple-soft: #f0edff;
  --purple-pale: #f8f6ff;
  --green: #1d9b6c;
  --green-soft: #e9f8f1;
  --amber: #b97b17;
  --amber-soft: #fff6df;
  --red: #d95370;
  --red-soft: #fff0f3;
  --shadow: 0 10px 35px rgba(50, 42, 105, .07);
  --radius: 10px;
  --mono: "DM Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: Manrope, "Noto Sans SC", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--ink); font-family: var(--sans); overflow-x: hidden; }
body { font-size: 14px; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .58; }
code, .mono { font-family: var(--mono); }

.app-shell { min-height: 100vh; display: flex; }
.sidebar { width: 244px; flex: 0 0 244px; background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 25px 15px 15px; }
.brand, .auth-logo { display: flex; align-items: center; gap: 11px; padding: 0 10px; }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; background: var(--purple); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 18px; box-shadow: 0 7px 14px rgba(109, 74, 255, .23); }
.brand strong, .auth-logo strong { display: block; font-size: 16px; letter-spacing: -.3px; }
.brand span, .auth-logo span { display: block; font-size: 10px; color: var(--muted-2); margin-top: 2px; letter-spacing: .3px; }
.nav-list { margin-top: 48px; display: flex; flex-direction: column; gap: 4px; }
.nav-label { color: #b0b1be; font-size: 10px; letter-spacing: .9px; text-transform: uppercase; margin: 13px 12px 7px; }
.nav-item { border: 0; background: transparent; color: var(--muted); border-radius: 8px; height: 42px; display: flex; align-items: center; gap: 12px; padding: 0 12px; text-align: left; font-size: 13px; font-weight: 600; transition: .18s ease; }
.nav-item:hover { color: var(--purple); background: var(--purple-pale); }
.nav-item.active { color: var(--purple); background: var(--purple-soft); }
.nav-icon { width: 18px; text-align: center; font-size: 16px; font-weight: 500; }
.sidebar-bottom { margin-top: auto; }
.endpoint-mini { border-top: 1px solid var(--line); padding: 17px 10px 14px; display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; flex-wrap: wrap; }
.endpoint-mini code { color: var(--muted-2); font-size: 10px; margin-left: 12px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.user-chip { width: 100%; border: 0; border-top: 1px solid var(--line); padding: 13px 10px 2px; background: transparent; display: flex; align-items: center; gap: 9px; color: var(--ink); text-align: left; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: #eeeaff; color: var(--purple); display: grid; place-items: center; font-weight: 800; font-size: 12px; }
.user-name { flex: 1; font-size: 11px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logout-icon { color: var(--muted-2); font-size: 18px; }

.main-column { flex: 1; min-width: 0; }
.topbar { min-height: 70px; height: auto; background: rgba(255,255,255,.9); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 15px 43px; position: sticky; top: 0; z-index: 10; backdrop-filter: blur(12px); }
.breadcrumb { display: flex; gap: 9px; align-items: center; color: var(--muted-2); font-size: 12px; }
.breadcrumb b { color: var(--line-strong); font-weight: 400; }
.breadcrumb strong { color: var(--ink); font-size: 13px; }
.topbar-actions { display: flex; align-items: center; gap: 15px; }
.date-label { color: var(--muted-2); font-size: 11px; }
.icon-button, .mobile-menu { width: 32px; height: 32px; border: 1px solid var(--line); background: var(--surface); border-radius: 7px; color: var(--muted); display: grid; place-items: center; font-size: 17px; }
.icon-button:hover { border-color: var(--purple); color: var(--purple); }
.mobile-menu { display: none; }
.content { max-width: 1360px; margin: 0 auto; padding: 34px 43px 55px; }

.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 25px; margin-bottom: 27px; }
.eyebrow { color: var(--purple); font-size: 10px; font-weight: 800; letter-spacing: 1.4px; text-transform: uppercase; margin-bottom: 8px; }
.page-heading h1 { margin: 0; font-size: 27px; letter-spacing: -.8px; line-height: 1.2; }
.page-heading p { color: var(--muted); margin: 7px 0 0; font-size: 12px; }
.heading-actions { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; }
.primary-button, .secondary-button, .danger-button { min-height: 37px; border-radius: 7px; padding: 0 15px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; font-size: 12px; font-weight: 700; border: 1px solid transparent; transition: .18s ease; }
.primary-button { color: #fff; background: var(--purple); box-shadow: 0 5px 14px rgba(109,74,255,.18); }
.primary-button:hover { background: var(--purple-dark); transform: translateY(-1px); }
.secondary-button { color: var(--muted); background: var(--surface); border-color: var(--line); }
.secondary-button:hover { color: var(--purple); border-color: #c9c0ff; background: var(--purple-pale); }
.danger-button { color: var(--red); background: var(--red-soft); border-color: #ffd8e0; }
.full-button { width: 100%; }

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 15px; }
.kpi-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 19px; min-height: 116px; }
.kpi-label { color: var(--muted); font-size: 11px; display: flex; align-items: center; justify-content: space-between; }
.kpi-symbol { color: var(--purple); font-size: 16px; font-weight: 700; }
.kpi-value { margin-top: 13px; font-size: 23px; line-height: 1; font-weight: 800; letter-spacing: -.6px; }
.kpi-meta { margin-top: 11px; font-size: 10px; color: var(--muted-2); }
.kpi-meta.positive { color: var(--green); }
.kpi-meta.warning { color: var(--amber); }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.72fr) minmax(260px, .92fr); gap: 15px; }
.dashboard-wide { grid-column: 1 / -1; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 21px; min-width: 0; }
.panel-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 18px; }
.panel-title { margin: 0; font-size: 14px; font-weight: 800; letter-spacing: -.15px; }
.panel-subtitle { color: var(--muted-2); font-size: 10px; margin-top: 5px; }
.period-select { border: 1px solid var(--line); background: var(--surface); color: var(--muted); border-radius: 6px; padding: 6px 9px; font-size: 10px; outline: 0; }
.trend-chart { height: 235px; position: relative; }
.trend-chart svg { width: 100%; height: 100%; overflow: visible; }
.chart-label { fill: var(--muted-2); font-family: var(--sans); font-size: 10px; }
.chart-grid { stroke: #f0f0f5; stroke-width: 1; }
.chart-area { fill: url(#chart-fill); }
.chart-line { fill: none; stroke: var(--purple); stroke-width: 2.4; vector-effect: non-scaling-stroke; }
.chart-point { fill: var(--surface); stroke: var(--purple); stroke-width: 2; }
.chart-empty { height: 100%; display: grid; place-items: center; text-align: center; color: var(--muted); font-size: 12px; }
.chart-empty span { display: block; margin-top: 8px; color: var(--muted-2); font-size: 11px; }
.legend { display: flex; gap: 16px; margin-top: 4px; color: var(--muted); font-size: 10px; }
.legend i { width: 7px; height: 7px; border-radius: 50%; display: inline-block; margin-right: 5px; background: var(--purple); }
.legend i.tokens { background: #c6baff; }
.donut-layout { display: flex; align-items: center; gap: 20px; min-height: 230px; }
.donut { width: 150px; height: 150px; flex: 0 0 150px; position: relative; }
.donut svg { transform: rotate(-90deg); width: 100%; height: 100%; }
.donut-track { fill: none; stroke: #f2f1f7; stroke-width: 20; }
.donut-segment { fill: none; stroke-width: 20; stroke-linecap: butt; }
.donut-center { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; align-content: center; }
.donut-center b { font-size: 20px; letter-spacing: -.6px; }
.donut-center span { color: var(--muted-2); font-size: 10px; margin-top: 3px; }
.model-legend { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 13px; }
.model-row { display: grid; grid-template-columns: 9px minmax(0, 1fr) auto; gap: 8px; align-items: center; font-size: 11px; }
.model-color { width: 7px; height: 7px; border-radius: 50%; }
.model-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.model-share { color: var(--ink); font-family: var(--mono); font-size: 10px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 590px; }
th { color: var(--muted-2); font-size: 10px; text-align: left; font-weight: 600; padding: 0 11px 12px; white-space: nowrap; }
td { border-top: 1px solid var(--line); padding: 13px 11px; color: var(--muted); font-size: 11px; white-space: nowrap; }
td:first-child, th:first-child { padding-left: 0; }
td:last-child, th:last-child { padding-right: 0; text-align: right; }
.table-primary { color: var(--ink); font-weight: 700; }
.table-mono { font-family: var(--mono); font-size: 10px; }
.status-badge { display: inline-flex; align-items: center; gap: 5px; border-radius: 20px; padding: 4px 8px; font-size: 10px; font-weight: 700; }
.status-badge.success { color: var(--green); background: var(--green-soft); }
.status-badge.error { color: var(--red); background: var(--red-soft); }
.status-badge.pending { color: var(--amber); background: var(--amber-soft); }
.status-badge.neutral { color: var(--muted); background: #f3f3f7; }
.status-badge .status-dot { width: 5px; height: 5px; box-shadow: none; }
.empty-state { min-height: 180px; display: grid; place-items: center; text-align: center; padding: 28px 15px; }
.empty-icon { width: 43px; height: 43px; border-radius: 50%; background: var(--purple-soft); color: var(--purple); display: grid; place-items: center; font-size: 19px; margin: 0 auto 11px; }
.empty-state strong { display: block; font-size: 13px; }
.empty-state p { margin: 7px 0 15px; color: var(--muted); font-size: 11px; }

.cta-banner { background: var(--purple); border-radius: var(--radius); color: #fff; padding: 25px 28px; display: flex; align-items: center; justify-content: space-between; gap: 20px; position: relative; overflow: hidden; }
.cta-banner::after { content: ""; position: absolute; width: 180px; height: 180px; border: 1px solid rgba(255,255,255,.18); border-radius: 50%; right: 50px; top: -90px; box-shadow: 0 0 0 18px rgba(255,255,255,.04), 0 0 0 38px rgba(255,255,255,.03); }
.cta-banner h2 { font-size: 18px; margin: 0 0 6px; letter-spacing: -.3px; position: relative; z-index: 1; }
.cta-banner p { margin: 0; color: #dcd6ff; font-size: 11px; position: relative; z-index: 1; }
.cta-banner .primary-button { background: #fff; color: var(--purple); box-shadow: none; position: relative; z-index: 1; white-space: nowrap; }

.filter-bar { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.search-input, .filter-select { height: 36px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); outline: none; padding: 0 11px; color: var(--ink); font-size: 11px; }
.search-input { min-width: 220px; }
.search-input:focus, .filter-select:focus, .field input:focus, .field textarea:focus { border-color: #b8aaff; box-shadow: 0 0 0 3px var(--purple-soft); }
.data-panel { padding: 0; overflow: hidden; }
.data-panel .panel-header { padding: 20px 21px 16px; margin: 0; border-bottom: 1px solid var(--line); align-items: center; }
.data-panel .table-wrap { padding: 0 21px 4px; }
.data-panel .empty-state { margin: 0 21px; }
.data-panel .table-wrap td, .data-panel .table-wrap th { padding-top: 14px; padding-bottom: 14px; }
.actions { display: flex; justify-content: flex-end; gap: 5px; }
.action-button { border: 0; background: transparent; color: var(--muted-2); padding: 5px; font-size: 15px; border-radius: 5px; }
.action-button:hover { color: var(--purple); background: var(--purple-soft); }
.toggle { appearance: none; width: 32px; height: 18px; border: 0; border-radius: 20px; background: #d8d8e3; position: relative; vertical-align: middle; transition: .18s ease; cursor: pointer; }
.toggle::after { content: ""; width: 14px; height: 14px; position: absolute; left: 2px; top: 2px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.15); transition: .18s ease; }
.toggle:checked { background: var(--purple); }
.toggle:checked::after { transform: translateX(14px); }

.model-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.model-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 19px; min-height: 166px; display: flex; flex-direction: column; }
.model-card-head { display: flex; justify-content: space-between; gap: 10px; }
.model-card h3 { font-size: 14px; margin: 0; max-width: 75%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.model-card p { font-size: 11px; color: var(--muted); line-height: 1.7; margin: 16px 0; flex: 1; }
.model-card-foot { border-top: 1px solid var(--line); padding-top: 13px; display: flex; justify-content: space-between; color: var(--muted-2); font-size: 10px; }
.model-card-foot strong { color: var(--ink); font-family: var(--mono); font-weight: 500; }
.channel-models { max-width: 270px; overflow: hidden; text-overflow: ellipsis; }

.docs-grid { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.7fr); gap: 15px; }
.doc-nav { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; align-self: start; }
.doc-nav button { width: 100%; border: 0; background: transparent; text-align: left; padding: 10px 11px; border-radius: 6px; color: var(--muted); font-size: 12px; }
.doc-nav button.active, .doc-nav button:hover { background: var(--purple-soft); color: var(--purple); font-weight: 700; }
.doc-content { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; }
.doc-content h2 { margin: 0 0 8px; font-size: 19px; }
.doc-content h3 { margin: 27px 0 10px; font-size: 14px; }
.doc-content p, .doc-content li { color: var(--muted); font-size: 12px; line-height: 1.8; }
.doc-content ul { padding-left: 19px; }
.code-block { margin: 12px 0; background: #191a28; color: #e6e5ff; border-radius: 8px; padding: 17px; overflow-x: auto; position: relative; }
.code-block pre { margin: 0; font-family: var(--mono); font-size: 11px; line-height: 1.75; white-space: pre-wrap; word-break: break-word; }
.code-copy { position: absolute; right: 10px; top: 9px; border: 1px solid #424355; color: #bab8d6; background: #252638; border-radius: 5px; padding: 4px 8px; font-size: 10px; }
.endpoint-pill { background: var(--purple-soft); color: var(--purple); border-radius: 6px; padding: 9px 12px; font-family: var(--mono); font-size: 11px; display: inline-block; word-break: break-all; }

.playground-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 15px; align-items: start; }
.playground-panel { padding: 22px; }
.stack-form { display: flex; flex-direction: column; gap: 15px; }
.field { display: flex; flex-direction: column; gap: 7px; color: var(--muted); font-size: 11px; font-weight: 600; }
.field input, .field textarea, .field select { width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 7px; padding: 10px 11px; color: var(--ink); outline: none; font-size: 12px; }
.field textarea { resize: vertical; min-height: 170px; line-height: 1.7; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-hint { color: var(--muted-2); font-size: 10px; line-height: 1.5; }
.form-error { color: var(--red); background: var(--red-soft); border-radius: 6px; padding: 9px 11px; font-size: 11px; }
.playground-result { min-height: 304px; background: #191a28; border-radius: 8px; padding: 17px; color: #e8e7ff; overflow: auto; }
.playground-result pre { margin: 0; font-family: var(--mono); font-size: 11px; line-height: 1.7; white-space: pre-wrap; word-break: break-word; }
.result-placeholder { color: #77798e; font-size: 11px; line-height: 1.7; }
.loading-bar { height: 3px; border-radius: 3px; background: linear-gradient(90deg, transparent, var(--purple), transparent); background-size: 200% 100%; animation: loading 1.2s infinite; }
@keyframes loading { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.button-spinner { width: 13px; height: 13px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.modal-root { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 20px; }
.modal-root[hidden], .auth-layer[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(21, 20, 37, .36); backdrop-filter: blur(4px); }
.modal-card { width: min(500px, 100%); max-height: calc(100vh - 40px); overflow: auto; background: var(--surface); border-radius: 12px; box-shadow: 0 20px 70px rgba(25, 20, 65, .2); position: relative; padding: 25px; }
.modal-head { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; margin-bottom: 21px; }
.modal-head h2 { margin: 0; font-size: 18px; }
.modal-head p { color: var(--muted); font-size: 11px; margin: 7px 0 0; }
.modal-close { border: 0; background: transparent; color: var(--muted-2); font-size: 22px; line-height: 1; padding: 0 2px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 9px; margin-top: 22px; }
.secret-box { background: var(--green-soft); border: 1px solid #cceedd; border-radius: 8px; padding: 14px; margin-top: 16px; }
.secret-box strong { color: var(--green); display: block; font-size: 11px; margin-bottom: 8px; }
.secret-row { display: flex; gap: 7px; align-items: center; }
.secret-row code { background: var(--surface); border: 1px solid #cceedd; border-radius: 5px; flex: 1; padding: 9px; color: var(--ink); font-size: 11px; overflow: auto; }
.auth-layer { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; overflow-y: auto; padding: clamp(16px, 5vh, 48px) 16px; }
.auth-backdrop { position: fixed; inset: 0; background: #f7f8fc; }
.auth-card { position: relative; width: min(420px, calc(100vw - 32px)); max-width: 100%; min-width: 0; max-height: calc(100dvh - 32px); overflow-x: hidden; overflow-y: auto; padding: 32px 34px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.auth-logo { padding: 0; margin-bottom: 28px; min-width: 0; }
.auth-kicker { font-size: 10px; color: var(--purple); letter-spacing: 1.5px; font-weight: 800; margin-bottom: 11px; }
.auth-card h1 { margin: 0; font-size: 24px; letter-spacing: -.7px; }
.auth-card > p { color: var(--muted); font-size: 12px; line-height: 1.6; margin: 8px 0 18px; }
.auth-card .stack-form { gap: 12px; }
.auth-card .full-button { position: sticky; bottom: 0; z-index: 1; box-shadow: 0 -8px 14px var(--surface); }
.auth-choice { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; min-width: 0; }
.auth-choice-button { min-width: 0; overflow: hidden; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 10px 6px; color: var(--muted); text-align: center; }
.auth-choice-button strong, .auth-choice-button span { display: block; }
.auth-choice-button strong { color: var(--ink); font-size: 11px; }
.auth-choice-button span { margin-top: 4px; font-size: 9px; }
.auth-choice-button.active { border-color: #b8aaff; background: var(--purple-soft); color: var(--purple); box-shadow: 0 0 0 2px var(--purple-pale); }
.auth-segment { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); border-radius: 7px; padding: 3px; background: var(--surface-soft); }
.auth-segment button { border: 0; background: transparent; color: var(--muted); border-radius: 5px; min-height: 31px; font-size: 10px; font-weight: 700; }
.auth-segment button.active { color: var(--purple); background: var(--surface); box-shadow: 0 2px 8px rgba(50,42,105,.08); }
.field-action-row { display: flex; gap: 8px; align-items: stretch; }
.field-action-row input { flex: 1; min-width: 0; }
.field-action-row .secondary-button { white-space: nowrap; }
.settings-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; align-items: start; }
.profile-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.notice-list { color: var(--muted); font-size: 11px; line-height: 1.8; }
.notice-list p { margin: 0 0 10px; }
.permission-picker { max-height: 180px; overflow: auto; border: 1px solid var(--line); border-radius: 7px; padding: 7px 10px; }
.check-row { display: flex; align-items: center; gap: 8px; min-height: 30px; color: var(--muted); font: 10px var(--mono); }
.check-row input { width: auto; }
.permission-cell { max-width: 360px; white-space: normal; line-height: 1.6; }
.auth-error { color: var(--red); background: var(--red-soft); padding: 10px 12px; border-radius: 6px; font-size: 11px; margin-top: 13px; }
.auth-foot { text-align: center; color: var(--muted-2); font-size: 10px; margin-top: 28px; }
.auth-foot code { color: var(--muted); margin-left: 4px; }
.toast-region { position: fixed; right: 22px; bottom: 22px; z-index: 80; display: flex; flex-direction: column; gap: 8px; }
.toast { color: var(--ink); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); border-left: 3px solid var(--purple); border-radius: 7px; padding: 11px 14px; min-width: 220px; font-size: 11px; animation: toast-in .2s ease-out; }
.toast.error { border-left-color: var(--red); }
.toast.success { border-left-color: var(--green); }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

@media (max-width: 1050px) {
  .sidebar { width: 215px; flex-basis: 215px; }
  .topbar, .content { padding-left: 27px; padding-right: 27px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .model-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .sidebar { position: fixed; z-index: 25; left: 0; top: 0; bottom: 0; transform: translateX(-100%); transition: transform .2s ease; box-shadow: 10px 0 30px rgba(30,25,70,.1); }
  .sidebar.open { transform: translateX(0); }
  .topbar { min-height: 62px; padding: 12px 16px; align-items: flex-start; }
  .mobile-menu { display: grid; }
  .breadcrumb { margin-right: auto; margin-left: 11px; }
  .date-label { display: none; }
  .content { padding: 25px 16px 40px; }
  .page-heading { display: block; }
  .heading-actions { margin-top: 18px; }
  .dashboard-grid, .docs-grid, .playground-grid, .settings-grid { grid-template-columns: 1fr; }
  .model-grid { grid-template-columns: 1fr; }
  .cta-banner { display: block; padding: 23px; }
  .cta-banner .primary-button { margin-top: 18px; }
  .donut-layout { justify-content: center; flex-wrap: wrap; }
  .model-legend { width: 100%; }
  .search-input { min-width: 170px; flex: 1; }
  .data-panel .panel-header { align-items: flex-start; flex-direction: column; }
  .filter-bar { width: 100%; }
  .filter-bar .search-input { width: 100%; }
}
.version-tag { margin-left: auto; border: 1px solid var(--line); border-radius: 5px; padding: 3px 5px; color: var(--muted-2); font: 8px var(--mono); white-space: nowrap; }
.identity-badge { color: var(--purple); background: var(--purple-soft); border-radius: 5px; padding: 5px 8px; font-size: 10px; font-weight: 700; white-space: nowrap; }
.month-input { height: 37px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--ink); padding: 0 10px; font-size: 12px; outline: 0; }
.month-input:focus { border-color: #b8aaff; box-shadow: 0 0 0 3px var(--purple-soft); }
.summary-panel { padding: 0; overflow: hidden; }
.summary-panel .panel-header { padding: 20px 21px 16px; margin: 0; border-bottom: 1px solid var(--line); align-items: center; }
.summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.summary-metric { min-height: 92px; padding: 18px 21px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; justify-content: center; gap: 8px; }
.summary-metric:nth-child(3n) { border-right: 0; }
.summary-metric:nth-last-child(-n+3) { border-bottom: 0; }
.summary-metric span { color: var(--muted-2); font-size: 10px; }
.summary-metric strong { font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.live-indicator { display: inline-flex; align-items: center; gap: 6px; color: var(--green); background: var(--green-soft); border-radius: 5px; padding: 5px 8px; font-size: 10px; font-weight: 700; white-space: nowrap; }
.live-indicator::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
.cell-note { margin-top: 4px; color: var(--muted-2); font-size: 9px; font-weight: 400; }
.receipt-cell { max-width: 230px; overflow: hidden; text-overflow: ellipsis; }
.section-gap { margin-top: 15px; }
.warning-box { color: var(--amber); background: var(--amber-soft); border: 1px solid #f5dfad; border-radius: 7px; padding: 10px 12px; font-size: 10px; line-height: 1.6; }
.secret-meta { margin-top: 10px; color: #4b806b; }
.single-doc { grid-template-columns: minmax(0, 1fr); max-width: 920px; }
.bar-chart { min-height: 180px; display: flex; flex-direction: column; justify-content: center; gap: 13px; }
.bar-row { display: grid; grid-template-columns: minmax(70px, 120px) minmax(80px, 1fr) auto; align-items: center; gap: 10px; font-size: 10px; }
.bar-label { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { height: 8px; border-radius: 4px; background: #f0eff5; overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 4px; background: var(--purple); }
.bar-row strong { color: var(--ink); font: 10px var(--mono); }
.field span small { color: var(--muted-2); font-size: 9px; font-weight: 400; }
.auth-active .app-shell { visibility: hidden; }
.key-model-picker { border: 1px solid var(--line); border-radius: 8px; padding: 12px; min-width: 0; margin: 0; }
.key-model-picker legend { font-size: 12px; font-weight: 600; padding: 0 5px; }
.key-model-picker .form-hint { margin: 0 0 8px; }
.key-model-list { max-height: 210px; overflow-y: auto; overscroll-behavior: contain; }
.key-model-option { display: flex; align-items: center; gap: 9px; padding: 8px 0; overflow-wrap: anywhere; cursor: pointer; }
.key-model-option span { min-width: 0; }
.key-model-option input[type="checkbox"] { width: 18px; height: 18px; flex: 0 0 auto; accent-color: var(--purple); }
.key-model-picker button { margin-top: 8px; }
.modal-card { max-height: calc(100dvh - 40px); overflow-y: auto; overscroll-behavior: contain; }
.modal-card .modal-foot { position: sticky; bottom: 0; background: var(--surface); padding: 12px 0; z-index: 1; }

@media (max-width: 760px) {
  .identity-badge { display: none; }
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .summary-metric, .summary-metric:nth-child(3n), .summary-metric:nth-last-child(-n+3) { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
  .summary-metric:nth-child(2n) { border-right: 0; }
  .summary-metric:nth-last-child(-n+2) { border-bottom: 0; }
}

@media (max-width: 430px) {
  .auth-layer { padding: 12px 8px; }
  .auth-card { width: min(420px, calc(100vw - 16px)); padding: 24px 16px; }
  .auth-choice { grid-template-columns: 1fr; gap: 5px; }
  .auth-choice-button { padding: 8px 10px; text-align: left; }
  .auth-choice-button strong, .auth-choice-button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .kpi-grid { gap: 9px; }
  .kpi-card { padding: 14px; min-height: 108px; }
  .kpi-value { font-size: 19px; overflow-wrap: anywhere; }
  .panel { padding: 16px; }
  .data-panel, .summary-panel { padding: 0; }
  .field-row { grid-template-columns: 1fr; }
  .auth-card { padding: 30px 22px; }
  .summary-grid { grid-template-columns: 1fr; }
  .summary-metric, .summary-metric:nth-child(2n), .summary-metric:nth-child(3n), .summary-metric:nth-last-child(-n+2), .summary-metric:nth-last-child(-n+3) { border-right: 0; border-bottom: 1px solid var(--line); }
  .summary-metric:last-child { border-bottom: 0; }
  .secret-row, .field-action-row { align-items: stretch; flex-direction: column; }
  .auth-choice { grid-template-columns: 1fr; }
  .auth-choice-button { text-align: left; padding: 9px 11px; }
  .modal-foot { flex-wrap: wrap; }
}
