/* Shell-level styles: topbar, dropdown, auth pill, loader, error panel, base
   reset, and the shared color palette. Dashboard-specific styles live in each
   dashboard's view.css (see docs/CONTRACT.md). Dashboards must NOT override
   these classes. */

@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700;800;900&family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  /* Published for dashboards: the sticky topbar's height. Dashboards that
     need to align to or sit below the shell header should use
     var(--shell-topbar-h) instead of hardcoding it. */
  --shell-topbar-h: 66px;
  --navy:#19213D; --navy2:#243058; --blue:#0075A9; --gold:#E69C24; --mint:#2FD3A0;
  --lavender:#AE60A7; --red:#DC2626; --redbg:#FEE2E2; --green:#15803D; --greenbg:#DCFCE7;
  --orange:#B45309; --orangebg:#FEF3C7; --bg:#F4F7FA; --card:#FFFFFF; --text:#1E293B;
  --muted:#64748B; --muted2:#94A3B8; --line:#E2E8F0; --line2:#CBD5E1;
  --shadow:0 2px 10px rgba(0,0,0,.045); --shadow-lg:0 14px 34px rgba(25,33,61,.13)
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; font-family: 'Inter', Arial, sans-serif; background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
button, select, input { font: inherit; }

.topbar { height: var(--shell-topbar-h); background: var(--navy); color: #fff; display: flex; align-items: center; justify-content: space-between; padding: 0 32px; position: sticky; top: 0; z-index: 200; box-shadow: 0 4px 16px rgba(0,0,0,.16); }
.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.brand img { height: 36px; width: auto; object-fit: contain; display: block; }
.brand-divider { width: 1px; height: 27px; background: rgba(255,255,255,.18); flex: 0 0 auto; }
.brand-copy { min-width: 0; }
.brand h1 { font-family: 'Montserrat', sans-serif; font-size: 16px; line-height: 1.15; margin: 0; font-weight: 800; letter-spacing: -.3px; white-space: nowrap; }
.brand small { display: block; color: rgba(255,255,255,.46); margin-top: 3px; font-size: 10.5px; font-weight: 600; letter-spacing: .72px; text-transform: uppercase; white-space: nowrap; }

.top-actions { display: flex; align-items: center; gap: 14px; font-size: 11px; }
.pill { padding: 6px 12px; border-radius: 20px; background: rgba(255,255,255,.1); color: #fff; font-weight: 600; border: 0; display: flex; align-items: center; gap: 6px; }
.pill:before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 3px rgba(47,211,160,.12); }
/* Sample-data state: amber dot, so it never reads as a healthy live feed. */
.pill.sample { background: rgba(230,156,36,.16); }
.pill.sample:before { background: var(--gold); box-shadow: 0 0 0 3px rgba(230,156,36,.14); }

.btn { border: 1px solid var(--line2); border-radius: 8px; padding: 9px 14px; font-weight: 700; cursor: pointer; background: #fff; color: var(--navy); transition: .2s; }
.btn:hover { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0,117,169,.08); }
.btn.refresh { background: rgba(255,255,255,.1); color: #fff; border-color: rgba(255,255,255,.22); display: flex; align-items: center; gap: 6px; }
.btn.refresh:hover { background: rgba(255,255,255,.18); box-shadow: none; }

/* Dashboard-select dropdown in the topbar. */
.dash-select { background: rgba(255,255,255,.1); color: #fff; border: 1px solid rgba(255,255,255,.22); border-radius: 8px; padding: 8px 12px; font-weight: 700; font-size: 11px; cursor: pointer; outline: none; }
.dash-select option { color: var(--text); }

/* Main container the dashboard renders into. */
.shell { max-width: 1600px; margin: auto; padding: 28px 32px 56px; }
/* Full-bleed layout for dashboards that manage their own spacing (e.g. the
   finance dashboard, whose sidebar is meant to reach the edges). Opt in per
   dashboard with `layout: 'full'` in its manifest; everything else keeps the
   cushioned default above, so existing dashboards are unaffected. */
.shell.shell--full { max-width: none; margin: 0; padding: 0; }

.loader { position: fixed; inset: var(--shell-topbar-h) 0 0; background: rgba(244,247,250,.94); display: grid; place-items: center; z-index: 999; }
.spinner { width: 46px; height: 46px; border: 4px solid #E2E8F0; border-top-color: var(--blue); border-radius: 50%; animation: spin .85s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.error { max-width: 760px; margin: 70px auto; background: #fff; border: 1px solid #FECACA; border-left: 5px solid var(--red); border-radius: 14px; padding: 25px; box-shadow: var(--shadow-lg); }
.error h2 { margin: 0 0 8px; font-size: 20px; color: var(--navy); }
.error p { margin: 8px 0; color: var(--muted); font-size: 13px; line-height: 1.6; }

@media (max-width: 760px) {
  .shell { padding: 18px 16px 42px; }
  .topbar { padding: 0 16px; }
  .brand h1 { font-size: 13px; }
  .brand img { height: 30px; }
  .brand-divider { height: 23px; }
  .top-actions .pill { display: none; }
  .brand small { display: none; }
}
@media (max-width: 480px) {
  .top-actions { gap: 7px; }
  .btn.refresh { padding: 8px 10px; }
  .brand h1 { white-space: normal; }
}

@media print {
  .topbar { display: none !important; }
  .shell { max-width: none; padding: 0; }
}
