:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #1a2435;
  background: #f5f7fb;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --bg: #f5f7fb;
  --surface: #fff;
  --surface-muted: #f8faff;
  --text: #1a2435;
  --muted: #6d788a;
  --line: #e5eaf2;
  --primary: #315bd6;
  --primary-soft: #edf2ff;
  --green: #15845b;
  --green-soft: #e8f7f0;
  --red: #c23d4b;
  --red-soft: #fff0f1;
  --amber: #9a6500;
  --amber-soft: #fff6e3;
  --shadow: 0 10px 30px rgba(25, 40, 70, .06);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); }
button, input, select { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.app-shell { min-height: 100vh; }
.sidebar { width: 250px; position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column; padding: 25px 17px 18px; background: var(--surface); border-right: 1px solid var(--line); z-index: 10; }
.brand { display: flex; align-items: center; gap: 11px; padding: 2px 9px 32px; color: var(--text); text-decoration: none; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 15px; letter-spacing: -.02em; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 11px; }
.brand-mark { width: 38px; height: 38px; display: inline-grid; place-items: center; border-radius: 12px; background: #315bd6; color: white; font-weight: 800; font-size: 19px; box-shadow: 0 5px 14px rgba(49, 91, 214, .22); }
.nav-label, .eyebrow { margin: 0; font-size: 10px; line-height: 1.3; font-weight: 750; letter-spacing: .12em; color: var(--muted); }
.nav-label { padding: 0 11px 11px; }
.main-nav { display: grid; gap: 5px; }
.nav-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 12px; border: 0; border-radius: 9px; color: #667287; background: transparent; text-align: left; font-size: 13px; font-weight: 600; transition: background .16s, color .16s; }
.nav-item span { width: 18px; font-size: 17px; text-align: center; }
.nav-item:hover { background: var(--surface-muted); color: var(--text); }
.nav-item.active { color: var(--primary); background: var(--primary-soft); }
.sidebar-bottom { display: flex; align-items: center; gap: 9px; margin-top: auto; padding: 13px 10px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.main-area { margin-left: 250px; min-height: 100vh; }
.topbar { min-height: 92px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 17px clamp(20px, 4vw, 54px); background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar h1 { margin: 5px 0 0; font-size: 21px; letter-spacing: -.035em; }
.top-actions, .user-menu { display: flex; align-items: center; gap: 14px; }
.status-pill { display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 11px; font-weight: 650; white-space: nowrap; }
.status-dot { width: 7px; height: 7px; display: inline-block; flex: 0 0 auto; border-radius: 50%; background: #aab3c1; }
.status-green { background: var(--green); }
.status-red { background: var(--red); }
.status-amber { background: #d99b28; }
.icon-button { width: 36px; height: 36px; display: inline-grid; place-items: center; border: 1px solid var(--line); border-radius: 9px; color: var(--text); background: var(--surface); }
.icon-button:hover, .button-quiet:hover { background: var(--surface-muted); }
.avatar { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; color: var(--primary); background: var(--primary-soft); font-size: 13px; font-weight: 750; }
.user-menu { gap: 9px; }
.user-label strong, .user-label small { display: block; }
.user-label strong { max-width: 150px; overflow: hidden; text-overflow: ellipsis; font-size: 11px; }
.user-label small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.button { min-height: 36px; padding: 8px 13px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); font-size: 12px; font-weight: 650; }
.button-primary { border-color: var(--primary); color: #fff; background: var(--primary); box-shadow: 0 5px 12px rgba(49, 91, 214, .17); }
.button-primary:hover { background: #264dbd; }
.button-quiet { border-color: transparent; color: #667287; }
.button-danger { color: var(--red); border-color: #f0cdd1; background: var(--surface); }
.content { width: min(1450px, 100%); margin: 0 auto; padding: 26px clamp(20px, 4vw, 54px) 46px; }
.page-footer { padding: 0 clamp(20px, 4vw, 54px) 20px; color: #8791a1; font-size: 10px; }
.system-banner { margin: 18px clamp(20px, 4vw, 54px) 0; padding: 11px 14px; border: 1px solid #f1d89f; border-radius: 9px; color: var(--amber); background: var(--amber-soft); font-size: 12px; }
.section-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin: 0 0 16px; }
.section-heading h2 { margin: 0; font-size: 15px; letter-spacing: -.02em; }
.section-heading p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.grid { display: grid; gap: 15px; }
.metric-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.metric-card, .panel { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); }
.metric-card { min-height: 122px; padding: 17px 18px; }
.metric-top { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 11px; font-weight: 600; }
.metric-icon { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px; color: var(--primary); background: var(--primary-soft); }
.metric-value { display: block; margin-top: 12px; font-size: 25px; font-weight: 750; letter-spacing: -.045em; }
.metric-foot { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.overview-grid { grid-template-columns: minmax(0, 1.3fr) minmax(260px, .7fr); margin-top: 19px; }
.panel { overflow: hidden; }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 17px; border-bottom: 1px solid var(--line); }
.panel-header h2 { margin: 0; font-size: 13px; }
.panel-body { padding: 16px 17px; }
.site-state { display: flex; align-items: center; gap: 13px; }
.site-state-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; background: var(--green-soft); color: var(--green); font-size: 19px; }
.site-state-icon.down { color: var(--red); background: var(--red-soft); }
.site-state-icon.unknown { color: var(--amber); background: var(--amber-soft); }
.site-state strong, .site-state span { display: block; }
.site-state strong { font-size: 14px; }
.site-state span { margin-top: 4px; color: var(--muted); font-size: 11px; }
.system-list { display: grid; gap: 0; }
.system-row { display: flex; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 11px; }
.system-row:last-child { border-bottom: 0; }
.system-row span:first-child { color: var(--muted); }
.system-row strong { text-align: right; font-weight: 650; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; white-space: nowrap; }
th { padding: 11px 14px; color: var(--muted); background: var(--surface-muted); font-size: 10px; font-weight: 700; letter-spacing: .03em; }
td { padding: 12px 14px; border-top: 1px solid var(--line); font-size: 11px; }
tbody tr:hover { background: color-mix(in srgb, var(--primary-soft) 35%, var(--surface)); }
.table-empty { padding: 28px 14px; color: var(--muted); text-align: center; white-space: normal; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border-radius: 999px; color: var(--muted); background: var(--surface-muted); font-size: 10px; font-weight: 700; }
.badge-red { color: var(--red); background: var(--red-soft); }
.badge-amber { color: var(--amber); background: var(--amber-soft); }
.badge-green { color: var(--green); background: var(--green-soft); }
.badge-blue { color: var(--primary); background: var(--primary-soft); }
.toolbar { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-bottom: 14px; }
.field, select { min-height: 36px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; color: var(--text); background: var(--surface); font-size: 11px; }
.toolbar .spacer { flex: 1; }
.load-more { display: flex; justify-content: center; padding: 14px; border-top: 1px solid var(--line); }
.notice { padding: 17px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); background: var(--surface); font-size: 12px; }
.form-error { margin: 0; color: var(--red); font-size: 11px; }
.stack { display: grid; gap: 9px; }
.stack label { margin-top: 5px; color: #49566b; font-size: 11px; font-weight: 650; }
.stack input, .stack select { width: 100%; min-height: 42px; padding: 10px 11px; border: 1px solid var(--line); border-radius: 8px; color: var(--text); background: var(--surface); outline: none; }
.stack input:focus, .field:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(49, 91, 214, .12); }
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 20% 10%, #e6edff 0, transparent 32%), var(--bg); }
.login-card { width: min(420px, 100%); padding: 34px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: 0 24px 70px rgba(25, 40, 70, .12); }
.login-card .brand-mark { margin-bottom: 23px; }
.login-card h1 { margin: 8px 0 6px; font-size: 24px; letter-spacing: -.04em; }
.muted { color: var(--muted); font-size: 12px; line-height: 1.55; }
.login-card .stack { margin-top: 22px; }
.login-card .button { min-height: 42px; margin-top: 8px; }
.mfa-secret { display: block; overflow-wrap: anywhere; padding: 12px; border: 1px solid var(--line); border-radius: 8px; color: var(--text); background: var(--surface-muted); font-size: 14px; letter-spacing: .08em; user-select: text; }
.login-footnote { margin: 19px 0 0; padding-top: 15px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; }
.mobile-only { display: none; }
.detail-list { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.detail-item { padding: 12px; border-radius: 8px; background: var(--surface-muted); }
.detail-item small, .detail-item strong { display: block; }
.detail-item small { color: var(--muted); font-size: 10px; }
.detail-item strong { margin-top: 5px; font-size: 12px; overflow-wrap: anywhere; }
.account-form { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); align-items: end; gap: 10px; margin-bottom: 18px; }
.account-form .stack { gap: 6px; }
.error-box { padding: 11px 13px; border-radius: 8px; color: var(--red); background: var(--red-soft); font-size: 11px; }
@media (max-width: 1050px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .overview-grid { grid-template-columns: 1fr; }
  .account-form { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 760px) {
  .sidebar { width: 260px; transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow); }
  .sidebar.open { transform: translateX(0); }
  .main-area { margin-left: 0; }
  .topbar { min-height: 78px; padding: 13px 16px; }
  .topbar h1 { font-size: 18px; }
  .mobile-only { display: inline-grid; }
  .top-actions { gap: 7px; }
  .status-pill { display: none; }
  .user-label { display: none; }
  .user-menu { gap: 6px; }
  .user-menu .button { padding: 7px 8px; font-size: 10px; }
  .content { padding: 19px 14px 34px; }
  .page-footer { padding: 0 14px 16px; line-height: 1.5; }
  .system-banner { margin: 12px 14px 0; }
  .metric-grid { gap: 9px; }
  .metric-card { min-height: 108px; padding: 13px; }
  .metric-value { font-size: 21px; }
  .metric-top { font-size: 10px; }
  .metric-foot { line-height: 1.4; }
  .panel-header, .panel-body { padding-left: 13px; padding-right: 13px; }
  .table-wrap { margin: 0 -13px; }
  table { min-width: 640px; }
  .login-card { padding: 27px 22px; }
  .account-form { grid-template-columns: 1fr; }
  .detail-list { grid-template-columns: 1fr; }
}
@media (max-width: 390px) {
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .metric-card { padding: 11px; }
  .metric-value { font-size: 19px; }
  .topbar .eyebrow { font-size: 8px; }
  .user-menu .button { min-height: 32px; }
}
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111827;
  --surface: #182233;
  --surface-muted: #202d40;
  --text: #e7edf6;
  --muted: #9aa8bb;
  --line: #2b394d;
  --primary: #88a7ff;
  --primary-soft: #25375d;
  --green: #63d0a0;
  --green-soft: #193d34;
  --red: #ff8992;
  --red-soft: #46272f;
  --amber: #f0bd58;
  --amber-soft: #453920;
  --shadow: 0 10px 30px rgba(0, 0, 0, .16);
}
[data-theme="dark"] .login-shell { background: radial-gradient(circle at 20% 10%, #1b2b50 0, transparent 32%), var(--bg); }
[data-theme="dark"] .stack label { color: #b7c3d4; }
/* Dashboard views */
.stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 13px; }
.stat-card { min-height: 112px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); }
.stat-card span, .stat-card strong, .stat-card small { display: block; }
.stat-card span, .detail-grid span { color: var(--muted); font-size: 11px; }
.stat-card strong { margin-top: 12px; font-size: 23px; letter-spacing: -.03em; }
.stat-card small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.panel-grid, .stack-panels { display: grid; gap: 15px; margin-top: 16px; }
.panel-grid { grid-template-columns: 1.15fr .85fr; }
.panel { padding: 18px; }
.panel h2 { margin: 5px 0 12px; font-size: 16px; }
.panel-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.panel-heading h2 { margin-bottom: 0; }
.detail-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; margin-top: 18px; }
.detail-grid strong { display: block; margin-top: 5px; font-size: 12px; overflow-wrap: anywhere; }
.badge { text-transform: capitalize; }
.text-button { padding: 0; border: 0; color: var(--primary); background: transparent; text-decoration: underline; }
.empty { padding: 26px; color: var(--muted); text-align: center; }
.detail-panel { margin-top: 18px; padding: 15px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-muted); }
.detail-panel h3 { margin: 0 0 6px; }
.inline-form { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; margin: 15px 0; }
.inline-form h3 { flex-basis: 100%; margin: 0 0 4px; font-size: 13px; }
.inline-form input, .inline-form select { min-width: 170px; min-height: 36px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; color: var(--text); background: var(--surface); }
.loading { color: var(--muted); }
.error-panel { border-color: var(--red); }
.error-panel h2 { color: var(--red); }
@media (max-width: 1050px) { .stat-grid { grid-template-columns: repeat(2,minmax(0,1fr)); } .panel-grid { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .stat-grid { gap: 9px; } .stat-card { min-height: 99px; padding: 12px; } .stat-card strong { font-size: 19px; } .panel { padding: 14px; } .inline-form { align-items: stretch; flex-direction: column; } .inline-form input, .inline-form select, .inline-form .button { width: 100%; } }
.diagnostic-list { display: grid; gap: 13px; }
.diagnostic-card { padding: 17px; }
.diagnostic-card h2 { max-width: 850px; line-height: 1.45; }
.diagnostic-card h3 { margin: 0 0 9px; font-size: 12px; }
.diagnostic-card ul { margin: 0; padding-left: 18px; color: var(--text); font-size: 11px; line-height: 1.65; }
.diagnostic-columns { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 18px; margin-top: 18px; }
.diagnostic-columns section { min-width: 0; }
.diagnostic-columns p { font-size: 11px; line-height: 1.6; }
.diagnostic-columns p strong { font-size: 11px; }
.ai-note { margin-top: 17px; padding: 14px; border: 1px solid var(--primary); border-radius: 9px; background: var(--primary-soft); font-size: 11px; line-height: 1.6; }
.ai-note p { margin: 8px 0; }
.diagnostic-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 17px; padding-top: 12px; border-top: 1px solid var(--line); }
.empty-state { color: var(--muted); text-align: center; }
@media (max-width: 760px) { .diagnostic-columns { grid-template-columns: 1fr; gap: 15px; } .diagnostic-actions { flex-direction: column; align-items: flex-start; } }
