:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #071321;
  color: #edf5ff;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --muted: #a7bacd;
  --line: #233a50;
  --surface: #0d1d2d;
  --accent: #50d0e6;
}

* { box-sizing: border-box; }
body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(ellipse at 15% -15%, #1d536b66, transparent 45%),
    radial-gradient(ellipse at 100% 25%, #1c3f6255, transparent 38%),
    #071321;
}
button, input, textarea { font: inherit; }
.page { width: min(1120px, calc(100% - 36px)); margin: 0 auto; padding-bottom: 64px; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 76px; border-bottom: 1px solid #ffffff12; margin-bottom: 36px;
}
.brand { display: flex; align-items: center; gap: 11px; color: #f4f8fc; font-size: 20px; font-weight: 800; text-decoration: none; letter-spacing: -.04em; }
.brand img { display: block; width: 42px; height: 42px; border: 1px solid #34506a; border-radius: 13px; box-shadow: 0 5px 18px #0004; }
.brand span { color: #f4f8fc; }
.top-actions { display: flex; align-items: center; gap: 14px; }
.session-status, .muted, .hint, small { color: var(--muted); }
.session-status { font-size: 13px; }
.hero { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
h1 { margin: 6px 0 8px; font-size: clamp(28px, 5vw, 42px); letter-spacing: -.04em; }
h2 { margin: 8px 0 10px; font-size: 22px; letter-spacing: -.025em; }
h3 { margin: 20px 0 6px; font-size: 16px; }
p { line-height: 1.6; }
.hero p, .login-card > p { max-width: 690px; margin: 0; color: var(--muted); }
.eyebrow { color: #67d7e9; font-size: 11px; font-weight: 800; letter-spacing: .14em; }
.card, .login-card {
  border: 1px solid var(--line); border-radius: 20px;
  background: linear-gradient(145deg, #102237f2, #0b1927f5);
  box-shadow: 0 18px 50px #0002;
}
.login-card { max-width: 480px; margin: 10vh auto; padding: clamp(24px, 5vw, 38px); }
.login-card h1 { margin-top: 10px; }
.stack { display: grid; gap: 18px; }
#login-form { margin-top: 26px; }
#settings-form { gap: 18px; }
.card { padding: clamp(20px, 3vw, 28px); }
.section-title { display: flex; justify-content: space-between; align-items: start; }
.muted { margin: 0 0 18px; font-size: 14px; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
label { display: grid; align-content: start; gap: 8px; font-size: 13px; font-weight: 650; }
label small { font-size: 12px; font-weight: 400; }
input:not([type="checkbox"]):not([type="file"]), textarea {
  width: 100%; min-width: 0; border: 1px solid #34506a; border-radius: 11px;
  background: #071523; color: #f2f7fc; padding: 12px 13px; outline: none;
}
input:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px #50d0e622; }
textarea { resize: vertical; line-height: 1.5; }
.span-2 { grid-column: span 2; }
.button {
  min-height: 44px; border: 0; border-radius: 11px; padding: 0 18px;
  background: linear-gradient(110deg, #62e1e7, #58c1ea);
  color: #08202c; font-weight: 800; cursor: pointer;
}
.button:disabled { opacity: .55; cursor: wait; }
.button-secondary { color: #e8f5ff; background: #1a3953; border: 1px solid #345572; }
.button-quiet { min-height: 34px; padding: 0 12px; color: #dceafa; background: #1a2c3e; }
.toggle-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.toggle {
  grid-template-columns: 1fr auto; align-items: center; border: 1px solid #2a435a;
  padding: 16px; border-radius: 14px; background: #081827;
}
.toggle span { display: grid; gap: 6px; }
.toggle small { line-height: 1.45; }
.toggle input { accent-color: var(--accent); width: 20px; height: 20px; }
.check { display: flex; align-items: center; gap: 9px; color: var(--muted); font-weight: 500; }
.check input { accent-color: var(--accent); }
.inline-actions { display: flex; flex-wrap: wrap; gap: 20px; margin-top: 14px; }
.test-row, .upload-row { display: flex; align-items: end; gap: 14px; margin-top: 20px; }
.test-row label { flex: 1; }
.upload-row { flex-wrap: wrap; align-items: center; }
.upload-row input[type="file"] { max-width: 100%; color: var(--muted); }
.upload-row .check { flex: 1 1 100%; }
.callout, .hint {
  border-left: 3px solid #51cce1; padding: 10px 14px; background: #12304777;
  border-radius: 0 10px 10px 0; color: #c4d8e7; font-size: 13px; line-height: 1.6;
}
.hint { border: 0; padding: 0; background: none; overflow-wrap: anywhere; }
code { color: #81deeb; overflow-wrap: anywhere; }
.divider { height: 1px; background: #ffffff17; margin: 22px 0; }
.sticky-actions { position: sticky; bottom: 12px; display: flex; align-items: center; gap: 14px;
  padding: 12px; border: 1px solid #34506a; border-radius: 15px; background: #081523ed;
  backdrop-filter: blur(16px); z-index: 2; }
#form-message, #password-message { color: #9ae9d3; font-size: 13px; }
.status-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin: 20px 0; }
.status-item { border: 1px solid var(--line); background: #0b1b2b; border-radius: 13px; padding: 13px; }
.status-item b { display: block; font-size: 12px; margin-bottom: 6px; }
.status-item span { font-size: 12px; color: var(--muted); }
.status-item .good { color: #8de0c4; }
.status-item .missing { color: #f5c27a; }
.status-pill { flex: 0 0 auto; border-radius: 99px; padding: 8px 12px; color: #9ae9d3; background: #173c3a; font-size: 12px; }
.password-card { margin-top: 24px; }
footer { padding: 24px 0; text-align: center; font-size: 12px; color: #7890a7; }
.toast { position: fixed; right: 20px; bottom: 20px; max-width: min(430px, calc(100% - 40px));
  border: 1px solid #34506a; border-radius: 12px; background: #10243a; padding: 14px 18px;
  box-shadow: 0 10px 35px #0008; z-index: 4; }
.theme-toggle { white-space: nowrap; }
.dashboard-card { margin-bottom: 24px; }
.dashboard-heading { align-items: center; gap: 16px; }
.dashboard-heading h2 { margin-bottom: 0; }
.dashboard-note { margin: 8px 0 16px; }
.dashboard-status { min-height: 20px; margin: 0 0 14px; color: var(--muted); font-size: 12px; }
.metric-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.metric-card { min-width: 0; display: grid; gap: 8px; border: 1px solid var(--line);
  border-radius: 15px; padding: 16px; background: #0b1b2b; }
.metric-card > span { font-size: 12px; }
.metric-card strong { font-size: clamp(18px, 2.2vw, 26px); line-height: 1.1; overflow-wrap: anywhere; }
.metric-card small { font-size: 11px; }
.dashboard-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 20px; }
.table-panel { min-width: 0; border: 1px solid var(--line); border-radius: 16px; padding: 18px;
  background: #0b1b2b; }
.table-heading { display: flex; align-items: end; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.table-heading h3 { margin: 0 0 5px; }
.table-heading .muted { margin: 0; font-size: 12px; }
.search-field { flex: 0 1 230px; font-size: 11px; }
.search-field input { padding: 9px 10px !important; }
.table-scroll { max-width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: 12px; }
th, td { padding: 11px 9px; border-bottom: 1px solid #ffffff12; vertical-align: top; }
th { color: var(--muted); font-size: 10px; font-weight: 750; letter-spacing: .04em; text-transform: uppercase; }
td { min-width: 82px; }
td > span, td > small { display: block; }
td > span { font-weight: 650; overflow-wrap: anywhere; }
td > small { margin-top: 4px; color: var(--muted); font-size: 10px; overflow-wrap: anywhere; }
.empty-cell { padding: 26px 12px; color: var(--muted); text-align: center; }
.access-badge { display: inline-block; width: fit-content; border-radius: 99px; padding: 5px 9px;
  font-size: 10px; font-weight: 750; }
.access-premium { color: #8de0c4; background: #173c3a; }
.access-trial { color: #f3d08d; background: #47391e; }
.access-free { color: #b4c3d2; background: #25384a; }
.table-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 12px; }
.table-footer .muted { margin: 0; font-size: 11px; }
.table-footer > div { display: flex; gap: 7px; }
.table-footer .button { min-height: 34px; padding: 0 10px; font-size: 11px; }
.hidden { display: none !important; }

body[data-theme="light"] {
  color-scheme: light;
  color: #17324b;
  --muted: #60778e;
  --line: #d4e0ec;
  --surface: #ffffff;
  --accent: #3478c8;
  background:
    radial-gradient(ellipse at 15% -15%, #d7eafa, transparent 45%),
    radial-gradient(ellipse at 100% 25%, #e0ebf6, transparent 38%),
    #f2f7fc;
}
body[data-theme="light"] .topbar { border-bottom-color: #17324b18; }
body[data-theme="light"] .brand,
body[data-theme="light"] .brand span { color: #17324b; }
body[data-theme="light"] .brand img { border-color: #c3d4e5; box-shadow: 0 5px 18px #1c385018; }
body[data-theme="light"] .eyebrow { color: #3478c8; }
body[data-theme="light"] .card,
body[data-theme="light"] .login-card {
  border-color: #d4e0ec;
  background: linear-gradient(145deg, #ffffff, #f8fbfe);
  box-shadow: 0 18px 50px #1c38500d;
}
body[data-theme="light"] input:not([type="checkbox"]):not([type="file"]),
body[data-theme="light"] textarea {
  border-color: #c7d7e6;
  background: #ffffff;
  color: #17324b;
}
body[data-theme="light"] input:focus,
body[data-theme="light"] textarea:focus { border-color: #3478c8; box-shadow: 0 0 0 3px #3478c822; }
body[data-theme="light"] .button {
  background: linear-gradient(110deg, #3478c8, #4285f4);
  color: #ffffff;
}
body[data-theme="light"] .button-secondary,
body[data-theme="light"] .button-quiet {
  border: 1px solid #cbd9e7;
  background: #eaf1f8;
  color: #23425f;
}
body[data-theme="light"] .toggle {
  border-color: #d4e0ec;
  background: #f6f9fc;
}
body[data-theme="light"] .callout {
  border-left-color: #3478c8;
  background: #eaf3fb;
  color: #37556f;
}
body[data-theme="light"] .hint { color: #60778e; }
body[data-theme="light"] code { color: #2868ae; }
body[data-theme="light"] .divider { background: #17324b1a; }
body[data-theme="light"] .sticky-actions { border-color: #cbd9e7; background: #ffffffed; }
body[data-theme="light"] .status-item,
body[data-theme="light"] .metric-card,
body[data-theme="light"] .table-panel {
  border-color: #d4e0ec;
  background: #ffffff;
}
body[data-theme="light"] .status-item .good { color: #187457; }
body[data-theme="light"] .status-item .missing { color: #986000; }
body[data-theme="light"] .status-pill { color: #187457; background: #e2f3ed; }
body[data-theme="light"] .password-card { margin-top: 24px; }
body[data-theme="light"] footer { color: #60778e; }
body[data-theme="light"] .toast { border-color: #cbd9e7; background: #ffffff; color: #17324b; }
body[data-theme="light"] #form-message,
body[data-theme="light"] #password-message { color: #187457; }
body[data-theme="light"] th,
body[data-theme="light"] td { border-bottom-color: #17324b14; }
body[data-theme="light"] .access-premium { color: #187457; background: #e2f3ed; }
body[data-theme="light"] .access-trial { color: #805700; background: #fbf1d8; }
body[data-theme="light"] .access-free { color: #526b82; background: #edf2f7; }

@media (max-width: 720px) {
  .page { width: min(100% - 24px, 600px); }
  .topbar { margin-bottom: 24px; }
  .session-status { display: none; }
  .hero { align-items: start; flex-direction: column; }
  .field-grid, .toggle-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .test-row { align-items: stretch; flex-direction: column; }
  .status-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .table-heading { align-items: stretch; flex-direction: column; }
  .search-field { flex-basis: auto; }
  .sticky-actions { align-items: stretch; flex-direction: column; }
}
@media (max-width: 430px) {
  .top-actions { gap: 7px; }
  .theme-toggle, #logout-button { padding: 0 9px; font-size: 11px; }
  .dashboard-heading { align-items: start; }
  .table-panel { padding: 14px; }
}
