:root {
  color-scheme: light;
  --ink: #13231d;
  --muted: #68766f;
  --line: #dbe3de;
  --panel: #ffffff;
  --canvas: #f3f6f3;
  --green: #126b4c;
  --green-dark: #0b4d37;
  --green-soft: #e0f2e9;
  --amber: #9a5c00;
  --amber-soft: #fff0cc;
  --red: #a53630;
  --red-soft: #fde8e6;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: radial-gradient(circle at 10% 0%, #e3eee7 0, transparent 30rem), var(--canvas); }
button, input { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.shell { width: min(1480px, calc(100% - 40px)); margin: 0 auto 80px; }
.topbar { display: flex; justify-content: space-between; gap: 24px; align-items: center; padding: 44px 0 28px; }
h1, h2, p { margin-top: 0; }
h1 { font-size: clamp(28px, 4vw, 44px); letter-spacing: -.04em; margin-bottom: 8px; }
h2 { font-size: 21px; margin-bottom: 6px; }
.subtitle, .login-card p, .panel-heading small { color: var(--muted); margin-bottom: 0; }
.risk-banner { border: 1px solid #e2bd77; background: var(--amber-soft); color: #64400a; border-radius: 12px; padding: 12px 15px; font-size: 13px; line-height: 1.55; }
.eyebrow { color: var(--green); font-size: 11px; letter-spacing: .16em; font-weight: 800; margin-bottom: 8px; }
.header-actions, .inline-form, .form-actions { display: flex; gap: 10px; align-items: center; }
.header-actions { flex-wrap: wrap; justify-content: flex-end; }
.status-detail { max-width: 440px; color: var(--red); font-size: 12px; line-height: 1.45; }
.button { border: 1px solid transparent; border-radius: 9px; padding: 10px 15px; font-weight: 700; }
.button.primary { background: var(--green); color: white; }
.button.primary:hover { background: var(--green-dark); }
.button.secondary { border-color: var(--line); background: white; color: var(--ink); }
.button.ghost { background: transparent; color: var(--muted); }
.button.danger { background: var(--red-soft); color: var(--red); padding: 7px 10px; }
.button.small { padding: 7px 10px; font-size: 12px; }
.pill { display: inline-flex; align-items: center; gap: 7px; border-radius: 999px; padding: 8px 12px; font-size: 13px; font-weight: 750; }
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pill.neutral { color: var(--muted); background: #e7ebe8; }
.pill.healthy, .pill.active { color: var(--green); background: var(--green-soft); }
.pill.degraded, .pill.disabled { color: var(--red); background: var(--red-soft); }
.login-card, .panel, .key-reveal { background: color-mix(in srgb, var(--panel) 96%, transparent); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 12px 40px rgba(19, 35, 29, .05); }
.login-card { max-width: 760px; margin: 70px auto; padding: 32px; display: grid; grid-template-columns: 1fr 1.2fr; gap: 36px; align-items: end; }
label { color: var(--muted); font-size: 12px; font-weight: 700; display: grid; gap: 7px; }
input { border: 1px solid var(--line); background: white; border-radius: 9px; padding: 10px 12px; color: var(--ink); min-width: 0; }
input:focus { outline: 3px solid rgba(18, 107, 76, .14); border-color: var(--green); }
.inline-form input { flex: 1; }
.error { color: var(--red) !important; font-size: 12px; margin: 8px 0 0; min-height: 1.2em; }
.metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 18px; }
.metric { background: var(--ink); color: white; border-radius: 15px; padding: 20px; }
.metric span, .metric small { display: block; color: #b8c8c0; }
.metric span { font-size: 13px; font-weight: 700; }
.metric strong { display: block; font-size: 30px; letter-spacing: -.03em; margin: 12px 0 5px; }
.panel { margin-top: 18px; overflow: hidden; }
.panel-heading { padding: 22px 24px; display: flex; justify-content: space-between; align-items: center; gap: 20px; border-bottom: 1px solid var(--line); }
.panel-heading h2 { margin-bottom: 0; }
.create-grid { display: grid; grid-template-columns: 1.2fr repeat(4, 1fr) auto; gap: 12px; align-items: end; padding: 20px 24px; background: #f8faf8; border-bottom: 1px solid var(--line); }
.span-all { grid-column: 1 / -1; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { color: var(--muted); font-size: 11px; letter-spacing: .05em; text-transform: uppercase; text-align: left; background: #fafbfa; }
th, td { padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: top; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
td strong { display: block; }
.muted, td small { color: var(--muted); }
.quota-stack { display: grid; gap: 5px; }
.quota-field { color: var(--muted); font-size: 10px; gap: 3px; }
.quota-stack input { width: 110px; padding: 5px 7px; font-size: 12px; }
.key-list { display: grid; gap: 6px; }
.key-line { display: flex; gap: 7px; align-items: center; }
code { background: #edf1ee; color: var(--green-dark); padding: 4px 7px; border-radius: 6px; }
.key-reveal { margin-top: 18px; padding: 22px 24px; display: grid; grid-template-columns: 1fr minmax(300px, 2fr) auto auto; gap: 14px; align-items: center; border-color: #78b69c; background: var(--green-soft); }
.key-reveal h2 { margin-bottom: 0; }
.key-reveal code { overflow-x: auto; white-space: nowrap; padding: 12px; background: white; }
.toast { position: fixed; right: 24px; bottom: 24px; background: var(--ink); color: white; border-radius: 10px; padding: 12px 16px; box-shadow: 0 8px 30px rgba(0,0,0,.2); }
.status-good { color: var(--green); font-weight: 750; }
.status-bad { color: var(--red); font-weight: 750; }

@media (max-width: 1000px) {
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .create-grid { grid-template-columns: repeat(2, 1fr); }
  .key-reveal { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .shell { width: min(100% - 24px, 1480px); }
  .topbar { align-items: flex-start; flex-direction: column; padding-top: 28px; }
  .login-card { margin-top: 30px; grid-template-columns: 1fr; padding: 22px; }
  .inline-form { align-items: stretch; flex-direction: column; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .metric { padding: 16px; }
  .metric strong { font-size: 24px; }
}
