/* ===========================================================================
   theme-c.css — "Grouped" theme for the WRB Production Planner.

   Loaded LAST, after styles.css / wrb-design-system.css / planner-theme.css.
   It overrides those sheets rather than replacing them, so:
     - removing ONE <link> line returns the tool to exactly how it looked before
     - no existing rule is edited, so nothing can be lost in a merge
     - anything this sheet does not mention keeps its current styling

   Colour is the tool's own, unchanged in hue: the charcoal chrome, clay accent
   and ok/warn/bad/info semantics all come from wrb-design-system.css. The one
   addition is a ground tint a step darker than the card surface — that tint is
   what makes panels read as lifted, which is the whole idea of the direction.
   =========================================================================== */

:root{
  /* Structural additions. Everything else is inherited. */
  --c-ground:#EFEBE4;
  --c-group:var(--wrb-white,#FFFFFF);
  --c-sep:var(--wrb-rule,#E3DDD4);
  --c-sep-strong:var(--wrb-rule-strong,#CFC7BB);
  --c-ink:var(--wrb-ink,#2B2B2C);
  --c-ink-2:var(--wrb-ink-soft,#6A6259);
  --c-ink-3:var(--wrb-ink-faint,#8E877E);
  --c-accent:var(--wrb-clay,#9B6344);
  --c-accent-deep:var(--wrb-clay-deep,#7E4F35);
  --c-ok:var(--wrb-ok,#4F7C46);
  --c-warn:var(--wrb-warn,#B08637);
  --c-bad:var(--wrb-bad,#9B4A33);
  --c-info:var(--wrb-info,#3E6C8C);
  --c-idle:var(--wrb-idle,#8A7B6A);
  --c-r:14px;      /* groups */
  --c-r-sm:8px;    /* controls */
  --c-r-pill:999px;
  --c-lift:0 1px 2px rgba(43,43,44,.05), 0 8px 22px rgba(43,43,44,.055);
  --c-lift-2:0 1px 2px rgba(43,43,44,.06), 0 14px 34px rgba(43,43,44,.075);
}

/* ---------------------------------------------------------------- ground -- */
body{background:var(--c-ground)}

/* ---------------------------------------------------------------- header -- */
/* Dark chrome, with a LIGHT LOGO VARIANT rather than a compromise on the colour.
   The stock logo is 49% charcoal (#303030) against a #39393A header — 1.14:1, which
   is invisible. assets/wrb-logo-light.png remaps each brand colour to a lighter
   counterpart instead of flattening the mark to white, so the identity survives:
   wordmark 10.42:1, clay mark 4.40:1, sage mark 6.42:1.
   The lockup is also given room and a rule, so it reads as a masthead rather than
   a label sitting next to the counts. */
body > header{background:var(--wrb-charcoal,#39393A);color:#F6F3EE;
  padding:0 22px;position:sticky;top:0;z-index:40;box-shadow:0 1px 0 rgba(0,0,0,.28);
  display:flex;align-items:center;gap:22px;min-height:66px;border:0}
/* planner-theme.css already injects the logo with .brand::before as a background
   image, so no markup change is needed — the theme only has to point it at the light
   variant and give it a little more room. */
body > header .brand{display:flex;align-items:center;gap:14px;padding-right:22px;
  border-right:1px solid rgba(255,255,255,.14)}
body > header .brand::before{
  background-image:url('assets/wrb-logo-light.png');
  width:108px;height:42px}
/* If a logo is ever placed as a real <img> instead, it inherits the same sizing. */
body > header .brand img,.brand-logo{height:34px;width:auto;display:block;flex:none}
body > header .brand h1{font-family:Sora,var(--head,sans-serif);font-size:16px;font-weight:600;
  letter-spacing:-.012em;line-height:1.15;color:#F6F3EE;margin:0;text-transform:none;
  white-space:nowrap}
body > header .brand .sub{font-size:11.5px;color:#A9A29A;letter-spacing:.02em}
.header-stats{display:flex;gap:7px;flex-wrap:wrap}
.header-stats .hstat{display:flex;flex-direction:column;gap:1px;padding:6px 11px;
  border-radius:var(--c-r-sm);background:rgba(255,255,255,.06);min-width:64px;border:0}
.header-stats .hstat .n{font-family:var(--mono,ui-monospace);font-size:16px;font-weight:600;
  line-height:1.05;color:#F6F3EE}
.header-stats .hstat .l{font-size:10.5px;color:#A9A29A;text-transform:none;letter-spacing:0}
.header-stats .hstat.bad{background:color-mix(in srgb,var(--c-bad) 34%,transparent)}
.header-stats .hstat.bad .n{color:#F6C7BA}
.header-stats .hstat.warn{background:color-mix(in srgb,var(--c-warn) 32%,transparent)}
.header-stats .hstat.warn .n{color:#F6E0B2}
.header-actions{margin-left:auto;display:flex;align-items:center;gap:10px}

/* ------------------------------------------------------------------ tabs -- */
nav.tabbar{background:var(--wrb-charcoal-deep,#2E2E2F);padding:0 22px;position:sticky;
  top:66px;z-index:39;display:flex;align-items:stretch;gap:2px;min-height:42px;border:0}
nav.tabbar .tab{display:flex;align-items:center;font-size:13px;color:#A9A29A;padding:0 13px;
  border:0;background:none;cursor:pointer;border-radius:var(--c-r-sm) var(--c-r-sm) 0 0;
  border-bottom:2px solid transparent;font-family:inherit;letter-spacing:0;text-transform:none}
nav.tabbar .tab:hover{color:#F6F3EE;background:rgba(255,255,255,.05)}
nav.tabbar .tab.active{background:var(--c-ground);color:var(--c-ink);font-weight:500;
  border-bottom-color:var(--c-ground)}
nav.tabbar .tab[data-tab="settings"]{margin-left:auto;gap:7px}
nav.tabbar .tab[data-tab="settings"]::before{content:"";width:15px;height:15px;flex:none;
  background-color:currentColor;-webkit-mask:var(--c-gear) center/contain no-repeat;
  mask:var(--c-gear) center/contain no-repeat}
:root{--c-gear:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='3.2'/%3E%3Cpath d='M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 1 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 1 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06A1.65 1.65 0 0 0 9 4.6a1.65 1.65 0 0 0 1-1.51V3a2 2 0 1 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 1 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z'/%3E%3C/svg%3E")}

/* ------------------------------------------------- panels as lifted groups -- */
.panel,.settings-card,.rep-card{background:var(--c-group);border:0;border-radius:var(--c-r);
  box-shadow:var(--c-lift);overflow:hidden}
.panel > h2,.settings-card > h3{font-family:Sora,var(--head,sans-serif);letter-spacing:-.01em;
  text-transform:none}
.card-hint,.panel-sub{color:var(--c-ink-3)}
.count-pill{background:var(--wrb-bone-2,#F2EEE8);color:var(--c-ink-2);border-radius:var(--c-r-pill);border:0}

/* ----------------------------------------------------------------- tables -- */
.data-table{border-collapse:collapse;width:100%}
.data-table thead th{background:transparent;color:var(--c-ink-3);font-weight:500;
  text-transform:none;letter-spacing:0;font-size:12.5px;border-bottom:0}
.data-table td{border-top:1px solid var(--c-sep);border-bottom:0;vertical-align:middle}
.data-table tbody tr:hover td{background:var(--wrb-bone,#FAF8F5)}
.td-name{font-weight:500}
.td-sub{color:var(--c-ink-3)}

/* Health is rendered as <span class="badge" style="background:…"> with the colour set
   inline from riskMeta, so the theme must not touch the colour — only the shape. The
   same applies to the build-hours status pill and the board card badges. */
.badge,.bh-status-pill,.count-pill,.mt-badge,.pill{
  border-radius:var(--c-r-pill);font-weight:500;text-transform:none;letter-spacing:.005em;border:0}

/* The 4px ink bar across the top of every panel belongs to the squared-off card it
   was drawn for. A rounded group with a hard bar across its corners reads as a
   mistake, so it goes. */
.panel::before{display:none}
.panel{border:0;padding:20px 22px}
/* Section headings inside panels were uppercase display type; sentence case with
   weight carries the same hierarchy without shouting. */
.forecast-detail-head,.rep-head,.panel h2,.settings-card h3{
  text-transform:none;letter-spacing:-.008em;font-family:Sora,var(--head,sans-serif)}
.forecast-detail-head{font-size:13px;color:var(--c-ink-2);font-weight:600}

/* ---------------------------------------------------------------- buttons -- */
.btn{border-radius:var(--c-r-sm);border:1px solid var(--c-sep);background:var(--wrb-bone,#FAF8F5);
  color:var(--c-ink-2);font-family:inherit;text-transform:none;letter-spacing:0}
.btn:hover{background:var(--wrb-bone-2,#F2EEE8);color:var(--c-ink)}
.btn.primary{background:var(--c-accent);border-color:var(--c-accent);color:#fff}
.btn.primary:hover{background:var(--c-accent-deep);border-color:var(--c-accent-deep)}
.btn.danger{background:none;border-color:color-mix(in srgb,var(--c-bad) 45%,transparent);color:var(--c-bad)}
.btn.danger:hover{background:color-mix(in srgb,var(--c-bad) 10%,transparent)}

/* ------------------------------------------------------------------ board -- */
.b-col{background:var(--c-group);border:0;border-radius:var(--c-r);box-shadow:var(--c-lift)}
.b-col-head{border-bottom:1px solid var(--c-sep);background:transparent}
.b-card{background:var(--wrb-bone,#FAF8F5);border:1px solid var(--c-sep);border-radius:10px;
  box-shadow:none}
.b-card:hover{box-shadow:var(--c-lift);border-color:var(--c-sep-strong)}

/* ------------------------------------------------------------------ gantt -- */
#ganttRoot .g-wrap{background:var(--c-group);border:0;border-radius:var(--c-r);
  box-shadow:var(--c-lift);overflow:hidden}
#ganttRoot .g-head{background:var(--wrb-bone-2,#F2EEE8);border-bottom:1px solid var(--c-sep-strong)}
#ganttRoot .g-label-sp{font-weight:600;color:var(--c-ink-2);border-right:1px solid var(--c-sep-strong)}
#ganttRoot .g-row{border-top:1px solid var(--c-sep)}
#ganttRoot .g-row:hover{background:var(--wrb-bone,#FAF8F5)}
#ganttRoot .g-label{border-right:1px solid var(--c-sep)}
/* Bars become pills, matching the status pills — one radius language throughout. */
#ganttRoot .g-bar{border-radius:var(--c-r-pill);box-shadow:0 1px 2px rgba(43,43,44,.14)}
#ganttRoot .g-bar-ghost{border-radius:var(--c-r-pill)}
/* Date markers: a 2px line is near-impossible to hover. This widens the target to
   22px with a transparent hit area, and gives the flag a solid head. */
#ganttRoot .g-target{width:22px;margin-left:-11px;border-left:0;cursor:help;z-index:4}
#ganttRoot .g-target::before{content:"";position:absolute;top:6px;bottom:6px;left:10px;width:2px;
  border-radius:1px;background:var(--c-ink)}
#ganttRoot .g-target-complete::before{background:var(--c-ok)}
#ganttRoot .g-target-flag{left:7px;border-top-width:7px;border-right-width:9px}
/* Keep the chart's lines behind the frozen build names when scrolling sideways.
   The widened target line above sits at z-index 4, the same as the names
   (styles.css), and comes later in the page, so it was drawn over them. Names go
   to 5: above target lines (4) and Today (3), below the "Build" header cell (6)
   and the date header (7). */
#ganttRoot .g-label{z-index:5}
/* The row separators belong to the row, not the name cell, so the Today line
   still showed through the 1px gaps in the name column. Each name cell paints a
   separator-coloured strip over the 2px gap above it (the previous row's bottom
   border plus this row's top border). Screen only: print draws its own
   row lines (styles.css), and this would cover them. */
@media screen{
  #ganttRoot .g-label::before{content:"";position:absolute;left:0;right:0;top:-2px;height:2px;
    background:var(--c-sep);pointer-events:none}
}

/* ------------------------------------------------------------ build hours -- */
#hoursRoot .hours-grid-wrap{background:var(--c-group);border:0;border-radius:var(--c-r);
  box-shadow:var(--c-lift);overflow:auto}
/* A true grid: ruled both ways. On a thirteen-column numeric table the vertical
   rules matter as much as the horizontal ones — without them the eye loses which
   stage column a figure belongs to halfway across. */
#hoursRoot .hours-grid th,#hoursRoot .hours-grid td{
  border-right:1px solid var(--c-sep);border-bottom:1px solid var(--c-sep)}
#hoursRoot .hours-grid th:last-child,#hoursRoot .hours-grid td:last-child{border-right:0}
#hoursRoot .hours-grid thead th{background:var(--wrb-bone-2,#F2EEE8);color:var(--c-ink-2);
  font-weight:600;text-transform:none;letter-spacing:0;border-bottom:1px solid var(--c-sep-strong)}
#hoursRoot .hours-grid .bh-name{background:var(--c-group);border-right:1px solid var(--c-sep-strong)}
#hoursRoot .hours-grid tbody tr:hover td{background:var(--wrb-bone,#FAF8F5)}
#hoursRoot .hours-grid tbody tr:hover .bh-name{background:var(--wrb-bone,#FAF8F5)}
#hoursRoot .bh-totals-row > td,#hoursRoot .bh-avg-row > td{background:var(--wrb-bone-2,#F2EEE8)}

/* ------------------------------------------------------------------- shop -- */
#shopRoot .shop-map-wrap{background:var(--c-group);border:0;border-radius:var(--c-r);
  box-shadow:var(--c-lift);overflow:hidden}

/* ------------------------------------------------- build panel as a sheet -- */
/* A build carries five tabs of content. A centred box either scrolls badly or fills
   the screen anyway; a sheet keeps the list you came from visible at the left edge. */
#buildOverlay{background:rgba(30,30,31,.34);backdrop-filter:blur(3px)}
#buildModal{position:fixed;top:0;right:0;bottom:0;left:auto;width:min(760px,94vw);
  max-width:none;max-height:none;height:100vh;margin:0;transform:none;border-radius:0;
  background:var(--c-ground);display:flex;flex-direction:column;
  box-shadow:-18px 0 50px rgba(43,43,44,.20);border:0}
#buildModal .modal-head{background:var(--c-group);border-bottom:1px solid var(--c-sep);
  padding:20px 24px 15px;flex:none}
#buildModal .modal-head h2{font-family:Sora,var(--head,sans-serif);font-size:19px;
  letter-spacing:-.016em;line-height:1.25}
#buildModal .mono-sub{color:var(--c-ink-3)}
#buildModal .modal-tabs{background:var(--c-group);border-bottom:1px solid var(--c-sep);
  padding:0 24px;flex:none;gap:2px}
#buildModal .modal-tab{border:0;background:none;color:var(--c-ink-2);font-family:inherit;
  font-size:13px;padding:11px 13px;border-bottom:2px solid transparent;margin-bottom:-1px;
  text-transform:none;letter-spacing:0;border-radius:0}
#buildModal .modal-tab:hover{color:var(--c-ink);background:none}
#buildModal .modal-tab.active{color:var(--c-accent);border-bottom-color:var(--c-accent);
  font-weight:500;background:none}
.mt-badge{border-radius:var(--c-r-pill);background:var(--wrb-bone-2,#F2EEE8);color:var(--c-ink-2);border:0}
.mt-badge.ok{background:color-mix(in srgb,var(--c-ok) 16%,transparent);color:var(--c-ok)}
.mt-badge.fail{background:color-mix(in srgb,var(--c-bad) 16%,transparent);color:var(--c-bad)}
#buildModal .modal-body{flex:1;overflow-y:auto;padding:18px 24px 28px;background:var(--c-ground)}
#buildModal .modal-foot{background:var(--c-group);border-top:1px solid var(--c-sep);
  padding:13px 24px;flex:none}
/* Field groups become lifted cards inside the sheet, so the body reads as grouped
   decisions rather than one long form. */
#buildModal .field-grid{background:var(--c-group);border-radius:var(--c-r);
  box-shadow:var(--c-lift);padding:16px 18px;margin-bottom:16px}
/* Field labels everywhere, not only in the build panel: uppercase mono labels were a
   default rather than a decision, and weight plus colour carry the same hierarchy. */
.field > span{color:var(--c-ink-2);font-weight:500;text-transform:none;letter-spacing:0;
  font-family:inherit;font-size:12.5px}
#buildModal .field input,#buildModal .field select,#buildModal .field textarea{
  background:var(--wrb-bone,#FAF8F5);border:1px solid var(--c-sep-strong);border-radius:var(--c-r-sm)}
#buildModal .field input:focus,#buildModal .field select:focus,#buildModal .field textarea:focus{
  background:var(--c-group);border-color:var(--c-accent);outline:none;
  box-shadow:0 0 0 3px color-mix(in srgb,var(--c-accent) 20%,transparent)}
#buildModal .stage-row{border-bottom:1px solid var(--c-sep)}

/* ------------------------------------------------------- column filters --- */
.gf-menu{border-radius:var(--c-r-sm);box-shadow:var(--c-lift-2)}
.gf-th-btn{border-radius:4px}

/* ------------------------------------------- pinned header and tab bar -- */
/* styles.css sets html,body{overflow-x:hidden}. That turns the page into its own
   scrolling box, so the header and tab bar had nothing to pin to and scrolled away.
   `clip` still stops sideways scrolling but doesn't create the box. Browsers
   without `clip` (Safari before 16) ignore this line and behave as before. */
html,body{overflow-x:clip}
/* The header fits on one line from about 1000px up. Below 1100px it wraps to two or
   three lines, so it scrolls away normally (a 170px pinned block would take a third
   of a tablet screen), gets breathing room top and bottom, and the tab bar alone
   stays pinned at the very top. */
@media (max-width:1099px){
  body > header{position:static;padding-top:10px;padding-bottom:10px}
  nav.tabbar{top:0}
}
/* The tabs need about 910px. Narrower than that, the tab bar scrolls sideways so
   every tab stays reachable. A scrolling bar would clip the roofline decoration
   that hangs below it (planner-theme.css), so the roofline is hidden only here. */
@media (max-width:939px){
  nav.tabbar{overflow-x:auto;scrollbar-width:thin}
  nav.tabbar .tab{flex:none;white-space:nowrap}
  nav.tabbar::after{display:none}
}

/* ------------------------------------------------------------------ print -- */
/* Depth costs ink and can render as grey boxes. The 11x17 Gantt work assumes a
   plain surface, so the theme steps out of the way entirely. */
@media print{
  body{background:#fff}
  body > header,nav.tabbar{position:static;background:#fff;color:#000;box-shadow:none}
  .panel,.settings-card,.rep-card,.b-col,#ganttRoot .g-wrap,#hoursRoot .hours-grid-wrap,
  #shopRoot .shop-map-wrap{box-shadow:none;border-radius:0}
  #buildModal{position:static;width:auto;height:auto;box-shadow:none}
}
