:root {
  --brand: #1F4D3A; --accent: #C8892B; --bg: #F5F6F4; --card: #FFFFFF; --text: #1C2321; --muted: #6B7470;
  --line: #E1E4E0; --ok: #1E7B45; --warn: #B4531A; --danger: #B3261E; --radius: 8px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; font-size: 15px; color: var(--text);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); line-height: 1.45; }
a { color: var(--brand); }
h1 { font-size: 1.5rem; margin: 0 0 .5rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; margin: 0 0 .6rem; }
.topbar { display: flex; align-items: center; gap: 1rem; background: var(--brand); color: #fff; padding: .6rem 1rem; position: sticky; top: 0; z-index: 20; }
.topbar a, .topbar .link { color: #fff; text-decoration: none; }
.topbar .logo { font-weight: 700; font-size: 1.05rem; white-space: nowrap; }
.topbar .search { flex: 1; max-width: 520px; } .topbar .search input { width: 100%; border: 0; border-radius: 6px; padding: .45rem .7rem; }
.top-actions { display: flex; gap: 1rem; align-items: center; margin-left: auto; } .top-actions select { max-width: 180px; }
.badge { background: var(--accent); border-radius: 10px; padding: 0 .45rem; font-size: .8rem; }
.nav-toggle { display: none; background: none; border: 0; color: #fff; font-size: 1.3rem; }
.shell { display: flex; min-height: calc(100vh - 52px); }
.sidebar { width: 220px; background: #fff; border-right: 1px solid var(--line); padding: 1rem 0; flex-shrink: 0; }
.sidebar a { display: block; padding: .55rem 1.2rem; color: var(--text); text-decoration: none; }
.sidebar a.active, .sidebar a:hover { background: #EEF3EF; color: var(--brand); font-weight: 600; border-left: 3px solid var(--brand); padding-left: calc(1.2rem - 3px); }
.sidebar .sep { border-top: 1px solid var(--line); margin: .6rem 0; }
.content { flex: 1; padding: 1.25rem 1.5rem 3rem; min-width: 0; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.page-head.small { margin-bottom: .5rem; } .actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem; margin-bottom: 1rem; }
.card.narrow { max-width: 440px; margin: 2rem auto; } .card.highlight { border-color: var(--accent); background: #FFF9F0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; } .grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .8rem 1.2rem; }
.form-grid .field-textarea, .form-grid .field-json, .span-all, .form-actions { grid-column: 1 / -1; }
label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .5rem; }
label.check { font-weight: 400; display: flex; gap: .4rem; align-items: center; }
input, select, textarea { font: inherit; padding: .45rem .55rem; border: 1px solid #C9CEC9; border-radius: 6px; width: 100%; background: #fff; margin-top: .2rem; }
input[type=checkbox], input[type=radio] { width: auto; margin: 0; } input[type=color] { padding: 2px; height: 36px; }
.inline { display: inline-flex; gap: .4rem; align-items: center; } .inline input, .inline select { width: auto; margin: 0; }
.inline-form { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; } .inline-form h3 { width: 100%; }
.inline-form input, .inline-form select { width: auto; flex: 1 1 160px; margin: 0; } .inline-form.compact input, .inline-form.compact select { flex: 0 1 130px; }
.btn { display: inline-block; padding: .45rem .9rem; border: 1px solid #C9CEC9; border-radius: 6px; background: #fff; color: var(--text); cursor: pointer; text-decoration: none; font: inherit; font-weight: 600; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; } .btn.danger { color: var(--danger); border-color: var(--danger); }
.btn.small { padding: .25rem .6rem; font-size: .85rem; } .btn.full { width: 100%; margin-top: .5rem; } .btn:hover { filter: brightness(.96); }
button.link { background: none; border: 0; padding: 0; cursor: pointer; font: inherit; color: inherit; text-decoration: underline; }
.flash { padding: .7rem 1rem; border-radius: 6px; margin-bottom: 1rem; } .flash.error { background: #FCE8E6; color: var(--danger); } .flash.success { background: #E6F4EA; color: var(--ok); }
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 1rem; }
.card .table-wrap { border: 0; }
.table { width: 100%; border-collapse: collapse; } .table th, .table td { padding: .5rem .7rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.table th { background: #FAFBFA; font-size: .85rem; color: var(--muted); white-space: nowrap; } .table th a { color: inherit; text-decoration: none; }
.table tr[data-href] { cursor: pointer; } .table tr[data-href]:hover { background: #F7FAF8; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; } .table tfoot td { font-weight: 700; background: #FAFBFA; }
.dl { display: grid; grid-template-columns: 180px 1fr; gap: .35rem 1rem; margin: 0; } .dl dt { color: var(--muted); font-size: .9rem; } .dl dd { margin: 0; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .mono { font-family: ui-monospace, Menlo, Consolas, monospace; overflow-wrap: anywhere; } .center { text-align: center; }
.warn { color: var(--warn); } .ok { color: var(--ok); } .nowrap { white-space: nowrap; } .req { color: var(--danger); } .unit { color: var(--muted); font-weight: 400; }
.help { font-size: .8rem; color: var(--muted); } .has-error input, .has-error select, .has-error textarea { border-color: var(--danger); } .error-text { color: var(--danger); font-size: .85rem; }
.pre { white-space: pre-wrap; } .swatch { display: inline-block; width: 14px; height: 14px; border-radius: 3px; vertical-align: middle; border: 1px solid var(--line); }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; }
.kpi-n { font-size: 1.6rem; font-weight: 700; color: var(--brand); font-variant-numeric: tabular-nums; } .kpi-l { color: var(--muted); font-size: .85rem; }
.kpi.bad .kpi-n { color: var(--danger); } .kpi.good .kpi-n { color: var(--ok); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .8rem; }
.tile { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; text-decoration: none; color: var(--text); display: flex; flex-direction: column; gap: .3rem; }
.tile:hover { border-color: var(--brand); } .tile span { color: var(--muted); font-size: .88rem; }
.pill { display: inline-block; padding: .05rem .5rem; border-radius: 10px; background: #EEE; font-size: .78rem; font-weight: 600; color: var(--muted); }
.pill.ok { background: #E6F4EA; color: var(--ok); } .pill.warn { background: #FDEFE3; color: var(--warn); } .pill.bad { background: #FCE8E6; color: var(--danger); }
.tags { display: flex; flex-wrap: wrap; gap: .3rem; margin-bottom: .5rem; } .tag { background: var(--tag, #667); color: #fff; border-radius: 12px; padding: .1rem .55rem; font-size: .82rem; }
.tag button { color: #fff; text-decoration: none; }
.alerts, .tasks, .files, .history { list-style: none; padding: 0; margin: 0; } .alerts li, .tasks li, .files li, .history li { padding: .45rem 0; border-bottom: 1px solid var(--line); }
.alerts li.lvl-alert { border-left: 3px solid var(--danger); padding-left: .5rem; } .alerts li.lvl-warning { border-left: 3px solid var(--warn); padding-left: .5rem; } .alerts li.read { opacity: .6; }
.pager { display: flex; gap: .3rem; flex-wrap: wrap; } .pager a { padding: .2rem .55rem; border: 1px solid var(--line); border-radius: 4px; text-decoration: none; background: #fff; } .pager a.active { background: var(--brand); color: #fff; }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: .3rem 1rem; margin-bottom: .8rem; } .perm-grid code { color: var(--muted); font-size: .75rem; }
.codes { columns: 2; } .qr { display: flex; justify-content: center; margin: 1rem 0; } .qr img, .qr canvas { width: 200px; height: 200px; image-rendering: pixelated; }
.bare .bare-main { padding: 1rem; } .brand-mark { text-align: center; font-weight: 800; font-size: 1.4rem; color: var(--brand); margin-top: 2rem; }
.intro { color: var(--muted); max-width: 820px; }
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(170px, 1fr); gap: .7rem; overflow-x: auto; padding-bottom: .5rem; }
.board-col { background: #EEF1EE; border-radius: var(--radius); padding: .5rem; min-height: 200px; } .board-col h4 { margin: .2rem .3rem .5rem; font-size: .9rem; }
.board-col.drop { outline: 2px dashed var(--brand); }
.board-card { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: .5rem .6rem; margin-bottom: .45rem; cursor: grab; font-size: .88rem; }
.board-card .small { display: block; } .board-card.weather { border-left: 3px solid #3B7DD8; } .board-card.blocked { border-left: 3px solid var(--danger); }
.map { height: 460px; border-radius: var(--radius); border: 1px solid var(--line); }
.sig-pad { border: 2px dashed #B9C0BA; border-radius: 6px; width: 100%; height: 160px; touch-action: none; background: #fff; }
.letterhead { background: #fff; max-width: 860px; margin: 0 auto; padding: 0 0 2rem; border: 1px solid var(--line); }
.letterhead .lh-banner { background: var(--brand); color: #fff; padding: 1.2rem 2rem; display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.letterhead .lh-banner img { max-height: 70px; max-width: 260px; } .letterhead .lh-body { padding: 1.5rem 2rem; }
.letterhead .lh-footer { border-top: 3px solid var(--accent); margin: 1rem 2rem 0; padding-top: .6rem; font-size: .82rem; color: var(--muted); }
.option-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; } .option-card.recommended { border: 2px solid var(--brand); }
.ai-panel textarea { min-height: 90px; } .ai-answer { white-space: pre-wrap; background: #F7F8F6; border-radius: 6px; padding: .8rem; margin-top: .6rem; }
.lint-hit { background: #FFF3CD; border-radius: 3px; padding: 0 2px; }
@media (max-width: 900px) {
  .sidebar { display: none; position: fixed; top: 52px; left: 0; bottom: 0; z-index: 30; box-shadow: 2px 0 12px rgba(0,0,0,.1); }
  .sidebar.open { display: block; } .nav-toggle { display: block; } .topbar .search { display: none; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; } .content { padding: 1rem; } .dl { grid-template-columns: 1fr; } .top-actions { gap: .6rem; font-size: .9rem; }
}
/* Wide tables and grids inside cards scroll inside the card, never the whole page */
.card { overflow-x: auto; } .content, .grid-2 > *, .grid-3 > *, .layout > * { min-width: 0; }
.map { overflow: hidden; max-width: 100%; }
@media (max-width: 600px) {
  .topbar { gap: .6rem; padding: .5rem .75rem; } .topbar .logo { min-width: 0; overflow: hidden; text-overflow: ellipsis; flex: 1; }
  .top-actions { gap: .7rem; font-size: .85rem; } .top-actions .user-name { display: none; } .top-actions select { max-width: 110px; }
  .btn, button, input[type=submit], select, input:not([type=checkbox]):not([type=radio]) { min-height: 44px; }
  .btn.small { min-height: 40px; } form.inline { display: flex; flex-wrap: wrap; } .inline input, .inline select { max-width: 100%; } .table th, .table td { padding: .5rem; }
}
@media print {
  .topbar, .sidebar, .actions, .no-print, .flash { display: none !important; } .content { padding: 0; } .card { border: 0; } body { background: #fff; }
  .letterhead { border: 0; } .letterhead .lh-banner { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
.badge.bad { background: var(--danger); color: #fff; }
.tag-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .8rem; }
.tag { border: 1px dashed var(--line, #CCC); border-radius: 6px; padding: .6rem; text-align: center; break-inside: avoid; }
.tag .qr { display: flex; justify-content: center; margin-bottom: .3rem; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .5rem; }
.photo-grid img { width: 100%; height: 120px; object-fit: cover; border-radius: 4px; }
.gantt { width: 100%; overflow-x: auto; } .gantt svg { min-width: 640px; }
.prio-flash { position: fixed; inset: 0 0 auto 0; z-index: 1000; display: block; padding: 1.2rem 1rem; background: #C5221F; color: #fff !important; font-weight: 700; font-size: 1.1rem; text-align: center; text-decoration: none; animation: prioflash 1s steps(2, start) infinite; }
@keyframes prioflash { to { background: #7A1210; } }
.checklist li { display: flex; gap: .5rem; align-items: flex-start; padding: .4rem 0; border-bottom: 1px solid #EEE; list-style: none; }
.checklist li.done { color: var(--muted); }
@media print { .tag-grid { grid-template-columns: repeat(3, 1fr); } }

/* offline-first crew phone */
.offline-bar { position: sticky; top: 0; z-index: 50; background: #FFF4CE; color: #4A3B00; border-bottom: 1px solid #E8D48A; padding: .6rem 1rem; font-size: .95rem; }
.offline-bar.bad { background: #FCE8E6; color: var(--danger); border-color: #F3B8B2; }
.offline-bar .offline-note { font-weight: 600; }
.offline-rejected { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin-top: .4rem; }
.offline-rejected .btn { margin-left: auto; }
form.offline-saved { opacity: .7; }
form.offline-saved::after { content: "Saved on this phone — sending when there is signal"; display: block; font-size: .85rem; margin-top: .3rem; }

/* conversations */
.msg { padding: .5rem .7rem; border-radius: 8px; margin: .4rem 0; max-width: 46rem; background: #F1F3F4; }
.msg-out { background: #E6F4EA; margin-left: auto; } .msg-note { background: #FFF4CE; font-style: italic; }
.client-page { max-width: 44rem; margin: 0 auto; padding: 1rem; }

/* KPIs */
a.kpi { text-decoration: none; color: inherit; }
.kpi.light-green { border-left: 6px solid var(--ok); } .kpi.light-amber { border-left: 6px solid #E8A200; } .kpi.light-red { border-left: 6px solid var(--danger); }
.kpi-front { text-align: center; }
.tv { padding: 1.5rem; font-size: 1.25rem; } .tv header { display: flex; justify-content: space-between; align-items: baseline; }
.tv-storm { background: #E8F0FE; padding: .8rem 1rem; border-radius: 8px; margin: .8rem 0; }
.tv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); gap: 1rem; margin-top: 1rem; }

/* Manager Mobile */
.mobile { max-width: 640px; margin: 0 auto; }
.mobile .m-item { display: flex; justify-content: space-between; align-items: center; gap: .6rem; padding: .55rem 0; border-bottom: 1px solid var(--line, #e5e5e5); }
.mobile .m-buttons { display: flex; gap: .4rem; flex-shrink: 0; }
.mobile .m-buttons .btn { min-height: 44px; min-width: 88px; }
.mobile .storm { display: block; background: #b3261e; color: #fff; text-decoration: none; }
.mobile textarea, .mobile input, .mobile select { width: 100%; }
.sop-steps li { margin: .45rem 0; line-height: 1.45; }

/* Team chat */
.chat-log { max-height: 60vh; overflow-y: auto; display: flex; flex-direction: column; gap: .45rem; margin-bottom: .6rem; }
.chat-msg { background: var(--panel, #f4f4f4); padding: .45rem .6rem; border-radius: 8px; max-width: 85%; white-space: pre-wrap; }
.chat-msg.mine { align-self: flex-end; background: #e3efe6; }
.chat-form textarea { width: 100%; }

/* BIG1 2026-11-27: larger text on client pages (proposals, change orders, signing links) for older clients. Undo: restore ~/hq-private/bak-20261127-big1/app.css */
:is(.client-page, .bare-main .letterhead) { font-size: 1.125rem; line-height: 1.55; }
:is(.client-page, .bare-main .letterhead) input, :is(.client-page, .bare-main .letterhead) textarea, :is(.client-page, .bare-main .letterhead) select, :is(.client-page, .bare-main .letterhead) button, :is(.client-page, .bare-main .letterhead) .btn { font-size: 1.05rem; min-height: 2.75rem; }
:is(.client-page, .bare-main .letterhead) .small { font-size: .95rem; }
:is(.client-page, .bare-main .letterhead) input[type=checkbox], :is(.client-page, .bare-main .letterhead) input[type=radio] { width: 1.35rem; height: 1.35rem; min-height: 0; vertical-align: middle; }
:is(.client-page, .bare-main .letterhead) label { font-size: 1rem; } /* BIG1 labels */

/* PRO1 2026-11-27: typed signature on computer, finger signature on phone */
[data-sig-box].mode-type .sig-draw-area, [data-sig-box].mode-draw .sig-type-area { display: none; }
.sig-preview { font-family: "Segoe Script","Brush Script MT","Lucida Handwriting","Apple Chancery","Snell Roundhand",cursive; font-size: 2.4rem; color: #1a2a4a; border-bottom: 2px solid #999; padding: .4rem .6rem .2rem; min-height: 3.8rem; background: #fbfbf8; border-radius: 6px 6px 0 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.sig-preview.empty { color: #bbb; font-family: inherit; font-size: 1rem; line-height: 3rem; }
.sig-draw-area canvas.sig-pad { width: 100%; height: 170px; border: 1px dashed #999; border-radius: 6px; background: #fff; touch-action: none; }

/* CPT1 2026-11-27: client account page */
.cp-timeline { list-style: none; margin: .5rem 0 0 .4rem; padding: 0; border-left: 3px solid var(--brand, #1F4D3A); }
.cp-timeline li { position: relative; padding: 0 0 1.3rem 1.2rem; }
.cp-timeline li::before { content: ''; position: absolute; left: -.6rem; top: .3rem; width: .85rem; height: .85rem; border-radius: 50%; background: var(--brand, #1F4D3A); border: 2px solid #fff; }
.cp-date { font-size: .9rem; color: #666; font-weight: 600; }
.cp-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: .5rem; margin-top: .5rem; }
.cp-photos img { width: 100%; height: 110px; object-fit: cover; border-radius: 6px; display: block; }
.cp-docs { list-style: none; padding: 0; margin: 0; } .cp-docs li { padding: .55rem 0; border-bottom: 1px solid #eee; }
.cp-review { background: #f4f8f5; border-left: 4px solid var(--brand, #1F4D3A); }
