/* Health Broker Center — design system (matches the Arrival Point Software console visual language) */

:root {
  --brand-700:#3730a3; --brand-600:#4f46e5; --brand-500:#6366f1; --brand-300:#a5b4fc; --brand-100:#e0e7ff;

  --ink-900:#0b1120; --ink-800:#0f172a; --ink-700:#152033; --ink-600:#1e2a44; --ink-500:#2b3a5c;

  --ok-600:#059669; --ok-500:#10b981; --ok-bg:#ecfdf5;
  --warn-600:#d97706; --warn-500:#f59e0b; --warn-bg:#fffbeb;
  --bad-600:#dc2626; --bad-500:#ef4444; --bad-bg:#fef2f2;
  --info-600:#0284c7; --info-bg:#f0f9ff;

  --paper:#f6f7fb; --surface:#ffffff; --surface-2:#f4f6fb; --line:#e6e8f0; --line-strong:#d4d8e6;
  --text-900:#0f172a; --text-700:#334155; --text-600:#475569; --text-500:#64748b; --text-400:#94a3b8;

  --radius-sm:9px; --radius:16px; --radius-lg:22px;
  --shadow-xs:0 1px 1px rgba(15,23,42,.05);
  --shadow-sm:0 1px 2px rgba(15,23,42,.06), 0 2px 6px -1px rgba(15,23,42,.09);
  --shadow-md:0 4px 10px -3px rgba(15,23,42,.08), 0 8px 20px -8px rgba(15,23,42,.14);
  --shadow:0 6px 16px -4px rgba(15,23,42,.10), 0 14px 36px -14px rgba(15,23,42,.20);
  --shadow-lg:0 30px 70px -20px rgba(15,23,42,.34);

  --sidebar-w:264px; --topbar-h:68px;
  --fs-xs:12px; --fs-sm:13.5px; --fs-base:14.5px; --fs-md:16px; --fs-lg:20px; --fs-xl:26px;
}

/* ---------- Accent themes (7 selectable palettes, persisted per-user) ---------- */
:root.theme-indigo { --brand-700:#3730a3; --brand-600:#4f46e5; --brand-500:#6366f1; --brand-300:#a5b4fc; --brand-100:#e0e7ff; }
:root.theme-emerald{ --brand-700:#047857; --brand-600:#059669; --brand-500:#10b981; --brand-300:#6ee7b7; --brand-100:#d1fae5; }
:root.theme-rose   { --brand-700:#be123c; --brand-600:#e11d48; --brand-500:#f43f5e; --brand-300:#fda4af; --brand-100:#ffe4e6; }
:root.theme-amber  { --brand-700:#b45309; --brand-600:#d97706; --brand-500:#f59e0b; --brand-300:#fcd34d; --brand-100:#fef3c7; }
:root.theme-blue   { --brand-700:#1d4ed8; --brand-600:#2563eb; --brand-500:#3b82f6; --brand-300:#93c5fd; --brand-100:#dbeafe; }
:root.theme-orange { --brand-700:#c2410c; --brand-600:#ea580c; --brand-500:#f97316; --brand-300:#fdba74; --brand-100:#ffedd5; }
:root.theme-slate  { --brand-700:#334155; --brand-600:#475569; --brand-500:#64748b; --brand-300:#cbd5e1; --brand-100:#f1f5f9; }

.accent-picker { display:flex; align-items:center; gap:6px; padding:0 4px; }
.accent-swatch {
  width:18px; height:18px; border-radius:50%; border:2px solid transparent; cursor:pointer; padding:0;
  box-shadow:0 0 0 1px rgba(0,0,0,.08);
}
.accent-swatch.active { border-color:var(--text-900); }
.accent-swatch.sw-indigo { background:linear-gradient(135deg,#6366f1,#3730a3); }
.accent-swatch.sw-emerald { background:linear-gradient(135deg,#10b981,#047857); }
.accent-swatch.sw-rose { background:linear-gradient(135deg,#f43f5e,#be123c); }
.accent-swatch.sw-amber { background:linear-gradient(135deg,#f59e0b,#b45309); }
.accent-swatch.sw-blue { background:linear-gradient(135deg,#3b82f6,#1d4ed8); }
.accent-swatch.sw-orange { background:linear-gradient(135deg,#f97316,#c2410c); }
.accent-swatch.sw-slate { background:linear-gradient(135deg,#64748b,#334155); }

:root.dark {
  --paper:#0b1120; --surface:#0f172a; --surface-2:#1b2740; --line:#1e293b; --line-strong:#2b3a5c;
  --text-900:#f8fafc; --text-700:#cbd5e1; --text-600:#94a3b8; --text-500:#7e8db0; --text-400:#5c6c8c;
  --ok-bg:rgba(16,185,129,.12); --warn-bg:rgba(245,158,11,.12); --bad-bg:rgba(239,68,68,.12); --info-bg:rgba(2,132,199,.14);
}

* { box-sizing:border-box; }
html,body { margin:0; padding:0; }
body {
  background:var(--paper); color:var(--text-900);
  font-family:'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size:var(--fs-base); line-height:1.5;
  -webkit-font-smoothing:antialiased;
}
h1,h2,h3,h4,.num { font-family:'Sora', sans-serif; letter-spacing:-.01em; }
.num { font-variant-numeric:tabular-nums; }
a { color:var(--brand-600); text-decoration:none; }
a:hover { text-decoration:underline; }

/* ---------- Layout shell ---------- */
.app-shell { display:flex; min-height:100vh; }

.sidebar {
  position:fixed; top:0; left:0; bottom:0; width:var(--sidebar-w);
  background:linear-gradient(185deg,var(--ink-800),var(--ink-900));
  color:#e2e8f0; display:flex; flex-direction:column; z-index:40;
  box-shadow:var(--shadow-lg);
}
.sidebar::before {
  content:""; position:absolute; top:-80px; left:-80px; width:280px; height:280px; border-radius:50%;
  background:radial-gradient(circle, rgba(99,102,241,.35), transparent 70%); pointer-events:none;
}
.brand { padding:22px 20px 18px; display:flex; align-items:center; gap:12px; position:relative; z-index:1; }
.brand-mark {
  width:40px; height:40px; border-radius:12px; flex:none;
  background:linear-gradient(135deg,var(--brand-500),var(--brand-700));
  display:flex; align-items:center; justify-content:center; box-shadow:var(--shadow-sm);
  font-family:'Sora',sans-serif; font-weight:800; color:#fff; font-size:16px;
}
.brand-text { display:flex; flex-direction:column; line-height:1.2; }
.brand-text strong { font-family:'Sora',sans-serif; font-size:15px; color:#fff; }
.brand-text span { font-size:11px; color:#94a3b8; }
.brand-logo-img { background:none; box-shadow:none; object-fit:contain; padding:0; }
.report-logo { width:38px; height:38px; object-fit:contain; flex:none; }

.nav { flex:1; overflow-y:auto; padding:6px 12px 20px; position:relative; z-index:1; }
.nav-label {
  width:100%; text-align:left; background:none; border:none; color:#7d8bb0; font-size:11px; font-weight:700;
  letter-spacing:.08em; text-transform:uppercase; padding:16px 10px 6px; cursor:default;
}
.nav a {
  display:flex; align-items:center; gap:11px; padding:9px 12px; border-radius:10px; color:#cbd5e1;
  font-size:13.5px; font-weight:600; margin:1px 0; position:relative; text-decoration:none;
}
.nav a svg { width:18px; height:18px; flex:none; opacity:.85; }
.nav a:hover { background:rgba(255,255,255,.06); color:#fff; }
.nav a.active { background:rgba(99,102,241,.18); color:#fff; }
.nav a.active::before {
  content:""; position:absolute; left:-12px; top:6px; bottom:6px; width:3px; border-radius:3px;
  background:linear-gradient(var(--brand-500),var(--brand-700));
}
.nav-badge { margin-left:auto; background:var(--brand-500); color:#fff; font-size:10.5px; font-weight:700;
  padding:1px 7px; border-radius:999px; }

.main { margin-left:var(--sidebar-w); flex:1; min-width:0; display:flex; flex-direction:column; }

.topbar {
  height:var(--topbar-h); position:sticky; top:0; z-index:30; display:flex; align-items:center; gap:16px;
  padding:0 24px; background:rgba(255,255,255,.85); backdrop-filter:blur(12px); border-bottom:1px solid var(--line);
}
:root.dark .topbar { background:rgba(15,23,42,.85); }
.topbar .spacer { flex:1; }
.topbar-agency { font-size:15.5px; color:var(--text-900); font-weight:800; font-family:'Sora',sans-serif; min-width:180px; }
.user-chip { display:flex; align-items:center; gap:10px; padding:6px 16px 6px 6px; border-radius:999px; border:1px solid var(--line); min-width:190px; }
.avatar {
  width:32px; height:32px; border-radius:50%; background:linear-gradient(135deg,var(--brand-500),var(--brand-700));
  color:#fff; display:flex; align-items:center; justify-content:center; font-weight:700; font-size:12.5px; font-family:'Sora',sans-serif;
}
.user-chip .meta { line-height:1.2; }
.user-chip .name { font-size:13px; font-weight:700; white-space:nowrap; }
.user-chip .role { font-size:11px; color:var(--text-500); white-space:nowrap; }
#langSelect { min-width:0; width:58px; padding:6px 4px; text-align:center; }
#btnSignOut { min-width:100px; justify-content:center; }

.content { padding:26px 28px 60px; }

/* ---------- KPI cards ---------- */
.kpi-grid { display:grid; grid-template-columns:repeat(4,1fr); gap:18px; margin-bottom:22px; }
@media (max-width:1100px) { .kpi-grid { grid-template-columns:repeat(2,1fr); } }
.kpi {
  background:var(--surface); border:1px solid var(--line); border-radius:var(--radius); box-shadow:var(--shadow-sm);
  padding:18px 20px; position:relative; overflow:hidden;
}
.kpi .icn { width:46px; height:46px; border-radius:13px; display:flex; align-items:center; justify-content:center; margin-bottom:14px; }
.kpi .icn svg { width:22px; height:22px; color:#fff; }
.icn.b{background:linear-gradient(135deg,#5b86f0,#3b5bdb);}
.icn.g{background:linear-gradient(135deg,#2bcf95,#0a9d5a);}
.icn.a{background:linear-gradient(135deg,#fbb24a,#e07d09);}
.icn.r{background:linear-gradient(135deg,#f4665f,#dc2626);}
.icn.p{background:linear-gradient(135deg,#a878f6,#7c3aed);}
.icn.t{background:linear-gradient(135deg,#2ad6c1,#0d9488);}
.kpi .label { font-size:12.5px; color:var(--text-500); font-weight:600; text-transform:uppercase; letter-spacing:.04em; }
.kpi .value { font-family:'Sora',sans-serif; font-weight:800; font-size:32px; margin-top:2px; }
.kpi-zero { color:var(--text-400); }

/* ---------- Panels ---------- */
.panel { background:var(--surface); border:1px solid var(--line); border-radius:var(--radius); box-shadow:var(--shadow-sm); margin-bottom:20px; }
.panel-head {
  display:flex; align-items:center; justify-content:space-between; padding:16px 20px; border-bottom:1px solid var(--line);
}
.panel-head h3 { margin:0; font-size:15.5px; display:flex; align-items:center; gap:10px; }
.panel-head h3::before { content:""; width:4px; height:16px; border-radius:3px; background:linear-gradient(var(--brand-500),var(--brand-700)); }
.panel-body { padding:20px; }

/* ---------- Buttons ---------- */
.btn {
  display:inline-flex; align-items:center; gap:7px; border-radius:10px; padding:9px 16px; font-weight:600;
  font-size:13.5px; border:1px solid transparent; cursor:pointer; background:var(--surface); color:var(--text-700);
  transition:filter .12s;
}
.btn:hover { filter:brightness(.97); text-decoration:none; }
.btn-primary { background:linear-gradient(135deg,var(--brand-500),var(--brand-700)); color:#fff; }
.btn-ghost { background:var(--surface); border-color:var(--line-strong); color:var(--text-700); }
.btn-danger { background:var(--bad-bg); color:var(--bad-600); border-color:rgba(220,38,38,.25); }
.btn-sm { padding:6px 11px; font-size:12.5px; border-radius:8px; }

/* ---------- Badges ---------- */
.badge {
  display:inline-flex; align-items:center; gap:6px; padding:3px 10px; border-radius:999px; font-size:11.5px;
  font-family:'Sora',sans-serif; font-weight:700;
}
.badge::before { content:""; width:6px; height:6px; border-radius:50%; background:currentColor; }
.badge.ok { color:#047857; background:var(--ok-bg); border:1px solid rgba(4,120,87,.22); }
.badge.warn { color:#b45309; background:var(--warn-bg); border:1px solid rgba(180,83,9,.22); }
.badge.bad { color:var(--bad-600); background:var(--bad-bg); border:1px solid rgba(220,38,38,.22); }
.badge.info { color:#0369a1; background:var(--info-bg); border:1px solid rgba(3,105,161,.22); }
.badge.neutral { color:var(--text-500); background:#f1f5f9; border:1px solid rgba(100,116,139,.2); }

/* ---------- Forms ---------- */
label { display:block; font-size:12.5px; font-weight:700; color:var(--text-600); margin-bottom:5px; text-transform:uppercase; letter-spacing:.03em; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=tel], select, textarea {
  width:100%; padding:10px 12px; border:1px solid var(--line-strong); border-radius:10px; background:var(--surface);
  color:var(--text-900); font-size:13.5px; font-family:inherit;
}
input:focus, select:focus, textarea:focus { outline:2px solid var(--brand-300); outline-offset:0; border-color:var(--brand-500); }
.field { margin-bottom:14px; }
.field-row { display:grid; grid-template-columns:repeat(2,1fr); gap:14px; }
.field-row.cols-3 { grid-template-columns:repeat(3,1fr); }
.hint { font-size:12px; color:var(--text-500); margin-top:4px; }

/* ---------- Tables ---------- */
.gv { width:100%; border-collapse:collapse; }
.gv th { text-align:left; font-family:'Sora',sans-serif; font-size:11px; text-transform:uppercase; letter-spacing:.05em;
  color:var(--text-500); padding:10px 14px; border-bottom:1px solid var(--line); }
.gv td { padding:12px 14px; border-bottom:1px solid var(--line); font-size:13.5px; }
.gv tr:hover td { background:var(--surface-2); }
.gv tr:last-child td { border-bottom:none; }

/* ---------- Alerts ---------- */
.alert { padding:12px 16px; border-radius:10px; font-size:13.5px; margin-bottom:16px; }
.alert-ok { background:var(--ok-bg); color:#047857; border:1px solid rgba(4,120,87,.2); }
.alert-bad { background:var(--bad-bg); color:var(--bad-600); border:1px solid rgba(220,38,38,.2); }

.page-head { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; row-gap:12px; gap:18px; margin-bottom:20px; }
.page-head h1 { font-size:var(--fs-xl); margin:0; }
.page-head .sub { color:var(--text-500); font-size:13px; margin-top:2px; }
.page-head > div:first-child { flex:none; white-space:nowrap; }
.page-head .dash-widgets { flex:0 1 auto; min-width:0; justify-content:flex-end; }
.page-head .news-pill-stretch { flex-basis:200px; }
.breadcrumb { font-size:12.5px; color:var(--text-500); margin-bottom:6px; }
.breadcrumb a { color:var(--text-500); }

/* ---------- Login page ---------- */
.login-shell { display:flex; min-height:100vh; }
.login-brand {
  flex:1.1; background:linear-gradient(160deg,var(--ink-800),var(--ink-900)); color:#fff; padding:60px;
  display:flex; flex-direction:column; justify-content:space-between; position:relative; overflow:hidden;
}
.login-brand::before { content:""; position:absolute; top:-140px; right:-140px; width:420px; height:420px; border-radius:50%;
  background:radial-gradient(circle, rgba(99,102,241,.4), transparent 70%); }
.login-brand::after { content:""; position:absolute; bottom:-160px; left:-100px; width:380px; height:380px; border-radius:50%;
  background:radial-gradient(circle, rgba(16,185,129,.18), transparent 70%); }
.login-banner-card {
  background:#fff; border-radius:var(--radius-lg); box-shadow:var(--shadow-lg); padding:20px 28px;
  display:inline-block; margin-bottom:32px; position:relative; z-index:1;
}
.login-banner-card img { display:block; height:120px; width:auto; }
.login-brand h1 { font-size:32px; margin:0 0 12px; position:relative; z-index:1; }
.login-brand p { color:#94a3b8; font-size:15px; max-width:420px; position:relative; z-index:1; }
.login-form-pane { flex:1; display:flex; align-items:center; justify-content:center; background:var(--paper); padding:40px; }
.login-card { width:100%; max-width:380px; }
.login-card h2 { font-size:22px; margin:0 0 6px; }
.login-card .lede { color:var(--text-500); font-size:13.5px; margin-bottom:26px; }
.login-card .btn-primary { width:100%; justify-content:center; padding:11px; font-size:14px; }

/* ---------- Misc ---------- */
.text-muted { color:var(--text-500); }
.mt-0 { margin-top:0; }
.stack { display:flex; flex-direction:column; gap:10px; }
.row-flex { display:flex; align-items:center; gap:10px; }
.pill-count { background:var(--brand-100); color:var(--brand-700); font-size:11px; font-weight:700; padding:2px 8px; border-radius:999px; }
:root.dark .pill-count { background:rgba(99,102,241,.2); color:var(--brand-300); }

/* ---------- Dashboard header widgets: clock, weather, news ---------- */
.dash-widgets { display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.dash-clock { font-family:'Sora',sans-serif; font-size:20px; font-weight:700; white-space:nowrap; font-variant-numeric:tabular-nums; color:var(--text-900); }

.weather-dd { position:relative; display:inline-flex; flex-shrink:0; }
.weather-pill { display:inline-flex; align-items:center; gap:6px; font-size:var(--fs-xs); font-weight:600; color:var(--text-500);
  background:var(--surface-2); border:1px solid var(--line); border-radius:99px; padding:3px 11px 3px 9px;
  cursor:pointer; font-family:inherit; }
.weather-pill:hover { border-color:var(--brand-500); }
.weather-dd.open .weather-pill { border-color:var(--brand-500); }
.weather-pill svg { width:15px; height:15px; color:#f59e0b; flex-shrink:0; }
.weather-pill b { color:var(--text-900); font-size:13px; font-variant-numeric:tabular-nums; }
.weather-precip { color:#3b82f6; font-weight:700; margin-left:2px; }
.weather-menu { display:none; position:absolute; top:calc(100% + 8px); right:0; z-index:60;
  min-width:330px; background:var(--surface); border:1px solid var(--line);
  border-radius:12px; box-shadow:var(--shadow-lg); padding:10px; text-align:left; }
.weather-dd.open .weather-menu { display:block; }
.weather-menu-h { font-size:11.5px; font-weight:700; color:var(--text-500); text-transform:uppercase;
  letter-spacing:.04em; padding:4px 6px 8px; border-bottom:1px solid var(--line); margin-bottom:6px; }
.weather-day { display:grid; grid-template-columns:40px 22px 1fr 46px 60px; align-items:center; gap:8px;
  padding:6px; border-radius:8px; font-size:13px; }
.weather-day:hover { background:var(--surface-2); }
.weather-day-name { font-weight:700; color:var(--text-900); }
.weather-day-icon svg { width:17px; height:17px; color:#f59e0b; }
.weather-day-desc { color:var(--text-500); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.weather-day-precip { color:#3b82f6; font-weight:600; text-align:right; }
.weather-day-temps { text-align:right; color:var(--text-500); font-variant-numeric:tabular-nums; }
.weather-day-temps b { color:var(--text-900); }

.news-pill { display:inline-flex; align-items:center; gap:7px; font-size:var(--fs-xs); font-weight:600; color:var(--text-500);
  background:var(--surface-2); border:1px solid var(--line); border-radius:99px; padding:3px 12px 3px 9px;
  text-decoration:none; max-width:320px; }
.news-pill:hover { border-color:var(--brand-500); text-decoration:none; }
.news-pill svg { width:15px; height:15px; color:var(--brand-600); flex-shrink:0; }
.news-pill span { color:var(--text-900); font-weight:500; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
  transition:opacity .25s ease; min-width:0; display:block; }
.news-pill span.fading { opacity:0; }
.news-pill-stretch { flex:1 1 auto; min-width:0; max-width:none; }
