:root { color-scheme: light; --bg:#f4f7fb; --panel:#fff; --ink:#172033; --muted:#667085; --line:#dfe5ee; --accent:#5b5ce2; --accent2:#8b5cf6; --green:#16a34a; --red:#dc2626; }
* { box-sizing:border-box; }
body { margin:0; min-height:100vh; color:var(--ink); background:var(--bg); font-family:Arial,Tahoma,sans-serif; }
button,input,select { font:inherit; }
button,a { min-height:40px; border-radius:6px; }
button { border:1px solid var(--line); background:#fff; color:var(--ink); cursor:pointer; }
a { color:var(--accent); text-decoration:none; }
[hidden] { display:none !important; }
.auth-view { min-height:100vh; display:grid; place-items:center; padding:20px; background:linear-gradient(145deg,#eef2ff,#f8fafc 50%,#ecfeff); }
.auth-panel { width:min(430px,100%); padding:28px; border:1px solid var(--line); border-radius:8px; background:rgba(255,255,255,.94); box-shadow:0 24px 60px rgba(15,23,42,.12); }
.brand-mark,.admin-brand span { display:grid; place-items:center; width:42px; height:42px; border-radius:8px; color:#fff; background:linear-gradient(135deg,var(--accent),var(--accent2)); font-weight:900; }
.eyebrow { margin:14px 0 4px; color:var(--accent); font-size:12px; font-weight:900; text-transform:uppercase; }
h1,h2,p { margin-top:0; }
h1 { margin-bottom:6px; font-size:24px; }
h2 { margin-bottom:0; font-size:17px; }
.auth-panel>div:nth-child(2)>p:last-child,.section-toolbar p { color:var(--muted); font-size:13px; }
form label { display:grid; gap:6px; margin-top:14px; font-size:13px; font-weight:800; }
input,select { width:100%; min-height:42px; padding:0 11px; border:1px solid #cfd7e3; border-radius:6px; background:#fff; color:var(--ink); }
input:focus,select:focus,button:focus-visible,a:focus-visible { outline:3px solid rgba(91,92,226,.22); outline-offset:1px; border-color:var(--accent); }
.password-field { position:relative; display:block; min-width:0; }
.password-field input { padding-right:72px; }
.password-toggle { position:absolute; top:4px; right:4px; min-width:62px; min-height:34px; padding:0 10px; border-color:transparent; background:#eef2ff; color:#4338ca; font-size:12px; font-weight:800; }
.password-toggle:hover { background:#e0e7ff; }
#authSubmit,.primary,#newUserBtn,#refreshDashboard { padding:0 16px; color:#fff; border-color:var(--accent); background:var(--accent); font-weight:800; }
#authSubmit { width:100%; margin:18px 0 14px; }
.form-error { min-height:18px; margin:8px 0; color:var(--red); font-size:12px; }
.admin-shell { min-height:100vh; display:grid; grid-template-columns:240px minmax(0,1fr); }
.sidebar { position:sticky; top:0; height:100vh; display:flex; flex-direction:column; padding:18px 14px; background:#111827; color:#e5e7eb; }
.admin-brand { display:flex; align-items:center; gap:10px; min-height:48px; padding:0 6px; color:#fff; }
.sidebar nav { display:grid; gap:6px; margin-top:28px; }
.nav-item { width:100%; min-height:44px; display:flex; align-items:center; justify-content:flex-start; padding:0 12px; color:#cbd5e1; background:transparent; border:1px solid transparent; font-weight:700; }
.nav-item:hover,.nav-item.active { color:#fff; background:#272d48; border-color:#3c4261; }
.sidebar-user { margin-top:auto; display:grid; gap:6px; padding:14px 8px 0; border-top:1px solid #303849; }
.sidebar-user span { color:#9ca3af; font-size:12px; }
#logoutBtn { margin-top:8px; color:#fecaca; background:#2a1720; border-color:#58303d; }
.admin-main { min-width:0; padding:24px; }
.admin-header,.section-toolbar,.panel-head,.header-actions { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.admin-header { margin-bottom:18px; }
.admin-header .eyebrow { margin-top:0; }
.header-actions span { color:var(--muted); font-size:12px; }
.metric-grid { display:grid; grid-template-columns:repeat(6,minmax(120px,1fr)); gap:12px; }
.metric { min-width:0; padding:16px; border:1px solid var(--line); border-radius:8px; background:var(--panel); box-shadow:0 8px 20px rgba(15,23,42,.05); }
.metric span { display:block; min-height:32px; color:var(--muted); font-size:12px; }
.metric strong { display:block; margin-top:8px; font-size:28px; }
.metric.warn strong { color:#d97706; }
.scope-note { margin:0 0 14px; padding:11px 14px; border:1px solid #bae6fd; border-radius:7px; color:#075985; background:#f0f9ff; font-size:13px; }
.dashboard-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; margin-top:14px; }
.data-panel { min-width:0; border:1px solid var(--line); border-radius:8px; background:var(--panel); overflow:hidden; }
.span-2 { grid-column:span 2; }
.panel-head { min-height:52px; padding:0 16px; border-bottom:1px solid var(--line); }
.panel-head a { min-height:auto; font-size:13px; }
.table-scroll { overflow:auto; }
table { width:100%; min-width:720px; border-collapse:collapse; }
th,td { padding:11px 14px; border-bottom:1px solid #edf0f5; text-align:left; white-space:nowrap; font-size:13px; }
th { color:var(--muted); background:#fafbfc; font-size:11px; text-transform:uppercase; }
.badge { display:inline-flex; align-items:center; min-height:26px; padding:0 8px; border-radius:999px; background:#eef2ff; color:#4338ca; font-size:11px; font-weight:800; }
.badge.off { color:#991b1b; background:#fee2e2; }
.badge.ok { color:#166534; background:#dcfce7; }
.badge.warn { color:#92400e; background:#fef3c7; }
.missing-fields { display:block; max-width:260px; margin-top:5px; white-space:normal; }
.quality-ok { color:#166534; background:#f0fdf4; }
.bar-list { display:grid; gap:12px; padding:16px; }
.bar-row { display:grid; grid-template-columns:minmax(90px,1fr) 3fr 32px; align-items:center; gap:10px; font-size:13px; }
.bar-track { height:8px; overflow:hidden; border-radius:4px; background:#edf0f5; }
.bar-track i { display:block; height:100%; background:linear-gradient(90deg,var(--accent),var(--accent2)); }
.activity-list { display:grid; }
.activity-item { display:grid; grid-template-columns:150px minmax(0,1fr) 150px; gap:12px; padding:12px 16px; border-bottom:1px solid #edf0f5; font-size:13px; }
.activity-item span { color:var(--muted); }
.section-toolbar { margin-bottom:14px; }
.section-toolbar p { margin:4px 0 0; }
dialog { width:min(500px,calc(100% - 24px)); padding:0; border:0; border-radius:8px; box-shadow:0 28px 80px rgba(15,23,42,.28); }
dialog::backdrop { background:rgba(15,23,42,.58); }
#userForm { padding:20px; }
.dialog-head,.dialog-actions { display:flex; align-items:center; justify-content:space-between; gap:10px; }
.dialog-head button { width:40px; padding:0; font-size:24px; }
.dialog-actions { justify-content:flex-end; margin-top:18px; }
.dialog-actions button { padding:0 16px; }
small { color:var(--muted); font-weight:400; }
.user-actions { display:flex; gap:6px; }
.user-actions button { min-height:32px; padding:0 9px; font-size:12px; }
.toast { position:fixed; right:18px; bottom:18px; max-width:360px; padding:12px 16px; border-radius:7px; color:#fff; background:#111827; box-shadow:0 18px 44px rgba(15,23,42,.24); }
.empty { padding:24px; color:var(--muted); text-align:center; }
#resetDialog { width:min(560px,calc(100% - 24px)); max-height:90vh; overflow:auto; }
#resetForm { padding:20px; }
#resetDialog p { font-size:13px; line-height:1.6; margin-top:14px; overflow-wrap:anywhere; }
#resetChoices { border:1px solid var(--line); border-radius:6px; }
#resetChoices label { display:flex; gap:10px; align-items:flex-start; line-height:1.5; font-weight:400; }
#resetChoices input { width:18px; min-height:18px; flex:0 0 18px; margin:2px 0; }
#resetPreview,#resetExecute { padding:10px 14px; margin-top:12px; }
#resetExecute.danger { background:#b91c1c; color:white; border-color:#b91c1c; }
#resetSummary { margin-top:14px; line-height:1.7; font-size:13px; }
button:disabled { cursor:wait; opacity:.6; }
@media (max-width:1100px) { .metric-grid { grid-template-columns:repeat(3,1fr); } }
@media (max-width:760px) {
  .admin-shell { grid-template-columns:1fr; }
  .sidebar { position:static; height:auto; padding:10px; }
  .admin-brand { display:none; }
  .sidebar nav { grid-template-columns:repeat(4,minmax(0,1fr)); gap:4px; margin:0; overflow-x:auto; }
  .nav-item { justify-content:center; min-width:105px; padding:0 8px; font-size:12px; }
  .sidebar-user { grid-template-columns:minmax(0,1fr) auto; align-items:center; margin-top:10px; padding:8px 4px 0; }
  .sidebar-user span { grid-column:1; }
  #logoutBtn { grid-column:2; grid-row:1/3; margin:0; padding:0 12px; }
  .admin-main { padding:14px; }
  .admin-header { align-items:flex-start; }
  .header-actions { align-items:flex-end; flex-direction:column; }
  .metric-grid { grid-template-columns:repeat(2,1fr); }
  .dashboard-grid { grid-template-columns:1fr; }
  .span-2 { grid-column:auto; }
  .activity-item { grid-template-columns:1fr; gap:4px; }
}
@media (max-width:420px) { .metric strong { font-size:24px; } .admin-header h1 { font-size:20px; } .header-actions span { display:none; } }
