:root {
  --bg: #f7f8fa; --surface: #ffffff; --surface-2: #f2f4f7; --fg: #101828; --fg-2: #344054;
  --muted: #667085; --line: #e4e7ec; --line-2: #d0d5dd; --accent: #4f46e5; --accent-hover: #4338ca;
  --accent-soft: #eef2ff; --ok: #067647; --ok-soft: #ecfdf3; --ok-line: #abefc6;
  --fail: #b42318; --fail-soft: #fef3f2; --fail-line: #fecdca;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08); --radius: 12px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c111d; --surface: #161b26; --surface-2: #1f242f; --fg: #f5f5f6; --fg-2: #cecfd2;
    --muted: #94969c; --line: #2a303c; --line-2: #333741; --accent: #6366f1; --accent-hover: #818cf8;
    --accent-soft: #1e1b4b; --ok: #47cd89; --ok-soft: #053321; --ok-line: #085d3a;
    --fail: #f97066; --fail-soft: #55160c; --fail-line: #912018; --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; } a:hover { text-decoration: underline; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
h1 { font-size: 24px; line-height: 1.25; margin: 0 0 8px; letter-spacing: -.01em; }
h2 { font-size: 16px; margin: 0; }
.muted { color: var(--muted); } .small { font-size: 13px; } .center { text-align: center; }
.nowrap { white-space: nowrap; } .right { text-align: right; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 24px; }

.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--fg); font-weight: 700; }
.brand:hover { text-decoration: none; }
.mark { width: 28px; height: 28px; border-radius: 8px; background: linear-gradient(135deg, #6366f1, #8b5cf6); }
.top { background: var(--surface); border-bottom: 1px solid var(--line); }
.top-row { display: flex; align-items: center; gap: 28px; height: 60px; }
.nav { display: flex; gap: 6px; }
.nav a { color: var(--fg-2); font-weight: 550; padding: 6px 10px; border-radius: 8px; }
.nav a:hover { background: var(--surface-2); text-decoration: none; }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.sign-out { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.page { padding-top: 32px; padding-bottom: 64px; }
.page-head { margin-bottom: 24px; } .page-head p { margin: 0; max-width: 680px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 20px; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 16px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card-head p { margin: 4px 0 0; }
.card-body { padding: 18px 20px; }
.empty { text-align: center; padding: 48px 24px; }
.empty p { max-width: 520px; margin: 8px auto; }
.empty-icon { width: 44px; height: 44px; border-radius: 12px; background: var(--accent-soft); margin: 0 auto 14px; }

.btn { font: inherit; font-weight: 600; font-size: 14px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--surface); color: var(--fg-2); cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-sm { padding: 5px 11px; font-size: 13px; }
.btn-block { width: 100%; margin-top: 16px; }
.btn-danger-ghost { color: var(--fail); border-color: var(--fail-line); }

label { display: block; font-weight: 600; font-size: 14px; color: var(--fg-2); margin: 16px 0 6px; }
input[type=email], input[type=text] { width: 100%; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 9px; font: inherit; background: var(--surface); color: var(--fg); }
input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.alert { padding: 11px 14px; border-radius: 10px; border: 1px solid; margin: 14px 0; font-size: 14px; }
.alert-ok { background: var(--ok-soft); border-color: var(--ok-line); color: var(--ok); }
.alert-fail { background: var(--fail-soft); border-color: var(--fail-line); color: var(--fail); }
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--accent-soft); color: var(--accent); margin-left: 6px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 10px 20px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
td { padding: 12px 20px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 10px 28px; margin: 0; }
dl.kv dt { color: var(--muted); } dl.kv dd { margin: 0; word-break: break-word; }

.auth { max-width: 420px; margin: 0 auto; padding: 64px 16px; }
.brand-center { display: flex; justify-content: center; margin-bottom: 24px; }
.auth-card { padding: 28px; }
.auth-card p { margin: 0 0 8px; }

@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  .top-row { gap: 12px; }
  .who { display: none; }
  .auth { padding-top: 32px; }
}

/* Edges and ordering */
.split { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.crumbs { color: var(--muted); font-size: 13px; margin: 0 0 12px; }
.row-link { font-weight: 600; color: var(--fg); }
.card-foot { padding: 14px 20px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); display: flex; justify-content: flex-end; }
fieldset { border: 0; margin: 0; min-width: 0; }
fieldset.bordered { border-top: 1px solid var(--line); }
legend { padding: 0; margin-bottom: 12px; }
.options { display: grid; gap: 10px; }
.options-row { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.option { display: flex; gap: 12px; align-items: flex-start; margin: 0; padding: 14px 16px; border: 1px solid var(--line-2); border-radius: 10px; cursor: pointer; font-weight: 400; }
.option:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.option input { margin-top: 4px; }
.option-body { display: flex; flex-direction: column; gap: 2px; color: var(--fg); }
.price { font-weight: 700; } .price small { font-weight: 500; color: var(--muted); }
select { width: 100%; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 9px; font: inherit; background: var(--surface); color: var(--fg); }
.badge.t-ok { background: var(--ok-soft); color: var(--ok); }
.badge.t-fail { background: var(--fail-soft); color: var(--fail); }
.badge.t-warn { background: #fffaeb; color: #b54708; }
.badge.t-progress { background: var(--accent-soft); color: var(--accent); }
.badge.t-muted { background: var(--surface-2); color: var(--muted); }
@media (prefers-color-scheme: dark) { .badge.t-warn { background: #4e1d09; color: #fdb022; } }
h1 .badge { vertical-align: middle; font-size: 13px; }
.card-foot.left { justify-content: flex-start; }
code.copy { user-select: all; -webkit-user-select: all; word-break: break-all; }
.alert-info { background: var(--accent-soft); border-color: var(--accent-soft); color: var(--accent); }

/* Manage: cancel, backup, delete */
.manage { display: grid; gap: 18px; }
.manage-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; flex-wrap: wrap; }
.manage-row > div:first-child { flex: 1 1 320px; }
.manage-row h3 { margin: 0 0 4px; font-size: 15px; }
.manage-row p { margin: 0; }
details.confirm { position: relative; }
details.confirm > summary { list-style: none; }
details.confirm > summary::-webkit-details-marker { display: none; }
.confirm-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 10; width: 280px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 24px -4px rgba(16, 24, 40, .18); padding: 14px; }
.confirm-pop p { margin: 0 0 10px; font-size: 14px; }
.btn-danger { background: var(--fail); border-color: var(--fail); color: #fff; }

/* Usage meter: widths in steps, since the CSP allows no inline styles */
.meter { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin: 6px 0 4px; max-width: 320px; }
.meter span { display: block; height: 100%; background: var(--accent); }
.meter-warn span { background: #b54708; }
.meter .w0 { width: 0%; }
.meter .w10 { width: 10%; }
.meter .w20 { width: 20%; }
.meter .w30 { width: 30%; }
.meter .w40 { width: 40%; }
.meter .w50 { width: 50%; }
.meter .w60 { width: 60%; }
.meter .w70 { width: 70%; }
.meter .w80 { width: 80%; }
.meter .w90 { width: 90%; }
.meter .w100 { width: 100%; }
