@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap; src: url("/admin/fonts/inter-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 500; font-display: swap; src: url("/admin/fonts/inter-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap; src: url("/admin/fonts/inter-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Plus Jakarta Sans"; font-style: normal; font-weight: 600; font-display: swap; src: url("/admin/fonts/plus-jakarta-sans-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Plus Jakarta Sans"; font-style: normal; font-weight: 700; font-display: swap; src: url("/admin/fonts/plus-jakarta-sans-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Plus Jakarta Sans"; font-style: normal; font-weight: 800; font-display: swap; src: url("/admin/fonts/plus-jakarta-sans-latin-800-normal.woff2") format("woff2"); }

/* ProjectPulse brand tokens (media kit). */
:root {
  --primary: #0F766E; --primary-hover: #0B5F58; --on-primary: #FFFFFF; --accent: #14B8A6; --navy: #0B3B4F;
  --bg: #F6FAFA; --surface: #FFFFFF; --surface-alt: #EAF2F3; --line: #D3E0E3;
  --text: #0B2A36; --muted: #506676;
  --estimate: #64748B; --actual: #0F766E; --success: #15803D; --warning: #B45309; --danger: #B91C1C; --info: #0369A1;
  --radius: 14px;
  --font-heading: "Plus Jakarta Sans", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
  font-family: var(--font-body); font-size: 15px; color: var(--text); background: var(--bg);
}
@media (prefers-color-scheme: dark) {
  :root {
    --primary: #2DD4BF; --primary-hover: #5EEAD4; --on-primary: #04201C;
    --bg: #07141B; --surface: #0E2230; --surface-alt: #143042; --line: #24424F;
    --text: #E8F1F4; --muted: #9DB3BF;
    --estimate: #94A3B8; --actual: #2DD4BF; --success: #4ADE80; --warning: #FBBF24; --danger: #F87171; --info: #38BDF8;
  }
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--bg); }
[hidden] { display: none !important; }
h1, h2, h3 { font-family: var(--font-heading); margin: 0 0 8px; }
h1 { font-size: 28px; font-weight: 800; }
h2 { font-size: 21px; font-weight: 700; }
h3 { font-size: 16px; font-weight: 600; }
a { color: var(--primary); text-decoration: none; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.error { color: var(--danger); font-size: 14px; }
.num { font-variant-numeric: tabular-nums; }

/* buttons and inputs */
button, .ghost-btn, .btn {
  font: inherit; font-family: var(--font-heading); font-weight: 600; font-size: 14px; padding: 9px 16px;
  border-radius: 999px; border: 1px solid transparent; cursor: pointer; background: var(--surface-alt); color: var(--text);
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.primary { background: var(--primary); color: var(--on-primary); }
.primary:hover:not(:disabled) { background: var(--primary-hover); }
.ghost-btn, button.ghost { background: transparent; border-color: var(--line); color: var(--text); }
button.link { background: none; border: none; padding: 4px 6px; color: var(--primary); }
button.danger { color: var(--danger); }
button:disabled { opacity: .5; cursor: default; }
.wide { width: 100%; justify-content: center; padding: 12px; }
label { display: block; font-size: 13px; font-weight: 600; margin: 10px 0; }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
label.check input { width: auto; margin: 0; }
input, select, textarea {
  display: block; width: 100%; margin-top: 5px; padding: 9px 11px; font: inherit; font-size: 14px; font-weight: 400;
  color: var(--text); background: var(--surface-alt); border: 1px solid var(--line); border-radius: 9px;
}
textarea { min-height: 70px; resize: vertical; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--primary); display: inline-block; margin: 0; }

/* header */
.top {
  display: flex; align-items: center; gap: 20px; padding: 8px 24px; background: var(--surface);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5;
}
.logo { height: 54px; width: auto; display: block; margin: -8px -6px -8px -14px; }
.nav { display: flex; gap: 4px; }
.nav a { padding: 8px 14px; border-radius: 999px; color: var(--text); font-family: var(--font-heading); font-weight: 600; font-size: 14px; }
.nav a.active { background: var(--primary); color: var(--on-primary); }
.who { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 14px; }
@media (max-width: 720px) {
  .top { flex-wrap: wrap; gap: 8px; padding: 6px 14px; }
  .who #who-name { display: none; }
  .logo { height: 44px; }
}

main { max-width: 1200px; margin: 0 auto; padding: 22px 24px 60px; }
@media (max-width: 720px) { main { padding: 16px 14px 60px; } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }

/* sign in */
.signin { max-width: 420px; margin: 40px auto; padding: 0 16px; text-align: center; }
.signin .card { text-align: left; margin-top: 18px; box-shadow: 0 18px 50px rgba(11, 59, 79, .10); }
.signin-logo { width: 220px; height: auto; }
.tagline { margin-top: 22px; font-weight: 600; font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }

/* page head */
.page-head { display: flex; align-items: flex-end; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head .grow { flex: 1; min-width: 200px; }
.crumb { font-size: 13px; color: var(--muted); margin-bottom: 4px; display: block; }
.search { max-width: 280px; margin: 0; }
.tabs { display: flex; gap: 4px; background: var(--surface); padding: 4px; border-radius: 999px; border: 1px solid var(--line); width: fit-content; margin-bottom: 18px; flex-wrap: wrap; }
.tabs a { padding: 7px 14px; border-radius: 999px; color: var(--text); font-family: var(--font-heading); font-weight: 600; font-size: 14px; }
.tabs a.active { background: var(--primary); color: var(--on-primary); }

/* project cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.project-card { display: block; color: var(--text); transition: border-color .15s; }
.project-card:hover { border-color: var(--primary); }
.project-card h3 { margin-bottom: 4px; }
.badge {
  display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px;
  background: var(--surface-alt); color: var(--muted); white-space: nowrap;
}
.badge.ok { color: var(--success); } .badge.warn { color: var(--warning); } .badge.bad { color: var(--danger); }
.badge.primary { background: var(--primary); color: var(--on-primary); }

/* dashboard */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 14px; }
.stat { padding: 16px; }
.stat .value { font-family: var(--font-heading); font-size: 28px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat .label { font-size: 13px; color: var(--muted); font-weight: 500; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; }
@media (max-width: 720px) { .cards { grid-template-columns: 1fr; } }
.card h3 { margin-bottom: 12px; }
.bar { height: 10px; border-radius: 999px; background: var(--surface-alt); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--primary); border-radius: 999px; }
.bar.estimate > span { background: var(--estimate); }
.bar.bad > span { background: var(--danger); }
.bar.warn > span { background: var(--warning); }
.row { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 6px 0; font-size: 14px; }
.row + .row { border-top: 1px solid var(--line); }
.chart { display: flex; align-items: flex-end; gap: 6px; height: 120px; padding-top: 10px; }
.chart .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.chart .col span.b { width: 100%; background: var(--primary); border-radius: 6px 6px 2px 2px; min-height: 2px; }
.chart .col small { font-size: 11px; color: var(--muted); }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; }
.thumb { aspect-ratio: 1; border-radius: 10px; background: var(--surface-alt); overflow: hidden; cursor: zoom-in; border: none; padding: 0; display: block; width: 100%; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* reports */
.list { display: flex; flex-direction: column; gap: 10px; }
.list-item { display: flex; gap: 14px; align-items: center; color: var(--text); padding: 14px 16px; }
.list-item:hover { border-color: var(--primary); }
.list-item .thumb { width: 64px; flex: none; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item h3 { margin: 0 0 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.filters select, .filters input { width: auto; margin: 0; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.photo { margin: 0; }
.photo .thumb { aspect-ratio: 4 / 3; }
.photo figcaption { font-size: 13px; padding-top: 6px; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pair .thumb { aspect-ratio: 4 / 3; }
.label-chip { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 4px; display: block; }
table.lines { width: 100%; border-collapse: collapse; font-size: 14px; }
.lines th { text-align: left; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.lines td { padding: 8px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.lines td.r, .lines th.r { text-align: right; }
.lines tr.section td { font-weight: 700; background: var(--surface-alt); }
.totals { margin-left: auto; max-width: 320px; margin-top: 10px; }
.totals .row.total { font-weight: 800; font-size: 16px; }
.drawing { position: relative; display: inline-block; max-width: 100%; }
.drawing img { max-width: 100%; display: block; border-radius: 8px; }
.drawing svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.pin { position: absolute; transform: translate(-50%, -100%); background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; min-width: 22px; height: 22px; border-radius: 11px 11px 11px 2px; display: grid; place-items: center; padding: 0 5px; }
.section-gap { margin-top: 22px; }
.prewrap { white-space: pre-wrap; }

/* timesheets tool */
.tool-layout { display: grid; grid-template-columns: 300px 1fr; gap: 16px; align-items: start; }
@media (max-width: 900px) { .tool-layout { grid-template-columns: 1fr; } }
.side { position: sticky; top: 90px; max-height: calc(100vh - 110px); overflow: auto; }
@media (max-width: 900px) { .side { position: static; max-height: none; } }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 13px; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--text); font-family: var(--font-body); font-weight: 500; }
.chip.on { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.person { padding: 0; overflow: hidden; }
.person-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; }
.person-head .grow { flex: 1; min-width: 0; }
.person.off .person-head { opacity: .5; }
.days { border-top: 1px solid var(--line); }
.day { display: grid; grid-template-columns: 26px 120px 1fr auto; gap: 10px; align-items: center; padding: 8px 16px; font-size: 14px; }
.day + .day { border-top: 1px solid var(--line); }
.day.off { opacity: .45; }
.shift { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.shift-edit { display: grid; grid-template-columns: repeat(4, minmax(90px, 1fr)) auto; gap: 8px; align-items: end; padding: 10px 16px 14px 52px; background: var(--surface-alt); }
.shift-edit label { margin: 0; }
@media (max-width: 720px) {
  .day { grid-template-columns: 26px 1fr auto; }
  .day .shift { grid-column: 2 / -1; }
  .shift-edit { grid-template-columns: 1fr 1fr; padding-left: 16px; }
}
.summary-bar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; position: sticky; bottom: 12px; margin-top: 16px; box-shadow: 0 10px 30px rgba(11, 59, 79, .15); }
.summary-bar .grow { flex: 1; }
.dropzone { border: 2px dashed var(--line); border-radius: var(--radius); padding: 40px 20px; text-align: center; background: var(--surface); }
.dropzone.over { border-color: var(--primary); background: var(--surface-alt); }
dialog { width: min(560px, 94vw); border: 1px solid var(--line); border-radius: 16px; padding: 22px; background: var(--surface); color: var(--text); }
dialog::backdrop { background: rgba(0, 0, 0, .45); }
.actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }

/* lightbox, toast */
.lightbox { position: fixed; inset: 0; background: rgba(4, 12, 16, .92); z-index: 20; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; }
.lightbox img { max-width: 100%; max-height: 85vh; border-radius: 8px; }
.lightbox p { color: #E8F1F4; margin-top: 10px; text-align: center; max-width: 800px; }
.lightbox-close { position: absolute; top: 14px; right: 14px; background: rgba(255,255,255,.15); color: #fff; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-size: 14px; font-weight: 600; z-index: 30; }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.loading { text-align: center; padding: 40px; color: var(--muted); }

/* printed timesheet */
.print-only { display: none; }
.sheet { background: #fff; color: #0B2A36; padding: 28px; border-radius: 8px; margin-bottom: 20px; }
.sheet-head { display: flex; justify-content: space-between; gap: 20px; margin-bottom: 16px; }
.sheet-head .wc { font-family: var(--font-heading); font-weight: 700; }
.sheet-fields { font-size: 13px; line-height: 2; }
.sheet-fields span { display: inline-block; min-width: 170px; font-weight: 600; }
.sheet table { width: 100%; border-collapse: collapse; font-size: 12px; }
.sheet th, .sheet td { border: 1px solid #D3E0E3; padding: 6px; text-align: center; font-variant-numeric: tabular-nums; }
.sheet th { background: #0F766E; color: #fff; }
.sheet td.l, .sheet th.l { text-align: left; }
.sheet tr.count td { background: #0F766E; color: #fff; font-weight: 600; }
.sheet tr.total td { background: #0B3B4F; color: #fff; font-weight: 700; }
.sheet .desc { margin-top: 14px; font-size: 13px; }
@media print {
  @page { size: A4 landscape; margin: 12mm; }
  body { background: #fff; }
  .top, .no-print, .summary-bar, .tool-layout > .side { display: none !important; }
  main { padding: 0; max-width: none; }
  .print-only { display: block; }
  .sheet { padding: 0; margin: 0; page-break-after: always; break-after: page; }
  .sheet:last-child { page-break-after: auto; break-after: auto; }
  .card { border: none; padding: 0; }
  .report-print .thumb { break-inside: avoid; }
  .photo, .pair, .card { break-inside: avoid; }
}
/* Images load from the server with the session token; hide them until they have. */
img:not([src]) { visibility: hidden; }
.side input[type=date] { min-width: 0; }
.side-photos { display: flex; flex-direction: column; gap: 10px; }
.side-photos .photo figcaption { padding-top: 4px; }
.notice { border-color: var(--warning); margin-bottom: 14px; }
.qr { width: 200px; height: 200px; background: #fff; padding: 8px; border-radius: 10px; display: block; margin: 8px 0; }
code.key { display: inline-block; font-size: 15px; letter-spacing: .05em; background: var(--surface-alt); padding: 6px 10px; border-radius: 8px; word-break: break-all; }
.recovery pre { background: var(--surface-alt); padding: 12px; border-radius: 10px; columns: 2; font-size: 14px; }
#who-name { color: var(--text); font-weight: 600; }
.photo-group + .photo-group { margin-top: 18px; }
.photo-group h4 { font-family: var(--font-heading); font-size: 15px; margin: 6px 0 10px; }
.group-title { color: var(--primary); }
.rich p { margin: 0 0 4px; }
.rich p.blank { height: 6px; }
.rich ul, .rich ol { margin: 2px 0 6px; padding-left: 22px; }
.rich li { margin: 2px 0; }

.numbered { position: relative; }
.photo-number { position: absolute; top: 8px; left: 8px; min-width: 24px; height: 24px; padding: 0 6px; border-radius: 12px; background: var(--primary); color: var(--on-primary); font-size: 12px; font-weight: 700; display: grid; place-items: center; pointer-events: none; }
.lightbox-nav { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(255,255,255,.15); color: #fff; font-size: 30px; width: 48px; height: 64px; border-radius: 12px; justify-content: center; }
.lightbox-nav.prev { left: 14px; } .lightbox-nav.next { right: 14px; }
.lightbox-count { color: #E8F1F4; font-weight: 700; margin: 10px 0 0; font-variant-numeric: tabular-nums; }

/* ---- phones ---------------------------------------------------------------- */
.nav svg { display: none; }
.phone-only { display: none !important; }
@media (max-width: 720px) {
  .top { flex-wrap: nowrap; gap: 8px; padding: 6px 12px; padding-top: max(6px, env(safe-area-inset-top)); }
  .who { gap: 6px; }
  .who .ghost-btn, .who button { padding: 7px 12px; font-size: 13px; }
  /* App-style tab bar at the bottom of the screen. */
  .nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; gap: 0; justify-content: space-around;
    background: var(--surface); border-top: 1px solid var(--line);
    padding: 4px 8px max(6px, env(safe-area-inset-bottom));
  }
  .nav a, .nav a.phone-only {
    display: flex !important; flex: 1; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px;
    border-radius: 12px; font-size: 11px; color: var(--muted); background: none;
  }
  .nav a.active { background: none; color: var(--primary); }
  .nav svg { display: block; width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
  .nav a.active svg { fill: color-mix(in srgb, currentColor 18%, transparent); }
  main { padding-bottom: calc(90px + env(safe-area-inset-bottom)); }
  .summary-bar { bottom: calc(72px + env(safe-area-inset-bottom)); }
  .toast { bottom: calc(84px + env(safe-area-inset-bottom)); }
  /* 16px keeps iOS from zooming in when a field is tapped. */
  input, select, textarea { font-size: 16px; }
  .search { max-width: none; width: 100%; }
  h1 { font-size: 24px; }
  .tabs { width: auto; max-width: 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs a { flex-shrink: 0; }
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { padding: 12px 14px; }
  .stat .value { font-size: 22px; }
  .card { padding: 16px; }
  dialog { width: calc(100vw - 16px); max-width: none; padding: 18px; }
  .actions { flex-wrap: wrap; }
  .lightbox { padding: 12px; }
}

/* printed timesheet footer: generated left, quote in the middle */
.sheet-foot { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; color: #506676; margin-top: 10px; }
.sheet-foot .mid { text-align: center; font-weight: 600; }

/* forms */
.form-page { max-width: 760px; }
.form-body { display: flex; flex-direction: column; gap: 12px; }
.form-heading h2 { margin: 10px 0 2px; }
.form-text { white-space: pre-wrap; margin: 0; }
.form-picture { margin: 0; }
.form-picture img { max-width: 100%; border-radius: var(--radius); border: 1px solid var(--line); display: block; }
.form-doc { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.form-q .form-label { font-family: var(--font-heading); font-weight: 600; margin-bottom: 4px; }
.form-q .req { color: var(--danger); }
.form-q input, .form-q select, .form-q textarea { margin-top: 6px; }
.choices { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.upload-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.upload-item { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.upload-thumb { width: 84px; height: 84px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
img.broken { opacity: .3; }
.center-actions { justify-content: center; }

/* ---- pages without an account: create an account, shared form links ---- */
.public-page { max-width: 720px; margin: 32px auto; padding: 0 16px 48px; }
.public-card { max-width: 460px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }
.public-card label { display: flex; flex-direction: column; gap: 4px; }
.public-card h1 { margin: 0; }
.center { text-align: center; }
.pre { white-space: pre-line; }
.code-input { font-size: 1.6rem; letter-spacing: .35em; text-align: center; font-variant-numeric: tabular-nums; }
a.button-link { display: block; text-align: center; text-decoration: none; padding: 10px 16px; border-radius: 12px; }
.steps { display: flex; gap: 6px; list-style: none; padding: 0; margin: 4px 0 8px; counter-reset: step; font-size: .8rem; }
.steps li { flex: 1; counter-increment: step; color: var(--muted); border-top: 3px solid var(--line); padding-top: 6px; }
.steps li::before { content: counter(step) ". "; }
.steps li.done { color: var(--primary); border-top-color: var(--primary); }
.steps li.current { color: var(--text); font-weight: 600; border-top-color: var(--primary); }
@media (max-width: 520px) { .steps li { font-size: 0; } .steps li::before { font-size: .8rem; } .steps li.current { font-size: .8rem; } }
