:root {
  color-scheme: light;
  font-family: Inter, "Segoe UI", "Microsoft YaHei", sans-serif;
  background: #f3f5f6;
  color: #1d2529;
  letter-spacing: 0;
  --ink: #1d2529;
  --muted: #667278;
  --line: #d9dfe2;
  --surface: #ffffff;
  --accent: #087f79;
  --accent-dark: #05645f;
  --danger: #b53a32;
  --amber: #a86712;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: #f3f5f6; color: var(--ink); }
button, input, select { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
code { font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace; }
.topbar { background: #172125; color: #fff; border-bottom: 3px solid #d08a22; }
.topbar-inner { max-width: 1440px; min-height: 58px; margin: 0 auto; padding: 0 24px; display: flex; gap: 20px; align-items: center; justify-content: space-between; }
.topbar-main { min-width: 0; display: flex; align-items: center; gap: 30px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 44px; height: 44px; display: grid; place-items: center; background: #087f79; color: #fff; border-radius: 6px; font-weight: 800; }
.brand-mark-small { width: 30px; height: 30px; font-size: 12px; }
.topnav { display: flex; align-self: stretch; gap: 4px; }
.topnav a { display: flex; align-items: center; padding: 0 12px; border-bottom: 3px solid transparent; color: #bfc8cc; font-size: 13px; font-weight: 700; text-decoration: none; }
.topnav a:hover { color: #fff; }
.topnav a.active { border-bottom-color: #66c2bc; color: #fff; }
.logout-form { flex: 0 0 auto; }
.workspace { max-width: 1440px; margin: 0 auto; padding: 28px 24px 64px; }
.page-heading { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 22px; }
.eyebrow { margin: 0 0 5px; color: var(--accent); font-size: 11px; font-weight: 800; text-transform: uppercase; }
h1, h2, h3, p { letter-spacing: 0; }
h1 { margin: 0; font-size: 30px; line-height: 1.2; }
h2 { margin: 0; font-size: 20px; }
h3 { margin: 0 0 4px; font-size: 16px; }
.live-status { display: inline-flex; align-items: center; gap: 8px; color: #3d4b50; font-size: 13px; }
.live-status i { width: 8px; height: 8px; border-radius: 50%; background: #1c9b68; box-shadow: 0 0 0 3px #dff3ea; }
.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); background: var(--surface); }
.metric { min-width: 0; padding: 18px 20px; border-right: 1px solid var(--line); }
.metric:last-child { border-right: 0; }
.metric span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.metric strong { display: block; font-size: 25px; overflow-wrap: anywhere; }
.metric-errors strong { color: var(--danger); }
.reset-strip { display: flex; flex-wrap: wrap; gap: 20px; align-items: center; padding: 11px 16px; background: #e9edef; color: #566269; font-size: 12px; border: 1px solid var(--line); border-top: 0; }
.reset-strip b { color: var(--ink); margin-left: 4px; }
.reset-strip em { margin-left: auto; font-style: normal; font-weight: 700; color: var(--accent-dark); }
.section-block { margin-top: 30px; }
.section-title { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 12px; }
.count-label { color: var(--muted); font-size: 13px; }
.sync-status { max-width: 50%; color: var(--accent-dark); font-size: 12px; font-weight: 700; text-align: right; overflow-wrap: anywhere; }
.usage-meta { display: flex; flex-wrap: wrap; gap: 18px; padding: 10px 14px; border: 1px solid var(--line); border-bottom: 0; background: #eaf2f1; color: var(--muted); font-size: 12px; }
.usage-meta b { color: var(--ink); margin-left: 4px; }
.official-usage-table { min-width: 850px; background: var(--surface); }
.official-usage-table td { min-width: 145px; }
.official-token-cell { display: grid; gap: 3px; }
.official-token-cell b { font-size: 15px; }
.official-token-cell small { color: var(--muted); font-size: 10px; white-space: nowrap; }
.policy-form, .key-item { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; }
.policy-form { padding: 18px; }
.name-field { display: grid; grid-template-columns: 80px minmax(240px, 420px); align-items: center; gap: 10px; margin-bottom: 16px; }
label > span { color: #4d5a60; font-size: 12px; font-weight: 700; }
input { width: 100%; min-width: 0; height: 36px; padding: 7px 9px; border: 1px solid #c9d1d5; border-radius: 4px; background: #fff; color: var(--ink); }
select { width: 100%; min-width: 0; height: 36px; padding: 6px 30px 6px 9px; border: 1px solid #c9d1d5; border-radius: 4px; background: #fff; color: var(--ink); }
input:focus, select:focus { outline: 2px solid #83c7c3; outline-offset: 1px; border-color: var(--accent); }
.table-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; }
.quota-table { min-width: 1120px; }
th, td { padding: 10px; border-bottom: 1px solid #e4e8ea; text-align: left; vertical-align: middle; }
thead th { background: #f4f6f7; color: #526067; font-size: 11px; text-transform: uppercase; white-space: nowrap; }
tbody tr:last-child th, tbody tr:last-child td { border-bottom: 0; }
tbody th { min-width: 168px; }
tbody th span, tbody th small { display: block; }
tbody th small { margin-top: 3px; color: var(--muted); font-weight: 400; }
td input[type="number"] { min-width: 112px; }
.switch { position: relative; display: inline-block; width: 38px; height: 22px; }
.switch input { position: absolute; opacity: 0; }
.switch span { position: absolute; inset: 0; background: #aeb8bd; border-radius: 12px; transition: .15s; }
.switch span::after { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .15s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(16px); }
.form-actions { display: flex; justify-content: flex-end; margin-top: 14px; }
.button { min-height: 34px; padding: 7px 12px; border: 1px solid transparent; border-radius: 4px; background: #fff; color: var(--ink); font-weight: 700; font-size: 13px; text-decoration: none; }
.button-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.button-primary:hover { background: var(--accent-dark); }
.button-quiet { border-color: #bfc8cc; background: transparent; color: inherit; }
.topbar .button-quiet { border-color: #526167; color: #fff; }
.button-danger { border-color: #e0aaa6; color: var(--danger); background: #fff; }
.button-block { width: 100%; }
.key-list { display: grid; gap: 12px; }
.key-header { display: flex; gap: 20px; align-items: center; justify-content: space-between; padding: 16px 18px; }
.key-identity { display: flex; min-width: 0; align-items: center; gap: 12px; }
.key-identity code { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.status-dot { width: 10px; height: 10px; flex: 0 0 auto; border-radius: 50%; background: #aeb8bd; }
.status-dot.active { background: #1c9b68; }
.key-actions { display: flex; flex-wrap: wrap; gap: 7px; justify-content: flex-end; }
.key-stats { display: flex; flex-wrap: wrap; gap: 20px; padding: 11px 18px; border-top: 1px solid var(--line); background: #f7f8f8; color: var(--muted); font-size: 12px; }
.key-stats b { color: var(--ink); }
.key-policy { border-top: 1px solid var(--line); }
.key-policy summary { padding: 12px 18px; cursor: pointer; font-size: 13px; font-weight: 700; }
.key-policy form { padding: 0 18px 18px; }
.quota-table-edit { min-width: 1050px; }
.quota-table-edit td { min-width: 250px; }
.quota-cell { display: grid; grid-template-columns: 48px minmax(100px, 1fr); gap: 5px 8px; align-items: center; }
.quota-cell label { display: contents; }
.quota-cell input { height: 30px; }
.usage-line { grid-column: 1 / -1; position: relative; height: 16px; overflow: hidden; background: #e7ecee; border-radius: 3px; }
.usage-line progress { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; appearance: none; }
.usage-line progress::-webkit-progress-bar { background: #e7ecee; }
.usage-line progress::-webkit-progress-value { background: #7cc4bf; }
.usage-line progress::-moz-progress-bar { background: #7cc4bf; }
.usage-line span { position: relative; z-index: 1; display: block; padding: 1px 5px; color: #304045; font-size: 10px; line-height: 14px; }
.alert { margin-bottom: 14px; padding: 11px 14px; border: 1px solid #b9d9d6; border-left: 4px solid var(--accent); background: #eef8f7; border-radius: 4px; }
.alert-error { border-color: #e3b4b0; border-left-color: var(--danger); background: #fff1f0; }
.secret-banner { display: flex; justify-content: space-between; gap: 20px; align-items: center; margin-bottom: 16px; padding: 16px; background: #fff8e8; border: 1px solid #e5c98f; border-left: 4px solid var(--amber); }
.secret-banner .eyebrow { color: var(--amber); }
.secret-copy { display: flex; min-width: 0; align-items: center; gap: 8px; }
.secret-copy code { max-width: 620px; padding: 9px 10px; background: #fff; border: 1px solid #dbc896; overflow-wrap: anywhere; }
.empty-state { padding: 42px; border: 1px dashed #bbc5c9; color: var(--muted); text-align: center; }
.timezone-label { color: var(--muted); font-size: 12px; font-weight: 700; }
.filter-form { display: grid; grid-template-columns: minmax(230px, 1.7fr) repeat(6, minmax(125px, 1fr)) auto; gap: 12px; align-items: end; padding: 16px; border: 1px solid var(--line); background: var(--surface); }
.filter-form label { display: grid; min-width: 0; gap: 6px; }
.filter-actions { display: flex; gap: 8px; align-items: center; }
.filter-actions .button { display: inline-flex; align-items: center; justify-content: center; white-space: nowrap; }
.request-log-wrap { background: var(--surface); }
.request-log-table { min-width: 1740px; background: var(--surface); font-size: 12px; }
.request-log-table th, .request-log-table td { padding: 9px 10px; }
.request-log-table tbody tr:hover { background: #f6faf9; }
.request-log-table td { white-space: nowrap; }
.request-log-table code { font-size: 11px; }
.time-cell { color: #4f5d63; font-variant-numeric: tabular-nums; }
.request-id-cell { width: 180px; max-width: 180px; }
.request-id-cell code { display: block; overflow: hidden; text-overflow: ellipsis; }
.key-cell { min-width: 155px; }
.key-cell strong, .key-cell small { display: block; }
.key-cell small { max-width: 160px; margin-top: 3px; overflow: hidden; color: var(--muted); font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace; font-size: 10px; text-overflow: ellipsis; }
.endpoint-cell { min-width: 185px; }
.endpoint-cell small, .endpoint-cell code { display: block; }
.endpoint-cell small { margin-bottom: 3px; color: var(--muted); font-size: 9px; font-weight: 800; }
.status-badge { display: inline-grid; min-width: 40px; height: 23px; padding: 0 7px; place-items: center; border: 1px solid; border-radius: 4px; font-weight: 800; font-variant-numeric: tabular-nums; }
.status-success { border-color: #9bcdbb; background: #edf8f3; color: #176b4d; }
.status-error { border-color: #e4afa9; background: #fff1f0; color: var(--danger); }
.status-text { display: block; max-width: 100px; margin-top: 3px; overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; }
.number-cell { text-align: right; font-variant-numeric: tabular-nums; }
.token-total, .tps-cell { color: #104f4b; font-weight: 800; }
.duration-cell { color: #4f5d63; }
.source-label { display: inline-block; padding: 4px 7px; border: 1px solid #ced8db; border-radius: 4px; background: #f4f7f7; color: #526067; font-size: 10px; }
.request-log-table abbr { text-decoration: underline dotted; text-underline-offset: 3px; cursor: help; }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 12px; color: var(--muted); font-size: 12px; }
.pagination div { display: flex; gap: 8px; }
.pagination .button { display: inline-flex; align-items: center; justify-content: center; }
.pagination .disabled { cursor: default; opacity: .45; }
.login-page { background: #172125; }
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-panel { width: min(100%, 390px); padding: 32px; background: #fff; border-top: 4px solid #d08a22; box-shadow: 0 18px 50px #00000040; }
.login-panel h1 { margin-bottom: 24px; }
.login-panel .brand-mark { margin-bottom: 20px; }
.login-form { display: grid; gap: 15px; }
.login-form label { display: grid; gap: 6px; }
.login-form .button { margin-top: 4px; }
@media (max-width: 800px) {
  .workspace { padding: 20px 14px 48px; }
  .topbar-inner { padding: 0 14px; }
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric:nth-child(2) { border-right: 0; }
  .metric:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .page-heading, .secret-banner, .key-header { align-items: flex-start; flex-direction: column; }
  .section-title { align-items: flex-start; gap: 8px; }
  .sync-status { max-width: 55%; }
  .secret-copy { width: 100%; align-items: stretch; flex-direction: column; }
  .secret-copy code { max-width: 100%; }
  .name-field { grid-template-columns: 1fr; }
  .key-actions { justify-content: flex-start; }
  .reset-strip em { width: 100%; margin-left: 0; }
	.filter-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.filter-search, .filter-actions { grid-column: 1 / -1; }
	.filter-actions { justify-content: flex-end; }
	.pagination { align-items: flex-start; flex-direction: column; }
}
@media (max-width: 560px) {
  .topbar-inner { padding-top: 8px; padding-bottom: 8px; flex-wrap: wrap; }
  .topbar-main { width: 100%; gap: 12px; justify-content: space-between; }
  .brand strong { display: none; }
  .topnav { min-height: 40px; }
  .topnav a { padding: 0 8px; }
  .logout-form { margin-left: auto; }
  .filter-form { grid-template-columns: 1fr; }
  .filter-search, .filter-actions { grid-column: auto; }
  .filter-actions .button { flex: 1; }
}
