/* DatumField. High-contrast and readable outdoors. Lamar Services Group palette: navy, ink, blue, cyan. */
:root {
  --navy: #102839; --navy-2: #173a52; --ink: #153447; --ink-2: #3c5566; --muted: #536572; --line: #d7e0e5; --bg: #eff4f6; --card: #fff;
  --blue: #24667e; --blue-dk: #1b5064; --cyan: #64c6e5; --green: #60a030;
  --accent: #24667e; --accent-ink: #fff; --shadow: 0 1px 2px rgba(16,40,57,.06), 0 1px 3px rgba(16,40,57,.08); --ok: #1d6b3a; --ok-bg: #e7f4ec; --warn: #8a5a00; --warn-bg: #fff4d9;
  --err: #a1121a; --err-bg: #fde8e9; --info-bg: #e3f1f6; --radius: 10px; --tap: 44px;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px; color: var(--ink); background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; line-height: 1.45; }
a { color: var(--accent); }
h1 { font-size: 1.55rem; margin: 0 0 .25rem; color: var(--navy); letter-spacing: -.01em; }
h2 { font-size: 1.1rem; margin: 0 0 .6rem; color: var(--navy); }
h3 { font-size: 1rem; margin: 1.2rem 0 .5rem; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--muted); } .small { font-size: .85rem; } .mono { font-family: ui-monospace, Menlo, Consolas, monospace; }
.pre { white-space: pre-wrap; } .warn-text { color: var(--warn); } .clip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; display: block; }

/* Top bar */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; gap: 1rem; align-items: center; padding: .5rem 1.25rem; background: #fff; color: var(--navy); min-height: 56px; border-bottom: 3px solid var(--navy); box-shadow: 0 1px 4px rgba(16,40,57,.08); }
.brand { display: inline-flex; align-items: center; flex: none; text-decoration: none; }
.brand img { display: block; height: 32px; width: auto; }
.brand .logo-mark { display: none; }
.brand.big img { height: 44px; max-width: 100%; }
.brand-sub { margin: .75rem 0 1.5rem; font-size: .78rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--blue); }
.project-switch { flex: 1; min-width: 0; }
.project-switch select { width: 100%; max-width: 420px; background: var(--bg); color: var(--navy); border: 1px solid #b9cbd4; border-radius: 8px; padding: .45rem .5rem; font-size: .9rem; }
.who { display: flex; gap: .6rem; align-items: center; margin-left: auto; font-size: .85rem; }
.net { font-size: .72rem; font-weight: 600; padding: .15rem .55rem; border-radius: 99px; background: #eaf4e2; color: #3d6e1c; border: 1px solid #bcdca6; }
.net.offline { background: var(--err); color: #fff; border-color: var(--err); }
.user-menu { position: relative; }
.user-menu summary { cursor: pointer; list-style: none; padding: .35rem .6rem; border-radius: 6px; border: 1px solid transparent; }
.user-menu summary { font-weight: 600; color: var(--navy); }
.user-menu summary:hover, .user-menu[open] summary { border-color: var(--line); background: var(--bg); }
.user-menu summary::-webkit-details-marker { display: none; }
.menu-pop { position: absolute; right: 0; top: 2.2rem; background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem; min-width: 220px; box-shadow: 0 10px 28px rgba(16,40,57,.18); display: grid; gap: .5rem; }
.menu-pop a { color: var(--ink); }

/* Layout */
.shell { display: flex; min-height: calc(100vh - 59px); }
.sidenav { width: 240px; flex: none; background: #fff; border-right: 1px solid var(--line); padding: 1rem .75rem; position: sticky; top: 59px; height: calc(100vh - 59px); overflow-y: auto; }
.proj-head { padding: 0 .5rem .75rem; border-bottom: 1px solid var(--line); margin-bottom: .75rem; }
.proj-num { font-size: .75rem; font-weight: 600; letter-spacing: .06em; color: var(--blue); } .proj-name { font-weight: 700; color: var(--navy); margin-bottom: .4rem; }
.nav-group { margin-bottom: 1rem; }
.nav-title { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); padding: 0 .5rem .3rem; }
.sidenav a { display: block; padding: .45rem .6rem; border-radius: 6px; color: var(--ink); text-decoration: none; border-left: 3px solid transparent; }
.sidenav a:hover { background: var(--bg); }
.sidenav a[aria-current="page"] { background: #e3eef2; color: var(--navy); font-weight: 600; border-left-color: var(--blue); }
main { flex: 1; min-width: 0; padding: 1.25rem 1.5rem 6rem; max-width: 1100px; }
main.narrow { max-width: 560px; margin: 3rem auto; padding: 1rem; }
.page-head h1 + .intro { margin-top: .15rem; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.intro { margin: 0; color: var(--ink-2); max-width: 70ch; }
.actions, .button-row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.button-row { margin: 0 0 1rem; }

/* Cards and lists */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; margin-bottom: 1rem; box-shadow: var(--shadow); }
details.card > summary, details > summary { cursor: pointer; font-weight: 600; padding: .25rem 0; }
details[open] > summary { margin-bottom: .75rem; }
.card-head { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; }
.card-head h2 a { color: var(--ink); text-decoration: none; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)); gap: 1rem; }
.link-card { text-decoration: none; color: var(--ink); border-top: 3px solid var(--blue); transition: border-color .15s, box-shadow .15s; } .link-card:hover { border-color: var(--blue); box-shadow: 0 6px 18px rgba(16,40,57,.12); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .75rem; margin: .5rem 0; }
.stats div { min-width: 0; background: var(--bg); border-radius: 8px; padding: .55rem .65rem; border-left: 3px solid var(--cyan); }
.stats span { display: block; font-size: .72rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); overflow-wrap: break-word; }
.stats b { display: block; font-size: 1.05rem; line-height: 1.3; overflow-wrap: anywhere; color: var(--navy); font-variant-numeric: tabular-nums; }
.list { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 1rem; box-shadow: var(--shadow); }
.list.compact { border: 0; box-shadow: none; }
.row { display: flex; justify-content: space-between; gap: 1rem; align-items: center; padding: .75rem 1rem; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.row:last-child { border-bottom: 0; }
a.row:hover { background: #f5f9fa; }
.row-main { display: grid; gap: .1rem; min-width: 0; }
.row-actions { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.plain { list-style: none; padding: 0; margin: 0; display: grid; gap: .35rem; }
.tasks { margin: 0; padding-left: 1.1rem; display: grid; gap: .5rem; }
.menu-list { list-style: none; padding: 0; margin: 0; } .menu-list a { display: block; padding: .75rem 0; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.empty { color: var(--muted); padding: 1rem; background: #fff; border: 1px dashed var(--line); border-radius: var(--radius); }
.exceptions { border-left: 4px solid var(--accent); }
.tabs { display: flex; gap: .25rem; margin-bottom: 1rem; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs a { padding: .6rem .9rem; color: var(--ink-2); text-decoration: none; border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs a[aria-current="page"] { color: var(--navy); border-color: var(--accent); font-weight: 600; }

/* Badges */
.badge { display: inline-block; font-size: .75rem; font-weight: 600; padding: .15rem .5rem; border-radius: 99px; background: #e6edf1; color: var(--ink-2); white-space: nowrap; }
.badge-approved, .badge-closed, .badge-issued, .badge-accepted { background: var(--ok-bg); color: var(--ok); }
.badge-submitted, .badge-priced, .badge-sent { background: var(--info-bg); color: var(--blue-dk); }
.badge-returned, .badge-blocked, .badge-rejected, .badge-declined { background: var(--warn-bg); color: var(--warn); }
.badge-void, .badge-superseded, .badge-expired { background: #eee; color: #777; text-decoration: line-through; }
.badge-open { background: var(--err-bg); color: var(--err); }
.badge-test { background: #222; color: #fff; }
.badge-execution { background: var(--blue); color: #fff; }

/* Notices */
.notice { border-radius: var(--radius); padding: .75rem 1rem; margin-bottom: 1rem; border: 1px solid transparent; }
.notice ul { margin: .35rem 0 0; padding-left: 1.1rem; }
.notice-ok { background: var(--ok-bg); color: var(--ok); }
.notice-error { background: var(--err-bg); color: var(--err); border-color: #f3b9bd; }
.notice-warn { background: var(--warn-bg); color: #6b4700; border-color: #f0d68f; }
.notice-info { background: var(--info-bg); color: var(--blue-dk); border-left: 4px solid var(--blue); }

/* Forms */
.field { display: grid; gap: .3rem; margin-bottom: .85rem; }
.field > span { font-weight: 600; font-size: .9rem; }
.hint { color: var(--muted); font-size: .82rem; margin: 0 0 .5rem; }
input, select, textarea { font: inherit; color: var(--ink); background: #fff; border: 1px solid #b9cbd4; border-radius: 8px; padding: .55rem .65rem; min-height: var(--tap); width: 100%; }
textarea { min-height: 4.5rem; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(100,198,229,.35); border-color: var(--accent); }
input[type="checkbox"] { width: 1.25rem; min-height: 1.25rem; height: 1.25rem; accent-color: var(--accent); }
.check { display: inline-flex; align-items: center; gap: .45rem; margin: .25rem 1rem .25rem 0; font-size: .95rem; }
.checks { border: 1px solid var(--line); border-radius: var(--radius); padding: .5rem .75rem; margin: 0 0 .85rem; }
.checks legend { font-weight: 600; font-size: .9rem; padding: 0 .25rem; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0 1rem; }
.filters { display: flex; gap: .5rem; flex-wrap: wrap; align-items: flex-end; margin-bottom: 1rem; }
.filters input, .filters select { width: auto; min-width: 150px; flex: 1; }
.filters label { display: grid; font-size: .8rem; color: var(--muted); gap: .2rem; }
form.inline { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin: .25rem 0; }
form.inline input { width: auto; flex: 1; min-width: 160px; }
form.inline .field { margin: 0; flex: 1; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: var(--tap); padding: .5rem 1rem; border-radius: 8px; border: 1px solid #b9cbd4; background: #fff; color: var(--navy); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--blue); color: var(--blue); }
.btn.primary { background: var(--blue); border-color: var(--blue); color: var(--accent-ink); }
.btn.primary:hover { background: var(--blue-dk); border-color: var(--blue-dk); color: #fff; }
.btn.primary:disabled { background: #9fbcc7; border-color: #9fbcc7; cursor: not-allowed; }
.btn.danger { color: var(--err); border-color: #e3a1a5; }
.btn.small { min-height: 34px; padding: .25rem .65rem; font-size: .85rem; }
.btn.wide { width: 100%; }
.btn.link { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 600; cursor: pointer; font: inherit; }
.form-actions { display: flex; gap: .6rem; flex-wrap: wrap; margin: 1rem 0; }
.form-actions.sticky { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--bg) 25%); padding: 1rem 0; z-index: 5; }
fieldset.step { border: 1px solid var(--line); background: #fff; border-radius: var(--radius); padding: 1rem 1.1rem; margin: 0 0 1rem; box-shadow: var(--shadow); }
fieldset.step legend { font-weight: 700; font-size: 1.05rem; padding: 0 .35rem; color: var(--navy); }

/* Labor grid */
.labor { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.labor-head, .labor-row { display: grid; grid-template-columns: 1fr 92px 92px; gap: .5rem; align-items: center; padding: .5rem .75rem; }
.labor-head { background: var(--bg); letter-spacing: .03em; font-size: .8rem; font-weight: 700; color: var(--muted); }
.labor-row { border-top: 1px solid var(--line); }
.labor-row small { display: block; }
.labor.view .labor-row span:not(:first-child) { text-align: right; }
.labor-foot { padding: .5rem .75rem; border-top: 1px solid var(--line); display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.qty, .bill-lines { display: grid; gap: .5rem; margin-bottom: 1rem; }
.qty-row { display: grid; grid-template-columns: 1fr 200px; gap: .75rem; align-items: center; padding: .5rem 0; border-bottom: 1px solid var(--line); }
.qty-row small { display: block; }
.with-unit { display: flex; align-items: center; gap: .4rem; } .with-unit em { font-style: normal; color: var(--muted); min-width: 2rem; }
.checklist { display: grid; gap: .25rem; margin-bottom: 1rem; }
.check-row { display: grid; grid-template-columns: 1fr 120px; gap: .75rem; align-items: center; padding: .35rem 0; border-bottom: 1px solid var(--line); }

/* Progress */
.progress-list { display: grid; gap: .75rem; margin-bottom: .75rem; }
.prog-label { display: flex; justify-content: space-between; font-size: .9rem; gap: .5rem; }
progress { width: 100%; height: 10px; appearance: none; border: 0; border-radius: 99px; background: #dde7ec; overflow: hidden; }
progress::-webkit-progress-bar { background: #dde7ec; } progress::-webkit-progress-value { background: var(--blue); } progress::-moz-progress-bar { background: var(--blue); }

/* Stage tracker */
.stages { list-style: none; display: flex; gap: .35rem; padding: 0; margin: 0 0 1rem; flex-wrap: wrap; }
.stages li { opacity: .45; } .stages li.done { opacity: .8; } .stages li[aria-current="step"] { opacity: 1; }
.stages li[aria-current="step"] .badge { background: var(--accent); color: #fff; }

/* Photos */
.thumbs, .gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.gallery { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
figure { margin: 0; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
figure img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; background: #e5e8eb; }
figcaption { padding: .45rem .6rem; font-size: .85rem; display: grid; gap: .1rem; }

/* Records */
dl.record { display: grid; grid-template-columns: 200px 1fr; gap: .5rem 1rem; margin: .75rem 0 0; }
dl.record dt { font-weight: 600; color: var(--ink-2); } dl.record dd { margin: 0; white-space: pre-wrap; }
.audit { display: grid; font-size: .85rem; }
.audit-row { display: grid; grid-template-columns: 170px 140px 190px 1fr; gap: .5rem; padding: .4rem 0; border-bottom: 1px solid var(--line); }
.review-box { border-left: 4px solid var(--blue); }

/* Sign-in */
body.login { display: grid; place-items: center; padding: 1rem; background: var(--navy); background-image: linear-gradient(160deg, #102839 0%, #153447 55%, #1b5064 100%); }
.login-card { width: 100%; max-width: 420px; background: #fff; border: 0; border-top: 4px solid var(--cyan); border-radius: 12px; padding: 2.25rem 1.75rem 1.75rem; box-shadow: 0 20px 50px rgba(0,0,0,.3); }
.or { text-align: center; color: var(--muted); margin: .75rem 0; }

/* Phone bottom bar */
.tabbar { display: none; }
@media (max-width: 820px) {
  .sidenav { display: none; }
  main { padding: 1rem 1rem 7rem; }
  .who .net { display: none; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; background: #fff; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
  .tabbar a { text-align: center; padding: .85rem .25rem; font-size: .8rem; font-weight: 600; color: var(--ink-2); text-decoration: none; }
  .tabbar a[aria-current="page"] { color: var(--blue); box-shadow: inset 0 3px 0 var(--blue); }
  .form-actions.sticky { bottom: calc(52px + env(safe-area-inset-bottom)); }
  dl.record { grid-template-columns: 1fr; } dl.record dt { margin-top: .5rem; }
  .qty-row { grid-template-columns: 1fr; }
  .cols { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
  .project-switch select { font-size: .85rem; }
  .user-menu summary { max-width: 88px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .audit-row { grid-template-columns: 1fr; gap: 0; }
  .labor-head, .labor-row { grid-template-columns: 1fr 72px 72px; padding: .5rem; }
  h1 { font-size: 1.3rem; }
  .row { flex-wrap: wrap; }
  .stats { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: .5rem; }
  .stats b { font-size: .98rem; }
}
@media print {
  .topbar, .sidenav, .tabbar, .form-actions, .review-box, .filters { display: none !important; }
  main { padding: 0; } .card { break-inside: avoid; }
}
form > .check, fieldset.step > .check, .card > form > .check { display: flex; margin-right: 0; }

.section-title { margin: 1.5rem 0 .75rem; }

@media (max-width: 820px) { .topbar { padding: .5rem .75rem; gap: .6rem; } .brand img { height: 24px; } }
@media (max-width: 560px) { .topbar .brand .logo-full { display: none; } .topbar .brand .logo-mark { display: block; height: 30px; } }
