/* =========================================================================
   dev21.css — Atlas design system, portable stylesheet
   Extracted from data/mockups/dashboard/atlas-dashboard-v1.html
                  data/mockups/sammy/sammy-3up-v2.html
   Single source of truth. Import this in any HTML page that needs the system.
   ========================================================================= */

/* --- Fonts ---------------------------------------------------------------- */
/* Self-host or load via:
   <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Space+Grotesk:wght@500;600;700&family=JetBrains+Mono:wght@500;600&display=swap" rel="stylesheet">
*/

/* --- Tokens --------------------------------------------------------------- */
:root {
  /* Brand */
  --navy:        #062a6b;
  --navy-deep:   #041d4d;
  --navy-light:  #0a3a8f;
  --green:       #64b743;
  --green-deep:  #57a33b;
  --green-glow:  rgba(100,183,67,.16);

  /* Status — paired bg/border for chips and pills */
  --success:     #16a34a;
  --success-bg:  #f0fdf4;
  --success-bd:  #bbf7d0;
  --warn:        #d97706;
  --warn-bg:     #fffbeb;
  --warn-bd:     #fde68a;
  --danger:      #dc2626;
  --danger-bg:   #fef2f2;
  --danger-bd:   #fecaca;
  --info:        #2563eb;
  --info-bg:     #eff6ff;
  --info-bd:     #bfdbfe;
  --purple:      #7c3aed;
  --purple-bg:   #f5f3ff;
  --orange:      #f97316;

  /* Text scale */
  --t1: #0f172a;
  --t2: #475569;
  --t3: #94a3b8;
  --t4: #cbd5e1;

  /* Surfaces */
  --bg:          #f6f8fa;
  --bg-rail:     #fafbfc;
  --surface:     #fff;
  --line:        #e5e7eb;
  --line-soft:   #eef0f3;
  --line-strong: #d1d5db;

  /* Mockup canvas (presentation backgrounds — not for app surfaces) */
  --canvas:      #0c1530;

  /* Radius */
  --r-sm: 8px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 18px;
  --r-pill: 999px;

  /* Shadows (navy-tinted) */
  --shadow-sm:    0 1px 2px rgba(15,23,42,.06);
  --shadow-md:    0 4px 12px rgba(15,23,42,.08);
  --shadow-lg:    0 16px 40px rgba(15,23,42,.12);
  --shadow-sheet: -12px 0 40px rgba(15,23,42,.08);

  /* Typography */
  --font-body:    'Inter', system-ui, -apple-system, sans-serif;
  --font-display: 'Space Grotesk', 'Inter', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', 'SF Mono', Menlo, monospace;

  /* Type scale (mobile-first; bump at lg breakpoint via utilities below) */
  --fs-xs: 11px;
  --fs-sm: 12.5px;
  --fs-md: 14px;
  --fs-lg: 16px;
  --fs-xl: 20px;
  --fs-2xl: 28px;
  --fs-3xl: 36px;
  --fs-display: 44px;

  /* Spacing scale */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;
  --sp-12: 48px;

  /* Layout — laptop chrome (desktop only) */
  --topbar-h: 54px;
  --rail-w: 240px;

  /* Layout — mobile */
  --bottom-nav-h: 64px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);

  /* Motion */
  --t-fast: .12s;
  --t-base: .18s;
  --t-slow: .28s;
  --ease:    cubic-bezier(.4, 0, .2, 1);
}

/* --- Reset ---------------------------------------------------------------- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  background: var(--bg);
  color: var(--t1);
  font-family: var(--font-body);
  font-size: var(--fs-md);
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
a { color: inherit; text-decoration: none; }
input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }

/* When the page is showing mockups on a dark canvas (presentation), opt-in: */
body.canvas { background: var(--canvas); color: #fff; }

/* --- Typography utilities ------------------------------------------------- */
.t-display { font-family: var(--font-display); font-weight: 700; letter-spacing: -1.5px; font-size: var(--fs-display); line-height: 1.05; }
.t-h1      { font-family: var(--font-display); font-weight: 700; letter-spacing: -1px;   font-size: var(--fs-3xl); line-height: 1.1; }
.t-h2      { font-family: var(--font-display); font-weight: 700; letter-spacing: -.5px;  font-size: var(--fs-2xl); line-height: 1.15; }
.t-h3      { font-family: var(--font-display); font-weight: 600; letter-spacing: -.3px;  font-size: var(--fs-xl); line-height: 1.2; }
.t-body    { font-size: var(--fs-md); color: var(--t2); line-height: 1.5; }
.t-small   { font-size: var(--fs-sm); color: var(--t2); }
.t-caps    { font-family: var(--font-display); font-size: var(--fs-xs); font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: var(--t3); }
.t-mono    { font-family: var(--font-mono); }

.t-1 { color: var(--t1); }
.t-2 { color: var(--t2); }
.t-3 { color: var(--t3); }
.t-4 { color: var(--t4); }

/* --- Brand mark ----------------------------------------------------------- */
/* .brand-logo — the actual ECC logo PNG (use this for any customer/staff-facing surface).
   Path defaults to /branding/ecc-logo.png; override via inline src on <img>. */
.brand-logo {
  display: block;
  height: 32px;
  width: auto;
  flex-shrink: 0;
}
.brand-logo-sm { height: 24px; }
.brand-logo-lg { height: 48px; }
.brand-logo-xl { height: 72px; }

/* .mark — the abbreviated letterform variant (use for tight spaces / favicon / app icon).
   Falls back when there's no room for the full logo. */
.mark {
  display: grid;
  place-items: center;
  width: 26px; height: 26px;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--navy), var(--navy-light));
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: -.5px;
}
.mark-lg { width: 36px; height: 36px; border-radius: 10px; font-size: 16px; }

/* --- Pills / chips -------------------------------------------------------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--t2);
}
.pill-success { background: var(--success-bg); border-color: var(--success-bd); color: var(--success); }
.pill-warn    { background: var(--warn-bg);    border-color: var(--warn-bd);    color: var(--warn); }
.pill-danger  { background: var(--danger-bg);  border-color: var(--danger-bd);  color: var(--danger); }
.pill-info    { background: var(--info-bg);    border-color: var(--info-bd);    color: var(--info); }
.pill-purple  { background: var(--purple-bg);  border-color: transparent;       color: var(--purple); }
.pill-stamp {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: 800;
  padding: 6px 14px;
  background: rgba(100,183,67,.18);
  color: var(--green);
  border: 1px solid rgba(100,183,67,.35);
  border-radius: var(--r-sm);
}

/* --- Buttons -------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 14px;
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--t1);
  background: var(--surface);
  border: 1px solid var(--line);
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
  min-height: 36px;
}
.btn:hover { background: var(--bg); }
.btn-primary { background: var(--green); color: #fff; border-color: var(--green); }
.btn-primary:hover { background: var(--green-deep); border-color: var(--green-deep); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--t2); }
.btn-ghost:hover { background: var(--bg); color: var(--t1); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { filter: brightness(.95); }
.btn-lg { padding: 12px 18px; font-size: var(--fs-md); min-height: 44px; }
.btn-sm { padding: 6px 10px; font-size: var(--fs-xs); min-height: 28px; }

/* --- Cards / surfaces ----------------------------------------------------- */
.card {
  background: var(--surface);
  color: var(--t1);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--sp-4);
  box-shadow: var(--shadow-sm);
}
.card-elevated { box-shadow: var(--shadow-md); }
.card-flat     { box-shadow: none; }

/* --- List rows (mobile-friendly tap targets) ------------------------------ */
.list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--surface);
  color: var(--t1);
  min-height: 56px;
  cursor: pointer;
  transition: background var(--t-fast);
}
.list-row:hover { background: var(--bg); }
.list-row:last-child { border-bottom: 0; }
.list-row .primary   { font-size: var(--fs-md); font-weight: 600; color: var(--t1); }
.list-row .secondary { font-size: var(--fs-sm); color: var(--t2); margin-top: 2px; }
.list-row .meta      { margin-left: auto; font-size: var(--fs-sm); color: var(--t3); text-align: right; }

/* --- KBD ------------------------------------------------------------------ */
kbd {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  color: var(--t2);
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
}

/* --- Topbar (laptop) ------------------------------------------------------ */
.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  color: var(--t1);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 14px;
}

/* --- Mobile bottom nav ---------------------------------------------------- */
.bottom-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: calc(var(--bottom-nav-h) + var(--safe-bot));
  padding-bottom: var(--safe-bot);
  background: var(--surface);
  border-top: 1px solid var(--line);
  display: flex;
  z-index: 50;
  box-shadow: 0 -2px 8px rgba(15,23,42,.04);
}
.bottom-nav .nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--t3);
  padding: 8px 4px;
  transition: color var(--t-fast);
}
.bottom-nav .nav-item.active { color: var(--navy); }
.bottom-nav .nav-item .ic { font-size: 20px; }

/* --- Bottom sheet (mobile) ------------------------------------------------ */
.sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: var(--surface);
  color: var(--t1);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  box-shadow: var(--shadow-sheet);
  padding: 20px 18px calc(20px + var(--safe-bot));
  z-index: 60;
  max-height: 85vh;
  overflow-y: auto;
}
.sheet::before {
  content: '';
  display: block;
  width: 36px; height: 4px;
  border-radius: 2px;
  background: var(--line-strong);
  margin: -6px auto 14px;
}

/* --- Hero header (mobile, navy gradient) ---------------------------------- */
.hero {
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy-light) 100%);
  color: #fff;
  padding: calc(20px + var(--safe-top)) 22px 26px;
  border-radius: 0 0 28px 28px;
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: '';
  position: absolute;
  width: 240px; height: 240px;
  background: radial-gradient(circle, var(--green-glow) 0%, transparent 65%);
  border-radius: 50%;
  top: -100px; right: -80px;
  pointer-events: none;
}
.hero h1 { font-size: 24px; font-weight: 700; letter-spacing: -.5px; line-height: 1.15; }
.hero .sub { font-size: 13px; color: rgba(255,255,255,.7); margin-top: 4px; }

/* --- Status dot (live indicator) ------------------------------------------ */
.live-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--green);
  animation: live-pulse 2s infinite;
}
@keyframes live-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(100,183,67,.7); }
  70%  { box-shadow: 0 0 0 8px rgba(100,183,67,0); }
  100% { box-shadow: 0 0 0 0 rgba(100,183,67,0); }
}

/* --- Empty state ---------------------------------------------------------- */
.empty {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 40px 20px;
  text-align: center;
  color: var(--t3);
}
.empty .ic { font-size: 32px; opacity: .5; }
.empty .msg { font-size: var(--fs-sm); }

/* --- Avatar --------------------------------------------------------------- */
.av {
  display: inline-grid;
  place-items: center;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--navy), var(--navy-light));
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: .3px;
  flex-shrink: 0;
}
.av-sm { width: 24px; height: 24px; font-size: 10.5px; }
.av-lg { width: 44px; height: 44px; font-size: 16px; }
.av-xl { width: 64px; height: 64px; font-size: 22px; }
.av img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }

/* --- Badge (notification count, small label) ------------------------------ */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .2px;
}
.badge-info    { background: var(--info); }
.badge-success { background: var(--success); }
.badge-warn    { background: var(--warn); color: #fff; }
.badge-mono    { background: var(--t1); }

/* --- Form inputs (44px min — mobile-tuned) -------------------------------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field-label {
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--t3);
}
.input, .textarea, .select {
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: var(--fs-md);
  color: var(--t1);
  font-family: var(--font-body);
  min-height: 44px;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--navy-light);
  box-shadow: 0 0 0 3px rgba(10,58,143,.12);
}
.input::placeholder, .textarea::placeholder { color: var(--t3); }
.textarea { min-height: 88px; resize: vertical; line-height: 1.45; }
.field-help { font-size: var(--fs-xs); color: var(--t3); }
.field-error .input, .field-error .textarea, .field-error .select { border-color: var(--danger); }
.field-error .field-help { color: var(--danger); }

/* --- Checkbox / radio ----------------------------------------------------- */
.check {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: var(--fs-md);
  color: var(--t1);
  min-height: 44px;
}
.check input[type="checkbox"], .check input[type="radio"] {
  width: 20px; height: 20px;
  accent-color: var(--green);
  cursor: pointer;
}

/* --- Tabs ----------------------------------------------------------------- */
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  padding: 12px 16px;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--t2);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  cursor: pointer;
  transition: color var(--t-fast), border-color var(--t-fast);
  margin-bottom: -1px;
}
.tab:hover { color: var(--t1); }
.tab.active { color: var(--navy); border-bottom-color: var(--navy); }

/* --- Segmented control (alternative to tabs) ------------------------------ */
.segmented {
  display: inline-flex;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 3px;
  gap: 2px;
}
.segmented .seg {
  padding: 7px 14px;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--t2);
  border-radius: 7px;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
}
.segmented .seg.active { background: var(--surface); color: var(--t1); box-shadow: var(--shadow-sm); }

/* --- Modal / dialog (laptop) ---------------------------------------------- */
.scrim {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.45);
  backdrop-filter: blur(2px);
  z-index: 55;
}
.modal {
  position: fixed;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  background: var(--surface);
  color: var(--t1);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  z-index: 60;
  width: min(520px, calc(100vw - 32px));
  max-height: calc(100vh - 64px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.modal-head { padding: 18px 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.modal-head h3 { font-size: var(--fs-lg); font-weight: 700; }
.modal-body { padding: 18px 22px; overflow-y: auto; flex: 1; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; background: var(--bg-rail); }

/* --- Divider -------------------------------------------------------------- */
.divider { height: 1px; background: var(--line); margin: var(--sp-4) 0; }
.divider-strong { background: var(--line-strong); }

/* --- Skeleton loader ------------------------------------------------------ */
.skel {
  display: block;
  background: linear-gradient(90deg, var(--line-soft) 0%, var(--line) 50%, var(--line-soft) 100%);
  background-size: 200% 100%;
  border-radius: var(--r-sm);
  animation: skel-shimmer 1.4s ease-in-out infinite;
  height: 14px;
}
.skel-circle { border-radius: 50%; }
.skel-lg { height: 24px; }
@keyframes skel-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* --- Tag (more lightweight than pill) ------------------------------------- */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--r-sm);
  background: var(--bg);
  border: 1px solid var(--line);
  font-size: 11px;
  font-weight: 600;
  color: var(--t2);
}

/* --- Progress bar --------------------------------------------------------- */
.progress {
  height: 6px;
  background: var(--line);
  border-radius: 3px;
  overflow: hidden;
}
.progress > .bar {
  height: 100%;
  background: var(--green);
  border-radius: 3px;
  transition: width var(--t-base) var(--ease);
}
.progress > .bar.warn   { background: var(--warn); }
.progress > .bar.danger { background: var(--danger); }

/* --- Breakpoints (mobile-first) ------------------------------------------- */
/*  default = mobile (< 768)
    md = tablet  (>= 768)
    lg = laptop  (>= 1024)
    xl = wide    (>= 1280)
*/
@media (min-width: 768px) {
  :root { --fs-md: 14px; --fs-lg: 16px; --fs-xl: 22px; --fs-2xl: 32px; --fs-3xl: 40px; }
}

/* --- Scrollbars (subtle) -------------------------------------------------- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--t3); }

/* --- Focus rings (accessibility) ------------------------------------------ */
:focus-visible {
  outline: 2px solid var(--info);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

/* End dev21.css ============================================================ */
