@font-face {
  font-family: "Geist";
  src: url("/geist-latin.woff2") format("woff2");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: light;
  --ground: #f2f4f7;
  --surface: #fff;
  --raised: #eee;
  --border: #e6e6e6;
  --rule: #f0f0f0;
  --text: #0a0a0a;
  --muted: #626262;
  --accent: #1d5fbf;
  --positive: #247b50;
  --negative: #c4242a;
  --warning: #92400e;
  --notice-bg: #fffbeb;
  --notice-border: #fde68a;
  --radius-card: 8px;
  --gap: 12px;
  --pad: 24px;
  font-family: "Geist", -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { background: var(--ground); }
body { margin: 0; color: var(--text); font-size: 14px; line-height: 1.5; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

.topbar { min-height: 48px; padding-top: env(safe-area-inset-top); }
.topbar-inner {
  max-width: 1088px;
  min-height: 48px;
  margin: 0 auto;
  padding: 0 var(--pad);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; font-weight: 600; }
.brand img { border-radius: 6px; }
.refresh-button {
  min-height: 44px;
  padding: 0 4px 0 12px;
  border: 0;
  background: transparent;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.refresh-button svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.refresh-button:active { opacity: .55; }
.refresh-button:disabled { cursor: wait; opacity: .55; }

.canvas { max-width: 1088px; margin: 0 auto; padding: 28px var(--pad) 48px; }
.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
h1 { margin: 0; font-size: 24px; line-height: 1.25; letter-spacing: -.02em; font-weight: 600; }
.page-heading p { margin: 7px 0 0; color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.connection { font-size: 12px; color: var(--muted); padding-top: 5px; }
.notice { margin-top: 20px; padding: 12px 14px; border: 1px solid var(--notice-border); border-radius: var(--radius-card); background: var(--notice-bg); color: var(--warning); font-size: 13px; }
.quota-section { margin-top: 30px; }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
h2 { margin: 0; font-size: 16px; line-height: 1.4; font-weight: 500; }
.section-heading > span { color: var(--muted); font-size: 12px; }
.quota-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); align-items: start; }
.quota-card { min-width: 0; padding: 18px 20px; border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--surface); }
.card-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.app-name { min-width: 0; font-size: 16px; font-weight: 500; text-decoration: none; overflow-wrap: anywhere; }
.app-name:hover { text-decoration: underline; text-underline-offset: 3px; }
.updated { flex: none; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.card-status { margin-top: 8px; color: var(--negative); font-size: 13px; }
.quota-items { margin-top: 14px; display: grid; gap: 18px; }
.quota-line { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.quota-name { color: var(--muted); font-size: 14px; }
.quota-value { font-size: 30px; line-height: 1.15; font-weight: 400; letter-spacing: -.025em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.quota-item:not(:first-child) .quota-value { font-size: 24px; }
.quota-detail-line { min-height: 20px; margin-top: 5px; display: flex; align-items: baseline; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 13px; }
.quota-reset { text-align: right; font-variant-numeric: tabular-nums; }
.meter { height: 6px; margin-top: 10px; overflow: hidden; border-radius: 999px; background: var(--raised); }
.meter-fill { width: 0; height: 100%; border-radius: inherit; background: var(--accent); }
.quota-item[data-level="warning"] .meter-fill { background: var(--warning); }
.quota-item[data-level="critical"] .meter-fill { background: var(--negative); }
.card-footer { margin: 16px 0 0; padding-top: 12px; border-top: 1px solid var(--rule); color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.card-footer:empty { display: none; }
.access-section { max-width: 480px; margin: 32px auto 0; padding: 24px; border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--surface); }
.access-section p { color: var(--muted); }
.access-section label { display: block; margin: 22px 0 8px; font-weight: 500; }
.access-row { display: flex; gap: 8px; }
.access-row input { min-width: 0; flex: 1; min-height: 44px; padding: 0 12px; border: 1px solid #d1d5db; border-radius: 6px; background: #fff; color: var(--text); }
.access-row button { min-height: 44px; padding: 0 16px; border: 0; border-radius: 6px; background: #1d1f20; color: #fff; }
.footer { max-width: 1088px; margin: 0 auto; padding: 0 var(--pad) calc(32px + env(safe-area-inset-bottom)); color: var(--muted); font-size: 12px; }

@media (max-width: 640px) {
  :root { --pad: 16px; }
  .canvas { padding-top: 22px; padding-bottom: 32px; }
  .quota-grid { grid-template-columns: minmax(0, 1fr); }
  .quota-section { margin-top: 26px; }
  .quota-card { padding: 16px 18px; }
  .quota-items { gap: 20px; }
  .refresh-button { padding-right: 0; }
}

@media (prefers-reduced-motion: no-preference) {
  .refresh-button svg { transition: transform .18s ease; }
  .refresh-button:active svg { transform: rotate(45deg); }
}

@media (forced-colors: active) {
  .meter { border: 1px solid CanvasText; }
  .meter-fill { background: CanvasText; }
}
