/* Scaffold Tracker base styles. Dark UI, single stylesheet (no framework). */
:root {
  color-scheme: dark;   /* render native controls (date picker, dropdowns, scrollbars) in dark mode */
  --bg:      #111316;
  --panel:   #1a1d22;
  --panel2:  #22262d;
  --bd:      #33373f;
  --text:    #eef1f4;
  --muted:   #9aa1ab;
  --accent:  #ffffff;   /* monochrome white accent, default, easy on the eyes */
  --accent2: #c0c0c0;
  --danger:  #e5534b;
  --ok:      #3fb950;
  /* day-aging legend (scaffold days standing) */
  --d1:      #b6bcc6;   /* 1-35  */
  --d2:      #4a90e2;   /* 36-52 */
  --d3:      #f2c200;   /* 53-60 */
  --d4:      #e23b2e;   /* 61+   */
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Demo "View as" bar ── */
.viewas-bar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: #7c3aed; color: #fff; padding: 7px 18px; font-size: 14px; }
.viewas-lbl strong { font-weight: 800; }
.viewas-sel { background: rgba(255,255,255,.16); color: #fff; border: 1px solid rgba(255,255,255,.45);
  border-radius: 6px; padding: 3px 9px; font-size: 13px; width: auto; min-width: 190px; max-width: 260px; }
.viewas-sel option { color: #111; }
.viewas-return { margin-left: auto; color: #fff; text-decoration: underline; font-weight: 700; white-space: nowrap; }
@media print { .viewas-bar { display: none !important; } }

/* ── Top nav ── */
.topnav {
  display: flex; align-items: center; gap: 24px;
  padding: 0 20px; height: 56px;
  background: var(--panel);
  border-bottom: 1px solid var(--bd);
}
.topnav .brand a { color: var(--text); font-weight: 700; letter-spacing: .2px; display: inline-flex; align-items: center; }
/* Pin icon recolored to the current theme text color via CSS mask (no inline SVG). */
.brand-pin {
  display: inline-block; width: 22px; height: 26px; margin-right: 8px;
  background: currentColor;
  -webkit-mask: url("pin.svg") center/contain no-repeat;
          mask: url("pin.svg") center/contain no-repeat;
}
/* Stacked "Scaffold / Tracker" wordmark, matching the home page */
.brand-name { line-height: 1.0; font-size: 15px; font-weight: 800; }
/* Full logo lockup (includes wordmark) for the auth pages, themeable via mask. */
.auth-logo {
  width: 300px; aspect-ratio: 1329/642; margin: 0 auto 8px;
  background: currentColor;
  -webkit-mask: url("logo.svg") center/contain no-repeat;
          mask: url("logo.svg") center/contain no-repeat;
}
.topnav .navlinks { display: flex; gap: 18px; }
.topnav .navlinks a { color: var(--muted); }
.topnav .navlinks a:hover { color: var(--text); text-decoration: none; }
.topnav .navlinks .nav-off { color: var(--muted); opacity: .35; cursor: not-allowed; user-select: none; }
tr.row-current > td { background: rgba(96, 165, 250, .10); }
/* inventory item history modal */
.hist-box { max-width: 620px; width: 94%; text-align: left; }
.hist-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.hist-head h3 { margin: 0; font-size: 16px; }
.hist-body { max-height: 62vh; overflow: auto; }
.hist-body .data-table th, .hist-body .data-table td { padding: 6px 10px; font-size: 13px; }
.hist-in { color: #4ade80; font-weight: 700; }
.hist-out { color: #f87171; font-weight: 700; }
.inv-log-h { width: 48px; text-align: center; }
.inv-log-cell { text-align: center; }
.inv-log { min-width: 26px; padding: 1px 8px; border-radius: 10px; border: 1px solid var(--bd);
  background: var(--panel2); color: var(--text); font-size: 12px; font-weight: 700; cursor: pointer; }
.inv-log:hover { border-color: var(--accent); color: var(--accent); }
/* build request form */
.req-size { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.req-checks { display: flex; flex-wrap: wrap; gap: 22px; margin-top: 12px; }
.req-check { display: inline-flex; align-items: center; gap: 8px; margin: 0; }
.req-check input { width: auto; }
.req-row-actions { display: flex; gap: 14px; }
.portal-demo-cell { text-align: right; white-space: nowrap; }
.portal-demo-btn { padding: 4px 12px; min-height: 30px; }
@media (max-width: 620px) { .req-size { grid-template-columns: repeat(2, 1fr); } }
.sup-actions { display: flex; gap: 12px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.ok-msg { color: #4ade80; }
.err-head { color: #f87171; font-size: 1.05rem; margin: 0 0 8px; }
.err-list { margin: 0; padding-left: 20px; color: var(--text); }
.err-list li { margin: 2px 0; }
.file-label { display: inline-flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 14px; }
.help-list { color: var(--text); line-height: 1.6; }
.help-list ul { margin: 6px 0; }
.cat-list { line-height: 1.9; }
.topnav .navuser { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.topnav .who { color: var(--muted); font-size: 14px; }
.badge {
  background: var(--accent); color: #1a1a1a; font-size: 11px; font-weight: 700;
  padding: 1px 6px; border-radius: 4px; text-transform: uppercase;
}
.badge-owner { background: #7c3aed; color: #fff; }

/* ── Layout ── */
.wrap { max-width: 1120px; margin: 0 auto; padding: 18px 22px; }
.page-head { margin-bottom: 13px; }
.page-head h1 { margin: 0 0 2px; font-size: 23px; }
.edit-link { margin-left: 12px; font-size: 18px; color: var(--muted); text-decoration: none; vertical-align: middle; }
.edit-link:hover { color: var(--accent); }
.sub { color: var(--muted); margin: 0; }
.muted { color: var(--muted); }

/* ── Cards ── */
.card {
  background: var(--panel);
  border: 1px solid var(--bd);
  border-radius: 10px;
  padding: 15px 18px;
  margin-bottom: 13px;
}
.card h2 { margin: 0 0 11px; font-size: 17px; }
.card > p { margin: 3px 0 12px; }

.auth-card { max-width: 420px; margin: 8vh auto 0; }
.auth-card h1 { margin: 0 0 4px; }
.auth-card .sub { margin-bottom: 18px; }

/* ── Forms ── */
label { display: block; margin-bottom: 9px; color: var(--muted); font-size: 13px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=search], select, textarea {
  width: 100%; margin-top: 3px; padding: 9px 11px; min-height: 40px;
  background: var(--panel2); color: var(--text);
  border: 1px solid var(--bd); border-radius: 6px; font-size: 15px;
}
textarea { min-height: 68px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
input[readonly] { background: var(--bg); color: var(--text); cursor: default; }
input[readonly]:focus { border-color: var(--bd); }
input[type=date]::-webkit-calendar-picker-indicator { cursor: pointer; opacity: .85; }
input[type=date]::-webkit-calendar-picker-indicator:hover { opacity: 1; }

.btn {
  width: 100%; padding: 11px 16px; margin-top: 6px;
  background: var(--accent); color: #1a1a1a; font-weight: 700; font-size: 15px;
  border: none; border-radius: 7px; cursor: pointer;
}
.btn:hover { background: var(--accent2); }
.btn-ghost {
  padding: 9px 16px; min-height: 40px; border: 1px solid var(--muted); border-radius: 7px;
  color: var(--text); background: var(--panel2); font-size: 14px; display: inline-flex; align-items: center;
}
.btn-ghost:hover { color: var(--text); text-decoration: none; background: var(--bd); border-color: var(--text); }

.alt { margin-top: 16px; color: var(--muted); font-size: 14px; text-align: center; }

/* ── Messages ── */
.error  { background: rgba(229,83,75,.12); border: 1px solid var(--danger); color: #ffb3ae;
          padding: 10px 12px; border-radius: 7px; margin-bottom: 16px; font-size: 14px; }
.notice { background: rgba(63,185,80,.10); border: 1px solid var(--ok); color: #9ae6a6;
          padding: 10px 12px; border-radius: 7px; margin-bottom: 16px; font-size: 14px; }

/* ── Stats ── */
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 13px; }
.stat {
  background: var(--panel); border: 1px solid var(--bd); border-radius: 10px;
  padding: 12px 16px;
}
.stat-num { font-size: 25px; font-weight: 700; color: var(--accent); }
.stat-label { color: var(--muted); font-size: 13px; margin-top: 2px; }

.todo-list { color: var(--muted); padding-left: 18px; }
.todo-list li { margin: 4px 0; }

/* ── Buttons (inline / auto width) ── */
.btn-inline, .btn-auto {
  display: inline-block; width: auto; padding: 10px 18px; min-height: 40px;
  background: var(--accent); color: #1a1a1a; font-weight: 700; font-size: 14px;
  border: none; border-radius: 7px; cursor: pointer; text-align: center;
}
.btn-inline:hover, .btn-auto:hover { background: var(--accent2); text-decoration: none; }

.card-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.form-actions { display: flex; align-items: center; gap: 12px; margin: 2px 0 18px; }

/* ── Lists / chips ── */
.site-list { list-style: none; padding: 0; margin: 8px 0 0; }
.site-list li { padding: 9px 0; border-bottom: 1px solid var(--bd); }
.site-list li:last-child { border-bottom: none; }
.chip {
  display: inline-block; margin-left: 8px; padding: 1px 8px; font-size: 12px;
  background: var(--panel2); border: 1px solid var(--bd); border-radius: 10px; color: var(--muted);
}

/* ── Data tables ── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--bd); }
.data-table th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
.data-table th a.sorth { color: inherit; text-decoration: none; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.data-table th a.sorth:hover, .data-table th a.sorth.active { color: var(--text); }
.data-table th .sarr { font-size: 9px; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr.rowlink { cursor: pointer; }
.data-table tbody tr.rowlink:hover { background: var(--panel2); }

/* Age color legend by days standing (mirrors the legacy app): 1-35 white,
   36-52 blue, 53-60 yellow, 61+ red. Text/link colors flip for contrast. */
.data-table tbody tr.age-white  { background: #ffffff; }
.data-table tbody tr.age-blue   { background: #2f6fed; }
.data-table tbody tr.age-yellow { background: #f2c200; }
.data-table tbody tr.age-red    { background: #e23b2e; }
.data-table tbody tr.age-white td,  .data-table tbody tr.age-white td a,  .data-table tbody tr.age-white strong,
.data-table tbody tr.age-yellow td, .data-table tbody tr.age-yellow td a, .data-table tbody tr.age-yellow strong { color: #1a1a1a; }
.data-table tbody tr.age-blue td,   .data-table tbody tr.age-blue td a,   .data-table tbody tr.age-blue strong,
.data-table tbody tr.age-red td,    .data-table tbody tr.age-red td a,    .data-table tbody tr.age-red strong { color: #ffffff; }
/* Keep the demo button self-contained (dark pill, light text) so the age-row
   text-color override above can't turn it dark-on-dark on white/yellow rows. */
.data-table tbody tr td a.portal-demo-btn {
  color: #f2f4f8; background: #2a2f3a; border-color: #55606f;
}
.data-table tbody tr td a.portal-demo-btn:hover { background: #363c49; border-color: #f2f4f8; }
.data-table tbody tr.age-white:hover  { background: #e9e9e9; }
.data-table tbody tr.age-blue:hover   { background: #2a63d4; }
.data-table tbody tr.age-yellow:hover { background: #dcb100; }
.data-table tbody tr.age-red:hover    { background: #cf3327; }

.age-legend { display: flex; align-items: center; gap: 8px; margin-top: 14px; font-size: 13px; flex-wrap: wrap; }
.age-legend .lg { padding: 2px 10px; border-radius: 5px; font-weight: 600; }
.age-legend .lg-white  { background: #ffffff; color: #1a1a1a; }
.age-legend .lg-blue   { background: #2f6fed; color: #ffffff; }
.age-legend .lg-yellow { background: #f2c200; color: #1a1a1a; }
.age-legend .lg-red    { background: #e23b2e; color: #ffffff; }

/* ── Form grid ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.small { font-size: 13px; }

/* ── Site switcher (nav) ── */
.site-switch {
  width: auto; margin: 0; padding: 6px 10px; font-size: 13px;
  background: var(--panel2); color: var(--text);
  border: 1px solid var(--bd); border-radius: 7px;
}

/* ── Filters / tabs / search ── */
.filters { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.tabs { display: flex; gap: 6px; }
.tab {
  padding: 7px 14px; border-radius: 7px; font-size: 14px; color: var(--muted);
  border: 1px solid transparent;
}
.tab:hover { color: var(--text); text-decoration: none; }
.tab.on { background: var(--panel2); color: var(--text); border-color: var(--bd); }
.search { display: flex; gap: 8px; }
.search input[type=search] { width: 240px; margin: 0; }
.search .btn-ghost { white-space: nowrap; }
.scaf-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.scaf-filters select { width: auto; min-width: 0; margin: 0; }
.scaf-filters input[type=search] { width: 240px; min-width: 140px; margin: 0; }
.scaf-filters .btn-ghost, .scaf-filters .btn-inline { white-space: nowrap; }

/* ── Status badges ── */
/* Solid dark chip + colored status dot, so it stays legible on the age-colored
   rows (white / blue / yellow / red) as well as on plain dark rows. */
.status { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px;
  border-radius: 11px; font-size: 11px; font-weight: 700; letter-spacing: .3px; white-space: nowrap;
  background: rgba(18,22,29,.85); color: #fff;
  border: 1px solid rgba(255,255,255,.16); box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; flex: none; background: #9aa4b2; }
.status.open::before   { background: #35d07f; }
.status.closed::before { background: #9aa4b2; }

/* Modified / re-inspect chips on the scaffold tag (legible on colored rows) */
.tag-chip { display: inline-block; margin-left: 5px; padding: 1px 5px; border-radius: 4px;
  font-size: 9px; font-weight: 800; letter-spacing: .4px; vertical-align: middle;
  background: rgba(18,22,29,.82); color: #fff; border: 1px solid rgba(255,255,255,.2); }
.tag-chip.green { background: #1f9d55; border-color: rgba(255,255,255,.28); }
.tag-chip.red { background: #c0392b; border-color: rgba(255,255,255,.28); }
.tag-chip.yellow { background: #d4a017; color: #1a1a1a; border-color: rgba(0,0,0,.25); }
.tag-chip.due { background: #e07b00; border-color: rgba(255,255,255,.28); }

/* Inspection status pills + history badges (scaffold page) */
.insp-status { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 14px; }
.tagpill { display: inline-block; padding: 2px 10px; border-radius: 11px; font-size: 12px; font-weight: 700; }
.tagpill.green  { background: #1f9d55; color: #fff; }
.tagpill.yellow { background: #d4a017; color: #1a1a1a; }
.tagpill.red    { background: #c0392b; color: #fff; }
.tagpill.due    { background: #e07b00; color: #fff; }
.tagpill.none   { background: var(--panel2); color: var(--muted); border: 1px solid var(--bd); }
.insp-badge { margin-left: auto; padding: 1px 8px; border-radius: 5px; font-size: 12px; font-weight: 700; }
.insp-badge.green  { background: #1f9d55; color: #fff; }
.insp-badge.yellow { background: #d4a017; color: #1a1a1a; }
.insp-badge.red    { background: #c0392b; color: #fff; }

/* Inspect form: result radio options */
.insp-results { display: flex; flex-direction: column; gap: 6px; margin: 3px 0 12px; }
.insp-opt { display: flex; align-items: center; gap: 8px; margin: 0; padding: 8px 12px; border: 1px solid var(--bd); border-radius: 7px; color: var(--text); font-size: 14px; cursor: pointer; }
.insp-opt input[type=radio] { width: 18px; height: 18px; min-height: 0; margin: 0; flex: none; }
.insp-opt.insp-green  { border-left: 4px solid #1f9d55; }
.insp-opt.insp-yellow { border-left: 4px solid #d4a017; }
.insp-opt.insp-red    { border-left: 4px solid #c0392b; }

/* Modify screen: remove-materials checklist */
.rm-list { list-style: none; padding: 0; margin: 0; }
.rm-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 7px 2px; border-bottom: 1px solid var(--bd); }
.rm-list li:last-child { border-bottom: none; }
.rm-list .rm-name { color: var(--text); font-size: 14px; min-width: 0; }
.rm-list .rm-qty { display: inline-flex; align-items: center; gap: 6px; flex: none; color: var(--muted); font-size: 13px; }
.rm-list .rm-qty input { width: 58px; min-width: 0; min-height: 34px; padding: 5px 6px; text-align: center; margin: 0; }

/* Billing / modification audit panel on the scaffold page */
.audit-wrap { margin-top: 4px; }
.bill-summary { display: flex; flex-wrap: wrap; gap: 6px 22px; margin-bottom: 12px; color: var(--muted); font-size: 14px; }
.bill-summary strong { color: var(--text); }
.bill-table tfoot td { border-top: 2px solid var(--bd); border-bottom: none; padding-top: 9px; }
.reinspect-flag { background: rgba(229,83,75,.14); border: 1px solid var(--danger); color: #ffb3ae;
  padding: 8px 12px; border-radius: 7px; font-size: 13px; font-weight: 600; margin: 0 0 12px; }
.mod-history { list-style: none; padding: 0; margin: 0; }
.mod-history li { padding: 10px 0; border-bottom: 1px solid var(--bd); }
.mod-history li:last-child { border-bottom: none; }
.mod-head { display: flex; align-items: center; gap: 10px; }
.mod-date { font-weight: 700; }
.mod-delta { margin-left: auto; font-weight: 700; font-size: 13px; }
.mod-delta.up { color: #ff8f88; }
.mod-delta.down { color: #6fd383; }
.mod-reason { color: var(--muted); font-size: 13px; margin: 3px 0 5px; }
.mod-line { font-size: 13px; padding-left: 4px; }
.mod-line.add { color: #6fd383; }
.mod-line.rem { color: #ff8f88; }

.data-table td.num, .data-table th.num { text-align: right; }

/* ── 3-col form grid ── */
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 16px; }

/* ── Add-row (managed lists: units / job types) ── */
.add-row { display: flex; gap: 8px; margin: 4px 0 14px; }
.add-row input[type=text] { margin: 0; max-width: 320px; }
.chip-list { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chip-list li {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--panel2); border: 1px solid var(--bd); border-radius: 16px;
  padding: 5px 6px 5px 14px; font-size: 14px;
}
.chip-list form { margin: 0; display: inline; }
.chip-list .x {
  width: 20px; height: 20px; line-height: 1; padding: 0;
  background: transparent; color: var(--muted); border: none; cursor: pointer;
  border-radius: 50%; font-size: 16px;
}
.chip-list .x:hover { background: var(--danger); color: #fff; }

/* ── Scaffold form (VB-style: fields left, materials right) ── */
.up { text-transform: uppercase; }
.sf-grid { display: grid; grid-template-columns: minmax(340px, 460px) 1fr; gap: 16px; align-items: stretch; }
.sf-left { margin-bottom: 0; }
/* The materials content is taken out of flow (absolute) so it can't drive the grid
   row height. The row is then sized by the LEFT column, and .mat-fill stretches to
   that height while .mat-scroll scrolls whatever overflows. */
.sf-right { margin-bottom: 0; position: relative; overflow: hidden; min-height: 320px; }
.mat-fill { position: absolute; inset: 22px 24px; display: flex; flex-direction: column; }
.sf-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.sf-row .lbl { width: 96px; flex: none; text-align: right; color: var(--muted); font-size: 13px; }
.sf-row > input, .sf-row > select, .sf-row > textarea { flex: 1; margin: 0; width: auto; min-width: 0; }
.sf-row.top { align-items: flex-start; }
.sf-row.top .lbl { padding-top: 8px; }
.sf-row.size-row .sz { flex: 0 1 82px; width: 82px; min-width: 0; padding: 9px 6px; text-align: center; margin: 0; }
.sf-row.size-row .x { color: var(--muted); }
.sf-row.size-row .cm { display: inline-flex; align-items: center; gap: 5px; color: var(--muted);
  font-size: 12px; margin-left: 6px; white-space: nowrap; }
.sf-row.size-row .cm input { width: auto; margin: 0; }

.loc-builder { border: 1px solid var(--bd); border-radius: 8px; padding: 12px 14px 4px; margin: 6px 0 16px; min-width: 0; }
.loc-builder legend { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .4px; padding: 0 6px; }
.loc-display { min-height: 43px; padding: 10px 12px; margin-bottom: 12px; background: var(--bg);
  border: 1px solid var(--bd); border-radius: 7px; font-size: 15px; color: var(--text);
  line-height: 21px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sf-actions { display: flex; align-items: center; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.sf-actions .btn, .sf-actions .btn-auto, .sf-actions .btn-ghost { margin-top: 0; }
.sf-actions .btn-ghost { padding: 9px 16px; font-size: 14px; }
.foot-gap { flex: 1; min-width: 0; }
.foot-field { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.foot-field select, .foot-field input { width: auto; margin: 0; }

.mat-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.mat-title { font-weight: 700; }
.mat-scroll { flex: 1; overflow-y: auto; min-height: 0; }
.mat-grid { width: 100%; border-collapse: collapse; }
.mat-grid thead th { position: sticky; top: 0; background: var(--panel); z-index: 1; }
.mat-grid th { text-align: left; padding: 6px 8px; color: var(--muted); font-size: 11px;
  text-transform: uppercase; letter-spacing: .4px; border-bottom: 1px solid var(--bd); }
.mat-grid th.num, .mat-grid td.num { text-align: right; }
.mat-grid th.qcol { width: 64px; }
.mat-grid td { padding: 5px 6px; border-bottom: 1px solid var(--bd); vertical-align: middle; }
.mat-grid select, .mat-grid input { margin: 0; padding: 7px 9px; }
.mat-grid .mat-qty { width: 58px; text-align: right; }
.mat-grid .mat-cost { white-space: nowrap; color: var(--muted); text-align: right; }
.mat-grid .x { width: 34px; height: 34px; line-height: 1; padding: 0; border: none; cursor: pointer;
  background: transparent; color: var(--muted); border-radius: 50%; font-size: 18px; }
.mat-grid .x:hover { background: var(--danger); color: #fff; }
.mat-total { text-align: right; margin-top: 12px; font-size: 15px; }
.mat-total strong { color: var(--accent); }

@media (max-width: 820px) {
  .sf-grid { grid-template-columns: 1fr; }
  /* stacked: no left column to borrow height from, so give the materials box its own */
  .sf-right { min-height: 60vh; }
}
@media (max-width: 640px) {
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .search input[type=search] { width: 160px; }
}

/* ── Site map (Mapbox) ───────────────────────────────────────── */
.map-wrap { position: relative; display: flex; gap: 12px;
  height: calc(100vh - 190px); min-height: 440px; }
.map-side { flex: 0 0 260px; width: 260px; display: flex; flex-direction: column;
  overflow: hidden; padding: 12px 14px; }
.map-side-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.map-list { overflow-y: auto; margin-top: 8px; flex: 1; }
.map-item { display: flex; align-items: center; gap: 8px; padding: 8px 2px;
  border-bottom: 1px solid rgba(0,0,0,.07); }
.map-item .mi-tag { font-weight: 600; }
.map-item .mi-loc { flex: 1; min-width: 0; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.map-item.placed { cursor: pointer; }
.map-item .place-btn { padding: 3px 10px; font-size: 13px; }
.mi-dot { width: 11px; height: 11px; border-radius: 50%; flex: 0 0 11px; background: #8a8f98; }
.mi-dot.green { background: #1f9d55; }
.mi-dot.amber { background: #e0a800; }
.mi-dot.red   { background: #d64545; }
.mi-dot.grey  { background: #8a8f98; }

.map-legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px;
  color: #666; margin: 8px 0 2px; }
.map-legend .mkey { display: inline-flex; align-items: center; gap: 5px; }
.map-legend .mkey::before { content: ''; width: 10px; height: 10px; border-radius: 50%; }
.map-legend .mkey.green::before { background: #1f9d55; }
.map-legend .mkey.amber::before { background: #e0a800; }
.map-legend .mkey.red::before   { background: #d64545; }
.map-legend .mkey.grey::before  { background: #8a8f98; }

.map-canvas { flex: 1; min-width: 0; min-height: 440px; border-radius: 10px; overflow: hidden; }
.map-canvas.placing { cursor: crosshair; }
.map-canvas.placing .mapboxgl-canvas { cursor: crosshair; }

.map-placing { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%);
  background: #1b1f24; color: #fff; padding: 9px 16px; border-radius: 8px; z-index: 5;
  box-shadow: 0 4px 14px rgba(0,0,0,.3); font-size: 14px; }
.map-placing .btn-ghost { color: #cfe3ff; margin-left: 8px; }

/* Map popup: force solid, high-contrast content regardless of basemap behind it */
.mapboxgl-popup-content { background: #ffffff; color: #1b1f24;
  padding: 10px 12px; border-radius: 8px; box-shadow: 0 3px 14px rgba(0,0,0,.32); }
.mapboxgl-popup-anchor-top .mapboxgl-popup-tip,
.mapboxgl-popup-anchor-top-left .mapboxgl-popup-tip,
.mapboxgl-popup-anchor-top-right .mapboxgl-popup-tip { border-bottom-color: #ffffff; }
.mapboxgl-popup-anchor-bottom .mapboxgl-popup-tip,
.mapboxgl-popup-anchor-bottom-left .mapboxgl-popup-tip,
.mapboxgl-popup-anchor-bottom-right .mapboxgl-popup-tip { border-top-color: #ffffff; }
.mapboxgl-popup-anchor-left .mapboxgl-popup-tip { border-right-color: #ffffff; }
.mapboxgl-popup-anchor-right .mapboxgl-popup-tip { border-left-color: #ffffff; }
.mapboxgl-popup-close-button { color: #444; font-size: 16px; }

.mp { font-size: 13px; line-height: 1.5; color: #1b1f24; }
.mp strong { color: #111418; font-size: 14px; }
.mp .mp-st { display: inline-block; margin-left: 4px; padding: 1px 8px; border-radius: 10px;
  font-size: 11px; font-weight: 700; color: #fff; background: #8a8f98; vertical-align: 1px; }
.mp .mp-st.green { background: #1f9d55; }
.mp .mp-st.amber { background: #c98a00; }
.mp .mp-st.red   { background: #d64545; }
.mp .mp-st.grey  { background: #8a8f98; }
.mp .mp-loc { color: #333; margin: 4px 0 2px; }
.mp .mp-days { color: #444; margin: 2px 0; font-weight: 600; }
.mp .mp-demo { color: #b02a1a; font-weight: 700; margin: 2px 0; }
.mp .mp-links { margin-top: 5px; }
.mp .mp-links a { color: #1669c1; font-weight: 600; }
.rec-demo { color: #d64545; font-weight: 700; }

@media (max-width: 760px) {
  .map-wrap { flex-direction: column; height: auto; }
  .map-side { flex: none; width: auto; max-height: 220px; }
  .map-canvas { height: 60vh; }
}

/* ── Site map: ScafMarker flag pin (legacy icon), status dot, tag label ── */
.scaf-marker { position: relative; width: 30px; height: 29px; cursor: pointer; }
.scaf-marker img { display: block; width: 30px; height: 29px; }
.scaf-dot { position: absolute; top: -3px; right: -4px; width: 10px; height: 10px;
  border-radius: 50%; border: 1.5px solid #fff; box-shadow: 0 0 2px rgba(0,0,0,.5); background: #8a8f98; }
.scaf-dot.green { background: #1f9d55; }
.scaf-dot.amber { background: #e0a800; }
.scaf-dot.red   { background: #d64545; }
.scaf-dot.grey  { background: #8a8f98; }
.scaf-label { position: absolute; left: 33px; bottom: 12px; white-space: nowrap;
  font-size: 12px; font-weight: 700; line-height: 1; color: #fff; pointer-events: none;
  text-shadow: 0 0 3px #000, 0 0 3px #000, 0 1px 2px #000; }
.scaf-label.green { color: #3ddc84; }
.scaf-label.amber { color: #ffc21f; }
.scaf-label.red   { color: #ff5a5a; }
.scaf-label.grey  { color: #dcdcdc; }
.scaf-marker.spiderfied { z-index: 10; transition: transform .12s ease-out; }

/* ── Inventory (yard) page ──────────────────────────────────── */
.inv-table td, .inv-table th { vertical-align: middle; }
.inv-table .cat-row td { background: var(--panel2); font-weight: 700; font-size: 12px;
  text-transform: uppercase; letter-spacing: .03em; color: var(--muted); padding: 6px 10px; }
.inv-pn { font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--muted); }
.inv-name { min-width: 220px; }
.inv-name .inv-localname { width: 100%; max-width: 320px; min-height: 34px; padding: 5px 8px;
  box-sizing: border-box; }
.inv-default { margin-top: 2px; }
.inv-qty { font-weight: 700; font-variant-numeric: tabular-nums; transition: background .2s; }
.inv-adjust { white-space: nowrap; }
.inv-adjust .inv-delta { width: 68px; min-height: 34px; padding: 5px 7px; box-sizing: border-box;
  text-align: right; }
.inv-adjust .inv-reason { width: auto; min-width: 120px; max-width: 150px;
  min-height: 34px; padding: 4px 6px; margin: 0 5px; }
.inv-adjust .inv-apply { padding: 5px 12px; }
.inv-act { text-align: center; width: 60px; }
.inv-act .inv-active { width: 18px; height: 18px; min-height: 0; margin: 0; cursor: pointer; }
/* dim an inactive item's content but keep its Active checkbox crisp for re-toggling */
.inv-inactive .inv-pn, .inv-inactive .inv-name, .inv-inactive .inv-qty { opacity: .45; }
.inv-foot { margin-top: 10px; }
/* save feedback flashes */
.inv-ok  { animation: invok 1s ease-out; }
.inv-bad { animation: invbad 1s ease-out; }
@keyframes invok  { 0% { background: rgba(63,185,80,.40); } 100% { background: transparent; } }
@keyframes invbad { 0% { background: rgba(229,83,75,.40); } 100% { background: transparent; } }

@media (max-width: 760px) {
  .inv-adjust { white-space: normal; }
  .inv-adjust .inv-reason { margin: 4px 0; }
}

.inv-scroll { overflow-x: auto; }

/* ── Deployed materials report ──────────────────────────────── */
.dep-form .dep-fields { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.dep-form .dep-fields label { margin: 0; flex: 1 1 150px; min-width: 140px; max-width: 230px; }
.dep-form .dep-or { align-self: flex-end; color: var(--muted); line-height: 40px; }
.dep-form .dep-actions { display: flex; align-items: center; gap: 14px; margin-top: 13px; flex-wrap: wrap; }
.dep-check { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--text); font-size: 14px; }
.dep-check input { width: 18px; height: 18px; min-height: 0; margin: 0; }
.dep-table .dep-closed td { color: var(--muted); }
/* Email-verify nag banner */
.verify-banner { background: #7a5b00; color: #fff; text-align: center; padding: 8px 14px; font-size: 13px; }
.verify-banner .vb-form { display: inline; margin: 0; }
.verify-banner .vb-link { background: none; border: none; color: #ffe08a; text-decoration: underline; cursor: pointer; font: inherit; padding: 0 0 0 4px; }
.usermenu { position: relative; }
.navuser .who {
  color: var(--text); text-decoration: none; font: inherit; font-size: 14px; line-height: 1;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border: 1px solid var(--muted); border-radius: 7px;
  background: var(--panel2); cursor: pointer;
}
.navuser .who::after { content: "\25BE"; font-size: 11px; opacity: .7; margin-left: 2px; }
.navuser .who:hover { border-color: var(--text); background: var(--bd); }
.usermenu-pop {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 60; min-width: 200px;
  background: var(--panel); border: 1px solid var(--bd); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.4); overflow: hidden;
}
.udrop-name { padding: 12px 14px 2px; font-size: 13px; font-weight: 600; color: var(--text); }
.udrop-email { padding: 0 14px 10px; font-size: 11px; color: var(--muted); }
.udrop-divider { border-top: 1px solid var(--bd); }
.udrop-item { display: block; padding: 10px 14px; font-size: 13px; color: var(--muted); text-decoration: none; white-space: nowrap; }
.udrop-item:hover { background: var(--panel2); color: var(--text); }

/* 2FA / authenticator setup */
.totp-setup .totp-steps { margin: 0 0 14px; padding-left: 20px; color: var(--muted); font-size: 14px; }
.totp-setup .totp-steps li { margin: 3px 0; }
.totp-qr { width: 190px; max-width: 100%; margin: 4px 0 10px; background: #fff; padding: 8px; border-radius: 8px; }
.totp-qr svg { display: block; width: 100%; height: auto; }
.totp-key { font-family: monospace; font-size: 18px; letter-spacing: 2px; background: var(--panel2); border: 1px solid var(--bd); border-radius: 6px; padding: 8px 12px; display: inline-block; }
.totp-inline { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.totp-inline label { margin: 0; }
.totp-inline input[type=text] { max-width: 200px; }
.backup-codes { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; margin-top: 12px; max-width: 360px; }
.backup-codes span { font-family: monospace; font-size: 16px; background: var(--panel2); border: 1px solid var(--bd); border-radius: 6px; padding: 8px 10px; text-align: center; }
.site-footer { text-align: center; padding: 22px 16px 30px; margin-top: 20px; color: var(--muted); font-size: 13px; }
.site-footer .foot-line { margin: 2px 0; }
.site-footer a { color: var(--accent); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.invite-link-row { display: flex; gap: 8px; margin-top: 6px; }
.invite-link-row input { flex: 1; min-width: 0; font-family: monospace; font-size: 13px; }
.invoice-doc .inv-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; border-bottom: 2px solid var(--bd); padding-bottom: 12px; margin-bottom: 12px; }
.invoice-doc .inv-co { font-size: 20px; font-weight: 800; }
.invoice-doc .inv-meta { text-align: right; font-size: 13px; }
.invoice-doc .inv-meta div { margin: 1px 0; }
.invoice-doc .inv-billto { margin-bottom: 14px; font-size: 14px; }
.data-table tfoot th { border-top: 2px solid var(--bd); padding: 8px 10px; font-size: 15px; }
.plain-list { margin: 4px 0 0; padding-left: 18px; }
.plain-list li { margin: 2px 0; }
.u-actions { white-space: nowrap; }
.u-actions .u-remove { color: var(--danger); }
.dep-tag-link { color: var(--accent); font-weight: 600; text-decoration: none; }
.dep-tag-link:hover { text-decoration: underline; }
@media print { .dep-tag-link { color: #000; font-weight: 600; text-decoration: none; } }
.dep-legend-closed { color: var(--muted); }
.print-title { display: none; }
@media print {
  .no-print, .topnav { display: none !important; }
  .print-title { display: block; margin: 0 0 10px; }
  .card { border: none; padding: 0; }
  body { background: #fff; color: #000; }
  .data-table th, .data-table td { border-color: #ccc; }
  /* Compact report tables (deployed materials, etc.) so they don't waste pages */
  .print-compact th, .print-compact td { padding: 2.5px 10px; font-size: 10.5px; line-height: 1.2; }
}

.dep-summary { margin: 0 0 10px; }

/* ── Orders ─────────────────────────────────────────────────── */
.ord-status { display: inline-block; padding: 1px 9px; border-radius: 10px; font-size: 12px;
  font-weight: 700; color: #fff; }
.ord-status.open { background: var(--danger); }
.ord-status.complete { background: var(--ok); }

.ord-head { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.ord-head label { margin: 0; }
.ord-scroll { overflow-x: auto; }
.ord-table th:first-child, .ord-table td:first-child { text-align: center; width: 52px; }
.ord-table .ord-add { width: 18px; height: 18px; min-height: 0; margin: 0; cursor: pointer; }
.ord-table .ord-qty { width: 72px; min-height: 34px; padding: 5px 7px; text-align: right; }
.ord-actions { display: flex; align-items: center; gap: 14px; margin-top: 4px; }
.ord-total-wrap { margin-left: auto; font-size: 16px; }

/* PO document */
.po-doc { max-width: 900px; }
.po-title { text-align: center; font-size: 22px; margin: 0 0 14px; }
.po-head { width: 100%; border-collapse: collapse; margin-bottom: 10px; }
.po-head th, .po-head td { border: 1px solid var(--bd); padding: 6px 9px; font-size: 13px; text-align: left; }
.po-head th { background: var(--panel2); color: var(--muted); font-weight: 700; }
.po-parties { display: flex; gap: 14px; margin: 14px 0; flex-wrap: wrap; }
.po-block { flex: 1 1 260px; border: 1px solid var(--bd); border-radius: 8px; padding: 10px 12px; font-size: 13px; }
.po-block-h { font-weight: 700; text-transform: uppercase; font-size: 11px; letter-spacing: .05em;
  color: var(--muted); margin-bottom: 5px; }
.po-block .po-name { font-weight: 700; }
.po-items tfoot td { border-top: 2px solid var(--bd); }
.po-approve { display: flex; gap: 40px; margin-top: 48px; flex-wrap: wrap; }
/* signature line = a real block with height + bottom border (no empty inline
   elements, which detach to the top of the page in print) */
.po-sign { flex: 1 1 240px; }
.po-sign-line { height: 30px; border-bottom: 1px solid var(--muted); }
.po-sign-cap { margin-top: 4px; font-size: 12px; color: var(--muted); }

@media print {
  .no-print, .topnav { display: none !important; }
  /* Force a clean white document: the dark theme must not print. */
  body, .card, .po-doc, .po-block { background: #fff !important; color: #000 !important; }
  .po-doc { border: none; max-width: none; width: 100%; }
  .po-head, .po-items, .data-table { width: 100%; }
  .po-head th, .po-items th, .data-table th { background: #eee !important; color: #000 !important; }
  .po-head td, .po-items td, .data-table td,
  .po-block, .po-block-h, .po-name, .po-title, .sub, .muted { color: #000 !important; }
  .po-head th, .po-head td, .po-block, .data-table th, .data-table td,
  .po-items th, .po-items td { border-color: #999 !important; }
  .po-sign-line { border-bottom-color: #000 !important; }
  .po-sign-cap { color: #000 !important; }
  /* scroll wrappers must lay out naturally on paper, not as a clipped column */
  .inv-scroll, .ord-scroll { overflow: visible !important; }
}

/* Order form: grey deactivated items but keep their Add/Qty usable so they can still be ordered */
.ord-legend { margin: 0 0 10px; }
.ord-table .ord-inactive td { opacity: .45; }
.ord-table .ord-inactive td:first-child, .ord-table .ord-inactive td:nth-child(2) { opacity: 1; }

/* action buttons live in the empty grid cell to the right of Supplier */
.ord-head-actions { grid-column: span 2; display: flex; align-items: flex-end; gap: 12px;
  padding-bottom: 1px; flex-wrap: wrap; }
.ord-head-actions .ord-total-wrap { margin-left: auto; font-size: 16px; }
@media (max-width: 760px) { .ord-head-actions { grid-column: 1; } }

.req { color: var(--danger); font-weight: 700; }

.ord-recv { margin-left: 8px; font-size: 13px; }

/* ── Themed confirm modal (reusable via window.appConfirm) ───── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.6);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px; }
.modal-overlay[hidden] { display: none; }
.modal-box { background: var(--panel); border: 1px solid var(--bd); border-radius: 12px;
  padding: 20px 22px; max-width: 430px; width: 100%; box-shadow: 0 12px 44px rgba(0,0,0,.55); }
.modal-msg { margin: 0 0 18px; color: var(--text); font-size: 15px; line-height: 1.55; white-space: pre-line; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }
.modal-actions .btn-auto { margin-top: 0; }
.btn-danger { background: var(--danger) !important; color: #fff !important; }
.btn-danger:hover { background: #c0403a !important; }

/* ── Floating back-to-top button (all pages) ────────────────── */
.to-top { position: fixed; right: 20px; bottom: 22px; z-index: 90;
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--bd);
  background: var(--panel2); color: var(--text); font-size: 20px; line-height: 1;
  cursor: pointer; box-shadow: 0 4px 14px rgba(0,0,0,.45); }
.to-top:hover { background: var(--panel); border-color: var(--muted); }
.to-top[hidden] { display: none; }
@media print { .to-top { display: none !important; } }

.ord-rowbtns { white-space: nowrap; text-align: right; }
.ord-po-btn { padding: 4px 12px; min-height: 30px; font-size: 13px; }

/* outline button variant + push a trailing Cancel to the right */
.btn-outline { display: inline-block; width: auto; padding: 10px 18px; min-height: 40px;
  background: transparent; color: var(--accent); border: 1px solid var(--accent);
  border-radius: 7px; font-weight: 700; font-size: 14px; cursor: pointer; text-align: center; }
.btn-outline:hover { background: var(--panel2); text-decoration: none; }
.ord-cancel { margin-left: auto; }

/* keep action-row buttons on the same line (base .btn has a margin-top) */
.form-actions .btn { margin-top: 0; }

/* modal Cancel shouldn't read as disabled: give it a solid secondary look */
.modal-actions .btn-ghost { color: var(--text); background: var(--panel2); border-color: var(--muted); }
.modal-actions .btn-ghost:hover { background: var(--bd); border-color: var(--text); color: var(--text); }

/* form-action Cancel/ghost buttons: solid secondary look so they don't read as disabled */
.form-actions .btn-ghost { color: var(--text); background: var(--panel2); border-color: var(--muted); }
.form-actions .btn-ghost:hover { background: var(--bd); border-color: var(--text); color: var(--text); }

/* full-width page container (map): no max-width, fill the browser */
.wrap-full { margin: 0 auto; padding: 14px 18px; }

/* ── Printable scaffold tag ─────────────────────────────────── */
.tag-sheet { display: flex; justify-content: center; }
.tag-card { width: 360px; background: #fff; color: #111; border: 2px solid #111;
  border-radius: 6px; padding: 14px 16px; }
.tag-top { display: flex; justify-content: space-between; align-items: baseline;
  border-bottom: 1px solid #111; padding-bottom: 6px; }
.tag-co { font-weight: 800; font-size: 15px; }
.tag-kind { font-size: 11px; letter-spacing: .12em; color: #444; }
.tag-status { text-align: center; font-weight: 800; font-size: 20px; letter-spacing: .05em;
  color: #fff; padding: 8px; margin: 10px 0; border-radius: 4px; }
.tag-status.green { background: #1f9d55; }
.tag-status.amber { background: #c98a00; }
.tag-status.red   { background: #d64545; }
.tag-status.grey  { background: #8a8f98; }
.tag-id { text-align: center; font-size: 34px; font-weight: 800; letter-spacing: .02em; margin-bottom: 10px; }
.tag-info { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 10px; }
.tag-info th { text-align: left; width: 74px; color: #444; font-weight: 700; padding: 2px 6px 2px 0; vertical-align: top; }
.tag-info td { padding: 2px 0; }
.tag-grid-h { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: #444; margin: 4px 0 4px; }
.tag-log { width: 100%; border-collapse: collapse; font-size: 12px; }
.tag-log th, .tag-log td { border: 1px solid #333; padding: 4px 6px; text-align: left; height: 20px; }
.tag-log th { background: #eee; font-size: 10px; text-transform: uppercase; }
.tag-foot { text-align: center; font-size: 10px; color: #666; margin-top: 8px; }

@media print {
  .no-print, .topnav, .to-top { display: none !important; }
  body { background: #fff; }
  .wrap { max-width: none; padding: 0; }
  .tag-card { border-width: 2px; }
}

/* QR on the printed tag */
.tag-qr { text-align: center; margin: 10px 0; }
.tag-qr-img svg { width: 120px; height: 120px; }
.tag-qr-cap { font-size: 10px; color: #444; margin-top: 2px; }

/* ── Public scaffold status page (QR scan target, mobile-first) ── */
.pub-wrap { max-width: 520px; margin: 0 auto; }
.pub-head { color: var(--muted); font-size: 15px; margin-bottom: 12px; }
.pub-head strong { color: var(--text); font-size: 18px; }
.pub-status { border-radius: 12px; padding: 22px 16px; text-align: center; color: #fff; margin-bottom: 14px; }
.pub-status.green { background: #1f9d55; }
.pub-status.amber { background: #c98a00; }
.pub-status.red   { background: #d64545; }
.pub-status.grey  { background: #6c7280; }
.pub-status-label { font-size: 30px; font-weight: 800; letter-spacing: .02em; }
.pub-status-sub { font-size: 15px; margin-top: 6px; opacity: .95; }
.pub-due { background: rgba(242,194,0,.15); border: 1px solid #c98a00; color: #f2c200;
  border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; font-weight: 600; }
.pub-recorded { background: rgba(74,222,128,.15); border: 1px solid #2e9e57; color: #4ade80;
  border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; font-weight: 600; }
/* read-only scaffold record: disabled fieldset must not add chrome or dim the text */
fieldset.sf-ro { border: 0; margin: 0; padding: 0; min-width: 0; }
fieldset.sf-ro :disabled { opacity: 1; color: var(--text); -webkit-text-fill-color: var(--text); }
.pub-defect { background: var(--panel2); border: 1px solid var(--bd); border-radius: 8px;
  padding: 10px 12px; margin-bottom: 12px; font-size: 14px; }
.pub-info { width: 100%; border-collapse: collapse; margin-bottom: 12px; table-layout: fixed; }
.pub-info th { text-align: left; width: 96px; color: var(--muted); font-weight: 600;
  padding: 6px 8px 6px 0; vertical-align: top; font-size: 14px; }
.pub-info td { padding: 6px 0; border-bottom: 1px solid var(--bd); }
.pub-last { color: var(--muted); font-size: 13px; margin-bottom: 14px; }
.pub-inspect { display: block; width: 100%; text-align: center; text-decoration: none; }
.pub-note { text-align: center; margin-top: 8px; }
.pub-info td, .pub-info th { overflow-wrap: anywhere; }
/* mobile full record cards */
.rec-card { background: var(--panel); border: 1px solid var(--bd); border-radius: 10px;
  padding: 12px 14px; margin-bottom: 12px; }
.rec-h { font-size: 15px; margin: 0 0 6px; }
.rec-info { margin-bottom: 0; }
.rec-info th { width: auto; font-weight: 500; color: var(--text); }
.rec-info td { text-align: right; white-space: nowrap; color: var(--muted); }
.rec-mat { font-weight: 500; }
.rec-qty { font-weight: 700; color: var(--text); }
.rec-insp { list-style: none; margin: 0; padding: 0; }
.rec-insp li { padding: 8px 0; border-bottom: 1px solid var(--bd); }
.rec-insp li:last-child { border-bottom: none; }
.rec-insp-res { display: inline-block; font-weight: 800; font-size: 11px; padding: 1px 7px;
  border-radius: 9px; color: #fff; margin-right: 6px; }
.rec-insp-res.green { background: #1f9d55; } .rec-insp-res.amber { background: #c98a00; }
.rec-insp-res.red { background: #d64545; }
.rec-insp-meta { color: var(--muted); font-size: 13px; }
.rec-insp-def { font-size: 13px; margin-top: 3px; }

/* ── Scaffold tag insert print-overlay (3.125in x 7.625in tag-holder card) ── */
.insert-page { position: relative; width: 3.125in; height: 7.625in; background: #fff;
  color: #000; margin: 0 auto; }
.ins-fld { position: absolute; font: 700 11pt Arial, Helvetica, sans-serif; color: #000;
  white-space: nowrap; }
/* estimated positions of the insert's white write-on lines (tune after a test print) */
.ins-scafno     { top: 1.34in; left: 1.55in; }
.ins-jobsite    { top: 1.80in; left: 1.55in; font-size: 9pt; }
.ins-date       { top: 2.26in; left: 1.55in; }
.ins-erectprint { top: 3.46in; left: 1.10in; font-size: 9pt; }
@media screen {
  .insert-page { border: 1px solid var(--bd); box-shadow: 0 4px 14px rgba(0,0,0,.4); margin-top: 6px; }
  .ins-fld { outline: 1px dashed #4a90e2; }
}
@media print {
  .no-print, .topnav, .to-top { display: none !important; }
  body { background: #fff; }
  .wrap, .wrap-full { max-width: none; margin: 0; padding: 0; }
  /* @page size for the insert lives in scaffold_insert.html so it can't shrink
     other print pages (a global @page applies to the whole print job). */
  .insert-page { border: none; box-shadow: none; margin: 0; }
  .ins-fld { outline: none; }
}

/* ── Our own scaffold tag insert (3.125in x 7.625in, double-sided) ── */
.ins2 { width: 3.125in; height: 7.625in; box-sizing: border-box; color: #fff; margin: 0 auto;
  background: #1f9d55; font-family: Arial, Helvetica, sans-serif; display: flex;
  flex-direction: column; overflow: hidden; padding: 7px 0 10px; }
.ins2.yellow { background: #f2c200; color: #141414; }
.ins2.green { color: #0e1a12; }
.ins2.red { background: #cf2f27; color: #111; }
.ins2-tag { text-align: center; font-weight: 800; font-size: 19pt; letter-spacing: .04em; padding: 0 6px 2px; }
.ins2-row { display: flex; align-items: flex-end; gap: 5px; padding: 2px 9px; font-size: 8pt; }
.ins2-lbl { font-weight: 700; white-space: nowrap; }
.ins2-val { flex: 1; border-bottom: 1.4px solid currentColor; min-height: 13px; font-weight: 700; padding-left: 3px; }
.ins2-sec { text-align: center; font-weight: 800; font-size: 8pt; letter-spacing: .04em;
  margin-top: 5px; padding-top: 3px; border-top: 1.4px solid currentColor; }
.ins2-warnblock { display: flex; flex-direction: column; align-items: center;
  text-align: center; gap: 12px; padding: 14px 8px 10px; }
.ins2-tri { width: 1.05em; height: 1.05em; vertical-align: -.16em; }
.ins2-tagword { display: inline-flex; align-items: center; gap: 8px; font-weight: 900;
  font-size: 17pt; letter-spacing: .03em; border: 3px solid currentColor; border-radius: 4px; padding: 3px 14px; }
.ins2-big { font-size: 27pt; font-weight: 900; line-height: 1; letter-spacing: 0; }
.ins2-sub { font-size: 13pt; font-weight: 800; line-height: 1.05; letter-spacing: .02em; }
.ins2-qr { align-self: center; margin-top: auto; background: #fff; padding: 5px; border-radius: 4px; }
.ins2-qr svg { width: 0.95in; height: 0.95in; display: block; }
/* inline inspection sign-off grid: a white block inset on the colored tag */
.ins2-gridwrap { background: #fff; color: #000; margin: 8px 8px 0; border: 1px solid rgba(0,0,0,.5);
  border-radius: 3px; overflow: hidden; }
.ins2-grid-title { background: #e9e9e9; color: #000; font-weight: 800; font-size: 8pt;
  text-align: center; padding: 2px; letter-spacing: .06em; }
.ins2-grid { width: 100%; border-collapse: collapse; table-layout: fixed; }
.ins2-grid th { background: #f2f2f2; color: #000; font-size: 6.5pt; font-weight: 800; padding: 2px 4px;
  border: 1px solid #999; text-align: left; }
.ins2-grid td { border: 1px solid #999; font-size: 7.5pt; padding: 2px 4px; height: .19in; }
.ins2-grid-ok { width: 0.32in; text-align: center; }
.ins2-grid-time { width: 0.52in; }

@media screen {
  .ins2 { box-shadow: 0 4px 16px rgba(0,0,0,.4); margin-top: 6px; }
}
@media print {
  .no-print, .topnav, .to-top { display: none !important; }
  body { background: #fff; }
  .wrap, .wrap-full { max-width: none; margin: 0; padding: 0; }
  /* @page size lives in scaffold_insert.html, see note above. */
  .ins2 { box-shadow: none; margin: 0; }
}
.btn-ghost.on { border-color: var(--accent); color: var(--accent); }

/* red insert variant */
.ins2.red { border-color: #c62f2f; }
.ins2.red .ins2-hd { background: #d64545; color: #fff; }
.ins2.red .ins2-band { background: #d64545; color: #fff; }
.ins2.red .ins2-title { color: #8f1f1f; }

/* user form site checkboxes + plant portal */
.site-checks { display: flex; flex-wrap: wrap; gap: 6px 20px; margin-top: 6px; }
.site-checks .dep-check { margin: 0; }

.role-help { margin: 6px 0 4px; line-height: 1.6; }
.role-help strong { color: var(--text); }

/* New-user form: 2-col grid so role help sits right of/under Role, competent stays left */
.user-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; align-items: start; }
.user-grid > label { margin: 0; }
.user-grid .user-desig { align-self: center; }
.user-grid .role-help { margin: 0; align-self: start; }
.user-grid .user-sites { grid-column: 1 / -1; margin-top: 4px; }
@media (max-width: 760px) { .user-grid { grid-template-columns: 1fr; } }

/* user capabilities checklist (site users) */
.user-caps { grid-column: 1 / -1; margin-top: 2px; }
.cap-checks { display: grid; grid-template-columns: 1fr 1fr; gap: 7px 18px; margin-top: 6px; }
.cap-item { display: flex; align-items: flex-start; gap: 8px; margin: 0; color: var(--text); font-size: 14px; }
.cap-item input { margin-top: 3px; width: 16px; height: 16px; }
@media (max-width: 640px) { .cap-checks { grid-template-columns: 1fr; } }
