/* ==========================================================================
   UNIFIED MEDICAL IMAGE DIAGNOSTICS — Design System
   A diagnostic-instrument visual language.
   Signature: a brand-tuned Grad-CAM colormap (Indigo→Turquoise→Mango→Sunset).
   ========================================================================== */

/* -------------------------------------------------------------------------- */
/* 1. DESIGN TOKENS                                                            */
/* -------------------------------------------------------------------------- */
:root {
  /* Brand */
  --sunset:    #FF5E62;
  --turquoise: #00C9B7;
  --indigo:    #2D3FE7;
  --mango:     #FFB347;
  --plum:      #6E2EB7;
  --rose:      #FF7AB6;

  /* Neutrals */
  --paper:     #FAF7F2;
  --ink:       #14122C;

  /* The signature: Grad-CAM activation colormap (cool→hot) */
  --camap: linear-gradient(120deg, #2D3FE7 0%, #00C9B7 34%, #FFB347 68%, #FF5E62 100%);
  --camap-soft: linear-gradient(120deg, rgba(45,63,231,.16), rgba(0,201,183,.16) 40%, rgba(255,179,71,.16) 70%, rgba(255,94,98,.16));

  /* Semantic surfaces — LIGHT (default) */
  --bg:          #FAF7F2;
  --bg-2:        #F3EEE6;
  --surface:     #FFFFFF;
  --surface-2:   #FBF9F5;
  --lightbox:    #0C0B1E;   /* image viewers stay dark even in light mode */
  --lightbox-2:  #15132E;
  --border:      rgba(20,18,44,.10);
  --border-2:    rgba(20,18,44,.06);
  --text:        #14122C;
  --text-2:      #4A4763;
  --text-3:      #8A8799;
  --text-on-dark:#F3F1FA;

  /* Shadows — soft, layered, warm */
  --sh-1: 0 1px 2px rgba(20,18,44,.05), 0 2px 6px rgba(20,18,44,.04);
  --sh-2: 0 2px 8px rgba(20,18,44,.06), 0 12px 28px -8px rgba(20,18,44,.10);
  --sh-3: 0 10px 24px -10px rgba(20,18,44,.14), 0 30px 60px -24px rgba(20,18,44,.18);
  --sh-glow: 0 0 0 rgba(0,0,0,0);

  /* Type */
  --f-display: "inter", Georgia, serif;
  --f-body: "Plus Jakarta Sans", system-ui, -apple-system, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, monospace;

  /* Radii */
  --r-xs: 8px;  --r-sm: 12px; --r-md: 16px; --r-lg: 22px; --r-xl: 30px; --r-pill: 999px;

  /* Layout */
  --maxw: 1240px;
  --gutter: clamp(20px, 5vw, 64px);
  --sidebar-w: 264px;

  --ease: cubic-bezier(.22,.61,.36,1);
  --ease-out: cubic-bezier(.16,1,.3,1);
}

[data-theme="dark"] {
  --bg:        #0B0A1F;
  --bg-2:      #0E0D24;
  --surface:   #14122C;
  --surface-2: #1B1839;
  --lightbox:  #060512;
  --lightbox-2:#0C0B22;
  --border:    rgba(255,255,255,.09);
  --border-2:  rgba(255,255,255,.05);
  --text:      #F1EFFA;
  --text-2:    #B7B3CE;
  --text-3:    #7C7895;
  --text-on-dark: #F3F1FA;

  --sh-1: 0 1px 2px rgba(0,0,0,.4);
  --sh-2: 0 2px 10px rgba(0,0,0,.4), 0 16px 40px -12px rgba(0,0,0,.55);
  --sh-3: 0 12px 30px -10px rgba(0,0,0,.5), 0 40px 80px -30px rgba(0,0,0,.7);
}

/* -------------------------------------------------------------------------- */
/* 2. RESET & BASE                                                             */
/* -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

body {
  margin: 0;
  font-family: var(--f-body);
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.6;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background .4s var(--ease), color .4s var(--ease);
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
::selection { background: rgba(45,63,231,.18); }

h1, h2, h3, h4 { font-family: var(--f-display); font-weight: 600; line-height: 1.05; letter-spacing: -0.025em; margin: 0; color: var(--text); }
.font-display { font-family: var(--f-display); }
.font-mono { font-family: var(--f-mono); }

/* Type scale */
.t-eyebrow {
  font-family: var(--f-mono); font-size: .72rem; font-weight: 600; letter-spacing: .22em;
  text-transform: uppercase; color: var(--text-3);
}
.t-display { font-size: clamp(2.6rem, 6.4vw, 5rem); line-height: .98; letter-spacing: -0.035em; }
.t-h1 { font-size: clamp(2rem, 4.4vw, 3.2rem); }
.t-h2 { font-size: clamp(1.6rem, 3.2vw, 2.4rem); }
.t-h3 { font-size: clamp(1.25rem, 2vw, 1.6rem); }
.t-lead { font-size: clamp(1.05rem, 1.6vw, 1.28rem); color: var(--text-2); line-height: 1.55; font-weight: 400; }
.t-mono-num { font-family: var(--f-mono); font-feature-settings: "tnum" 1; letter-spacing: -.02em; }
.ital { font-style: italic; font-optical-sizing: auto; }

.text-2 { color: var(--text-2); }
.text-3 { color: var(--text-3); }

/* Gradient ink on the signature colormap */
.cam-text {
  background: var(--camap);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}

/* -------------------------------------------------------------------------- */
/* 3. LAYOUT PRIMITIVES                                                         */
/* -------------------------------------------------------------------------- */
.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }
.section { padding-block: clamp(64px, 9vw, 130px); }
.section-tight { padding-block: clamp(44px, 6vw, 80px); }
.stack > * + * { margin-top: var(--s, 1rem); }
.grid { display: grid; gap: clamp(16px, 2vw, 26px); }

/* -------------------------------------------------------------------------- */
/* 4. BUTTONS                                                                   */
/* -------------------------------------------------------------------------- */
.btn {
  --bpv: .82rem; --bph: 1.35rem;
  display: inline-flex; align-items: center; gap: .55rem; justify-content: center;
  font-family: var(--f-body); font-weight: 600; font-size: .96rem; letter-spacing: -.01em;
  padding: var(--bpv) var(--bph); border-radius: var(--r-pill);
  border: 1px solid transparent; background: transparent; color: var(--text);
  transition: transform .25s var(--ease-out), box-shadow .25s var(--ease), background .25s, border-color .25s, color .25s;
  position: relative; white-space: nowrap;
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn i { font-size: 1.05em; }

.btn-primary { background: var(--ink); color: #fff; box-shadow: var(--sh-2); }
[data-theme="dark"] .btn-primary { background: #fff; color: var(--ink); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: var(--sh-3); }

.btn-cta {
  background: var(--sunset); color: #fff;
  box-shadow: 0 8px 22px -8px rgba(255,94,98,.7), inset 0 1px 0 rgba(255,255,255,.25);
}
.btn-cta:hover { transform: translateY(-2px); box-shadow: 0 14px 34px -8px rgba(255,94,98,.75); }

.btn-ghost { border-color: var(--border); background: var(--surface); color: var(--text); box-shadow: var(--sh-1); }
.btn-ghost:hover { border-color: var(--text-3); transform: translateY(-2px); box-shadow: var(--sh-2); }

.btn-quiet { color: var(--text-2); padding-inline: .8rem; }
.btn-quiet:hover { color: var(--text); background: var(--bg-2); }

.btn-lg { --bpv: 1rem; --bph: 1.7rem; font-size: 1rem; }
.btn-block { width: 100%; }
.btn-icon { width: 42px; height: 42px; padding: 0; border-radius: 50%; }

/* -------------------------------------------------------------------------- */
/* 5. PILLS / BADGES / CHIPS                                                     */
/* -------------------------------------------------------------------------- */
.pill {
  display: inline-flex; align-items: center; gap: .5rem;
  font-family: var(--f-mono); font-size: .72rem; font-weight: 600; letter-spacing: .04em;
  padding: .42rem .8rem; border-radius: var(--r-pill);
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
}
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--turquoise); box-shadow: 0 0 0 3px rgba(0,201,183,.18); }
.pill-cam { border: none; color: #fff; background: var(--camap); }

.badge {
  display: inline-flex; align-items: center; gap: .35rem;
  font-family: var(--f-mono); font-size: .68rem; font-weight: 600; letter-spacing: .03em;
  padding: .28rem .6rem; border-radius: var(--r-xs); text-transform: uppercase;
}
.badge-ok    { background: rgba(0,201,183,.14); color: #008e80; }
.badge-warn  { background: rgba(255,179,71,.18); color: #b9740a; }
.badge-risk  { background: rgba(255,94,98,.14); color: #d93a3f; }
.badge-info  { background: rgba(45,63,231,.12); color: var(--indigo); }
.badge-plum  { background: rgba(110,46,183,.12); color: var(--plum); }
[data-theme="dark"] .badge-ok { color: #25e3cf; }
[data-theme="dark"] .badge-warn { color: var(--mango); }
[data-theme="dark"] .badge-risk { color: #ff8e91; }
[data-theme="dark"] .badge-info { color: #8b97ff; }
[data-theme="dark"] .badge-plum { color: #c49bf0; }

/* -------------------------------------------------------------------------- */
/* 6. CARDS / PANELS                                                            */
/* -------------------------------------------------------------------------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--sh-1);
  transition: transform .35s var(--ease-out), box-shadow .35s var(--ease), border-color .35s;
}
.card-pad { padding: clamp(20px, 2.4vw, 30px); }
.card-hover:hover { transform: translateY(-4px); box-shadow: var(--sh-3); border-color: var(--border); }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--sh-2); }

.glass {
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  backdrop-filter: blur(18px) saturate(1.3);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  border: 1px solid var(--border);
}

/* -------------------------------------------------------------------------- */
/* 7. SITE HEADER (marketing)                                                   */
/* -------------------------------------------------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  transition: background .3s, box-shadow .3s, border-color .3s;
}
.site-header.scrolled {
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(16px) saturate(1.4); -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border-bottom: 1px solid var(--border-2); box-shadow: var(--sh-1);
}
.nav { display: flex; align-items: center; justify-content: space-between; gap: 1rem; height: 76px; }
.nav-links { display: flex; align-items: center; gap: .35rem; }
.nav-link {
  font-size: .94rem; font-weight: 500; color: var(--text-2); padding: .5rem .85rem; border-radius: var(--r-pill);
  transition: color .2s, background .2s;
}
.nav-link:hover { color: var(--text); background: var(--bg-2); }

/* Brand mark */
.brand { display: inline-flex; align-items: center; gap: .65rem; font-weight: 700; letter-spacing: -.02em; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; flex: none;
  background: var(--camap); position: relative; box-shadow: var(--sh-1);
  display: grid; place-items: center;
}
.brand-mark::after { content:""; position:absolute; inset:0; border-radius:10px; box-shadow: inset 0 1px 0 rgba(255,255,255,.4); }
.brand-mark svg { width: 19px; height: 19px; position: relative; z-index: 1; }
.brand-name { font-family: var(--f-display); font-size: 1.12rem; font-weight: 600; }
.brand-name small { display:block; font-family: var(--f-mono); font-size: .56rem; letter-spacing:.18em; color: var(--text-3); font-weight: 600; margin-top: -2px; }

/* Theme toggle */
.theme-toggle {
  width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); display: grid; place-items: center;
  box-shadow: var(--sh-1); transition: transform .3s var(--ease-out), box-shadow .25s, color .25s;
}
.theme-toggle:hover { transform: translateY(-2px) rotate(-12deg); box-shadow: var(--sh-2); }
.theme-toggle .bi-sun-fill { display: none; }
[data-theme="dark"] .theme-toggle .bi-moon-stars-fill { display: none; }
[data-theme="dark"] .theme-toggle .bi-sun-fill { display: block; color: var(--mango); }

/* -------------------------------------------------------------------------- */
/* 8. MESH / ATMOSPHERE                                                          */
/* -------------------------------------------------------------------------- */
.mesh {
  position: absolute; inset: -10% -10% auto -10%; height: 720px; z-index: 0; pointer-events: none;
  filter: blur(8px); opacity: .9;
}
.mesh .blob { position: absolute; border-radius: 50%; filter: blur(60px); opacity: .5; mix-blend-mode: multiply; animation: drift 18s ease-in-out infinite; }
[data-theme="dark"] .mesh .blob { mix-blend-mode: screen; opacity: .42; }
.mesh .b1 { width: 460px; height: 460px; background: var(--indigo);    top: -80px; left: 4%;  }
.mesh .b2 { width: 420px; height: 420px; background: var(--turquoise); top: -40px; left: 38%; animation-delay: -6s; }
.mesh .b3 { width: 380px; height: 380px; background: var(--sunset);    top: 30px;  right: 6%;  animation-delay: -11s; }
.mesh .b4 { width: 300px; height: 300px; background: var(--plum);      top: 220px; left: 22%; animation-delay: -3s; }
@keyframes drift {
  0%,100% { transform: translate(0,0) scale(1); }
  33% { transform: translate(34px,-26px) scale(1.08); }
  66% { transform: translate(-26px,22px) scale(.95); }
}

/* faint grid texture for clinical feel */
.scan-grid::before {
  content:""; position:absolute; inset:0; z-index:0; pointer-events:none; opacity:.5;
  background-image: linear-gradient(var(--border-2) 1px, transparent 1px), linear-gradient(90deg, var(--border-2) 1px, transparent 1px);
  background-size: 46px 46px; mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 30%, transparent 75%);
}

/* -------------------------------------------------------------------------- */
/* 9. MEDICAL VIEWER (the lightbox)                                              */
/* -------------------------------------------------------------------------- */
.viewer {
  position: relative; background: radial-gradient(120% 120% at 50% 0%, var(--lightbox-2), var(--lightbox));
  border-radius: var(--r-lg); overflow: hidden; border: 1px solid rgba(255,255,255,.06);
  color: var(--text-on-dark);
}
.viewer-toolbar {
  display: flex; align-items: center; gap: .5rem; padding: .6rem .8rem;
  border-bottom: 1px solid rgba(255,255,255,.07); background: rgba(0,0,0,.25);
}
.viewer-tool { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center;
  border: 1px solid rgba(255,255,255,.08); background: rgba(255,255,255,.04); color: #cfcbe6; transition: .2s; }
.viewer-tool:hover { background: rgba(255,255,255,.1); color: #fff; }
.viewer-tool.active { background: var(--camap); border-color: transparent; color: #fff; }
.viewer-stage { position: relative; aspect-ratio: 1/1; display: grid; place-items: center; padding: 6%; }
.viewer-meta { position: absolute; font-family: var(--f-mono); font-size: .62rem; letter-spacing: .06em; color: rgba(207,203,230,.7); }
.viewer-meta.tl { top: 12px; left: 14px; } .viewer-meta.tr { top: 12px; right: 14px; text-align: right; }
.viewer-meta.bl { bottom: 12px; left: 14px; } .viewer-meta.br { bottom: 12px; right: 14px; text-align: right; }
.viewer-scanline { position: absolute; left:0; right:0; height: 2px; background: linear-gradient(90deg, transparent, var(--turquoise), transparent); opacity:.0; animation: scan 3.2s var(--ease-out) infinite; }
@keyframes scan { 0%{ top:8%; opacity:0;} 12%{opacity:.9;} 88%{opacity:.9;} 100%{ top:92%; opacity:0;} }

/* Grad-CAM heatmap overlay applied to synthetic anatomy */
.heat-overlay { position:absolute; inset:0; mix-blend-mode: screen; opacity: var(--heat,.85); transition: opacity .4s var(--ease); pointer-events:none; }

/* legend */
.cam-legend { display:flex; align-items:center; gap:.6rem; font-family: var(--f-mono); font-size:.64rem; color: var(--text-3); }
.cam-bar { height: 8px; width: 120px; border-radius: 4px; background: var(--camap); }

/* -------------------------------------------------------------------------- */
/* 10. CONFIDENCE RING                                                           */
/* -------------------------------------------------------------------------- */
.ring { position: relative; width: 168px; height: 168px; }
.ring svg { transform: rotate(-90deg); width: 100%; height: 100%; }
.ring .track { fill: none; stroke: var(--border); stroke-width: 12; }
.ring .fill { fill: none; stroke: url(#camGrad); stroke-width: 12; stroke-linecap: round;
  transition: stroke-dashoffset 1.4s var(--ease-out); }
.ring .val { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring .val b { font-family: var(--f-mono); font-size: 2.1rem; font-weight: 700; letter-spacing: -.03em; }
.ring .val span { font-family: var(--f-mono); font-size: .64rem; letter-spacing: .18em; text-transform: uppercase; color: var(--text-3); }

/* linear meter */
.meter { height: 9px; border-radius: 6px; background: var(--border); overflow: hidden; }
.meter > i { display:block; height:100%; border-radius:6px; background: var(--camap); width:0; transition: width 1.2s var(--ease-out); }

/* -------------------------------------------------------------------------- */
/* 11. BENTO GRID                                                                */
/* -------------------------------------------------------------------------- */
.bento { display: grid; grid-template-columns: repeat(6, 1fr); gap: clamp(14px,1.6vw,20px); grid-auto-flow: dense; }
.bento > * { min-width: 0; }
.b-2 { grid-column: span 2; } .b-3 { grid-column: span 3; } .b-4 { grid-column: span 4; } .b-6 { grid-column: span 6; }
.row-2 { grid-row: span 2; }
@media (max-width: 900px){ .bento { grid-template-columns: repeat(2,1fr);} .b-2,.b-3,.b-4{ grid-column: span 1;} .b-6{grid-column: span 2;} .row-2{grid-row:auto;} }
@media (max-width: 540px){ .bento { grid-template-columns: 1fr;} .b-6{grid-column:auto;} }

/* -------------------------------------------------------------------------- */
/* 12. APP SHELL (dashboard)                                                     */
/* -------------------------------------------------------------------------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar-scrim { display: none; }
.sidebar {
  position: sticky; top: 0; height: 100vh; padding: 22px 16px; display: flex; flex-direction: column;
  z-index: 60;
}
.sidebar-inner {
  flex: 1; display: flex; flex-direction: column; gap: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl);
  box-shadow: var(--sh-2); padding: 18px 14px; overflow: auto;
}
.side-brand { padding: 8px 10px 14px; }
.side-group { font-family: var(--f-mono); font-size: .6rem; letter-spacing: .2em; text-transform: uppercase; color: var(--text-3); padding: 14px 12px 6px; }
.side-link {
  display: flex; align-items: center; gap: .75rem; padding: .68rem .8rem; border-radius: var(--r-sm);
  color: var(--text-2); font-weight: 500; font-size: .92rem; position: relative; transition: .2s;
}
.side-link i { font-size: 1.12rem; width: 20px; text-align: center; }
.side-link:hover { background: var(--bg-2); color: var(--text); }
.side-link.active { background: var(--ink); color: #fff; box-shadow: var(--sh-1); }
[data-theme="dark"] .side-link.active { background: var(--surface-2); color:#fff; }
.side-link.active::before { content:""; position:absolute; left:-14px; top:50%; transform:translateY(-50%); width:4px; height:22px; border-radius:4px; background: var(--camap); }
.side-link .tag { margin-left: auto; font-family: var(--f-mono); font-size: .62rem; padding: .1rem .4rem; border-radius: 6px; background: rgba(0,201,183,.16); color: #008e80; }
[data-theme="dark"] .side-link .tag { color: var(--turquoise); }

.appbar {
  position: sticky; top: 0; z-index: 50; height: 72px; display:flex; align-items:center; gap: 1rem;
  padding: 0 clamp(16px,3vw,34px);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px) saturate(1.3); -webkit-backdrop-filter: blur(14px) saturate(1.3);
  border-bottom: 1px solid var(--border-2);
}
.main { display: flex; flex-direction: column; min-width: 0; }
.page { padding: clamp(20px,3vw,38px); flex: 1; }

.search-field {
  display: flex; align-items: center; gap: .6rem; flex: 1; max-width: 420px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-pill);
  padding: .55rem 1rem; color: var(--text-3); box-shadow: var(--sh-1);
}
.search-field input { border: none; background: transparent; outline: none; color: var(--text); width: 100%; font-family: var(--f-body); font-size: .92rem; }

.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--camap); display: grid; place-items: center;
  color: #fff; font-weight: 700; font-family: var(--f-display); box-shadow: var(--sh-1); flex: none; }

.hamburger { display: none; }

@media (max-width: 1024px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: 290px; padding: 14px;
    transform: translateX(-104%); transition: transform .4s var(--ease-out);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-scrim { display: block; position: fixed; inset: 0; background: rgba(8,7,20,.5); backdrop-filter: blur(3px); z-index: 55; opacity: 0; visibility: hidden; transition: .3s; }
  .sidebar-scrim.show { opacity: 1; visibility: visible; }
  .hamburger { display: grid; }
}

/* -------------------------------------------------------------------------- */
/* 13. STAT / METRIC WIDGETS                                                     */
/* -------------------------------------------------------------------------- */
.stat { display: flex; flex-direction: column; gap: .35rem; }
.stat-top { display: flex; align-items: center; justify-content: space-between; }
.stat-ico { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-size: 1.2rem; }
.ico-indigo { background: rgba(45,63,231,.12); color: var(--indigo); }
.ico-turq { background: rgba(0,201,183,.14); color: #00a596; }
.ico-sunset { background: rgba(255,94,98,.13); color: var(--sunset); }
.ico-plum { background: rgba(110,46,183,.12); color: var(--plum); }
.ico-mango { background: rgba(255,179,71,.18); color: #c07d12; }
[data-theme="dark"] .ico-turq{color:var(--turquoise);}[data-theme="dark"] .ico-mango{color:var(--mango);}
.stat-num { font-family: var(--f-mono); font-size: clamp(1.7rem,3vw,2.3rem); font-weight: 700; letter-spacing: -.03em; line-height: 1; }
.stat-label { font-size: .82rem; color: var(--text-3); }
.trend { font-family: var(--f-mono); font-size: .72rem; font-weight: 600; display: inline-flex; align-items: center; gap: .2rem; }
.trend.up { color: #00a596; } .trend.down { color: var(--sunset); }

/* -------------------------------------------------------------------------- */
/* 14. FORMS                                                                     */
/* -------------------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: .4rem; }
.field label { font-size: .82rem; font-weight: 600; color: var(--text-2); }
.input, .select, textarea.input {
  width: 100%; font-family: var(--f-body); font-size: .96rem; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm);
  padding: .85rem 1rem; outline: none; transition: border-color .2s, box-shadow .2s, background .2s;
}
.input::placeholder { color: var(--text-3); }
.input:focus, .select:focus, textarea.input:focus { border-color: var(--indigo); box-shadow: 0 0 0 4px rgba(45,63,231,.14); }
.input-wrap { position: relative; }
.input-wrap > i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.input-wrap .input { padding-left: 42px; }
.input-wrap .toggle-eye { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); background: none; border: none; }
.check { display: inline-flex; align-items: center; gap: .55rem; font-size: .88rem; color: var(--text-2); cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--indigo); }

/* segmented role selector */
.seg { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit,minmax(120px,1fr)); }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; }
.seg .opt {
  border: 1px solid var(--border); border-radius: var(--r-sm); padding: .8rem; text-align: center;
  font-size: .86rem; font-weight: 600; color: var(--text-2); transition: .2s; background: var(--surface);
}
.seg .opt i { display:block; font-size: 1.3rem; margin-bottom: .25rem; color: var(--text-3); }
.seg input:checked + .opt { border-color: var(--indigo); background: rgba(45,63,231,.07); color: var(--text); box-shadow: 0 0 0 3px rgba(45,63,231,.1); }
.seg input:checked + .opt i { color: var(--indigo); }
.seg input:focus-visible + .opt { outline: 2px solid var(--indigo); outline-offset: 2px; }

/* -------------------------------------------------------------------------- */
/* 15. AUTH SPLIT                                                                */
/* -------------------------------------------------------------------------- */
.auth { display: grid; grid-template-columns: 1.05fr .95fr; min-height: 100vh; }
.auth-aside { position: relative; overflow: hidden; background: var(--ink); color: var(--text-on-dark); display: flex; flex-direction: column; justify-content: space-between; padding: clamp(28px,4vw,56px); }
.auth-form-col { display: grid; place-items: center; padding: clamp(28px,4vw,56px); }
.auth-card { width: 100%; max-width: 430px; }
@media (max-width: 920px){ .auth { grid-template-columns: 1fr; } .auth-aside { display: none; } }

/* -------------------------------------------------------------------------- */
/* 16. UPLOAD DROPZONE                                                           */
/* -------------------------------------------------------------------------- */
.dropzone {
  position: relative; border: 2px dashed var(--border); border-radius: var(--r-xl);
  background: var(--surface-2); padding: clamp(30px,5vw,64px); text-align: center;
  transition: border-color .25s, background .25s, transform .25s; overflow: hidden;
}
.dropzone.drag { border-color: var(--turquoise); background: rgba(0,201,183,.05); transform: scale(1.005); }
.dropzone .du-ico { width: 76px; height: 76px; margin: 0 auto 1rem; border-radius: 22px; background: var(--camap-soft); display: grid; place-items: center; font-size: 2rem; color: var(--indigo); }
.dropzone.drag .du-ico { animation: bob .8s var(--ease-out) infinite; }
@keyframes bob { 0%,100%{transform:translateY(0);} 50%{transform:translateY(-8px);} }

.upfile { display:flex; align-items:center; gap: .9rem; padding: .8rem; border:1px solid var(--border); border-radius: var(--r-md); background: var(--surface); }
.upfile-thumb { width: 52px; height: 52px; border-radius: 10px; background: var(--lightbox); display:grid; place-items:center; color:#7c7895; flex:none; overflow:hidden; }
.upfile-bar { height: 6px; border-radius: 4px; background: var(--border); overflow:hidden; margin-top: .4rem; }
.upfile-bar > i { display:block; height:100%; background: var(--camap); width:0; transition: width .3s linear; }

/* modality chooser */
.modality { border:1px solid var(--border); border-radius: var(--r-lg); padding: 1rem; background: var(--surface); cursor:pointer; transition:.25s; display:flex; gap:.9rem; align-items:center; }
.modality:hover { border-color: var(--indigo); transform: translateY(-3px); box-shadow: var(--sh-2); }
.modality.sel { border-color: var(--indigo); background: rgba(45,63,231,.05); box-shadow: 0 0 0 3px rgba(45,63,231,.1); }
.modality .m-ico { width: 48px; height:48px; border-radius: 14px; display:grid; place-items:center; font-size:1.4rem; flex:none; }

/* -------------------------------------------------------------------------- */
/* 17. TABLE                                                                     */
/* -------------------------------------------------------------------------- */
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; }
table.tbl thead th {
  font-family: var(--f-mono); font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3);
  text-align: left; padding: .85rem 1rem; border-bottom: 1px solid var(--border); font-weight: 600;
}
table.tbl tbody td { padding: .9rem 1rem; border-bottom: 1px solid var(--border-2); font-size: .9rem; vertical-align: middle; }
table.tbl tbody tr { transition: background .15s; }
table.tbl tbody tr:hover { background: var(--bg-2); }
.tid { font-family: var(--f-mono); font-size: .82rem; color: var(--text-2); }

/* DataTables harmonising */
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-pill);
  padding: .5rem .9rem; color: var(--text); outline: none; font-family: var(--f-body);
}
.dataTables_wrapper .dataTables_paginate .paginate_button {
  border-radius: 8px !important; border: 1px solid var(--border) !important; color: var(--text-2) !important;
  margin: 0 2px; padding: .35rem .7rem !important; background: var(--surface) !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current { background: var(--ink) !important; color: #fff !important; border-color: var(--ink) !important; }
.dataTables_wrapper .dataTables_info, .dataTables_wrapper .dataTables_length label, .dataTables_wrapper .dataTables_filter label { color: var(--text-3); font-size: .85rem; }

/* -------------------------------------------------------------------------- */
/* 18. WORKFLOW TIMELINE                                                          */
/* -------------------------------------------------------------------------- */
.flow { display: grid; gap: 0; position: relative; }
.flow-step { display: grid; grid-template-columns: 56px 1fr; gap: 1.1rem; padding-bottom: 2.2rem; position: relative; }
.flow-step::before { content:""; position:absolute; left: 27px; top: 52px; bottom: -4px; width: 2px; background: var(--border); }
.flow-step:last-child::before { display:none; }
.flow-node { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; font-family: var(--f-mono); font-weight: 700; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--sh-1); z-index: 1; font-size: 1rem; }
.flow-step.is-on .flow-node { background: var(--camap); color: #fff; border-color: transparent; }
.flow-step.is-on::before { background: var(--camap); }

/* -------------------------------------------------------------------------- */
/* 19. FOOTER                                                                    */
/* -------------------------------------------------------------------------- */
.site-footer { background: var(--ink); color: var(--text-on-dark); padding-block: clamp(48px,6vw,80px) 32px; position: relative; overflow: hidden; }
.site-footer a { color: rgba(243,241,250,.66); font-size: .92rem; transition: color .2s; }
.site-footer a:hover { color: #fff; }
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 2rem; }
@media (max-width: 820px){ .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px){ .footer-grid { grid-template-columns: 1fr; } }
.foot-col h6 { font-family: var(--f-mono); font-size: .68rem; letter-spacing: .18em; text-transform: uppercase; color: rgba(243,241,250,.5); margin-bottom: 1rem; }
.foot-col ul { list-style: none; padding: 0; margin: 0; display: grid; gap: .65rem; }

/* -------------------------------------------------------------------------- */
/* 20. UTILITIES / MOTION                                                         */
/* -------------------------------------------------------------------------- */
.divider { height: 1px; background: var(--border); border: 0; }
.muted-rule { display:flex; align-items:center; gap: 1rem; color: var(--text-3); font-size:.82rem; }
.muted-rule::before, .muted-rule::after { content:""; flex:1; height:1px; background: var(--border); }
.kpi-spark { height: 44px; }
.float { animation: float 6s ease-in-out infinite; }
@keyframes float { 0%,100%{transform:translateY(0);} 50%{transform:translateY(-12px);} }
.pulse-dot { width:8px;height:8px;border-radius:50%; background: var(--turquoise); box-shadow:0 0 0 0 rgba(0,201,183,.5); animation: pulse 2s infinite; }
@keyframes pulse { 0%{box-shadow:0 0 0 0 rgba(0,201,183,.5);} 70%{box-shadow:0 0 0 12px rgba(0,201,183,0);} 100%{box-shadow:0 0 0 0 rgba(0,201,183,0);} }

.skeleton { background: linear-gradient(100deg, var(--border-2) 30%, var(--border) 50%, var(--border-2) 70%); background-size: 200% 100%; animation: sk 1.3s infinite; border-radius: 8px; }
@keyframes sk { to { background-position: -200% 0; } }

:focus-visible { outline: 3px solid var(--indigo); outline-offset: 2px; border-radius: 4px; }
.hide-scroll::-webkit-scrollbar { display: none; }

/* reveal-on-load helpers (used where AOS not desired) */
[data-reveal] { opacity: 0; transform: translateY(18px); transition: opacity .7s var(--ease-out), transform .7s var(--ease-out); }
[data-reveal].in { opacity: 1; transform: none; }

.hidden { display: none !important; }
@media (max-width: 700px){ .nav-links.desktop { display: none; } }

/* hero stat trio */
.hero-stats { display: flex; align-items: stretch; gap: clamp(20px,3vw,40px); flex-wrap: wrap; }
.hero-stats .hs-item { position: relative; padding-right: clamp(20px,3vw,40px); }
.hero-stats .hs-item + .hs-item::before { content:""; position:absolute; left: calc(-1 * clamp(20px,3vw,40px) / 2 - .5px); top: 8%; bottom: 8%; width:1px; background: var(--border); }
@media (max-width:380px){ .hero-stats { gap: 16px; } .hero-stats .hs-item + .hs-item::before { display:none; } }

/* -------------------------------------------------------------------------- */
/* 21. UTILITY LAYER (Bootstrap-compatible, self-contained — no CDN needed)     */
/*     Implements exactly the grid / flex / spacing / display utilities the     */
/*     markup uses, so there are zero collisions with the components above.      */
/* -------------------------------------------------------------------------- */

/* Spacing scale: 0=0 · 1=.25rem · 2=.5rem · 3=1rem · 4=1.5rem · 5=3rem */

/* containers / wrap */
.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }

/* ---- grid ---- */
.row { --gx: 1.5rem; --gy: 0rem; display: flex; flex-wrap: wrap;
  margin-left: calc(-.5 * var(--gx)); margin-right: calc(-.5 * var(--gx)); margin-top: calc(-1 * var(--gy)); }
.row > * { box-sizing: border-box; padding-left: calc(.5 * var(--gx)); padding-right: calc(.5 * var(--gx)); margin-top: var(--gy); }
.g-0 { --gx: 0; --gy: 0; } .g-1 { --gx: .25rem; --gy: .25rem; } .g-2 { --gx: .5rem; --gy: .5rem; }
.g-3 { --gx: 1rem; --gy: 1rem; } .g-4 { --gx: 1.5rem; --gy: 1.5rem; } .g-5 { --gx: 3rem; --gy: 3rem; }
.gx-3 { --gx: 1rem; } .gx-4 { --gx: 1.5rem; } .gy-3 { --gy: 1rem; } .gy-4 { --gy: 1.5rem; }

.col { flex: 1 0 0%; }
.row > .col { flex: 1 0 0%; width: auto; }
.row > [class*="col-"] { flex: 0 0 auto; width: 100%; }   /* responsive cols full-width by default */
.row > .col-1 { width: 8.3333%; } .row > .col-2 { width: 16.6667%; } .row > .col-3 { width: 25%; }
.row > .col-4 { width: 33.3333%; } .row > .col-5 { width: 41.6667%; } .row > .col-6 { width: 50%; }
.row > .col-7 { width: 58.3333%; } .row > .col-8 { width: 66.6667%; } .row > .col-9 { width: 75%; }
.row > .col-10 { width: 83.3333%; } .row > .col-11 { width: 91.6667%; } .row > .col-12 { width: 100%; }

@media (min-width: 576px) {
  .row > .col-sm-4 { width: 33.3333%; } .row > .col-sm-5 { width: 41.6667%; } .row > .col-sm-6 { width: 50%; }
  .row > .col-sm-7 { width: 58.3333%; } .row > .col-sm-8 { width: 66.6667%; }
}
@media (min-width: 768px) {
  .row > .col-md-3 { width: 25%; } .row > .col-md-4 { width: 33.3333%; } .row > .col-md-5 { width: 41.6667%; }
  .row > .col-md-6 { width: 50%; } .row > .col-md-7 { width: 58.3333%; } .row > .col-md-8 { width: 66.6667%; }
}
@media (min-width: 992px) {
  .row > .col-lg-3 { width: 25%; } .row > .col-lg-4 { width: 33.3333%; } .row > .col-lg-5 { width: 41.6667%; }
  .row > .col-lg-6 { width: 50%; } .row > .col-lg-7 { width: 58.3333%; } .row > .col-lg-8 { width: 66.6667%; }
}

/* ---- display ---- */
.d-none { display: none !important; } .d-block { display: block !important; }
.d-inline { display: inline !important; } .d-inline-block { display: inline-block !important; }
.d-flex { display: flex !important; } .d-inline-flex { display: inline-flex !important; }
.d-grid { display: grid !important; }
@media (min-width: 576px) { .d-sm-none{display:none!important} .d-sm-block{display:block!important} .d-sm-flex{display:flex!important} .d-sm-inline-flex{display:inline-flex!important} }
@media (min-width: 768px) { .d-md-none{display:none!important} .d-md-block{display:block!important} .d-md-flex{display:flex!important} .d-md-inline-flex{display:inline-flex!important} }
@media (min-width: 992px) { .d-lg-none{display:none!important} .d-lg-block{display:block!important} .d-lg-flex{display:flex!important} }

/* ---- flex helpers ---- */
.flex-row { flex-direction: row !important; } .flex-column { flex-direction: column !important; }
.flex-wrap { flex-wrap: wrap !important; } .flex-nowrap { flex-wrap: nowrap !important; }
.flex-fill { flex: 1 1 auto !important; } .flex-grow-1 { flex-grow: 1 !important; }
.align-items-start { align-items: flex-start !important; } .align-items-center { align-items: center !important; }
.align-items-end { align-items: flex-end !important; } .align-items-stretch { align-items: stretch !important; }
.align-items-baseline { align-items: baseline !important; }
.align-self-start { align-self: flex-start !important; } .align-self-center { align-self: center !important; } .align-self-end { align-self: flex-end !important; }
.justify-content-start { justify-content: flex-start !important; } .justify-content-center { justify-content: center !important; }
.justify-content-end { justify-content: flex-end !important; } .justify-content-between { justify-content: space-between !important; }
.justify-content-around { justify-content: space-around !important; } .justify-content-evenly { justify-content: space-evenly !important; }

/* ---- gap ---- */
.gap-0 { gap: 0 !important; } .gap-1 { gap: .25rem !important; } .gap-2 { gap: .5rem !important; }
.gap-3 { gap: 1rem !important; } .gap-4 { gap: 1.5rem !important; } .gap-5 { gap: 3rem !important; }

/* ---- sizing ---- */
.w-100 { width: 100% !important; } .h-100 { height: 100% !important; } .mw-100 { max-width: 100% !important; }

/* ---- text alignment ---- */
.text-start { text-align: left !important; } .text-center { text-align: center !important; } .text-end { text-align: right !important; }

/* ---- margin / padding (0..5 + auto) ---- */
.m-0{margin:0!important}.m-1{margin:.25rem!important}.m-2{margin:.5rem!important}.m-3{margin:1rem!important}.m-4{margin:1.5rem!important}.m-5{margin:3rem!important}.m-auto{margin:auto!important}
.mt-0{margin-top:0!important}.mt-1{margin-top:.25rem!important}.mt-2{margin-top:.5rem!important}.mt-3{margin-top:1rem!important}.mt-4{margin-top:1.5rem!important}.mt-5{margin-top:3rem!important}
.mb-0{margin-bottom:0!important}.mb-1{margin-bottom:.25rem!important}.mb-2{margin-bottom:.5rem!important}.mb-3{margin-bottom:1rem!important}.mb-4{margin-bottom:1.5rem!important}.mb-5{margin-bottom:3rem!important}
.ms-0{margin-left:0!important}.ms-1{margin-left:.25rem!important}.ms-2{margin-left:.5rem!important}.ms-3{margin-left:1rem!important}.ms-auto{margin-left:auto!important}
.me-0{margin-right:0!important}.me-1{margin-right:.25rem!important}.me-2{margin-right:.5rem!important}.me-3{margin-right:1rem!important}.me-auto{margin-right:auto!important}
.mx-auto{margin-left:auto!important;margin-right:auto!important}.mx-1{margin-left:.25rem!important;margin-right:.25rem!important}.mx-2{margin-left:.5rem!important;margin-right:.5rem!important}
.my-0{margin-top:0!important;margin-bottom:0!important}.my-1{margin-top:.25rem!important;margin-bottom:.25rem!important}.my-2{margin-top:.5rem!important;margin-bottom:.5rem!important}.my-3{margin-top:1rem!important;margin-bottom:1rem!important}
.p-0{padding:0!important}.p-1{padding:.25rem!important}.p-2{padding:.5rem!important}.p-3{padding:1rem!important}.p-4{padding:1.5rem!important}
.pt-0{padding-top:0!important}.pt-1{padding-top:.25rem!important}.pt-2{padding-top:.5rem!important}.pt-3{padding-top:1rem!important}.pt-4{padding-top:1.5rem!important}
.pb-0{padding-bottom:0!important}.pb-1{padding-bottom:.25rem!important}.pb-2{padding-bottom:.5rem!important}.pb-3{padding-bottom:1rem!important}.pb-4{padding-bottom:1.5rem!important}
.px-1{padding-left:.25rem!important;padding-right:.25rem!important}.px-2{padding-left:.5rem!important;padding-right:.5rem!important}.px-3{padding-left:1rem!important;padding-right:1rem!important}
.py-1{padding-top:.25rem!important;padding-bottom:.25rem!important}.py-2{padding-top:.5rem!important;padding-bottom:.5rem!important}.py-3{padding-top:1rem!important;padding-bottom:1rem!important}

/* ---- misc ---- */
.position-relative { position: relative !important; }
.overflow-hidden { overflow: hidden !important; }
.text-nowrap { white-space: nowrap !important; }
/* =========================
   Register Page Responsive Fix
========================= */

/* Role Selection */
.seg {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 12px;
}

.seg label {
    width: 100%;
}

.seg .opt {
    min-height: 90px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 8px;
    text-align: center;
    padding: 12px;
}

.seg .opt i {
    margin: 0;
    font-size: 24px;
}

/* Tablet */
@media (max-width: 768px) {
    .auth-card {
        max-width: 100% !important;
    }

    .seg {
        grid-template-columns: repeat(2, 1fr);
    }

    .row.g-3 {
        --gx: 0.75rem;
    }
}

/* Mobile */
@media (max-width: 576px) {
    .auth-form-col {
        padding: 20px;
    }

    .auth-card {
        max-width: 100% !important;
    }

    .seg {
        grid-template-columns: 1fr;
    }

    .seg .opt {
        min-height: 70px;
        flex-direction: row;
        justify-content: flex-start;
        text-align: left;
        padding: 14px 16px;
    }

    .seg .opt i {
        font-size: 20px;
    }

    .btn-lg {
        width: 100%;
    }

    .row > .col-sm-5,
    .row > .col-sm-6,
    .row > .col-sm-7 {
        width: 100%;
    }
}