/* Fusion Force, design tokens and base styles.
   Strict palette: #053E91 #1E4DB1 #042C6B #C5D4EF #E8EEF9 #F3F6FC #FFFFFF.
   Solid surfaces only: no gradients, no glass, no blur. */
:root {
  /* Brand palette */
  --p: #053E91;        /* primary blue / turquoise: main buttons, branding, banners */
  --c: #1E4DB1;        /* bright cyan: icons, interactive and selected states */
  --d: #042C6B;        /* deep medical blue: secondary actions, strong elements */
  --sky: #C5D4EF;      /* soft sky: decorative shapes, borders */
  --ice: #E8EEF9;      /* light ice: section backgrounds */
  --pale: #F3F6FC;     /* very pale: cards, secondary surfaces */
  --white: #FFFFFF;

  /* Legacy aliases used across modules (kept so every screen maps onto the palette) */
  --blue: var(--p);
  --cyan: var(--c);
  --navy: var(--d);
  --navy-2: var(--d);
  --blue-700: var(--d);
  --blue-100: var(--ice);
  --blue-50: var(--pale);
  --cyan-50: var(--ice);

  /* Text: deep tones of the medical blue for legibility */
  --ink: #181D38;
  --ink-2: #3F4767;
  --ink-3: #6B7393;
  --line: #C5D4EF;
  --line-2: #E2E8F5;
  --surface: #FFFFFF;
  --bg: #F3F6FC;

  /* Functional status colours (clinical safety signals) */
  --ok: #157A55;      --ok-bg: #E3F4EC;
  --warn: #9A5B00;    --warn-bg: #FCF1DC;
  --bad: #B42F2F;     --bad-bg: #FBE9E9;
  --info: #042C6B;    --info-bg: #E8EEF9;
  --mute: #557686;    --mute-bg: #EEF5F8;

  --r-sm: 5px;
  --r: 7px;
  --r-lg: 9px;
  --r-xl: 12px;

  --shadow-1: 0 1px 2px rgba(14, 22, 52, .06);
  --shadow-2: 0 6px 18px -8px rgba(14, 22, 52, .16);
  --shadow-3: 0 18px 44px -14px rgba(14, 22, 52, .28);
  --ring: 0 0 0 3px rgba(30, 77, 177, .30);

  --font: 'Quicksand', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --t-fast: .14s;
  --t: .22s;

  /* Workspace navigation (sidebar + top bar): a deep tone of the brand blue in both themes */
  --nav-bg: #0A1F4D;
  --nav-bg-2: #0E275C;
  --nav-ink: #EEF2FB;
  --nav-ink-2: #AEBBDA;
  --nav-ink-3: #7F8DB3;
  --nav-line: rgba(197, 212, 239, .14);
  --nav-hover: rgba(197, 212, 239, .10);
  --nav-active: rgba(30, 77, 177, .24);
  color-scheme: light;
}

/* Dark theme: deep shades of the brand blues, never black. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --d: #7B9CF0;
  --sky: #2C3E73;
  --ice: #18244A;
  --pale: #141F40;
  --white: #111A35;
  --ink: #E9EDF8;
  --ink-2: #B1BCDA;
  --ink-3: #8792B8;
  --line: #2B3B6C;
  --line-2: #1E2A50;
  --surface: #111A35;
  --bg: #0B1224;
  --ok: #5CD6A5;   --ok-bg: #0F3A34;
  --warn: #F3C46A; --warn-bg: #3A3118;
  --bad: #FF8E8E;  --bad-bg: #47222B;
  --info: #9DB7F5; --info-bg: #18244A;
  --mute: #A2ACCB; --mute-bg: #1A2443;
  --shadow-1: 0 1px 2px rgba(3, 6, 18, .4);
  --shadow-2: 0 8px 22px -10px rgba(3, 6, 18, .7);
  --shadow-3: 0 22px 50px -16px rgba(3, 6, 18, .8);
  --nav-bg: #0B1026;
  --nav-bg-2: #0E1631;
  --nav-line: rgba(197, 212, 239, .10);
}
/* Colours ease across a theme switch (only while switching, so normal interactions stay crisp). */
html.theme-switching *, html.theme-switching *::before, html.theme-switching *::after { transition: background-color .35s var(--ease), border-color .35s var(--ease), color .35s var(--ease) !important; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, h5 { margin: 0; font-weight: 700; line-height: 1.2; letter-spacing: -.005em; }
h1 { font-size: 1.45rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; } h4 { font-size: .9rem; }
p { margin: 0; }
a { color: var(--d); text-decoration: none; }
a:hover { color: var(--p); }
button, input, select, textarea, table { font: inherit; color: inherit; }
button { cursor: pointer; }
img, svg { display: block; max-width: 100%; }
table { border-collapse: collapse; width: 100%; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 5px; }
::selection { background: var(--sky); }

.icon { width: 17px; height: 17px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Utilities */
.row { display: flex; align-items: center; gap: 10px; }
.row-wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack-sm { gap: 6px; }
.grow { flex: 1; min-width: 0; }
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.grid-side { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(var(--min, 240px), 1fr)); }
.muted { color: var(--ink-3); }
.small { font-size: .82rem; }
.tiny { font-size: .74rem; }
.strong { font-weight: 700; }
.mono { font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden { display: none !important; }
.mt { margin-top: 14px; } .mb { margin-bottom: 14px; }
.pre { white-space: pre-wrap; }
.brand-text { color: var(--p); }

@media (max-width: 1180px) { .grid-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-side { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .grid-2, .grid-3, .grid-4, .grid-6 { grid-template-columns: 1fr; } }

/* Boot splash and view transitions */
.boot { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 14px; background: var(--white); color: var(--p); font-weight: 700; letter-spacing: .14em; text-transform: uppercase; font-size: .8rem; }
.boot-mark { width: 64px; height: 64px; background: url('/assets/brand/mark-256.png') center / contain no-repeat; animation: pulse 1.4s var(--ease) infinite; }
@keyframes pulse { 50% { transform: scale(.88); opacity: .7; } }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes breathe { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
@keyframes pop { 0% { transform: scale(.96); opacity: 0; } 100% { transform: none; opacity: 1; } }
/* No forwards fill: a lingering transform on the outlet would re-anchor position:fixed children. */
.view-enter { animation: rise .24s var(--ease) backwards; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .2s; }

/* Skeleton loading (opacity pulse; no gradient shimmer) */
.skeleton { display: grid; gap: 10px; padding: 16px; }
.sk { height: 12px; border-radius: 4px; background: var(--ice); animation: breathe 1.3s ease-in-out infinite; }
.sk.h { height: 22px; width: 40%; }
.sk.w60 { width: 60%; } .sk.w80 { width: 80%; } .sk.w30 { width: 30%; }
.sk-row { display: grid; grid-template-columns: 36px 1fr 1fr 90px; gap: 14px; align-items: center; }
.sk-row .sk.dot { width: 36px; height: 36px; border-radius: 7px; }

/* Scroll reveal: elements ease in as they enter the viewport and back out as they leave. */
.reveal, .reveal-left, .reveal-right, .reveal-scale, .reveal-rotate { transition: opacity .75s var(--ease-out), transform .75s var(--ease-out); transition-delay: var(--d-delay, 0s); will-change: opacity, transform; }
.reveal { opacity: 0; transform: translateY(46px); }
.reveal-left { opacity: 0; transform: translateX(-64px); }
.reveal-right { opacity: 0; transform: translateX(64px); }
.reveal-scale { opacity: 0; transform: scale(.88); }
.reveal-rotate { opacity: 0; transform: translateY(34px) rotate(-2.5deg) scale(.96); }
.reveal.in, .reveal-left.in, .reveal-right.in, .reveal-scale.in, .reveal-rotate.in { opacity: 1; transform: none; }

/* Workspace content: cards and tiles rise in, staggered, when a view opens. */
.view-enter .stat, .view-enter .card, .view-enter .dept-card { animation: riseIn .55s var(--ease-out) backwards; }
@keyframes riseIn { from { opacity: 0; transform: translateY(14px); } }
.view-enter .stats > :nth-child(2), .view-enter .grid > :nth-child(2) { animation-delay: .05s; }
.view-enter .stats > :nth-child(3), .view-enter .grid > :nth-child(3) { animation-delay: .1s; }
.view-enter .stats > :nth-child(4), .view-enter .grid > :nth-child(4) { animation-delay: .15s; }
.view-enter .grid > :nth-child(n+5) { animation-delay: .2s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .reveal, .reveal-left, .reveal-right, .reveal-scale, .reveal-rotate { opacity: 1; transform: none; }
}
