/* =====================================================================
   NumbrWiz Design System v2 — tokens, base, site chrome & new templates
   Brand reference: supplied NumbrWiz.com logo (navy #022E56, N-blue #034177,
   green #39BC44). Legacy calculator CSS consumes the --primary/--bg/... tokens.
   Docs: docs/DESIGN-SYSTEM.md
   ===================================================================== */

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/assets/fonts/inter-latin-var.woff2') format('woff2');
}
@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url('/assets/fonts/jakarta-latin-var.woff2') format('woff2');
}

/* ---------- 1. Tokens ---------- */
:root {
  /* brand scales */
  --nw-navy-50: #eef4fa; --nw-navy-100: #dcebf8; --nw-navy-200: #b9d4ee; --nw-navy-300: #8cb6e0;
  --nw-navy-400: #4f8ccc; --nw-navy-500: #1f6fbf; --nw-navy-600: #0a4f94; --nw-navy-700: #034177;
  --nw-navy-800: #022e56; --nw-navy-900: #021f3b; --nw-navy-950: #01142a;
  --nw-green-50: #effaf0; --nw-green-100: #d6f2da; --nw-green-200: #aee4b4; --nw-green-300: #7fd287;
  --nw-green-400: #39bc44; --nw-green-500: #21b74b; --nw-green-600: #1e9a3d; --nw-green-700: #1a7f37;
  --nw-green-800: #166430; --nw-green-900: #134f28;
  --nw-slate-50: #f6f8fb; --nw-slate-100: #eef2f7; --nw-slate-200: #dde5ee; --nw-slate-300: #c3cfdd;
  --nw-slate-400: #94a6bb; --nw-slate-500: #627385; --nw-slate-600: #475d6f; --nw-slate-700: #33475a;
  --nw-slate-800: #1c2c3f; --nw-slate-900: #0f1f33;

  /* semantic (light) — names kept compatible with the legacy calculators */
  --primary: var(--nw-navy-600);
  --primary-hover: var(--nw-navy-800);
  --primary-light: var(--nw-navy-100);
  --primary-50: #eef5fc;
  --secondary: var(--nw-navy-800);
  --accent: var(--nw-green-700);
  --accent-hover: var(--nw-green-800);
  --accent-bright: var(--nw-green-400);
  --nw-solid-primary: var(--nw-navy-600); /* fill behind white text (stays dark in dark mode) */
  --bg: var(--nw-slate-50);
  --card-bg: #ffffff;
  --surface-2: var(--nw-slate-100);
  --text: var(--nw-slate-900);
  --text-secondary: var(--nw-slate-600);
  --text-muted: #566778;
  --border: var(--nw-slate-200);
  --border-light: var(--nw-slate-100);
  --success: var(--nw-green-700);
  --success-bg: var(--nw-green-50);
  --warning: #b45309;
  --warning-bg: #fffbeb;
  --danger: #c62828;
  --danger-bg: #fef2f2;
  --focus-ring: 0 0 0 3px rgba(31, 111, 191, 0.35);

  /* elevation */
  --shadow-sm: 0 1px 2px rgba(2, 31, 59, 0.05);
  --shadow: 0 1px 3px rgba(2, 31, 59, 0.07), 0 1px 2px rgba(2, 31, 59, 0.04);
  --shadow-md: 0 6px 16px -6px rgba(2, 31, 59, 0.12), 0 2px 4px rgba(2, 31, 59, 0.04);
  --shadow-lg: 0 18px 40px -16px rgba(2, 31, 59, 0.22), 0 4px 10px rgba(2, 31, 59, 0.04);

  /* shape, type, motion, layout */
  --radius-sm: 8px; --radius: 12px; --radius-lg: 16px; --radius-xl: 20px; --radius-pill: 999px;
  --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Plus Jakarta Sans', 'Inter', system-ui, sans-serif;
  --fs-xs: 0.78rem; --fs-sm: 0.875rem; --fs-md: 1rem; --fs-lg: 1.125rem;
  --fs-h3: 1.15rem; --fs-h2: clamp(1.35rem, 1.1rem + 1vw, 1.75rem); --fs-h1: clamp(1.75rem, 1.2rem + 2.4vw, 2.75rem);
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 24px; --space-6: 32px; --space-7: 48px; --space-8: 64px;
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --max-width: 1280px;
  --header-height: 64px;
  --toc-width: 220px;
  --ad-subtle-border: rgba(148, 166, 187, 0.25);
  --ad-subtle-bg: rgba(238, 242, 247, 0.6);
  color-scheme: light;
}

.dark {
  --primary: #6cb2f0;
  --primary-hover: #9ccbf5;
  --nw-solid-primary: #1f6fbf;
  --primary-light: #173a63;
  --primary-50: #11243f;
  --secondary: #eef3f9;
  --accent: #1a7f37;
  --accent-hover: #166430;
  --bg: #0b1526;
  --card-bg: #13223a;
  --surface-2: #172a45;
  --text: #eef3f9;
  --text-secondary: #c3cfdd;
  --text-muted: #94a6bb;
  --border: #26395a;
  --border-light: #172a45;
  --success: #5fd06a;
  --success-bg: #0d2a17;
  --warning: #fbbf24;
  --warning-bg: #3a2a07;
  --danger: #f87171;
  --danger-bg: #3a1414;
  --focus-ring: 0 0 0 3px rgba(108, 178, 240, 0.45);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 6px 16px -6px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 18px 40px -16px rgba(0, 0, 0, 0.6);
  --ad-subtle-border: rgba(148, 166, 187, 0.15);
  --ad-subtle-bg: rgba(19, 34, 58, 0.5);
  color-scheme: dark;
}

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-height) + 12px); }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img, svg { max-width: 100%; }
:focus-visible { outline: 2px solid var(--nw-navy-500); outline-offset: 2px; }
.dark :focus-visible { outline-color: var(--primary); }
::selection { background: var(--nw-green-100); color: var(--nw-navy-900); }

.nw-icon { width: 1.15em; height: 1.15em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.nw-sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.nw-skip {
  position: absolute; left: 16px; top: -100px; z-index: 1000; padding: 10px 18px;
  background: var(--nw-navy-800); color: #fff; font-weight: 600; border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  text-decoration: none;
}
.nw-skip:focus { top: 0; }

/* light/dark logo swap (theme is a class, not a media query) */
.nw-brand__img--dark { display: none; }
.dark .nw-brand__img--light { display: none; }
.dark .nw-brand__img--dark { display: block; }

/* ---------- 3. Header ---------- */
.nw-header {
  position: sticky; top: 0; z-index: 900;
  background: rgba(255, 255, 255, 0.92);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.dark .nw-header { background: rgba(11, 21, 38, 0.92); }
.nw-header__inner {
  max-width: var(--max-width); margin: 0 auto; height: var(--header-height);
  display: flex; align-items: center; gap: var(--space-5); padding: 0 20px;
}
.nw-header .nw-brand { display: flex; align-items: center; flex: none; text-decoration: none; }
.nw-header .nw-brand__img { height: 40px; width: auto; }
.nw-header .nw-nav { display: flex; gap: 4px; margin-right: auto; }
.nw-header .nw-nav a {
  font: 600 0.92rem/1 var(--font-sans); color: var(--text-secondary); text-decoration: none;
  padding: 10px 12px; border-radius: var(--radius-sm); transition: color var(--transition), background var(--transition);
}
.nw-header .nw-nav a:hover { color: var(--secondary); background: var(--surface-2); }
.nw-header .nw-nav a[aria-current] { color: var(--secondary); box-shadow: inset 0 -2px 0 var(--accent-bright); border-radius: 0; }
.nw-header__actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.nw-header .nw-nav + .nw-header__actions { margin-left: 0; }

.nw-iconbtn {
  display: inline-grid; place-items: center; width: 42px; height: 42px; padding: 0;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--card-bg); color: var(--text-secondary);
  cursor: pointer; transition: color var(--transition), background-color var(--transition), border-color var(--transition);
}
.nw-iconbtn:hover { color: var(--secondary); border-color: var(--nw-slate-300); background: var(--surface-2); }
.nw-iconbtn .nw-icon, .nw-iconbtn .svg-icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.nw-searchbtn {
  display: inline-flex; align-items: center; gap: 10px; height: 42px; padding: 0 10px 0 14px; min-width: 250px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); color: var(--text-muted);
  font: 500 0.9rem/1 var(--font-sans); cursor: pointer; transition: color var(--transition), background-color var(--transition), border-color var(--transition);
}
.nw-searchbtn:hover { border-color: var(--nw-navy-300); color: var(--text-secondary); }
.nw-searchbtn__label { flex: 1; text-align: left; }
.nw-searchbtn__kbd {
  font: 600 0.7rem/1 var(--font-sans); padding: 5px 6px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--card-bg); color: var(--text-muted);
}
.nw-hamburger { display: none; }

.nw-catbar { border-top: 1px solid var(--border-light); background: var(--card-bg); }
.dark .nw-catbar { background: #0e1a2e; }
.nw-catbar__inner {
  max-width: var(--max-width); margin: 0 auto; padding: 8px 20px; display: flex; gap: 6px;
  overflow-x: auto; scrollbar-width: none;
}
.nw-catbar__inner::-webkit-scrollbar { display: none; }
.nw-catbar a {
  display: inline-flex; align-items: center; gap: 6px; flex: none; padding: 6px 12px; border-radius: var(--radius-pill);
  font: 600 0.82rem/1.2 var(--font-sans); color: var(--text-secondary); text-decoration: none; border: 1px solid transparent;
  transition: all var(--transition);
}
.nw-catbar a .nw-icon { width: 15px; height: 15px; color: var(--nw-green-600); }
.nw-catbar a:hover { background: var(--surface-2); color: var(--secondary); }
.nw-catbar a[aria-current] { background: var(--primary-50); color: var(--secondary); border-color: var(--nw-navy-200); }
.dark .nw-catbar a[aria-current] { border-color: var(--border); }

/* ---------- 4. Drawer ---------- */
.nw-drawer-overlay {
  position: fixed; inset: 0; z-index: 950; background: rgba(1, 20, 42, 0.5); opacity: 0; visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}
.nw-drawer-overlay.active { opacity: 1; visibility: visible; transition: opacity 0.25s ease; }
.nw-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 960; width: min(340px, 88vw);
  background: var(--card-bg); box-shadow: var(--shadow-lg); padding: 16px 18px 24px; overflow-y: auto;
  transform: translateX(100%); visibility: hidden; transition: transform 0.28s ease, visibility 0.28s ease;
  display: flex; flex-direction: column; gap: 8px;
}
.nw-drawer.active { transform: none; visibility: visible; transition: transform 0.28s ease; }
.nw-drawer__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.nw-drawer__head .nw-brand__img { height: 34px; width: auto; }
.nw-drawer__nav, .nw-drawer__cats { display: flex; flex-direction: column; }
.nw-drawer__nav a, .nw-drawer__cats a {
  display: flex; align-items: center; gap: 10px; padding: 11px 10px; border-radius: var(--radius-sm);
  color: var(--text); font-weight: 600; text-decoration: none; min-height: 44px;
}
.nw-drawer__nav a:hover, .nw-drawer__cats a:hover { background: var(--surface-2); }
.nw-drawer__cats a { font-weight: 500; color: var(--text-secondary); }
.nw-drawer__cats a .nw-icon { color: var(--nw-green-600); }
.nw-drawer__cats a span:first-of-type { flex: 1; }
.nw-drawer__label { margin: 12px 10px 2px; font: 700 0.72rem/1 var(--font-sans); letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); }
.nw-drawer__theme { margin-top: auto; }
.nw-count {
  display: inline-block; min-width: 1.9em; padding: 2px 7px; border-radius: var(--radius-pill); text-align: center;
  font: 600 0.72rem/1.4 var(--font-sans); background: var(--surface-2); color: var(--text-muted);
}
body.drawer-open { overflow: hidden; }

/* ---------- 5. Search dialog ---------- */
.nw-search {
  position: fixed; inset: 0; z-index: 980; display: flex; justify-content: center; align-items: flex-start;
  padding: 10vh 16px 16px; background: rgba(1, 20, 42, 0.55); opacity: 0; visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}
.nw-search.active { opacity: 1; visibility: visible; transition: opacity 0.2s ease; }
.nw-search__panel {
  width: min(640px, 100%); max-height: 76vh; display: flex; flex-direction: column; overflow: hidden;
  background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
}
.nw-search__head { display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 16px; border-bottom: 1px solid var(--border); color: var(--text-muted); }
.nw-search__input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text);
  font: 500 1.05rem/1.4 var(--font-sans); padding: 10px 0;
}
.nw-search__input::-webkit-search-cancel-button { display: none; }
.nw-search__results { overflow-y: auto; padding: 8px; }
.nw-search__hint, .nw-search__empty { padding: 18px 10px; margin: 0; color: var(--text-muted); font-size: var(--fs-sm); text-align: center; }
.nw-result {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius); text-decoration: none; color: var(--text);
}
.nw-result:hover, .nw-result[aria-selected="true"] { background: var(--primary-50); }
.nw-result__title { font-weight: 600; display: block; }
.nw-result__meta { display: block; font-size: var(--fs-xs); color: var(--text-muted); }
.nw-result mark { background: var(--nw-green-100); color: inherit; border-radius: 3px; padding: 0 1px; }
.dark .nw-result mark { background: #1b4d2a; }
.nw-result__icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--surface-2); color: var(--nw-green-600); flex: none; }

/* ---------- 6. Breadcrumbs ---------- */
.nw-breadcrumbs { max-width: var(--max-width); margin: 0 auto; padding: 16px 0 0; font-size: var(--fs-sm); }
.nw-breadcrumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 2px; }
.nw-breadcrumbs li { display: inline-flex; align-items: center; color: var(--text-muted); }
.nw-breadcrumbs li + li::before { content: '›'; margin: 0 8px; color: var(--nw-slate-400); }
.nw-breadcrumbs a { color: var(--text-secondary); text-decoration: none; font-weight: 500; }
.nw-breadcrumbs a:hover { color: var(--primary); text-decoration: underline; }
.nw-breadcrumbs [aria-current] { color: var(--secondary); font-weight: 600; }

/* ---------- 7. Buttons, chips, inputs (new templates) ---------- */
.nw-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 20px;
  border-radius: var(--radius-pill); border: 1px solid transparent; font: 600 0.95rem/1.2 var(--font-sans);
  text-decoration: none; cursor: pointer; transition: color var(--transition), background-color var(--transition), border-color var(--transition);
}
.nw-btn--primary { background: var(--accent); color: #fff; box-shadow: 0 6px 16px -6px rgba(26, 127, 55, 0.55); }
.nw-btn--primary:hover { background: var(--accent-hover); transform: translateY(-1px); }
.nw-btn--ghost { background: transparent; border-color: var(--border); color: var(--text); }
.nw-btn--ghost:hover { background: var(--surface-2); }
.nw-linkbtn { border: 0; background: none; padding: 0; color: var(--primary); font: inherit; font-weight: 600; text-decoration: underline; cursor: pointer; }
.nw-chip {
  display: inline-flex; align-items: center; gap: 6px; margin: 0; padding: 8px 14px; border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.12); color: inherit; font-size: var(--fs-sm); border: 1px solid rgba(255, 255, 255, 0.18);
}
.nw-eyebrow { margin: 0 0 10px; font: 700 0.78rem/1.2 var(--font-sans); letter-spacing: 0.14em; text-transform: uppercase; color: var(--nw-green-300); }

/* ---------- 8. Hero (new templates) ---------- */
.nw-hero {
  position: relative; overflow: hidden; margin: 18px 0 8px; border-radius: var(--radius-xl); color: #fff;
  background:
    radial-gradient(900px 300px at 100% 0%, rgba(57, 188, 68, 0.28), transparent 60%),
    radial-gradient(700px 320px at 0% 100%, rgba(31, 111, 191, 0.45), transparent 60%),
    linear-gradient(135deg, var(--nw-navy-800) 0%, var(--nw-navy-900) 55%, var(--nw-navy-950) 100%);
  box-shadow: var(--shadow-lg);
}
.nw-hero::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: 0.35;
  background-image: linear-gradient(rgba(255,255,255,0.06) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.06) 1px, transparent 1px);
  background-size: 28px 28px;
  -webkit-mask-image: linear-gradient(180deg, #000, transparent 85%); mask-image: linear-gradient(180deg, #000, transparent 85%);
}
.nw-hero__inner { position: relative; z-index: 1; padding: clamp(28px, 5vw, 56px) clamp(20px, 5vw, 56px); max-width: 860px; }
.nw-hero h1 {
  margin: 0 0 12px; font: 800 var(--fs-h1)/1.12 var(--font-display); letter-spacing: -0.025em; color: #fff;
}
.nw-hero__sub { margin: 0 0 22px; font-size: clamp(1rem, 0.95rem + 0.3vw, 1.15rem); line-height: 1.6; color: #c9d8ea; max-width: 680px; }
.nw-hero__badge { display: inline-grid; place-items: center; width: 52px; height: 52px; margin-bottom: 14px; border-radius: 14px; background: rgba(57, 188, 68, 0.18); color: var(--nw-green-300); border: 1px solid rgba(57, 188, 68, 0.35); }
.nw-hero__badge .nw-icon { width: 26px; height: 26px; }
.nw-hero__row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.nw-hero__search, .nw-filter {
  position: relative; display: flex; align-items: center; max-width: 560px; margin: 0 0 20px;
}
.nw-hero__search .nw-icon, .nw-filter .nw-icon { position: absolute; left: 16px; width: 20px; height: 20px; color: var(--nw-slate-500); pointer-events: none; }
.nw-hero__search input, .nw-filter input {
  width: 100%; height: 54px; padding: 0 18px 0 46px; border-radius: var(--radius-pill); border: 2px solid transparent;
  background: #fff; color: var(--nw-slate-900); font: 500 1rem/1 var(--font-sans); box-shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.5);
}
.nw-hero__search input:focus, .nw-filter input:focus { outline: none; border-color: var(--nw-green-400); }
.nw-filter { margin: 0; flex: 1 1 260px; }
.nw-filter input { height: 44px; }
.nw-stats, .nw-trust { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px 22px; }
.nw-stats { margin-bottom: 16px; color: #c9d8ea; font-size: var(--fs-sm); }
.nw-stats strong { color: #fff; font: 800 1.25rem/1 var(--font-display); margin-right: 4px; }
.nw-trust li { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-xs); font-weight: 600; color: #dfe9f5; }
.nw-trust li::before { content: ''; width: 16px; height: 16px; border-radius: 50%; background: var(--nw-green-400) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") center/10px no-repeat; }

.nw-hero__art {
  position: absolute; right: clamp(16px, 5vw, 72px); top: 50%; z-index: 1; width: clamp(180px, 22vw, 300px); height: auto;
  transform: translateY(-50%); filter: drop-shadow(0 20px 40px rgba(0, 0, 0, 0.35)); pointer-events: none;
}
.nw-hero__art-wrap::before {
  content: ''; position: absolute; right: clamp(0px, 3vw, 40px); top: 50%; width: 360px; height: 360px; transform: translateY(-50%);
  background: radial-gradient(circle, rgba(57, 188, 68, 0.35), transparent 65%); pointer-events: none;
}
@media (max-width: 960px) { .nw-hero__art, .nw-hero__art-wrap { display: none; } }

/* ---------- 9. Sections & grids (new templates) ---------- */
.nw-section { padding: 28px 0 8px; }
.nw-section__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.nw-section__head h2 { margin: 0; font: 800 var(--fs-h2)/1.2 var(--font-display); letter-spacing: -0.02em; color: var(--secondary); }
.nw-subhead { margin: 22px 0 10px; font: 700 var(--fs-h3)/1.3 var(--font-display); color: var(--secondary); }
.nw-link-more { font-weight: 600; font-size: var(--fs-sm); color: var(--primary); text-decoration: none; white-space: nowrap; }
.nw-link-more::after { content: ' →'; }
.nw-link-more:hover { text-decoration: underline; }
.nw-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.nw-grid--cards { grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }
.nw-grid--cats { grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); }
.nw-grid--compact { grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 8px; margin-top: 14px; }

.nw-card__link {
  height: 100%; display: flex; align-items: flex-start; gap: 14px; padding: 16px; text-decoration: none; color: var(--text);
  background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.nw-card__link:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--nw-navy-200); }
.dark .nw-card__link:hover { border-color: var(--nw-navy-600); }
.nw-card__icon, .nw-cat__icon {
  display: grid; place-items: center; width: 42px; height: 42px; flex: none; border-radius: 12px;
  background: linear-gradient(135deg, var(--nw-green-50), var(--nw-navy-50)); color: var(--nw-green-700);
  border: 1px solid var(--nw-green-100);
}
.dark .nw-card__icon, .dark .nw-cat__icon { background: #10301d; border-color: #1b4d2a; color: var(--nw-green-300); }
.nw-card__icon .nw-icon, .nw-cat__icon .nw-icon { width: 21px; height: 21px; }
.nw-card__body { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.nw-card__eyebrow { font: 700 0.68rem/1.2 var(--font-sans); letter-spacing: 0.08em; text-transform: uppercase; color: var(--nw-green-700); }
.dark .nw-card__eyebrow { color: var(--nw-green-300); }
.nw-card__title { font: 700 1rem/1.3 var(--font-display); color: var(--secondary); }
.nw-card__text { font-size: var(--fs-sm); line-height: 1.5; color: var(--text-secondary); display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.nw-card__arrow { width: 18px; height: 18px; color: var(--text-muted); margin-top: 2px; transition: transform var(--transition), color var(--transition); }
.nw-card__link:hover .nw-card__arrow { transform: translateX(3px); color: var(--accent); }

.nw-cat__link {
  height: 100%; display: flex; flex-direction: column; gap: 8px; padding: 18px; text-decoration: none; color: var(--text);
  background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  position: relative; overflow: hidden;
}
.nw-cat__link::before { content: ''; position: absolute; inset: 0 0 auto; height: 3px; background: linear-gradient(90deg, var(--nw-navy-600), var(--nw-green-400)); opacity: 0; transition: opacity var(--transition); }
.nw-cat__link:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.nw-cat__link:hover::before { opacity: 1; }
.nw-cat__title { font: 800 1.1rem/1.2 var(--font-display); color: var(--secondary); }
.nw-cat__text { font-size: var(--fs-sm); color: var(--text-secondary); line-height: 1.5; flex: 1; }
.nw-cat__count { font-size: var(--fs-sm); font-weight: 700; color: var(--accent); }
.dark .nw-cat__count { color: var(--nw-green-300); }

.nw-compact a {
  display: flex; align-items: center; min-height: 44px; padding: 10px 14px; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--card-bg); color: var(--text); font-weight: 600; font-size: var(--fs-sm); text-decoration: none;
}
.nw-compact a:hover { border-color: var(--nw-navy-300); color: var(--primary); }
.nw-filter-empty { color: var(--text-secondary); }
[data-nw-hidden] { display: none !important; }

/* ---------- 10. Footer ---------- */
.nw-footer { margin-top: 56px; background: var(--card-bg); border-top: 1px solid var(--border); color: var(--text-secondary); font-size: var(--fs-sm); }
.dark .nw-footer { background: #0a1322; }
.nw-footer::before { content: ''; display: block; height: 4px; background: linear-gradient(90deg, var(--nw-navy-800), var(--nw-navy-600) 45%, var(--nw-green-400)); }
.nw-footer__inner {
  max-width: var(--max-width); margin: 0 auto; padding: 44px 20px 28px;
  display: grid; grid-template-columns: minmax(240px, 1.6fr) repeat(4, minmax(140px, 1fr)); gap: 32px;
}
.nw-footer__logo img { width: 230px; height: auto; }
.nw-footer__brand p { margin: 14px 0; line-height: 1.6; max-width: 34ch; }
.nw-footer h2 { margin: 4px 0 12px; font: 700 0.78rem/1.2 var(--font-sans); letter-spacing: 0.1em; text-transform: uppercase; color: var(--secondary); }
.nw-footer ul { list-style: none; margin: 0; padding: 0; }
.nw-footer li { margin: 0; }
.nw-footer a { display: inline-flex; align-items: center; gap: 6px; padding: 5px 0; color: var(--text-secondary); text-decoration: none; }
.nw-footer a:hover { color: var(--primary); text-decoration: underline; }
.nw-footer .nw-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.nw-footer .nw-pills li { padding: 4px 10px; border-radius: var(--radius-pill); background: var(--nw-green-50); color: var(--nw-green-800); font-size: 0.75rem; font-weight: 600; }
.dark .nw-footer .nw-pills li { background: #10301d; color: var(--nw-green-200); }
.nw-footer__bottom { max-width: var(--max-width); margin: 0 auto; padding: 18px 20px 28px; border-top: 1px solid var(--border); font-size: 0.8rem; color: var(--text-muted); }
.nw-footer__bottom p { margin: 4px 0; }
.nw-footer__tagline { margin-left: 8px; font-weight: 700; color: var(--accent); }
.dark .nw-footer__tagline { color: var(--nw-green-300); }

/* ---------- 11. Toasts (fallback for pages without legacy toast CSS) ---------- */
.toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 990; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast-container > * { pointer-events: auto; }

/* ---------- 12. 404 + main wrapper for new pages ---------- */
.nw-main { max-width: var(--max-width); margin: 0 auto; padding: 0 20px; }
.nw-hero--404 p:last-child { margin: 0; }

/* ---------- 13. Responsive ---------- */
@media (max-width: 1100px) {
  .nw-searchbtn { min-width: 0; }
  .nw-searchbtn__label, .nw-searchbtn__kbd { display: none; }
  .nw-searchbtn { width: 42px; padding: 0; justify-content: center; }
  .nw-footer__inner { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .nw-footer__brand { grid-column: 1 / -1; }
}
@media (max-width: 860px) {
  .nw-header .nw-nav { display: none; }
  .nw-hamburger { display: inline-grid; }
  .nw-header__actions { margin-left: auto; }
}
@media (max-width: 640px) {
  :root { --header-height: 58px; }
  .nw-header__inner { padding: 0 14px; gap: 10px; }
  .nw-header .nw-brand__img { height: 32px; }
  .nw-catbar__inner { padding: 6px 14px; }
  .nw-hero { border-radius: var(--radius-lg); margin-top: 12px; }
  .nw-hero__search input { height: 50px; }
  .nw-footer__inner { grid-template-columns: 1fr 1fr; gap: 24px 16px; padding-top: 32px; }
  .nw-main { padding: 0 16px; }
}
@media (max-width: 380px) {
  .nw-footer__inner { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
@media print {
  .nw-header, .nw-catbar, .nw-footer, .nw-drawer, .nw-drawer-overlay, .nw-search, .ad-container, .nw-skip { display: none !important; }
  .nw-hero { color: #000; background: none; box-shadow: none; }
  .nw-hero h1 { color: #000; }
}
