/* ============================================================================
   PDR-Team shared stylesheet — deploy.pdr-team.com
   Source of truth for the WEB palette. Change colors here, once, never per page.

   HARD RULE: this file contains NO element selectors.
   Only :root{}, .pdr-* classes, and print rules. No *{} reset, no body{}, no h1{}.
   That is deliberate: adding the <link> to any page is a guaranteed visual no-op
   until that page opts in by trimming its own :root or using a .pdr-* class.
   Adding an element selector here would silently restyle all 37 pages at once.

   Bump the ?v= query in every page whenever this file changes.
   ==========================================================================*/

@import url('https://fonts.googleapis.com/css2?family=Figtree:wght@300;400;500&family=Inter:wght@400;500;600;700;800&display=swap');

:root{
  /* ── brand ramp — 500 is the primary ─────────────────────────────────── */
  --pdr-50:  rgb(229,238,246);
  --pdr-100: rgb(202,221,237);
  --pdr-200: rgb(155,192,224);
  --pdr-300: rgb(103,160,209);
  --pdr-400: rgb(61,133,195);
  --pdr-500: rgb(0,87,164);      /* #0057A4 — PRIMARY */
  --pdr-600: rgb(0,75,143);
  --pdr-700: rgb(0,62,120);
  --pdr-800: rgb(0,45,89);
  --pdr-900: rgb(0,29,61);

  /* ── neutrals ────────────────────────────────────────────────────────── */
  --n-50:  rgb(253,252,252);   /* eggshell — page canvas */
  --n-100: rgb(245,243,241);   /* warm taupe — section fill */
  --n-200: rgb(230,225,219);   /* hairline */
  --n-300: rgb(213,207,199);
  --n-400: rgb(155,148,139);
  --n-500: rgb(112,106,99);    /* body muted - 4.83:1 on the --n-100 fill */
  --n-600: rgb(95,89,82);
  --n-700: rgb(68,63,57);
  --n-900: rgb(18,16,14);      /* ink */
  --white: rgb(255,255,255);   /* stays true white — text on navy relies on it */

  /* ── paper — the warm ground surfaces sit on ─────────────────────────── */
  --paper:   rgb(253,252,252);
  --paper-2: rgb(245,243,241);

  /* ── status ──────────────────────────────────────────────────────────── */
  --green-bg:   rgb(236,251,243);
  --green-text: rgb(10,105,60);
  --green-dot:  rgb(18,157,89);
  --amber-bg:   rgb(255,248,235);
  --amber-text: rgb(146,75,0);
  --amber-dot:  rgb(214,128,0);
  --danger:     rgb(185,28,28);
  --danger-bg:  rgb(254,226,226);

  /* ── radii — collapses 4/5/6/7/8/10/12/14/20 to five rungs ───────────── */
  --r-sm: 6px; --r-md: 9px; --r-lg: 12px; --r-xl: 16px; --r-2xl: 20px;
  --r-pill: 9999px;

  /* ── layout — collapses 560/600/640/768/860/900/960/1100 to four ─────── */
  --header-h: 64px;
  --sidenav-w: 68px;
  --w-sm: 640px; --w-md: 900px; --w-lg: 1100px; --w-xl: 1280px;

  /* ── type ────────────────────────────────────────────────────────────── */
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
  --font-display: 'Figtree', 'Inter', system-ui, -apple-system, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, monospace;

  /* ── elevation ───────────────────────────────────────────────────────── */
  --shadow-sm: none;
  --shadow-md: none;
  --shadow-lg: 0 24px 60px rgba(18,16,14,.20);   /* modals only */
}

/* ── LEGACY ALIASES ────────────────────────────────────────────────────────
   These let the ~1300 existing var(--primary) / var(--navy) / … references keep
   resolving after a page's own :root is trimmed, retargeting them to the
   canonical ramp. Only names with ONE unambiguous role site-wide belong here.

   Deliberately ABSENT: --surface, --bg, --page. Those are semantically inverted
   between pages (page background on 15 pages, card fill on 5). Aliasing them
   globally would swap figure and ground. They stay page-local.
   ────────────────────────────────────────────────────────────────────────── */
:root{
  --primary: var(--pdr-500);
  --brand:   var(--pdr-500);
  --blue:    var(--pdr-500);
  /* --accent is read as TEXT on nine pages - section eyebrows, slide titles,
     step numbers. At --pdr-400 that measured 3.84:1 on the eggshell canvas,
     under the 4.5:1 line. --pdr-600 is the same hue two steps down at ~8:1,
     and it also fixes white-on-accent buttons (3.93 -> 8.5). */
  --accent:  var(--pdr-600);
  --navy:    var(--pdr-800);
  --dark:    var(--pdr-800);
  --ink:     var(--n-900);
  --text:    var(--n-900);
  --muted:   var(--n-500);
  --gray:    var(--n-500);
  --border:  var(--n-200);
  --line:    var(--n-200);
  --panel:   var(--pdr-50);
  --ice:     var(--pdr-100);
  --green:   var(--green-text);
  --red:     var(--danger);
  --r:       var(--r-lg);
  --shadow:  var(--shadow-md);
  --font-sans: var(--font);
}

/* ── APP SHELL ────────────────────────────────────────────────────────────
   Replaces the ~1.5KB inline-styled header duplicated across 14 pages.
   Markup:
     <div class="pdr-shell">
       <a class="pdr-shell__logo" href="/index.html"><img src="/PDR_Logo_Color_Trans.png" alt="PDR Team"></a>
       <div class="pdr-shell__sep"></div>
       <nav class="pdr-shell__crumbs">
         <a href="/index.html">Deploy</a><span class="pdr-shell__chev"></span>
         <span class="is-current">Page name</span>
       </nav>
       <div class="pdr-shell__spacer"></div>
       <div class="pdr-shell__host">deploy.pdr-team.com</div>
     </div>
   ────────────────────────────────────────────────────────────────────────── */
.pdr-shell{
  min-height:var(--header-h); background:var(--white);
  border-bottom:1px solid var(--n-200);
  display:flex; align-items:center; padding:0 24px; gap:16px;
  position:sticky; top:0; z-index:200; font-family:var(--font);
}
.pdr-shell--static{position:static}
.pdr-shell__logo{display:flex;align-items:center;gap:10px;text-decoration:none;flex-shrink:0}
.pdr-shell__logo img{height:28px;display:block}
.pdr-shell__sep{width:1px;height:28px;background:var(--n-200);flex-shrink:0}
.pdr-shell__crumbs{display:flex;align-items:center;gap:6px;font-size:12px;font-weight:600;flex-wrap:wrap}
.pdr-shell__crumbs a{color:var(--n-500);text-decoration:none}
.pdr-shell__crumbs a:hover{color:var(--pdr-500)}
.pdr-shell__crumbs .is-current{color:var(--n-900)}
.pdr-shell__chev{
  width:12px;height:12px;flex-shrink:0;
  background:var(--n-300);
  -webkit-mask:no-repeat center/12px url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='9 18 15 12 9 6'/%3E%3C/svg%3E");
          mask:no-repeat center/12px url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='9 18 15 12 9 6'/%3E%3C/svg%3E");
}
.pdr-shell__spacer{flex:1}
.pdr-shell__host{font-size:11px;font-weight:600;color:var(--n-500)}

@media (max-width:640px){
  .pdr-shell{padding:0 14px;gap:10px}
  .pdr-shell__host{display:none}
}

/* Never print the shell — otherwise every PDF gets a 64px white bar on page 1. */
@media print{ .pdr-shell{display:none !important} }


/* ── APP BAR ──────────────────────────────────────────────────────────────
   THE standard header. Josh, 2026-09-04, shown both side by side: "I actually
   like the before more. If you could do everything like that." — the single
   navy bar wins over the white breadcrumb shell.

   One row: white logo, page title, then the page's own actions on the right.
   Wayfinding lives in the logo (always links home) and an optional parent
   link, kept small so it never competes with the title.

   Markup:
     <div class="pdr-bar">
       <a class="pdr-bar__logo" href="/index.html"><img src="/PDR_Logo_White_Trans.png" alt="PDR Team"></a>
       <a class="pdr-bar__up" href="/index.html">HR</a>
       <span class="pdr-bar__title">Subcontractor Roster</span>
       <span class="pdr-bar__spacer"></span>
       ... page actions: .pdr-bar__pill, .pdr-bar__btn ...
     </div>

   .pdr-shell above is the previous standard, kept so the pages still on it
   keep rendering while they are migrated. Do not put it on anything new.
   ────────────────────────────────────────────────────────────────────────── */
.pdr-bar{
  position:sticky; top:0; z-index:200;
  background:var(--navy); color:var(--white);
  padding:12px 20px;
  display:flex; align-items:center; gap:12px; flex-wrap:wrap;
  box-shadow:0 2px 8px rgba(0,0,0,.25);
  font-family:var(--font);
}
.pdr-bar--static{position:static}
.pdr-bar__logo{display:flex;align-items:center;text-decoration:none;flex-shrink:0}
.pdr-bar__logo img{height:26px;display:block}
.pdr-bar__up{
  font-size:12px;font-weight:600;color:rgba(255,255,255,.62);text-decoration:none;
  flex-shrink:0;padding-left:12px;margin-left:2px;border-left:1px solid rgba(255,255,255,.22);
}
.pdr-bar__up:hover{color:var(--white)}
.pdr-bar__title{font-size:15px;font-weight:700;letter-spacing:.01em}
.pdr-bar__spacer{flex:1}
.pdr-bar__pill{
  font-size:12px;font-weight:600;padding:5px 12px;border-radius:99px;
  background:rgba(255,255,255,.14);color:var(--white);white-space:nowrap;
}
.pdr-bar__pill.is-done{background:rgba(27,115,64,.4);color:rgb(141,255,176)}
.pdr-bar__btn{
  font:600 12.5px var(--font);padding:7px 14px;border-radius:var(--r-md);cursor:pointer;
  border:1px solid rgba(255,255,255,.28);background:rgba(255,255,255,.10);color:var(--white);
  display:inline-flex;align-items:center;gap:6px;
}
.pdr-bar__btn:hover{background:rgba(255,255,255,.18)}
.pdr-bar__btn[disabled]{opacity:.45;cursor:not-allowed}

@media (max-width:640px){
  .pdr-bar{padding:10px 14px;gap:8px}
  .pdr-bar__title{font-size:13px}
}

@media print{ .pdr-bar{display:none !important} }

/* ==========================================================================
   PHONE BASELINE — Josh, 2026-09-05: "I tried it on my phone it looks not
   good - go through all the pages for the phone".

   Measured cause across ten pages that scrolled sideways at 375px: grid and
   flex items default to min-width:auto, so ONE child wider than its share
   drags the whole page out. calculator's .two-col resolved to a single 544px
   column that way; insurance-savings pushed its export button past the edge
   because the top bar could not wrap.

   These rules are the shared floor. Pages still needing a real breakpoint
   get one of their own.
   ==========================================================================*/
@media (max-width: 640px) {
  html { -webkit-text-size-adjust: 100%; }

  /* clip, not hidden: overflow:hidden on body creates a scroll container and
     breaks position:sticky headers. clip does not. This is the backstop for
     off-canvas drawers and carousels that live to the right of the viewport. */
  /* both, because the slide decks position their next-slide peek absolutely
     and body is not a containing block for it - clipping body alone leaves
     <html> scrolling sideways. */
  html, body { overflow-x: clip; }

  /* the min-width:auto fix - the single most common cause of sideways scroll */
  body * { min-width: 0; }

  img, svg, video, canvas, iframe { max-width: 100%; }
  pre { overflow-x: auto; }

  /* a wide table scrolls inside its own box instead of moving the page */
  table { display: block; width: 100%; overflow-x: auto; }

  /* header bars wrap instead of pushing their last button off the edge */
  header, nav, .topbar, .topbar-in, .toolbar, .hdr-top { flex-wrap: wrap; }

  /* thumbs are ~44px; anything a finger presses should be reachable */
  button, .btn, [role="button"] { min-height: 36px; }

  /* iOS Safari zooms the whole page in when you tap a field whose text is
     under 16px, and then leaves it zoomed. That alone makes a form feel
     broken on a phone. 16px is the threshold, not a style choice. */
  input, select, textarea { font-size: 16px; }
}


/* --------------------------------------------------------------------------
   Measured: a disabled button keeps its white label but swaps to a light
   grey fill, which lands at 1.3:1 - the word vanishes. setup.html's "Next"
   was the clearest case. Give every disabled control a readable label.
   -------------------------------------------------------------------------- */
button:disabled, .btn:disabled, input:disabled, select:disabled,
button[disabled], .btn[disabled] {
  color: var(--n-600) !important;
  border-color: var(--n-300);
}
/* 2026-09-05: the label alone was not enough. A disabled button that keeps a
   coloured fill (the checklists' green "Save & Export PDF") put grey on green
   at 1.18:1 - the button read as an empty slab. Neutralise the fill too, so a
   disabled control looks disabled in one consistent way across every page.
   Measured after: 6.25:1 light, 8.36:1 dark. The dark app bar keeps its own
   translucent treatment - a pale grey slab there would look like a bug. */
button:disabled, .btn:disabled, button[disabled], .btn[disabled] {
  background: var(--n-100) !important;
  background-image: none !important;
  opacity: 1;
  box-shadow: none;
}
.pdr-bar__btn[disabled] {
  background: rgba(255,255,255,.10) !important;
  color: rgba(255,255,255,.62) !important;
  opacity: 1;
}


/* ==========================================================================
   DARK THEME  (experiment, 2026-09-05)
   Every page now draws its greys and blues from the ramps above, so redefining
   the ramps under [data-theme="dark"] flips a page without touching it. Pages
   that still hardcode a hex stay light in those spots - that is the measure of
   how far this gets us.

   Warm dark, not blue-black: it is the eggshell palette inverted, so the
   system still feels like one thing.
   ==========================================================================*/
:root[data-theme="dark"]{
  --n-50:  rgb(23,21,20);      /* page canvas */
  --n-100: rgb(32,30,28);      /* section fill */
  --n-200: rgb(52,48,45);      /* hairline */
  --n-300: rgb(74,69,64);
  --n-400: rgb(120,113,105);
  --n-500: rgb(158,150,140);
  --n-600: rgb(190,183,173);   /* muted text */
  --n-700: rgb(216,210,202);
  --n-900: rgb(245,243,240);   /* ink */
  --white: rgb(31,29,27);      /* "card" surface - no longer literal white */

  --paper:   rgb(23,21,20);
  --paper-2: rgb(32,30,28);

  /* the brand ramp lifts so it still reads on a dark ground */
  --pdr-50:  rgb(18,30,44);
  --pdr-100: rgb(24,44,66);
  --pdr-200: rgb(32,62,94);
  --pdr-300: rgb(58,110,164);
  --pdr-400: rgb(90,150,208);
  --pdr-500: rgb(120,175,228);
  --pdr-600: rgb(150,196,240);
  --pdr-700: rgb(180,214,246);
  --pdr-800: rgb(16,26,38);
  --pdr-900: rgb(12,20,30);

  --green-bg:   rgb(16,40,29);
  --green-text: rgb(122,222,166);
  --amber-bg:   rgb(46,35,14);
  --amber-text: rgb(240,190,110);
  --danger:     rgb(248,150,150);
  --danger-bg:  rgb(56,22,22);
}
:root[data-theme="dark"] body { background: var(--n-50); color: var(--n-900); }

/* --------------------------------------------------------------------------
   Inside the app shell, a page must not draw its own branding: the shell
   already shows the logo, the page name and the breadcrumb. .pdr-shell is the
   breadcrumb bar shared by the internal pages, so hiding it here is what makes
   "one header, one logo" true everywhere instead of page by page.
   -------------------------------------------------------------------------- */
html[data-pdr-embedded] .pdr-shell { display: none !important; }

/* --------------------------------------------------------------------------
   A page that is not finished says so, in one consistent shape. Drawn by
   /assets/pdr-frame.js from <meta name="pdr-status" content="draft|beta">.
   -------------------------------------------------------------------------- */
.pdr-status-flag{
  display:flex; align-items:baseline; gap:10px; flex-wrap:wrap;
  padding:9px 20px; font-size:13px; line-height:1.45;
  border-bottom:1px solid var(--n-200); background:var(--n-100); color:var(--n-700);
}
.pdr-status-flag b{
  font-size:10.5px; font-weight:700; letter-spacing:.09em; text-transform:uppercase;
  padding:2px 8px; border-radius:20px; color:var(--white);
}
.pdr-status-flag--draft b{ background:#B4500E; }
.pdr-status-flag--beta  b{ background:var(--pdr-600, rgb(0,75,143)); }
@media print{ .pdr-status-flag{display:none !important} }

/* --------------------------------------------------------------------------
   Josh: "this pages all have this free area". Inside the shell a page's own
   bar has lost its logo and title, so it kept a full header's height around
   two small controls. It is an action strip now, not a second header.
   -------------------------------------------------------------------------- */
html[data-pdr-embedded] .topbar,
html[data-pdr-embedded] .toolbar,
html[data-pdr-embedded] .hdr{
  min-height:0 !important;
  padding-top:7px !important; padding-bottom:7px !important;
}

/* Leaflet paints its attribution link at its own blue over a grey strip. */
.leaflet-control-attribution a { color: rgb(0,75,143) !important; }
.leaflet-control-attribution { color: var(--n-700) !important; }
