/* ============================================================
   DavoBuild OS — design system v2
   Editorial / architectural: warm paper, deep ink, amber signal.
   ============================================================ */
:root {
  --ink:        #11161a;
  --ink-2:      #171e23;
  --ink-3:      #212a31;
  --ink-4:      #2c3840;
  --ink-line:   #2f3a42;
  --paper:      #f4f2ed;
  --paper-2:    #faf9f6;
  --white:      #ffffff;
  --rule:       #e3dfd6;
  --rule-soft:  #eeebe3;
  --text:       #151a1e;
  --text-2:     #3d464d;
  --muted:      #6d757c;
  --muted-2:    #98a0a5;
  --amber:      #d4802a;
  --amber-deep: #a75f16;
  --amber-wash: #fdf4e8;
  --amber-line: #f0dcc0;
  --teal:       #1c6f62;
  --teal-wash:  #e9f3f0;
  --red:        #b44127;
  --red-wash:   #fbebe6;
  --blue:       #2b5680;
  --blue-wash:  #ecf1f7;
  --green:      #2a7048;
  --green-wash: #eaf4ee;

  --r-sm: 7px;
  --r:    10px;
  --r-lg: 14px;

  --sh-1: 0 1px 2px rgba(17,22,26,.05);
  --sh-2: 0 2px 8px rgba(17,22,26,.06), 0 1px 2px rgba(17,22,26,.04);
  --sh-3: 0 18px 40px -16px rgba(17,22,26,.28), 0 2px 6px rgba(17,22,26,.05);

  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4, p { margin: 0; }
svg { display: block; flex: 0 0 auto; }
svg:not([width]):not([height]) { width: 14px; height: 14px; }

/* ---------------- shell ---------------- */
.app { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; }

/* ---------------- sidebar ---------------- */
.sidebar {
  background: var(--ink);
  color: #c8d0d5;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
}
.brand {
  display: flex; align-items: center; gap: 11px;
  padding: 20px 18px 18px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px;
  background: linear-gradient(155deg, #e9a04c, #c9761d);
  color: #1b1105; display: grid; place-items: center;
  font-weight: 800; font-size: 15px; letter-spacing: -.4px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.4), 0 2px 6px rgba(0,0,0,.35);
  flex: 0 0 auto;
}
.brand-name { color: #fff; font-size: 14.5px; font-weight: 700; letter-spacing: -.25px; line-height: 1.15; }
.brand-sub { color: #7c8890; font-size: 9.5px; letter-spacing: .11em; text-transform: uppercase; margin-top: 4px; font-weight: 600; }

.nav { flex: 1; overflow-y: auto; padding: 14px 12px 20px; }
.nav-label {
  color: #66737b; font-size: 9.5px; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; padding: 14px 10px 8px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 9px 10px; margin-bottom: 2px;
  background: transparent; border: 0; border-radius: var(--r-sm);
  color: #b3bdc3; font-size: 13px; font-weight: 500; text-align: left;
  transition: background .13s ease, color .13s ease;
}
.nav-item svg { width: 15px; height: 15px; opacity: .75; }
.nav-item span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item:hover { background: rgba(255,255,255,.055); color: #fff; }
.nav-item:hover svg { opacity: .95; }
.nav-item.active {
  background: rgba(255,255,255,.085);
  color: #fff;
  box-shadow: inset 2px 0 0 var(--amber);
}
.nav-item.active svg { color: #f0a552; opacity: 1; }
.nav-badge {
  flex: 0 0 auto; min-width: 18px; text-align: center;
  font-size: 10px; font-weight: 800; padding: 1px 6px; border-radius: 20px;
  background: var(--amber); color: #21160a;
}
.nav-badge.subtle { background: rgba(255,255,255,.14); color: #d5dce0; }

.sidebar-foot {
  border-top: 1px solid rgba(255,255,255,.07);
  padding: 13px 16px; display: flex; align-items: center; gap: 10px;
}
.avatar {
  width: 28px; height: 28px; border-radius: 50%; flex: 0 0 auto;
  background: #2c3841; color: #dfe6ea; display: grid; place-items: center;
  font-size: 10.5px; font-weight: 700; letter-spacing: .02em;
}
.sidebar-foot .who { color: #eaeff2; font-size: 12px; font-weight: 600; line-height: 1.25; }
.sidebar-foot .role { color: #78858d; font-size: 10.5px; margin-top: 2px; }

/* ---------------- main / topbar ---------------- */
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 62px; flex: 0 0 auto;
  display: flex; align-items: center; gap: 12px;
  padding: 0 26px;
  background: rgba(250,249,246,.92);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--rule);
  position: sticky; top: 0; z-index: 30;
}
.topbar-spacer { flex: 1; }

.project-switch { position: relative; min-width: 0; }
.ps-btn {
  display: flex; align-items: center; gap: 10px;
  max-width: 540px; padding: 7px 11px;
  background: var(--white); border: 1px solid var(--rule);
  border-radius: var(--r); box-shadow: var(--sh-1);
}
.ps-btn:hover { border-color: #cfc8bc; }
.ps-code {
  flex: 0 0 auto; white-space: nowrap;
  font-family: var(--mono); font-size: 10px; font-weight: 700; letter-spacing: .02em;
  background: var(--ink); color: #f7f4ee; padding: 3px 7px; border-radius: 5px;
}
.ps-name {
  font-size: 12.8px; font-weight: 600; letter-spacing: -.1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ps-menu {
  position: absolute; top: calc(100% + 8px); left: 0; width: 480px;
  background: var(--white); border: 1px solid var(--rule); border-radius: var(--r);
  box-shadow: var(--sh-3); padding: 6px; z-index: 60;
}
.ps-option { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 10px 11px; border-radius: var(--r-sm); }
.ps-option:hover { background: var(--paper); }
.ps-option.active { background: var(--amber-wash); }
.ps-option .t { font-size: 12.8px; font-weight: 650; letter-spacing: -.1px; }
.ps-option .s { font-size: 11.5px; color: var(--muted); margin-top: 3px; }

.searchbox {
  display: flex; align-items: center; gap: 8px;
  height: 34px; width: 250px; padding: 0 11px;
  background: var(--white); border: 1px solid var(--rule); border-radius: var(--r);
  color: var(--muted-2); box-shadow: var(--sh-1);
}
.searchbox input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 12.8px; color: var(--text); }
.searchbox input::placeholder { color: var(--muted-2); }

.icon-btn {
  width: 34px; height: 34px; flex: 0 0 auto;
  display: grid; place-items: center; position: relative;
  background: var(--white); border: 1px solid var(--rule); border-radius: var(--r);
  color: var(--text-2); box-shadow: var(--sh-1);
}
.icon-btn:hover { border-color: #cfc8bc; color: var(--text); }
.dot-badge { position: absolute; top: 7px; right: 8px; width: 6px; height: 6px; border-radius: 50%; background: var(--red); border: 1.5px solid #fff; }

/* ---------------- buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 34px; padding: 0 14px; border-radius: var(--r);
  border: 1px solid var(--rule); background: var(--white); color: var(--text);
  font-size: 12.8px; font-weight: 600; letter-spacing: -.05px; white-space: nowrap;
  box-shadow: var(--sh-1); transition: background .13s, border-color .13s, transform .06s;
}
.btn:hover { background: #fdfcfa; border-color: #cfc8bc; }
.btn:active { transform: translateY(.5px); }
.btn svg { width: 13px; height: 13px; }
.btn-primary { background: var(--ink); border-color: var(--ink); color: #fff; box-shadow: 0 1px 2px rgba(17,22,26,.25); }
.btn-primary:hover { background: #000; border-color: #000; }
.btn-amber { background: linear-gradient(180deg, #e18e35, #d07f28); border-color: #bb6c1c; color: #2a1a06; box-shadow: 0 1px 2px rgba(120,70,10,.22); }
.btn-amber:hover { background: linear-gradient(180deg, #e59745, #d6842c); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn-ghost:hover { background: rgba(17,22,26,.05); border-color: transparent; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 11.8px; border-radius: var(--r-sm); gap: 5px; }
.btn-sm svg { width: 11px; height: 11px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.w100 { width: 100%; }

/* ---------------- content ---------------- */
.content { padding: 26px 26px 56px; width: 100%; max-width: 1320px; margin: 0 auto; }

.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 20px; }
.page-title { font-size: 26px; font-weight: 700; letter-spacing: -.75px; line-height: 1.15; }
.page-sub { font-size: 13px; color: var(--muted); margin-top: 5px; max-width: 720px; line-height: 1.5; }
.page-head .spacer { flex: 1; }
.page-actions { display: flex; gap: 8px; flex: 0 0 auto; }

/* ---------------- hero ---------------- */
.hero {
  position: relative; overflow: hidden;
  border-radius: var(--r-lg); border: 1px solid #0d1215;
  min-height: 186px; display: flex; flex-direction: column; justify-content: flex-end;
  color: #fff; box-shadow: var(--sh-2);
  background: #182026 url("/hero.jpg") center 62% / cover no-repeat;
}
.hero::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(105deg, rgba(9,13,16,.94) 0%, rgba(9,13,16,.8) 42%, rgba(9,13,16,.34) 100%);
}
.hero-inner { position: relative; z-index: 1; padding: 22px 24px; display: flex; gap: 24px; align-items: flex-end; }
.hero-main { flex: 1; min-width: 0; }
.hero-eyebrow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 9px; }
.hero-code {
  font-family: var(--mono); font-size: 10px; font-weight: 700; letter-spacing: .04em;
  background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.18);
  color: #fff; padding: 3px 7px; border-radius: 5px;
}
.hero-tag {
  font-size: 10.5px; font-weight: 700; letter-spacing: .02em;
  background: rgba(224,138,46,.16); border: 1px solid rgba(240,166,80,.42);
  color: #f6c489; padding: 3px 8px; border-radius: 20px;
  display: inline-flex; align-items: center; gap: 5px;
}
.hero-tag .pip { width: 5px; height: 5px; border-radius: 50%; background: #f0a552; }
.hero-title { font-size: 22px; font-weight: 700; letter-spacing: -.6px; line-height: 1.2; }
.hero-meta { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 8px; font-size: 12.2px; color: rgba(255,255,255,.68); }
.hero-meta span { display: inline-flex; align-items: center; gap: 5px; }
.hero-meta svg { width: 12px; height: 12px; opacity: .7; }
.hero-progress { margin-top: 14px; max-width: 460px; }
.hero-bar { height: 5px; border-radius: 4px; background: rgba(255,255,255,.26); overflow: hidden; box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); }
.hero-bar > i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, #e0973f, #f0b96f); }
.hero-progress .lbl { display: flex; justify-content: space-between; font-size: 10.5px; color: rgba(255,255,255,.62); margin-bottom: 6px; letter-spacing: .02em; }
.hero-side { display: flex; gap: 10px; flex: 0 0 auto; }
.hero-stat {
  background: rgba(10,14,17,.6); border: 1px solid rgba(255,255,255,.16);
  border-radius: var(--r); padding: 10px 13px; min-width: 118px;
  backdrop-filter: blur(4px);
}
.hero-stat .l { font-size: 9.5px; text-transform: uppercase; letter-spacing: .09em; color: rgba(255,255,255,.6); font-weight: 700; }
.hero-stat .v { font-size: 16px; font-weight: 700; letter-spacing: -.3px; margin-top: 4px; font-variant-numeric: tabular-nums; }
.hero-stat .s { font-size: 10.5px; color: rgba(255,255,255,.55); margin-top: 2px; }

/* ---------------- cards ---------------- */
.card {
  background: var(--white); border: 1px solid var(--rule); border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
}
.card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 15px 18px; border-bottom: 1px solid var(--rule-soft);
}
.card-head h3 { font-size: 13.5px; font-weight: 650; letter-spacing: -.15px; }
.card-head .sub { font-size: 11.8px; color: var(--muted); }
.card-head .spacer { flex: 1; }
.card-body { padding: 18px; }
.card-body.tight { padding: 0; }
.card-foot { padding: 12px 18px; border-top: 1px solid var(--rule-soft); background: #fcfbf8; }

.grid { display: grid; gap: 16px; }
.g4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.g2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.g-2-1 { grid-template-columns: minmax(0,1.85fr) minmax(0,1fr); }
.g-1-2 { grid-template-columns: minmax(0,1fr) minmax(0,2fr); }
.g-3-1 { grid-template-columns: minmax(0,2.6fr) minmax(0,1fr); }
@media (max-width: 1360px) {
  .ps-btn { max-width: 400px; }
}
@media (max-width: 1180px) {
  .searchbox { display: none; }
}
@media (max-width: 1240px) {
  .g4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .g3 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .g-2-1, .g-1-2, .g-3-1 { grid-template-columns: minmax(0,1fr); }
  .searchbox { width: 190px; }
}

/* ---------------- ledger (KPI strip) ---------------- */
.ledger {
  display: grid; grid-template-columns: repeat(4, minmax(0,1fr));
  background: var(--white); border: 1px solid var(--rule); border-radius: var(--r-lg);
  box-shadow: var(--sh-1); overflow: hidden;
}
@media (max-width: 1100px) { .ledger { grid-template-columns: repeat(2, minmax(0,1fr)); } }
.ledger-cell { padding: 17px 18px 16px; border-right: 1px solid var(--rule-soft); position: relative; }
.ledger-cell:last-child { border-right: 0; }
.ledger-cell.flag { background: linear-gradient(180deg, #fffaf2, #fff); }
.ledger-cell.flag::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px; background: var(--amber); }
.ledger-cell.risk { background: linear-gradient(180deg, #fdf7f5, #fff); }
.ledger-label {
  display: flex; align-items: center; gap: 6px;
  font-size: 10px; font-weight: 700; letter-spacing: .085em; text-transform: uppercase;
  color: var(--muted);
}
.ledger-label svg { width: 12px; height: 12px; color: var(--amber); }
.ledger-value {
  font-size: 27px; font-weight: 700; letter-spacing: -.9px; line-height: 1.1;
  margin-top: 9px; font-variant-numeric: tabular-nums;
}
.ledger-value .unit { font-size: 13px; font-weight: 600; letter-spacing: 0; color: var(--muted); }
.ledger-note { font-size: 11.5px; color: var(--muted); margin-top: 7px; line-height: 1.45; }
.ledger-note b { color: var(--text-2); font-weight: 650; }
.ledger-delta { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 20px; margin-top: 8px; }
.ledger-delta.bad { background: var(--red-wash); color: var(--red); }
.ledger-delta.good { background: var(--green-wash); color: var(--green); }
.ledger-delta.warn { background: var(--amber-wash); color: var(--amber-deep); }

/* legacy kpi (used in secondary views) */
.kpi { background: var(--white); border: 1px solid var(--rule); border-radius: var(--r-lg); padding: 16px 18px; box-shadow: var(--sh-1); }
.kpi.alert { background: linear-gradient(180deg, #fffaf2, #fff); border-color: var(--amber-line); }
.kpi.risk { background: linear-gradient(180deg, #fdf7f5, #fff); border-color: #efd8d1; }
.kpi-label { display: flex; align-items: center; gap: 6px; font-size: 10px; font-weight: 700; letter-spacing: .085em; text-transform: uppercase; color: var(--muted); }
.kpi-label svg { width: 12px; height: 12px; color: var(--amber); }
.kpi-value { font-size: 25px; font-weight: 700; letter-spacing: -.8px; margin-top: 8px; line-height: 1.12; font-variant-numeric: tabular-nums; }
.kpi-value .unit { font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.kpi-foot { font-size: 11.5px; color: var(--muted); margin-top: 7px; line-height: 1.45; }
.kpi-foot b, .kpi-foot strong { color: var(--text-2); font-weight: 650; }

/* ---------------- queue list ---------------- */
.queue { display: flex; flex-direction: column; }
.q-row {
  display: grid; grid-template-columns: 26px minmax(0,1fr) auto;
  gap: 14px; align-items: center;
  padding: 14px 18px; border-bottom: 1px solid var(--rule-soft);
  cursor: pointer; transition: background .12s;
}
.q-row:last-child { border-bottom: 0; }
.q-row:hover { background: #fdfcf9; }
.q-icon {
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: var(--paper); color: var(--muted); border: 1px solid var(--rule);
}
.q-icon svg { width: 12px; height: 12px; }
.q-icon.pending { background: var(--amber-wash); border-color: var(--amber-line); color: var(--amber-deep); }
.q-icon.approved { background: var(--green-wash); border-color: #cfe5d8; color: var(--green); }
.q-icon.risk { background: var(--red-wash); border-color: #f0d5cc; color: var(--red); }
.q-tags { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 5px; }
.q-title { font-size: 13.2px; font-weight: 600; letter-spacing: -.1px; line-height: 1.35; }
.q-meta { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.q-right { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 7px; }
.q-value { font-family: var(--mono); font-size: 13.5px; font-weight: 700; letter-spacing: -.2px; font-variant-numeric: tabular-nums; }

/* ---------------- badges / chips ---------------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .01em;
  padding: 2.5px 8px; border-radius: 20px; border: 1px solid transparent;
  white-space: nowrap;
}
.badge .pip { width: 5px; height: 5px; border-radius: 50%; background: currentColor; flex: 0 0 auto; }
.badge.pending { background: var(--amber-wash); color: #9a5710; border-color: var(--amber-line); }
.badge.approved { background: var(--green-wash); color: var(--green); border-color: #cfe5d8; }
.badge.billed { background: var(--blue-wash); color: var(--blue); border-color: #d3e0ee; }
.badge.rejected { background: var(--red-wash); color: var(--red); border-color: #f0d5cc; }
.badge.neutral { background: #f2f0eb; color: var(--muted); border-color: var(--rule); }
.badge.teal { background: var(--teal-wash); color: var(--teal); border-color: #cfe4df; }

.chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10.5px; font-weight: 600; color: var(--text-2);
  background: #f5f3ee; border: 1px solid var(--rule); border-radius: 5px;
  padding: 2px 6px; white-space: nowrap;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis;
}
.chip.warn { background: var(--amber-wash); color: #95550f; border-color: var(--amber-line); }

/* ---------------- tables ---------------- */
table { width: 100%; border-collapse: collapse; }
table.cols { table-layout: fixed; }
thead th {
  text-align: left; font-size: 9.5px; font-weight: 700; letter-spacing: .09em;
  text-transform: uppercase; color: var(--muted);
  padding: 10px 16px; background: #fbfaf7;
  border-bottom: 1px solid var(--rule); white-space: nowrap;
}
tbody td { padding: 13px 16px; border-bottom: 1px solid var(--rule-soft); vertical-align: middle; font-size: 13px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover { background: #fdfcf9; }
td.num, th.num, .num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--mono); font-size: 12.6px; white-space: nowrap; }
td.num { color: var(--text); }
.ref { font-family: var(--mono); font-size: 11.2px; font-weight: 700; color: var(--muted); white-space: nowrap; letter-spacing: .01em; }
.cell-title { font-size: 13px; font-weight: 600; letter-spacing: -.1px; line-height: 1.35; }
.cell-sub { font-size: 11.6px; color: var(--muted); margin-top: 3px; line-height: 1.4; }
.cell-clip { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tfoot-row td {
  background: #fbfaf7; font-weight: 700; font-size: 12.3px;
  border-top: 1px solid var(--rule); border-bottom: 0; padding: 13px 16px;
}
.tfoot-row td.num { font-size: 12.8px; }

/* row status rail */
td.rail { width: 3px; padding: 0; }
td.rail i { display: block; width: 3px; height: 26px; border-radius: 3px; }

/* ---------------- drawer ---------------- */
.drawer-scrim {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(13,17,20,.44);
  backdrop-filter: blur(2px);
  animation: fadeIn .16s ease-out;
}
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 700px; max-width: 94vw;
  z-index: 90; display: flex; flex-direction: column;
  background: var(--paper-2); box-shadow: -30px 0 70px rgba(13,17,20,.3);
  animation: slideIn .22s cubic-bezier(.22,.8,.3,1);
}
@keyframes slideIn { from { transform: translateX(30px); opacity: .7; } to { transform: none; opacity: 1; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.drawer-head {
  flex: 0 0 auto; padding: 18px 22px; background: var(--white);
  border-bottom: 1px solid var(--rule); display: flex; gap: 14px; align-items: flex-start;
}
.drawer-body { flex: 1; overflow-y: auto; padding: 20px 22px 28px; }
.drawer-foot {
  flex: 0 0 auto; padding: 14px 22px; background: var(--white);
  border-top: 1px solid var(--rule); display: flex; gap: 9px; align-items: center;
}
.drawer-foot .spacer { flex: 1; }

/* ---------------- forms ---------------- */
.field { margin-bottom: 15px; }
.field > label {
  display: block; font-size: 10px; font-weight: 700; letter-spacing: .085em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 6px;
}
.input, textarea.input, select.input {
  width: 100%; padding: 9px 11px; font-size: 13.2px;
  background: var(--white); border: 1px solid var(--rule); border-radius: var(--r-sm);
  outline: 0; box-shadow: var(--sh-1);
  transition: border-color .12s, box-shadow .12s;
}
.input:focus, textarea.input:focus, select.input:focus { border-color: var(--amber); box-shadow: 0 0 0 3px rgba(212,128,42,.15); }
textarea.input { min-height: 82px; resize: vertical; line-height: 1.55; }
.input-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.input-row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.help { font-size: 11.2px; color: var(--muted-2); margin-top: 5px; line-height: 1.45; }
.signature-pad {
  min-height: 78px; display: grid; place-items: center; padding: 18px 14px;
  background: #fffefb; border: 1.5px dashed #cfc8bb; border-radius: var(--r);
  font-family: "Segoe Script", "Bradley Hand", cursive; font-size: 22px; color: #22303a;
  letter-spacing: .5px;
}
.signature-pad.filled { border: 1px solid #b9d8c5; background: #fbfdfb; }

/* ---------------- notices ---------------- */
.notice { display: flex; align-items: flex-start; gap: 10px; padding: 11px 13px; border-radius: var(--r); font-size: 12.4px; line-height: 1.5; }
.notice svg { width: 15px; height: 15px; margin-top: 1px; }
.notice b, .notice strong { font-weight: 700; }
.notice.warn { background: var(--amber-wash); border: 1px solid var(--amber-line); color: #7b4a0d; }
.notice.danger { background: var(--red-wash); border: 1px solid #f0d5cc; color: #8f3520; }
.notice.info { background: var(--blue-wash); border: 1px solid #d3e0ee; color: #234669; }
.notice.ok { background: var(--green-wash); border: 1px solid #cfe5d8; color: #235c3b; }

/* ---------------- misc ---------------- */
.section-label { font-size: 9.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 22px 0 9px; }
.divider { height: 1px; background: var(--rule-soft); margin: 16px 0; }
.empty { padding: 34px 18px; text-align: center; color: var(--muted); font-size: 12.6px; }
.empty svg { width: 24px; height: 24px; opacity: .3; margin: 0 auto 10px; }
.kv { display: grid; grid-template-columns: 132px minmax(0,1fr); gap: 9px 14px; font-size: 12.8px; align-items: baseline; }
.kv dt { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; font-weight: 500; }
.bar { height: 6px; border-radius: 4px; background: #eeebe4; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 4px; background: var(--teal); }
.bar > i.amber { background: var(--amber); }
.bar > i.red { background: var(--red); }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.small { font-size: 11.8px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.flex { display: flex; }
.aic { align-items: center; }
.gap6 { gap: 6px; } .gap8 { gap: 8px; } .gap10 { gap: 10px; } .gap14 { gap: 14px; }
.mt4 { margin-top: 4px; } .mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; } .mt20 { margin-top: 20px; }
.mb0 { margin-bottom: 0; }

.toast-wrap { position: fixed; bottom: 88px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  display: flex; align-items: center; gap: 9px;
  background: var(--ink); color: #f6f3ed; padding: 10px 16px; border-radius: var(--r);
  font-size: 12.8px; font-weight: 500; box-shadow: var(--sh-3);
  animation: toastIn .18s ease-out;
}
.toast svg { width: 14px; height: 14px; color: #7fd0a2; }
@keyframes toastIn { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------------- gantt ---------------- */
.gantt { overflow: visible; }
.gantt-head, .gantt-row { display: grid; grid-template-columns: 264px repeat(24, minmax(0,1fr)); align-items: stretch; }
.gantt-head { background: #fbfaf7; border-bottom: 1px solid var(--rule); position: sticky; top: 62px; z-index: 5; }
.gantt-head .lbl { font-size: 9.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); padding: 10px 18px; align-self: center; }
.gantt-head .wk { font-family: var(--mono); font-size: 9px; font-weight: 600; color: var(--muted-2); text-align: center; padding: 10px 0; border-left: 1px solid var(--rule-soft); align-self: center; }
.gantt-head .wk.milestone { color: var(--text); font-weight: 800; }
.gantt-row { border-bottom: 1px solid var(--rule-soft); }
.gantt-row:last-child { border-bottom: 0; }
.gantt-row:hover { background: #fdfcf9; }
.gantt-task { padding: 14px 18px; border-right: 1px solid var(--rule-soft); }
.gantt-task .t { font-size: 12.6px; font-weight: 600; letter-spacing: -.1px; line-height: 1.35; }
.gantt-task .s { font-size: 11px; color: var(--muted); margin-top: 3px; }
.gantt-track { grid-column: 2 / -1; position: relative; min-height: 58px; }
.gantt-track .cell-line { position: absolute; top: 0; bottom: 0; width: 1px; background: #f2efe9; }
.gbar {
  position: absolute; top: 19px; height: 20px; border-radius: 5px;
  display: flex; align-items: center; padding: 0 7px;
  font-size: 9.5px; font-weight: 800; color: #fff; letter-spacing: .02em;
  box-shadow: 0 1px 2px rgba(17,22,26,.18); overflow: hidden; white-space: nowrap;
}
.gbar.done { background: #9aa5ab; }
.gbar.progress { background: var(--teal); }
.gbar.impacted { background: var(--amber); color: #2c1c07; }
.gbar.sched { background: #d3dbe0; color: #3c4750; }
.gbar-eot {
  position: absolute; top: 19px; height: 20px; border-radius: 0 5px 5px 0;
  background: repeating-linear-gradient(45deg, #f6ddbd 0 4px, #fdf1e0 4px 8px);
  border: 1px solid #edc79a; border-left: 0;
}
.today-line { position: absolute; top: 0; bottom: 0; width: 2px; background: rgba(180,65,39,.55); }
.today-flag {
  position: absolute; top: 4px; transform: translateX(-50%);
  font-size: 8.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  color: var(--red); background: #fff; padding: 1px 5px; border-radius: 3px;
  border: 1px solid #f0d5cc; white-space: nowrap;
}

/* ---------------- selection compare ---------------- */
.opt-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; }
@media (max-width: 1000px) { .opt-grid { grid-template-columns: minmax(0,1fr); } }
.opt-card {
  position: relative; padding: 14px; border-radius: var(--r);
  border: 1.5px solid var(--rule); background: var(--white);
  cursor: pointer; transition: border-color .13s, box-shadow .13s, transform .13s;
  display: flex; flex-direction: column;
}
.opt-card:hover { border-color: #cbc4b7; box-shadow: var(--sh-2); }
.opt-card.selected { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(28,111,98,.1); }
.opt-card .swatch {
  height: 48px; border-radius: var(--r-sm); margin-bottom: 11px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #ece7dd, #f7f4ed);
  border: 1px solid #eae5db;
  font-size: 9px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: #948b7d;
  padding: 0 8px; text-align: center;
}
.opt-card .nm { font-size: 12.8px; font-weight: 650; line-height: 1.35; letter-spacing: -.1px; }
.opt-card .sup { font-size: 11px; color: var(--muted); margin-top: 4px; }
.opt-card .pr { font-size: 17px; font-weight: 700; letter-spacing: -.4px; margin-top: 10px; font-variant-numeric: tabular-nums; }
.opt-card .diff { font-size: 11px; font-weight: 700; margin-top: 3px; }
.opt-card .diff.over { color: var(--red); }
.opt-card .diff.under { color: var(--green); }
.opt-card .meta { font-size: 11px; color: var(--muted); line-height: 1.45; margin-top: auto; padding-top: 10px; border-top: 1px solid var(--rule-soft); }
.opt-card .diff { margin-bottom: 10px; }
.opt-pick {
  position: absolute; top: 10px; right: 10px; width: 19px; height: 19px; border-radius: 50%;
  background: var(--teal); color: #fff; display: grid; place-items: center;
  opacity: 0; transition: opacity .12s; box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.opt-pick svg { width: 11px; height: 11px; }
.opt-card.selected .opt-pick { opacity: 1; }

/* ---------------- approval flow ---------------- */
.flow { display: flex; align-items: center; flex-wrap: wrap; gap: 0; }
.flow-step { display: flex; align-items: center; gap: 7px; font-size: 11.2px; font-weight: 600; color: var(--muted-2); }
.flow-step .n { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; background: #efede7; color: var(--muted); font-size: 9.5px; font-weight: 800; }
.flow-step.done { color: var(--teal); }
.flow-step.done .n { background: var(--teal); color: #fff; }
.flow-step.now { color: var(--text); }
.flow-step.now .n { background: var(--amber); color: #2a1a06; }
.flow-sep { width: 24px; height: 1px; background: var(--rule); margin: 0 9px; }

/* ---------------- client portal ---------------- */
.portal-frame { border: 1px solid var(--rule); border-radius: var(--r-lg); overflow: hidden; background: var(--white); box-shadow: var(--sh-2); }
.portal-top { display: flex; align-items: center; gap: 12px; padding: 15px 20px; background: var(--ink); color: #fff; }
.portal-body { padding: 20px; background: #f7f5f0; }
.portal-card { background: var(--white); border: 1px solid var(--rule); border-radius: var(--r); padding: 16px; margin-bottom: 12px; }
.portal-card.pending { border-left: 3px solid var(--amber); }

/* ---------------- site diary ---------------- */
.log-item { display: grid; grid-template-columns: 92px minmax(0,1fr); gap: 16px; padding: 16px 18px; border-bottom: 1px solid var(--rule-soft); }
.log-item:last-child { border-bottom: 0; }
.log-date { font-family: var(--mono); font-size: 10.5px; color: var(--muted); font-weight: 600; line-height: 1.6; }
.log-note { font-size: 13px; line-height: 1.6; color: var(--text-2); }
.log-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; font-size: 11.5px; color: var(--muted); }
.ai-panel { padding: 14px; border-radius: var(--r); background: linear-gradient(180deg, #fffdf8, #fdf8f0); border: 1px solid var(--amber-line); }
.ai-tag {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 9.5px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase;
  color: #8f5311; background: #fff; border: 1px solid var(--amber-line);
  padding: 2.5px 7px; border-radius: 5px;
}
.ai-tag svg { width: 11px; height: 11px; }

/* ---------------- claim stages ---------------- */
.stage-row { display: grid; grid-template-columns: 26px minmax(0,1fr) auto; gap: 13px; align-items: center; padding: 13px 18px; border-bottom: 1px solid var(--rule-soft); }
.stage-row:last-child { border-bottom: 0; }
.stage-dot {
  width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  font-size: 9.5px; font-weight: 800; background: var(--white);
  border: 1.5px solid var(--rule); color: var(--muted-2);
}
.stage-dot svg { width: 11px; height: 11px; }
.stage-dot.paid { background: var(--green); border-color: var(--green); color: #fff; }
.stage-dot.ready { background: var(--amber); border-color: var(--amber); color: #2a1a06; }
.stage-dot.issued { background: var(--blue); border-color: var(--blue); color: #fff; }

@media (max-width: 1100px) {
  .gantt { overflow-x: auto; }
  .gantt-head, .gantt-row { min-width: 940px; }
}
/* grid alignment helper */
.align-start { align-items: start; }
/* compact inputs inside tables */
td .input { padding: 6px 8px; font-size: 12.4px; }

/* ============================================================
   ROLE GATING
   ============================================================ */
body[data-role="client"] .admin-only { display: none !important; }
body[data-role="admin"] .client-only { display: none !important; }

/* Sidebar utility buttons (tour / sign out) */
.sidebar-tools { padding: 6px 10px 8px; display: flex; gap: 6px; }
.tool-btn {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 5px;
  padding: 6px 8px; border-radius: var(--r-sm); border: 1px solid transparent;
  background: rgba(255,255,255,.05); color: #b9c1c7; cursor: pointer;
  font: inherit; font-size: 10.6px; font-weight: 600; letter-spacing: .2px;
  transition: background .15s, color .15s, border-color .15s;
}
.tool-btn svg { width: 12px; height: 12px; }
.tool-btn:hover { background: rgba(255,255,255,.11); color: #fff; border-color: rgba(255,255,255,.12); }

/* ============================================================
   AUTH GATE
   ============================================================ */
#authGate {
  position: fixed; inset: 0; z-index: 1200; background: var(--paper);
  overflow: auto; -webkit-font-smoothing: antialiased;
}
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: 1.02fr .98fr; }
@media (max-width: 940px) { .auth-shell { grid-template-columns: 1fr; } .auth-brand { display: none; } }

.auth-brand {
  position: relative; background: radial-gradient(120% 90% at 12% 0%, #22303a 0%, var(--ink) 55%, #0c1114 100%);
  color: #eef1f3; padding: 44px 48px 36px; display: flex; flex-direction: column;
  border-right: 1px solid #000;
}
.auth-brand::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,.028) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.028) 1px, transparent 1px);
  background-size: 46px 46px; mask-image: linear-gradient(180deg, rgba(0,0,0,.9), transparent 75%);
}
.auth-brand-top { display: flex; align-items: center; gap: 12px; position: relative; z-index: 1; }
.auth-brand-top .brand-mark {
  width: 38px; height: 38px; border-radius: 10px; background: var(--amber);
  color: #22160a; font-weight: 800; font-size: 19px; display: grid; place-items: center;
  box-shadow: 0 6px 18px -6px rgba(212,128,42,.9);
}
.auth-brand-name { font-size: 15px; font-weight: 700; letter-spacing: -.2px; }
.auth-brand-sub { font-size: 10.4px; text-transform: uppercase; letter-spacing: 1.1px; color: #8f9aa2; margin-top: 2px; }
.auth-headline {
  position: relative; z-index: 1; font-size: 34px; line-height: 1.15; letter-spacing: -1.1px;
  margin: 46px 0 14px; font-weight: 650; max-width: 15ch;
}
.auth-lede { position: relative; z-index: 1; font-size: 13.6px; line-height: 1.65; color: #a9b3ba; max-width: 42ch; }
.auth-points { position: relative; z-index: 1; list-style: none; padding: 0; margin: 30px 0 0; display: grid; gap: 14px; }
.auth-points li { display: flex; gap: 11px; align-items: flex-start; }
.auth-points b { display: block; font-size: 12.8px; color: #eef1f3; font-weight: 650; margin-bottom: 2px; }
.auth-points span { font-size: 12px; color: #939ea6; line-height: 1.5; }
.auth-tick {
  width: 20px; height: 20px; flex: none; border-radius: 50%; display: grid; place-items: center;
  background: rgba(42,112,72,.22); color: #63c08c; margin-top: 1px;
}
.auth-tick svg { width: 11px; height: 11px; }
.auth-brand-foot {
  position: relative; z-index: 1; margin-top: auto; padding-top: 34px;
  font-size: 10.6px; letter-spacing: .5px; text-transform: uppercase; color: #647078;
}

.auth-panel { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 24px; background: var(--paper-2); }
.auth-card {
  width: min(408px, 100%); background: var(--white); border: 1px solid var(--rule);
  border-radius: var(--r-lg); padding: 30px 30px 26px; box-shadow: var(--sh-3);
}
.auth-eyebrow { font-size: 10.2px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--amber-deep); font-weight: 700; }
.auth-card h2 { font-size: 21px; letter-spacing: -.6px; margin: 8px 0 6px; font-weight: 650; }
.auth-sub { font-size: 12.4px; color: var(--muted); line-height: 1.55; margin-bottom: 20px; }
.auth-field { display: block; margin-bottom: 13px; }
.auth-field > span { display: block; font-size: 11.2px; font-weight: 650; color: var(--text-2); margin-bottom: 5px; letter-spacing: .1px; }
.auth-field .input { width: 100%; height: 40px; font-size: 13.4px; }
.auth-submit { width: 100%; height: 42px; justify-content: center; font-size: 13px; margin-top: 6px; gap: 8px; }
.auth-submit svg { width: 13px; height: 13px; }
.auth-error {
  display: flex; gap: 8px; align-items: flex-start; background: var(--red-wash); border: 1px solid #f0d2c9;
  color: #8f3319; border-radius: var(--r-sm); padding: 9px 11px; font-size: 12px; margin: 4px 0 12px; line-height: 1.45;
}
.auth-error svg { width: 13px; height: 13px; flex: none; margin-top: 1px; }
.auth-note { display: flex; gap: 7px; align-items: center; font-size: 11.4px; color: var(--muted); margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--rule-soft); }
.auth-note svg { width: 12px; height: 12px; }
.auth-demo { margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--rule); }
.auth-demo-label { font-size: 10.4px; text-transform: uppercase; letter-spacing: .9px; color: var(--muted-2); font-weight: 700; margin-bottom: 8px; }
.auth-demo-row { display: flex; gap: 7px; flex-wrap: wrap; }
.auth-demo-row .btn { flex: 1; justify-content: center; white-space: nowrap; }
.auth-demo-row .btn svg { width: 12px; height: 12px; }
.auth-demo-hint { font-size: 10.8px; color: var(--muted-2); margin-top: 9px; line-height: 1.5; font-family: var(--mono); }
.auth-foot-note { font-size: 10.8px; color: var(--muted-2); margin-top: 18px; text-align: center; }

/* account picker (client/job assignment) */
.pick-list { display: grid; gap: 6px; margin-top: 7px; }
.pick-row {
  display: flex; gap: 10px; align-items: flex-start; padding: 9px 11px; border: 1px solid var(--rule);
  border-radius: var(--r-sm); background: #fcfbf8; cursor: pointer;
}
.pick-row:hover { border-color: var(--amber-line); background: var(--amber-wash); }
.pick-row input { margin-top: 2px; accent-color: var(--amber); }

/* ============================================================
   ONBOARDING TOUR
   ============================================================ */
#tourRoot { position: fixed; inset: 0; z-index: 1500; pointer-events: none; }
.tour-shade { position: fixed; inset: 0; background: rgba(9,13,16,.42); pointer-events: auto; }
/* When something IS being pointed at, the shade goes clear and the cut-out carries the
   dimming — so the highlighted element stays at full brightness and is easy to read. */
.tour-shade.spot { background: transparent; }
.tour-shade.full { backdrop-filter: blur(1.5px); background: rgba(9,13,16,.55); }
.tour-hole {
  position: fixed; border-radius: 12px; pointer-events: none;
  background: transparent;
  /* lift whatever is inside the cut-out so it reads at full strength */
  backdrop-filter: brightness(1.14) saturate(1.06);
  -webkit-backdrop-filter: brightness(1.14) saturate(1.06);
  box-shadow:
    0 0 0 9999px rgba(9,13,16,.42),
    0 0 0 2px rgba(212,128,42,.95),
    0 0 0 8px rgba(212,128,42,.16),
    0 0 30px 10px rgba(212,128,42,.22);
  transition: all .22s cubic-bezier(.3,.8,.3,1);
}
.tour-card {
  position: fixed; pointer-events: auto; background: var(--white); border-radius: var(--r-lg);
  box-shadow: 0 30px 60px -18px rgba(0,0,0,.5), 0 2px 6px rgba(0,0,0,.12);
  border: 1px solid rgba(17,22,26,.09); padding: 16px 18px 14px;
  animation: tourIn .22s ease-out both;
}
@keyframes tourIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.tour-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tour-kicker { font-size: 9.8px; text-transform: uppercase; letter-spacing: 1px; font-weight: 750; color: var(--amber-deep); }
.tour-x { border: 0; background: transparent; color: var(--muted-2); cursor: pointer; padding: 2px; line-height: 0; border-radius: 5px; }
.tour-x:hover { color: var(--text); background: var(--rule-soft); }
.tour-x svg { width: 13px; height: 13px; }
.tour-title { font-size: 15.5px; letter-spacing: -.35px; font-weight: 650; margin: 7px 0 7px; }
.tour-body { font-size: 12.6px; line-height: 1.62; color: var(--text-2); }
.tour-body b { color: var(--text); font-weight: 650; }
.tour-body i { color: var(--amber-deep); font-style: italic; }
.tour-foot { display: flex; align-items: center; gap: 7px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--rule-soft); }
.tour-foot .spacer { flex: 1; }
.tour-dots { display: flex; gap: 4px; }
.tour-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--rule); }
.tour-dot.on { background: var(--amber); width: 14px; border-radius: 3px; }
.tour-foot .btn svg { width: 11px; height: 11px; }
@media (max-width: 640px) { .tour-card { bottom: 16px !important; top: auto !important; left: 16px !important; transform: none !important; width: auto !important; right: 16px; } }

/* Clients see three ledger cells (no internal risk cell) */
body[data-role="client"] .ledger { grid-template-columns: repeat(3, minmax(0,1fr)); }
@media (max-width: 900px) { body[data-role="client"] .ledger { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 600px) { body[data-role="client"] .ledger { grid-template-columns: 1fr; } }

/* Demo credential list on the sign-in card */
.auth-demo-creds { margin-top: 10px; display: grid; gap: 4px; }
.auth-demo-creds > div { display: flex; align-items: center; gap: 6px; font-size: 10.8px; }
.auth-demo-creds span {
  width: 42px; flex: none; font-size: 9.4px; text-transform: uppercase; letter-spacing: .7px;
  color: var(--muted-2); font-weight: 700;
}
.auth-demo-creds code {
  font-family: var(--mono); font-size: 10.8px; color: var(--text-2);
  background: var(--paper); border: 1px solid var(--rule-soft); border-radius: 5px;
  padding: 2px 6px; white-space: nowrap;
}

/* "Offline demo" pill shown when the page is hosted without a backend */
.mode-pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 9.6px; font-weight: 750; letter-spacing: .7px; text-transform: uppercase;
  color: var(--amber-deep); background: var(--amber-wash); border: 1px solid var(--amber-line);
  padding: 4px 8px; border-radius: 999px; white-space: nowrap;
}
.mode-pill::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--amber); }

/* ============================================================
   DAILY SITE REPORTS
   ============================================================ */
.dsr-row{width:100%;display:flex;align-items:center;gap:16px;padding:15px 18px;border:0;border-bottom:1px solid var(--line,#e9e8e4);background:#fff;text-align:left;cursor:pointer;color:inherit;transition:background .15s}
.dsr-row:last-child{border-bottom:0}.dsr-row:hover{background:#faf9f6}
.dsr-date{width:47px;height:50px;flex:none;border-radius:9px;background:#f5f3ee;display:flex;flex-direction:column;align-items:center;justify-content:center;color:#59605f}
.dsr-date .d{font-size:20px;font-weight:750;line-height:1}.dsr-date .m{font-size:10px;text-transform:uppercase;letter-spacing:.08em;margin-top:4px;font-weight:650}
.dsr-main{min-width:0;flex:1}.dsr-title{font-weight:700;font-size:13px}.dsr-sum{font-size:11px;color:#777f81;margin-top:6px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.dsr-stats{display:flex;gap:18px;flex:none}.dsr-stats>div{display:flex;flex-direction:column;align-items:center;min-width:36px}.dsr-stats b{font-size:14px}.dsr-stats span{font-size:9px;color:#8a8f90;text-transform:uppercase;letter-spacing:.07em;margin-top:2px}
.wx-chip{display:inline-flex;gap:5px;align-items:center;padding:4px 8px;border-radius:20px;font-size:10px;font-weight:650;white-space:nowrap;background:#fff4d8;color:#886514}.wx-chip svg{width:14px;height:14px}.wx-chip.wet{background:#e9f2fb;color:#3d6c91}.wx-chip.cloud{background:#eef0ef;color:#697170}.wx-chip.hot{background:#fae9df;color:#a95432}.wx-chip.wind{background:#e9f1ed;color:#4a7660}.wx-chip.fine{background:#f6f1d9;color:#847225}
.dsr-sheet{background:#fff;border:1px solid #e5e3dd;border-radius:12px;padding:26px;box-shadow:0 5px 22px #202b3210}.dsr-sheet-head{display:flex;justify-content:space-between;gap:20px;padding-bottom:16px;border-bottom:2px solid #252b2c}.dsr-brand{font-size:15px;font-weight:800;letter-spacing:-.02em}.dsr-sheet-title{font-size:14px;font-weight:800;letter-spacing:.12em}.dsr-wx-row{display:grid;grid-template-columns:1.1fr 1fr;gap:24px;padding:17px 0;border-bottom:1px solid #eceae5}.dsr-wx{display:flex;flex-direction:column;gap:12px}.dsr-wx .wx-chip{align-self:flex-start;font-size:11px;padding:6px 10px}.dsr-wx-facts{display:flex;gap:18px;flex-wrap:wrap}.dsr-wx-facts>div{display:flex;flex-direction:column;gap:3px}.dsr-wx-facts b{font-size:12px}.dsr-wx-facts span{font-size:9px;color:#858988;text-transform:uppercase;letter-spacing:.06em}.dsr-cond{border-left:1px solid #e8e6df;padding-left:20px}.dsr-grid2{display:grid;grid-template-columns:1fr 1fr;gap:22px}.dsr-block{padding:18px 0;border-bottom:1px solid #eceae5}.dsr-block:last-child{border-bottom:0}.dsr-list{margin:10px 0 0;padding-left:18px}.dsr-list li{font-size:11px;line-height:1.55;margin:4px 0;color:#42494a}.dsr-list li::marker{color:#cc9b31}.dsr-list.next li::marker{color:#719380}
.photo-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;margin-top:12px}.photo{margin:0;min-width:0;border:1px solid #e9e7e1;border-radius:9px;overflow:hidden;background:#fbfaf8}.photo img{width:100%;height:165px;object-fit:cover;display:block;background:#eee}.photo figcaption{padding:8px 9px}.photo-time{font-size:9px;color:#7d8583}.photo-cap{width:100%;border:0;background:transparent;padding:4px 0;font:inherit;font-size:10px;color:#303738;outline:none}.photo-cap:focus{border-bottom:1px solid #c99c40}.photo-cap-static{font-size:10px;line-height:1.35;margin:4px 0;color:#414848}.photo-meta{display:flex;align-items:center;justify-content:space-between}.photo-x,.row-x{border:0;background:transparent;color:#8d9390;cursor:pointer;padding:3px}.photo-x svg,.row-x svg{width:14px;height:14px}.row-x{margin-left:8px;vertical-align:middle}.dsr-table{font-size:10px}.dsr-table th{font-size:9px}.dsr-table tfoot td{font-weight:700;border-top:1px solid #d9d8d2}.issue{border:1px solid #e8e5de;border-radius:9px;padding:12px 14px;margin:10px 0;background:#fff}.issue.closed{background:#fafaf8;opacity:.72}.issue-top{display:flex;align-items:center;gap:7px}.issue-title{font-size:12px;font-weight:700;margin:9px 0 5px}.issue-detail,.issue-action{font-size:10px;line-height:1.5;color:#666e6e}.issue-action{margin-top:7px}.issue-actions{display:flex;gap:6px;margin-top:10px;flex-wrap:wrap}.sev{font-size:9px;font-weight:750;text-transform:uppercase;letter-spacing:.05em}.sev-low{color:#63816a}.sev-medium{color:#b17b25}.sev-high{color:#b24c3c}.dsr-signoff{display:flex;justify-content:space-between;align-items:end;padding:18px 0 0}.dsr-sign-line{min-width:190px;border-bottom:1px solid #adb1ac;padding:0 0 6px 8px;display:flex;justify-content:space-between;font-size:9px;color:#8b908e}.dsr-sign-line b{font-size:11px;color:#414747}.dsr-block.internal{background:#fff8e9;border:1px solid #f1dfb8;border-radius:8px;padding:14px;margin-top:12px}.fld-inline{display:flex;flex-direction:column;gap:5px;flex:1;min-width:110px;font-size:10px;color:#6d7473}.fld-block{display:flex;flex-direction:column;gap:5px;flex:1;font-size:10px;color:#6d7473}.fld-block textarea{resize:vertical}.notice.warn{display:flex;gap:10px;align-items:flex-start;padding:12px 14px;background:#fff8e8;border:1px solid #f1dfb7;border-radius:8px;color:#65562f;font-size:11px}.notice.warn>svg{width:16px;height:16px;flex:none}.alert .kpi-value{color:#b4513c}
#reportPhotoInput{display:none}
#printRoot{display:none}
@media(max-width:850px){.dsr-stats{gap:10px}.photo-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.dsr-sheet{padding:18px}}
@media(max-width:620px){.dsr-row{gap:9px;padding:12px 10px}.dsr-date{width:39px;height:44px}.dsr-stats{display:none}.dsr-wx-row,.dsr-grid2{grid-template-columns:1fr}.dsr-cond{border-left:0;border-top:1px solid #e8e6df;padding:12px 0 0}.photo-grid{grid-template-columns:1fr 1fr}.photo img{height:125px}.dsr-sheet{padding:13px}.dsr-sheet-head{flex-direction:column}.dsr-sheet-head>div:last-child{text-align:left!important}.dsr-table{min-width:650px}.dsr-block:has(.dsr-table){overflow-x:auto}}
@media print{
  @page{size:A4;margin:13mm}
  body.printing>*:not(#printRoot){display:none!important}
  body.printing #printRoot{display:block!important;position:static!important;color:#202526;background:#fff;font-family:Arial,sans-serif;font-size:9pt}
  #printRoot *{box-sizing:border-box}
  .print-sheet{width:100%;background:#fff}
  .ps-head{display:flex;justify-content:space-between;align-items:flex-start;padding:0 0 12px;border-bottom:2px solid #263032;margin-bottom:14px}
  .ps-company{font-size:16pt;font-weight:700}.ps-title{font-size:12pt;font-weight:700;letter-spacing:1.5px}.ps-meta{font-size:8pt;color:#66706f;margin-top:4px}
  .ps-project{display:grid;grid-template-columns:1fr 1fr 1fr;gap:9px 16px;padding:10px 0 13px;border-bottom:1px solid #ddd}.ps-project>div,.ps-wx>div{display:flex;flex-direction:column;gap:3px}.ps-project span,.ps-wx span{font-size:7pt;color:#777;text-transform:uppercase;letter-spacing:.5px}.ps-project b,.ps-wx b{font-size:8.5pt}
  .ps-wx{display:grid;grid-template-columns:repeat(5,1fr);gap:10px;padding:11px;background:#f4f5f3;margin:12px 0}
  .ps-section{margin:12px 0;page-break-inside:avoid}.ps-section h4{font-size:9pt;text-transform:uppercase;letter-spacing:.7px;margin:0 0 6px;border-bottom:1px solid #ddd;padding-bottom:4px}.ps-section p{font-size:8.5pt;line-height:1.45;margin:0}.ps-section ul{margin:5px 0;padding-left:16px}.ps-section li{font-size:8pt;line-height:1.4;margin:3px 0}.ps-two{display:grid;grid-template-columns:1fr 1fr;gap:18px}
  .ps-photos{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}.ps-photos figure{margin:0;page-break-inside:avoid}.ps-photos img{width:100%;height:115px;object-fit:cover}.ps-photos figcaption{font-size:7pt;line-height:1.35;padding-top:3px}.ps-photos figcaption b{display:block;color:#65706c}
  .ps-table{width:100%;border-collapse:collapse;font-size:7pt}.ps-table th,.ps-table td{border:1px solid #ddd;padding:4px;text-align:left;vertical-align:top}.ps-table th{background:#f0f1ee}.ps-issue{padding:7px 8px;border:1px solid #ddd;margin:6px 0;font-size:7.5pt;line-height:1.4;page-break-inside:avoid}.ps-issue b{display:block;margin-bottom:3px}.ps-issue-detail{color:#555;margin:3px 0}.ps-foot{display:flex;justify-content:space-between;border-top:1px solid #ccc;padding-top:7px;margin-top:16px;font-size:7pt;color:#68706f}
}

/* Trade coordination: bookings, prerequisite readiness and change notice queue */
.sched-coord-head{display:flex;justify-content:space-between;align-items:flex-start;gap:20px;padding:6px 0 15px}.sched-coord-head h2{font-size:17px;margin:0 0 5px;letter-spacing:-.02em}.sched-coord-head p{font-size:11px;color:#777f7d;margin:0;max-width:550px;line-height:1.45}.sched-coord-counts{display:flex;gap:16px;flex-wrap:wrap;justify-content:flex-end;font-size:10px;color:#777}.sched-coord-counts b{font-size:13px;color:#303738;margin-right:3px}.warn-text{color:#9b711e!important}.danger-text{color:#b24c3c!important}.danger-text b{color:#b24c3c!important}.ok-text{color:#63816a!important}
.sched-stage-list{display:grid;grid-template-columns:1fr;gap:12px}.sched-stage{border:1px solid #e8e6df;border-radius:10px;background:#fff;padding:14px 15px}.sched-stage-top{display:flex;align-items:center;gap:8px;flex-wrap:wrap}.sched-stage-id{font-size:9px;text-transform:uppercase;letter-spacing:.08em;color:#8a908e;font-weight:700}.sched-stage-title{font-size:13px;font-weight:750;color:#303738}.sched-stage-grid{display:grid;grid-template-columns:1.35fr 1fr .95fr 1.15fr;gap:18px;margin-top:14px;padding:12px;background:#faf9f6;border-radius:8px}.sched-stage-grid>div{min-width:0}.sched-label{font-size:9px;color:#858b88;text-transform:uppercase;letter-spacing:.07em;font-weight:700;margin-bottom:5px}.sched-assignee b{display:block;font-size:11px;line-height:1.4}.sched-assignee div:not(.sched-label){font-size:10px;color:#5f6865;line-height:1.4}.sched-assignee a{color:#6e7f72;text-decoration:none}.sched-select{height:31px!important;padding:4px 7px!important;font-size:10px!important;margin-bottom:3px}.sched-actions{border-left:1px solid #e7e5de;padding-left:15px}.sched-actions .btn svg,.sched-stage-foot .btn svg{width:12px;height:12px}.readiness-pill{display:inline-flex;align-items:center;gap:4px;padding:4px 7px;border-radius:20px;font-size:9px;font-weight:700}.readiness-pill svg{width:12px;height:12px}.readiness-pill.blocked{background:#fff0e7;color:#a95134}.readiness-pill.ready{background:#eaf3ec;color:#557d5d}.sched-note{font-size:10px;color:#6e7471;padding:8px 0 0}.sched-note b{color:#4a514f;margin-right:5px}.prereq-box{margin-top:11px;padding:10px 12px;border-radius:8px}.prereq-box.blocked{border:1px solid #f0d9c7;background:#fff8f3}.prereq-box.ready{border:1px solid #dce9dd;background:#f5faf5}.prereq-head{display:flex;align-items:center;gap:7px;font-size:10px}.prereq-head svg{width:14px;height:14px;flex:none}.prereq-box.blocked .prereq-head{color:#a65137}.prereq-box.ready .prereq-head{color:#557b5c}.prereq-head .small{color:#7b817e;margin-left:3px}.prereq-list{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:5px 14px;margin-top:9px}.prereq-item{display:flex;align-items:center;gap:7px;font-size:10px;color:#626b68;cursor:pointer;min-width:0}.prereq-item input{accent-color:#64866b;flex:none}.prereq-item span{flex:1}.prereq-item em{font-style:normal;font-size:8px;text-transform:uppercase;letter-spacing:.05em;color:#a45c42}.prereq-item.done em{color:#64806a}.prereq-item.done span{text-decoration:line-through;color:#8d938e}.sched-change-notice{display:flex;align-items:center;gap:9px;margin-top:10px;padding:10px 12px;background:#fff6e4;border:1px solid #edd7a7;border-radius:8px;color:#775e24}.sched-change-notice>svg{width:16px;height:16px;flex:none}.sched-change-notice>div{flex:1}.sched-change-notice b{font-size:10px}.sched-change-notice .small{margin-top:3px}.sched-notified{display:block;margin-top:8px}.sched-stage-foot{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-top:11px;padding-top:9px;border-top:1px solid #efeee9}.sched-stage-foot>span{max-width:60%;line-height:1.35}.trade-coord-card .card-body{padding-top:16px}
@media(max-width:1000px){.sched-stage-grid{grid-template-columns:1fr 1fr;gap:12px}.sched-actions{border-left:0;padding-left:0}.sched-coord-head{flex-direction:column}.sched-coord-counts{justify-content:flex-start}}
@media(max-width:620px){.sched-stage{padding:11px}.sched-stage-grid{grid-template-columns:1fr;gap:10px}.sched-stage-foot{align-items:flex-start;flex-direction:column}.sched-stage-foot>span{max-width:100%}.prereq-list{grid-template-columns:1fr}.sched-change-notice{align-items:flex-start;flex-wrap:wrap}.sched-change-notice .btn{margin-left:23px}}

/* Login intro video — muted motion under a dark readability veil */
.auth-brand{isolation:isolate;overflow:hidden;background:#10171b}
.auth-video{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;z-index:0;opacity:.94;filter:brightness(.84) saturate(.92);pointer-events:none}
.auth-brand::before{content:"";position:absolute;inset:0;z-index:1;pointer-events:none;background:linear-gradient(180deg,rgba(3,6,8,.76) 0%,rgba(4,7,9,.68) 36%,rgba(5,8,10,.48) 52%,rgba(5,8,10,.20) 76%,rgba(5,8,10,.36) 100%),linear-gradient(90deg,rgba(4,7,9,.16),transparent 88%)}
.auth-brand::after{z-index:1}
.auth-brand>:not(.auth-video){position:relative;z-index:2}
.auth-headline,.auth-brand-name,.auth-brand-foot,.auth-lede,.auth-points b,.auth-points span{text-shadow:0 1px 8px rgba(0,0,0,.35)}
.auth-brand-foot{color:#a4afb5}
.empty-workspace{max-width:680px;margin:clamp(40px,12vh,130px) auto;padding:42px 44px;background:#fff;border:1px solid #e3dfd6;border-radius:16px;box-shadow:0 18px 40px -16px rgba(17,22,26,.2);text-align:center}
.empty-workspace .empty-icon{width:48px;height:48px;margin:0 auto 18px;border-radius:14px;display:grid;place-items:center;background:#fdf4e8;color:#a75f16}.empty-workspace .empty-icon svg{width:23px;height:23px}
.empty-workspace .eyebrow{font-size:10px;text-transform:uppercase;letter-spacing:.13em;color:#a75f16;font-weight:750}
.empty-workspace h1{font-size:27px;letter-spacing:-.7px;margin:8px 0 11px;color:#151a1e}
.empty-workspace p{max-width:52ch;margin:0 auto;color:#6d757c;font-size:13px;line-height:1.65}
.empty-actions{display:flex;justify-content:center;gap:9px;flex-wrap:wrap;margin-top:23px}.empty-foot{border-top:1px solid #eeebe3;margin-top:24px;padding-top:14px;color:#8c9398;font-size:10px}
.btn-danger-lite{color:#9c3e2d;border-color:#ead2cb;background:#fffaf8}.btn-danger-lite:hover{color:#873522;background:#fff3ee;border-color:#dbb5aa}
body[data-empty="true"] .topbar .admin-only,body[data-empty="true"] .topbar .searchbox,body[data-empty="true"] .topbar .icon-btn{display:none!important}
body[data-empty="true"] .content{min-height:calc(100vh - 62px);display:flex;align-items:flex-start;justify-content:center}
@media(max-width:940px){.auth-video{object-position:center}.empty-workspace{margin:45px 18px;padding:32px 22px}}

/* Smooth, staggered slide-in reveal throughout the app. Content layout is unchanged. */
@keyframes app-slide-reveal{0%{opacity:0;transform:translate3d(var(--motion-x,0),16px,0)}72%{opacity:1;transform:translate3d(0,-1px,0)}100%{opacity:1;transform:none}}
@keyframes shell-slide-left{0%{opacity:0;transform:translateX(-16px)}100%{opacity:1;transform:none}}
@keyframes shell-slide-down{0%{opacity:0;transform:translateY(-10px)}100%{opacity:1;transform:none}}
@keyframes auth-slide-left{0%{opacity:0;transform:translateX(-22px)}100%{opacity:1;transform:none}}
@keyframes auth-slide-right{0%{opacity:0;transform:translateX(18px)}100%{opacity:1;transform:none}}
#view .motion-enter{opacity:0;transform:translate3d(var(--motion-x,0),16px,0);will-change:opacity,transform}
#view .motion-enter.motion-visible{animation:app-slide-reveal .58s cubic-bezier(.2,.72,.25,1) var(--motion-delay,0ms) both}
body.motion-shell-ready .sidebar{animation:shell-slide-left .55s cubic-bezier(.2,.72,.25,1) both}
body.motion-shell-ready .topbar{animation:shell-slide-down .48s cubic-bezier(.2,.72,.25,1) both}
#authGate .auth-brand{animation:auth-slide-left .66s cubic-bezier(.2,.72,.25,1) both}
#authGate .auth-panel{animation:auth-slide-right .58s cubic-bezier(.2,.72,.25,1) both}
.empty-workspace{animation:app-slide-reveal .55s cubic-bezier(.2,.72,.25,1) both}
@media(prefers-reduced-motion:reduce){
  #view .motion-enter,#view .motion-enter.motion-visible,.sidebar,.topbar,#authGate .auth-brand,#authGate .auth-panel,.empty-workspace{opacity:1!important;transform:none!important;animation:none!important;transition:none!important;will-change:auto!important}
  *,*::before,*::after{scroll-behavior:auto!important}
}
