/* Travel Path tablet PWA — same ShapeShift tokens and light/dark themes as the Pre-Shift app
   and the Monday Admin Dashboard, so the three look like one family. Theme key: 'tp_theme'. */
:root {
  --font-heading: 'Space Grotesk', system-ui, sans-serif;
  --font-ui: 'Space Grotesk', system-ui, sans-serif;
  --font-body: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --font-mono: 'JetBrains Mono', 'Roboto Mono', ui-monospace, monospace;
  --grad-brand: linear-gradient(90deg, #6547F0 0%, #3567F1 42%, #01C1F0 70%, #3DEFA2 100%);
  --grad-neutral: linear-gradient(120deg, #B5894A 0%, #9A7C44 48%, #6E5530 100%);
  --shadow-card: 0 1px 3px rgba(17, 23, 41, .06), 0 1px 2px rgba(17, 23, 41, .04);
  --shadow-md: 0 8px 28px rgba(17, 23, 41, .10);
  --shadow-cta: 0 6px 18px rgba(110, 85, 48, .28);
  --bg: #F6F3EA; --surface: #ffffff; --surface-2: #E8DFD0;
  --text: #050505; --text-muted: #4B4842; --text-subtle: #8A857C;
  --border: #D0C5B4; --hairline: rgba(5, 5, 5, .06);
  --accent: #C6A15B; --accent-strong: #A8843F;
  --grad-cta: var(--grad-neutral); --on-cta: #ffffff;
  --good: #2F855A; --good-bg: #E6F4EC; --bad: #C53030; --bad-bg: #FBEAEA; --warn: #B7791F; --warn-bg: #FBF3E2;
  --info: #2B6CB0; --info-bg: #E7F0F8;
}
[data-theme="dark"] {
  --bg: #030817; --surface: #0A1326; --surface-2: #0F1B36;
  --text: #ffffff; --text-muted: #9BA7BD; --text-subtle: #6B7891;
  --border: rgba(155, 167, 189, .16); --hairline: rgba(255, 255, 255, .06);
  --accent: #01C1F0; --accent-strong: #3567F1;
  --grad-cta: var(--grad-brand); --on-cta: #00121A;
  --good: #3DEFA2; --good-bg: rgba(61, 239, 162, .13); --bad: #ff7a7a; --bad-bg: rgba(197, 48, 48, .20);
  --warn: #F6C453; --warn-bg: rgba(246, 196, 83, .14); --info: #01C1F0; --info-bg: rgba(1, 193, 240, .13);
  --shadow-card: 0 1px 3px rgba(0, 0, 0, .45); --shadow-md: 0 10px 30px rgba(0, 0, 0, .55); --shadow-cta: 0 6px 18px rgba(53, 103, 241, .35);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { background: var(--bg); color: var(--text); font-family: var(--font-body); min-height: 100vh; }
button, input, select, textarea { font: inherit; }
ol, ul { list-style: none; }
fieldset { border: 0; min-width: 0; }
[hidden] { display: none !important; }

.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--text-subtle); }
.small { font-size: 13px; font-family: var(--font-ui); }
.warn-text { color: var(--warn); font-weight: 600; font-family: var(--font-ui); font-size: 13px; }
.eyebrow { font-family: var(--font-ui); font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--text-subtle); }
.h1 { font-family: var(--font-heading); font-size: 26px; font-weight: 700; line-height: 1.15; }
.h2 { font-family: var(--font-heading); font-size: 19px; font-weight: 700; line-height: 1.2; display: flex; align-items: center; gap: 8px; }
.big { font-size: 34px; font-weight: 600; line-height: 1; }
.big small { font-size: .5em; color: var(--text-subtle); font-weight: 500; }
.stack > * + * { margin-top: 12px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row.end { justify-content: flex-end; }
.empty { padding: 34px 20px; text-align: center; color: var(--text-subtle); font-family: var(--font-ui); }

/* ── chrome ── */
.hdr { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; padding-top: calc(12px + env(safe-area-inset-top));
  background: var(--surface); border-bottom: 1px solid var(--border); }
.hdr-logo { width: 38px; height: 38px; border-radius: 10px; background: #fff; object-fit: cover; }
.hdr-title { font-family: var(--font-heading); font-size: 17px; font-weight: 700; line-height: 1.1; }
.hdr-sub { font-family: var(--font-ui); font-size: 11px; color: var(--text-subtle); text-transform: uppercase; letter-spacing: .12em; font-weight: 600; }
.hdr-spacer { flex: 1; }
.theme-toggle { width: 38px; height: 38px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; }
.theme-toggle svg { width: 17px; height: 17px; }
.theme-toggle .ic-dark { display: none; }
[data-theme="dark"] .theme-toggle .ic-dark { display: block; }
[data-theme="dark"] .theme-toggle .ic-light { display: none; }
.sync { font-family: var(--font-ui); font-size: 11.5px; font-weight: 600; border-radius: 999px; padding: 4px 10px; white-space: nowrap; }
.sync.good { background: var(--good-bg); color: var(--good); }
.sync.warn { background: var(--warn-bg); color: var(--warn); }

.main { max-width: 760px; margin: 0 auto; padding: 16px 16px 40px; }
.main > * + * { margin-top: 14px; }
.foot { text-align: center; font-family: var(--font-mono); font-size: 11px; color: var(--text-subtle); padding: 0 16px 24px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-card); padding: 16px 18px; }
.card > * + * { margin-top: 12px; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.score { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; padding: 18px; border-radius: 16px;
  background: var(--grad-cta); color: var(--on-cta); box-shadow: var(--shadow-cta); }
.hero .eyebrow { color: inherit; opacity: .8; }
.hero .btn-ghost { background: rgba(255, 255, 255, .92); color: #050505; border-color: transparent; }

.banner { border-radius: 12px; padding: 11px 14px; font-family: var(--font-ui); font-size: 13.5px; border: 1px solid; }
.banner.good { background: var(--good-bg); color: var(--good); border-color: color-mix(in srgb, var(--good) 35%, transparent); }
.banner.warn { background: var(--warn-bg); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.badge { display: inline-block; font-family: var(--font-mono); font-size: 11px; font-weight: 600; border-radius: 999px; padding: 2px 9px; }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.count { font-family: var(--font-mono); font-size: 13px; background: var(--warn-bg); color: var(--warn); border-radius: 999px; padding: 1px 9px; }

/* ── controls ── */
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-family: var(--font-ui); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .14em; color: var(--text-muted); }
select, input[type=password], input[type=text], input:not([type]), textarea {
  background: var(--surface); border: 1.5px solid var(--border); border-radius: 12px; color: var(--text);
  font-family: var(--font-ui); font-size: 16px; padding: 12px 15px; outline: none; width: 100%; -webkit-appearance: none; appearance: none; }
select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238A857C' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; padding-right: 40px; }
select:focus, input:focus, textarea:focus { border-color: var(--accent); }
select option { background: var(--surface); color: var(--text); }
textarea { resize: vertical; min-height: 84px; }
#pin, .code-input { font-family: var(--font-mono); font-size: 22px; letter-spacing: .3em; text-transform: uppercase; }
.form-error { color: var(--bad); font-family: var(--font-ui); font-size: 13.5px; font-weight: 600; }

.btn-primary { width: 100%; min-height: 50px; background: var(--grad-cta); color: var(--on-cta); font-family: var(--font-ui); font-size: 16px; font-weight: 700;
  border: none; border-radius: 12px; padding: 12px 18px; cursor: pointer; box-shadow: var(--shadow-cta); }
.btn-primary.slim { width: auto; min-height: 44px; font-size: 14px; padding: 10px 20px; }
.btn-primary.big { min-height: 58px; font-size: 17px; border-radius: 14px; }
.btn-primary:disabled { opacity: .45; box-shadow: none; }
.btn-primary:active, .btn-ghost:active { transform: scale(.98); }
.btn-ghost { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; color: var(--text); font-family: var(--font-ui);
  font-size: 14px; font-weight: 600; min-height: 44px; padding: 9px 14px; cursor: pointer; white-space: nowrap; }
.btn-ghost.sm { min-height: 36px; font-size: 12.5px; padding: 6px 12px; }
.btn-ghost.dark { background: rgba(255, 255, 255, .12); color: #fff; border-color: rgba(255, 255, 255, .25); }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── hour strip: status = mark + colour, never colour alone ── */
/* One row: all 15 hours (7 AM–9 PM) side by side at every width. */
.hours { display: grid; grid-template-columns: repeat(15, minmax(0, 1fr)); gap: 3px; }
.hour { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; min-height: 40px; min-width: 0;
  border-radius: 7px; border: 1px solid var(--border); background: var(--bg); font-family: var(--font-ui); overflow: hidden; }
.hour-h { font-size: 10.5px; font-weight: 600; color: var(--text-subtle); }
.hour-m { font-family: var(--font-mono); font-size: 13px; font-weight: 600; min-height: 1.2em; }
.hour.is-hit { background: var(--good-bg); border-color: color-mix(in srgb, var(--good) 35%, transparent); color: var(--good); }
.hour.is-partial { background: var(--warn-bg); border-color: color-mix(in srgb, var(--warn) 35%, transparent); color: var(--warn); }
.hour.is-missed { background: var(--bad-bg); border-color: color-mix(in srgb, var(--bad) 35%, transparent); color: var(--bad); }
.hour.is-current { background: var(--info-bg); border: 2px solid var(--info); color: var(--info); }
.hour.is-upcoming { border-style: dashed; color: var(--text-subtle); }
.hour.is-hit .hour-h, .hour.is-partial .hour-h, .hour.is-missed .hour-h, .hour.is-current .hour-h { color: inherit; opacity: .85; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-family: var(--font-ui); font-size: 12px; color: var(--text-subtle); }
.legend li { display: flex; align-items: center; gap: 6px; }
.sw { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 5px; font-style: normal; font-size: 11px; border: 1px solid var(--border); }
.sw.is-hit { background: var(--good-bg); color: var(--good); }
.sw.is-partial { background: var(--warn-bg); color: var(--warn); }
.sw.is-missed { background: var(--bad-bg); color: var(--bad); }
.sw.is-current { background: var(--info-bg); border: 2px solid var(--info); }

/* ── travel path ── */
.scan-actions { display: flex; flex-direction: column; align-items: stretch; gap: 6px; margin-bottom: 18px; }
.scan-actions .btn-primary { margin: 0; }
.scan-actions .btn-ghost { align-self: center; }
.form-error { margin: 0; color: #dc2626; font-family: var(--font-ui); font-size: 14px; font-weight: 600; }
.meter { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--grad-cta); border-radius: 999px; transition: width .2s; }
.areas { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; }
.area { width: 100%; min-height: 64px; display: grid; grid-template-columns: 32px 1fr; grid-template-rows: auto auto; column-gap: 9px; align-items: center;
  text-align: left; padding: 8px 10px; border-radius: 12px; border: 1px solid var(--border); background: var(--bg); color: var(--text); cursor: pointer; }
.area-n { grid-row: 1 / 3; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-family: var(--font-mono); font-size: 13px;
  border: 1.5px dashed var(--text-subtle); color: var(--text-subtle); }
.area-name { font-family: var(--font-ui); font-weight: 600; font-size: 14px; line-height: 1.2; }
.area-time { font-family: var(--font-mono); font-size: 12px; color: var(--text-subtle); }
.area.done { background: var(--good-bg); border-color: color-mix(in srgb, var(--good) 40%, transparent); }
.area.done .area-n { background: var(--good); border: 0; color: var(--surface); }
.area.done .area-time { color: var(--good); font-weight: 600; }

.checklist { display: flex; flex-direction: column; gap: 8px; }
.checklist li { position: relative; padding: 10px 12px 10px 36px; border-radius: 10px; background: var(--bg); border: 1px solid var(--border);
  font-family: var(--font-ui); font-size: 15px; line-height: 1.35; }
.checklist li::before { content: '👀'; position: absolute; left: 11px; top: 9px; font-size: 14px; }
/* Checklist thumbs: green up / red down, answerable once the area is checked in on your travel path. */
.checklist.answerable li.chk { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 12px; }
.checklist.answerable li.chk::before { content: none; }
.chk-text { flex: 1; min-width: 0; }
.chk-btns { display: flex; gap: 8px; flex: none; }
.thumb { width: 50px; height: 44px; display: grid; place-items: center; border-radius: 10px; border: 1.5px solid; background: transparent; cursor: pointer; transition: background .12s, color .12s; }
.thumb.up { color: #16a34a; border-color: rgba(22, 163, 74, .45); }
.thumb.down { color: #dc2626; border-color: rgba(220, 38, 38, .45); }
.thumb.up.on { background: #16a34a; border-color: #16a34a; color: #fff; }
.thumb.down.on { background: #dc2626; border-color: #dc2626; color: #fff; }
.thumb:active { transform: scale(.96); }
.chk.is-up { border-color: rgba(22, 163, 74, .5); }
.chk.is-down { border-color: rgba(220, 38, 38, .6); }

/* To-do List: a box per item; ticked = green check + crossed out. */
.todos > li + li { border-top: 1px solid var(--hairline); }
.todo { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; }
.todo-box { flex: none; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 10px; border: 2px solid var(--border);
  background: var(--bg); color: #fff; cursor: pointer; transition: background .12s, border-color .12s; }
.todo-box:active { transform: scale(.95); }
.todo.is-done .todo-box { background: #16a34a; border-color: #16a34a; }
.todo-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; padding-top: 4px; }
.todo-text { overflow-wrap: anywhere; }
.todo.is-done .todo-text { text-decoration: line-through; text-decoration-thickness: 2px; color: var(--text-subtle); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip input, .seg input { position: absolute; opacity: 0; pointer-events: none; }
.chip span { display: inline-flex; align-items: center; min-height: 38px; padding: 0 13px; border-radius: 999px; border: 1px solid var(--border);
  font-family: var(--font-ui); font-size: 14px; cursor: pointer; }
.chip input:checked + span { background: var(--text); color: var(--bg); border-color: var(--text); }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.seg span { display: flex; align-items: center; justify-content: center; min-height: 46px; border-radius: 12px; border: 1px solid var(--border);
  font-family: var(--font-ui); font-size: 14px; font-weight: 600; cursor: pointer; text-align: center; padding: 0 8px; }
.seg label:first-child input:checked + span { background: var(--good-bg); border-color: var(--good); color: var(--good); }
.seg label:last-child input:checked + span { background: var(--warn-bg); border-color: var(--warn); color: var(--warn); }
.chip input:focus-visible + span, .seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── modal, toast, scanner ── */
#modal-root { position: fixed; inset: 0; z-index: 60; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(15, 20, 30, .55); display: flex; align-items: flex-end; justify-content: center; padding: 12px; }
.modal { width: min(560px, 100%); max-height: calc(100vh - 24px); overflow-y: auto; background: var(--surface); border: 1px solid var(--border);
  border-radius: 18px; box-shadow: var(--shadow-md); padding: 20px; }
.confirm-text { font-family: var(--font-ui); font-size: 17px; line-height: 1.45; }
@media (min-width: 700px) { .modal-backdrop { align-items: center; } }

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translate(-50%, 16px); z-index: 80; opacity: 0; pointer-events: none;
  width: max-content; max-width: calc(100% - 32px); background: var(--text); color: var(--bg); border-radius: 12px; padding: 11px 16px;
  font-family: var(--font-ui); font-size: 14px; font-weight: 600; box-shadow: var(--shadow-md); transition: opacity .25s, transform .25s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.is-success { background: #2F855A; color: #fff; }
.toast.is-error { background: #C53030; color: #fff; }
.toast.is-warn { background: #B7791F; color: #fff; }

.scanner { position: fixed; inset: 0; z-index: 70; background: #05080f; color: #fff; display: grid; grid-template-rows: auto 1fr auto auto; gap: 12px;
  padding: calc(12px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom)); font-family: var(--font-ui); }
.scanner-top { display: flex; justify-content: space-between; align-items: center; }
.scanner-view { position: relative; overflow: hidden; border-radius: 18px; background: #000; min-height: 0; }
.scanner-view video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scanner-frame { position: absolute; left: 50%; top: 50%; width: min(64vw, 280px); aspect-ratio: 1; transform: translate(-50%, -50%);
  border: 3px solid rgba(255, 255, 255, .9); border-radius: 22px; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .35); }
.scanner-msg { text-align: center; min-height: 3em; padding: 8px 12px; border-radius: 12px; font-weight: 600; }
.scanner-msg.is-ok { background: #2F855A; }
.scanner-msg.is-bad { background: #C53030; }
.scanner-bottom { display: flex; justify-content: center; }

@media (max-width: 620px) {
  .hours { gap: 2px; }
  .hour { min-height: 34px; border-radius: 5px; }
  .hour-h { font-size: 8.5px; letter-spacing: -.02em; }
  .hour-m { font-size: 10px; }
  .hour.is-current .hour-m { font-size: 8px; }
  .areas { grid-template-columns: 1fr 1fr; }
  .h1 { font-size: 23px; }
  .big { font-size: 28px; }
}
@media (max-width: 360px) {
  .areas { grid-template-columns: 1fr; }
}
