/* =========================================================
   SUPREME TELEMETRY - GLOBAL THEME (single source of truth)
   Look & feel follows the main website (its-si.com): IBM Plex fonts,
   ink-navy surfaces, blue brand colour, green "trace" accent.
   Linked by: index, login, dashboard, change_password, admin_users
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&family=IBM+Plex+Sans+Condensed:wght@500;600;700&family=IBM+Plex+Sans:wght@400;500;600;700&display=swap');

/* ---------------------------------------------------------
   1) PRIMARY COLOR  <<< CHANGE THE COLOR HERE >>>
   ---------------------------------------------------------
   Values are "R G B" triplets (no commas) - this is what lets
   Tailwind opacity classes like bg-primary-950/40 keep working.

   To switch colors: replace the 11 lines in ACTIVE PALETTE below
   with the lines from one of the ready-made palettes underneath.
   --------------------------------------------------------- */

:root {
/* ACTIVE PALETTE = its-si.com "brand" blue (brand-500 #2468d1 is primary-600) */
--primary-50:  238 245 255;
--primary-100: 217 232 255;
--primary-200: 185 212 251;
--primary-300: 132 178 242;
--primary-400: 77 143 232;
--primary-500: 58 123 220;
--primary-600: 36 104 209;
--primary-700: 26 82 171;
--primary-800: 22 63 133;
--primary-900: 17 47 99;
--primary-950: 11 22 38;

  /* its-si.com "ink" navy surfaces + green "trace" accent (R G B) */
  --ink-900: 11 22 38;    /* #0b1626 */
  --ink-800: 15 32 56;    /* #0f2038 */
  --ink-700: 22 48 79;    /* #16304f */
  --trace:   61 220 151;  /* #3ddc97 */

  /* Fonts used on every page (change once here) */
  --font-sans:    'IBM Plex Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'IBM Plex Sans Condensed', 'IBM Plex Sans', ui-sans-serif, system-ui, sans-serif;
  --font-mono:    'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ---------------------------------------------------------
   READY-MADE PALETTES (copy the 11 lines into :root above)
   ROSE
   --primary-50:  255 241 242;
--primary-100: 255 228 230;
--primary-200: 254 205 211;
--primary-300: 253 164 175;
--primary-400: 251 113 133;
--primary-500: 244 63 94;
--primary-600: 225 29 72;
--primary-700: 190 18 60;
--primary-800: 159 18 57;
--primary-900: 136 19 55;
--primary-950: 76 5 25;

INDIGO
--primary-50:  238 242 255;
--primary-100: 224 231 255;
--primary-200: 199 210 254;
--primary-300: 165 180 252;
--primary-400: 129 140 248;
--primary-500: 99 102 241;
--primary-600: 79 70 229;
--primary-700: 67 56 202;
--primary-800: 55 48 163;
--primary-900: 49 46 129;
--primary-950: 30 27 75;

GREEN
--primary-50:  240 253 244;
--primary-100: 220 252 231;
--primary-200: 187 247 208;
--primary-300: 134 239 172;
--primary-400: 74 222 128;
--primary-500: 34 197 94;
--primary-600: 22 163 74;
--primary-700: 21 128 61;
--primary-800: 22 101 52;
--primary-900: 20 83 45;
--primary-950: 5 46 22;

   BLUE
   --primary-50:  239 246 255;
   --primary-100: 219 234 254;
   --primary-200: 191 219 254;
   --primary-300: 147 197 253;
   --primary-400: 96 165 250;
   --primary-500: 59 130 246;
   --primary-600: 37 99 235;
   --primary-700: 29 78 216;
   --primary-800: 30 64 175;
   --primary-900: 30 58 138;
   --primary-950: 23 37 84;

   RED
   --primary-50:  254 242 242;
   --primary-100: 254 226 226;
   --primary-200: 254 202 202;
   --primary-300: 252 165 165;
   --primary-400: 248 113 113;
   --primary-500: 239 68 68;
   --primary-600: 220 38 38;
   --primary-700: 185 28 28;
   --primary-800: 153 27 27;
   --primary-900: 127 29 29;
   --primary-950: 69 10 10;

   VIOLET
   --primary-50:  245 243 255;
   --primary-100: 237 233 254;
   --primary-200: 221 214 254;
   --primary-300: 196 181 253;
   --primary-400: 167 139 250;
   --primary-500: 139 92 246;
   --primary-600: 124 58 237;
   --primary-700: 109 40 217;
   --primary-800: 91 33 182;
   --primary-900: 76 29 149;
   --primary-950: 46 16 101;

   ORANGE
   --primary-50:  255 247 237;
   --primary-100: 255 237 213;
   --primary-200: 254 215 170;
   --primary-300: 253 186 116;
   --primary-400: 251 146 60;
   --primary-500: 249 115 22;
   --primary-600: 234 88 12;
   --primary-700: 194 65 12;
   --primary-800: 154 52 18;
   --primary-900: 124 45 18;
   --primary-950: 67 20 7;
   --------------------------------------------------------- */


/* ---------------------------------------------------------
   2) SHARED BASE STYLES
   (Colors/layout come from Tailwind classes in each page,
    which now read the --primary-* variables above.)
   --------------------------------------------------------- */

body {
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

/* Headings use the condensed display face, like the main website */
h1, h2, h3, .font-display { font-family: var(--font-display); }

/* Smooth light/dark switching (used as class="theme-transition") */
.theme-transition,
.theme-transition * {
  transition-property: background-color, border-color, color, fill, stroke;
  transition-duration: 150ms;
  transition-timing-function: ease;
}


/* ---------------------------------------------------------
   3) RESPONSIVE SCALING  (720p laptops -> 2K / 4K monitors)
   Everything in Tailwind is rem-based, so scaling the root font
   size scales the whole UI to the screen. Below 1024px (phones /
   tablets) the normal 16px base is kept.
   Takes the SMALLER of a width-based and a height-based size, so
   short screens (720p) never overflow and big screens (2K) fill up.
     1280x720  -> ~14px      1920x1080 -> ~16px      2560x1440 -> ~19px
   --------------------------------------------------------- */
@media (min-width: 1024px) {
  html { font-size: clamp(14px, min(0.4vw + 9.5px, 0.85vh + 8px), 22px); }
}

/* One fluid page container (header, banner and content all line up).
   Uses the full screen width up to 3200px; side padding grows with width. */
.page-wrap {
  width: 100%;
  max-width: 3200px;
  margin-inline: auto;
  padding-inline: clamp(0.625rem, 1.6vw, 3rem);
}

/* Metric cards: as many columns as fit, cards stretch to fill the row */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
}

/* Charts: side by side whenever there is room, stacked on narrow screens */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 30rem), 1fr));
}

/* Stops grid children (e.g. chart canvases) from forcing horizontal overflow */
.metrics-grid > *, .charts-grid > * { min-width: 0; }

/* Chart height follows the screen height */
.chart-box {
  position: relative;
  width: 100%;
  height: clamp(15rem, 36vh, 36rem);
}

/* Short laptop screens (e.g. 1280x720): don't let the sticky header eat the viewport */
@media (min-width: 1024px) and (max-height: 820px) {
  .app-header { position: static !important; }
}


/* ---------------------------------------------------------
   4) its-si.com LOOK (shared by every page)
   --------------------------------------------------------- */

/* Tighter corners, like the main site's cards and buttons
   (html prefix makes these win over the Tailwind utility classes). */
html .rounded-xl  { border-radius: 0.375rem; }
html .rounded-2xl,
html .rounded-3xl { border-radius: 0.5rem; }

/* Circuit-trace drawing animation (same as the its-si.com hero) */
@media (prefers-reduced-motion: no-preference) {
  .trace { stroke-dasharray: 1400; stroke-dashoffset: 1400; animation: draw 3.2s ease-out forwards; }
  .trace.d2 { animation-delay: .5s; }
  .trace.d3 { animation-delay: 1s; }
  @keyframes draw { to { stroke-dashoffset: 0; } }
}