/* ============================================================================
   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;
  --sky: #2E6DB4;            /* focus / links */
  /* 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(--sky); outline-offset: 2px; border-radius: 4px; }

/* ---------- Typography ---------- */
.nw-h1 {
  font-family: var(--sans); font-weight: 650; font-size: var(--fs-3xl);
  line-height: 1.2; 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: var(--fs-lg);
  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; box-shadow: var(--shadow-2); }
.nw-kpi__value {
  font-size: var(--fs-2xl); font-weight: 650; letter-spacing: -.02em; color: var(--ink);
  line-height: 1.15; padding-right: 26px;
}
.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; box-shadow: var(--shadow-2); }
.nw-stat__value { font-size: var(--fs-2xl); 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; }

/* ---------- Navigation ---------- */
.nw-nav {
  background: var(--navy); position: sticky; top: 0; z-index: 900;
  transition: box-shadow .3s var(--ease), background-color .3s var(--ease);
}
.nw-nav--scrolled { box-shadow: 0 6px 20px rgba(16,24,40,.18); }
.nw-nav__inner {
  max-width: 1400px; margin: 0 auto; padding: 0 24px; display: flex; align-items: center;
  justify-content: space-between; min-height: 56px; gap: 20px; position: relative;
}
.nw-nav__brand { display: flex; align-items: center; gap: 12px; text-decoration: none; flex-shrink: 0; }
.nw-nav__logo { height: 30px; width: auto; display: block; }
.nw-nav__product {
  font-size: var(--fs-md); font-weight: 600; color: rgba(255,255,255,.92); letter-spacing: .01em;
  padding-left: 12px; border-left: 1px solid rgba(255,255,255,.22); line-height: 22px; white-space: nowrap;
}
.nw-nav__menu { display: flex; align-items: center; gap: 0; }
.nw-nav__group {
  font-size: 10.5px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase;
  color: rgba(255,255,255,.45); padding: 0 6px 0 12px; margin-left: 8px;
  border-left: 1px solid rgba(255,255,255,.16); white-space: nowrap;
}
.nw-nav__link {
  position: relative; color: rgba(255,255,255,.72); text-decoration: none; font-size: var(--fs-md);
  font-weight: 500; padding: 18px 8px; white-space: nowrap; transition: color .15s var(--ease);
}
.nw-nav__link::after {
  content: ''; position: absolute; left: 8px; right: 8px; bottom: 0; height: 2px; background: #fff;
  transform: scaleX(0); transition: transform .2s var(--ease);
}
.nw-nav__link:hover { color: #fff; }
.nw-nav__link--active { color: #fff; }
.nw-nav__link--active::after { transform: scaleX(1); }
.nw-nav__logout {
  color: rgba(255,255,255,.65); font-size: var(--fs-md); text-decoration: none;
  padding: 8px 0 8px 10px; white-space: nowrap; transition: color .15s var(--ease);
}
.nw-nav__logout:hover { color: #fff; }
.nw-nav__account {
  flex-shrink: 0; width: 28px; height: 34px; margin-left: 6px; border-radius: var(--radius-sm);
  background: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' 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>") center / 17px no-repeat;
  opacity: .65; transition: opacity .15s var(--ease);
}
.nw-nav__account:hover { opacity: 1; }
.nw-nav__account-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.nw-nav__menu .nw-btn--ghost { margin-left: 12px; padding: 6px 11px; font-size: var(--fs-sm); }
.nw-syncbar { max-width: 1400px; margin: 0 auto; padding: 6px 24px; font-size: var(--fs-sm); color: rgba(255,255,255,.75); }
.nw-syncbar:empty { padding: 0; }
.nw-progress {
  position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 1200; pointer-events: none;
  background: #8DB6E3; transform-origin: 0 50%; transform: scaleX(0);
}

.nw-nav__toggle { display: none; background: none; border: 0; color: #fff; font-size: 22px; cursor: pointer; padding: 8px 4px; user-select: none; }
@media (max-width: 1340px) {
  .nw-nav__product { display: none; }
}
@media (max-width: 960px) {
  .nw-nav__product { display: block; }
  .nw-nav__toggle { display: block; }
  .nw-nav__menu { display: none; }
  .nw-nav--open .nw-nav__menu {
    display: flex; flex-direction: column; align-items: stretch; position: absolute; top: 56px; left: 0; right: 0;
    z-index: 100; background: var(--navy); padding: 6px 20px 18px; border-top: 1px solid rgba(255,255,255,.12);
    box-shadow: 0 12px 24px rgba(16,24,40,.25);
  }
  .nw-nav--open .nw-nav__link { padding: 12px 6px; }
  .nw-nav--open .nw-nav__link::after { display: none; }
  .nw-nav__group { border-left: 0; margin: 10px 0 0; padding: 6px; }
  .nw-nav__menu .nw-btn--ghost { margin: 12px 0 0; }
  .nw-nav__logout { padding: 12px 6px; }
  .nw-nav__account { width: auto; height: auto; margin: 0; background: none; opacity: 1; color: rgba(255,255,255,.65); font-size: var(--fs-md); text-decoration: none; padding: 12px 6px; }
  .nw-nav__account-label { position: static; width: auto; height: auto; clip: auto; }
}

/* ---------- 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(--sky); box-shadow: 0 0 0 3px rgba(46,109,180,.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(--sky); box-shadow: 0 0 0 3px rgba(46,109,180,.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__scene { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.nw-login__scene canvas { display: block; width: 100% !important; height: 100% !important; }
.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; }
  .nw-login__scene { opacity: .45; }
}

/* ---------- Motion hooks (assets/zz-app/motion.js) ---------- */
.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-nav__link::after { transition: none !important; }
  .nw-btn:active, .nw-scope .nw-iconbtn:active { transform: none; }
}
