/* DirtWorks brand UI — Brand & Document Style Guide v5.0
   Navy #0A4861 leads · Red #BF2025 accents · earth tones support */
:root {
  --navy: #0A4861; --navy-dark: #073950;
  --red: #BF2025; --red-dark: #9C1A1E;
  --terracotta: #B45A36; --sand: #D4A05A;
  --taupe: #7A6A54; --parchment: #F4EEE3; --stone: #BFB8AE;
  --bg: #F4EEE3; --panel: #ffffff; --line: #D9D3C7;
  --text: #1d2733; --muted: var(--taupe);
  --accent: var(--red); --accent-dark: var(--red-dark);
  --green: #2e7d32;
  /* softened (translucent) fills - full-strength solids felt harsh */
  --red-soft: rgba(191, 32, 37, .82);
  --navy-soft: rgba(10, 72, 97, .85);
  --green-soft: rgba(46, 125, 50, .82);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Aptos", Inter, "Segoe UI", Calibri, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg); color: var(--text); font-size: 15px;
  -webkit-text-size-adjust: 100%;
}

/* ---- layout ---- */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px;
  background: var(--navy); color: #fff; padding: 10px 14px;
  padding-top: calc(10px + env(safe-area-inset-top));
  border-bottom: 3px solid var(--red);
}
.topbar .brand { font-weight: 700; margin-right: 8px; white-space: nowrap; display: flex; align-items: center; }
.topbar .brand img { height: 20px; display: block; }
.topbar button {
  background: transparent; color: #cfdbe3; border: none; padding: 10px 12px;
  font-size: 15px; border-radius: 8px; cursor: pointer;
}
.topbar button.active { background: var(--red-soft); color: #fff; }
.topbar .spacer { flex: 1; }
/* right-side utility buttons (Dashboard / Sign out): pill definition */
.topbar button.tbtn {
  border: 1px solid rgba(244, 238, 227, 0.4); border-radius: 999px;
  background: rgba(244, 238, 227, 0.08); color: #fff; padding: 8px 16px;
  flex: none; white-space: nowrap;
}
.topbar button.tbtn:active { background: rgba(244, 238, 227, 0.2); border-color: #fff; }
/* signed-in email: truncates instead of pushing buttons off the bar */
.topbar .who-email {
  color: #cfdbe3; font-size: 13px; max-width: 170px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 0 1 auto;
}
/* iPad / narrow: drop the email (it's in the tooltip), tighten the pills */
@media (max-width: 1024px) {
  .topbar .who-email { display: none; }
  .topbar button.tbtn { padding: 7px 12px; font-size: 13.5px; }
  .topbar button { padding: 10px 9px; }
}
.page { padding: 14px; max-width: 1200px; margin: 0 auto; }

/* ---- panels & tables ---- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px; margin-bottom: 14px; }
.panel h2 { margin: 0 0 10px; font-size: 17px; color: var(--navy); }
.panel h3 { margin: 14px 0 8px; font-size: 14px; color: var(--red); text-transform: uppercase; letter-spacing: .02em; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; color: #fff; background: var(--navy); letter-spacing: .03em; padding: 9px 6px; }
th:first-child { border-radius: 6px 0 0 0; } th:last-child { border-radius: 0 6px 0 0; }
td.num, th.num { text-align: right; }
tbody tr:nth-child(even) td { background: #FAF7F0; }
tr.total td { font-weight: 700; border-top: 2px solid var(--navy); background: #fff !important; }

/* ---- inputs ---- */
input, select, textarea {
  font: inherit; color: inherit; background: #fff; border: 1px solid var(--stone);
  border-radius: 8px; padding: 9px 10px; min-height: 40px; max-width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--navy); border-color: var(--navy); }
input.cell, select.cell {
  width: 100%; min-width: 60px; padding: 6px 8px;
  background: #fff; border: 1px solid var(--stone); border-radius: 7px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .04);
}
input.cell:focus, select.cell:focus { background: #fff; border-color: var(--navy); }
input.num { text-align: right; }
label { display: block; font-size: 12px; color: var(--taupe); margin-bottom: 4px; text-transform: uppercase; letter-spacing: .03em; font-weight: 600; }
.field { margin-bottom: 12px; }
.grid { display: grid; gap: 12px; }
.grid.c2 { grid-template-columns: 1fr 1fr; }
.grid.c3 { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 700px) { .grid.c2, .grid.c3 { grid-template-columns: 1fr; } }

/* ---- buttons ---- */
button.btn {
  background: var(--red-soft); color: #fff; border: none; border-radius: 8px;
  padding: 11px 16px; font-size: 15px; font-weight: 600; cursor: pointer; min-height: 44px;
}
button.btn:active { background: var(--red-dark); }
button.btn.green { background: var(--green-soft); }
button.btn.green:active { background: var(--green); }
button.btn.secondary { background: var(--parchment); color: var(--navy); border: 1px solid var(--stone); }
button.btn.secondary:active { background: #EAE2D2; }
button.btn.danger { background: transparent; color: var(--red); padding: 8px; min-height: 36px; border: none; }
button.btn.small { padding: 7px 12px; min-height: 36px; font-size: 13px; }
button:disabled { opacity: .5; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }

/* ---- misc ---- */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs button {
  background: #fff; border: 1px solid var(--stone); border-radius: 20px; padding: 9px 16px;
  font-size: 14px; cursor: pointer; min-height: 40px; color: var(--navy);
}
.tabs button.active { background: var(--navy-soft); border-color: transparent; color: #fff; }
.muted { color: var(--taupe); font-size: 13px; }
.money { font-variant-numeric: tabular-nums; }
.badge { font-size: 11px; padding: 3px 8px; border-radius: 10px; background: var(--parchment); color: var(--taupe); border: 1px solid var(--line); }
.badge[style] { filter: saturate(.82) brightness(1.04); } /* inline-colored (status/rev) badges soften */

/* ---- resource-type icon cards (labor / equipment / material / supply / sub) ---- */
.resicon-wrap { display: inline-flex; align-items: center; gap: 6px; vertical-align: middle; }
.resicon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 27px; height: 23px; border-radius: 6px; flex: none;
  background: #fff; border: 1px solid var(--line);
  box-shadow: 0 1px 1.5px rgba(43, 42, 38, .08);
}
.resicon svg { width: 17px; height: 17px; display: block; }
.resicon-lbl { font-size: 12px; color: var(--taupe); }
body.pipeline-dark .resicon { background: rgba(244, 238, 227, 0.10); border-color: rgba(244, 238, 227, 0.25); box-shadow: none; }
body.pipeline-dark .resicon-lbl { color: var(--parchment); }

/* ---- schedule calendar (Summary ▸ Schedule) ---- */
.schedmonth { max-width: 1020px; }
.schedgrid { display: grid; grid-template-columns: repeat(7, 1fr); }
.schedgrid.dow div { font-size: 11px; font-weight: 700; color: var(--taupe); text-transform: uppercase; padding: 2px 5px; }
.schedweek { border-top: 1px solid var(--line); }
.schedweek:last-child { border-bottom: 1px solid var(--line); }
.schedgrid.days .schedday { font-size: 11px; padding: 3px 5px; min-height: 20px; color: var(--navy); background: #fff; border-left: 1px solid var(--line); }
.schedgrid.days .schedday:last-child { border-right: 1px solid var(--line); }
.schedday.out { color: #C8C2B6; background: #FBFAF7; }
.schedday.off { background: var(--parchment); color: var(--taupe); }
.schedday .hol { color: var(--red); margin-left: 3px; font-size: 10px; }
.schedgrid.bars { gap: 2px 0; padding: 2px 0 5px; background: #fff;
  border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
.schedbar { color: #fff; font-size: 11px; line-height: 20px; padding: 0 7px; margin: 0 1px;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.schedbar .bardesc { margin-left: 6px; opacity: .85; font-size: 10px; }
.error { color: var(--red); margin: 8px 0; }
.success { color: var(--green); margin: 8px 0; }
.card-list { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.card { background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--navy); border-radius: 10px; padding: 14px; cursor: pointer; }
.card:active { border-color: var(--red); }
.card .title { font-weight: 700; margin-bottom: 4px; color: var(--navy); }

/* ---- bid pipeline dashboard ---- */
.schip {
  border: 1.5px solid var(--stone); background: #fff; border-radius: 20px;
  padding: 8px 14px; font-size: 13px; font-weight: 600; cursor: pointer; min-height: 38px;
}
.schip.on { color: #fff; filter: saturate(.82) brightness(1.04); }
.schip:not(.on) { opacity: .55; background: #fff; }
.sdot { width: 14px; height: 14px; border-radius: 50%; flex: none; }
.card.jcard { border-left-width: 5px; }
/* archived jobs: light grey, slightly transparent pillar - kept for the record,
   out of the summaries, locked until restored */
.card.jcard.archived { background: #EFEDE8 !important; border-left-color: #A29B8F !important; opacity: .62; filter: grayscale(.55); }
body.pipeline-dark .card.jcard.archived { background: rgba(244, 238, 227, 0.06) !important; border-left-color: #7D786E !important; opacity: .55; }
.schip.archchip { border-style: dashed; }
.schip.archchip.on { background: #8F8880; border-color: #8F8880; color: #fff; opacity: 1; }
/* archived job open in the edit form: everything inert until restored */
.archlock { pointer-events: none; opacity: .72; filter: grayscale(.25); }
.jmoney { font-size: 21px; font-weight: 700; color: var(--navy); margin: 6px 0 2px; }
.jdates { display: flex; gap: 14px; font-size: 12.5px; color: var(--taupe); flex-wrap: wrap; }

/* calendar */
.calgrid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-top: 4px; }
.calhead div { text-align: center; font-size: 11px; text-transform: uppercase; color: var(--taupe); font-weight: 700; }
.calday {
  min-height: 86px; background: #fff; border: 1px solid var(--line); border-radius: 6px;
  padding: 3px; overflow: hidden;
}
.calday.out { opacity: .38; }
.calday.today { outline: 2px solid var(--navy); }
.caldate { font-size: 11px; color: var(--taupe); font-weight: 700; margin-bottom: 2px; }
.caljob {
  color: #fff; font-size: 10.5px; font-weight: 600; border-radius: 4px;
  filter: saturate(.82) brightness(1.04);
  padding: 3px 5px; margin-bottom: 3px; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* estimator seal - stamp-style ring with initials */
.eseal {
  flex: none; width: 40px; height: 40px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  border: 2.5px double var(--navy); color: var(--navy); background: var(--parchment);
  font-weight: 800; font-size: 12.5px; letter-spacing: .04em; cursor: pointer;
  box-shadow: inset 0 0 0 2px #fff;
}
.eseal:active { border-color: var(--red); color: var(--red); }

/* par (annual goals) bars */
.pargrid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.parbar { position: relative; height: 14px; background: #EAE4D6; border-radius: 999px; overflow: visible;
  box-shadow: inset 0 1px 2px rgba(43, 42, 38, .12); }
.parfill { height: 100%; border-radius: 999px; transition: width .4s ease, background .4s ease;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .38), 0 1px 2px rgba(43, 42, 38, .14); }
body.pipeline-dark .parbar { background: rgba(244, 238, 227, 0.12); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .35); }
.partick { position: absolute; top: -4px; width: 4px; height: 22px; background: var(--navy);
  border: 1.5px solid #fff; border-radius: 3px; box-shadow: 0 0 4px rgba(43, 42, 38, .45); z-index: 1; }
body.pipeline-dark .partick { background: var(--parchment); border-color: var(--navy-dark); box-shadow: 0 0 5px rgba(0, 0, 0, .55); }

/* months-out revenue view */
.mongrid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); margin-top: 4px; }
.moncard { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px; min-height: 92px; }
.moncard.now { outline: 2px solid var(--navy); }
.monhead { display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  border-bottom: 2px solid var(--terracotta); padding-bottom: 5px; margin-bottom: 6px; }
.monhead b { color: var(--navy); font-size: 14px; }
.monmoney { font-weight: 700; color: var(--terracotta); font-variant-numeric: tabular-nums; font-size: 13.5px; }

/* ---- login ---- */
.login-wrap { max-width: 400px; margin: 10vh auto; text-align: center; }
.login-wrap input { width: 100%; text-align: left; }
.login-wrap .logo { width: 260px; max-width: 90%; margin: 0 auto 6px; display: block; }
.login-wrap .license { color: var(--taupe); font-style: italic; font-size: 13px; margin: 0 0 18px; }
.login-wrap .field { text-align: left; }
.login-wrap .btn { width: 100%; }

/* ---- bid item block ---- */
.bid-item { border-left: 4px solid var(--terracotta); }
.act-table td { padding: 6px 4px; }
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ---- estimate tree view: bid item > activity > resource ---- */
.tree { padding: 12px 14px; }
.tnode, .trow { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.tnode { padding: 11px 12px; border-radius: 8px; margin-top: 11px; }
.tnode.l1 {
  margin-left: 30px; background: #fff; border: 1px solid var(--line);
  border-left: 5px solid var(--navy); font-weight: 600;
}
.tnode.l1.alt { border-left-color: var(--sand); }
/* bid item card read-out: bold description line over a quiet meta line
   (qty · division · phase · type · pricing) — settings live behind ⚙ */
/* the bid item card reads like a proposal line over a detail line:
   row 1 — # | Description | Qty | Unit | Unit $ | Total — labeled columns,
           one font, centered vertically in the card
   row 2 — Division · Phase · Base · Calc · 📅 days ....... [▸ 🔓 ✕]      */
.biwrap { flex: 1 1 420px; min-width: 280px; display: flex; flex-direction: column;
  gap: 7px; justify-content: center; }
.birow1 { display: flex; align-items: center; gap: 18px; cursor: pointer; }
.birow1 .badge.tno { align-self: center; }
.bifield { display: flex; flex-direction: column; gap: 2px; white-space: nowrap; }
.bifield small { font-size: 10px; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: var(--taupe); line-height: 1; }
.bifield > span { font-size: 14.5px; font-weight: 700; color: var(--navy);
  line-height: 1.25; font-variant-numeric: tabular-nums; }
.bifield.bidescf { flex: 1 1 200px; min-width: 150px; white-space: normal; }
.bidesc.empty { color: var(--taupe); font-weight: 500; font-style: italic; }
.bifield.biqty   { min-width: 78px; text-align: right; }
.bifield.bium    { min-width: 44px; text-align: center; }
.bifield.biup    { min-width: 104px; text-align: right; }
.bifield.bitotal { min-width: 116px; text-align: right; }
.bifield.bitotal > span { font-weight: 800; }
.birow2 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 12.5px; font-weight: 600; color: var(--taupe); line-height: 1.3; }
.bisep { color: #C4BCAC; }
.biflag { font-weight: 700; letter-spacing: .03em; font-size: 12.5px; }
.biflag.altf { color: #A5760A; }
.biflag.keyf { color: var(--terracotta); }
.bidays {
  white-space: nowrap; font-weight: 700; font-size: 12.5px; margin-left: 8px;
  color: var(--navy); background: #EFF3F8; border: 1px solid #C9D6E4;
  border-radius: 6px; padding: 3px 9px;
}
.bidays small { font-weight: 500; color: var(--taupe); font-size: 11px; }
.bictl {
  display: flex; align-items: center; gap: 8px; flex: 0 0 auto;
  margin-left: auto; padding-left: 12px; border-left: 1px solid var(--line);
}
/* activity / cost-code rows read green — visually distinct from the white
   bid item cards above and the navy settings drawer */
.tnode.l2 {
  margin-left: 58px; background: #EEF5EC;
  border: 1px solid var(--line); border-left: 4px solid #2E7D32;
}
.tnode.l2.tadd { background: transparent; border: none; padding: 2px 8px; }
/* bid item settings drawer — dressed like the bid item card it edits (same
   alignment + navy spine, pale navy fill), clearly apart from the warm
   parchment / terracotta activity rows below it */
.tnode.l2.cfgdrawer {
  margin-left: 30px;                      /* lines up with the bid item card, not the activities */
  margin-top: -7px;                       /* tucks under the card it belongs to */
  background: #EFF3F8;                    /* pale navy — the card's color family */
  border: 1px solid var(--line);
  border-left: 5px solid var(--navy);     /* same spine as .tnode.l1 */
  border-top: 1px dashed #B9C6D6;
  border-radius: 0 0 8px 8px;
}
.tnode.l2.cfgdrawer.alt { border-left-color: var(--sand); } /* alternates match their sand spine */
.tnode.l2.cfgdrawer .tlabel { color: var(--navy); }
body.pipeline-dark .tnode.l2.cfgdrawer {
  background: rgba(43, 108, 176, 0.16); border-left-color: #7FB0DE;
}
.tnode.l3 {
  margin-left: 86px; display: block;
  background: #EFE6D3; border: 1px solid var(--line); border-left: 4px solid var(--taupe);
  padding: 14px 16px;
}
.tnode.l3 .trow { margin-top: 8px; }
.tchev {
  flex: none; width: 36px; height: 38px; border: 1px solid var(--stone); background: #fff;
  color: var(--navy); font-size: 16px; font-weight: 700; cursor: pointer; border-radius: 8px; padding: 0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .08);
}
.tchev:active { background: var(--parchment); border-color: var(--navy); }
.tchev.gchev { width: 30px; height: 30px; font-size: 14px; }
.notegrp { margin-top: 8px; }
.notegrp input { font-style: italic; font-size: 13px; }
/* estimate spreadsheet view - Excel / Google Sheets look & feel */
.sheettbl {
  border-collapse: collapse; background: #fff;
  font-family: Calibri, "Segoe UI", Inter, Arial, sans-serif; font-size: 13px;
  border: 1px solid #c6c6c6;
}
.sheettbl th {
  position: sticky; top: 0; z-index: 2;
  background: #F1F3F4; color: #444; font-weight: 600; font-size: 11.5px;
  text-transform: none; letter-spacing: 0; border: 1px solid #c6c6c6;
  border-radius: 0 !important; padding: 5px 6px;
}
.sheettbl td {
  padding: 0; border: 1px solid #E1E3E6; background: #fff !important;
  height: 30px; vertical-align: middle;
}
.sheettbl tbody tr:nth-child(even) td { background: #fff !important; }
.sheettbl td.rownum, .sheettbl th.rownum {
  background: #F1F3F4 !important; color: #666; text-align: center;
  min-width: 34px; width: 34px; font-size: 11.5px; border: 1px solid #c6c6c6;
  position: sticky; left: 0; z-index: 1;
}
.sheettbl td.itemno { padding: 0 6px; color: var(--navy); font-weight: 700; font-size: 12px; white-space: nowrap; }
.sheettbl input.cell, .sheettbl select.cell {
  width: 100%; height: 30px; min-height: 30px; margin: 0; padding: 2px 6px;
  border: none; border-radius: 0; background: transparent; box-shadow: none;
  font: inherit; -webkit-appearance: none; appearance: none;
}
.sheettbl select.cell {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='8' height='5'><path d='M0 0l4 5 4-5z' fill='%23888'/></svg>");
  background-repeat: no-repeat; background-position: right 5px center; padding-right: 16px;
}
.sheettbl td:focus-within {
  outline: 2px solid #1a73e8; outline-offset: -2px; background: #fff !important;
  box-shadow: 0 0 0 3px rgba(26, 115, 232, .15);
}
.sheettbl input.cell:focus, .sheettbl select.cell:focus { outline: none; border: none; background: transparent; }
.sheettbl td.num input.cell { text-align: right; }
.sheettbl .muted { font-size: 11.5px; padding-left: 6px; }
.sheettbl .money { padding-right: 6px; }
.sheettbl td .badge { border-radius: 3px; }
.sheettbl .btn.small { padding: 2px 7px; min-height: 24px; font-size: 12px; border-radius: 3px; }
.sheettbl .btn.danger { min-height: 24px; padding: 2px 5px; }
.sheettbl .lockwrap.locked td { background: #F7F7F7 !important; }
.sheettbl .lockwrap.locked input.cell, .sheettbl .lockwrap.locked select.cell { color: #999; }
/* subtle banding so bid items and their activities don't blend on the white sheet:
   items alternate white / faint parchment; activity sub-rows sit a shade deeper;
   a hairline tops each new bid item. Palette stays in the parchment family. */
.sheettbl tbody tr.gsub td:not(.rownum) { background: #FCFBF7 !important; }
.sheettbl tbody tr.galt td:not(.rownum) { background: #FAF7F0 !important; }
.sheettbl tbody tr.galt.gsub td:not(.rownum) { background: #F6F2E8 !important; }
.sheettbl tbody tr.gfirst td { border-top: 1px solid #CFC9BC; }
/* library-book sheets (and any sheet without item groups): simple every-other-row
   banding in the same faint parchment so rows don't blend on the white background */
.sheettbl.zebra tbody tr:nth-child(even) td:not(.rownum) { background: #FAF7F0 !important; }
/* activity cells read GREEN on the sheet — same language as the activity
   cards and the tree's activity rows; keyed pricing reads sand */
.sheettbl td.tdact { background: #EEF5EC !important; }
.sheettbl td.tdkeyed { background: #FAF3E6 !important; }
/* lock tint and the edit-focus highlight stay on top of the banding */
.sheettbl tbody tr.lockwrap.locked td:not(.rownum) { background: #F7F7F7 !important; }
.sheettbl tbody tr.lockwrap td:not(.rownum):focus-within { background: #fff !important; }
/* ============ estimate TREE view — Windows-explorer style (desktop) ============ */
.treesplit { display: flex; gap: 12px; align-items: flex-start; }
.treenav { flex: 0 0 400px; max-width: 46%; background: #fff; border: 1px solid var(--stone);
  border-radius: 8px; overflow: hidden; }
.treescroll { max-height: 70vh; overflow: auto; padding: 6px 4px 10px; }
.trow { display: flex; align-items: center; gap: 6px; padding: 3px 8px 3px 0; font-size: 13px;
  cursor: pointer; white-space: nowrap; border-radius: 4px; user-select: none; position: relative; }
.trow:hover { filter: brightness(0.955); }
/* node-type tints — the SAME color language as the cards view everywhere:
   navy = the estimate/divisions · sand = phases/keyed · white = bid items ·
   green = activities · soft taupe = other resources */
.trow.troot { background-color: #E7EDF2; }
.trow.tdiv  { background-color: #EFF3F6; }
.trow.tph   { background-color: #FAF3E6; }
.trow.titem { background-color: #fff; }
.trow.tact  { background-color: #EEF5EC; }
.trow.tres  { background-color: #F5F3EF; }
.trow.sel { background-color: var(--navy); color: #fff; filter: none; }
.trow.sel .tsum, .trow.sel .muted, .trow.sel .tno2 { color: #fff; }
.tbox { flex: none; width: 15px; height: 15px; border: 1px solid #8b8b8b; background: #fff;
  color: #333; font: 700 11px/13px Consolas, monospace; text-align: center; border-radius: 2px;
  position: relative; z-index: 1; }
.tbox:hover { border-color: var(--navy); color: var(--navy); }
.tleaf { flex: none; width: 15px; text-align: center; color: var(--taupe); font-size: 8px;
  position: relative; z-index: 1; }
.trow .tlbl { overflow: hidden; text-overflow: ellipsis; }
.trow .tsum { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--taupe);
  font-size: 12px; flex: none; padding-right: 4px; }
.tno2 { flex: none; font-size: 10.5px; font-weight: 700; color: var(--navy); }
.trow.troot { padding-left: 8px; }
.trow.lvl0 { padding-left: 28px; }
.trow.lvl1 { padding-left: 48px; }
.trow.lvl2 { padding-left: 68px; }
.trow.lvl3 { padding-left: 88px; }
.trow.lvl4 { padding-left: 108px; }
/* ---- tree logic lines: each level wears its own color, tying every branch
   back up to the estimate at the root ----
   root rail x15 navy · division x35 sand · phase/item x55 terracotta ·
   item/act x75 green · act/res x95 taupe */
.trow::before { /* elbow vertical (├ / └ when .tlast) */
  content: ""; position: absolute; top: 0; bottom: 0; width: 0; display: none;
  border-left: 1.5px solid transparent;
}
.trow::after { /* elbow horizontal stub into the +/− box */
  content: ""; position: absolute; top: 50%; height: 0; width: 11px; display: none;
  border-top: 1.5px solid transparent;
}
.trow.lvl0::before, .trow.lvl0::after { display: block; border-color: var(--navy); }
.trow.lvl1::before, .trow.lvl1::after { display: block; border-color: #D4A05A; }
.trow.lvl2::before, .trow.lvl2::after { display: block; border-color: var(--terracotta); }
.trow.lvl3::before, .trow.lvl3::after { display: block; border-color: #2E7D32; }
.trow.lvl4::before, .trow.lvl4::after { display: block; border-color: #8F8880; }
.trow.lvl0::before { left: 15px; } .trow.lvl0::after { left: 16px; }
.trow.lvl1::before { left: 35px; } .trow.lvl1::after { left: 36px; }
.trow.lvl2::before { left: 55px; } .trow.lvl2::after { left: 56px; }
.trow.lvl3::before { left: 75px; } .trow.lvl3::after { left: 76px; }
.trow.lvl4::before { left: 95px; } .trow.lvl4::after { left: 96px; }
.trow.tlast::before { bottom: 50%; } /* └ — the branch ends here */
/* ancestor rails pass through deeper rows, each in its parent's color */
.trow.lvl1 { background-image: linear-gradient(var(--navy), var(--navy));
  background-size: 1.5px 100%; background-repeat: no-repeat; background-position: 15px 0; }
.trow.lvl2 { background-image: linear-gradient(var(--navy), var(--navy)), linear-gradient(#D4A05A, #D4A05A);
  background-size: 1.5px 100%, 1.5px 100%; background-repeat: no-repeat; background-position: 15px 0, 35px 0; }
.trow.lvl3 { background-image: linear-gradient(var(--navy), var(--navy)), linear-gradient(#D4A05A, #D4A05A),
    linear-gradient(var(--terracotta), var(--terracotta));
  background-size: 1.5px 100%, 1.5px 100%, 1.5px 100%; background-repeat: no-repeat;
  background-position: 15px 0, 35px 0, 55px 0; }
.trow.lvl4 { background-image: linear-gradient(var(--navy), var(--navy)), linear-gradient(#D4A05A, #D4A05A),
    linear-gradient(var(--terracotta), var(--terracotta)), linear-gradient(#2E7D32, #2E7D32);
  background-size: 1.5px 100%, 1.5px 100%, 1.5px 100%, 1.5px 100%; background-repeat: no-repeat;
  background-position: 15px 0, 35px 0, 55px 0, 75px 0; }
.trow.sel { background-image: none; }
.trow.sel::before, .trow.sel::after { border-color: rgba(255, 255, 255, .55); }
.treedetail { flex: 1; min-width: 320px; background: #fff; border: 1px solid var(--stone);
  border-radius: 8px; padding: 16px 18px; max-height: 70vh; overflow: auto; }
/* the detail pane wears its node's colors — same language, settled tints:
   navy spine for the estimate/divisions/items, sand for phases, green for
   activities, taupe for resources */
.treedetail.tdet-root, .treedetail.tdet-div {
  background: #F7FAFC; border-left: 4px solid var(--navy); }
.treedetail.tdet-item { background: #fff; border-left: 4px solid var(--navy); }
.treedetail.tdet-phase { background: #FDFAF1; border-left: 4px solid #D4A05A; }
.treedetail.tdet-act { background: #F6FAF5; border-left: 4px solid #2E7D32; }
.treedetail.tdet-res { background: #FAF8F4; border-left: 4px solid #8F8880; }
/* full-screen tree (EXPERIMENTAL) — fills the display; Esc or the button exits */
.treesplit.tfull {
  position: fixed; inset: 0; z-index: 60; margin: 0 !important;
  background: var(--parchment); overflow: hidden;
  /* framed toward the center under the brand banner */
  padding: 82px clamp(28px, 5vw, 110px) 26px;
}
.treesplit.tfull .treenav { flex-basis: 460px; max-width: 46%; }
.treesplit.tfull .treescroll { max-height: calc(100vh - 168px); }
.treesplit.tfull .treedetail { max-height: calc(100vh - 110px); }
/* the DirtWorks banner across the top of the full-screen estimate */
.tfbanner {
  position: absolute; top: 0; left: 0; right: 0; height: 58px;
  background: linear-gradient(90deg, var(--navy) 0%, #062F40 100%);
  display: flex; align-items: center; gap: 16px;
  padding: 0 clamp(24px, 4vw, 64px);
  box-shadow: 0 2px 12px rgba(0, 0, 0, .22);
}
.tfbanner img { height: 30px; display: block; }
.tfjob { color: #fff; font-weight: 700; font-size: 15px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.tfsub { color: var(--sand); font-size: 11px; letter-spacing: .14em;
  text-transform: uppercase; font-weight: 700; flex: none; }
button.btn.tfexit { background: transparent; border: 1.5px solid rgba(255, 255, 255, .55);
  color: #fff; border-radius: 999px; }
button.btn.tfexit:active { border-color: #fff; background: rgba(255, 255, 255, .12); }
.treedetail h3 { margin: 0 0 12px; color: var(--navy); }
.tfield { margin-bottom: 12px; }
.tfield label { display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--taupe); font-weight: 700; margin-bottom: 4px; }
.tfield input, .tfield select { width: 100%; }
.tfgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
/* activities quick view inside the item pane — thumb through, tree follows */
.qact { display: flex; align-items: center; gap: 12px; padding: 7px 8px; cursor: pointer;
  border-bottom: 1px solid var(--taupe, #EAE4D5); border-radius: 4px; font-size: 13px; }
.qact:hover { background: var(--parchment); }
/* item card: activities carry the estimate-wide GREEN, their resources the
   taupe - the card reads with the same color language as the tree and sheet */
.qact.qact-act { background: #EEF5EC; border-left: 3px solid #2E7D32; border-radius: 6px; margin-bottom: 2px; }
.qact.qact-act:hover { background: #EEF5EC; filter: brightness(0.965); }
.qact.qact-res { background: #F5F3EF; border-left: 3px solid #8F8880; border-radius: 6px;
  margin-bottom: 2px; padding-top: 5px; padding-bottom: 5px; font-size: 12.5px; }
.qact.qact-res:hover { background: #F5F3EF; filter: brightness(0.97); }
.qact.qindent { margin-left: 28px; }
.qres-none { margin: 2px 0 6px 32px; font-size: 12px; }
/* inline activity editor on the item card - the whole activity builds here */
.qedit {
  margin: 0 0 6px 28px; padding: 10px 12px;
  background: #F6FAF5; border: 1px solid #CFE3D0; border-left: 3px solid #2E7D32;
  border-radius: 8px;
}
.row.qindent { margin-left: 28px; }
/* highlighted activity: the card and the tree glow together */
.qact.qact-act.hl { box-shadow: 0 0 0 2px rgba(46, 125, 50, 0.45); }
/* tree rows: whisper-quiet type tag - (division) (phase) (bid item) (activity)
   (resource) - small and faded so the tree still reads smooth */
.tkind {
  font-size: 9.5px; font-weight: 400; font-style: italic;
  color: #8F8880; opacity: 0.75; letter-spacing: 0.2px; white-space: nowrap;
}
.trow.sel .tkind, .trow:hover .tkind { opacity: 1; }
.qact .qlbl { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; color: var(--navy); }
/* the book's header + filters pin below the topbar while the cards or the
   log scroll — filters stay reachable from anywhere in a long book */
.bookhead {
  position: sticky; top: calc(50px + env(safe-area-inset-top)); z-index: 15;
  margin: -10px -14px 8px; padding: 10px 14px 8px;
  border-radius: 10px 10px 0 0; background: #fff;
}
body.pipeline-dark .bookhead {
  background: rgba(13, 63, 84, 0.94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(244, 238, 227, 0.18);
}

/* ---- estimate edit lock: one estimator holds the pen ---- */
.lockbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: #FDF3E7; border: 1px solid #E7C9A1; border-left: 4px solid var(--terracotta);
  border-radius: 8px; padding: 8px 12px; margin-bottom: 10px;
  font-size: 13px; color: #6B4A12;
}
/* checked out to ME: green open-for-editing bar with the check-in button */
.lockbar.mine {
  background: #EDF5EE; border-color: #BFD9C2; border-left-color: #2E7D32; color: #1F4D23;
}
/* edit history strip: two lines tall, scrolls for the rest */
.editlog {
  max-height: 40px; overflow-y: auto;
  border: 1px solid var(--line); border-radius: 8px;
  padding: 3px 10px; margin-bottom: 10px;
  background: #FBFAF7; font-size: 12px; color: #5C544A;
}
.editlog .elrow { line-height: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.editlog .elrow b { color: var(--navy); }
.editlog .elive { color: #2E7D32; font-weight: 700; margin-left: 4px; }
/* read-only estimate: fields and mutating buttons freeze; navigating the
   views (tabs, expand chevrons, doc viewer) stays live so others can read */
.estro :is(input, select, textarea) { pointer-events: none; background: #F3F1EC !important; color: #8F8880; }
.estro button { pointer-events: none; opacity: .55; }
.estro :is(.tabs button, .tchev, .gchev, .roallow, .tfexit) { pointer-events: auto; opacity: 1; }

/* 🆕 new-bid-item entry pen: pending row parked at the bottom of every view */
.newpen {
  flex-wrap: wrap; margin-top: 16px; padding: 12px 14px;
  border: 2px dashed var(--navy); border-radius: 12px;
  background: #F4F8FB; box-shadow: 0 4px 14px rgba(10, 72, 97, 0.12);
}
.newpen-head {
  flex: 1 1 100%; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap;
  color: var(--navy); font-weight: 800; font-size: 12.5px; letter-spacing: 0.6px;
}
/* fullscreen tree: the pen floats above the overlay so + Bid Item stays fluid */
.newpen.tfpen {
  position: fixed; bottom: 14px; z-index: 320;
  left: clamp(28px, 5vw, 110px); right: clamp(28px, 5vw, 110px);
  margin-top: 0; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

/* lock glows: green = you hold the pen · red = another estimator does */
.jcard.glowgreen { box-shadow: 0 0 0 1.5px rgba(46, 125, 50, .65), 0 0 14px 3px rgba(46, 125, 50, .35); }
.jcard.glowred   { box-shadow: 0 0 0 1.5px rgba(191, 32, 37, .6),  0 0 14px 3px rgba(191, 32, 37, .32); }
.lockmini { flex: none; font-size: 13px; opacity: .4; cursor: default; line-height: 1; }
.lockmini.red { opacity: 1; filter: drop-shadow(0 0 4px rgba(191, 32, 37, .8)); }
.lockmini.grn { opacity: 1; color: #2E7D32; filter: drop-shadow(0 0 4px rgba(46, 125, 50, .8)); }
.lockchip { background: #FBEDED; border-color: rgba(191, 32, 37, .45) !important; color: #8E1418 !important; }
.lockchip.mine { background: #EDF5EE; border-color: rgba(46, 125, 50, .5) !important; color: #215B25 !important; }
/* log rows glow with a tint + colored spine (box-shadow doesn't sit on <tr>) */
tr.glowred td   { background: rgba(191, 32, 37, .07) !important; }
tr.glowred td:first-child   { box-shadow: inset 3px 0 0 #BF2025; }
tr.glowgreen td { background: rgba(46, 125, 50, .07) !important; }
tr.glowgreen td:first-child { box-shadow: inset 3px 0 0 #2E7D32; }
/* topbar Estimate tab mirrors the lock the open estimate holds */
.topbar button.glowme {
  box-shadow: 0 0 0 1px rgba(129, 199, 132, .9), 0 0 10px 2px rgba(76, 175, 80, .75);
  border-radius: 8px;
}
.topbar button.glowlock {
  box-shadow: 0 0 0 1px rgba(229, 115, 115, .9), 0 0 10px 2px rgba(211, 47, 47, .7);
  border-radius: 8px;
}

/* inline Excel viewer for attached estimate workbooks (SheetJS -> table) */
.xlsview { max-height: 72vh; overflow: auto; background: #fff; padding: 8px 10px; }
.xlsview table { border-collapse: collapse; font: 12.5px Calibri, "Segoe UI", Arial, sans-serif; }
.xlsview td { border: 1px solid #E1E3E6; padding: 3px 8px; white-space: nowrap; }
.xlsview tr:first-child td { background: #F1F3F4; font-weight: 700; position: sticky; top: 0; }

/* crew-driven production rate — read-only chip; the crew sets the pace */
.prodlock { display: inline-flex; align-items: center; gap: 4px; background: #F3F1EC;
  border: 1px solid var(--stone); border-radius: 6px; padding: 5px 10px;
  color: #8a857a; font-style: italic; font-size: 13px; font-variant-numeric: tabular-nums; }
@media (max-width: 900px) {
  .treesplit { flex-direction: column; }
  .treenav { flex: 1; width: 100%; max-width: none; }
  .tfgrid { grid-template-columns: 1fr; }
}

.tdesc { flex: 1 1 150px; min-width: 130px; }
.tlabel { font-size: 10px; text-transform: uppercase; color: var(--taupe); letter-spacing: .04em; flex: none; }
.tmoney { margin-left: auto; text-align: right; min-width: 110px; font-variant-numeric: tabular-nums; }
.tmoney small { display: block; color: var(--taupe); font-weight: 400; font-size: 11px; }
@media (pointer: coarse) { .tchev { width: 44px; height: 44px; font-size: 20px; } }

/* Division / phase group headers in the estimate tree */
.tgroup-div {
  display: flex; align-items: center; gap: 8px; margin-top: 26px;
  padding: 8px 12px; background: var(--terracotta); color: #fff;
  font-weight: 700; border-radius: 8px; letter-spacing: .02em;
}
.tgroup-div .tmoney, .tgroup-div .tmoney b { color: #fff; }
.tgroup-phase {
  display: flex; align-items: center; gap: 8px; margin: 14px 0 0 14px;
  padding: 6px 12px; background: var(--parchment); color: var(--navy);
  font-weight: 600; border: 1px solid var(--line); border-radius: 8px;
}
.badge.tno { min-width: 58px; text-align: center; background: var(--navy); color: #fff; border: none; flex: none; }

/* Locks: .lockwrap.locked freezes everything inside except the padlock & chevron */
.lockwrap.locked :is(input, select, textarea, .qdial, button.btn) {
  pointer-events: none; opacity: .55;
}
.lockwrap.locked :is(.lockbtn, .tchev) { pointer-events: auto; opacity: 1; }
.lockbtn {
  flex: none; width: 38px; height: 38px; border: 1px solid var(--line);
  background: #fff; border-radius: 8px; font-size: 15px; cursor: pointer; padding: 0;
}
.lockbtn.on { background: var(--navy); border-color: var(--navy); }
.lockbtn:disabled { cursor: default; opacity: .75; }
.lockbtn.small { width: 30px; height: 30px; font-size: 12px; border-radius: 6px; }
.tab-lock { margin-left: 7px; font-size: 12px; cursor: pointer; opacity: .6; }
.tab-lock.on { opacity: 1; }
.tabs button.active .tab-lock { opacity: .9; }
@media (pointer: coarse) { .lockbtn { width: 44px; height: 44px; } .lockbtn.small { width: 38px; height: 38px; } }

/* Crew roll-up cards */
.card.crewnew {
  border: 2px dashed var(--red); border-left: 2px dashed var(--red);
  background: #fff; margin-bottom: 12px;
}
.card.crewnew:active { background: var(--parchment); }
.card.crewcard { border-left: 4px solid var(--terracotta); margin-bottom: 10px; cursor: default; }
.card.crewcard.open { border-color: var(--navy); border-left-color: var(--navy); }

/* Library group header rows (+/− roll-up) */
tr.lgroup td b:first-child {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; background: #fff; border: 1px solid var(--stone);
  border-radius: 7px; color: var(--navy); box-shadow: 0 1px 2px rgba(0, 0, 0, .08);
}

tr.lgroup td {
  background: var(--parchment) !important; color: var(--navy); cursor: pointer;
  border-top: 2px solid var(--line); font-size: 13.5px; padding: 9px 8px;
}
tr.lgroup:active td { background: #EAE2D2 !important; }

/* Collapsible qualification sections */
.qsec {
  background: var(--parchment); border: 1px solid var(--line); border-radius: 8px;
  padding: 6px 10px; margin: 10px 0 6px; cursor: pointer;
}
.qsec:active { background: #EAE2D2; }

/* View-only crew resource table inside the L3 drawer */
.tview { width: 100%; }
.tview th { background: var(--taupe); font-size: 11px; padding: 6px; }
.tview td { background: transparent !important; padding: 5px 6px; font-size: 13px; border-bottom: 1px solid #E0D6C2; }

/* Activities zone: parchment tint so it reads apart from the white bid-item card */
.act-zone {
  background: #F8F3E9; border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px 12px; margin-top: 12px;
}
.act-zone h3 { margin-top: 0; }
.act-zone tbody tr:nth-child(even) td { background: #F1EADB; }
.act-zone th { background: var(--terracotta); }

/* Roller-dial quantity control */
.qdial { display: inline-flex; align-items: center; gap: 3px; }
.qdial input { min-width: 52px; }
.qdial-grip {
  position: relative;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  touch-action: none; cursor: ew-resize;
  min-width: 28px; min-height: 38px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--stone); border-radius: 6px; background: var(--parchment);
  color: var(--taupe); font-weight: 700; font-size: 15px;
}
.qdial-grip:active { background: var(--sand); }
.qdial.dragging .qdial-grip { background: var(--navy); color: #fff; border-color: var(--navy); }
.qdial.dragging input { background: #fff; border-color: var(--navy); font-weight: 700; }

/* Floating value readout while rolling (finger covers the field on iPad) */
.qdial-bubble {
  position: absolute; bottom: calc(100% + 9px); left: 50%; transform: translateX(-50%);
  background: var(--navy); color: #fff; font-weight: 700; font-size: 18px;
  font-variant-numeric: tabular-nums; padding: 7px 14px; border-radius: 9px;
  white-space: nowrap; pointer-events: none; z-index: 40;
  box-shadow: 0 3px 10px rgba(0, 0, 0, .3);
}
.qdial-bubble::after {
  content: ""; position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  border: 6px solid transparent; border-top-color: var(--navy);
}

/* Touch devices (iPad): Apple HIG 44pt targets + 16px inputs so iOS
   Safari doesn't auto-zoom the page when a field gets focus */
@media (pointer: coarse) {
  .qdial-grip { min-width: 44px; min-height: 44px; font-size: 19px; border-radius: 8px; }
  .qdial input { min-width: 60px; }
  input, select, textarea { font-size: 16px; }
  input.cell, select.cell { font-size: 16px; }
  .qdial-bubble { font-size: 20px; padding: 8px 16px; }
}

/* Expanded materials/subs drawer inside an activity: one shade deeper */
td.res-zone { background: #EFE6D3 !important; border-radius: 6px; padding: 10px; }
.res-zone table td { background: transparent !important; }
.res-zone th { background: var(--navy); }

/* ============================================================
   PIPELINE DARK MODE - the Jobs tab wears the dirtworksai.com
   glass theme (navy gradient + grid, glass panels, sand labels).
   Same layout, spacing, and status colors - only the finish.
   ============================================================ */
body.pipeline-dark {
  --panel: rgba(18, 92, 120, 0.48);
  --line: rgba(244, 238, 227, 0.24);
  --text: #F4EEE3;
  --muted: #C9C2B6;
  color: var(--text);
  /* brighter, higher-energy wash — the cards stay as they are and read
     crisply against the lighter tone */
  background: radial-gradient(ellipse at 30% 0%, #2E86A6 0%, #1B6485 48%, #114459 100%);
  background-attachment: fixed;
}
body.pipeline-dark .topbar { background: rgba(3, 22, 30, 0.75); backdrop-filter: blur(10px); }

/* solid button colors soften to translucent glass on the pipeline */
body.pipeline-dark button.btn:not(.secondary):not(.danger) {
  background: rgba(191, 32, 37, 0.55); backdrop-filter: blur(4px);
}
body.pipeline-dark button.btn:not(.secondary):not(.danger):active { background: rgba(191, 32, 37, 0.8); }
body.pipeline-dark button.btn.green { background: rgba(46, 125, 50, 0.55); }
body.pipeline-dark button.btn.green:active { background: rgba(46, 125, 50, 0.8); }
body.pipeline-dark .topbar button.active { background: rgba(191, 32, 37, 0.55); }
body.pipeline-dark .schip.on { opacity: .88; }

/* glass surfaces */
body.pipeline-dark .panel {
  background: var(--panel) !important;              /* beats inline gradients (digest) */
  border-color: var(--line);
  backdrop-filter: blur(8px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}
body.pipeline-dark .panel h2, body.pipeline-dark .panel h3 { color: #fff; }
body.pipeline-dark .card {
  background: rgba(244, 238, 227, 0.14);
  border-color: rgba(244, 238, 227, 0.32);
  backdrop-filter: blur(6px);
  box-shadow: 0 5px 16px rgba(0, 0, 0, 0.28);
}
body.pipeline-dark .card:active { border-color: #E63946; box-shadow: 0 0 24px rgba(191, 32, 37, 0.25); }
body.pipeline-dark .card .title { color: #fff; }
body.pipeline-dark .jmoney { color: #fff; }
body.pipeline-dark .jdates, body.pipeline-dark .muted { color: var(--muted); }
body.pipeline-dark .error { color: #ffb3b6; }
body.pipeline-dark .success { color: #7fd18a; }

/* inputs & controls */
body.pipeline-dark input, body.pipeline-dark select, body.pipeline-dark textarea {
  background: rgba(3, 22, 30, 0.55); border-color: rgba(244, 238, 227, 0.25); color: #fff;
}
body.pipeline-dark input.cell, body.pipeline-dark select.cell {
  background: rgba(3, 22, 30, 0.55); border-color: rgba(244, 238, 227, 0.25); color: #fff; box-shadow: none;
}
body.pipeline-dark input:focus, body.pipeline-dark select:focus, body.pipeline-dark textarea:focus {
  outline: 2px solid #E63946; border-color: #E63946;
}
/* the OPTION list pops up on a light native panel - white text was invisible
   (the "empty dropdown" bug). Paint options dark-on-dark explicitly. */
body.pipeline-dark select option {
  background-color: #08222E; color: #F4EEE3;
}
body.pipeline-dark input:disabled { opacity: .55; }
body.pipeline-dark label, body.pipeline-dark .tlabel { color: var(--sand); }
body.pipeline-dark .tabs button {
  background: rgba(244, 238, 227, 0.07); border-color: var(--line); color: var(--parchment);
}
body.pipeline-dark .tabs button.active { background: rgba(191, 32, 37, 0.5); border-color: transparent; color: #fff; }
body.pipeline-dark .schip { background: rgba(244, 238, 227, 0.07); border-color: rgba(244, 238, 227, 0.22); color: var(--parchment); }
body.pipeline-dark .schip:not(.on) { background: rgba(244, 238, 227, 0.04); opacity: .55; }
body.pipeline-dark .badge { background: rgba(244, 238, 227, 0.08); color: var(--parchment); border-color: var(--line); }
body.pipeline-dark button.btn.secondary {
  background: rgba(244, 238, 227, 0.08); color: var(--parchment); border-color: rgba(244, 238, 227, 0.25);
}
body.pipeline-dark button.btn.secondary:active { background: rgba(244, 238, 227, 0.16); }
body.pipeline-dark button.btn.danger { color: #ff9ba0; }
body.pipeline-dark .tchev, body.pipeline-dark .lockbtn {
  background: rgba(244, 238, 227, 0.08); border-color: rgba(244, 238, 227, 0.25); color: var(--parchment); box-shadow: none;
}
body.pipeline-dark .tchev:active { background: rgba(244, 238, 227, 0.18); border-color: var(--sand); }
body.pipeline-dark .eseal {
  background: rgba(244, 238, 227, 0.08); border-color: var(--sand); color: var(--sand); box-shadow: none;
}

/* tables (log + time cards) */
body.pipeline-dark th { background: rgba(3, 22, 30, 0.65); }
body.pipeline-dark td { border-bottom-color: var(--line); }
body.pipeline-dark tbody tr:nth-child(even) td { background: rgba(244, 238, 227, 0.03); }
body.pipeline-dark tr.total td { background: transparent !important; color: #fff; border-top-color: var(--sand); }

/* calendars */
body.pipeline-dark .calday { background: rgba(244, 238, 227, 0.05); border-color: var(--line); }
body.pipeline-dark .calday.out { opacity: .3; }
body.pipeline-dark .calday.today { outline-color: var(--sand); }
body.pipeline-dark .caldate, body.pipeline-dark .calhead div { color: var(--muted); }
body.pipeline-dark .moncard { background: rgba(244, 238, 227, 0.05); border-color: var(--line); }
body.pipeline-dark .monhead b { color: #fff; }
body.pipeline-dark .moncard.now { outline-color: var(--sand); }

/* par bars */
body.pipeline-dark .parbar { background: rgba(3, 22, 30, 0.55); }
body.pipeline-dark .partick { background: var(--sand); }

/* inline color accents from the templates are unreadable on glass -
   headings (Daily Digest, Par, Latest Notes...) go bright white,
   red/green accents go to their bright variants */
body.pipeline-dark [style*="color:var(--navy)"] { color: #fff !important; text-shadow: 0 1px 2px rgba(0, 0, 0, .4); }
body.pipeline-dark [style*="color: var(--navy)"] { color: #fff !important; text-shadow: 0 1px 2px rgba(0, 0, 0, .4); }
body.pipeline-dark [style*="color:var(--red)"] { color: #FF8A8E !important; }
body.pipeline-dark [style*="color: var(--red)"] { color: #FF8A8E !important; }
body.pipeline-dark [style*="color:var(--green)"] { color: #7FD18A !important; }
body.pipeline-dark [style*="color: var(--green)"] { color: #7FD18A !important; }
body.pipeline-dark .monmoney { color: #E8B979; }

/* ---- dark theme, rest of the system (estimate tree, sheet, libraries, admin) ---- */
/* estimate tree nodes */
body.pipeline-dark .tnode.l1 { background: rgba(244, 238, 227, 0.07); border-color: var(--line); font-weight: 600; }
body.pipeline-dark .tnode.l2 { background: rgba(244, 238, 227, 0.045); border-color: var(--line); }
body.pipeline-dark .tnode.l2.tadd { background: transparent; }
body.pipeline-dark .tnode.l3 { background: rgba(3, 22, 30, 0.35); border-color: var(--line); }
body.pipeline-dark .tgroup-phase { background: rgba(244, 238, 227, 0.08); color: var(--sand); border-color: var(--line); }
body.pipeline-dark .tdesc, body.pipeline-dark .tmoney { color: var(--text); }
body.pipeline-dark .tview th { background: rgba(3, 22, 30, 0.65); }
body.pipeline-dark .tview td { border-bottom-color: var(--line); }
body.pipeline-dark td.res-zone { background: rgba(3, 22, 30, 0.45) !important; }
body.pipeline-dark .notegrp input { color: var(--parchment); }

/* Excel-style sheet views STAY LIGHT - a bright "document" on the dark desk.
   (The generic dark input/th rules outrank the base .sheettbl styles, so the
   light look is restored explicitly here.) */
body.pipeline-dark .sheettbl { background: #fff; border-color: #c6c6c6; }
body.pipeline-dark .sheettbl th { background: #F1F3F4; color: #444; border-color: #c6c6c6; }
body.pipeline-dark .sheettbl td { background: #fff !important; border-color: #E1E3E6; color: #1d2733; }
body.pipeline-dark .sheettbl tbody tr:nth-child(even) td { background: #fff !important; }
body.pipeline-dark .sheettbl td.rownum, body.pipeline-dark .sheettbl th.rownum {
  background: #F1F3F4 !important; color: #666; }
body.pipeline-dark .sheettbl td.itemno { color: var(--navy); }
body.pipeline-dark .sheettbl input, body.pipeline-dark .sheettbl select,
body.pipeline-dark .sheettbl input.cell, body.pipeline-dark .sheettbl select.cell {
  background: transparent; border: none; color: #1d2733; box-shadow: none;
}
body.pipeline-dark .sheettbl select.cell {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='8' height='5'><path d='M0 0l4 5 4-5z' fill='%23888'/></svg>");
  background-repeat: no-repeat; background-position: right 5px center;
}
body.pipeline-dark .sheettbl td:focus-within { outline-color: #1a73e8; background: #fff !important; }
body.pipeline-dark .sheettbl .muted { color: var(--taupe); }
body.pipeline-dark .sheettbl .badge { background: var(--parchment); color: var(--taupe); border-color: #D9D3C7; }
body.pipeline-dark .sheettbl .lockwrap.locked td { background: #F7F7F7 !important; }
body.pipeline-dark .sheettbl .lockwrap.locked input.cell,
body.pipeline-dark .sheettbl .lockwrap.locked select.cell { color: #999; }
/* the dark-glass accent rules above (navy->white, red/green->bright, total row
   ->white text) bleed into the white sheet and turn text white-on-white.
   Re-assert dark-on-white for everything inside a sheet. */
body.pipeline-dark .sheettbl [style*="color:var(--navy)"],
body.pipeline-dark .sheettbl [style*="color: var(--navy)"] {
  color: var(--navy) !important; text-shadow: none; }
body.pipeline-dark .sheettbl [style*="color:var(--red)"],
body.pipeline-dark .sheettbl [style*="color: var(--red)"] { color: var(--red) !important; }
body.pipeline-dark .sheettbl [style*="color:var(--green)"],
body.pipeline-dark .sheettbl [style*="color: var(--green)"] { color: var(--green) !important; }
body.pipeline-dark .sheettbl tr.total td {
  background: #F1F3F4 !important; color: var(--navy); font-weight: 700;
  border-top: 2px solid var(--navy); }
body.pipeline-dark .sheettbl button.btn.secondary {
  background: #fff; color: var(--navy); border-color: #B9B4A8; }
body.pipeline-dark .sheettbl button.btn.danger { color: var(--red); }

/* library group rows, qual sections, crew cards */
body.pipeline-dark tr.lgroup td { background: rgba(244, 238, 227, 0.08) !important; color: var(--sand); border-top-color: var(--line); }
body.pipeline-dark tr.lgroup:active td { background: rgba(244, 238, 227, 0.14) !important; }
body.pipeline-dark tr.lgroup td b:first-child { background: rgba(3, 22, 30, 0.5); border-color: rgba(244, 238, 227, 0.25); color: var(--sand); box-shadow: none; }
body.pipeline-dark .qsec { background: rgba(244, 238, 227, 0.07); border-color: var(--line); }
body.pipeline-dark .qsec:active { background: rgba(244, 238, 227, 0.13); }
body.pipeline-dark .card.crewnew { background: rgba(244, 238, 227, 0.04); }
body.pipeline-dark .card.crewnew:active { background: rgba(244, 238, 227, 0.1); }

/* qty dials */
body.pipeline-dark .qdial-grip { background: rgba(244, 238, 227, 0.08); border-color: rgba(244, 238, 227, 0.25); color: var(--sand); }
body.pipeline-dark .qdial-grip:active { background: var(--sand); color: var(--navy-dark); }
body.pipeline-dark .qdial.dragging input { background: rgba(3, 22, 30, 0.75); }

/* lock buttons keep their on-state */
body.pipeline-dark .lockbtn.on { background: var(--navy); border-color: var(--sand); }
