:root {
  color-scheme: light;
  --ink: #202622;
  --muted: #818a83;
  --line: #e5e9e4;
  --paper: #f4f5f2;
  --surface: #fff;
  --green: #286d50;
  --orange: #a96442;
  --shadow: 0 8px 26px rgba(36, 47, 40, .045);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif; font-size: 14px; -webkit-font-smoothing: antialiased; }
button, input { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.app-shell { min-height: 100vh; }
.topbar { display: flex; align-items: center; justify-content: space-between; width: min(100% - 48px, 1120px); height: 68px; margin: 0 auto; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font-size: 12px; font-weight: 680; }
.brand-mark { display: grid; place-items: center; width: 31px; height: 31px; flex: 0 0 31px; color: #f5fff9; background: var(--green); border-radius: 10px 10px 10px 3px; font-family: Georgia, serif; font-size: 17px; font-style: italic; }
.top-actions { display: flex; align-items: center; gap: 13px; }
.status-indicator { display: flex; align-items: center; gap: 7px; color: #858e87; font-size: 9px; }
.online-dot, .status-indicator .online-dot { display: inline-block; width: 6px; height: 6px; flex: 0 0 6px; background: #65b383; border-radius: 50%; }
.status-indicator.is-error { color: #a56559; }
.status-indicator.is-error .online-dot { background: #df9e65; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 33px; padding: 0 11px; border: 1px solid transparent; border-radius: 7px; font-size: 9px; font-weight: 650; transition: background .15s; }
.button:disabled { opacity: .6; cursor: wait; }
.button-soft { color: #52675a; background: #fff; border-color: #e3e9e2; }
.button-soft:hover { background: #f4f8f3; }
.refresh-icon { font-size: 15px; }
.logout-button { display: grid; place-items: center; width: 29px; height: 29px; padding: 0; color: #879189; background: transparent; border: 1px solid #e2e7e1; border-radius: 50%; font-size: 13px; transform: rotate(180deg); }
.logout-button:hover { color: #a45f54; background: #fff; }
.main-content { width: min(100% - 48px, 1120px); margin: 0 auto; padding: 32px 0 45px; }
.page-title { margin: 0 0 18px; font-size: 19px; font-weight: 660; letter-spacing: -.035em; }
.quota-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.quota-card { min-width: 0; padding: 19px 20px 14px; background: var(--surface); border: 1px solid #e7ebe6; border-radius: 11px; box-shadow: var(--shadow); }
.quota-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 14px; border-bottom: 1px solid #eff1ed; }
.provider-identity { display: flex; align-items: center; gap: 10px; min-width: 0; }
.provider-mark { display: grid; place-items: center; width: 34px; height: 34px; flex: 0 0 34px; color: #fff; border-radius: 11px 11px 11px 4px; font-family: Georgia, serif; font-size: 18px; font-style: italic; }
.mark-claude { background: var(--orange); }
.mark-codex { background: var(--green); }
.provider-name-group { min-width: 0; }
.provider-kicker { margin: 0 0 3px; color: #a0a8a2; font-size: 7px; font-weight: 740; letter-spacing: .1em; }
.provider-name { overflow: hidden; margin: 0; font-size: 13px; font-weight: 670; text-overflow: ellipsis; }
.window-list { display: grid; }
.quota-window { padding: 16px 0 13px; border-bottom: 1px solid #f0f2ee; }
.quota-window:last-child { border-bottom: 0; }
.window-topline { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.window-title-group { min-width: 0; }
.window-title { margin: 0; color: #3a443d; font-size: 9px; font-weight: 650; }
.window-length { display: block; margin-top: 4px; color: #a0a8a2; font-size: 8px; }
.quota-percent { color: #394c3f; font-size: 17px; font-weight: 650; letter-spacing: -.04em; }
.progress-track { display: block; width: 100%; height: 5px; overflow: hidden; margin: 10px 0 7px; appearance: none; background: #edf0ec; border: 0; border-radius: 20px; }
.progress-track::-webkit-progress-bar { background: #edf0ec; border-radius: 20px; }
.progress-track::-webkit-progress-value { background: linear-gradient(90deg, #7bae7d, #377854); border-radius: 20px; transition: width .3s; }
.progress-track::-moz-progress-bar { background: linear-gradient(90deg, #7bae7d, #377854); border-radius: 20px; }
.progress-track.is-high::-webkit-progress-value { background: linear-gradient(90deg, #dda56b, #c46b50); }
.progress-track.is-high::-moz-progress-bar { background: linear-gradient(90deg, #dda56b, #c46b50); }
.window-bottomline { display: flex; justify-content: flex-end; color: #a0a8a2; font-size: 8px; }
.no-quota { display: grid; place-items: center; min-height: 115px; color: #909a92; font-size: 9px; }
.observed-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; padding-top: 10px; border-top: 1px solid #eff1ed; }
.observed-label { color: #a3aba5; font-size: 8px; }
.observed-value { color: #79857d; font-size: 8px; font-variant-numeric: tabular-nums; }
.loading-card, .error-card { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 190px; grid-column: 1 / -1; padding: 20px; color: #879188; background: #fff; border: 1px solid #e7ebe6; border-radius: 11px; font-size: 9px; }
.error-card { color: #a56559; }
.spinner { width: 14px; height: 14px; border: 2px solid #dfe9dd; border-top-color: #4a855f; border-radius: 50%; animation: spin .85s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.login-screen { display: grid; place-items: center; min-height: 100svh; padding: 24px; background: var(--paper); }
.login-card { display: grid; width: min(100%, 350px); gap: 12px; padding: 28px; background: #fff; border: 1px solid #e7ebe5; border-radius: 12px; box-shadow: 0 15px 40px rgba(32,59,40,.07); }
.login-card .brand-mark { margin-bottom: 4px; }
.login-card h1 { margin: 0 0 5px; font-size: 20px; font-weight: 660; letter-spacing: -.04em; }
.login-card label { color: #69746c; font-size: 9px; font-weight: 650; }
.login-card input { width: 100%; min-height: 39px; padding: 9px 10px; color: var(--ink); background: #fff; border: 1px solid #dfe5de; border-radius: 7px; outline: none; font-size: 10px; }
.login-card input:focus { border-color: #83ab8b; box-shadow: 0 0 0 3px rgba(83,131,104,.1); }
.button-primary { color: #fff; background: var(--green); }
.button-primary:hover { background: #19583f; }
.login-button { width: 100%; justify-content: space-between; margin-top: 2px; padding: 0 12px; }
.form-error { min-height: 13px; margin: 0; color: #b4544b; font-size: 9px; }
.toast { position: fixed; z-index: 15; right: 18px; bottom: 18px; padding: 10px 13px; color: #fff; background: #253e31; border-radius: 7px; box-shadow: 0 8px 25px rgba(21,38,27,.16); font-size: 9px; opacity: 0; pointer-events: none; transform: translateY(7px); transition: opacity .18s, transform .18s; }
.toast.visible { opacity: 1; transform: translateY(0); }

@media (max-width: 680px) {
  .topbar, .main-content { width: calc(100% - 32px); }
  .topbar { height: 58px; }
  .top-actions { gap: 8px; }
  .status-indicator { display: none; }
  .main-content { padding-top: 22px; }
  .page-title { margin-bottom: 13px; font-size: 17px; }
  .quota-grid { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .quota-card { padding: 16px 15px 12px; }
  .toast { right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); left: 12px; text-align: center; }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; } }
