/* ============================================================================
   nwif.css — NWIF Reporting design system (v4, 2026-09)
   A neutral, data-first reporting UI: cool grey canvas, white surfaces, one navy
   brand colour, Inter throughout, 1px borders instead of shadows, semantic badges.

   Scope discipline: every rule is class-namespaced (.nw-*) or targets Dash's own
   component classes inside .nw-scope. No bare element selectors, so the locked
   sponsor-report pages (inline styles, no classNames) render exactly as before.
   ========================================================================== */

:root {
  /* canvas & surfaces */
  --paper: #F5F6F8;          /* app background (name kept for inline uses) */
  --surface: #FFFFFF;
  --surface-2: #F9FAFB;      /* table headers, subtle fills */
  --line: #E3E6EA;
  --line-soft: #EEF0F3;
  /* text */
  --ink: #101828;
  --text: #344054;
  --muted: #667085;
  --faint: #98A2B3;
  /* brand */
  --navy: #1E3A5F;
  --navy-700: #172E4B;
  --navy-50: #EEF2F7;
  /* semantic */
  --green: #1D7A53;  --green-tint: #E9F5EF;
  --amber: #946200;  --amber-tint: #FDF4E1;
  --rust: #B42318;   --rust-tint: #FDECEA;
  --gold: #946200;           /* legacy alias */

  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --serif: var(--sans);      /* legacy alias: serif retired */
  --radius: 8px;
  --radius-sm: 6px;
  --shadow-1: 0 1px 2px rgba(16,24,40,.04);
  --shadow-2: 0 4px 12px rgba(16,24,40,.08);
  --shadow-pop: 0 20px 48px rgba(16,24,40,.18);
  --ease: cubic-bezier(.2,.7,.2,1);

  --fs-xs: 11px; --fs-sm: 12px; --fs-md: 13px; --fs-base: 14px;
  --fs-lg: 16px; --fs-xl: 20px; --fs-2xl: 26px; --fs-3xl: 28px;
}

@font-face {
  font-family: 'Inter';
  src: url('/assets/fonts/Inter-Variable.woff2') format('woff2');
  font-weight: 100 900; font-display: swap;
}

/* ---------- Base (opt-in wrapper only) ---------- */
.nw-scope {
  font-family: var(--sans);
  font-size: var(--fs-base);
  color: var(--text);
  font-feature-settings: "tnum" 1, "cv11" 1;
  -webkit-font-smoothing: antialiased;
}
.nw-scope :focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; border-radius: 4px; }

/* ---------- Typography ---------- */
.nw-h1 {
  font-family: var(--sans); font-weight: 650; font-size: var(--fs-3xl);
  line-height: 34px; letter-spacing: -.018em; color: var(--ink); margin: 0;
}
.nw-subtitle { font-size: var(--fs-base); color: var(--muted); margin-top: 6px; line-height: 1.5; max-width: 760px; }
.nw-eyebrow {
  font-size: var(--fs-xs); font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 6px;
}
.nw-section-title {
  font-family: var(--sans); font-weight: 600; font-size: 18px; line-height: 26px;
  color: var(--ink); margin: 28px 0 4px; letter-spacing: -.005em;
}
.nw-caption { font-size: var(--fs-md); color: var(--muted); margin-bottom: 14px; line-height: 1.55; }
.nw-caption--fine { font-size: var(--fs-sm); color: var(--faint); margin: -8px 0 18px; }
.nw-error { font-size: var(--fs-md); color: var(--rust); text-align: center; margin-top: 12px; }

/* ---------- Page header ---------- */
.nw-pagehead {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap;
  padding: 24px 0 18px; margin-bottom: 22px; border-bottom: 1px solid var(--line); position: relative;
}
.nw-pagehead__meta { font-size: var(--fs-md); color: var(--muted); padding-bottom: 3px; }

/* ---------- Buttons ---------- */
.nw-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-family: var(--sans); font-size: var(--fs-base); font-weight: 600; line-height: 1;
  padding: 10px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background-color .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease),
              box-shadow .15s var(--ease), transform .12s var(--ease);
}
.nw-btn:hover { border-color: #CBD2DA; background: var(--surface-2); }
.nw-btn:active { transform: scale(.98); }
.nw-btn--primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.nw-btn--primary:hover { background: var(--navy-700); border-color: var(--navy-700); color: #fff; }
.nw-btn--ghost { background: transparent; color: rgba(255,255,255,.88); border-color: rgba(255,255,255,.28); }
.nw-btn--ghost:hover { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.45); color: #fff; }
.nw-btn--sm { padding: 7px 12px; font-size: var(--fs-md); }
.nw-btn--block { width: 100%; padding-top: 11px; padding-bottom: 11px; }
.nw-btn[disabled] { opacity: .5; cursor: default; }

/* Icon-only row actions (edit / record PO / mark paid) */
.nw-scope .nw-iconbtn {
  width: 30px; height: 30px; padding: 0; margin-right: 4px; vertical-align: middle;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface) center / 16px no-repeat; cursor: pointer;
  transition: background-color .15s var(--ease), border-color .15s var(--ease), transform .12s var(--ease);
}
.nw-scope .nw-iconbtn:hover { background-color: var(--navy-50); border-color: #C5D0DE; }
.nw-scope .nw-iconbtn:active { transform: scale(.94); }
.nw-scope .nw-iconbtn--paid { background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231E3A5F' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect x='2' y='6' width='20' height='12' rx='2'/><circle cx='12' cy='12' r='2'/><path d='M6 12h.01M18 12h.01'/></svg>"); }
.nw-scope .nw-iconbtn--po { background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231E3A5F' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect x='8' y='2' width='8' height='4' rx='1'/><path d='M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2'/><path d='M9 13h6M9 17h4'/></svg>"); }
.nw-scope .nw-iconbtn--edit { background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231E3A5F' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M12 20h9'/><path d='M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z'/></svg>"); }

/* ---------- Cards ---------- */
.nw-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-1); transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}

/* KPI tiles */
.nw-kpi-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-bottom: 20px; }
.nw-kpi { padding: 18px 20px; position: relative; }
.nw-kpi:hover { border-color: #CFD5DD; }
.nw-kpi__value {
  font-size: 28px; font-weight: 650; letter-spacing: -.02em; color: var(--ink);
  line-height: 32px; padding-right: 26px; font-variant-numeric: tabular-nums;
}
.nw-kpi__value--long { font-size: var(--fs-xl); padding-top: 4px; }
.nw-kpi__label { font-size: var(--fs-sm); font-weight: 500; color: var(--muted); margin-top: 6px; }
.nw-kpi__icon {
  position: absolute; top: 16px; right: 16px; width: 18px; height: 18px; background-color: var(--faint);
  -webkit-mask: var(--icon) no-repeat center / contain; mask: var(--icon) no-repeat center / contain;
}
.nw-kpi__icon--people   { --icon: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><circle cx='9' cy='8' r='3.2'/><path d='M3.5 19c0-3 2.5-5.5 5.5-5.5s5.5 2.5 5.5 5.5'/><path d='M15.5 5.2a3.2 3.2 0 0 1 0 5.6'/><path d='M17 13.7c2 .8 3.5 2.9 3.5 5.3'/></svg>"); }
.nw-kpi__icon--cap      { --icon: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><path d='M12 4 2.5 8.8 12 13.6l9.5-4.8L12 4z'/><path d='M6.5 11v4.4c0 1.5 2.5 2.8 5.5 2.8s5.5-1.3 5.5-2.8V11'/><path d='M21.5 9v5'/></svg>"); }
.nw-kpi__icon--mic      { --icon: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><rect x='9' y='3' width='6' height='11' rx='3'/><path d='M5.5 11.5a6.5 6.5 0 0 0 13 0'/><path d='M12 18v3'/></svg>"); }
.nw-kpi__icon--bag      { --icon: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><path d='M5.5 8.5h13l-1.2 11H6.7l-1.2-11z'/><path d='M9 8.5V7a3 3 0 0 1 6 0v1.5'/></svg>"); }
.nw-kpi__icon--dollar   { --icon: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='8.5'/><path d='M12 7.5v9'/><path d='M14.5 9.2c-.5-.8-1.4-1.2-2.5-1.2-1.5 0-2.6.8-2.6 2s1.1 1.7 2.6 2 2.8.8 2.8 2.1-1.2 2-2.8 2c-1.2 0-2.2-.5-2.7-1.3'/></svg>"); }
.nw-kpi__icon--calendar { --icon: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><rect x='4' y='5.5' width='16' height='15' rx='2'/><path d='M4 10.5h16'/><path d='M8.5 3v4M15.5 3v4'/><path d='M9 15l2 2 4-4'/></svg>"); }
.nw-delta {
  display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-sm); font-weight: 600;
  padding: 2px 7px; border-radius: 4px; margin-top: 10px;
}
.nw-delta--up { color: var(--green); background: var(--green-tint); }
.nw-delta--down { color: var(--rust); background: var(--rust-tint); }

/* Chart cards */
.nw-chart-row { display: flex; gap: 16px; flex-wrap: wrap; }
.nw-chartcard { flex: 1; min-width: 320px; padding: 12px 10px; margin-bottom: 16px; }

/* Single-stat tiles */
.nw-stat { text-align: left; padding: 18px 20px; margin-bottom: 20px; position: relative; }
.nw-stat:hover { border-color: #CFD5DD; }
.nw-stat__value { font-size: 28px; font-variant-numeric: tabular-nums; font-weight: 650; letter-spacing: -.02em; color: var(--ink); line-height: 1.15; }
.nw-stat__label { font-size: var(--fs-sm); font-weight: 500; color: var(--muted); margin-top: 6px; }

/* ---------- App shell: navy rail + work canvas (Phase 1) ---------- */
.nw-shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; background: var(--paper); }
.nw-shell--collapsed { grid-template-columns: 64px minmax(0, 1fr); }
.nw-main { min-width: 0; }
.nw-main__inner { max-width: 1400px; margin: 0 auto; padding: 8px 28px 40px; }
.nw-rail {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; overflow-x: hidden; z-index: 900;
  background: var(--navy); color: #fff; display: flex; flex-direction: column; padding: 14px 10px 10px;
}
.nw-rail__top { display: flex; align-items: center; justify-content: space-between; padding: 2px 6px 14px; }
.nw-rail__brand { display: flex; align-items: center; gap: 10px; text-decoration: none; min-width: 0; }
.nw-rail__logo { height: 28px; width: auto; flex-shrink: 0; }
.nw-rail__product { font-size: var(--fs-md); font-weight: 600; color: rgba(255,255,255,.92); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; padding-left: 10px; border-left: 1px solid rgba(255,255,255,.22); line-height: 20px; }
.nw-rail__menu { display: none; }
.nw-rail__nav { flex: 1; }
.nw-rail__section { margin-top: 10px; }
.nw-rail__group { font-size: var(--fs-xs); font-weight: 600; color: rgba(255,255,255,.5); padding: 8px 10px 4px; white-space: nowrap; }
.nw-rail__link {
  display: flex; align-items: center; gap: 10px; width: 100%; box-sizing: border-box; padding: 7px 10px; margin: 1px 0;
  border-radius: var(--radius-sm); border: 0; background: transparent; font: 500 var(--fs-md)/20px var(--sans);
  color: rgba(255,255,255,.78); text-decoration: none; text-align: left; cursor: pointer; white-space: nowrap;
  transition: background-color .12s var(--ease), color .12s var(--ease);
}
.nw-rail__link:hover { background: rgba(255,255,255,.08); color: #fff; }
.nw-rail__link--active { background: rgba(255,255,255,.14); color: #fff; font-weight: 600; }
.nw-rail__link:focus-visible { outline: 2px solid #fff; outline-offset: -2px; }
.nw-rail__btn[disabled] { opacity: .55; cursor: default; }
.nw-rail__icon {
  width: 18px; height: 18px; flex-shrink: 0; background-color: currentColor;
  -webkit-mask: var(--icon) no-repeat center / contain; mask: var(--icon) no-repeat center / contain;
}
.nw-rail__label { overflow: hidden; text-overflow: ellipsis; }
.nw-rail__badge { margin-left: auto; font-size: var(--fs-xs); font-weight: 600; background: #fff; color: var(--navy);
  border-radius: 9px; padding: 0 7px; line-height: 18px; }
.nw-rail__foot { border-top: 1px solid rgba(255,255,255,.14); padding-top: 8px; margin-top: 8px; }
.nw-rail__collapse {
  align-self: flex-end; flex-shrink: 0; width: 30px; height: 26px; margin: -6px 0 2px; border: 0; border-radius: var(--radius-sm); cursor: pointer;
  background: rgba(255,255,255,.72); -webkit-mask: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><path d='M15 6l-6 6 6 6'/></svg>") no-repeat center / 16px; mask: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><path d='M15 6l-6 6 6 6'/></svg>") no-repeat center / 16px;
}
.nw-rail__collapse:hover { background: #fff; }
.nw-ico--home { --icon: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><path d='M3 11l9-7 9 7'/><path d='M5 10v10h14V10'/><path d='M10 20v-6h4v6'/></svg>"); }
.nw-ico--calendar { --icon: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><rect x='4' y='5' width='16' height='15' rx='2'/><path d='M4 10h16M9 3v4M15 3v4'/></svg>"); }
.nw-ico--broadcast { --icon: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='2'/><path d='M7.8 7.8a6 6 0 0 0 0 8.4M16.2 7.8a6 6 0 0 1 0 8.4M5 5a10 10 0 0 0 0 14M19 5a10 10 0 0 1 0 14'/></svg>"); }
.nw-ico--monitor { --icon: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><rect x='3' y='4' width='18' height='12' rx='2'/><path d='M8 20h8M12 16v4'/><path d='M10 8.5v4l3.5-2z'/></svg>"); }
.nw-ico--mic { --icon: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><rect x='9' y='3' width='6' height='11' rx='3'/><path d='M5.5 11.5a6.5 6.5 0 0 0 13 0M12 18v3'/></svg>"); }
.nw-ico--layers { --icon: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><path d='M12 3 3 8l9 5 9-5-9-5z'/><path d='M3 13l9 5 9-5'/></svg>"); }
.nw-ico--list { --icon: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><path d='M9 6h11M9 12h11M9 18h11'/><circle cx='4.5' cy='6' r='1'/><circle cx='4.5' cy='12' r='1'/><circle cx='4.5' cy='18' r='1'/></svg>"); }
.nw-ico--doc { --icon: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><path d='M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z'/><path d='M14 3v5h5M9 13h6M9 17h6'/></svg>"); }
.nw-ico--receipt { --icon: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><path d='M6 3h12v18l-3-2-3 2-3-2-3 2z'/><path d='M9 8h6M9 12h6'/></svg>"); }
.nw-ico--inbox { --icon: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><path d='M3 13l3-8h12l3 8v6H3z'/><path d='M3 13h5l1 3h6l1-3h5'/></svg>"); }
.nw-ico--eye { --icon: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><path d='M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7S2 12 2 12z'/><circle cx='12' cy='12' r='3'/></svg>"); }
.nw-ico--chart { --icon: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><path d='M4 20V10M10 20V4M16 20v-7M22 20H2'/></svg>"); }
.nw-ico--users { --icon: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><circle cx='9' cy='8' r='3.2'/><path d='M3.5 19c0-3 2.5-5.5 5.5-5.5s5.5 2.5 5.5 5.5'/><path d='M15.5 5.2a3.2 3.2 0 0 1 0 5.6M17 13.7c2 .8 3.5 2.9 3.5 5.3'/></svg>"); }
.nw-ico--user { --icon: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='8' r='4'/><path d='M4 21c0-4 3.6-7 8-7s8 3 8 7'/></svg>"); }
.nw-ico--refresh { --icon: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><path d='M20 11a8 8 0 1 0-2.3 5.7'/><path d='M20 4v7h-7'/></svg>"); }
.nw-ico--logout { --icon: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><path d='M15 4h4a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1h-4'/><path d='M10 16l-4-4 4-4M6 12h10'/></svg>"); }
.nw-ico--chev { --icon: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><path d='M15 6l-6 6 6 6'/></svg>"); }
.nw-ico--menu { --icon: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><path d='M4 7h16M4 12h16M4 17h16'/></svg>"); }

/* Collapsed rail: icons only (default on the four sponsor report pages) */
.nw-shell--collapsed .nw-rail { padding-left: 8px; padding-right: 8px; }
.nw-shell--collapsed .nw-rail__product, .nw-shell--collapsed .nw-rail__label,
.nw-shell--collapsed .nw-rail__group, .nw-shell--collapsed .nw-rail__badge { display: none; }
.nw-shell--collapsed .nw-rail__top { justify-content: center; padding-left: 0; padding-right: 0; }
.nw-shell--collapsed .nw-rail__logo { height: 22px; }
.nw-shell--collapsed .nw-rail__link { justify-content: center; padding: 9px 0; }
.nw-shell--collapsed .nw-rail__section { margin-top: 6px; padding-top: 6px; border-top: 1px solid rgba(255,255,255,.1); }
.nw-shell--collapsed .nw-rail__collapse { align-self: center; transform: scaleX(-1); }

/* Sync status strip at the top of the canvas */
.nw-syncbar { max-width: 1400px; margin: 0 auto; padding: 8px 28px 0; font-size: var(--fs-sm); color: var(--text-2, var(--muted)); }
.nw-syncbar:empty { padding: 0; }

/* Mobile: the rail becomes a top bar with a menu */
@media (max-width: 960px) {
  .nw-shell, .nw-shell--collapsed { grid-template-columns: 1fr; }
  .nw-rail { position: sticky; height: auto; padding: 10px 14px; overflow: visible; }
  .nw-rail__top { padding: 0; }
  .nw-rail__menu { display: block; width: 36px; height: 32px; border: 0; cursor: pointer; background: #fff;
    -webkit-mask: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><path d='M4 7h16M4 12h16M4 17h16'/></svg>") no-repeat center / 22px; mask: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><path d='M4 7h16M4 12h16M4 17h16'/></svg>") no-repeat center / 22px; }
  .nw-rail__nav, .nw-rail__foot, .nw-rail__collapse { display: none; }
  .nw-shell--menu-open .nw-rail__nav, .nw-shell--menu-open .nw-rail__foot { display: block; }
  .nw-shell--collapsed .nw-rail__label, .nw-shell--collapsed .nw-rail__group, .nw-shell--collapsed .nw-rail__product { display: initial; }
  .nw-shell--collapsed .nw-rail__link { justify-content: flex-start; padding: 7px 10px; }
  .nw-main__inner { padding: 8px 16px 32px; }
}

/* ---------- Forms ---------- */
.nw-field-label { display: block; font-size: var(--fs-md); font-weight: 500; color: var(--text); margin: 0 0 6px; }
.nw-input {
  width: 100%; box-sizing: border-box; font-family: var(--sans); font-size: var(--fs-base); color: var(--ink);
  padding: 9px 12px; background: var(--surface); border: 1px solid #D0D5DD; border-radius: var(--radius-sm);
  box-shadow: 0 1px 2px rgba(16,24,40,.04);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.nw-input:hover { border-color: #B8BFCA; }
.nw-input:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgba(30,58,95,.16); }
/* Dash 4 renders dcc.Input as <div class="dash-input-container nw-input"><input class="dash-input-element">:
   the class lands on the wrapper, so it carries the box and the inner input goes bare. */
.dash-input-container.nw-input { height: 40px; padding: 0; }
.dash-input-container.nw-input > .dash-input-element {
  padding: 0 12px; font-family: var(--sans); font-size: var(--fs-base); color: var(--ink); background: transparent;
}
.dash-input-container.nw-input:focus-within { border: 1px solid var(--navy); box-shadow: 0 0 0 3px rgba(30,58,95,.16); outline: none; }
.dash-input-container.nw-input:has(:focus-visible) { outline: none; }
.nw-filter-row { display: flex; align-items: center; margin-bottom: 20px; }
.nw-filter-row .nw-field-label { margin: 0 10px 0 0; }

/* Dash dropdowns inside our pages: match the input styling */
.nw-scope .Select-control, .nw-scope .dash-dropdown .Select-control { border-color: #D0D5DD; border-radius: var(--radius-sm); }

/* ---------- Tables ---------- */
.nw-scope .nw-table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ---------- Tabs (dcc.Tabs; inline styles come from portal_common.TAB_*) ---------- */
.nw-scope .tab { transition: color .15s var(--ease), border-color .15s var(--ease), background-color .15s var(--ease) !important; }
.nw-scope .tab:not(.tab--selected):hover { color: var(--ink) !important; }

/* ---------- Dialogs ---------- */
.nw-modal {
  position: fixed; inset: 0; z-index: 1000; background: rgba(16,24,40,.45);
  align-items: flex-start; justify-content: center; padding: 8vh 16px; overflow-y: auto;
}
.nw-modal__box {
  background: var(--surface); border-radius: 12px; width: 100%; max-width: 640px;
  padding: 22px 24px 18px; box-shadow: var(--shadow-pop); font-family: var(--sans);
}
.nw-modal__box--sm { max-width: 420px; }
.nw-modal__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; gap: 12px; }
.nw-modal__head .nw-section-title { margin: 0; font-size: var(--fs-lg); }
.nw-modal__x { border: none; background: none; font-size: 24px; line-height: 1; color: var(--faint); cursor: pointer; padding: 0 4px; border-radius: 4px; }
.nw-modal__x:hover { color: var(--ink); background: var(--surface-2); }
.nw-modal__body { display: block; }
.nw-modal__body > * + * { margin-top: 12px; }
.nw-modal__row { display: flex; gap: 12px; flex-wrap: wrap; }
.nw-modal__foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line-soft); flex-wrap: wrap; }
.nw-modal__foot .nw-btn--left { margin-right: auto; }
.nw-modal .nw-field-label { margin-bottom: 4px; }
.nw-noscroll { overflow: hidden; }

/* ---------- Login: brand panel + form ---------- */
.nw-login { min-height: 100vh; display: grid; grid-template-columns: minmax(360px, 44%) 1fr; background: var(--surface); }
.nw-login__panel {
  position: relative; overflow: hidden; isolation: isolate; background: var(--navy); color: #fff;
  display: flex; flex-direction: column; justify-content: space-between; padding: 44px 48px;
}
.nw-login__logo { width: 190px; height: auto; display: block; }
.nw-login__tag { font-size: 22px; font-weight: 600; letter-spacing: -.01em; margin-top: auto; }
.nw-login__blurb { font-size: var(--fs-base); color: rgba(255,255,255,.72); margin-top: 8px; max-width: 360px; line-height: 1.55; }
.nw-login__foot { font-size: var(--fs-sm); color: rgba(255,255,255,.5); margin-top: 28px; }
.nw-login__main { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.nw-login__form { width: 100%; max-width: 360px; }
.nw-login__form .nw-field-label { margin-top: 16px; }
.nw-login__title { font-size: 24px; font-weight: 650; color: var(--ink); letter-spacing: -.015em; }
.nw-login__sub { font-size: var(--fs-base); color: var(--muted); margin: 6px 0 12px; }
.nw-login__form .nw-btn--block { margin-top: 22px; }
.nw-login__hint { font-size: var(--fs-sm); color: var(--muted); margin-top: 18px; line-height: 1.5; }
@media (max-width: 820px) {
  .nw-login { grid-template-columns: 1fr; }
  .nw-login__panel { padding: 28px 24px; min-height: 180px; }
  .nw-login__logo { width: 130px; }
  .nw-login__tag { margin-top: 18px; font-size: 18px; }
  .nw-login__blurb, .nw-login__foot { display: none; }
}

/* ---------- Tables, chips, filter bar, export menu, stamp (Phase 1) ---------- */
.nw-scope .nw-levent-table tbody tr { transition: background-color .15s var(--ease); }
.nw-scope .nw-levent-table tbody tr:hover { background-color: var(--surface-2); }

@media (prefers-reduced-motion: reduce) {
  .nw-btn, .nw-card, .nw-scope .nw-iconbtn, .nw-scope .tab, .nw-rail__link { transition: none !important; }
  .nw-btn:active, .nw-scope .nw-iconbtn:active { transform: none; }
}

/* Data tables — Carbon spec: 40 px rows, 16 px cell padding, raised header, right-aligned numbers */
.nw-scope .nw-num { text-align: right !important; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nw-scope table[data-sortable] th { cursor: pointer; user-select: none; }
.nw-scope table[data-sortable] th::after { content: ''; display: inline-block; width: 8px; margin-left: 4px; opacity: .45; }
.nw-scope table[data-sortable] th[aria-sort=ascending]::after { content: '\2191'; opacity: .8; }
.nw-scope table[data-sortable] th[aria-sort=descending]::after { content: '\2193'; opacity: .8; }
.nw-table-caption { font-size: var(--fs-sm); color: var(--muted); margin: 0 0 8px; }

/* Status chips — three fixed sets, dot + word, never clickable */
.nw-scope .nw-chip--positive { background: var(--green-tint); color: var(--green); }
.nw-scope .nw-chip--warning  { background: var(--amber-tint); color: var(--amber); }
.nw-scope .nw-chip--danger   { background: var(--rust-tint);  color: var(--rust); }
.nw-scope .nw-chip--neutral  { background: #F2F4F7; color: #475467; }
.nw-scope .nw-chip--brand    { background: var(--navy-50); color: var(--navy); }

/* Filter bar — URL-driven, forwardable */
.nw-filterbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin: 0 0 16px; font-size: var(--fs-md); }
.nw-filterbar__group { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.nw-filterbar__label { color: var(--muted); font-weight: 500; margin-right: 2px; }
.nw-filterbar__opt {
  display: inline-block; padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
  color: var(--text); text-decoration: none; font-size: var(--fs-md); line-height: 18px;
}
.nw-filterbar__opt:hover { border-color: #B8BFCA; }
.nw-filterbar__opt--on { background: var(--navy); border-color: var(--navy); color: #fff; font-weight: 600; }
.nw-filterbar__meta { color: var(--muted); font-size: var(--fs-sm); }
.nw-filterbar__reset { color: var(--navy); font-size: var(--fs-sm); font-weight: 600; }

/* Export menu (native <details>, works without JavaScript) */
.nw-export { position: relative; display: inline-block; }
.nw-export > summary { list-style: none; }
.nw-export > summary::-webkit-details-marker { display: none; }
.nw-export > summary::after { content: ''; width: 0; height: 0; margin-left: 2px; border: 4px solid transparent; border-top-color: currentColor; transform: translateY(2px); }
.nw-export__menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 50; min-width: 260px; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-2);
}
.nw-export__head { font-size: var(--fs-xs); font-weight: 600; color: var(--muted); padding: 6px 10px 4px; }
.nw-export__item { display: flex; justify-content: space-between; gap: 12px; padding: 7px 10px; border-radius: var(--radius-sm);
  color: var(--ink); text-decoration: none; font-size: var(--fs-md); }
.nw-export__item:hover { background: var(--surface-2); }
.nw-export__fmt { color: var(--muted); font-size: var(--fs-sm); }

/* Page header action row + document stamp */
.nw-pagehead__actions { display: flex; gap: 8px; align-items: center; padding-bottom: 2px; }
.nw-stamp { margin-top: 28px; padding-top: 12px; border-top: 1px solid var(--line); font-size: var(--fs-sm); color: var(--muted); }
.nw-scope .nw-nowrap { white-space: nowrap; font-variant-numeric: tabular-nums; }
.nw-scope .nw-cell-sm { font-size: var(--fs-sm); color: var(--muted); }
