:root {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-synthesis: none; -webkit-font-smoothing: antialiased;
  color-scheme: light; color: var(--text); background: var(--page);
  --page: #f5f5f7; --surface: #fff; --surface-soft: #fafafa; --text: #1d1d1f;
  --secondary: #6e6e73; --muted: #86868b; --line: #e5e5e9; --line-soft: #f0f0f2;
  --nav: #fbfbfddc; --hover: #f5f5f7; --input: #fff; --input-line: #d2d2d7;
  --accent: #0071e3; --accent-hover: #0077ed; --focus: #0071e330;
  --badge: #f1f6f3; --badge-text: #4d7960; --warn: #faf4e9; --warn-text: #9b753c;
  --error-bg: #fcf0ed; --error: #b65043; --code: #f5f5f7;
  --shadow: 0 3px 16px #00000003; --brand: #1d1d1f; --brand-text: #fff;
}
:root[data-theme="dark"] {
  color-scheme: dark; --page: #000; --surface: #141416; --surface-soft: #18181b;
  --text: #f5f5f7; --secondary: #a1a1a6; --muted: #85858b;
  --line: #2b2b30; --line-soft: #252529; --nav: #101012de; --hover: #222226;
  --input: #1c1c1f; --input-line: #3b3b40; --accent: #2997ff; --accent-hover: #50aaff;
  --focus: #2997ff33; --badge: #1c2a23; --badge-text: #92b19d;
  --warn: #2b251b; --warn-text: #c7a775; --error-bg: #301e1c; --error: #dc9386;
  --code: #1c1c1f; --shadow: none; --brand: #f5f5f7; --brand-text: #1d1d1f;
}
* { box-sizing: border-box; }
html, body, .topbar, button, input, select, .metric, .records-section, .settings-panel, .login-card, th, td, .config-details pre, .new-key-box, .badge, .brand-mark, .toast, .page-footer {
  transition: background-color .32s ease, color .32s ease, border-color .32s ease, box-shadow .32s ease;
}
body { margin: 0; }
button, input, select { font: inherit; }
button, a, input { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .42; }
button:focus-visible, a:focus-visible, summary:focus-visible, select:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
input:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus); }
[hidden] { display: none !important; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }
.topbar { height: 76px; border-bottom: 1px solid var(--line); padding: 0 max(32px, calc((100vw - 1180px) / 2)); display: flex; align-items: center; justify-content: space-between; background: var(--nav); backdrop-filter: blur(20px); }
.brand { display: flex; align-items: center; gap: 12px; font-size: 16px; font-weight: 600; letter-spacing: -.4px; white-space: nowrap; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--brand); color: var(--brand-text); font: 600 26px/28px Georgia, serif; text-align: center; position: relative; }
.brand-mark span { font-size: 26px; opacity: .6; position: absolute; bottom: -3px; right: 3px; }
.brand-light { font-weight: 400; color: var(--secondary); }
.topbar-right, .header-actions { display: flex; align-items: center; gap: 23px; }
.topbar-right { gap: 19px; }
.connection { font-size: 11px; color: var(--secondary); display: flex; align-items: center; gap: 7px; }
.connection::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--muted); }
.connection.ready::before { background: #65a77d; }
.connection.expired::before { background: #cba15e; }
.theme-toggle { display: flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: transparent; padding: 7px 11px; border-radius: 30px; font-size: 11px; color: var(--secondary); }
.theme-toggle:hover { color: var(--text); background: var(--hover); }
main { max-width: 1180px; margin: 0 auto; padding: 65px 0 28px; }
h1 { font-size: 42px; line-height: 1.23; font-weight: 600; letter-spacing: -1.9px; margin-top: 14px; }
h2 { font-size: 19px; font-weight: 600; letter-spacing: -.5px; }
.eyebrow { font-size: 10px; letter-spacing: 2px; color: var(--muted); font-weight: 500; }
.intro { color: var(--secondary); font-size: 15px; line-height: 1.8; margin-top: 12px; letter-spacing: -.2px; }
.page-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 49px; }
.heading-buttons { display: flex; gap: 10px; align-items: center; }
.primary, .secondary, .small-button { border: 1px solid var(--line); border-radius: 30px; padding: 11px 18px; background: var(--surface); color: var(--text); line-height: 1.3; font-size: 12px; font-weight: 400; white-space: nowrap; }
.primary { background: var(--accent); border-color: transparent; color: #fff; }
.primary:hover { background: var(--accent-hover); }
.secondary:hover, .small-button:hover { background: var(--hover); border-color: var(--input-line); }
.secondary span { padding-left: 9px; color: var(--secondary); }
.text-button, .icon-button { border: 0; background: transparent; color: var(--secondary); padding: 8px; font-size: 12px; }
.text-button:hover, .icon-button:hover { color: var(--accent); }
.icon-button { font-size: 22px; line-height: 1; }
.compact { padding: 8px 13px; font-size: 11px; }
.quiet { font-size: 12px; line-height: 1.7; color: var(--secondary); }
.toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 21px; gap: 12px; }
.filters { display: flex; align-items: center; gap: 17px; flex-wrap: wrap; }
.month-control { display: flex; align-items: center; gap: 5px; }
.month-control input { border: 0; border-radius: 7px; background: transparent; color: var(--text); font-size: 14px; width: 150px; padding: 6px; }
.timezone { font-size: 9px; color: var(--muted); letter-spacing: .5px; margin-left: 4px; }
select { font-size: 11px; padding: 8px 25px 8px 12px; max-width: 185px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); color: var(--secondary); }
.toolbar-actions { display: flex; gap: 8px; align-items: center; }
.load-status { font-size: 10px; color: var(--muted); margin-right: 7px; }
.load-status.error, .form-status.error { color: var(--error); }
.metrics { display: grid; grid-template-columns: 1.1fr 1fr 1fr 1fr; gap: 16px; margin-bottom: 31px; }
.metric { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 26px 25px 24px; min-height: 170px; box-shadow: var(--shadow); }
.metric-label { font-size: 12px; color: var(--secondary); display: flex; justify-content: space-between; align-items: center; }
.metric-symbol { font-size: 16px; line-height: 12px; color: var(--muted); }
.metric-value { font-variant-numeric: tabular-nums; font-size: 34px; font-weight: 550; letter-spacing: -1.2px; margin: 20px 0 12px; white-space: nowrap; line-height: 1.2; }
.metric p { font-size: 10px; color: var(--muted); line-height: 1.5; }
.records-section { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; box-shadow: var(--shadow); }
.records-heading { display: flex; align-items: center; justify-content: space-between; padding: 0 25px; border-bottom: 1px solid var(--line); min-height: 68px; gap: 12px; }
.records-heading > .quiet { font-size: 10px; color: var(--muted); }
.tabs { display: flex; gap: 27px; align-self: stretch; }
.tabs button { font-size: 12px; background: none; border: 0; border-bottom: 2px solid transparent; padding: 22px 0; color: var(--muted); white-space: nowrap; }
.tabs button[aria-selected="true"] { border-bottom-color: var(--text); color: var(--text); font-weight: 500; }
.table-scroll { overflow: auto; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; font-size: 12px; }
th { background: var(--surface-soft); color: var(--muted); font-size: 10px; font-weight: 400; text-align: right; padding: 15px 17px; border-bottom: 1px solid var(--line-soft); }
td { padding: 18px 17px; border-bottom: 1px solid var(--line-soft); text-align: right; font-variant-numeric: tabular-nums; color: var(--secondary); }
td:first-child, th:first-child { text-align: left; padding-left: 25px; }
td:nth-child(2), th:nth-child(2) { text-align: left; }
td:last-child, th:last-child { padding-right: 25px; }
tbody tr:hover td { background: var(--surface-soft); }
.cell-main { color: var(--text); font-size: 12px; }
.cell-sub { font-size: 10px; color: var(--muted); margin-top: 5px; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 11px; }
.badge { display: inline-block; font-size: 10px; padding: 4px 8px; background: var(--badge); color: var(--badge-text); border-radius: 5px; }
.badge.warning { background: var(--warn); color: var(--warn-text); }
.badge.error { background: var(--error-bg); color: var(--error); }
.table-footer { display: flex; align-items: center; justify-content: space-between; padding: 11px 17px 11px 25px; min-height: 50px; gap: 12px; }
.table-footer .quiet, .table-footer button { font-size: 10px; }
.ledger-note { font-size: 10px; line-height: 1.9; color: var(--muted); max-width: 1060px; margin-top: 20px; }
.page-footer { margin-top: 44px; border-top: 1px solid var(--line); padding-top: 19px; display: flex; justify-content: space-between; gap: 15px; font-size: 10px; color: var(--muted); }
.empty-state { text-align: center; padding: 56px 15px 65px; color: var(--muted); }
.empty-icon { font-size: 28px; margin-bottom: 16px; color: var(--muted); }
.empty-state h3 { font-size: 16px; font-weight: 500; color: var(--secondary); margin-bottom: 10px; }
.empty-state p { font-size: 12px; line-height: 1.9; }
.settings-panel { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; margin: 0 0 28px; padding: 29px; box-shadow: var(--shadow); }
.section-heading { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 25px; gap: 12px; }
.section-heading p { margin-top: 8px; font-size: 11px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.field.full { grid-column: 1/-1; }
label { font-size: 12px; color: var(--secondary); display: block; margin-bottom: 9px; }
input { border: 1px solid var(--input-line); border-radius: 10px; padding: 12px 13px; width: 100%; background: var(--input); color: var(--text); font-size: 13px; min-width: 0; }
input::placeholder { color: var(--muted); font-size: 12px; opacity: .8; }
.field-help { font-size: 10px; color: var(--muted); margin-top: 9px; line-height: 1.8; }
.input-actions { display: flex; gap: 8px; }
.small-button { font-size: 11px; padding: 8px 12px; }
.form-footer { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-top: 26px; }
.form-status { font-size: 12px; line-height: 1.7; color: var(--secondary); min-height: 20px; }
.endpoint-row { display: flex; align-items: center; gap: 15px; border-top: 1px solid var(--line); padding-top: 19px; margin-top: 25px; font-size: 11px; color: var(--muted); }
.endpoint-row code { color: var(--secondary); overflow-wrap: anywhere; flex: 1; font-size: 11px; }
.config-details { font-size: 11px; color: var(--secondary); margin-top: 17px; }
.config-details summary { cursor: pointer; padding: 5px 0; color: var(--accent); }
.config-details p { margin: 14px 0; font-size: 11px; }
.config-details pre { font-size: 11px; line-height: 1.8; overflow: auto; background: var(--code); padding: 20px; border-radius: 12px; color: var(--secondary); }
.key-create-form { display: grid; grid-template-columns: 1fr 1.25fr auto; gap: 16px; align-items: end; }
.optional { font-size: 10px; color: var(--muted); font-weight: 400; margin-left: 5px; }
.key-create-form > .primary { height: 43px; }
.key-status { margin: 16px 0; }
.new-key-box { background: var(--surface-soft); border: 1px solid var(--line); border-radius: 12px; padding: 20px; margin: 18px 0 25px; }
.new-key-box label { font-size: 11px; }
.new-key-box input { font-family: ui-monospace, monospace; font-size: 12px; }
.keys-table td, .keys-table th { padding: 16px 12px; }
.keys-table td:first-child, .keys-table th:first-child { padding-left: 0; }
.keys-table td:last-child, .keys-table th:last-child { padding-right: 0; }
.key-note { font-size: 10px; margin-top: 18px; color: var(--muted); }
.danger-button { color: var(--error); }
.key-actions { display: flex; justify-content: flex-end; gap: 4px; }
.key-actions button { font-size: 11px; }
.login-view { max-width: 445px; margin: 26px auto 0; text-align: center; }
.login-view h1 { font-size: 46px; line-height: 1.24; letter-spacing: -2px; margin-top: 21px; }
.login-view .intro { margin-top: 20px; font-size: 14px; }
.login-card { background: var(--surface); border: 1px solid var(--line); padding: 31px; border-radius: 20px; margin: 34px 0 20px; text-align: left; }
.login-card input { margin-bottom: 22px; padding: 14px; }
.login-card .primary { width: 100%; display: flex; justify-content: space-between; padding: 13px 18px; }
.login-card .form-status { margin-top: 16px; }
.login-view > .quiet { font-size: 11px; line-height: 1.85; color: var(--muted); }
.boot-status { text-align: center; color: var(--secondary); font-size: 13px; margin: 70px; }
.toast { position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%); background: var(--brand); color: var(--brand-text); padding: 13px 24px; border-radius: 30px; box-shadow: 0 6px 24px #00000015; font-size: 12px; max-width: 90vw; z-index: 3; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
@media (min-width: 1450px) {
  main { padding-top: 76px; } .page-heading { margin-bottom: 57px; }
  h1 { font-size: 46px; } .metric { min-height: 180px; } .metric-value { font-size: 37px; }
}
@media (max-width: 1250px) {
  main { padding: 53px 28px 24px; } .topbar { padding: 0 28px; }
  .metric { padding: 24px 21px; } .metric-value { font-size: 30px; }
}
@media (max-width: 930px) {
  .metrics { grid-template-columns: repeat(2, 1fr); } .metric { min-height: 156px; }
  .metric-value { font-size: 34px; } .toolbar { flex-wrap: wrap; }
  .toolbar-actions { margin-left: auto; }
  .key-create-form { grid-template-columns: 1fr 1fr; }
  .key-create-form > .primary { grid-column: 1/-1; justify-self: end; }
}
@media (max-width: 700px) {
  h1 { font-size: 34px; } .intro { font-size: 13px; } .page-heading { margin-bottom: 35px; }
  .heading-buttons { flex-direction: column; gap: 8px; align-items: flex-end; }
  .heading-buttons .secondary { font-size: 11px; padding: 10px 13px; }
  .form-grid { grid-template-columns: 1fr; } .load-status { font-size: 9px; }
  .connection { display: none; } .topbar-right, .header-actions { gap: 11px; }
  .filters { gap: 10px; } .metric { border-radius: 16px; }
}
@media (max-width: 550px) {
  .topbar { height: 65px; padding: 0 18px; } .brand { font-size: 13px; gap: 8px; }
  .brand-light { font-size: 11px; } .brand-mark { width: 27px; height: 27px; font-size: 24px; line-height: 25px; }
  .theme-toggle { padding: 7px 8px; border-color: transparent; } .theme-toggle span { display: none; }
  .header-actions .text-button { font-size: 10px; padding: 5px; }
  main { padding: 34px 18px 21px; } h1 { font-size: 29px; letter-spacing: -1.2px; }
  .eyebrow { font-size: 8px; letter-spacing: 1.5px; } .intro { font-size: 12px; }
  .page-heading .secondary span { display: none; } .heading-buttons .secondary { font-size: 10px; padding: 9px 11px; }
  .metrics { gap: 10px; margin-bottom: 24px; } .metric { padding: 20px 17px; min-height: 145px; }
  .metric-value { font-size: 26px; margin: 19px 0 11px; }
  .metric p { font-size: 9px; } .metric-label { font-size: 11px; }
  .toolbar-actions { width: 100%; justify-content: flex-end; }
  .load-status { margin-right: auto; font-size: 9px; }
  .filters { width: 100%; justify-content: space-between; gap: 7px; }
  select { max-width: 139px; font-size: 10px; padding-left: 10px; }
  .month-control { gap: 1px; } .month-control input { width: 132px; font-size: 13px; }
  .timezone { margin-left: 0; font-size: 8px; }
  .records-section, .settings-panel { border-radius: 16px; }
  .records-heading { padding: 0 16px 7px; min-height: 56px; flex-wrap: wrap; gap: 0; }
  .tabs { gap: 19px; } .tabs button { font-size: 10px; padding: 19px 0 16px; }
  .records-heading > .quiet { font-size: 9px; margin-left: auto; }
  .table-footer { padding: 8px 10px 8px 16px; }
  .table-footer .quiet, .table-footer button { font-size: 9px; }
  .table-footer button { padding: 7px; }
  .page-footer { flex-direction: column; gap: 8px; margin-top: 30px; font-size: 9px; }
  .ledger-note { font-size: 9px; } .settings-panel { padding: 21px; }
  .section-heading p { font-size: 10px; } .section-heading h2 { font-size: 17px; }
  .endpoint-row { gap: 9px; } .endpoint-row > span { display: none; }
  .form-footer { flex-direction: column; align-items: stretch; gap: 10px; }
  .form-footer .primary { align-self: flex-end; }
  .login-view { margin: 24px auto 0; } .login-view h1 { font-size: 39px; }
  .login-view .intro { font-size: 12px; } .login-card { padding: 25px; }
  .boot-status { margin: 60px 0; }
  .key-create-form { grid-template-columns: 1fr; }
  .key-actions { gap: 0; } .key-actions button { padding: 7px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}

