/* =========================
   main.css — merged & de-conflicted
   ========================= */

/* ---------- Base tokens ---------- */
:root{
  --font: "Poppins", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;

  /* colors come from your theme variables */
  --bg: var(--darkblue);
  --panel: var(--blue);
  --cell: var(--SteelBlue);
  --cell-hover: var(--Iris);
  --header: var(--DeepTeal);
  --ink: #fff;
  --ink-dim: #cfd8e3;
  --grid: rgba(0,0,0,.25);

  /* table sizing tokens (shared across PC/WIP/BL) */
  --pp-col: clamp(240px, 22vw, 320px);   /* Workflow width */
  --num-col: 52px;     /* numeric col width */
  --pad-y: 3px;        /* compact cells */
  --pad-x: 7px;
  --radius: 4px;       /* small rounding */
  --gap: 4px;          /* inter-cell spacing */
  --border-w: 1.25px;
  --font-size: 0.82rem;
  --font-size-sm: 0.78rem;
  --text-weight: 400;
  --text-scale: 1.00;

  --pp-bg: var(--cell);         /* tooltip bubble bg */
  --pp-text: var(--ink);
  --pp-border: rgba(0,0,0,.25);

  --num-hover-bg: var(--cell-hover);
  --num-weight: 700;            /* default boldness for numeric cells */
  --num-scale: 1.00;  
  --edited-cell-background: rgba(255,255,255,0.14);
  --edited-cell-border: rgba(148,163,184,0.55);
  --edited-cell-text: var(--ink);
}

/* ---------- Page shell & typography ---------- */
*{ box-sizing: border-box; }
html, body{
  margin:0; padding:0; height:100%; width:100%;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  overflow-x: hidden;
}
.main{ width:100%; }
.main_content{ padding:12px; }

/* ---------- Top nav (kept) ---------- */
.nav{
  position: sticky; top:0; left:0; z-index:100;
  height: 5vh; min-height: 40px; max-height: 60px; width: 100vw;
  background: var(--nav-bg, var(--bg));
  display:flex; align-items:center;
  box-shadow: 0 10px 18px rgba(0,0,0,.75);
  border-bottom: 5px solid var(--nav-border, var(--grid)); 
}
.nav_part{ flex:1; height:100%; display:flex; justify-content:center; align-items:center; }
.nav_right{ justify-content:flex-end; }
.nav_items_right{
  font-weight: 700;
  font-size: 1rem;
  display:flex;
  height:100%;
  min-width: 140px;
  justify-content:center;
  align-items:center;
  transition: .2s;
  cursor:pointer;
  padding: 0 16px;
  gap: 8px;
}
.nav_items_right:hover{ text-decoration: underline; color:#181b1f; }
.nav_left{
  height:50%; justify-content:space-around;
  outline:2px solid var(--white);
  border-top-right-radius:10px; border-bottom-right-radius:10px;
  box-shadow:0 0 5px .5px rgba(0,0,0,.75);
  color:var(--white); background:var(--Storm);
}
.nav_items{
  font-weight:500; font-size: small; text-decoration: underline;
  display:flex; height:100%; width:100%;
  justify-content:center; align-items:center; transition:.2s; cursor:pointer;
}
.nav_items:nth-child(1){ background:#7a8a9c; color:#181b1f; }
.nav_items:hover{ background:#7a8a9c; color:#181b1f; }

/* ---------- Misc shell bits you use ---------- */
.site_time{
  border:2px solid black;
  padding:5px 12px;
  border-radius:10px;
  background:var(--DeepTeal);
  display:flex;
  align-items:center;
  gap:16px;
  justify-content:space-between;
  min-width:220px;
}
.site_time #realTime{
  margin-left:auto;
}
.sections{ display:flex; flex-wrap:wrap; gap:10px; align-items:flex-start; width:100%; margin:10px; }
/*.tracker-card-title{ font-size:1.02rem; font-weight:650; letter-spacing:.28px; }*/
.tracker-card-title{
  font-size: calc(var(--font-size) * var(--text-scale, 1) * 1.1);
  font-weight: 700;
  letter-spacing: .24px;
}

.lock{ position:absolute; }
.editable{ user-select:text; cursor:text; }
.refreshing{ animation:spin 1s linear infinite; }
@keyframes spin{ 100%{ transform:rotate(360deg); } }

.wip-cols-pop,
.bl-cols-pop{
  position:absolute;
  z-index:2147483642;
  display:none;
  min-width:160px;
  max-width:220px;
  padding:10px 12px;
  border-radius:12px;
  background-color: rgba(15,23,42,0.92);
  color:var(--ink);
  border:1px solid rgba(148,163,184,.35);
  box-shadow:0 18px 36px rgba(15,23,42,.35);
}
.wip-cols-pop label,
.bl-cols-pop label{
  display:flex;
  align-items:center;
  gap:8px;
  font-size:12px;
  padding:6px 8px;
  color:inherit;
  background:rgba(15,23,42,.6);
  border-radius:8px;
  border:1px solid transparent;
  transition:background .12s ease, border-color .12s ease, transform .12s ease;
}
.wip-cols-pop label:hover,
.wip-cols-pop label:focus-within,
.bl-cols-pop label:hover,
.bl-cols-pop label:focus-within{
  background:rgba(148,197,255,.22);
  border-color:rgba(148,197,255,.35);
  transform:translateX(1px);
}
.wip-cols-pop input[type="checkbox"],
.bl-cols-pop input[type="checkbox"]{
  cursor:pointer;
}

/* ---------- Module cards (PickCalc / WIP / BL) ---------- */
.pickCalc, .WIPTracker, .BL{
  position:relative;
  background: var(--panel);
  color: var(--ink);
  flex: 1 1 520px; min-width:520px; max-width:100%;
  padding: 12px 16px 18px;
  border: 2px solid var(--grid);
  border-radius: 12px;
  overflow: visible; /* contain table overflow */
}

.pickCalc.loading{ opacity:.6; pointer-events:none; }

/* panel titles (first span inside each card header area) */
.pickCalc > div > span:first-of-type,
.WIPTracker > div > span:first-of-type,
.BL > div > span:first-of-type{
  text-align:center; font-weight:700; letter-spacing:.2px;
}

/* ---------- Unified table system (PC/WIP/BL) ---------- */
.pickCalc table, .WIPTracker table, .BL table{
  width:100%;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: var(--gap);
}

/* cells (shared) */
.pickCalc th, .pickCalc td,
.WIPTracker th, .WIPTracker td,
.BL th, .BL td{
  font-size: calc(var(--font-size) * var(--text-scale, 1));
  line-height: 1.25;
  padding: var(--pad-y) var(--pad-x);
  border: var(--border-w) solid rgba(0,0,0,.18);
  border-radius: var(--radius);
  background: var(--cell);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
  -webkit-font-feature-settings: "tnum";
  font-feature-settings: "tnum";
  font-weight: var(--text-weight, 400);
}

/* first column = Workflow — exclude section/column headers */
.pickCalc tr:not(.pc-section-header):not(.pc-columns-header) > :is(th,td):first-child,
.WIPTracker tr:not(.wip-section-header):not(.wip-columns-header)
           :not(.wip-pp-section-header):not(.wip-pp-columns)
           :not(.buffer-section-header):not(.buffer-columns-header)
           > :is(th,td):first-child {
  width: var(--pp-col) !important;
  min-width: var(--pp-col);
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
  position: relative;
  white-space: nowrap;
}

/* Section headers: PC, WIP main, Picking-Picked, Buffer, BL */
.pc-section-header > th,
.wip-section-header > th,
.wip-pp-section-header > th,
.buffer-section-header > th,
.bl-section-header > th{
  text-align: center !important;
  width: auto !important;
  min-width: 0 !important;
  position: relative;                 /* for +/- icons */
  font-family: var(--font);
  padding: calc(var(--pad-y) * 1.5) var(--pad-x);
  background: var(--header);
  color: var(--ink);
  font-weight: 700;
  letter-spacing: .3px;
  border: 1px solid var(--grid) !important;
  border-left-width: 2px;             /* keep your left edge weight */
  cursor: pointer;
}

.pickCalc .capacity-summary th,
.pickCalc .capacity-summary td{
  width: auto !important;
  min-width: 0 !important;
}

.pick-calc-table td:not(:first-child),
.wip-table td:not(:first-child),
.bl-table  td:not(:first-child),
.WIPTracker td:not(:first-child),
.BL td:not(:first-child){
  font-weight: var(--num-weight);
  font-size: calc(var(--font-size) * var(--text-scale, 1) * var(--num-scale));
}

/* Hover for numeric cells from custom var */
.pickCalc td:not(:first-child):hover,
.WIPTracker td:not(:first-child):hover,
.BL td:not(:first-child):hover{
  background: var(--num-hover-bg);
}

/* other columns = compact + centered (ONLY real data tables) */
.pick-calc-table th:not(:first-child), .pick-calc-table td:not(:first-child),
.BL        th:not(:first-child), .BL        td:not(:first-child) {
  width: var(--num-col) !important;
  min-width: var(--num-col);
  text-align: center;
}

.WIPTracker th[data-col]:not(:first-child),
.WIPTracker td[data-col]:not(:first-child) {
  width: var(--wip-metric-width, var(--num-col));
  min-width: var(--wip-metric-width, var(--num-col));
  text-align: center;
}

#WIP_PickingPicked_Cont th:not(:first-child),
#WIP_PickingPicked_Cont td:not(:first-child),
#Buffer_Cont th:not(:first-child),
#Buffer_Cont td:not(:first-child) {
  text-align: center;
}

/* headers */
.pickCalc th, .WIPTracker th, .BL th{ background: var(--header); font-weight:600; }

/* per-section column headers */
.pc-columns-header th, .wip-columns-header th, .wip-pp-columns th, .bl-columns-header th, .buffer-columns-header th{
  background: var(--header);
  font-weight: 600;
  letter-spacing: .2px;
}

#Backlog_Cont .bl-columns-header[data-bl-of="scanned"] th.bl-col-name{
  width: calc(var(--pp-col) + var(--num-col)); /* PP wider than a single metric slot */
}

/* remove classic thead in PickCalc (we use per-section headers) */
.pick-calc-table > thead{ display:none; }

/* thin line at end of sections (optional) */
.section-end td{ border-bottom: 2px solid var(--grid) !important; }

.pp-ellipsis{
  white-space: nowrap;
  overflow: hidden !important;
  text-overflow: ellipsis;
}

/* ---------- Flow Summary ---------- */
.capacity-summary{
  width:100%;
  margin-top:10px;
  border-collapse: separate;
  border-spacing: var(--gap);
}
.capacity-summary th, .capacity-summary td{
  background: var(--num-bg);
  color: var(--num-text);
  border: var(--border-w) solid var(--num-border);
  border-radius: var(--radius);
  padding: var(--pad-y) var(--pad-x);
  white-space: nowrap; overflow:hidden; text-overflow:ellipsis;
  text-align: center;
  font-size: calc(var(--font-size) * var(--text-scale, 1));
  font-weight: var(--text-weight, 400);
}
.capacity-summary .cs-title th{
  background: var(--header);
  font-weight: var(--text-weight, 700);
  letter-spacing:.3px;
}
.capacity-summary .cs-sub th{ font-weight: var(--text-weight, 700); }
.capacity-summary .cs-values td{
  font-weight: var(--num-weight, 700);
  font-size: calc(var(--font-size) * var(--text-scale, 1) * var(--num-scale, 1));
  text-align: center;
}
.capacity-summary .muted{ color: var(--cell-hover); }

.capacity-summary .cs-trans th { 
    text-align: center;
    font-weight: var(--num-weight, 700);
    letter-spacing: .2px;
}

.capacity-summary .cs-values #PickCapacityHC,
.capacity-summary .cs-values #PickCapacityRate { text-align: center; }

/* Keep Pack Throughput and Δ numbers right-aligned */
.capacity-summary .cs-values #throughputCapacity,
.capacity-summary .cs-values #throughputDelta { text-align: center; }

#throughputDelta.clamped { font-weight: var(--num-weight, 700); }
#throughputDelta .delta-hint { margin-left: 4px; opacity: .7; font-size: 12px; }


.capacity-summary .cs-title th,
.capacity-summary .cs-sub th,
.capacity-summary .cs-values td {
  text-align: center !important;
}

/* Keep numeric text light during edit everywhere in PickCalc/Flow Summary */
.pickCalc [contenteditable],
.capacity-summary [contenteditable]{
  color: var(--num-text) !important;
  caret-color: var(--num-text) !important;
  -webkit-text-fill-color: var(--num-text) !important; /* Chrome/Safari */
}

/* On focus some UAs override text fill; pin it to the numeric color */
.pickCalc [contenteditable]:focus,
.capacity-summary [contenteditable]:focus{
  color: var(--num-text) !important;
  caret-color: var(--num-text) !important;
  -webkit-text-fill-color: var(--num-text) !important;
  background: transparent; /* avoid UA light bg that flips contrast */
}

/* If any legacy text inputs are used in numeric cells, keep them consistent too */
.capacity-summary td input[type="text"],
.capacity-summary td input[type="text"]:focus,
.pickCalc td input[type="text"],
.pickCalc td input[type="text"]:focus{
  color: var(--num-text) !important;
  -webkit-text-fill-color: var(--num-text) !important;
  background: transparent !important;
}

.delta-pill {
  display: inline-block;
  font-size: 11px;
  line-height: 1;
  padding: 3px 6px;
  border-radius: 999px;
  background: var(--hc-pill-bg, rgba(0,0,0,.06));
  border: 1px solid rgba(0,0,0,.08);
  opacity: .9;
  white-space: nowrap;              /* NEW: keep math on one line */
}
.hc-holder { position: relative; display: inline-flex; align-items: baseline; gap: .4rem; }
.hc-ghost  { position: absolute; left: 0; top: 100%; margin-top: 2px; white-space: nowrap; font-size: 11px; opacity: .7; pointer-events: none; }
.capacity-summary .cs-values td, #PickCapacityHC { overflow: visible; position: relative; }

/* ======== Flow Summary — Trans PLANNER row (single-source) ======== */
#TransPlannerCell{
  /* match normal summary cell metrics — never taller */
  display: table-cell;
  vertical-align: middle;
  text-align: center;
  padding: var(--pad-y) var(--pad-x);
  line-height: 1.25;

  /* inherit the summary skin */
  background: var(--num-bg);
  color: var(--num-text);
  border: var(--border-w) solid var(--num-border);
  border-radius: var(--radius);

  /* numeric parity */
  font: inherit;
  font-weight: var(--num-weight, 700);
  font-size: calc(var(--font-size) * var(--text-scale, 1) * var(--num-scale, 1));
  font-variant-numeric: tabular-nums;
  -webkit-font-feature-settings: "tnum";
  font-feature-settings: "tnum";

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  caret-color: var(--num-text);
}

#TransPlannerValue{
  /* flat inline editor so the row height equals peers */
  display: inline;              /* inline avoids extra box height */
  margin: 0;
  padding: 0 2px;               /* no vertical padding */
  border: 0;                    /* remove inner border that raised height */
  background: transparent;
  line-height: inherit;         /* same line box as the cell */
  text-align: center;

  /* inherit numeric look */
  font: inherit;
  color: inherit;
  font-variant-numeric: inherit;
  -webkit-font-feature-settings: inherit;
  font-feature-settings: inherit;

  white-space: nowrap;
  overflow: visible;            /* no scrollbars that can expand height */
  cursor: text;
  user-select: text;
}

/* placeholder dash without reflow */
#TransPlannerValue:empty::before{
  content: '–';
  opacity: .6;
}

/* subtle focus, zero height impact */
#TransPlannerValue:focus{
  outline: 2px solid color-mix(in srgb, var(--num-text) 35%, transparent);
  outline-offset: 1px;
  box-shadow: none;
}


.capacity-summary th,
.capacity-summary td { vertical-align: middle; }

/* ---------- Buttons / icons you use ---------- */
#RecoHC{
  height: 26px; width: 26px; padding: 3px;
  background: var(--header); transition: .2s; filter: drop-shadow(0 0 rgba(0,0,0,.75));
}
#RecoHC:hover{ transform: scale(1.25); filter: drop-shadow(0 4px rgba(0,0,0,.75)); }

#PickCalcShot { height: 30px !important; width: 30px !important; padding: 5px !important; }

/* ---------- Overlays / loaders ---------- */
.loading-overlay{
  position:absolute; inset:0;
  background: rgba(255,255,255,.9);
  z-index:1000; display:flex; align-items:center; justify-content:center;
}
.loading-message{ text-align:center; font-weight:bold; display:flex; flex-direction:column; gap:10px; }
.loading-message img{ height:40px; width:40px; }

/* ---------- Utilities ---------- */
.hidden-cell{ opacity:0; width:0; height:0; border:none; pointer-events:none; }
.collapsed-row{ display:none !important; }
.edited-cell{
  background: var(--edited-cell-background, rgba(255,255,255,0.14)) !important;
  border-color: var(--edited-cell-border, rgba(148,163,184,0.55)) !important;
  color: var(--edited-cell-text, var(--ink)) !important;
}
.status-text[data-status="warning"]{ color:#d9534f; }

/* tool dropdown (kept) */
#tools_dropdownBox{
  position:absolute; top:3vh;
  display:flex; flex-direction:column; align-items:center; gap:3px;
  padding:5px; border:2px solid black; border-radius:10px; background: var(--bg);
}
#tools_dropdownBox div{
  font-weight:700; border:2px solid black; border-radius:10px; padding:5px;
  color:white; background:#7a8a9c; cursor:pointer; transition:.1s;
}
#tools_dropdownBox div:not([status="locked"]):hover{ background:#c5e1fc; color:#000; }

#siteModal{
  background: #fff !important;
  color: #111 !important;
  border: 2px solid #2b2b2b !important;
}
#siteModal *, #siteInput{ color: inherit; }
#siteInput{
  background:#fff !important;
  color:#111 !important;
  border:1px solid #777 !important;
}

/* First-column tooltip (PP name) */
.pickCalc td:first-child,
.WIPTracker td:first-child,
.BL td:first-child {
  position: relative;           /* anchor for tooltip */
  white-space: nowrap;          /* keep ellipsis by default */
  text-overflow: ellipsis;
  overflow: hidden;
}

/* Center the "Transship – Planner Hourly Input" header (the one with colspan=3) */
.capacity-summary .cs-sub th[colspan="3"] {
  text-align: center !important;
}

.capacity-summary td input[type="text"]{
  width:100%;
  border:none;
  outline:none;
  background:transparent;
  text-align:inherit;
  font:inherit;
  padding:0;
  margin:0;
  box-shadow:none;
  appearance:textfield;
}

/* Holder keeps inline size stable; ghost overlays without shifting layout */
.capacity-summary td .hc-holder{
  position:relative; display:inline-block; padding-right:8px;
}
.capacity-summary td .hc-ghost{
  position:absolute; right:0; top:0; opacity:0; white-space:nowrap;
  pointer-events:none; transition:opacity .12s;
  font-size:11px;
}
.capacity-summary td:hover .hc-ghost,
.capacity-summary td:focus-within .hc-ghost{ opacity:.75; }

.capacity-summary td .hc-mark{ font-size:10px; opacity:.75; margin-left:2px; }

/* keep the whole row centered (title and input) */
.pickCalc .capacity-summary .cs-sub th { text-align: center; }

/* ensure vertical centering everywhere in the summary */
.pickCalc .capacity-summary th,
.pickCalc .capacity-summary td { vertical-align: middle; }


/* keep HC stable; show ghost on hover without reflow */
#PickCapacityHC .hc-holder { position: relative; display: inline-block; }
#PickCapacityHC .hc-main { display: inline-flex; align-items: baseline; gap: .15em; }
#PickCapacityHC .hc-mark { font-size: .75em; line-height: 1; vertical-align: top; }
#PickCapacityHC .hc-ghost {
  position: absolute; left: 0; top: 100%;
  white-space: nowrap; opacity: 0; pointer-events: none; transform: translateY(.2em);
  transition: opacity .12s ease, transform .12s ease;
  font-size: .9em; font-style: italic; opacity: .75;
}
#PickCapacityHC .hc-holder:hover .hc-ghost { opacity: 1; transform: translateY(0); }

#PickCapacityHC.has-tooltip::after,
#PickCapacityHC.has-tooltip::before,
#PickCapacityHC.pc-tip::after,
#PickCapacityHC.pc-tip::before {
  content: none !important;
}

#Buffer_Cont tr.buffer-section-header > th .buffer-header-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

#Buffer_Cont tr.buffer-section-header > th .toggle-icon {
  display: inline-flex;
  align-items: center;
  pointer-events: none;
  font-weight: 700;
  margin-left: 8px;
}

#Buffer_Cont tr.buffer-columns-header th {
  background: var(--header);
  color: var(--ink);
  font-weight: 600;
  text-align: center;
  border: var(--border-w) solid rgba(0,0,0,.18);
  border-radius: var(--radius);
}

.pc-toggle-icon,
.wip-toggle-icon,
.picking-picked-toggle-icon,
.bl-toggle-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 8px;
  font-weight: 700;
  pointer-events: none;
}

.tracker-header-bar{
  display:grid;
  grid-template-columns:minmax(0,1fr) max-content minmax(0,1fr);
  align-items:center;
  gap:18px;
  padding:0 6px;
  min-height:38px;
  margin-bottom:10px;
}

.tracker-header-left,
.tracker-header-controls{
  display:inline-flex;
  align-items:center;
  gap:10px;
  flex-wrap:nowrap;
  min-width:0;
  /* overflow:hidden;  // ← enable only if you really want to clip extra buttons */
}

.tracker-header-title{
  grid-column:2;
  justify-self:center;
  display:inline-flex;
  align-items:center;
  gap:10px;
  min-width:0;
  max-width:100%;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  text-align:center;
  font-size:calc(var(--font-size) * var(--text-scale, 1) * 1.1);
  font-weight:700;
  letter-spacing:.24px;
  font-family:var(--font);
}

.tracker-header-shot{
  display:flex;
  align-items:center;
  justify-content:center;
  min-width:32px;
  min-height:32px;
}
.tracker-header-shot button,
.tracker-header-shot .tracker-shot-btn,
.tracker-header-shot [data-opsiq-shot]{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:30px;
  height:30px;
  background: color-mix(in srgb, var(--num-bg) 70%, transparent);
  color: var(--num-text);
  border: 1px solid var(--num-border);
  transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease, border-color .12s ease, background-color .12s ease;
  cursor:pointer;
}
.tracker-header-shot button:hover,
.tracker-header-shot .tracker-shot-btn:hover,
.tracker-header-shot [data-opsiq-shot]:hover{
  background: var(--num-hover-bg);
  transform:translateY(-1px);
  box-shadow: 0 6px 14px color-mix(in srgb, var(--th-bg) 35%, transparent);
  opacity:1;
}

.tracker-control-group,
.tracker-refresh-controls{
  display:inline-flex;
  align-items:center;
  gap:8px;
  flex-wrap:nowrap;
  white-space: nowrap;
}

/*.tracker-header-controls button{
  padding:6px 11px;
  border-radius:6px;
  border:1px solid var(--num-border);
  background: color-mix(in srgb, var(--num-bg) 70%, transparent);
  color: var(--num-text);
  font-size:12px;
  cursor:pointer;
  opacity:.92;
  transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease, border-color .12s ease, background-color .12s ease;
}*/

.tracker-header-controls button {
  justify-self: end;
  display: inline-flex;              /* fix: use flex so text centers */
  align-items: center;
  justify-content: center;
  height: 28px;                      /* fix: consistent pill height */
  padding: 0 10px;                   /* fix: side padding only */
  line-height: 1;                    /* fix: no baseline gaps */
  vertical-align: middle;            /* fix: aligns with neighbor pills */
  border-radius: 6px;
  border: 1px solid var(--num-border);
  background: color-mix(in srgb, var(--num-bg) 70%, transparent);
  color: var(--num-text);
  font-size: 12px;
  cursor: pointer;
  opacity: .92;
  transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease, border-color .12s ease, background-color .12s ease;
}

.tracker-header-controls button:hover{
  background: var(--num-hover-bg);
  transform:translateY(-1px);
  opacity:1;
  box-shadow: 0 6px 14px color-mix(in srgb, var(--th-bg) 35%, transparent);
}
.tracker-header-controls button.active{
  border-color: var(--nav-border);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--nav-border) 60%, transparent);
}

/*.tracker-refresh-menu{
  display:none;
  align-items:center;
  gap:6px;
  padding:6px 11px;
  border-radius:6px;
  border:1px solid var(--num-border);
  background: color-mix(in srgb, var(--num-bg) 70%, transparent);
  color: var(--num-text);
  font-size:12px;
  cursor:pointer;
  transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease, border-color .12s ease, background-color .12s ease;
}*/

.tracker-refresh-menu{
  display: none;                     /* stays hidden until your JS shows it */
  align-items: center;
  justify-content: center;
  height: 28px;                      /* match buttons */
  padding: 0 10px;                   /* match buttons */
  line-height: 1;                    /* match buttons */
  gap: 6px;
  border-radius: 6px;
  border: 1px solid var(--num-border);
  background: color-mix(in srgb, var(--num-bg) 70%, transparent);
  color: var(--num-text);
  font-size: 12px;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease, border-color .12s ease, background-color .12s ease;
}


.tracker-refresh-menu::after{
  content:'▾';
  font-size:10px;
  margin-left:4px;
}
.tracker-refresh-menu:hover{
  background: var(--num-hover-bg);
  transform:translateY(-1px);
  opacity:1;
  box-shadow: 0 6px 14px color-mix(in srgb, var(--th-bg) 35%, transparent);
}
.tracker-refresh-menu.active{
  border-color: var(--nav-border);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--nav-border) 60%, transparent);
}

.tracker-refresh-pop{
  position:absolute;
  z-index:2147483643;
  display:none;
  min-width:120px;
  padding:6px;
  border-radius:10px;
  background: color-mix(in srgb, var(--th-bg) 88%, transparent);
  border: 1px solid var(--th-border);
  box-shadow: 0 18px 34px color-mix(in srgb, var(--th-bg) 28%, transparent);
}
.tracker-refresh-pop button{
  display:block;
  width:100%;
  padding:6px 10px;
  background:transparent;
  border:1px solid transparent;
  color: var(--th-text);
  font-size:12px;
  letter-spacing:.2px;
  cursor:pointer;
  text-align:left;
  transition: background .12s ease, border-color .12s ease;
}
.tracker-refresh-pop button:hover{
  background: color-mix(in srgb, var(--num-hover-bg) 65%, transparent);
  border-color: color-mix(in srgb, var(--num-border) 70%, transparent);
}
.tracker-refresh-pop button.active{
  background: color-mix(in srgb, var(--num-bg) 80%, transparent);
  border-color: var(--nav-border);
}


/* Force true center alignment for WIP/BL headers 
.WIPTracker .tracker-header-bar,
.BL .tracker-header-bar{
  display:grid;
  grid-template-columns: 1fr auto 1fr; 
  align-items:center;
}

.WIPTracker .tracker-header-title,
.BL .tracker-header-title{
  grid-column: 2;    
  justify-self: center;    
  text-align: center;
}*/

/* Place header pieces & hard-right the controls */
.pickCalc .tracker-header-left,
.WIPTracker .tracker-header-left,
.BL .tracker-header-left { grid-column: 1; justify-self: start; }

.pickCalc .tracker-header-title,
.WIPTracker .tracker-header-title,
.BL .tracker-header-title { grid-column: 2; justify-self: center; }

.pickCalc .tracker-header-controls,
.WIPTracker .tracker-header-controls,
.BL .tracker-header-controls {
  grid-column: 3;
  justify-self: end;               /* align to the right edge of the grid */
  margin-left: auto;               /* belt & suspenders */
  min-width: max-content;   /* prevent clipping */
  margin-right: 0;
}

/* Header bar padding matches table’s outer gutter so edges line up */
.pickCalc .tracker-header-bar,
.WIPTracker .tracker-header-bar,
.BL .tracker-header-bar { padding: 0 var(--gap) !important; }

/* --- Header controls: keep on one line, never bleed --- */
.pickCalc .tracker-header-bar,
.WIPTracker .tracker-header-bar,
.BL .tracker-header-bar{
  overflow: hidden;            /* hard stop for anything inside the bar */
}

.pickCalc .tracker-header-controls,
.WIPTracker .tracker-header-controls,
.BL .tracker-header-controls{
  display: inline-flex;
  align-items: center;
  gap: 10px;

  /* key bits */
  white-space: nowrap;         /* stay on one line */
  flex-wrap: nowrap;           /* never wrap */
  min-width:0 !important;  
  max-width: 100%;             /* don’t exceed the column */
  overflow: hidden;            /* clip extra buttons/icons instead of bleeding */
  text-overflow: clip;         /* no ellipsis for buttons, just clip */
  justify-content: flex-end;   /* pin to the right edge */
}

/* ensure children don't try to grow and push outside */
.pickCalc .tracker-header-controls > *,
.WIPTracker .tracker-header-controls > *,
.BL .tracker-header-controls > *{
  flex: 0 0 auto;              /* keep each control at its intrinsic width */
  max-width: none;
}


@media (max-width: 1880px) {
  .tracker-header-bar{
    grid-template-columns:minmax(120px,auto) 1fr minmax(120px,auto);
    gap: 12px;
    min-height: 34px;
  }
  .tracker-header-left{
    gap: 10px;
  }
  .tracker-header-title{
    font-size: calc(var(--font-size) * var(--text-scale, 1) * 1.02);
    gap: 8px;
  }
  .tracker-header-shot .tracker-shot-btn,
  .tracker-header-shot button,
  .tracker-header-shot [data-opsiq-shot]{
    width: 26px;
    height: 26px;
  }
  .tracker-header-controls{
    gap: 6px;
    flex-wrap:nowrap;
    white-space: nowrap;
  }
  .tracker-header-controls .tracker-refresh-controls{
    display:none;
  }
  .tracker-control-group,
  .tracker-refresh-controls{
    gap: 6px;
  }
  .tracker-header-controls button{
    height: 26px;
    padding: 0 9px;
    line-height: 1;
    font-size: 11px;
  }
  .tracker-refresh-icon{
    width: 26px;
    height: 26px;
    padding: 3px;
  }
  .tracker-refresh-menu{
    display:inline-flex;
  }
  #bl-summary-key {
    width: 38%;
  }
}


@media (max-width: 1440px) {
  .tracker-header-bar{
    gap: 12px;
    min-height: 34px;
  }
  .tracker-header-left{
    gap: 10px;
  }
  .tracker-header-title{
    font-size: calc(var(--font-size) * var(--text-scale, 1) * 1.05);
    gap: 8px;
  }
  .tracker-header-shot .tracker-shot-btn,
  .tracker-header-shot button,
  .tracker-header-shot [data-opsiq-shot]{
    width: 26px;
    height: 26px;
  }
  .tracker-header-controls{
    gap: 8px;
    flex-wrap:nowrap;
  }
  .tracker-header-controls .tracker-refresh-controls{
    display:none;
  }
  .tracker-control-group,
  .tracker-refresh-controls{
    gap: 6px;
  }
  .tracker-header-controls button{
    height: 26px;
    padding: 0 9px;
    line-height: 1;
    font-size: 11px;
  }
  .tracker-refresh-icon{
    width: 26px;
    height: 26px;
    padding: 3px;
  }
  .tracker-refresh-menu{
    display:inline-flex;
  }
}

.tracker-refresh-icon {
  cursor: pointer;
  width: 28px;
  height: 28px;
  padding: 4px;
  border-radius: 6px;
  border: 1px solid var(--num-border);   
  background:rgba(15,23,42,.5);
  opacity: 0.9;
  transition: transform 0.15s ease, opacity 0.15s ease, box-shadow 0.15s ease;
}
.tracker-refresh-icon:hover{
  transform:translateY(-1px);
  opacity:1;
  box-shadow:0 6px 12px rgba(0,0,0,0.25);
}

.bl-escalation-icon{
  margin-right:6px;
  font-size:1rem;
  display:inline-flex;
  align-items:center;
}
.bl-escalation-value{
  display:inline-flex;
  align-items:center;
}

/* BL totals: center values (assumes an id or class for that table) */
#blTotals th, #blTotals td,
.BL .totals-row td, .BL .totals-row th {
  text-align: center;
}

/* Make sure first-column hover tooltip shows in all themes (already defined, just ensure overflow visible) */
.WIPTracker td:first-child,
.BL td:first-child {
  position: relative;
  overflow: hidden;       /* keep ellipsis baseline */
  text-overflow: ellipsis;
  white-space: nowrap;
}

.WIP-refresh-btn.active,
.bl-refresh-btn.active {
  outline: none;
}

.bl-summary-card {
  margin-top: 12px;
  padding: 12px;
  background: var(--panel);
  border: 1px solid rgba(0,0,0,.25);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bl-summary-card table {
  margin: 0;
  width: 100%;
  border-collapse: separate;
  border-spacing: var(--gap);
  table-layout: fixed;
}

/* Cells: inherit font from app/theme, only keep chrome + spacing */
#bl-summary-table th,
#bl-summary-table td {
  background: var(--cell);
  border: var(--border-w) solid rgba(0,0,0,.28);
  border-radius: var(--radius);
  padding: calc(var(--pad-y) * 1.9) calc(var(--pad-x) * 2.6);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 50%;

  /* inherit typography (pairs with the global patch I gave you) */
  font-family: var(--app-font, var(--font, inherit));
  font-size: calc(var(--font-size) * var(--text-scale, 1));
  font-weight: var(--text-weight, 400);
  font-variant-numeric: tabular-nums;
}

#bl-summary-table th {
  width: 65%;
  text-align: left;      /* change to left if you prefer label-left */
  letter-spacing: .2px;
  font-weight: var(--text-weight, 700);
}

#bl-summary-table td {
  width: 35%;
  text-align: right;      /* change to right if you prefer number-right */
  font-weight: var(--num-weight, 700);
  font-size: calc(var(--font-size) * var(--text-scale, 1) * var(--num-scale, 1));
}

#bl-summary-table td[id^="BL_"] {
  font-family: inherit;
  font-weight: var(--num-weight, 700);
}


#bl-summary-key {
  margin-top: 14px;
  background: var(--header);
  border: 1px solid var(--grid);
  border-radius: 12px;
  padding: 12px 14px;
  color: var(--ink);
  font-size: calc(var(--font-size) * var(--text-scale, 1));
  display: inline-block;
  max-width: 100%;
  width: 25%;
  transition: width 0.25s ease;
}

#bl-summary-key[open] {
  width: 100%;
}

#bl-summary-key summary {
  cursor: pointer;
  list-style: none;
  font-weight: var(--text-weight, 700);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(15,23,42,.65), rgba(15,23,42,.35));
  border: 1px solid rgba(148,163,184,.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}
#bl-summary-key summary::-webkit-details-marker { display:none; }
#bl-summary-key summary:hover,
#bl-summary-key summary:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(0,0,0,0.25);
  opacity: 0.96;
  outline: none;
}
#bl-summary-key[open] summary {
  margin-bottom: 12px;
}

.bl-key-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px 18px;
  align-items: stretch;
}

.bl-key-grid span {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 12px;
  background: rgba(15,23,42,.2);
  border-radius: 10px;
  border: 1px solid rgba(148,163,184,.32);
  justify-content: flex-start;
  font-size: 0.82rem;
}
.bl-key-grid span strong {
  font-size: 1.1rem;
  line-height: 1;
}
.bl-key-grid span span {
  display: flex;
  flex-direction: column;
  line-height: 1.35;
  text-align: left;
}
/* Belt-and-suspenders: hard-disable on this one cell */
#PickCapacityHC:hover::after,
#PickCapacityHC:hover::before {
  content: none !important;
}

#custom-theme-panel { display: none; }
#custom-theme-panel.is-open { display: block; }


.wip-pp-section-header th:hover,
.buffer-section-header th:hover {
  background: var(--header) !important;   /* keep the bar color fixed */
}

.WIPTracker .buffer-subtable :is(td, th, input, [contenteditable]):focus {
  outline: none !important;
  box-shadow: none !important;
}

/* ---------- Responsiveness ---------- */
@media (max-width: 1440px){
  :root{ --num-col: 50px; }
}

@media (max-width: 1100px){
  .pickCalc, .WIPTracker, .BL{ flex:1 1 520px; min-width:520px; }
}
@media (max-width: 740px){
  :root{ --num-col: 48px; --font-size: var(--font-size-sm); }
  .pickCalc, .WIPTracker, .BL{ flex:1 1 100%; min-width:100%; }
}

/* ---------- Tiny helpers ---------- */
#siteInput.error{ border:2px solid #ff4444; animation: shake .5s; }
@keyframes shake{
  0%,100%{ transform: translateX(0); }
  25%{ transform: translateX(5px); }
  75%{ transform: translateX(-5px); }
}
#checkIn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding: 0 16px;
  height: 60%;
  margin-top: auto;
  margin-bottom: 6px;
}

#checkIn span{
  display:inline-flex;
  align-items:center;
}

#checkIn span{ display:inline-flex; align-items:center; }

/* Normalize header focus on the subtable header th (since we moved tabindex) */
.WIPTracker .wip-pp-section-header th:focus,
.WIPTracker .wip-pp-section-header th:focus-visible,
.WIPTracker .wip-pp-section-header th:hover {
  outline: none !important;
  box-shadow: none !important;
  background: var(--header) !important;
  border-color: rgba(0,0,0,.18) !important;
}


/* ===== BL Escalation Matrix ===== */
.bl-esc-h4{
  margin: 10px 0 6px;
  font-size: 0.92rem;
  font-weight: 700;
}

/* Table shell inherits your card/table skin */
.bl-escalation-table{
  width:100%;
  border-collapse: separate;
  border-spacing: var(--gap);
  table-layout: fixed;
}
.bl-escalation-table th,
.bl-escalation-table td{
  background: var(--cell);
  color: var(--ink);
  border: var(--border-w) solid rgba(0,0,0,.28);
  border-radius: var(--radius);
  padding: calc(var(--pad-y) * 1.6) calc(var(--pad-x) * 2.2);
  vertical-align: top;
  text-align: left;
  font-size: calc(var(--font-size) * var(--text-scale, 1));
}

/* BL Summary — make the value (td) column wider than the label (th) 
.bl-escalation-table {
  table-layout: fixed;              
} */

.bl-escalation-table thead th:first-child,
.bl-escalation-table tbody td:first-child {
  width: 50% !important;   /* header/body label column */
  text-align: center;
}

.bl-escalation-table thead th:nth-child(2),
.bl-escalation-table tbody td:nth-child(2) {
  width: 50% !important;   /* header/body POC column */
  text-align: center;
}

.bl-escalation-table tbody td:nth-child(2) {
  text-align: left;
  white-space: normal !important;
  word-break: break-word;
  line-height: 1.35;
}

/* colored chips (use CSS vars so themes can override) */
:root{
  --esc-brown:#7b4a00;
  --esc-yellow:#ffd400;
  --esc-pink:#ffb3bf;
  --esc-red:#ef4444;
  --esc-darkred:#b91c1c;
}
.level-chip{
  display:inline-block;
  width:100%;
  text-align:center;
  font-weight:700;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid rgba(0,0,0,.2);
  color: #111;
  mix-blend-mode: normal;
}
.esc-brown{   background: var(--esc-brown);   color:#fff; }
.esc-yellow{  background: var(--esc-yellow);  color:#111; }
.esc-pink{    background: var(--esc-pink);    color:#111; }
.esc-red{     background: var(--esc-red);     color:#fff; }
.esc-darkred{ background: var(--esc-darkred); color:#fff; }

/* compact on narrow widths */
@media (max-width: 900px){
  .bl-escalation-table th, .bl-escalation-table td{ padding: 8px 10px; }
}

.tracker-header-controls button > svg,
.tracker-header-controls button > img {
  display: block;
}

/* make the number red */
.BL [id$="_HOW"].bl-how-low{
  color:#ef4444 !important;
  font-weight:700 !important;   /* ← force bold */
}


/* --- Classic theme → generic tokens (bridge) --- */
body[data-theme="classic"]{
  --bg:         var(--darkblue);
  --ink:        var(--amz-text-light);
  --grid:       var(--amz-border);

  --panel:      var(--amz-panel);
  --header:     var(--amz-head);
  --cell:       var(--amz-td);
  --cell-hover: var(--amz-td-h);

  --pp-bg:      var(--amz-td-1st);
  --pp-text:    #fff;
  --pp-border:  var(--amz-border);

  --th-bg:      var(--amz-head);
  --th-text:    var(--amz-text-light);
  --th-border:  var(--amz-border);

  --num-bg:     var(--amz-td);
  --num-text:   var(--amz-text-light);
  --num-border: var(--amz-border);

  --nav-bg:     var(--darkblue);
  --nav-border: #003c56;
}

