/* =============================================================================
   PWAtor — Prevailing Wage & Davis-Bacon lookup
   Light, printable "official wage sheet" theme.
   ========================================================================== */
:root {
  --page: #eef1f5;
  --paper: #ffffff;
  --ink: #1a2230;
  --ink-dim: #5b6675;
  --line: #d6dbe3;
  --line-soft: #eaedf2;
  --head: #f3f5f8;
  --accent: #1f4e8c;        /* official navy */
  --accent-soft: #e8eef7;
  --total: #0f7a4d;
  --warn: #a8660a;
  --warn-bg: #fdf6e7;
  --zebra: #f8fafc;
  --radius: 6px;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
  --sans: "Inter", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--page);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Control bar (screen only) ---------- */
.app-header {
  position: sticky; top: 0; z-index: 20;
  background: var(--accent);
  color: #fff;
  padding: 10px 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,.18);
}
.app-header .row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; max-width: 1000px; margin: 0 auto; }
.brand { display: flex; align-items: baseline; gap: 10px; }
.brand h1 { font-size: 18px; margin: 0; letter-spacing: -0.3px; font-weight: 700; }
.brand .tag { color: #c5d6ef; font-size: 12px; }
.location-pickers { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; }
select.picker, input.search {
  background: #fff; border: 1px solid #b9c4d4; color: var(--ink);
  padding: 7px 11px; border-radius: 6px; font-size: 13px; font-family: var(--sans);
}
select.picker:focus, input.search:focus { outline: 2px solid #9fc0ef; outline-offset: -1px; }
input.search { min-width: 220px; }
.btn { background: #fff; border: 1px solid #b9c4d4; color: var(--accent); padding: 7px 13px; border-radius: 6px; cursor: pointer; font-size: 13px; font-family: var(--sans); font-weight: 600; }
.btn:hover { background: var(--accent-soft); }

/* ---------- The "paper" document ---------- */
.container {
  max-width: 1000px; margin: 26px auto 70px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(20,30,50,.08);
  padding: 34px 40px 44px;
}

/* ---------- Document masthead ---------- */
.masthead { border-bottom: 3px solid var(--accent); padding-bottom: 16px; margin-bottom: 6px; }
.masthead .eyebrow { color: var(--accent); font-size: 12px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; }
.masthead h2 { font-size: 27px; margin: 4px 0 2px; letter-spacing: -0.5px; }
.masthead .sub { color: var(--ink-dim); font-size: 13px; }

/* ---------- Summary cards ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px,1fr)); gap: 12px; margin: 20px 0 22px; }
.card { background: var(--head); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.card .k { color: var(--ink-dim); font-size: 11px; text-transform: uppercase; letter-spacing: .6px; font-weight: 600; }
.card .v { font-size: 19px; font-weight: 700; margin-top: 3px; }
.card .v.small { font-size: 14px; font-weight: 600; }

.card.ok .v { color: var(--total); }
.card.bad .v { color: #c0392b; }

/* ---------- Source legend ---------- */
.source-legend { display: flex; gap: 18px; flex-wrap: wrap; align-items: center; padding: 10px 14px; background: var(--head); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 18px; font-size: 12.5px; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; color: var(--ink); }
.lg-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.lg-dot.ok { background: var(--total); }
.lg-dot.input { background: var(--accent); }
.lg-dot.pending { background: #d9b34a; }
.lg-status { color: var(--ink-dim); font-size: 11px; text-transform: uppercase; letter-spacing: .4px; }

/* ---------- Toolbar controls ---------- */
.tb-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tb-label { font-size: 12px; color: var(--ink-dim); font-weight: 600; }
.picker.sm { padding: 5px 9px; font-size: 12.5px; }
.btn.ghost { background: #fff; color: var(--ink-dim); font-weight: 500; }
.btn.ghost:hover { color: #c0392b; border-color: #e0a9a0; background: #fdf2f0; }

/* ---------- Toolbar ---------- */
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.chip-row { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { background: #fff; border: 1px solid var(--line); color: var(--ink-dim); padding: 4px 11px; border-radius: 20px; font-size: 12px; cursor: pointer; }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.result-count { margin-left: auto; color: var(--ink-dim); font-size: 12px; }

/* ---------- Determination meta ---------- */
.det-meta { background: var(--accent-soft); border: 1px solid #cdddf2; border-radius: var(--radius); padding: 11px 16px; margin-bottom: 14px; font-size: 12.5px; color: var(--ink-dim); display: flex; gap: 22px; flex-wrap: wrap; align-items: center; }
.det-meta strong { color: var(--ink); }
.det-meta .pill { background: #fff; border: 1px solid #cdddf2; border-radius: 5px; padding: 2px 8px; color: var(--accent); font-family: var(--mono); font-size: 12px; font-weight: 600; }

/* ---------- Table ---------- */
.table-wrap { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th { text-align: left; padding: 9px 14px; background: var(--head); color: var(--ink-dim); font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; border-bottom: 2px solid var(--line); cursor: pointer; user-select: none; white-space: nowrap; }
thead th.num { text-align: right; }
thead th .arrow { opacity: .35; font-size: 9px; }
thead th.sorted .arrow { opacity: 1; color: var(--accent); }
tbody td { padding: 9px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
tbody tr:nth-child(even) { background: var(--zebra); }
tbody tr:hover { background: var(--accent-soft); }
tbody tr:last-child td { border-bottom: none; }
td.num { text-align: right; font-family: var(--mono); }
td.total { color: var(--total); font-weight: 700; font-family: var(--mono); }
.trade-tag { display: inline-block; font-size: 10.5px; padding: 1px 7px; border-radius: 5px; background: var(--line-soft); color: var(--ink-dim); margin-right: 8px; white-space: nowrap; font-weight: 600; }
td.cls { min-width: 230px; }

/* cell internals */
.cell-total { font-family: var(--mono); font-weight: 600; font-size: 14px; }
.cell-sub { font-family: var(--mono); font-size: 11px; color: var(--ink-dim); margin-top: 1px; }
.cell-meta { font-family: var(--mono); font-size: 10.5px; color: #98a2b1; margin-top: 2px; }
.src-empty { color: #b7c0cd; }

/* OpCo column (highlighted, editable) */
th.head-opco { background: #eef5ff; color: var(--accent); }
td.opco-cell { background: #f6faff; }
tbody tr:nth-child(even) td.opco-cell { background: #eef5fc; }
.opco-inputs { display: flex; align-items: center; gap: 4px; justify-content: flex-end; }
.opco-in { width: 58px; padding: 4px 6px; border: 1px solid #b9c4d4; border-radius: 5px; font-family: var(--mono); font-size: 12px; text-align: right; }
.opco-in:focus { outline: 2px solid #9fc0ef; outline-offset: -1px; }
.opco-inputs .plus { color: var(--ink-dim); font-size: 11px; }
.opco-total { text-align: right; margin-top: 3px; color: var(--accent); }
td.req .cell-total { color: var(--ink); }

/* compliance status badges */
.status { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 20px; white-space: nowrap; }
.status.pass { background: #e3f6ec; color: #0f7a4d; }
.status.short { background: #fdeceb; color: #c0392b; }
.status.no-opco { background: #eef0f3; color: #7b8694; }
.status.no-req { background: #f4f1e8; color: #8a7a45; }

/* ---------- Notices / empty ---------- */
.notice { background: var(--warn-bg); border: 1px solid #efd9a8; border-radius: var(--radius); padding: 14px 17px; color: #7a5208; margin-bottom: 16px; font-size: 13px; }
.notice b { color: var(--warn); }
.notice.info { background: var(--accent-soft); border-color: #cdddf2; color: #234e85; }
.empty { padding: 42px; text-align: center; color: var(--ink-dim); }

/* ---------- Disclaimer ---------- */
.disclaimer { margin-top: 26px; color: var(--ink-dim); font-size: 11.5px; line-height: 1.7; border-top: 1px solid var(--line); padding-top: 14px; }

/* ---------- Print: clean official sheet ---------- */
@media print {
  @page { margin: 0.6in; }
  body { background: #fff; }
  .app-header, .toolbar, .tabs { display: none !important; }
  .container { box-shadow: none; border: none; margin: 0; max-width: 100%; padding: 0; border-radius: 0; }
  .card { background: #fff; }
  .det-meta { background: #fff; }
  thead th { background: #f0f0f0; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  tbody tr:nth-child(even) { background: #f7f7f7; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  td.total { color: #060 !important; }
  .table-wrap, td, th { border-color: #bbb !important; }
}
