/* ==========================================================================
   S16 Estimates list / pipeline (Mockup 9) - the cross-project home that the
   estimate builder (M1) and approval (M2) open from. DataRipple tokens from
   chrome.css, on-brand red/orange/blue. Review-only. No Date().
   ========================================================================== */

/* ---- toolbar: view toggle + stage filter + search -------------------- */
.est-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.seg { display: inline-flex; gap: 2px; background: var(--surface-secondary); border-radius: 999px; padding: 2px; }
.seg button { font-family: inherit; font-size: 12.5px; color: var(--fg-3); background: none; border: none; border-radius: 999px; padding: 6px 15px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.seg button.on { background: #fff; color: var(--fg-1); font-weight: 500; box-shadow: var(--shadow-sm); }
.filterchips { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.fchip { font-family: inherit; font-size: 12px; color: var(--fg-2); background: #fff; border: 1px solid var(--border-default); border-radius: 999px; padding: 5px 12px; cursor: pointer; }
.fchip:hover { border-color: var(--fg-3); }
.fchip.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.fchip .c { opacity: .7; margin-left: 4px; }
.est-toolbar .grow { flex: 1; }
.searchbox { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--border-default); border-radius: var(--r-md); padding: 6px 11px; background: #fff; width: 210px; }
.searchbox svg { color: var(--fg-3); flex-shrink: 0; }
.searchbox input { border: none; outline: none; font-family: inherit; font-size: 13px; color: var(--fg-1); background: transparent; width: 100%; }

/* ---- inline snapshot ------------------------------------------------- */
.est-snap { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 16px; padding: 2px 2px 15px; margin-bottom: 16px; border-bottom: 1px solid var(--border-subtle); }
.est-snap .eb { font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--brand); display: inline-flex; align-items: center; gap: 7px; }
.est-snap .eb .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 3px var(--brand-subtle); }
.est-snap .s { font-size: 13px; color: var(--fg-3); display: inline-flex; align-items: baseline; gap: 6px; }
.est-snap .s b { font-size: 18px; font-weight: 700; color: var(--fg-1); font-variant-numeric: tabular-nums; }
.est-snap .s.under b { color: var(--brand); }
.est-snap .sep { color: var(--border-default); }

/* ---- stage chip (shared list + board) -------------------------------- */
.stage { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 600; border-radius: 999px; padding: 3px 10px; white-space: nowrap; }
.stage::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.stage.draft { background: var(--surface-secondary); color: var(--fg-3); border: 1px solid var(--border-default); }
.stage.ready { background: rgba(81,137,173,0.13); color: var(--sky); }
.stage.approved { background: var(--info-soft); color: var(--info); }
.stage.sent { background: rgba(230,83,40,0.12); color: #C2410C; }
.stage.accepted { background: var(--info-soft); color: var(--info); }
.stage.project { background: #1b2433; color: #cbd5e6; }

/* ---- list view ------------------------------------------------------- */
.est-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.est-table thead th { font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--fg-3); text-align: right; padding: 9px 12px; border-bottom: 2px solid var(--border-default); white-space: nowrap; }
.est-table thead th.l { text-align: left; }
.est-table tbody td { padding: 11px 12px; border-bottom: 1px solid var(--border-subtle); text-align: right; vertical-align: middle; font-variant-numeric: tabular-nums; color: var(--fg-2); }
.est-table tbody td.l { text-align: left; }
.est-table tbody tr { cursor: pointer; }
.est-table tbody tr:hover td { background: #fafbfd; }
.est-job .jn { font-size: 13.5px; font-weight: 600; color: var(--fg-1); }
.est-table tbody tr:hover .est-job .jn { text-decoration: underline; text-underline-offset: 2px; }
.est-job .js { font-size: 11.5px; color: var(--fg-3); margin-top: 1px; }
.est-job .jid { font-size: 11px; color: var(--fg-3); font-variant-numeric: tabular-nums; }
.est-val { font-weight: 700; color: var(--fg-1); }
.est-mgn { font-weight: 600; }
.est-mgn.under { color: var(--brand); }
.est-mgn .flag { display: block; font-size: 10.5px; font-weight: 600; color: var(--brand); }
.est-upd { color: var(--fg-3); font-size: 12px; }
.est-table .chev { color: var(--fg-3); }

/* ---- board view ------------------------------------------------------ */
.est-board { display: grid; grid-template-columns: repeat(6, minmax(180px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 6px; }
.bcol { background: var(--surface-secondary); border-radius: var(--r-md); padding: 10px; min-width: 180px; }
.bcol .bh { display: flex; align-items: baseline; gap: 8px; padding: 2px 4px 10px; }
.bcol .bh .bt { font-size: 12px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: var(--fg-2); }
.bcol .bh .bc { font-size: 11px; font-weight: 700; background: #fff; border: 1px solid var(--border-default); border-radius: 999px; padding: 1px 7px; color: var(--fg-3); }
.bcol .bh .bv { margin-left: auto; font-size: 11.5px; color: var(--fg-3); font-variant-numeric: tabular-nums; }
.bcard { background: #fff; border: 1px solid var(--border-default); border-radius: var(--r-md); padding: 11px 12px; margin-bottom: 8px; cursor: pointer; box-shadow: var(--shadow-sm); transition: box-shadow .12s ease, transform .12s ease; }
.bcard:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.bcard:last-child { margin-bottom: 0; }
.bcard .bj { font-size: 13px; font-weight: 600; color: var(--fg-1); line-height: 1.25; }
.bcard .bs { font-size: 11.5px; color: var(--fg-3); margin-top: 2px; }
.bcard .bf { display: flex; align-items: baseline; justify-content: space-between; margin-top: 9px; }
.bcard .bval { font-size: 14px; font-weight: 700; color: var(--fg-1); font-variant-numeric: tabular-nums; }
.bcard .bmgn { font-size: 11.5px; font-weight: 600; color: var(--fg-3); }
.bcard .bmgn.under { color: var(--brand); }
.bcol.empty-note { color: var(--fg-3); font-size: 12px; text-align: center; padding: 16px 0; }

.est-empty { text-align: center; color: var(--fg-3); font-size: 13px; padding: 30px 0; }

/* ---- estimate preview pop-out (click a row/card) --------------------- */
.backdrop { position: fixed; inset: 0; background: rgba(11,18,32,0.5); display: none; align-items: center; justify-content: center; z-index: 200; padding: 32px; }
.backdrop.show { display: flex; }
.ep { background: #fff; border-radius: var(--r-lg); box-shadow: var(--shadow-lg); width: 100%; max-width: 1000px; max-height: 92vh; overflow: hidden; display: flex; flex-direction: column; }
.ep-head { display: flex; align-items: center; gap: 14px; padding: 20px 24px; border-bottom: 1px solid var(--border-default); flex-shrink: 0; }
.ep-head .av { width: 46px; height: 46px; border-radius: 12px; background: var(--brand); color: #fff; font-weight: 700; font-size: 15px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; letter-spacing: .02em; }
.ep-head .ht { flex: 1; min-width: 0; }
.ep-head .ht .jn { font-size: 19px; font-weight: 600; color: var(--fg-1); }
.ep-head .ht .jsub { font-size: 12.5px; color: var(--fg-3); margin-top: 3px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ep-head .ht .jmeta { font-size: 12px; color: var(--fg-3); margin-top: 5px; line-height: 1.4; }
.ep-head .ht .jmeta .d { margin: 0 8px; color: var(--border-default); }
.ep-head .x { font-size: 22px; color: var(--fg-3); cursor: pointer; background: none; border: none; line-height: 1; align-self: flex-start; }
.ep-body { padding: 20px 24px; flex: 1; overflow-y: auto; min-height: 0; }
.ep-stats { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--border-default); border-radius: var(--r-md); overflow: hidden; margin-bottom: 16px; }
.ep-stats .st { padding: 13px 16px; border-left: 1px solid var(--border-subtle); }
.ep-stats .st:first-child { border-left: none; }
.ep-stats .st .n { font-size: 19px; font-weight: 700; color: var(--fg-1); font-variant-numeric: tabular-nums; }
.ep-stats .st .n.under { color: var(--brand); }
.ep-stats .st .l { font-size: 11.5px; color: var(--fg-3); margin-top: 2px; }
.ep-life-lab { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--fg-3); margin-bottom: 14px; }
.ep-life { display: flex; align-items: flex-start; margin: 0 4px 4px; }
.ep-life .step { flex: 1; display: flex; flex-direction: column; align-items: center; position: relative; }
.ep-life .step .dot { width: 22px; height: 22px; border-radius: 50%; background: #fff; border: 2px solid var(--border-default); z-index: 2;
  display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; color: var(--fg-3); }
.ep-life .step .lab { font-size: 10.5px; margin-top: 6px; color: var(--fg-3); text-align: center; }
.ep-life .step.done .dot { background: var(--brand); border-color: var(--brand); color: #fff; }
.ep-life .step.current .dot { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-subtle); color: var(--brand); }
.ep-life .step.current .lab { color: var(--brand); font-weight: 600; }
.ep-life .step::before, .ep-life .step::after { content: ""; position: absolute; top: 10px; height: 2px; background: var(--border-default); z-index: 1; }
.ep-life .step::before { left: 0; right: 50%; } .ep-life .step::after { left: 50%; right: 0; }
.ep-life .step:first-child::before, .ep-life .step:last-child::after { display: none; }
.ep-life .step.done::before, .ep-life .step.done::after, .ep-life .step.current::before { background: var(--brand); }
.ep-foot { display: flex; align-items: center; gap: 12px; padding: 16px 24px; border-top: 1px solid var(--border-default); flex-shrink: 0; }
.ep-foot .ep-note { font-size: 12px; color: var(--fg-3); max-width: 44ch; line-height: 1.45; }
.ep-foot .grow { flex: 1; }
/* intermediate estimate detail - the builder's Format D grid, read-only customer view */
.ep-break-lab { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--fg-3); margin: 4px 0 8px; }
.ep-gridwrap { overflow-x: auto; border: 1px solid var(--border-default); border-radius: var(--r-md); }
.ep-grid { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.ep-grid thead th { font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--fg-3); text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--border-default); white-space: nowrap; }
.ep-grid th.num, .ep-grid td.num { text-align: right; }
.ep-grid th.ctr, .ep-grid td.ctr { text-align: center; }
.ep-grid tbody td { padding: 6px 12px; border-bottom: 1px solid var(--border-subtle); vertical-align: middle; color: var(--fg-2); }
.ep-grid tbody tr:last-child td { border-bottom: none; }
.ep-grid .sec-row td { background: #2F3C4E; color: #fff; font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; padding: 7px 12px; border: none; }
.ep-grid .sec-row .sub { float: right; color: #fff; font-variant-numeric: tabular-nums; letter-spacing: 0; }
.ep-grid .prod { font-weight: 500; color: var(--fg-1); white-space: nowrap; }
.ep-grid td.rate, .ep-grid td.total { text-align: right; font-variant-numeric: tabular-nums; color: var(--fg-1); white-space: nowrap; }
.ep-grid td.total { font-weight: 600; }
.ep-grid tfoot td { padding: 11px 12px; border-top: 2px solid var(--border-default); background: var(--surface-secondary); }
.ep-grid tfoot .lab { text-transform: uppercase; font-size: 11px; font-weight: 700; letter-spacing: .05em; color: var(--fg-2); }
.ep-grid tfoot .amt { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; font-size: 14.5px; color: var(--fg-1); white-space: nowrap; }

@media (max-width: 720px) { .ep-stats { grid-template-columns: 1fr 1fr; } .ep-foot .ep-note { display: none; } }
