/* ECOS Pacific — Quote Pipeline
   Brand: green #70AB2C, blue #0276C9, deep blue #015A9A.
   The logo PNG has a white background baked in, so it never sits on a colored fill. */

:root {
  --green: #70AB2C;
  --green-dk: #5C8F22;
  --blue: #0276C9;
  --blue-dk: #015A9A;
  --tint-blue: #D9EBF9;
  --tint-green: #E7F2D9;

  --bg: #F4F6F8;
  --surface: #FFFFFF;
  --surface-2: #FAFBFC;
  --line: #DFE4E9;
  --line-strong: #C6CED6;
  --text: #1B2733;
  --text-dim: #5D6B79;
  --text-faint: #8494A2;

  --high: #B0342C;
  --high-bg: #FCEAE8;
  --med: #C77700;
  --med-bg: #FDF2E0;
  --low: #6B7A88;
  --low-bg: #EEF1F4;

  --radius: 10px;
  --shadow: 0 1px 2px rgba(20,35,50,.06), 0 4px 14px rgba(20,35,50,.06);
  --shadow-lg: 0 10px 40px rgba(20,35,50,.18);
  --font: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12181E;
    --surface: #1A222B;
    --surface-2: #212B35;
    --line: #2C3945;
    --line-strong: #3C4B59;
    --text: #E8EDF2;
    --text-dim: #A3B1BE;
    --text-faint: #788997;
    --tint-blue: #16324A;
    --tint-green: #24371A;
    --high-bg: #3A1E1B;
    --med-bg: #3A2C12;
    --low-bg: #232D37;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 14px rgba(0,0,0,.3);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -.01em; }

/* ------------------------------------------------------------------ header */

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 12px 20px;
  background: #FFFFFF;               /* always white — the logo demands it */
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.logo { height: 34px; width: auto; display: block; }
.brand-divider { width: 1px; height: 26px; background: #DFE4E9; }
.brand-title { font-weight: 650; font-size: 16px; color: #1B2733; letter-spacing: -.01em; white-space: nowrap; }
.brandbar { height: 4px; background: linear-gradient(to right, var(--blue) 0%, var(--blue) 62%, var(--green) 62%, var(--green) 100%); }

.topbar-right { display: flex; align-items: center; gap: 12px; }
.who { display: flex; align-items: center; gap: 7px; font-size: 13px; color: #5D6B79; }
.who select {
  border: 1px solid #DFE4E9; background: #fff; color: #1B2733;
  border-radius: 7px; padding: 5px 9px; font: inherit; font-size: 13px;
}

.wrap { max-width: 1240px; margin: 0 auto; padding: 22px 20px 60px; }

/* ------------------------------------------------------------------ buttons */

.btn {
  font: inherit; font-size: 14px; font-weight: 550;
  border-radius: 8px; padding: 9px 16px; border: 1px solid transparent;
  cursor: pointer; white-space: nowrap; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: background .12s, border-color .12s, transform .04s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-dk); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--text-faint); }
.btn-danger { background: transparent; color: var(--high); border-color: var(--high); }
.btn-danger:hover { background: var(--high-bg); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.icon-btn {
  background: none; border: none; font-size: 26px; line-height: 1;
  color: var(--text-faint); cursor: pointer; padding: 2px 8px; border-radius: 6px;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

/* ------------------------------------------------------------------ tiles */

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 20px; }
.tile {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow);
  border-top: 3px solid var(--blue);
}
.tile.green { border-top-color: var(--green); }
.tile.warn  { border-top-color: var(--med); }
.tile-label { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint); font-weight: 600; }
.tile-value { font-size: 27px; font-weight: 680; margin-top: 5px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.tile-sub { font-size: 12.5px; color: var(--text-dim); margin-top: 3px; }

/* ------------------------------------------------------------------ panels */

.panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 20px; overflow: hidden;
}
.panel.attention { border-left: 4px solid var(--med); }
.panel-head {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 16px; border-bottom: 1px solid var(--line); background: var(--surface-2);
}
.panel-head h2 { font-size: 15px; }
.count-pill {
  background: var(--med); color: #fff; font-size: 12px; font-weight: 650;
  border-radius: 999px; padding: 2px 9px; min-width: 22px; text-align: center;
}

.attention-list { display: flex; flex-direction: column; }
.attn-row {
  display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center;
  padding: 11px 16px; border-bottom: 1px solid var(--line); cursor: pointer;
}
.attn-row:last-child { border-bottom: none; }
.attn-row:hover { background: var(--surface-2); }
.attn-main { min-width: 0; }
.attn-title { font-weight: 600; font-size: 14.5px; }
.attn-title .ref { color: var(--text-faint); font-weight: 500; font-size: 13px; margin-right: 7px; font-variant-numeric: tabular-nums; }
.attn-why { font-size: 13px; color: var(--text-dim); margin-top: 2px; }
.attn-right { text-align: right; white-space: nowrap; }
.attn-amount { font-weight: 640; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ auth */

.auth-body {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 100vh; padding: 24px 16px; background: var(--bg);
}
.auth-card {
  width: 100%; max-width: 420px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); overflow: hidden;
}
.auth-brand { background: #fff; padding: 22px 26px 18px; }   /* logo needs white */
.auth-logo { height: 38px; width: auto; display: block; }
.auth-bar { height: 4px; background: linear-gradient(to right, var(--blue) 0%, var(--blue) 62%, var(--green) 62%, var(--green) 100%); }
.auth-inner { padding: 24px 26px 28px; }
.auth-inner h1 { font-size: 20px; }
.auth-sub { margin: 6px 0 20px; font-size: 14px; color: var(--text-dim); line-height: 1.5; }

.auth-inner label {
  display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-faint); font-weight: 600; margin-bottom: 15px;
}
.auth-inner label input {
  display: block; width: 100%; margin-top: 5px; font: inherit; font-size: 15px;
  text-transform: none; letter-spacing: normal; font-weight: 400; color: var(--text);
  padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface-2);
}
.auth-inner label input:focus { outline: 2px solid var(--blue); outline-offset: -1px; border-color: var(--blue); }
.auth-inner .hint {
  display: block; margin-top: 5px; font-size: 11.5px; color: var(--text-faint);
  text-transform: none; letter-spacing: normal; font-weight: 400;
}
.auth-submit { width: 100%; margin-top: 4px; padding: 11px; font-size: 15px; }
.auth-switch { margin: 16px 0 0; font-size: 13.5px; color: var(--text-dim); text-align: center; }
.linkbtn {
  background: none; border: none; padding: 0; font: inherit; font-size: inherit;
  color: var(--blue); cursor: pointer; text-decoration: underline;
}
.auth-msg {
  border-radius: 8px; padding: 10px 13px; font-size: 13.5px; margin-bottom: 16px; line-height: 1.5;
  background: var(--high-bg); color: var(--high); border-left: 3px solid var(--high);
}
.auth-msg.good { background: var(--tint-green); color: var(--green-dk); border-left-color: var(--green); }
.auth-msg[hidden] { display: none; }
.auth-foot { margin-top: 22px; font-size: 11.5px; color: var(--text-faint); text-align: center; max-width: 420px; }

/* ------------------------------------------------------------------ estimate */

.est-grid { display: grid; grid-template-columns: 1.15fr 1fr; gap: 20px; align-items: start; }
.est-body { padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.est-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.est-field { display: flex; flex-direction: column; gap: 5px; font-size: 12px;
             text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); font-weight: 600; }
.est-field.wide { grid-column: 1 / -1; }
.est-label { font-size: 12px; text-transform: uppercase; letter-spacing: .05em;
             color: var(--text-faint); font-weight: 600; }
.est-label em { text-transform: none; letter-spacing: normal; font-weight: 400; color: var(--text-faint); }
.est-field input, .est-field select {
  font: inherit; font-size: 16px; font-weight: 500; text-transform: none; letter-spacing: normal;
  padding: 9px 12px; border-radius: 8px; border: 1px solid var(--line-strong);
  background: var(--surface-2); color: var(--text); width: 100%;
}
.est-field input:focus, .est-field select:focus { outline: 2px solid var(--blue); outline-offset: -1px; }
.est-hint { font-size: 12px; text-transform: none; letter-spacing: normal;
            font-weight: 400; color: var(--text-faint); }
.est-seg { display: inline-flex; }
.est-seg .seg-btn { padding: 7px 16px; font-size: 13.5px; }

.est-discount { display: flex; align-items: center; gap: 14px; }
.est-discount input[type=range] { flex: 1; accent-color: var(--med); }
.est-discount output { font-family: var(--mono, Consolas, monospace); font-size: 17px;
  font-weight: 700; color: var(--med); min-width: 52px; text-align: right;
  font-variant-numeric: tabular-nums; }

.est-search { display: grid; grid-template-columns: 1fr 78px; gap: 8px; align-items: center; }
.est-search input {
  font: inherit; font-size: 14.5px; padding: 10px 12px; border-radius: 8px;
  border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text); width: 100%;
}
.est-search input:focus { outline: 2px solid var(--blue); outline-offset: -1px; }

.est-chips { display: flex; gap: 5px; flex-wrap: wrap; margin-top: -4px; }
.est-chips .chip { font-size: 12px; padding: 4px 10px; }

.est-results {
  max-height: 300px; overflow-y: auto; border: 1px solid var(--line);
  border-radius: 8px; background: var(--surface);
}
.est-hit {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  width: 100%; text-align: left; font: inherit; cursor: pointer;
  padding: 8px 12px; background: none; border: none;
  border-bottom: 1px solid var(--rule-soft, var(--line));
}
.est-hit:last-child { border-bottom: none; }
.est-hit:hover, .est-hit:focus { background: var(--tint-blue); outline: none; }
.est-hit-name { font-size: 14px; color: var(--text); }
.est-hit-meta { font-size: 12px; color: var(--text-faint); white-space: nowrap;
  font-variant-numeric: tabular-nums; }

.est-items { display: flex; flex-direction: column; border: 1px solid var(--line);
  border-radius: 8px; overflow: hidden; }
.est-item-group { background: var(--surface-2); padding: 6px 12px; font-size: 10.5px;
  text-transform: uppercase; letter-spacing: .07em; color: var(--text-faint); font-weight: 600;
  border-bottom: 1px solid var(--line); }
.est-item { display: grid; grid-template-columns: 74px 1fr auto; gap: 10px; align-items: center;
  padding: 7px 12px; border-bottom: 1px solid var(--rule-soft, var(--line)); }
.est-item:last-child { border-bottom: none; }
.est-item:hover { background: var(--surface-2); }
.est-item-qty { font: inherit; font-size: 14.5px; font-weight: 600; text-align: right;
  padding: 6px 8px; border-radius: 6px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--text); width: 100%;
  font-variant-numeric: tabular-nums; }
.est-item-qty:focus { outline: 2px solid var(--blue); outline-offset: -1px; }
.est-item-name { font-size: 14px; min-width: 0; }
.est-item-meta { display: block; font-size: 11.5px; color: var(--text-faint); }
.est-item-x { background: none; border: none; color: var(--text-faint); cursor: pointer;
  font-size: 19px; line-height: 1; padding: 0 4px; }
.est-item-x:hover { color: var(--high); }
.est-empty { margin: 0; padding: 18px 14px; font-size: 13.5px; color: var(--text-faint);
  font-style: italic; text-align: center; }

.est-presets summary { font-size: 13px; color: var(--blue); cursor: pointer; }
.est-preset-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 9px; }

.est-result { position: sticky; top: 16px; padding: 20px; }
.est-headline { padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.est-price { font-size: 42px; font-weight: 700; letter-spacing: -.03em;
             font-variant-numeric: tabular-nums; line-height: 1.05; }
.est-sub { font-size: 13.5px; color: var(--text-dim); margin-top: 5px; }
.est-discount-row { margin-top: 12px; padding: 10px 13px; border-radius: 8px;
  background: var(--med-bg); color: var(--med); font-size: 13.5px; line-height: 1.5; }
.est-breakdown { margin-top: 14px; display: flex; flex-direction: column; gap: 7px; font-size: 14px; }
.est-breakdown div { display: flex; justify-content: space-between; gap: 12px; }
.est-breakdown .b-total { border-top: 1px solid var(--line); padding-top: 8px;
  font-weight: 650; font-size: 15px; }
.est-breakdown b, .est-breakdown span:last-child { font-variant-numeric: tabular-nums; }
.est-headroom { margin-top: 14px; padding: 11px 13px; border-radius: 8px;
  background: var(--surface-2); border-left: 3px solid var(--green);
  font-size: 13px; color: var(--text-dim); line-height: 1.55; }
.est-headroom.warn { border-left-color: var(--high); background: var(--high-bg); color: var(--high); }
.est-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.est-actions .btn { width: 100%; }
.est-export-note { margin-top: 10px; line-height: 1.5; }

/* Printing the Estimate tab: drop the app chrome and the input controls,
   keep the price, the breakdown and the line detail. */
@media print {
  body { background: #fff; }
  .topbar, .brandbar, .foot, .viewtabs, .whoami-menu,
  #todayView, #boardView, #reportsView, #teamView,
  .est-inputs, .est-actions, .est-export-note, #estReset,
  .drawer, .scrim, .toast { display: none !important; }

  .wrap { max-width: none; padding: 0; }
  .est-grid { display: block; }
  .est-result { position: static; border: none; box-shadow: none; padding: 0 0 14px;
                border-bottom: 2px solid #16202B; }
  .est-price { font-size: 30pt; }
  .panel { border: none; box-shadow: none; }
  .panel-head { padding-left: 0; background: none; border-bottom: 1px solid #D8DFE6; }
  figure.viz, .viz-body { padding: 0; }
  .today-head h1 { font-size: 17pt; }

  table.est-table { font-size: 9pt; }
  table.est-table th, table.est-table td { padding: 5px 10px 5px 0; }
  tr, .est-result { break-inside: avoid; }
}

table.est-table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
table.est-table th, table.est-table td { padding: 7px 12px 7px 0; text-align: left;
  border-bottom: 1px solid var(--rule-soft, var(--line)); white-space: nowrap; }
table.est-table th { font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-faint); font-weight: 600; }
table.est-table td.n { text-align: right; font-variant-numeric: tabular-nums; }
table.est-table th.n { text-align: right; }

@media (max-width: 900px) {
  .est-grid { grid-template-columns: 1fr; }
  .est-result { position: static; }
}
@media (max-width: 640px) {
  .est-row { grid-template-columns: 1fr; }
  .est-price { font-size: 34px; }
}

/* ------------------------------------------------------------------ team */

.team-row {
  display: grid; grid-template-columns: 1fr auto auto; gap: 14px; align-items: center;
  padding: 12px 16px; border-bottom: 1px solid var(--line);
}
.team-row:last-child { border-bottom: none; }
.team-name { font-weight: 600; font-size: 14.5px; }
.team-email { font-size: 13px; color: var(--text-dim); }
.team-meta { font-size: 12px; color: var(--text-faint); text-align: right; white-space: nowrap; }
.team-actions { display: flex; gap: 7px; }
.pill {
  font-size: 11px; font-weight: 650; border-radius: 5px; padding: 2px 8px;
  text-transform: uppercase; letter-spacing: .04em;
}
.pill.active { background: var(--tint-green); color: var(--green-dk); }
.pill.pending { background: var(--med-bg); color: var(--med); }
.pill.disabled { background: var(--low-bg); color: var(--low); }
.pill.invited { background: var(--tint-blue); color: var(--blue-dk); }
.pill.owner { background: var(--tint-blue); color: var(--blue-dk); }

.whoami-menu { display: flex; align-items: center; gap: 10px; font-size: 13px; color: #5D6B79; }
.whoami-name { font-weight: 600; color: #1B2733; }

/* ------------------------------------------------------------------ today */

.today-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.today-head h1 { font-size: 21px; }
.today-head p { margin: 3px 0 0; font-size: 14px; color: var(--text-dim); }
.today-mine label { display: flex; align-items: center; gap: 7px; font-size: 13.5px; color: var(--text-dim); cursor: pointer; }

.tab-badge {
  display: inline-block; margin-left: 6px; background: var(--med); color: #fff;
  font-size: 10.5px; font-weight: 700; border-radius: 999px; padding: 1px 6px; vertical-align: 1px;
}
.viewtab.on .tab-badge { background: var(--med); }

.today-panel { border-left: 4px solid var(--line-strong); }
.today-panel.sev-high { border-left-color: var(--high); }
.today-panel.sev-medium { border-left-color: var(--med); }
.today-panel.sev-low { border-left-color: var(--blue); }
.count-pill.sev-high { background: var(--high); }
.count-pill.sev-medium { background: var(--med); }
.count-pill.sev-low { background: var(--blue); }

.today-row {
  display: grid; grid-template-columns: 1fr auto auto; gap: 14px; align-items: center;
  padding: 12px 16px; border-bottom: 1px solid var(--line);
}
.today-row:last-child { border-bottom: none; }
.today-row:hover { background: var(--surface-2); }
.today-main { min-width: 0; cursor: pointer; }
.today-title { font-weight: 600; font-size: 14.5px; }
.today-title .ref { color: var(--text-faint); font-weight: 500; font-size: 12.5px; margin-right: 7px; font-variant-numeric: tabular-nums; }
.today-why { font-size: 13px; color: var(--text-dim); margin-top: 2px; }
.today-right { text-align: right; white-space: nowrap; }
.today-amount { font-weight: 640; font-variant-numeric: tabular-nums; }
.today-stage { font-size: 12px; color: var(--text-faint); }
.today-actions { display: flex; gap: 7px; align-items: center; }
.snooze {
  font: inherit; font-size: 13px; padding: 6px 9px; border-radius: 8px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text-dim); cursor: pointer;
}

.all-clear { display: flex; align-items: center; gap: 16px; padding: 28px 24px; border-left: 4px solid var(--green); }
.all-clear-mark {
  width: 42px; height: 42px; border-radius: 50%; background: var(--tint-green); color: var(--green-dk);
  display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 700; flex: none;
}
.all-clear-text { font-size: 15px; color: var(--text); }

.archtoggle { display: flex; align-items: center; gap: 7px; font-size: 13.5px; color: var(--text-dim); cursor: pointer; white-space: nowrap; }
.archive-note { font-size: 12.5px; color: var(--text-faint); margin: -6px 0 14px; line-height: 1.5; }

@media (max-width: 640px) {
  .today-row { grid-template-columns: 1fr auto; }
  .today-actions { grid-column: 1 / -1; }
  .today-actions .btn, .snooze { flex: 1; }
}

/* ------------------------------------------------------------------ controls */

.controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
#search {
  flex: 1 1 240px; min-width: 200px; font: inherit; font-size: 14px;
  padding: 9px 13px; border-radius: 8px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
}
#search:focus { outline: 2px solid var(--blue); outline-offset: -1px; border-color: var(--blue); }
.controls-right { display: flex; gap: 8px; align-items: center; margin-left: auto; }
#sortBy {
  font: inherit; font-size: 13.5px; padding: 8px 11px; border-radius: 8px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); cursor: pointer;
}

.filter-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  font: inherit; font-size: 13px; font-weight: 550; cursor: pointer;
  border-radius: 999px; padding: 5px 12px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text-dim);
  display: inline-flex; align-items: center; gap: 6px;
}
.chip:hover { border-color: var(--text-faint); }
.chip.on { background: var(--blue); border-color: var(--blue); color: #fff; }
.chip .n { font-size: 11.5px; opacity: .75; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ board */

.stage-group { margin-bottom: 18px; }
.stage-head {
  display: flex; align-items: center; gap: 10px; padding: 6px 2px 9px; cursor: pointer; user-select: none;
}
.stage-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.stage-name { font-weight: 650; font-size: 14px; }
.stage-count { font-size: 12.5px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.stage-total { margin-left: auto; font-size: 13px; color: var(--text-dim); font-variant-numeric: tabular-nums; font-weight: 550; }
.stage-hint { font-size: 12.5px; color: var(--text-faint); font-style: italic; }
.caret { font-size: 11px; color: var(--text-faint); width: 12px; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 10px; }

.card {
  background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--line-strong);
  border-radius: var(--radius); padding: 12px 14px; cursor: pointer;
  box-shadow: var(--shadow); transition: border-color .12s, transform .06s;
}
.card:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.card.sev-high { border-left-color: var(--high); }
.card.sev-medium { border-left-color: var(--med); }
.card.sev-low { border-left-color: var(--low); }

.card-top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.card-ref { font-size: 12px; color: var(--text-faint); font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.card-amount { font-weight: 660; font-variant-numeric: tabular-nums; white-space: nowrap; }
.card-customer { font-weight: 640; font-size: 15px; margin-top: 3px; }
.card-title { font-size: 13.5px; color: var(--text-dim); margin-top: 1px; }
.card-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 9px; font-size: 12px; color: var(--text-faint); align-items: center; }
.tag {
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 5px; padding: 1.5px 7px; font-size: 11.5px; color: var(--text-dim);
}
.card-flags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px; }
.flag {
  font-size: 11.5px; font-weight: 600; border-radius: 5px; padding: 2.5px 8px;
  background: var(--low-bg); color: var(--low);
}
.flag.high { background: var(--high-bg); color: var(--high); }
.flag.medium { background: var(--med-bg); color: var(--med); }

.empty-hint {
  text-align: center; color: var(--text-dim); font-size: 14.5px;
  max-width: 560px; margin: 50px auto; line-height: 1.6;
}

/* ------------------------------------------------------------------ drawer */

.scrim { position: fixed; inset: 0; background: rgba(15,25,35,.45); z-index: 40; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw);
  background: var(--bg); z-index: 50; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; border-left: 1px solid var(--line);
}
/* A class rule with display:flex outranks the browser's [hidden] rule, so say it again. */
.drawer[hidden], .scrim[hidden], .panel[hidden], .toast[hidden] { display: none; }
.drawer-head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
  padding: 16px 18px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.drawer-ref { font-size: 12px; color: var(--text-faint); font-variant-numeric: tabular-nums; letter-spacing: .03em; }
.drawer-head h2 { font-size: 18px; margin-top: 2px; }
.drawer-sub { font-size: 14px; color: var(--text-dim); margin-top: 3px; }
.drawer-body { overflow-y: auto; padding: 16px 18px 40px; flex: 1; }

.stage-strip { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 12px; }




.flag-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.quick-actions { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }

.field-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1px;
  background: var(--line); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; margin-bottom: 18px;
}
.fld { background: var(--surface); padding: 9px 12px; min-width: 0; }
.fld.wide { grid-column: 1 / -1; }
.fld label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); font-weight: 600; margin-bottom: 3px; }
.fld input, .fld select, .fld textarea {
  width: 100%; font: inherit; font-size: 14px; border: none; background: transparent;
  color: var(--text); padding: 2px 0; border-bottom: 1px dashed transparent; resize: vertical;
}
.fld input:hover, .fld select:hover, .fld textarea:hover { border-bottom-color: var(--line-strong); }
.fld input:focus, .fld select:focus, .fld textarea:focus { outline: none; border-bottom: 1px solid var(--blue); }
.fld select { cursor: pointer; }

.drawer-section { margin-bottom: 20px; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; }
.section-head h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); }

.file-list { display: flex; flex-direction: column; gap: 6px; }
.file-row {
  display: flex; align-items: center; gap: 10px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px;
}
.file-row a { color: var(--blue); text-decoration: none; font-weight: 550; font-size: 14px; word-break: break-all; }
.file-row a:hover { text-decoration: underline; }
.file-name-btn {
  background: none; border: none; padding: 0; cursor: pointer; text-align: left;
  color: var(--blue); font: inherit; font-weight: 550; font-size: 14px; word-break: break-all;
}
.file-name-btn:hover { text-decoration: underline; }
.file-row .file-x { text-decoration: none; font-size: 14px; }
.tag-ticket { border-color: var(--blue); color: var(--blue); }
.ticket-link { color: var(--blue); text-decoration: none; font-weight: 550; white-space: nowrap; }
.ticket-link:hover { text-decoration: underline; }
.file-meta { font-size: 12px; color: var(--text-faint); margin-left: auto; white-space: nowrap; }
.file-x { background: none; border: none; color: var(--text-faint); cursor: pointer; font-size: 17px; padding: 0 3px; }
.file-x:hover { color: var(--high); }
.file-empty { font-size: 13.5px; color: var(--text-faint); font-style: italic; padding: 4px 0; }

.note-add { display: flex; gap: 7px; margin-bottom: 12px; }
.note-add input {
  flex: 1; font: inherit; font-size: 14px; padding: 8px 11px; border-radius: 8px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
}
.note-add input:focus { outline: 2px solid var(--blue); outline-offset: -1px; }

.timeline { list-style: none; margin: 0; padding: 0 0 0 16px; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 14px 14px; }
.timeline li::before {
  content: ''; position: absolute; left: -21px; top: 5px;
  width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong);
  border: 2px solid var(--bg);
}
.timeline li.kind-stage::before { background: var(--blue); }
.timeline li.kind-note::before { background: var(--green); }
.timeline li.kind-followup::before { background: var(--med); }
.tl-detail { font-size: 14px; }
.tl-meta { font-size: 12px; color: var(--text-faint); margin-top: 1px; }

.drawer-danger { border-top: 1px solid var(--line); padding-top: 14px; }

/* ------------------------------------------------------------------ modals */

.modal {
  border: none; border-radius: 14px; padding: 0; max-width: 560px; width: calc(100vw - 32px);
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
}
.modal::backdrop { background: rgba(15,25,35,.5); }
.modal form { padding: 22px 24px 20px; }
.modal h2 { font-size: 19px; }
.modal-sub { font-size: 13.5px; color: var(--text-dim); margin: 5px 0 18px; }
.modal label { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-faint); font-weight: 600; margin-bottom: 13px; }
.modal label input, .modal label select, .modal label textarea {
  display: block; width: 100%; margin-top: 4px; font: inherit; font-size: 14.5px;
  text-transform: none; letter-spacing: normal; color: var(--text);
  padding: 8px 11px; border-radius: 8px; border: 1px solid var(--line-strong);
  background: var(--surface-2); font-weight: 400;
}
.modal label input:focus, .modal label select:focus, .modal label textarea:focus {
  outline: 2px solid var(--blue); outline-offset: -1px; border-color: var(--blue);
}
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.req { color: var(--high); }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 6px; }

/* ------------------------------------------------------------------ misc */

.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: #1B2733; color: #fff; padding: 11px 20px; border-radius: 9px;
  font-size: 14px; z-index: 100; box-shadow: var(--shadow-lg); max-width: 90vw;
}
.toast.err { background: var(--high); }

/* ------------------------------------------------------------------ reports
   Palette validated with the dataviz validator against these exact surfaces.
   Won/lost is aqua/orange, NOT green/red: green vs red measures CVD ΔE 4.1,
   which red-green colorblind readers cannot separate. Aqua/orange/blue scored
   9.2 worst all-pairs and still reads as good / bad / pending.
   Light-mode aqua, yellow and magenta sit under 3:1 on white, so every chart
   ships direct value labels and a table view — that is the required relief. */

:root {
  --c-won:  #1baf7a;  --c-lost: #eb6834;  --c-open: #2a78d6;
  --c-s1: #2a78d6; --c-s2: #eb6834; --c-s3: #1baf7a; --c-s4: #eda100; --c-s5: #e87ba4;
  --viz-grid: #E1E0D9; --viz-axis: #C3C2B7; --viz-ink: #52514E; --viz-muted: #898781;
  --viz-surface: #FFFFFF;
}
@media (prefers-color-scheme: dark) {
  :root {
    --c-won:  #199e70;  --c-lost: #d95926;  --c-open: #3987e5;
    --c-s1: #3987e5; --c-s2: #d95926; --c-s3: #199e70; --c-s4: #c98500; --c-s5: #d55181;
    --viz-grid: #2C3945; --viz-axis: #3C4B59; --viz-ink: #A3B1BE; --viz-muted: #788997;
    --viz-surface: #1A222B;
  }
}

.viewtabs { display: flex; gap: 2px; background: #EEF1F4; border-radius: 8px; padding: 3px; }
.viewtab {
  font: inherit; font-size: 13.5px; font-weight: 550; cursor: pointer;
  border: none; background: none; color: #5D6B79; padding: 5px 14px; border-radius: 6px;
}
.viewtab.on { background: #fff; color: #0276C9; box-shadow: 0 1px 2px rgba(20,35,50,.12); }

.report-bar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.seg { display: flex; gap: 2px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 3px; }
.seg-btn {
  font: inherit; font-size: 13px; font-weight: 550; cursor: pointer; border: none;
  background: none; color: var(--text-dim); padding: 5px 13px; border-radius: 6px;
}
.seg-btn.on { background: var(--blue); color: #fff; }
#rangeMonths {
  font: inherit; font-size: 13.5px; padding: 8px 11px; border-radius: 8px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); cursor: pointer;
}
.tabletoggle { display: flex; align-items: center; gap: 7px; font-size: 13.5px; color: var(--text-dim); cursor: pointer; }

.thin-warning {
  background: var(--med-bg); border-left: 3px solid var(--med); color: var(--text);
  border-radius: 8px; padding: 11px 15px; font-size: 13.5px; margin: 0 0 18px; line-height: 1.5;
}

figure.viz { margin: 0 0 20px; padding: 16px 18px 18px; }
figure.viz figcaption { margin-bottom: 14px; }
figure.viz figcaption h2 { font-size: 15px; }
figure.viz figcaption p { margin: 4px 0 0; font-size: 13px; color: var(--text-dim); line-height: 1.5; max-width: 78ch; }
.viz-body { width: 100%; overflow-x: auto; }
.viz-two { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }

.viz-mark { transition: opacity .1s; }
.viz-mark:hover { opacity: .82; cursor: default; }
text.viz-tick  { font-size: 11px; fill: var(--viz-muted); font-variant-numeric: tabular-nums; }
text.viz-value { font-size: 11px; font-weight: 620; fill: var(--viz-ink); font-variant-numeric: tabular-nums; }
text.viz-cat   { font-size: 12px; fill: var(--viz-ink); }

.viz-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 12px; padding-left: 4px; }
.viz-legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-dim); }
.viz-swatch { width: 11px; height: 11px; border-radius: 3px; flex: none; }
.viz-empty { font-size: 13.5px; color: var(--text-faint); font-style: italic; padding: 24px 4px; margin: 0; }

.viz-tip {
  position: fixed; z-index: 200; pointer-events: none;
  background: #1B2733; color: #fff; border-radius: 7px; padding: 8px 11px;
  font-size: 12.5px; line-height: 1.45; box-shadow: var(--shadow-lg); max-width: 240px;
}
.viz-tip-dim { color: #A3B1BE; }

.viz-table-wrap { overflow-x: auto; margin-top: 14px; }
.viz-table { border-collapse: collapse; width: 100%; font-size: 13px; }
.viz-table th, .viz-table td { padding: 6px 11px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.viz-table th { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); font-weight: 600; }
.viz-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.viz-table tbody tr:hover { background: var(--surface-2); }

@media (max-width: 900px) {
  .viz-two { grid-template-columns: 1fr; }
}

.foot {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center;
  padding: 18px 20px 26px; font-size: 12px; color: var(--text-faint);
  border-top: 1px solid var(--line); background: var(--surface); text-align: center;
}
.foot-logo { height: 20px; width: auto; background: #fff; padding: 2px 4px; border-radius: 3px; }
.foot a { color: var(--blue); text-decoration: none; }
.foot a:hover { text-decoration: underline; }
.foot-sep { opacity: .5; }

@media (max-width: 640px) {
  .wrap { padding: 16px 12px 50px; }
  .topbar { padding: 10px 13px; }
  .brand-title { display: none; }
  .brand-divider { display: none; }
  .cards { grid-template-columns: 1fr; }
  .field-grid { grid-template-columns: 1fr; }
  .row-2 { grid-template-columns: 1fr; }
  .controls-right { margin-left: 0; width: 100%; }
  #sortBy { flex: 1; }
  .drawer { width: 100vw; }
  /* Two-up so the attention list is reachable without scrolling on a phone. */
  .tiles { grid-template-columns: 1fr 1fr; gap: 8px; }
  .tile { padding: 10px 12px; }
  .tile-value { font-size: 20px; }
  .tile-label { font-size: 10.5px; }
  .tile-sub { font-size: 11.5px; }
  .attn-row { grid-template-columns: 1fr auto; padding: 10px 13px; }
  .attn-title { font-size: 13.5px; }
}


/* ---------------------------------------------------------------- jobs */
/* Palette note: green/red is avoided for status the way it is on the quote
   board — ~8% of men have a red-green deficiency, and "are we over hours" is
   exactly the signal that must not depend on hue alone. Over-budget carries a
   word as well as a colour. */

.head-actions { display: flex; gap: 8px; }

.job-group { margin: 0 0 22px; }
.job-group-head { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; }
.job-group-head h2 { font-size: 15px; margin: 0; letter-spacing: .01em; }
.job-group-head .count {
  font-size: 12px; font-weight: 600; color: var(--text-dim);
  background: var(--low-bg); border-radius: 10px; padding: 1px 7px;
}
.job-group-head .group-hint { font-size: 12px; margin-left: 4px; }
.stage-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }

.job-card {
  background: var(--surface); border: 1px solid var(--line); border-left: 3px solid transparent;
  border-radius: 10px; padding: 12px 14px; margin-bottom: 8px; cursor: pointer;
  transition: border-color .12s, box-shadow .12s;
}
.job-card:hover { box-shadow: 0 1px 6px rgba(0,0,0,.07); border-color: var(--line-strong); }
.job-card.sev-high { border-left-color: #B0342C; }
.job-card.sev-medium { border-left-color: #C77700; }

.job-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.job-title { min-width: 0; }
.job-ref { font-size: 12px; font-variant-numeric: tabular-nums; flex: none; }
.job-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 7px 0 0; }

/* Burn bar. Width is the reading; the label repeats it in words so the bar is
   never the only carrier of meaning. */
.burn { margin-top: 9px; }
.burn-track { height: 5px; border-radius: 3px; background: var(--low-bg); overflow: hidden; }
.burn-fill { height: 100%; border-radius: 3px; transition: width .2s; }
.burn-ok   { background: #0276C9; }
.burn-near { background: #C77700; }
.burn-over { background: #B0342C; }
.burn-label { display: inline-block; margin-top: 5px; font-size: 12px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.burn-label.burn-near { color: #8A5400; font-weight: 600; }
.burn-label.burn-over { color: #B0342C; font-weight: 600; }

.job-flags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.flag { font-size: 11.5px; padding: 2px 8px; border-radius: 10px; font-weight: 600; }
.flag-high   { background: #FBE9E7; color: #8E2A22; }
.flag-medium { background: #FDF3E2; color: #8A5400; }
.flag-low    { background: var(--low-bg); color: var(--text-dim); }
.closed-note { margin-top: 6px; font-size: 12.5px; }

/* billing run */
.billing-run { margin-bottom: 20px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; }
.billrow {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 11px 0; border-top: 1px solid var(--line); flex-wrap: wrap;
}
.billrow-main { min-width: 240px; flex: 1; }
.billrow-form { display: flex; align-items: center; gap: 6px; }
.pct-input { width: 62px; }
.amt-input { width: 110px; font-variant-numeric: tabular-nums; }

/* job drawer */


.stage-btn {
  font: inherit; font-size: 12.5px; padding: 5px 11px; border-radius: 999px; cursor: pointer;
  background: var(--surface); border: 1.5px solid var(--line); color: var(--text-dim);
}
.stage-btn.on { color: var(--text); font-weight: 600; border-width: 1.5px; }
.stage-btn:hover { border-color: var(--text-dim); }








@media (max-width: 760px) { .job-cols { grid-template-columns: 1fr; } }

.inline-form { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 10px; }
.inline-form input[type=number] { width: 92px; }
.inline-form input[type=text] { flex: 1; min-width: 110px; }
.chk { display: flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--text-dim); }

.loglist { display: flex; flex-direction: column; }
.logrow {
  display: flex; align-items: center; gap: 10px; padding: 6px 0;
  border-top: 1px solid var(--line); font-size: 13px;
}
.logrow-date { font-variant-numeric: tabular-nums; color: var(--text-dim); flex: none; width: 88px; }
.logrow-main { flex: 1; font-variant-numeric: tabular-nums; }
.linkbtn {
  background: none; border: 0; padding: 0; font: inherit; font-size: 12px;
  color: var(--blue); cursor: pointer; text-decoration: underline;
}
.linkbtn.paid { color: var(--text-dim); text-decoration: none; }
.two-up { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.small { font-size: 12px; }
.tile-bad .tile-value { color: #B0342C; }

/* jobs on Today, and the calibration table */
.today-row.clickable { cursor: pointer; }
.today-row-flags { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }

.cal-lead { display: flex; align-items: center; gap: 16px; margin: 6px 0 4px; }
.cal-ratio {
  font-size: 34px; font-weight: 650; font-variant-numeric: tabular-nums;
  line-height: 1; color: #0276C9;
}
.cal-ratio.cal-over { color: #B0342C; }
.cal-lead-text { font-size: 14px; max-width: 46ch; }

.cal-table { width: 100%; border-collapse: collapse; margin-top: 14px; font-size: 13.5px; }
.cal-table th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-dim); font-weight: 600; padding: 0 10px 6px 0; border-bottom: 1px solid var(--line);
}
.cal-table td { padding: 7px 10px 7px 0; border-bottom: 1px solid var(--line); }
.cal-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.cal-table td.cal-over { color: #B0342C; font-weight: 600; }

/* ---------------------------------------------------------------- job drawer
   Rebuilt: the first pass was six wrapping pills, one lonely stat and two
   columns of unequal weight. Structure now carries the meaning — a stepper for
   sequence, a fixed four-up stat row, and two columns that stay balanced. */

.dlg-job {
  max-width: 900px; width: min(94vw, 900px);
  padding: 0; border: 1px solid var(--line); border-radius: 14px;
  background: var(--surface); color: var(--text);
  box-shadow: var(--shadow-lg);
  font: 14px/1.5 var(--font);
}
.dlg-job::backdrop { background: rgba(12,18,24,.44); }

.jd-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: 20px 24px 16px; border-bottom: 1px solid var(--line);
}
.jd-head h2 { margin: 0; font-size: 20px; line-height: 1.25; }
.jd-sub { margin: 3px 0 0; font-size: 13px; color: var(--text-dim); }
.jd-x {
  flex: none; width: 30px; height: 30px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--line); background: transparent; color: var(--text-dim);
  font-size: 19px; line-height: 1; display: grid; place-items: center;
}
.jd-x:hover { background: var(--low-bg); color: var(--text); }

/* stepper */
.jd-steps {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  gap: 0; padding: 16px 24px 4px;
}
.jd-step {
  position: relative; background: none; border: 0; cursor: pointer;
  padding: 0 0 6px; font: inherit; text-align: center; color: var(--text-dim);
}
/* the connecting rail, drawn behind the dots */
.jd-step::before {
  content: ''; position: absolute; top: 5px; left: -50%; width: 100%; height: 2px;
  background: var(--line);
}
.jd-step:first-child::before { display: none; }
.jd-step.done::before, .jd-step.on::before { background: #0276C9; }
.jd-step-dot {
  position: relative; display: block; width: 12px; height: 12px; margin: 0 auto 7px;
  border-radius: 50%; background: var(--surface);
  box-shadow: inset 0 0 0 2px var(--line); transition: box-shadow .12s, background .12s;
}
.jd-step.done .jd-step-dot { background: #0276C9; box-shadow: inset 0 0 0 2px #0276C9; }
.jd-step.on .jd-step-dot {
  background: #0276C9; box-shadow: inset 0 0 0 2px #0276C9, 0 0 0 4px rgba(2,118,201,.18);
}
.jd-step-label { font-size: 11.5px; line-height: 1.25; display: block; }
.jd-step.on .jd-step-label { color: var(--text); font-weight: 650; }
.jd-step:hover .jd-step-label { color: var(--text); }

/* four-up stats */
.jd-stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px;
  margin: 18px 24px 0; background: var(--line);
  border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
}
.jd-stat { background: var(--surface); padding: 12px 14px; }
.jd-stat-value { font-size: 19px; font-weight: 650; font-variant-numeric: tabular-nums; line-height: 1.2; }
.jd-stat-label {
  margin-top: 3px; font-size: 10.5px; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: var(--text-dim);
}
.jd-stat-hint { margin-top: 2px; font-size: 11.5px; color: var(--text-dim); }
.jd-stat-bad .jd-stat-value { color: #B0342C; }
.jd-stat-warn .jd-stat-value { color: #8A5400; }

#jobDlgFlags:not(:empty) { padding: 12px 24px 0; }

/* columns */
.jd-cols {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0;
  margin-top: 18px; border-top: 1px solid var(--line);
}
.jd-col { padding: 16px 24px 20px; min-width: 0; }
.jd-col + .jd-col { border-left: 1px solid var(--line); }
.jd-col h3 {
  display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
  margin: 0 0 10px; font-size: 11.5px; font-weight: 650;
  letter-spacing: .06em; text-transform: uppercase; color: var(--text-dim);
}
.jd-col-note { font-size: 11.5px; font-weight: 500; letter-spacing: 0; text-transform: none; }

/* forms: a grid, so fields line up instead of wrapping wherever they land */
/* Every field is labelled. Placeholders vanish the moment someone types, so a
   form that relies on them stops explaining itself exactly when it matters —
   which is how a dollar amount got entered into the percent-complete box. */
.jd-form { display: grid; gap: 8px 8px; align-items: end; }
.jd-form > label {
  display: block; min-width: 0; font-size: 10.5px; font-weight: 600;
  letter-spacing: .05em; text-transform: uppercase; color: var(--text-faint);
}
.jd-form > label > input, .jd-form > label > select { margin-top: 4px; }
.jd-form-time { grid-template-columns: 1.3fr .65fr 1fr auto; }
.jd-form-time > label.wide { grid-column: 1 / 4; }
.jd-form-time > button { grid-column: 4; grid-row: 2; }
.jd-form-bill { grid-template-columns: .8fr 1.1fr .9fr; }
.jd-form-bill > .chk { grid-column: 1 / 3; text-transform: none; letter-spacing: 0; font-size: 12.5px; }
.jd-form-bill > button { grid-column: 3; grid-row: 2; }
.jd-math {
  margin: 8px 0 0; font-size: 12px; color: var(--text-dim);
  font-variant-numeric: tabular-nums; line-height: 1.45;
}
.jd-math.bad { color: var(--high); font-weight: 600; }
.jd-form input, .jd-form select {
  width: 100%; min-width: 0; font: inherit; font-size: 13px; padding: 6px 8px;
  border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--text);
}
.jd-form input:focus, .jd-form select:focus { outline: 2px solid rgba(2,118,201,.4); outline-offset: -1px; }
.jd-hint { margin: 9px 0 0; font-size: 11.5px; color: var(--text-dim); line-height: 1.45; }

.jd-novalue {
  background: var(--low-bg); border-radius: 9px; padding: 12px; margin-bottom: 12px;
}
.jd-novalue p { margin: 0 0 8px; font-size: 12.5px; color: var(--text-dim); }
.jd-novalue .jd-form { grid-template-columns: 1fr auto; }

.jd-foot {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 14px 24px; border-top: 1px solid var(--line); background: var(--low-bg);
  border-radius: 0 0 14px 14px;
}
.jd-foot .btn:disabled { opacity: .55; cursor: not-allowed; }

@media (max-width: 780px) {
  .jd-stats { grid-template-columns: repeat(2, 1fr); }
  .jd-cols { grid-template-columns: 1fr; }
  .jd-col + .jd-col { border-left: 0; border-top: 1px solid var(--line); }
  .jd-step-label { font-size: 10px; }
}

/* Helper classes the jobs UI assumed existed. Defining them here rather than
   rewriting every call site, since they are genuinely useful names — but they
   are deliberately thin wrappers over the palette the rest of the app uses. */
.muted { color: var(--text-dim); }
.jd-head-main { min-width: 0; }
.today-row-main { min-width: 0; flex: 1; }
.chip-muted { background: var(--low-bg); color: var(--text-dim); }
.chip-link { background: var(--tint-blue); color: var(--blue-dk); text-decoration: none; }
.chip-link:hover { text-decoration: underline; }
.chip-warn { background: var(--med-bg); color: var(--med); }

/* completed work — the week's tail, styled as settled rather than urgent */
.today-panel.sev-done { border-left-color: var(--green); }
.count-pill.sev-done { background: var(--tint-green); color: var(--green-dk); }
.flag-done { background: var(--tint-green); color: var(--green-dk); }
.today-foot {
  margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line);
  font-size: 12.5px; color: var(--text-dim); font-variant-numeric: tabular-nums;
}

/* dates and owner */
.jd-details {
  display: grid; grid-template-columns: repeat(4, 1fr) auto; gap: 10px; align-items: end;
  padding: 16px 24px 0;
}
.jd-details label {
  display: block; font-size: 10.5px; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: var(--text-faint);
}
.jd-details input, .jd-details select {
  display: block; width: 100%; margin-top: 4px; font: inherit; font-size: 13px;
  padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px;
  background: var(--surface); color: var(--text);
}
/* the field standing between this job and its next stage */
.jd-details label.needed { color: var(--med); }
.jd-details label.needed input, .jd-details label.needed select {
  border-color: var(--med); background: var(--med-bg);
}
.jd-step.blocked { cursor: not-allowed; }
.jd-step.blocked .jd-step-label { color: var(--text-faint); }
.jd-step.blocked .jd-step-dot { box-shadow: inset 0 0 0 2px var(--line); opacity: .55; }
@media (max-width: 780px) { .jd-details { grid-template-columns: 1fr 1fr; } }

/* The drawer must never grow past the viewport: the footer carries the close
   action and the reason a job cannot close, and both were being pushed off
   screen on shorter displays.
   ---
   display MUST be scoped to [open]. A bare `display: flex` on a <dialog>
   overrides the browser's own `dialog:not([open]) { display: none }`, so the
   dialog renders inline in the page forever — empty, un-closable, and sitting
   below the footer. This exact mistake bit the quote drawer earlier in the
   project; a dialog's display rule always belongs behind [open]. */
.dlg-job[open] { max-height: 92vh; display: flex; flex-direction: column; }
.dlg-job:not([open]) { display: none; }
.dlg-job > .jd-cols { overflow-y: auto; min-height: 0; }
.dlg-job > .jd-foot { margin-top: auto; }

/* The stat row and the fixed chrome must not be squeezed by the flex column —
   only the two log columns scroll. Without this the stats got clipped mid-row. */
.dlg-job[open] > .jd-head,
.dlg-job[open] > .jd-steps,
.dlg-job[open] > .jd-stats,
.dlg-job[open] > .jd-details,
.dlg-job[open] > #jobDlgFlags,
.dlg-job[open] > .jd-foot { flex: none; }

/* editing an invoice in place */
.billrow-log + .billrow-log { border-top: 1px solid var(--line); }
.billrow-log .logrow { border-top: 0; }
.jd-form-editinv {
  grid-template-columns: 1fr 1fr 1fr 1fr; gap: 8px;
  padding: 10px 12px 12px; margin: 0 0 8px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px;
}
.jd-form-editinv > .chk { grid-column: 1 / 3; text-transform: none; letter-spacing: 0; font-size: 12.5px; }
.jd-form-editinv > .btn { grid-column: 3; }
.jd-form-editinv > .danger { grid-column: 4; justify-self: end; color: var(--high); }
@media (max-width: 780px) { .jd-form-editinv { grid-template-columns: 1fr 1fr; } }
.pill.tech { background: var(--tint-green); color: var(--green-dk); }
