:root {
  color-scheme: light;
  font-family: "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  color: #182328;
  background: #f5f7f6;
  --surface: #fff;
  --surface-soft: #fbfcfb;
  --line: #dfe6e3;
  --muted: #6e7b78;
  --accent: #0d8a63;
  --accent-soft: #e9f7f0;
  --accent-dark: #08724f;
  --ink: #182328;
  --danger: #b42318;
}
* { box-sizing: border-box; }
html { min-width: 320px; background: #f5f7f6; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: #f5f7f6; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
a { color: inherit; text-decoration: none; }
code { font-family: "Cascadia Code", Consolas, monospace; }
[hidden] { display: none !important; }

.login-page { min-height: 100vh; padding: 28px 24px; color: var(--ink); }
.login-brand { display: flex; align-items: center; gap: 12px; max-width: 1120px; margin: 0 auto; }
.login-brand span:last-child, .sidebar-brand span:last-child { display: grid; gap: 3px; min-width: 0; }
.login-brand strong, .sidebar-brand strong { font-size: 14px; font-weight: 700; }
.login-brand small, .sidebar-brand small { color: var(--muted); font-size: 11px; }
.brand-mark { display: grid; width: 38px; height: 38px; place-items: center; flex: 0 0 auto; border-radius: 9px; background: #12a36f; color: #fff; font-size: 17px; font-weight: 800; box-shadow: 0 7px 16px rgba(13, 138, 99, .18); }
.login-card-wrap { display: grid; place-items: center; min-height: calc(100vh - 100px); padding: 52px 0; }
.login-intro { max-width: 470px; margin-bottom: 24px; text-align: center; }
.icon-badge { display: grid; width: 58px; height: 58px; place-items: center; margin: 0 auto 18px; border: 1px solid #cdeedd; border-radius: 17px; background: #fff; color: var(--accent); box-shadow: 0 12px 28px rgba(15, 55, 39, .07); }
.icon-badge svg { width: 25px; height: 25px; }
.login-intro h1 { margin: 0; font-size: 28px; letter-spacing: -.02em; }
.login-intro p { margin: 11px 0 0; color: var(--muted); font-size: 14px; line-height: 1.7; }
.login-card { width: min(430px, 100%); padding: 24px; border: 1px solid var(--line); background: var(--surface); box-shadow: 0 20px 60px rgba(19, 41, 32, .08); }
.login-card label { display: block; margin-bottom: 8px; font-size: 13px; font-weight: 650; }
.login-card input { width: 100%; height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 7px; outline: 0; background: #fbfdfc; color: var(--ink); font-family: "Cascadia Code", Consolas, monospace; font-size: 12px; }
.login-card input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(13, 138, 99, .1); }
.form-error { margin: 9px 0 0; color: var(--danger); font-size: 12px; line-height: 1.5; }
.button { display: inline-flex; min-height: 40px; align-items: center; justify-content: center; gap: 8px; padding: 0 14px; border: 1px solid transparent; border-radius: 7px; cursor: pointer; font-size: 12px; font-weight: 650; white-space: nowrap; }
.button svg { width: 16px; height: 16px; }
.button:disabled { opacity: .55; cursor: not-allowed; }
.button-wide { width: 100%; margin-top: 16px; }
.button-dark { color: #fff; border-color: #172127; background: #172127; }
.button-dark:hover { background: #2b373e; }
.button-green { color: #fff; border-color: var(--accent); background: var(--accent); }
.button-green:hover { background: var(--accent-dark); }
.button-light { color: #40504b; border-color: var(--line); background: #fff; }
.button-light:hover { border-color: #becdc6; background: #f8fbf9; }
.privacy-note { display: flex; align-items: center; justify-content: center; gap: 7px; margin: 15px 0 0; color: var(--muted); font-size: 11px; }
.remember-option { display: flex; align-items: flex-start; gap: 9px; margin-top: 15px; color: #40504b; cursor: pointer; font-size: 12px; line-height: 1.35; }
.remember-option input { width: 15px; height: 15px; margin: 1px 0 0; accent-color: var(--accent); }
.remember-option span { display: grid; gap: 3px; }
.remember-option strong { font-weight: 650; }
.remember-option small { color: var(--muted); font-size: 11px; }
.privacy-note svg { width: 15px; height: 15px; color: var(--accent); }

.portal-page { display: flex; min-height: 100vh; max-width: 1500px; margin: 0 auto; background: var(--surface); }
.sidebar { display: flex; width: 245px; flex: 0 0 245px; flex-direction: column; padding: 20px 16px; border-right: 1px solid var(--line); background: var(--surface-soft); }
.sidebar-brand { display: flex; align-items: center; gap: 11px; padding: 2px 7px; }
.balance-card { margin-top: 22px; padding: 15px; border: 1px solid #cdeedd; background: var(--accent-soft); }
.balance-card small { display: block; color: #27755a; font-size: 11px; font-weight: 650; }
.balance-card strong { display: block; margin-top: 4px; color: var(--accent-dark); font-size: 29px; line-height: 1.1; letter-spacing: -.02em; }
.balance-card span { display: block; margin-top: 5px; color: #46816b; font-size: 10px; }
.side-nav { display: grid; gap: 3px; margin-top: 18px; }
.nav-item { display: flex; width: 100%; min-height: 38px; align-items: center; gap: 10px; padding: 0 11px; border: 0; border-radius: 6px; background: transparent; color: #65736f; cursor: pointer; font-size: 12px; text-align: left; }
.nav-item svg { width: 16px; height: 16px; }
.nav-item:hover { background: #edf2ef; color: var(--ink); }
.nav-item.active { background: var(--accent-soft); color: var(--accent-dark); font-weight: 650; }
.sidebar-actions { display: grid; gap: 3px; margin-top: auto; padding-top: 28px; }
.portal-content { min-width: 0; flex: 1; }
.portal-header { display: flex; min-height: 64px; align-items: center; justify-content: flex-end; gap: 15px; padding: 0 30px; border-bottom: 1px solid var(--line); }
.connection-state { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; }
.connection-state b { width: 7px; height: 7px; border-radius: 99px; background: #24b47e; }
.mobile-brand, .mobile-nav { display: none; }
.content-inner { padding: 30px; }
.page-view { max-width: 1120px; margin: 0 auto; }
.page-heading { margin-bottom: 21px; }
.page-heading small { color: var(--accent-dark); font-size: 12px; font-weight: 650; }
.page-heading h1 { margin-top: 5px; font-size: 25px; letter-spacing: -.02em; }
.page-heading p { margin-top: 5px; color: var(--muted); font-size: 13px; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); background: #fff; }
.metric-card { min-width: 0; padding: 18px; border-right: 1px solid var(--line); }
.metric-card:last-child { border-right: 0; }
.metric-card small { display: block; color: var(--muted); font-size: 11px; }
.metric-card strong { display: block; margin-top: 9px; overflow: hidden; font-size: 20px; text-overflow: ellipsis; white-space: nowrap; }
.metric-card.accent strong { color: var(--accent-dark); font-size: 26px; }
.console-grid { display: grid; grid-template-columns: minmax(0, 1fr) 345px; gap: 22px; margin-top: 22px; }
.stack-panels { display: grid; align-content: start; gap: 22px; }
.panel { min-width: 0; border: 1px solid var(--line); background: #fff; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 17px; border-bottom: 1px solid var(--line); }
.panel-heading > div { display: flex; align-items: flex-start; gap: 10px; }
.panel-heading > div > svg, .panel-heading > svg { width: 17px; height: 17px; flex: 0 0 auto; margin-top: 1px; color: var(--accent); }
.panel-heading h2 { font-size: 14px; }
.panel-heading p { margin-top: 5px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.panel-heading.compact { align-items: center; justify-content: flex-start; gap: 9px; padding: 13px 15px; }
.panel-heading.compact h2 { font-size: 13px; }
.panel-heading.compact svg { width: 16px; height: 16px; color: var(--accent); }
.panel-count { margin-left: auto; color: var(--muted); font-size: 11px; font-weight: 500; }
.guide-step { position: relative; display: flex; gap: 12px; padding: 17px; }
.guide-step:not(.last)::after { position: absolute; top: 42px; bottom: -17px; left: 28px; width: 1px; background: var(--line); content: ''; }
.guide-step > b { position: relative; z-index: 1; display: grid; width: 23px; height: 23px; flex: 0 0 23px; place-items: center; border-radius: 99px; background: #20a978; color: #fff; font-size: 11px; }
.guide-step h3 { font-size: 12px; }
.guide-step p { margin-top: 5px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.guide-step code, .mac-guide code { font-size: 11px; }
.download-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 11px; }
.download-row .button { min-height: 35px; }
.secret-line, .command-line { display: flex; min-width: 0; align-items: center; margin-top: 9px; border: 1px solid var(--line); background: #fafcfb; }
.secret-line code, .command-line code { min-width: 0; flex: 1; overflow: hidden; padding: 9px 11px; text-overflow: ellipsis; white-space: nowrap; }
.icon-button { display: inline-grid; width: 31px; height: 31px; flex: 0 0 31px; place-items: center; padding: 0; border: 0; border-radius: 5px; background: transparent; color: #72807b; cursor: pointer; }
.icon-button:hover { background: #eef3f0; color: var(--ink); }
.icon-button svg { width: 15px; height: 15px; }
.secret-line .icon-button, .command-line .icon-button { border-left: 1px solid var(--line); border-radius: 0; }
.mac-guide { margin: 0 17px 17px; padding: 14px; border: 1px solid #d5e9df; background: #f4fbf7; }
.mac-guide h3 { display: flex; align-items: center; gap: 7px; font-size: 12px; }
.mac-guide h3 svg { width: 15px; height: 15px; color: var(--accent); }
.mac-guide p { margin-top: 5px; color: var(--muted); font-size: 11px; }
.command-line { margin-top: 10px; border-color: #d5e9df; background: #fff; }
.config-fields { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 17px 17px; }
.config-fields span { padding: 5px 7px; border: 1px solid #d5e9df; background: #f4fbf7; color: #34735d; font-size: 10px; }
.info-list { margin: 0; }
.info-list > div { padding: 14px 15px; border-bottom: 1px solid #edf1ef; }
.info-list > div:last-child { border-bottom: 0; }
.info-list dt { color: var(--muted); font-size: 10px; }
.info-list dd { display: flex; min-width: 0; align-items: center; gap: 4px; margin: 5px 0 0; }
.info-list dd code { min-width: 0; flex: 1; overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.model-list { max-height: 300px; overflow: auto; }
.model-row { padding: 12px 15px; border-bottom: 1px solid #edf1ef; }
.model-row:last-child { border-bottom: 0; }
.model-row-head { display: flex; min-width: 0; align-items: baseline; justify-content: space-between; gap: 8px; }
.model-row-head strong { min-width: 0; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.model-row-head > span { flex: 0 0 auto; color: var(--muted); font-size: 9px; }
.model-description { display: -webkit-box; margin-top: 5px; overflow: hidden; color: var(--muted); font-size: 10px; line-height: 1.45; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.model-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; color: #52625c; font-size: 10px; }
.model-badges { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.model-badge { padding: 3px 5px; border: 1px solid #dfe8e3; background: #f8faf9; color: #60706a; font-size: 9px; }
.model-badge.reasoning { border-color: #c8e6d6; background: #effaf5; color: #27755a; }
.model-row small { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.model-empty, .usage-state { padding: 30px 16px; color: var(--muted); font-size: 12px; text-align: center; }
.usage-panel { overflow: hidden; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 11px; }
th, td { padding: 12px 15px; border-bottom: 1px solid #edf1ef; text-align: left; white-space: nowrap; }
th { color: var(--muted); font-weight: 600; }
td { color: #46544f; }
td:nth-child(2) { max-width: 240px; overflow: hidden; font-weight: 650; text-overflow: ellipsis; }
.align-right { text-align: right; }
.table-footer { display: flex; align-items: center; justify-content: space-between; min-height: 56px; padding: 9px 15px; color: var(--muted); font-size: 11px; }
.table-footer > div { display: flex; align-items: center; gap: 8px; }
.table-footer .icon-button:disabled { opacity: .4; cursor: not-allowed; }
.usage-link { display: inline-flex; align-items: center; gap: 5px; margin: 0 15px 15px; color: var(--accent-dark); font-size: 11px; }
.usage-link svg { width: 13px; height: 13px; }
.faq-panel details { padding: 17px 18px; border-bottom: 1px solid var(--line); }
.faq-panel details:last-child { border-bottom: 0; }
.faq-panel summary { display: flex; align-items: center; justify-content: space-between; gap: 15px; cursor: pointer; font-size: 13px; font-weight: 650; list-style: none; }
.faq-panel summary::-webkit-details-marker { display: none; }
.faq-panel summary b { color: #85928d; font-size: 18px; font-weight: 400; transition: transform .18s; }
.faq-panel details[open] summary b { transform: rotate(45deg); }
.faq-panel p { max-width: 700px; margin-top: 10px; color: var(--muted); font-size: 12px; line-height: 1.75; }
.security-note { display: flex; gap: 11px; margin-top: 20px; padding: 15px; border: 1px solid #cdeedd; background: var(--accent-soft); }
.security-note > svg { width: 19px; height: 19px; flex: 0 0 auto; color: var(--accent-dark); }
.security-note strong { color: #126a4c; font-size: 12px; }
.security-note p { margin-top: 5px; color: #4e806c; font-size: 11px; line-height: 1.6; }
.toast { position: fixed; z-index: 30; right: 22px; bottom: 22px; max-width: calc(100vw - 44px); padding: 10px 13px; border: 1px solid #b9dfce; border-radius: 7px; background: #effaf5; color: #126a4c; font-size: 12px; opacity: 0; transform: translateY(10px); pointer-events: none; transition: opacity .18s, transform .18s; }
.toast.show { opacity: 1; transform: translateY(0); }
@media (max-width: 1000px) { .sidebar { width: 210px; flex-basis: 210px; } .console-grid { grid-template-columns: minmax(0, 1fr); } .stack-panels { grid-template-columns: repeat(2, minmax(0, 1fr)); display: grid; } }
@media (max-width: 720px) { .login-page { padding: 20px 16px; } .login-card-wrap { min-height: calc(100vh - 80px); padding: 35px 0; } .login-intro h1 { font-size: 24px; } .portal-page { display: block; } .sidebar { display: none; } .portal-header { justify-content: space-between; min-height: 58px; padding: 0 16px; } .mobile-brand { display: flex; align-items: center; gap: 8px; font-size: 12px; } .mobile-brand .brand-mark { width: 30px; height: 30px; border-radius: 7px; font-size: 13px; } .mobile-nav { display: flex; gap: 2px; } .mobile-nav-item { display: grid; width: 33px; height: 33px; place-items: center; border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; } .mobile-nav-item.active { background: var(--accent-soft); color: var(--accent-dark); } .mobile-nav-item svg { width: 16px; height: 16px; } .connection-state { display: none; } .content-inner { padding: 20px 15px 30px; } .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .metric-card { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); } .metric-card:nth-child(2n) { border-right: 0; } .metric-card:nth-last-child(-n + 2) { border-bottom: 0; } .stack-panels { display: grid; grid-template-columns: 1fr; gap: 18px; } .page-heading h1 { font-size: 23px; } .download-row .button { flex: 1; } th, td { padding-right: 11px; padding-left: 11px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: .01ms !important; } }

/* Usage detail workspace */
.usage-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; }
.usage-heading-actions { display: flex; align-items: center; gap: 10px; }
.usage-updated { color: var(--muted); font-size: 10px; white-space: nowrap; }
.button-small { min-height: 32px !important; padding: 0 10px !important; font-size: 11px !important; }
.usage-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; padding: 13px 15px; background: #fbfdfc; }
.usage-toolbar-copy { display: flex; align-items: baseline; gap: 9px; min-width: 0; }
.usage-toolbar-copy strong { font-size: 12px; }
.usage-toolbar-copy span { overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.usage-filters { display: flex; flex-wrap: wrap; gap: 8px; }
.usage-filters label { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 10px; }
.usage-filters select { min-width: 126px; height: 30px; padding: 0 24px 0 9px; border: 1px solid var(--line); border-radius: 5px; background: #fff; color: var(--ink); font: inherit; cursor: pointer; }
.usage-summary-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.usage-summary-card { display: flex; min-width: 0; align-items: flex-start; gap: 10px; padding: 14px 12px; border: 1px solid var(--line); background: #fff; }
.usage-summary-card.accent { border-color: #cce8d9; background: linear-gradient(145deg, #f5fcf8, #fff); }
.summary-icon { display: grid; width: 28px; height: 28px; flex: 0 0 28px; place-items: center; border: 1px solid #dcebe3; border-radius: 7px; background: #f4fbf7; color: var(--accent-dark); }
.summary-icon svg { width: 14px; height: 14px; }
.usage-summary-card small, .usage-summary-card span { display: block; color: var(--muted); font-size: 9px; }
.usage-summary-card strong { display: block; margin: 4px 0 3px; overflow: hidden; font-size: 17px; letter-spacing: -.02em; text-overflow: ellipsis; white-space: nowrap; }
.usage-summary-card.accent strong { color: var(--accent-dark); }
.usage-summary-card span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.usage-panel table { min-width: 930px; }
.usage-panel th { padding-top: 11px; padding-bottom: 11px; background: #fbfdfc; font-size: 10px; }
.usage-panel td { padding-top: 11px; padding-bottom: 11px; vertical-align: top; }
.usage-type { display: inline-flex; align-items: center; gap: 5px; padding: 4px 7px; border-radius: 99px; font-size: 10px; font-weight: 700; }
.usage-type::before { width: 5px; height: 5px; border-radius: 99px; background: currentColor; content: ''; }
.usage-type.consume { background: #effaf5; color: #237d5a; }
.usage-type.refund { background: #fff7e8; color: #a36b15; }
.usage-type.error { background: #fff0f0; color: #b24848; }
.usage-type.unknown { background: #f1f4f3; color: #687771; }
.usage-type-note { display: block; margin-top: 5px; color: var(--muted); font-size: 9px; }
.usage-token-cell { display: grid; gap: 3px; }
.usage-token-cell strong { color: var(--ink); font-size: 12px; }
.usage-token-cell span, .usage-token-cell small { color: var(--muted); font-size: 9px; }
.usage-duration { font-variant-numeric: tabular-nums; }
.usage-request-id { display: block; max-width: 115px; overflow: hidden; color: #53645d; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.usage-detail-row { background: #fbfdfc; }
.usage-detail-row td { padding-top: 0; padding-bottom: 12px; border-bottom-color: var(--line); }
.usage-detail-content { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 10px; border-left: 2px solid #d7eee2; background: #f5faf7; }
.usage-detail-chip { padding: 4px 7px; border: 1px solid #dcebe3; background: #fff; color: #5c6d65; font-size: 9px; }
.usage-detail-chip b { color: #315a49; font-weight: 700; }
.usage-detail-chip code { font-size: 9px; }
.usage-empty-note { padding: 8px 10px; color: var(--muted); font-size: 10px; }
@media (max-width: 1150px) { .usage-summary-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 720px) { .usage-heading { display: block; } .usage-heading-actions { justify-content: space-between; margin-top: 12px; } .usage-toolbar { display: block; } .usage-toolbar-copy { margin-bottom: 10px; } .usage-filters label { flex: 1; } .usage-filters select { width: 100%; min-width: 0; } .usage-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; } .usage-summary-card { padding: 11px 9px; } .usage-summary-card strong { font-size: 15px; } }
