:root {
  --brand: #2753a3; --brand-dk: #1b3a78; --brand-lt: #eaf0fb; --band: #232323;
  --ink: #1b1e24; --muted: #667085; --line: #e3e7ee; --bg: #f2f4f8; --card: #fff;
  --ok: #1f8a4c; --warn: #b86e00; --bad: #c0392b; --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-tap-highlight-color: transparent; }
a { color: var(--brand); }
svg.i { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* Header + nav */
.top { position: sticky; top: 0; z-index: 20; background: #fff; display: flex; align-items: center; justify-content: space-between;
  padding: 8px 16px; padding-top: calc(8px + env(safe-area-inset-top)); border-bottom: 4px solid var(--brand); }
.logo { height: 46px; display: block; }
.who { text-align: right; font-weight: 700; font-size: 14px; line-height: 1.2; }
.who small { display: block; color: var(--muted); font-weight: 400; }
main { max-width: 920px; margin: 0 auto; padding: 16px 16px calc(96px + env(safe-area-inset-bottom)); }
nav.tabs { position: fixed; bottom: 0; left: 0; right: 0; background: var(--band); display: flex; z-index: 20;
  padding-bottom: env(safe-area-inset-bottom); }
nav.tabs a { flex: 1; color: #a9b0bd; text-decoration: none; font-size: 12px; display: flex; flex-direction: column;
  align-items: center; gap: 2px; padding: 9px 0 8px; border-top: 3px solid transparent; }
nav.tabs a.on { color: #fff; border-top-color: #5b8cf0; }

/* Type */
h1 { font-size: 22px; margin: 2px 0 14px; }
h2 { font-size: 18px; margin: 0 0 10px; }
h3 { font-size: 15px; margin: 0 0 4px; }
.meta { color: var(--muted); font-size: 13px; }
.muted { color: var(--muted); }
.n { text-align: right; font-variant-numeric: tabular-nums; }

/* Cards & layout */
.card { background: var(--card); border-radius: var(--radius); padding: 16px; margin-bottom: 14px;
  box-shadow: 0 1px 2px rgba(16,24,40,.05), 0 1px 3px rgba(16,24,40,.08); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
@media (min-width: 640px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { background: #fff; border-radius: 12px; padding: 12px 14px; box-shadow: 0 1px 3px rgba(16,24,40,.08); }
.stat b { display: block; font-size: 22px; line-height: 1.2; }
.stat span { font-size: 13px; color: var(--muted); }
.quick { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
@media (min-width: 640px) { .quick { grid-template-columns: repeat(4, 1fr); } }

/* Planner */
table.plan { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 700px; font-size: 13px; }
table.plan th, table.plan td { border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); padding: 6px; vertical-align: top; text-align: left; }
table.plan tr:first-child th { text-align: center; font-size: 12px; color: var(--muted); font-weight: 400; background: #fafbfd; }
table.plan tr:first-child th b { font-size: 16px; color: var(--ink); }
table.plan tr > th:first-child { position: sticky; left: 0; background: #fff; z-index: 2; width: 118px; min-width: 118px; font-size: 13px; }
table.plan tr:first-child th.corner { background: #fafbfd; text-align: left; }
table.plan td { min-width: 92px; height: 66px; cursor: pointer; }
table.plan td:hover { background: var(--brand-lt); }
table.plan .today { background: #f3f7ff; }
table.plan tr:first-child th.today { background: var(--brand); color: #fff; }
table.plan tr:first-child th.today b { color: #fff; }
.pchip { display: block; width: 100%; border: 0; border-radius: 8px; color: #fff; padding: 5px 7px; margin-bottom: 4px; font: inherit;
  font-size: 12px; font-weight: 700; text-align: left; cursor: pointer; line-height: 1.25; }
.pchip small { display: block; font-weight: 400; opacity: .92; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.swatch { width: 14px; height: 14px; border-radius: 4px; display: inline-block; flex: none; }

/* Office: dashboard + feed */
body.wide main { max-width: 1400px; }
.office-links { grid-template-columns: 1fr 1fr !important; }
.office-links a { display: flex; gap: 10px; align-items: center; background: var(--brand-dk); color: #fff; text-decoration: none; border-radius: 12px; padding: 14px; }
.office-links a svg { color: #8fb3ff; width: 28px; height: 28px; }
.office-links small { display: block; font-size: 12px; color: #cfdcf5; font-weight: 400; }
.dash-grid { display: grid; gap: 0 14px; }
@media (min-width: 980px) { .dash-grid { grid-template-columns: 3fr 2fr; } }
.team { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; margin-top: 10px; }
.tm { border: 1px solid var(--line); border-left: 5px solid #cfd5df; border-radius: 10px; padding: 10px 12px; background: #fff; font-size: 14px; }
.tm-status { font-weight: 700; margin: 3px 0; }
.tm-ok { border-left-color: var(--ok); } .tm-ok .tm-status { color: var(--ok); }
.tm-warn { border-left-color: var(--warn); } .tm-warn .tm-status { color: var(--warn); }
.tm-bad { border-left-color: var(--bad); background: #fff7f6; } .tm-bad .tm-status { color: var(--bad); }
.tm-done { border-left-color: #98a2b3; }
.tm-idle { opacity: .7; }
.alert { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.alert:last-child { border-bottom: 0; }
.dot { width: 11px; height: 11px; border-radius: 50%; flex: none; background: var(--brand); }
.dot-bad { background: var(--bad); } .dot-warn { background: #e09a1a; }
.ev { display: flex; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.ev:last-child { border-bottom: 0; }
.ev-ico { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-lt); color: var(--brand); flex: none; }
.ev-ico svg { width: 18px; height: 18px; }
.ev-ok .ev-ico { background: #e3f4ea; color: var(--ok); }
.ev-warn .ev-ico { background: #fff2dc; color: var(--warn); }
.ev-bad .ev-ico { background: #fdeaea; color: var(--bad); }
.ev-bad .ev-body > div:first-child { color: var(--bad); }
.ev-body { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.ev-thumbs { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; align-items: center; }
.ev-thumbs button { padding: 0; border: 0; background: none; cursor: pointer; }
.ev-thumbs img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; background: #dfe4ec; display: block; }
.day-head { font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 18px 2px 6px; }

/* Tasks */
.task { background: #fff; border: 1px solid var(--line); border-left: 5px solid var(--brand); border-radius: 12px; padding: 12px 14px; margin: 10px 0; }
.card > .task:first-of-type { margin-top: 12px; }
.task.urgent { border-left-color: var(--bad); }
.task.late { background: #fff7f6; }
.task.done { border-left-color: var(--ok); opacity: .85; }
.task.done .task-title { text-decoration: line-through; color: var(--muted); }
.task-title { font-size: 16px; }
.task-details { margin: 4px 0; }

/* Checklists */
.progress { height: 10px; background: #e7ebf2; border-radius: 99px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--ok); border-radius: 99px; }
.chk { display: flex; gap: 12px; align-items: flex-start; padding: 11px 0; border-bottom: 1px solid var(--line); }
.chk:last-child { border-bottom: 0; }
.chk input[type=checkbox] { transform: scale(1.5); margin: 5px 4px 0 6px; flex: none; }
.chk label { flex: 1; margin: 0; font-weight: 500; color: var(--ink); cursor: pointer; }
.chk.done .t { text-decoration: line-through; color: var(--muted); }
.chk .del { color: #b4bcc8; min-height: 30px; padding: 4px; }
.chk .del svg { width: 16px; height: 16px; }

/* Orders */
.order-items { margin: 10px 0 8px; padding-left: 20px; }
.order-items li { margin-bottom: 3px; }
.card.order.late { border-left: 4px solid var(--bad); }
.item-row { display: grid; grid-template-columns: 1fr 64px 76px; gap: 6px; margin-bottom: 6px; }
.item-row input { margin-top: 0; }
.quick button { appearance: none; border: 0; background: #fff; border-radius: 12px; padding: 14px 8px; font: inherit; font-weight: 600;
  display: flex; flex-direction: column; align-items: center; gap: 6px; box-shadow: 0 1px 3px rgba(16,24,40,.08); cursor: pointer; color: var(--ink); }
.quick button svg { color: var(--brand); width: 28px; height: 28px; }

/* Buttons */
.btn { appearance: none; border: 1px solid #cfd5df; background: #fff; color: var(--ink); border-radius: 10px; padding: 9px 14px;
  font: inherit; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  text-decoration: none; min-height: 44px; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.stop { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.danger { color: var(--bad); border-color: #efc3be; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.big { width: 100%; font-size: 18px; min-height: 56px; }
.btn.sm { min-height: 34px; padding: 5px 10px; font-size: 14px; }
.btn:disabled { opacity: .5; }

/* Forms */
label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 12px; color: #344054; }
input, select, textarea { display: block; width: 100%; margin-top: 4px; font: inherit; padding: 10px 12px; border: 1px solid #cfd5df;
  border-radius: 10px; background: #fff; color: var(--ink); min-height: 44px; }
input[type=checkbox] { display: inline; width: auto; min-height: 0; margin: 0 8px 0 0; transform: scale(1.3); }
textarea { min-height: 88px; resize: vertical; }
input.job-search { padding-left: 38px; margin-bottom: -2px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-4-4'/%3E%3C/svg%3E") no-repeat 12px center / 18px; }
.clock-card input.job-search { border-color: transparent; }
label.check { display: flex; align-items: center; font-weight: 500; }
.checks { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px 0; margin-bottom: 12px; }
fieldset { border: 0; padding: 0; margin: 0; }
.hint { font-size: 13px; color: var(--muted); font-weight: 400; }

/* Lists */
.list .item { padding: 12px 0; border-bottom: 1px solid var(--line); }
.list .item:last-child { border-bottom: 0; }
.list a.item { display: block; color: inherit; text-decoration: none; }
.empty { color: var(--muted); text-align: center; padding: 18px 8px; }
.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 99px; background: #eef2f9; color: var(--brand-dk); white-space: nowrap; }
.badge.active, .badge.approved, .badge.fixed { background: #e3f4ea; color: var(--ok); }
.badge.quoted, .badge.pending, .badge.open { background: #fff2dc; color: var(--warn); }
.badge.on-hold, .badge.declined, .badge.incident { background: #fdeaea; color: var(--bad); }
.badge.complete { background: #eceff3; color: #475467; }
.badge.invoiced { background: #eee8fb; color: #5b3cc4; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 10px; scrollbar-width: none; }
.chips a, .chips button { white-space: nowrap; padding: 7px 13px; border-radius: 99px; background: #fff; border: 1px solid var(--line);
  color: var(--ink); text-decoration: none; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.chips .on { background: var(--brand); border-color: var(--brand); color: #fff; }

/* Clock */
.clock-card { background: linear-gradient(135deg, #2f60b8, var(--brand-dk)); color: #fff; }
.clock-card .meta { color: #cfdcf5; }
.clock-card select { border-color: transparent; }
.timer { font-size: 40px; font-weight: 800; letter-spacing: .5px; font-variant-numeric: tabular-nums; }
.pulse { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #4ade80; margin-right: 6px; animation: p 1.6s infinite; }
@keyframes p { 50% { opacity: .3; } }

/* Tables */
.tablewrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th, table.t td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.t th { font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
table.t th.n, table.t td.n { text-align: right; }
table.t tr.total td { font-weight: 800; border-bottom: 0; }
.pos { color: var(--ok); } .neg { color: var(--bad); }

/* Photos */
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 6px; }
.photos button { padding: 0; border: 0; background: none; cursor: pointer; position: relative; }
.photos img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; background: #dfe4ec; display: block; }
.photos .tag { position: absolute; left: 4px; bottom: 4px; font-size: 11px; background: rgba(0,0,0,.6); color: #fff; padding: 1px 6px; border-radius: 6px; }
.viewer img { width: 100%; border-radius: 10px; background: #000; }
.thumb { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; float: right; margin-left: 10px; }

/* Modal */
.modal-bg { position: fixed; inset: 0; background: rgba(10,15,30,.5); display: flex; align-items: flex-end; justify-content: center; z-index: 50; }
.modal { background: #fff; width: 100%; max-width: 620px; max-height: 92vh; overflow: auto; border-radius: 18px 18px 0 0;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); }
@media (min-width: 640px) { .modal-bg { align-items: center; } .modal { border-radius: 18px; } }
.modal .head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.modal .head h2 { margin: 0; }
.modal .actions { display: flex; gap: 10px; margin-top: 6px; }
.modal .actions .btn { flex: 1; }

/* Toast */
#toast { position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px);
  background: #1b1e24; color: #fff; padding: 10px 16px; border-radius: 10px; opacity: 0; transition: .25s; z-index: 60; pointer-events: none; max-width: 90vw; }
#toast.show { opacity: 1; transform: translateX(-50%); }

/* Login */
.login { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px;
  background: linear-gradient(160deg, #2f60b8, var(--brand-dk) 70%); }
.login .card { width: 100%; max-width: 380px; }
.login-logo { width: 100%; max-width: 380px; border-radius: 12px; margin-bottom: 18px; box-shadow: 0 6px 24px rgba(0,0,0,.25); }
.login h1 { color: #fff; text-align: center; }
.login .note { color: #cfdcf5; font-size: 13px; max-width: 380px; text-align: center; margin-top: 8px; }

/* Print (job reports) */
#print-root { display: none; }
@media print {
  body > *:not(#print-root) { display: none !important; }
  #print-root { display: block; font-size: 12pt; color: #000; }
  body { background: #fff; }
  .p-photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .p-photos figure { margin: 0; break-inside: avoid; }
  .p-photos img { width: 100%; aspect-ratio: 4/3; object-fit: cover; }
  .p-photos figcaption { font-size: 9pt; }
  table.t th, table.t td { border-bottom: 1px solid #bbb; }
  h2 { margin-top: 18px; border-bottom: 2px solid #2753a3; padding-bottom: 3px; }
}

/* form section headings that are not labels */
.form-heading { font-size: 14px; font-weight: 600; color: #344054; margin-bottom: 6px; }
/* Shared storage status remains visible in both office and site layouts. */
.sync-status{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:8px 16px;background:#e8f5ed;color:#174d2d;font-size:.875rem}
.sync-status.sync-warning{background:#fff1cd;color:#704600}
.sync-status .btn{white-space:nowrap}
.login>.meta{color:#f0f5ff;max-width:380px;line-height:1.5}
.login>.row .btn.ghost{color:#fff}
