:root {
  color-scheme: light;
  --ink: #172033;
  --muted: #637087;
  --line: #e1e6ef;
  --surface: #fff;
  --canvas: #f5f7fb;
  --brand: #65558f;
  --brand-dark: #4b3d73;
  --brand-wash: #f0edf8;
  --success: #18734d;
  --danger: #a12f38;
  font: 15px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--canvas); }
a { color: var(--brand-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
.topbar { min-height: 68px; display: flex; align-items: center; gap: 30px; padding: 10px max(24px, calc((100vw - 1240px) / 2)); background: var(--brand-dark); color: white; }
.brand { display: inline-flex; align-items: center; gap: 11px; color: white; font-size: 15px; font-weight: 600; line-height: 1.1; }
.brand:hover, .signout:hover { text-decoration: none; }
.brand b { font-weight: 750; }
.brand small { display: block; padding-top: 4px; color: #d8d1e8; font-size: 11px; font-weight: 450; }
.brand-mark { display: grid; width: 38px; height: 38px; place-items: center; border: 1px solid #ffffff40; border-radius: 12px; background: #ffffff16; font-size: 12px; font-weight: 750; }
.topnav { display: flex; gap: 8px; margin-left: auto; }
.topnav a, .signout { padding: 8px 11px; color: #f5f2fb; border-radius: 8px; font-size: 13px; }
.topnav a:hover, .signout:hover { background: #ffffff18; }
.account { display: flex; align-items: center; gap: 10px; color: #e5e0ef; font-size: 13px; }
main { width: min(1240px, 100%); margin: 32px auto 64px; padding: 0 24px; }
footer { padding: 18px 24px 24px; color: #8a94a6; text-align: center; font-size: 12px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 7px; font-size: clamp(25px, 3vw, 32px); font-weight: 680; letter-spacing: -.035em; line-height: 1.2; }
h2 { margin-bottom: 8px; font-size: 17px; font-weight: 650; letter-spacing: -.01em; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin: 10px 0 25px; }
.eyebrow { margin-bottom: 8px; color: var(--brand); font-size: 11px; font-weight: 750; letter-spacing: .12em; }
.muted { color: var(--muted); font-size: 13px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 15px; }
.card, .auth-card { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: 0 5px 18px #24314b08; }
.card { margin: 16px 0; padding: 22px; }
.auth-card { width: min(460px, 100%); margin: min(9vh, 90px) auto 0; padding: clamp(24px, 5vw, 36px); }
.auth-card h1 { margin-bottom: 10px; }
.auth-card form { margin-top: 24px; }
label { display: block; margin: 14px 0 6px; color: #344057; font-size: 13px; font-weight: 620; }
input, select { width: 100%; min-height: 43px; padding: 10px 12px; border: 1px solid #cbd3e0; border-radius: 8px; background: #fff; color: var(--ink); font: inherit; font-size: 14px; }
input:focus, select:focus { outline: 3px solid #7662a526; border-color: #7662a5; }
button { min-height: 39px; margin: 12px 7px 0 0; padding: 9px 14px; border: 0; border-radius: 8px; background: var(--brand); color: white; font: inherit; font-size: 13px; font-weight: 640; cursor: pointer; transition: background-color 150ms ease, transform 150ms ease; }
button:hover { background: var(--brand-dark); }
button:active { transform: translateY(1px); }
button:focus-visible, a:focus-visible { outline: 3px solid #9d8bc9; outline-offset: 2px; }
button.secondary { border: 1px solid var(--line); background: #f5f6f9; color: #303b50; }
button.secondary:hover { background: #eceef4; }
.subtle-link { display: inline-block; margin-top: 18px; font-size: 13px; font-weight: 600; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3px 18px; }
.check-row { display: flex; align-items: center; gap: 9px; margin: 20px 0 7px; }
.check-row input { width: 17px; min-height: 17px; height: 17px; margin: 0; accent-color: var(--brand); }
.flash { margin: 10px 0; padding: 13px 15px; border: 1px solid #ead8a7; border-radius: 9px; background: #fff8e6; color: #594719; font-size: 13px; }
table { width: 100%; border-collapse: collapse; }
.table-wrap { overflow-x: auto; }
th, td { padding: 12px 11px; border-bottom: 1px solid #ebeff4; text-align: left; vertical-align: top; }
th { color: #59667c; font-size: 11px; font-weight: 700; letter-spacing: .055em; text-transform: uppercase; white-space: nowrap; }
code { overflow-wrap: anywhere; color: #47386d; font-size: 12px; }
form.inline { display: inline; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 20px; background: #e7f5ed; color: var(--success); font-size: 12px; font-weight: 650; }
.pill.off { background: #fcebed; color: var(--danger); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.stat { min-height: 118px; }
.stat-value { margin: 9px 0 3px; font-size: 25px; font-weight: 700; letter-spacing: -.03em; }
.stat-label { color: var(--muted); font-size: 12px; }
.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; margin-top: 12px; }
.chart-card { min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: 11px; background: #fbfcfe; }
.chart-card h3 { margin: 0 0 8px; color: #46536a; font-size: 13px; }
.chart-card canvas { display: block; width: 100%; height: 170px; }
.chart-card select { min-height: 36px; }
.storage-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; }
.storage-grid > div { display: flex; justify-content: space-between; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); font-size: 13px; }
.storage-grid b { color: var(--ink); white-space: nowrap; }
.danger-card { border-color: #f0c8cc; }
.danger-button { background: #a12f38; }
.danger-button:hover { background: #7d2029; }
.error-text { color: var(--danger); }
@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; gap: 10px 16px; padding: 12px 17px; }
  .topnav { order: 3; width: 100%; margin: 0; }
  .account { margin-left: auto; }
  main { margin-top: 22px; padding: 0 15px; }
  .card { padding: 17px; }
  .form-grid { grid-template-columns: 1fr; }
  .page-heading { align-items: start; flex-direction: column; }
  th, td { padding: 10px 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
