/* ==========================================================================
   IRINN — design system
   Tokens mirror the MyIRINN portal (myirinn.in) so the two properties read as
   one family. Values were taken from the portal's rendered UI, not from the
   stale `--theme-primary: #FFD700` default left in its custom.css.

   Contrast, measured against #FFFFFF:
     --indigo-600 #4F46E5   8.06:1   AA/AAA body text, buttons, links
     --green-700  #15803D   4.85:1   AA body text
     --green-600  #16A34A   3.36:1   large text, badge fills (white on it: 3.4)
     --ink        #0F172A  17.85:1   headings
     --muted      #6B7280   4.83:1   AA secondary text
   Anything below 4.5:1 is used for fills or >=24px text only, never body copy.
   ========================================================================== */

/* --- Font -------------------------------------------------------------- */
@font-face {
  font-family: 'Varela Round';
  src: url('/fonts/VarelaRound-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* --- Tokens ------------------------------------------------------------ *
   The three brand colours are sampled directly from IRINNLogo.png, which is a
   globe encircled by saffron, indigo and green orbital rings -- the tricolour.
   Measured shares: green 36.7%, indigo 36.1%, saffron 27.1%.

     saffron  #e69847
     indigo   #2f247e
     green    #4f8d3b

   Contrast on white governs where each may be used:
     indigo  #2f247e  12.54:1  safe anywhere, including body text
     green   #4f8d3b   4.03:1  fills, icons and large text; NOT body text
     green   #477f35   4.82:1  the text-safe green
     saffron #e69847   2.35:1  DECORATIVE ONLY -- never carries text
     saffron #a16a32   4.54:1  the text-safe saffron
   Saffron is the one to watch: at full strength it is a fill colour, and text
   placed on or in it must use the darkened variant or sit on a pale tint.
   ------------------------------------------------------------------------ */
:root {
  /* Brand — sampled from IRINNLogo.png */
  --saffron: #e69847;
  --chakra: #2f247e;
  --india-green: #4f8d3b;

  /* Retained for the NIXI wordmark lockup in the header */
  --nixi-navy: #2b2f6c;

  /* Indigo ramp, built out from the logo's #2f247e */
  --indigo-50: #eeecf8;
  --indigo-100: #ddd9f1;
  --indigo-200: #c3bce6;
  --indigo-400: #7a6dc9;
  --indigo-500: #5b4cba;
  --indigo-600: #46379f;
  --indigo-700: #3a2d8b;
  --indigo-800: #2f247e;
  --indigo-900: #221a5c;

  /* Saffron ramp */
  --saffron-50: #fdf5ed;
  --saffron-100: #fbe9d6;
  --saffron-200: #f6d3ac;
  --saffron-400: #eeb06a;
  --saffron-500: #e69847;
  --saffron-600: #c4813c;
  --saffron-700: #a16a32;

  /* Green ramp, built out from the logo's #4f8d3b */
  --green-50: #eef5ec;
  --green-100: #dbead6;
  --green-200: #bcd7b3;
  --green-400: #6ea658;
  --green-500: #4f8d3b;
  --green-600: #477f35;
  --green-700: #3a6a2b;

  /* Status */
  --amber-50: #fffbeb;
  --amber-500: #f59e0b;
  --amber-700: #b45309;
  --red-50: #fef2f2;
  --red-600: #dc2626;
  --red-700: #b91c1c;
  --blue-50: #eff6ff;
  --blue-600: #2563eb;

  /* Neutrals */
  --white: #ffffff;
  --canvas: #f7f8fc;
  --surface: #ffffff;
  --surface-2: #fafbfe;
  --line: #e5e7eb;
  --line-strong: #d1d5db;
  --ink: #0f172a;
  --body: #374151;
  --muted: #5f6775;

  /* Semantic aliases — components reference these, so a re-theme is one block */
  --brand: var(--indigo-600);
  --brand-dark: var(--indigo-800);
  --brand-light: var(--indigo-50);
  --brand-on: var(--white);
  --link: var(--indigo-700);

  /* Focus indicators. WCAG 1.4.11 applies to focus rings, so the ring must be
     chosen for the surface it lands on: saffron is 2.35:1 against white and
     fails there, but reads strongly against the dark indigo bars. */
  --focus: #1d4ed8;                  /* on light surfaces  — 6.70:1 on white */
  --focus-on-dark: var(--saffron-500); /* on the dark indigo bars and footer */

  /* Tricolour accent roles. Components pick an accent rather than a raw
     colour, so the rotation stays consistent and the text-safe variants are
     never bypassed.

     One pairing to avoid: --accent-1-ink on --accent-1-tint is 4.21:1, just
     under AA. Saffron text belongs on white, and the saffron tint takes --ink
     or an indigo. Both green and indigo are safe ink-on-own-tint. */
  --accent-1: var(--saffron-500);      /* fills, rules, illustration */
  --accent-1-ink: var(--saffron-700);  /* the same accent, safe for text */
  --accent-1-tint: var(--saffron-50);
  --accent-2: var(--indigo-800);
  --accent-2-ink: var(--indigo-800);
  --accent-2-tint: var(--indigo-50);
  --accent-3: var(--green-500);
  --accent-3-ink: var(--green-600);
  --accent-3-tint: var(--green-50);

  /* The flag rule used as a hairline under the utility bar and above the
     footer. Hard stops, equal thirds. */
  --tricolour: linear-gradient(
    90deg,
    var(--saffron-500) 0 33.333%,
    var(--white) 33.333% 66.666%,
    var(--india-green) 66.666% 100%
  );

  /* Radii */
  --r-sm: 0.375rem;
  --r: 0.5rem;
  --r-lg: 0.75rem;
  --r-xl: 1rem;
  --r-pill: 999px;

  /* Elevation — soft, matching the portal's card treatment */
  --sh-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --sh: 0 1px 3px rgba(16, 24, 40, 0.1), 0 1px 2px rgba(16, 24, 40, 0.06);
  --sh-md: 0 4px 12px rgba(16, 24, 40, 0.08), 0 2px 4px rgba(16, 24, 40, 0.04);
  --sh-lg: 0 12px 32px rgba(16, 24, 40, 0.1), 0 4px 8px rgba(16, 24, 40, 0.04);
  --sh-brand: 0 4px 14px rgba(79, 70, 229, 0.25);

  /* Spacing — 4px base */
  --s1: 0.25rem;
  --s2: 0.5rem;
  --s3: 0.75rem;
  --s4: 1rem;
  --s5: 1.5rem;
  --s6: 2rem;
  --s7: 3rem;
  --s8: 4rem;

  /* Type */
  --font: 'Varela Round', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
    'Helvetica Neue', Arial, sans-serif;
  /* xs and sm are nudged up from 0.75/0.875 so that micro-copy -- badges,
     eyebrows, field hints -- stays above ~11px now the base is 87.5%. */
  --t-xs: 0.8125rem;
  --t-sm: 0.9375rem;
  --t-base: 1rem;
  --t-md: 1.0625rem;
  --t-lg: 1.25rem;
  --t-xl: 1.5rem;
  --t-2xl: 1.875rem;
  --t-3xl: 2.25rem;
  --t-4xl: 3rem;

  --container: 1240px;
  --header-h: 76px;
}

/* --- Accessibility: user font scaling (A- / A / A+) ----------------------
   The base is 87.5% rather than 100%, which makes the default rendering match
   what the old A- setting produced. The three controls step relative to that,
   so A+ still reaches a comfortably large size and browser zoom is unaffected.
   Everything below is sized in rem so it all scales together. */
html {
  font-size: calc(93.75% * var(--font-scale, 1));
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 1rem);
}

/* --- Accessibility: high-contrast mode ---------------------------------- */
[data-contrast='high'] {
  --canvas: #ffffff;
  --surface: #ffffff;
  --surface-2: #ffffff;
  --ink: #000000;
  --body: #000000;
  --muted: #1f2937;
  --line: #000000;
  --line-strong: #000000;
  --brand: #1a1a8c;
  --brand-dark: #10105e;
  --brand-light: #ffffff;
  --link: #10105e;
  --green-600: #14532d;
  --green-700: #14532d;
  --sh: none;
  --sh-sm: none;
  --sh-md: none;
  --sh-lg: none;
  --sh-brand: none;
}
[data-contrast='high'] .card,
[data-contrast='high'] .panel,
[data-contrast='high'] .btn {
  border: 2px solid #000 !important;
}
[data-contrast='high'] .hero,
[data-contrast='high'] .page-hero {
  background: #10105e !important;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* --- Base --------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--t-md);
  line-height: 1.65;
  color: var(--body);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0 0 var(--s3);
  color: var(--ink);
  line-height: 1.25;
  font-weight: 400; /* Varela Round has a single weight; size carries hierarchy */
  letter-spacing: -0.01em;
}
h1 { font-size: var(--t-3xl); }
h2 { font-size: var(--t-2xl); }
h3 { font-size: var(--t-xl); }
h4 { font-size: var(--t-lg); }

p { margin: 0 0 var(--s4); }
ul, ol { margin: 0 0 var(--s4); padding-left: 1.35rem; }
li { margin-bottom: var(--s2); }

a { color: var(--link); text-decoration: underline; text-underline-offset: 2px; }
a:hover { color: var(--brand-dark); }

img, svg, video { max-width: 100%; height: auto; }

strong, b { font-weight: 700; color: var(--ink); }

hr { border: 0; border-top: 1px solid var(--line); margin: var(--s6) 0; }

code, kbd, samp, pre {
  font-family: ui-monospace, SFMono-Regular, 'Cascadia Mono', Menlo, Consolas, monospace;
  font-size: 0.9em;
}

/* Focus — visible on every interactive element, never removed */
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

/* --- Layout ------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--s4);
}
@media (min-width: 768px) { .container { padding-inline: var(--s5); } }

.section { padding-block: var(--s7); }
.section--tight { padding-block: var(--s6); }
/* A band that lifts off the page background, used to separate homepage sections */
.section--panel { background: var(--surface); border-block: 1px solid var(--line); }
@media (min-width: 900px) { .section { padding-block: var(--s8); } }

.grid { display: grid; gap: var(--s5); }
@media (min-width: 640px)  { .grid--2 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px)  { .grid--3 { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 640px)  { .grid--4 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .grid--4 { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 900px)  { .grid--sidebar { grid-template-columns: minmax(0, 1fr) 320px; gap: var(--s6); } }

.stack > * + * { margin-top: var(--s4); }
.flow > * + * { margin-top: var(--s5); }

/* --- Utilities ---------------------------------------------------------- */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.text-center { text-align: center; }
.text-muted { color: var(--muted); }
.lead { font-size: var(--t-lg); color: var(--body); }

.mb-0 { margin-bottom: 0; }
.mt-0 { margin-top: 0; }
.mt-2 { margin-top: var(--s2); }
.mt-3 { margin-top: var(--s3); }
.mt-4 { margin-top: var(--s4); }
.mt-5 { margin-top: var(--s5); }
.mt-6 { margin-top: var(--s6); }
.mb-2 { margin-bottom: var(--s2); }
.mb-3 { margin-bottom: var(--s3); }
.mb-4 { margin-bottom: var(--s4); }
.mb-5 { margin-bottom: var(--s5); }
.gap-4 { gap: var(--s4); }
.text-brand { color: var(--brand); }
.text-on-dark { color: var(--white); }
.dim { opacity: 0.7; }
.indent { padding-left: 1.2rem; }
.col-narrow { width: 22%; }
.bare { border: 0; }
.pad-head { padding: var(--s4) var(--s5) 0; }
.mx-auto { margin-inline: auto; }
.text-sm { font-size: var(--t-sm); }
.text-base { font-size: var(--t-base); }
.stat-hero { font-size: var(--t-4xl); color: var(--brand); margin: 0; }

/* <summary> of a collapsible section — the marker is kept, so the control
   still announces its expanded state to assistive technology. */
.disclosure { cursor: pointer; list-style-position: inside; }
.disclosure:hover { background: linear-gradient(90deg, var(--indigo-100), var(--surface) 70%); }
.disclosure::marker { color: var(--brand); }
details[open] > .disclosure { border-bottom: 1px solid var(--line); }

/* Reading-width containers */
.measure { max-width: 70ch; }
.measure-wide { max-width: 80ch; }
.measure-full { max-width: 90ch; }

/* Plain lists — used for link lists in cards, footers and sidebars */
.list-plain { list-style: none; margin: 0; padding: 0; }
.list-plain li { margin-bottom: var(--s2); }
.list-plain li:last-child { margin-bottom: 0; }

/* Related links inside light cards and sidebars. Kept separate from the
   dark-footer link component so hover text always retains AA contrast. */
.related-links a {
  display: block;
  padding: var(--s2) var(--s3);
  color: var(--brand-dark);
  background: transparent;
  border-radius: var(--r-sm);
  text-decoration: none;
  transition: color .15s ease, background-color .15s ease, transform .15s ease;
}
.related-links a:hover,
.related-links a:focus-visible {
  color: var(--indigo-800);
  background: var(--indigo-50);
  text-decoration: underline;
  text-underline-offset: 3px;
  transform: translateX(2px);
}
.related-links a:active {
  color: var(--white);
  background: var(--brand-dark);
  transform: none;
}

.gap-tight { gap: var(--s3); }
.gap-wide { gap: var(--s6); }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-center { justify-content: center; }
.flush { padding: 0; }

.stat-figure { font-size: var(--t-3xl); color: var(--ink); margin: 0; }
.formula { font-size: var(--t-lg); }

/* Panel-inside-a-card, used for formulas and worked examples */
.inset {
  background: var(--surface-2);
  padding: var(--s3);
  border-radius: var(--r);
  font-size: var(--t-sm);
}

/* --- Search results ----------------------------------------------------- */
.search-form__row { display: flex; gap: var(--s3); flex-wrap: wrap; }
.search-form__row input { flex: 1 1 260px; }

.search-results { list-style: none; margin: 0; padding: 0; }
.search-result {
  margin: 0 0 var(--s4);
  padding: var(--s4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
}
.search-result__parent {
  margin: 0 0 var(--s1);
  font-size: var(--t-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.search-result__title { margin: 0 0 var(--s2); font-size: var(--t-lg); }
.search-result__title a { text-decoration: none; }
.search-result__title a:hover { text-decoration: underline; }
.search-result__snippet { margin: 0 0 var(--s2); color: var(--body); }
.search-result__url { margin: 0; font-size: var(--t-sm); color: var(--green-700); }

mark {
  background: var(--amber-50);
  color: var(--ink);
  padding: 0 2px;
  border-radius: 2px;
  box-shadow: inset 0 -2px 0 var(--amber-500);
}
[data-contrast='high'] mark { background: #ff0; color: #000; box-shadow: none; outline: 1px solid #000; }

/* --- Skip link ---------------------------------------------------------- */
.skip-link {
  position: absolute;
  top: -100px;
  left: var(--s4);
  z-index: 200;
  padding: var(--s3) var(--s5);
  background: var(--ink);
  color: var(--white);
  text-decoration: none;
  border-radius: 0 0 var(--r) var(--r);
  transition: top 0.15s ease;
}
.skip-link:focus { top: 0; color: var(--white); }

/* --- Section heading (portal style: rule + short brand underline) -------- */
.section-title { margin-bottom: var(--s5); }
.section-title h2,
.section-title h1 {
  margin-bottom: var(--s2);
  padding-bottom: var(--s3);
  border-bottom: 1px solid var(--line);
}
.section-title__sub { margin: 0; color: var(--muted); }
/* The rule under a section heading is the tricolour in miniature: three equal
   segments rather than one solid bar. */
.section-title::after {
  content: '';
  display: block;
  width: 72px;
  height: 4px;
  margin-top: var(--s3);
  border-radius: var(--r-pill);
  background: linear-gradient(
    90deg,
    var(--saffron-500) 0 33.333%,
    var(--indigo-800) 33.333% 66.666%,
    var(--india-green) 66.666% 100%
  );
}
.section-title--center { text-align: center; }
.section-title--center::after { margin-inline: auto; }

/* Uppercase rule heading, as used on the portal's Profile screen */
.rule-title {
  font-size: var(--t-lg);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink);
  padding-bottom: var(--s2);
  border-bottom: 2px solid var(--ink);
  margin-bottom: var(--s4);
}

/* --- Cards -------------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
  overflow: hidden;
}
.card__body { padding: var(--s5); }
.card__head {
  padding: var(--s4) var(--s5);
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, var(--indigo-50), var(--surface) 70%);
}
.card__head h2, .card__head h3 { margin: 0; font-size: var(--t-lg); color: var(--brand-dark); }

/* Left accent bar, as on the portal's dashboard cards. Three variants, one per
   brand colour, so a run of cards can cycle through the tricolour. */
.card--accent { border-left: 4px solid var(--accent-2); }

.card--accent-green { border-left: 4px solid var(--accent-3); }
.card--accent-green .card__head { background: linear-gradient(90deg, var(--green-50), var(--surface) 70%); }
.card--accent-green .card__head h2, .card--accent-green .card__head h3 { color: var(--accent-3-ink); }

.card--accent-saffron { border-left: 4px solid var(--accent-1); }
.card--accent-saffron .card__head { background: linear-gradient(90deg, var(--saffron-50), var(--surface) 70%); }
/* Not --accent-1-ink: saffron ink on the saffron tint is 4.21:1, below AA.
   The heading takes --ink, and saffron identifies the card via its edge. */
.card--accent-saffron .card__head h2, .card--accent-saffron .card__head h3 { color: var(--ink); }

/* Cards inside a .tricolour-set cycle saffron / indigo / green automatically,
   so a grid picks up the flag without each card being labelled by hand. */
.tricolour-set > *:nth-child(3n + 1) { border-top: 3px solid var(--saffron-500); }
.tricolour-set > *:nth-child(3n + 2) { border-top: 3px solid var(--indigo-800); }
.tricolour-set > *:nth-child(3n + 3) { border-top: 3px solid var(--india-green); }

.card--link { display: block; text-decoration: none; color: inherit; transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease; }
.card--link:hover { transform: translateY(-2px); box-shadow: var(--sh-md); border-color: var(--indigo-200); color: inherit; }
.card--link:hover .card__title { color: var(--brand); }

.card__icon {
  width: 48px; height: 48px;
  display: grid; place-items: center;
  border-radius: var(--r);
  background: var(--indigo-50);
  color: var(--brand);
  margin-bottom: var(--s3);
}
.card__icon svg { width: 24px; height: 24px; }
.card__icon--green { background: var(--green-50); color: var(--accent-3-ink); }
/* --amber is kept as an alias so existing markup keeps working; it now renders
   in the logo's saffron rather than a generic amber. */
.card__icon--amber,
.card__icon--saffron { background: var(--saffron-50); color: var(--accent-1-ink); }
.card__title { margin-bottom: var(--s2); font-size: var(--t-lg); transition: color 0.15s ease; }
.card__text { margin: 0; color: var(--muted); font-size: var(--t-base); }

/* Read-only field tile, as on the portal's Profile screen */
.field-tile {
  padding: var(--s3) var(--s4);
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
}
.field-tile dt {
  font-size: var(--t-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: var(--s1);
}
.field-tile dd { margin: 0; color: var(--ink); }

/* --- Buttons ------------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  padding: 0.7rem 1.4rem;
  min-height: 44px; /* WCAG 2.5.5 target size */
  font: inherit;
  font-size: var(--t-base);
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: var(--r);
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 18px; height: 18px; flex: none; }

.btn--primary { background: var(--brand); color: var(--brand-on); box-shadow: var(--sh-brand); }
.btn--primary:hover { background: var(--brand-dark); color: var(--brand-on); }

.btn--green { background: var(--green-600); color: var(--white); }
.btn--green:hover { background: var(--green-700); color: var(--white); }

.btn--outline { background: var(--surface); color: var(--brand-dark); border-color: var(--line-strong); }
.btn--outline:hover { background: var(--indigo-50); border-color: var(--brand); color: var(--brand-dark); }

.btn--ghost { background: transparent; color: var(--brand-dark); }
.btn--ghost:hover { background: var(--indigo-50); }

.btn--on-dark { background: var(--white); color: var(--indigo-800); }
.btn--on-dark:hover { background: var(--indigo-50); color: var(--indigo-800); }

/* Outlined button on a dark or gradient background */
.btn--outline-light {
  background: transparent;
  color: var(--white);
  border-color: rgba(255, 255, 255, 0.5);
}
.btn--outline-light:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--white);
  color: var(--white);
}
[data-contrast='high'] .btn--outline-light { border-color: var(--white); }

.btn--pill { border-radius: var(--r-pill); padding-inline: 1.75rem; }
.btn--lg { font-size: var(--t-lg); padding: 0.9rem 1.9rem; min-height: 52px; }
.btn--sm { font-size: var(--t-sm); padding: 0.4rem 0.9rem; min-height: 36px; }
.btn--block { width: 100%; }

.btn-row { display: flex; flex-wrap: wrap; gap: var(--s3); }

/* --- Badges ------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--s1);
  padding: 0.15rem 0.6rem;
  font-size: var(--t-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-radius: var(--r-pill);
  background: var(--indigo-50);
  color: var(--indigo-800);
  white-space: nowrap;
}
.badge--green { background: var(--green-600); color: var(--white); }
.badge--amber { background: var(--amber-500); color: #1f1300; }
.badge--red { background: var(--red-600); color: var(--white); }
.badge--new { background: var(--red-600); color: var(--white); }

/* --- Alerts ------------------------------------------------------------- */
.alert {
  display: flex;
  gap: var(--s3);
  padding: var(--s4);
  border-radius: var(--r);
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand);
  background: var(--indigo-50);
  color: var(--ink);
}
.alert p:last-child { margin-bottom: 0; }
.alert__icon { flex: none; width: 22px; height: 22px; margin-top: 2px; }
.alert--success { background: var(--green-50); border-left-color: var(--green-600); border-color: var(--green-100); }
.alert--success .alert__icon { color: var(--green-700); }
.alert--warn { background: var(--amber-50); border-left-color: var(--amber-500); border-color: #fde68a; }
.alert--warn .alert__icon { color: var(--amber-700); }
.alert--error { background: var(--red-50); border-left-color: var(--red-600); border-color: #fecaca; }
.alert--error .alert__icon { color: var(--red-700); }
.alert--info { background: var(--blue-50); border-left-color: var(--blue-600); border-color: #bfdbfe; }

/* --- Tables ------------------------------------------------------------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
table.table { width: 100%; border-collapse: collapse; font-size: var(--t-base); }
table.table caption { padding: var(--s3) var(--s4); text-align: left; color: var(--muted); font-size: var(--t-sm); }
table.table th, table.table td { padding: var(--s3) var(--s4); text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
table.table thead th { background: var(--surface-2); color: var(--ink); font-size: var(--t-sm); text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap; }
table.table tbody tr:last-child td { border-bottom: 0; }
table.table tbody tr:hover { background: var(--surface-2); }
table.table td.num, table.table th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* --- Forms -------------------------------------------------------------- */
.field { margin-bottom: var(--s4); }
.field > label,
.field .field__label {
  display: block;
  margin-bottom: var(--s2);
  font-size: var(--t-sm);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink);
}
.field .req { color: var(--red-600); }
.field__hint { display: block; margin-top: var(--s2); font-size: var(--t-sm); color: var(--muted); }
.field__error { display: block; margin-top: var(--s2); font-size: var(--t-sm); color: var(--red-700); }

input[type='text'], input[type='email'], input[type='tel'], input[type='number'],
input[type='search'], input[type='password'], select, textarea {
  width: 100%;
  padding: 0.7rem 0.9rem;
  min-height: 46px;
  font: inherit;
  font-size: var(--t-base);
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input::placeholder, textarea::placeholder { color: #9ca3af; }
input:hover, select:hover, textarea:hover { border-color: var(--indigo-400); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--indigo-100);
}
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 1px;
}
input[aria-invalid='true'] { border-color: var(--red-600); }
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2 4.2 6 8.2l4-4' fill='none' stroke='%236b7280' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  background-size: 14px;
  padding-right: 2.4rem;
}
fieldset { border: 1px solid var(--line); border-radius: var(--r); padding: var(--s4); margin: 0 0 var(--s4); }
legend { padding-inline: var(--s2); font-size: var(--t-sm); text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink); }

.radio-row { display: flex; flex-wrap: wrap; gap: var(--s4); }
.radio, .checkbox { display: flex; align-items: flex-start; gap: var(--s2); cursor: pointer; }
.radio input, .checkbox input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--brand); flex: none; }

/* --- Page hero (gradient banner, matching the portal's tool pages) ------- */
.page-hero {
  background: linear-gradient(115deg, var(--indigo-800) 0%, var(--indigo-600) 55%, var(--indigo-500) 100%);
  color: var(--white);
  padding-block: var(--s7);
  position: relative;
  overflow: hidden;
}
.page-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 82% 18%, rgba(255, 255, 255, 0.14), transparent 55%);
  pointer-events: none;
}
.page-hero > .container { position: relative; z-index: 1; }
.page-hero h1 { color: var(--white); margin-bottom: var(--s3); font-size: var(--t-3xl); }
.page-hero p { color: rgba(255, 255, 255, 0.92); max-width: 62ch; margin-bottom: 0; font-size: var(--t-lg); }
.page-hero--center { text-align: center; }
.page-hero--center p { margin-inline: auto; }
@media (min-width: 900px) { .page-hero h1 { font-size: var(--t-4xl); } }

/* --- Breadcrumbs -------------------------------------------------------- */
.breadcrumbs { background: var(--surface); border-bottom: 1px solid var(--line); font-size: var(--t-sm); }
.breadcrumbs ol { display: flex; flex-wrap: wrap; gap: var(--s2); list-style: none; margin: 0; padding: var(--s3) 0; }
.breadcrumbs li { margin: 0; display: flex; align-items: center; gap: var(--s2); color: var(--muted); }
.breadcrumbs li + li::before { content: '/'; color: var(--line-strong); }
.breadcrumbs a { color: var(--link); }

/* --- Panels (tool results) ---------------------------------------------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--s5);
  box-shadow: var(--sh-sm);
}
.panel--muted { background: var(--surface-2); }

.kv { display: grid; gap: 0; margin: 0; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.kv > div { display: grid; grid-template-columns: 1fr; gap: 0; border-bottom: 1px solid var(--line); }
.kv > div:last-child { border-bottom: 0; }
.kv dt { padding: var(--s3) var(--s4); background: var(--surface-2); color: var(--ink); font-size: var(--t-sm); text-transform: uppercase; letter-spacing: 0.04em; }
.kv dd { margin: 0; padding: var(--s3) var(--s4); color: var(--ink); overflow-wrap: anywhere; }
@media (min-width: 640px) {
  .kv > div { grid-template-columns: 240px 1fr; }
  .kv dt { border-right: 1px solid var(--line); }
  .kv--compact > div { grid-template-columns: minmax(0, 1.2fr) minmax(5.5rem, 0.8fr); }
}
.kv--compact dt,
.kv--compact dd { overflow-wrap: anywhere; }
.kv--total dd { font-size: var(--t-xl); color: var(--green-700); }

pre.output {
  margin: 0;
  padding: var(--s4);
  background: #0f172a;
  color: #e2e8f0;
  border-radius: var(--r);
  overflow-x: auto;
  font-size: var(--t-sm);
  line-height: 1.6;
  max-height: 520px;
}

/* --- Supporting editorial visuals -------------------------------------- */
.content-visual {
  margin: 0;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
}
.content-visual img { display: block; width: 100%; height: auto; }
.content-visual figcaption {
  padding: var(--s3) var(--s4);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: var(--t-sm);
}
.link-nowrap { white-space: nowrap; }
@media (min-width: 1100px) {
  .keep-line-wide { white-space: nowrap; }
}

/* --- Print -------------------------------------------------------------- */
@media print {
  .site-header, .site-footer, .utility-bar, .breadcrumbs, .skip-link { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .card, .panel { border: 1px solid #999; box-shadow: none; break-inside: avoid; }
  a[href^='http']::after { content: ' (' attr(href) ')'; font-size: 9pt; color: #555; }
}
