:root {
  color-scheme: light dark;
  --bg: #f3f6f8;
  --surface: #ffffff;
  --surface-2: #eef3f7;
  --ink: #18212b;
  --muted: #617083;
  --line: #d7e0ea;
  --primary: #0b6bcb;
  --good: #12805c;
  --warn: #a15c00;
  --bad: #b42318;
  --shadow: 0 12px 30px rgba(21, 32, 43, .08);
}
@media (prefers-color-scheme: dark) {
  :root { --bg:#101419; --surface:#181f27; --surface-2:#222b35; --ink:#edf2f7; --muted:#a6b2c0; --line:#354252; --primary:#68b7ff; --good:#55d49f; --warn:#f2b154; --bad:#ff8b82; --shadow:0 12px 30px rgba(0,0,0,.28); }
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink); font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; letter-spacing: 0; }
a { color: inherit; text-decoration: none; }
.app { min-height: 100vh; display: grid; grid-template-rows: auto 1fr; }
.header { height: 64px; display: flex; align-items: center; justify-content: space-between; padding: 0 22px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 2; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.logo { width: 34px; height: 34px; border-radius: 8px; background: var(--primary); color: white; display: grid; place-items: center; font-weight: 800; }
.brand strong { display:block; font-size: 16px; }
.brand span { display:block; font-size: 12px; color: var(--muted); }
.header-controls { display:flex; align-items:end; gap: 10px; }
label { color: var(--muted); font-size: 12px; display:grid; gap:4px; }
input, select, button, textarea { font: inherit; border:1px solid var(--line); border-radius: 6px; min-height: 36px; background: var(--surface); color: var(--ink); }
input, select, textarea { padding: 0 10px; }
button { padding: 0 12px; cursor: pointer; }
button.primary { background: var(--primary); border-color: var(--primary); color: white; }
button:disabled { opacity: .55; cursor: wait; }
.layout { display: grid; grid-template-columns: 232px minmax(0, 1fr); }
.nav { background: var(--surface); border-right: 1px solid var(--line); padding: 18px 12px; }
.nav a { display:block; padding: 11px 12px; border-radius: 6px; color: var(--muted); margin-bottom: 4px; }
.nav a.active, .nav a:hover { background: var(--surface-2); color: var(--ink); }
.content { min-width:0; padding: 22px; }
.breadcrumb { color: var(--muted); font-size: 13px; margin-bottom: 6px; }
h1 { margin: 0 0 18px; font-size: 25px; }
.grid { display:grid; gap: 14px; }
.grid.two { grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.panel { background: var(--surface); border:1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); padding: 16px; min-width:0; }
.panel h2 { font-size: 16px; margin: 0 0 12px; }
.toolbar { display:flex; flex-wrap:wrap; gap:8px; margin-bottom: 12px; }
.form { display:grid; grid-template-columns: repeat(4, minmax(130px, 1fr)); gap: 10px; margin-bottom: 12px; }
.metric { background: var(--surface-2); border:1px solid var(--line); border-radius: 8px; padding: 12px; }
.metric span { color: var(--muted); font-size: 12px; display:block; }
.metric strong { display:block; margin-top:4px; font-size: 18px; overflow-wrap:anywhere; }
.table-wrap { overflow:auto; border:1px solid var(--line); border-radius: 8px; }
table { width:100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 10px 11px; border-bottom:1px solid var(--line); text-align:left; white-space: nowrap; }
th { color: var(--muted); background: var(--surface-2); font-weight:600; }
tr:last-child td { border-bottom:0; }
.status-pill { display:inline-flex; align-items:center; border-radius: 999px; padding: 3px 8px; background: var(--surface-2); color: var(--muted); font-size: 12px; }
.status-pill.ok { color: var(--good); }
.status-pill.warn { color: var(--warn); }
.status-pill.bad { color: var(--bad); }
.skeleton { min-height: 64px; border-radius:8px; background: linear-gradient(90deg, var(--surface-2), var(--surface), var(--surface-2)); background-size: 220% 100%; animation: shimmer 1.3s infinite; display:none; }
.loading .skeleton { display:block; }
@keyframes shimmer { from { background-position: 0 0; } to { background-position: -220% 0; } }
.json { background:#0d1117; color:#edf2f7; padding:14px; border-radius:8px; min-height:180px; max-height:420px; overflow:auto; white-space:pre-wrap; overflow-wrap:anywhere; font-size:12px; }
.error { color: var(--bad); min-height: 20px; white-space:pre-wrap; }
.toast { position: fixed; right: 18px; bottom:18px; min-width:220px; background: var(--surface); border:1px solid var(--line); border-radius:8px; box-shadow:var(--shadow); padding:10px 12px; opacity:0; transition: opacity .16s ease; pointer-events:none; }
.toast.show { opacity:1; }
.small { color: var(--muted); font-size: 12px; }
.page-heading, .section-heading { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; }
.page-heading { margin-bottom:18px; }
.page-heading h1 { margin-bottom:4px; }
.page-heading p, .section-heading p { margin:0; color:var(--muted); font-size:13px; }
.section-heading { align-items:center; margin-bottom:12px; }
.section-heading h2 { margin-bottom:3px; }
.dashboard-metrics { grid-template-columns:repeat(4, minmax(0, 1fr)); }
.button-link { display:inline-flex; align-items:center; min-height:34px; padding:0 11px; border:1px solid var(--line); border-radius:6px; color:var(--primary); font-size:13px; white-space:nowrap; }
.attention-list { display:grid; gap:8px; }
.attention-item { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:12px; border:1px solid var(--line); border-radius:8px; background:var(--surface-2); }
.attention-item strong, .attention-item span { display:block; }
.attention-item span { margin-top:3px; color:var(--muted); font-size:12px; }
.attention-total { min-width:32px; min-height:32px; display:grid !important; place-items:center; border-radius:999px; background:color-mix(in srgb, var(--bad) 14%, transparent); color:var(--bad) !important; font-size:14px !important; font-weight:800; }
.empty-state { min-height:160px; display:grid; place-content:center; text-align:center; gap:6px; color:var(--good); }
.empty-state span { color:var(--muted); font-size:13px; }
.permission-notice { border-color:var(--bad); }
.diagnostic-panel .json { min-height:100px; }
.quick-action-grid { display:grid; grid-template-columns:repeat(4, minmax(0, 1fr)); gap:14px; }
.quick-action { display:grid; gap:4px; padding:15px; border:1px solid var(--line); border-radius:10px; background:var(--surface); box-shadow:var(--shadow); }
.quick-action:hover { border-color:var(--primary); transform:translateY(-1px); }
.quick-action span { width:max-content; padding:3px 7px; border-radius:999px; background:var(--surface-2); color:var(--primary); font-size:11px; font-weight:700; }
.quick-action strong { margin-top:5px; font-size:15px; }
.quick-action small { color:var(--muted); font-size:12px; }
.readiness-list { display:grid; gap:9px; }
.readiness-item { display:flex; align-items:center; gap:11px; padding:10px 11px; border:1px solid var(--line); border-radius:8px; }
.readiness-item strong, .readiness-item small { display:block; }
.readiness-item small { margin-top:2px; color:var(--muted); font-size:12px; }
.readiness-dot { width:10px; height:10px; flex:0 0 10px; border-radius:999px; background:var(--muted); }
.readiness-dot.ok { background:var(--good); }
.readiness-dot.warn { background:var(--warn); }
.readiness-dot.bad { background:var(--bad); }
.distribution-chart { display:grid; gap:13px; padding:4px 0; }
.distribution-row { display:grid; gap:6px; }
.distribution-label { display:flex; justify-content:space-between; gap:12px; font-size:12px; }
.distribution-label span { color:var(--muted); }
.distribution-track { height:12px; overflow:hidden; border-radius:999px; background:var(--surface-2); }
.distribution-bar { display:block; height:100%; border-radius:inherit; background:var(--primary); }
.distribution-bar.present { background:var(--good); }
.distribution-bar.late { background:var(--warn); }
.distribution-bar.absent { background:var(--bad); }
.distribution-bar.partial { background:var(--primary); }
.distribution-bar.exception { background:#7c3aed; }
.notification-layout { grid-template-columns:minmax(0, 1.25fr) minmax(300px, .75fr); }
.notification-list { display:grid; gap:10px; }
.notification-card { display:grid; grid-template-columns:5px minmax(0, 1fr); overflow:hidden; border:1px solid var(--line); border-radius:10px; background:var(--surface); }
.notification-card.read { opacity:.72; }
.notification-card.unread { box-shadow:0 8px 20px rgba(21,32,43,.07); }
.notification-accent { background:var(--primary); }
.notification-accent.success { background:var(--good); }
.notification-accent.warning { background:var(--warn); }
.notification-accent.critical { background:var(--bad); }
.notification-body { padding:13px 14px; }
.notification-body h3 { margin:5px 0; font-size:15px; }
.notification-body p { margin:0 0 11px; color:var(--muted); font-size:13px; line-height:1.55; white-space:pre-wrap; }
.notification-meta { display:flex; justify-content:space-between; gap:10px; color:var(--muted); font-size:11px; }
.notification-form { display:grid; gap:11px; }
.notification-form textarea { padding:9px 10px; resize:vertical; }
@media (max-width: 980px) { .notification-layout { grid-template-columns:1fr; } }
@media (max-width: 980px) { .layout { grid-template-columns:1fr; } .nav { display:flex; overflow:auto; gap:6px; } .nav a { white-space:nowrap; } .header { height:auto; align-items:flex-start; gap:12px; padding:14px; } .header-controls, .form, .grid.two, .grid.three { grid-template-columns:1fr; display:grid; width:100%; } }
@media (max-width: 980px) { .dashboard-metrics, .quick-action-grid { grid-template-columns:repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) { .page-heading, .section-heading { display:grid; } .dashboard-metrics, .quick-action-grid { grid-template-columns:1fr; } }

.auth-panel {
  border-top: 1px solid #d7dde8;
  border-bottom: 1px solid #d7dde8;
  background: #f8fafc;
  padding: 10px 18px;
}
.auth-grid,
.auth-status {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  align-items: end;
}
.auth-grid label {
  display: grid;
  gap: 4px;
  color: #526071;
  font-size: 12px;
}
.auth-grid input,
.auth-grid select {
  min-height: 34px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 0 9px;
  background: #fff;
}
.auth-grid button {
  min-height: 34px;
}
.auth-status {
  margin-top: 8px;
  font-size: 12px;
  color: #475569;
}
.auth-status strong {
  color: #0f172a;
}
@media (prefers-color-scheme: dark) {
  .auth-panel { background: #111827; border-color: #334155; }
  .auth-grid label, .auth-status { color: #cbd5e1; }
  .auth-grid input, .auth-grid select { background: #0f172a; border-color: #334155; color: #e5e7eb; }
  .auth-status strong { color: #f8fafc; }
}
