/* ZoneX desktop tokens: apps/desktop-ui/src/styles.css. */
:root {
  font-family: "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
  color-scheme: light;
  --bg: #f3f4f6;
  --surface: rgba(255,255,255,.66);
  --raised: #fff;
  --sink: rgba(20,24,31,.045);
  --text: #17191d;
  --muted: #62666e;
  --border: rgba(27,31,38,.10);
  --border-strong: rgba(27,31,38,.18);
  --accent: #0f766e;
  --accent-text: #fff;
  --accent-soft: rgba(15,118,110,.09);
  --error: #b9384e;
  --error-soft: rgba(185,56,78,.07);
  --success: #16705a;
  --focus: rgba(15,118,110,.24);
  --shadow: 0 18px 50px rgba(16,24,40,.09), 0 2px 8px rgba(16,24,40,.035);
}
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1012;
  --surface: rgba(28,29,33,.70);
  --raised: #202226;
  --sink: rgba(255,255,255,.055);
  --text: #f1f2f4;
  --muted: #a2a6af;
  --border: rgba(255,255,255,.09);
  --border-strong: rgba(255,255,255,.18);
  --accent: #5eead4;
  --accent-text: #102521;
  --accent-soft: rgba(94,234,212,.10);
  --error: #ff8ba0;
  --error-soft: rgba(255,113,136,.08);
  --success: #57d4aa;
  --focus: rgba(94,234,212,.24);
  --shadow: 0 18px 55px rgba(0,0,0,.32), 0 2px 8px rgba(0,0,0,.18);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-height: 100%; background: var(--bg); }
body { margin: 0; color: var(--text); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
::selection { background: var(--accent-soft); color: var(--accent); }
button, input, textarea, select { font: inherit; color: inherit; touch-action: manipulation; }
button, a, select { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { opacity: .5; cursor: not-allowed; }
a { color: var(--accent); text-underline-offset: 3px; }
button, a, input, textarea, select { transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: 28px; line-height: 1.25; letter-spacing: -.025em; font-weight: 600; }
h2 { margin-bottom: 14px; font-size: 17px; line-height: 1.4; letter-spacing: -.015em; font-weight: 600; }
p { max-width: 75ch; }
small { display: block; }
.shell { display: flex; min-height: 100dvh; }
.sidebar { width: 224px; padding: 28px 14px 18px; border-right: 1px solid var(--border); background: var(--surface); position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; flex-shrink: 0; }
.brand { display: flex; align-items: center; gap: 9px; padding: 0 10px; color: var(--text); text-decoration: none; font-size: 20px; font-weight: 650; letter-spacing: -.03em; }
.brand-mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--text); color: var(--bg); font-size: 20px; line-height: 1; font-weight: 650; font-style: italic; }
.brand-tag { margin-left: 2px; color: var(--muted); font-size: 12px; letter-spacing: 0; font-weight: 450; }
.nav-label { margin: 40px 12px 12px; color: var(--muted); font-size: 12px; }
.nav-item { width: 100%; display: flex; align-items: center; gap: 11px; margin: 3px 0; padding: 10px 12px; min-height: 42px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); text-align: left; font-size: 13px; }
.nav-item svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.nav-item:hover { background: var(--sink); color: var(--text); }
.nav-item.selected { background: var(--accent-soft); color: var(--accent); font-weight: 550; }
.sidebar-bottom { margin-top: auto; padding: 24px 12px 4px; color: var(--muted); font-size: 11px; }
.content { flex: 1; min-width: 0; }
.topbar { min-height: 68px; padding: 12px 36px; display: flex; gap: 20px; align-items: center; border-bottom: 1px solid var(--border); font-size: 13px; }
#breadcrumb { color: var(--muted); }
.preferences { display: flex; gap: 4px; align-items: center; margin-left: auto; }
.preference select { min-height: 34px; width: auto; padding: 5px 24px 5px 10px; background-color: transparent; border-color: transparent; font-size: 12px; color: var(--muted); }
.preference select:hover { background-color: var(--sink); }
.identity { display: flex; align-items: center; gap: 12px; }
#identity { max-width: 220px; overflow-wrap: anywhere; font-size: 12px; color: var(--muted); }
main { max-width: 1280px; padding: 38px 36px 64px; margin: 0 auto; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 30px; }
.subtitle, .muted { color: var(--muted); font-size: 13px; line-height: 1.75; }
.subtitle { margin-bottom: 0; }
.panel { border-radius: 12px; padding: 24px; background: var(--surface); border: 1px solid var(--border); min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 18px; }
.stack h2 { margin-bottom: 4px; }
.stack .muted { margin-bottom: 0; }
label { display: flex; flex-direction: column; gap: 8px; font-size: 13px; font-weight: 500; }
input, textarea, select { width: 100%; min-height: 42px; border: 1px solid var(--border-strong); border-radius: 8px; padding: 10px 12px; background: var(--raised); caret-color: var(--accent); }
input:hover, textarea:hover, select:hover { border-color: var(--muted); }
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; font-weight: 400; }
textarea { resize: vertical; }
.button { min-height: 40px; padding: 9px 15px; display: inline-flex; gap: 8px; align-items: center; justify-content: center; border: 1px solid transparent; border-radius: 8px; font-size: 13px; font-weight: 500; text-decoration: none; }
.button.primary { background: var(--accent); color: var(--accent-text); }
.button.primary:hover:not(:disabled) { background: color-mix(in srgb, var(--accent) 85%, var(--text)); }
.button.secondary { background: var(--raised); border-color: var(--border-strong); }
.button.secondary:hover:not(:disabled), .button.subtle:hover:not(:disabled) { background: var(--sink); }
.button.subtle { background: transparent; color: var(--muted); }
.button.small { min-height: 32px; padding: 5px 10px; font-size: 12px; }
[aria-busy="true"] .button.primary { opacity: .65; cursor: progress; }
.hint { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.75; }
.optional { color: var(--muted); font-size: 12px; }
.tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--border); margin-bottom: 28px; }
.tab { border: 0; border-bottom: 2px solid transparent; padding: 0 0 12px; background: transparent; color: var(--muted); font-size: 13px; }
.tab.active { border-bottom-color: var(--accent); color: var(--text); }
.auth-brand { display: flex; align-items: center; justify-content: center; gap: 11px; margin-bottom: 34px; }
.auth-brand h1 { margin: 0; font-size: 23px; letter-spacing: -.035em; }
.auth-brand .brand-mark { width: 34px; height: 34px; font-size: 24px; }
.account-grid { max-width: 360px; margin: auto; }
.auth-panel { padding: 0; border: 0; background: transparent; }
.signed-out .sidebar, .signed-out .topbar #breadcrumb, .signed-out .identity, .signed-out #view-account > .page-heading, .signed-out #initial-admin-notice { display: none; }
.signed-out .shell { min-height: 100dvh; }
.signed-out .content { display: flex; flex-direction: column; }
.signed-out .topbar { border: 0; min-height: 64px; }
.signed-out main { width: 100%; max-width: 440px; flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 24px 40px 104px; }
.signed-out #notice { order: 1; margin: 20px 0 0; }
.signed-out .auth-form .button.primary { margin-top: 6px; min-height: 44px; }
body[data-surface="admin"] .tabs, body[data-surface="admin"] #register-form, body[data-surface="admin"] #recover-form { display: none !important; }
body:not(.signed-out) .auth-brand { display: none; }
body:not(.signed-out) #email-actions { margin-top: 24px; }
.metrics { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); margin-bottom: 28px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.metric { min-width: 0; padding: 24px; }
.metric + .metric { border-left: 1px solid var(--border); }
.metric > span { font-size: 12px; color: var(--muted); }
.metric strong { display: block; margin: 14px 0 8px; font-size: 27px; line-height: 1.3; letter-spacing: -.025em; font-weight: 550; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.metric strong.email-value { font-size: 16px; }
.metric small { color: var(--muted); font-size: 12px; }
.two-column { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 24px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.panel-heading h2 { margin: 0; }
.space-top { margin-top: 24px; }
.pill { display: inline-flex; align-items: center; padding: 4px 9px; border-radius: 6px; background: var(--sink); color: var(--muted); font-size: 11px; }
.pill.warning { color: var(--muted); }
.secret { padding: 14px; border-radius: 8px; background: var(--sink); overflow-wrap: anywhere; font: 13px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; user-select: all; }
.notice { margin-bottom: 24px; padding: 12px 16px; border: 1px solid var(--border); border-radius: 8px; background: var(--accent-soft); color: var(--success); font-size: 13px; line-height: 1.65; overflow-wrap: anywhere; }
.notice.error { background: var(--error-soft); color: var(--error); }
.notice.pending { background: var(--sink); color: var(--muted); }
.notice .button { margin-top: 8px; }
.search-row { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 24px; }
.search-label { width: 320px; max-width: 100%; }
.table-wrap { max-width: 100%; overflow: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: 13px; white-space: nowrap; font-variant-numeric: tabular-nums; }
th { padding: 12px; border-bottom: 1px solid var(--border-strong); color: var(--muted); font-size: 12px; font-weight: 500; }
td { padding: 18px 12px; border-bottom: 1px solid var(--border); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--sink); }
td small { margin-top: 5px; font-size: 11px; color: var(--muted); }
td .actions { display: flex; gap: 6px; }
.table-wrap + .hint { margin-top: 18px; }
.empty { padding: 48px 20px; text-align: center; color: var(--muted); white-space: normal; }
.model-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 24px; }
.model-card h2 { overflow-wrap: anywhere; margin-bottom: 24px; }
.detail-list { margin-top: 24px; }
.detail-row { display: flex; justify-content: space-between; gap: 24px; padding: 11px 0; border-bottom: 1px solid var(--border); font-size: 12px; }
.detail-row > span:first-child { color: var(--muted); }
.detail-row > span:last-child { text-align: right; overflow-wrap: anywhere; }
.model-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.panel-heading .model-actions { margin-top: 0; }
dialog { width: min(520px,calc(100vw - 32px)); max-height: calc(100dvh - 48px); padding: 28px; border: 0; border-radius: 16px; background: var(--raised); color: var(--text); box-shadow: var(--shadow); overflow: auto; }
dialog::backdrop { background: rgba(10,13,18,.42); }
.icon-button { display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 24px; }
.icon-button:hover { background: var(--sink); }
.dialog-status, #credit-status { margin: 0; color: var(--error); font-size: 13px; line-height: 1.65; }
.setup-topbar { display: flex; align-items: center; gap: 16px; padding: 20px 32px; }
.setup-page main { max-width: 1080px; }
.setup-page .two-column { grid-template-columns: minmax(0,1.4fr) minmax(0,1fr); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.skip-link { position: fixed; top: -100px; left: 20px; z-index: 100; padding: 12px 16px; border-radius: 8px; background: var(--raised); }
.skip-link:focus { top: 12px; }
@media (max-width: 1100px) {
  .sidebar { width: 200px; }
  main { padding: 28px 24px 48px; }
  .topbar { padding-inline: 24px; }
  .metrics { grid-template-columns: 1fr; }
  .metric { padding: 20px 24px; }
  .metric + .metric { border-left: 0; border-top: 1px solid var(--border); }
  .metric strong { font-size: 24px; }
}
@media (max-width: 800px) {
  .shell { display: block; }
  .sidebar { position: static; width: 100%; height: auto; padding: 20px 16px 12px; border-right: 0; border-bottom: 1px solid var(--border); }
  .sidebar nav { display: flex; overflow-x: auto; gap: 4px; margin-top: 20px; }
  .nav-label, .sidebar-bottom { display: none; }
  .nav-item { width: auto; flex-shrink: 0; margin: 0; padding: 10px; font-size: 12px; }
  .nav-item svg { width: 16px; height: 16px; }
  .topbar { flex-wrap: wrap; padding: 12px 20px; gap: 10px; }
  .topbar > #breadcrumb { display: none; }
  .topbar .preferences { margin-left: 0; }
  .identity { margin-left: auto; }
  #identity { display: none; }
  main { padding: 28px 20px 40px; }
  h1 { font-size: 25px; }
  .page-heading { align-items: flex-start; flex-wrap: wrap; margin-bottom: 24px; }
  .page-heading > .pill { display: none; }
  .two-column, .model-grid, .setup-page .two-column { grid-template-columns: minmax(0,1fr); gap: 20px; }
  .panel { padding: 20px; }
  .panel-heading { flex-wrap: wrap; }
  .search-row { gap: 8px; }
  .search-row > label { flex: 1; min-width: 0; }
  .search-row > .button { flex-shrink: 0; }
  .signed-out main { max-width: 400px; padding: 24px 28px 88px; }
  .signed-out .topbar { justify-content: flex-end; }
  .signed-out .topbar .preferences { margin-left: auto; }
  .signed-out .auth-panel { padding: 0; }
  .setup-topbar { padding: 16px 20px; }
  dialog { padding: 22px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; } }
.help-section { color: var(--muted); font-size: 12px; }
.help-section summary { width: fit-content; cursor: pointer; padding: 6px 0; color: var(--text); font-size: 13px; }
.help-section > p { margin-top: 12px; margin-bottom: 0; }
.field-row { display: grid; grid-template-columns: minmax(0,1fr) 140px; gap: 16px; }
.settings-columns { grid-template-columns: minmax(0,1.5fr) minmax(0,1fr); align-items: start; }
.sidebar-product { color: var(--text); font-weight: 600; }
.sidebar-bottom { display: flex; gap: 6px; }
@media (max-width: 800px) { .settings-columns { grid-template-columns: minmax(0,1fr); } .sidebar-bottom { display: none; } .field-row { grid-template-columns: minmax(0,1fr) 110px; gap: 10px; } }
.menu-toggle { display: none; }
.menu-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.nav-item[data-view="account"] { margin-top: 24px; }
@media (max-width: 800px) {
  .sidebar { flex-direction: row; align-items: center; flex-wrap: wrap; gap: 0; padding-block: 14px; }
  .menu-toggle { display: grid; margin-left: auto; }
  .sidebar nav { display: none; width: 100%; overflow: visible; }
  .sidebar[data-open] nav { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
  .nav-item[data-view="account"] { margin-top: 0; }
}
.resource-list { padding: 12px 20px; }
.resource-list table { font-size: 12px; }
.resource-list th { font-size: 11px; }
.resource-list td { vertical-align: middle; }
.resource-models { max-width: 230px; min-width: 150px; white-space: normal; overflow-wrap: anywhere; }
.table-hint { margin: 16px 12px 8px; }
.pill.enabled { background: var(--accent-soft); color: var(--accent); }
.metric strong.number-value { white-space: nowrap; overflow-wrap: normal; overflow-x: auto; }
.metric strong.wide-number { font-size: 20px; }
.icon-button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.space-bottom { margin-bottom: 24px; }
.filter-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)) auto; gap: 12px; align-items: end; margin-bottom: 24px; }
.sidebar nav { min-height: 0; overflow-y: auto; }
.resource-list .button + .button { margin-left: 6px; }
@media(max-width:1100px) { .filter-grid { grid-template-columns: repeat(2,minmax(0,1fr)); } }
@media(max-width:800px) { .filter-grid { grid-template-columns: minmax(0,1fr); } .sidebar nav { overflow: visible; } input,textarea,select { font-size: 16px; } }

.dashboard-filter { margin-bottom:24px; }
.dashboard-presets { display:flex; flex-wrap:wrap; gap:8px; margin-bottom:16px; }
.dashboard-filter .filter-grid { grid-template-columns:repeat(4,minmax(0,1fr)); }
.dashboard-facts { display:flex; flex-wrap:wrap; gap:20px 36px; padding:20px 0; margin:0; border-block:1px solid var(--border); }
.dashboard-facts dt { font-size:12px; color:var(--muted); margin-bottom:6px; }
.dashboard-facts dd { margin:0; font-size:20px; font-weight:600; font-variant-numeric:tabular-nums; overflow-wrap:anywhere; }
.dashboard-columns { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:24px; }
.dashboard-columns .panel { min-width:0; padding:24px; }
.dashboard-columns h2 { margin:0 0 20px; font-size:16px; }
.dashboard-chart svg { display:block; width:100%; height:auto; min-height:140px; }
.chart-grid { stroke:var(--border); stroke-width:1; }
.chart-label { fill:var(--muted); font-size:12px; font-variant-numeric:tabular-nums; }
.chart-line { fill:none; stroke:var(--accent); stroke-width:2.5; stroke-linejoin:round; stroke-linecap:round; }
.chart-dates { display:flex; justify-content:space-between; gap:16px; font-size:11px; color:var(--muted); }
.dashboard-detail { margin:0; }
.dashboard-detail > div { display:flex; justify-content:space-between; gap:24px; padding:10px 0; border-bottom:1px solid var(--border); }
.dashboard-detail dt { color:var(--muted); }
.dashboard-detail dd { margin:0; text-align:right; font-variant-numeric:tabular-nums; overflow-wrap:anywhere; }
.usage-window-fieldset { min-width:0; border:1px solid var(--border); border-radius:8px; padding:16px; margin:8px 0; }
.usage-window-row { display:grid; grid-template-columns:1fr 1fr; gap:12px; border-bottom:1px solid var(--border); padding-bottom:16px; }
.usage-window-row .button { justify-self:start; }
@media(max-width:1100px) { .dashboard-filter .filter-grid {grid-template-columns:repeat(2,minmax(0,1fr));} .dashboard-columns {grid-template-columns:minmax(0,1fr);} }
@media(max-width:800px) { .dashboard-filter .filter-grid,.usage-window-row {grid-template-columns:minmax(0,1fr);} .dashboard-columns .panel {padding:16px;} .dashboard-facts {gap:16px 24px;} .dashboard-detail > div {flex-wrap:wrap;gap:6px;} .dashboard-detail dd {text-align:left;} }
