/* AVRV Field Apps — shared styles. Mobile-first.
   Phase 0: ONE design-token layer (:root) consumed by all three apps.
   Per-app accent is set on <body data-app="maintenance|host"> via --accent;
   the dashboard runs the dark theme on <body class="dash">. */

/* Headers use a sturdy grotesque (Archivo) for sunlight legibility; body stays
   the system stack (most legible + no network dependency in the field). If the
   web font fails to load outdoors, headers fall back to the system stack. */
@import url('https://fonts.googleapis.com/css2?family=Archivo:wght@600;700;800&display=swap');

:root {
  /* ---- Brand / per-app accent (the color-coding system — keep it) ---- */
  --app-maintenance: #1C75BC;  --app-maintenance-d: #115e96;
  --app-host:        #009444;  --app-host-d:        #00683a;
  --app-manager:     #092943;            /* navy: dashboard, chips, phase nums */
  --accent:   var(--app-maintenance);    /* swapped per body[data-app] below */
  --accent-d: var(--app-maintenance-d);  /* darker stop for the header gradient */
  --mint:   #88CB95;                     /* soft brand green: progress, on-site dot */

  /* Action: a hue distinct from the app color so the ONE primary CTA (Submit /
     Save) reads as "the action" instead of blending into the app blue/green.
     High-contrast ink — pops by contrast (best in sun), never collides with a
     category color. */
  --action: var(--app-manager);

  /* ---- Semantic status ---- */
  --success: #1f9d57;                    /* clock-in / "back on-site" */
  --check:   #189d52;                    /* completed checkmarks / done tags */
  --danger:  #d64545;                    /* destructive / genuine warning */
  --status-offsite:    #ffd166;
  --status-unverified: #ff8a5c;

  /* ---- Warning surface (midday banner, reference warning, pending turns) ---- */
  --warn-bg:     #fff6e6;
  --warn-border: #f0d9a8;
  --warn-text:   #8a5a00;

  /* ---- Surfaces & text ---- */
  --app-bg:       #f4f7f9;
  --surface:      #ffffff;
  --surface-2:    #f7f9fb;               /* submitted/section tint */
  --surface-sunk: #eef2f6;               /* toggle track, ghost btn, hairlines */
  --on-accent:    #ffffff;
  --text:         #11202e;
  --text-muted:   #5a6b78;
  --border:       #dce3ea;
  --hairline:     #e3e9ef;               /* faint dividers / inactive tick rule */

  /* ---- Category colors — SINGLE SOURCE OF TRUTH (was duplicated in JS) ---- */
  --cat-safety:       #d64545;
  --cat-utilities:    #e0801e;
  --cat-guest:        #0891b2;  /* bluer cyan — separates from Host green + link blue */
  --cat-preventative: #7a5cc0;
  --cat-grounds:      #3a9d57;
  --cat-default:      #6b7a86;

  /* ---- Dashboard (dark) ---- */
  --dash-bg:      #0b1622;
  --dash-surface: #0f2030;
  --dash-border:  #21384f;
  --dash-line:    #1b3147;
  --dash-text:    #e7eef5;
  --dash-muted:   #8aa3b8;
  --dash-live:    #3ad17a;

  /* ---- Type ---- */
  --font-display: 'Archivo', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-body:    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --fs-metric:  28px;
  --fs-title:   19px;
  --fs-heading: 17px;
  --fs-body:    15px;
  --fs-label:   13px;
  --fs-caption: 12px;

  /* ---- Spacing scale (4-pt) ---- */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;

  /* ---- Radius & shadow (already a scale) ---- */
  --r-sm: 10px;
  --r: 14px;
  --r-lg: 18px;
  --radius-pill: 999px;
  --radius-card: var(--r);
  --shadow-sm: 0 1px 2px rgba(9,41,67,0.05), 0 1px 3px rgba(9,41,67,0.04);
  --shadow-md: 0 2px 8px rgba(9,41,67,0.07);
}

body[data-app="host"] { --accent: var(--app-host); --accent-d: var(--app-host-d); }
body[data-app="maintenance"] { --accent: var(--app-maintenance); --accent-d: var(--app-maintenance-d); }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  color: var(--text);
  background: var(--app-bg);
  -webkit-font-smoothing: antialiased;
  /* Fill the screen regardless of the iOS Safari toolbar state (dvh = the live
     viewport), so short pages don't leave a gap and tall pages scroll cleanly. */
  min-height: 100vh;
  min-height: 100dvh;
  /* Just the home-indicator safe area by default. */
  padding-bottom: calc(20px + env(safe-area-inset-bottom));
}
/* Field apps have a FIXED bottom action bar (Log issue / Assign / Clock out);
   reserve room so it never covers the last section. The manager dashboard has no
   action bar, so it must NOT carry this 104px — that was leaving a big dead gap
   under the dashboard content. */
body[data-app] {
  padding-bottom: calc(104px + env(safe-area-inset-bottom));
}

/* Headers use the display face. One loud level (titles); everything else calmer,
   so hierarchy comes from contrast instead of everything shouting at 800. */
h1, h2, h3 { font-family: var(--font-display); }
h1 { font-weight: 800; letter-spacing: -0.02em; }
h2, h3 { font-weight: 700; letter-spacing: -0.01em; }

.ico { display: inline-flex; align-items: center; justify-content: center; flex: none; }
.ico svg { display: block; }

/* ---- Category colors — applied via .cat-* on pills / dots ---- */
.cat-safety       { background: var(--cat-safety); }
.cat-utilities    { background: var(--cat-utilities); }
.cat-guest        { background: var(--cat-guest); }
.cat-preventative { background: var(--cat-preventative); }
.cat-grounds      { background: var(--cat-grounds); }
.cat-default      { background: var(--cat-default); }

/* ---- Top status bar ----
   The brand header scrolls away; the progress/timeline strip below pins to the
   top so the phase navigation stays reachable while scrolling. */
.topbar {
  background: var(--accent);                                    /* solid fallback */
  background: linear-gradient(160deg, var(--accent) 0%, var(--accent-d) 100%);
  color: var(--on-accent);
  /* Extend the header up behind the iOS status bar / notch so it truly covers
     the top of the screen, while keeping the content clear of it. */
  padding: calc(14px + env(safe-area-inset-top)) 18px var(--space-4);
  display: flex; flex-direction: column; align-items: flex-start;
}
.topbar-row { display: flex; align-items: center; justify-content: space-between; width: 100%; gap: var(--space-3); }
.topbar .brand-logo { height: 44px; width: auto; flex: none; opacity: 0.97; }
.topbar .topbar-meta { min-width: 0; }
.topbar .app-name { font-family: var(--font-display); font-size: var(--fs-title); font-weight: 800; letter-spacing: -0.01em; }
.topbar .today { font-size: var(--fs-label); opacity: 0.85; margin-top: 3px; }
.app-version { font-size: 11px; opacity: 0.7; font-variant-numeric: tabular-nums; }
.shift-badge {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: var(--space-3); padding: 5px var(--space-3); border-radius: var(--radius-pill);
  background: rgba(255,255,255,0.16); font-size: var(--fs-label); font-weight: 600;
}
.shift-badge .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--mint); }
.shift-badge.offduty .dot { background: #b8c4cd; }   /* not clocked in: neutral, not green */
.shift-badge.offsite .dot { background: var(--status-offsite); }
.shift-badge.unverified .dot { background: var(--status-unverified); }
/* Completion-streak recognition chip (sits in the header, next to the shift badge). */
.streak-chip {
  display: inline-flex; align-items: center; margin-top: var(--space-3); margin-left: var(--space-2);
  padding: 5px var(--space-3); border-radius: var(--radius-pill);
  background: rgba(255,255,255,0.16); font-size: var(--fs-label); font-weight: 700; color: #fff;
}

/* ---- Progress bars (sticky timeline strip) ---- */
/* Sticky phase tab row. (Dropped the "Day · phase X of Y" label + the abstract
   % fill bar — they encoded the same state the labelled, tappable ticks do.) */
.progress-wrap {
  position: sticky; top: 0; z-index: 25;
  padding: var(--space-2) var(--space-4); background: rgba(255,255,255,0.92);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 4px 12px rgba(9,41,67,0.06);
}
/* Goal-gradient momentum header: a proximity caption + a filling track. */
.momentum { margin-bottom: var(--space-2); }
.momentum-caption { display: block; font-size: 12.5px; font-weight: 700; color: var(--accent); margin-bottom: 5px; }
.momentum-track { height: 7px; border-radius: 999px; background: var(--hairline); overflow: hidden; }
.momentum-fill {
  height: 100%; min-width: 7px; border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-d, var(--accent)));
  transition: width .45s cubic-bezier(.22,1,.36,1);
}
.momentum-fill.full { background: linear-gradient(90deg, var(--mint), var(--mint)); }

.phase-ticks { display: flex; gap: var(--space-1); }
.phase-ticks .tick {
  flex: 1; font-size: 10.5px; line-height: 1.15; text-align: center; color: var(--text-muted);
  padding: 7px 2px 2px; border: none; border-top: 3px solid var(--hairline); background: none;
  cursor: pointer; font-family: inherit; -webkit-tap-highlight-color: transparent;
}
.phase-ticks .tick.active { color: var(--accent); border-top-color: var(--accent); font-weight: 700; }
.phase-ticks .tick.done { border-top-color: var(--mint); }
.phase-ticks .tick:active { opacity: 0.6; }

/* ---- Weather strip ---- */
/* Single-line strip — keeps glance info but reclaims the vertical band so the
   checklist sits higher. */
.weather-card {
  display: flex; align-items: center; gap: var(--space-2);
  margin: var(--space-2) var(--space-4) 0; padding: 7px var(--space-3);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-pill); box-shadow: var(--shadow-sm);
  font-size: var(--fs-label); white-space: nowrap; overflow: hidden;
}
.weather-card .weather-emoji { font-size: 17px; line-height: 1; flex: none; }
.weather-card .weather-temp { font-family: var(--font-display); font-size: var(--fs-body); font-weight: 800; letter-spacing: -0.01em; flex: none; }
.weather-card .weather-label { color: var(--text-muted); flex: none; }
.weather-card .weather-meta { margin-left: auto; font-size: 12.5px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; }
.weather-card.err { color: var(--text-muted); }
.weather-card .weather-muted { font-size: var(--fs-label); color: var(--text-muted); }

/* ---- Day / All-items view toggle ---- */
.view-toggle {
  display: flex; gap: 0; margin: var(--space-3) 14px 0; padding: 3px;
  background: var(--surface-sunk); border-radius: var(--radius-pill);
}
.view-toggle .vt-btn {
  flex: 1; border: none; background: none; cursor: pointer;
  padding: 9px var(--space-3); border-radius: var(--radius-pill);
  font: inherit; font-size: 14px; font-weight: 600; color: var(--text-muted);
  transition: color .12s ease;
}
.view-toggle .vt-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.view-toggle .vt-btn.active { background: var(--surface); color: var(--accent); font-weight: 700; box-shadow: var(--shadow-sm); }
.view-toggle .vt-badge {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--radius-pill);
  background: var(--accent); color: var(--on-accent); font-size: 11px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}

/* ---- Filter chips (All-items view) ---- */
.chip-bar {
  display: flex; gap: var(--space-2); overflow-x: auto; padding: var(--space-1) 0 10px;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.chip-bar::-webkit-scrollbar { display: none; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--border); background: var(--surface); cursor: pointer;
  padding: 7px 14px; border-radius: var(--radius-pill);
  font: inherit; font-size: 13.5px; font-weight: 600; color: var(--text);
}
.chip.active { background: var(--app-manager); color: var(--on-accent); border-color: var(--app-manager); }
.chip .chip-dot { width: 9px; height: 9px; border-radius: 50%; }

.list-group .section-count { font-size: var(--fs-caption); font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .03em; }
.list-task-label { flex: 1; font-size: var(--fs-body); }
.list-done {
  flex: none; border: 1px solid var(--accent); background: var(--surface); color: var(--accent);
  font-weight: 600; font-size: var(--fs-label); padding: 6px 14px; border-radius: var(--radius-pill); cursor: pointer;
}

/* ---- Phases (collapsible accordion) ---- */
.phases { padding: 6px 14px 14px; }
.phase {
  margin-bottom: 10px; scroll-margin-top: 120px;
  border: 1px solid var(--border); border-radius: var(--r);
  background: var(--surface); overflow: hidden; box-shadow: var(--shadow-sm);
}
.phase-head {
  display: flex; align-items: center; gap: 9px; width: 100%;
  background: none; border: none; cursor: pointer; text-align: left;
  font-family: var(--font-display); font-size: var(--fs-heading); font-weight: 700; color: var(--text); padding: 14px;
  -webkit-tap-highlight-color: transparent;
}
.phase.open > .phase-head { border-bottom: 1px solid var(--border); }
.phase-head .phase-num {
  font-family: var(--font-body); font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--on-accent); background: var(--app-manager); padding: 3px 9px; border-radius: var(--radius-pill); flex: none;
}
.phase-head .phase-title { flex: 1; }
.phase-head .phase-status { font-family: var(--font-body); font-size: 12.5px; font-weight: 700; color: var(--text-muted); flex: none; }
.phase-head .phase-check { color: var(--check); font-size: 20px; flex: none; }
.phase-head .chevron { color: var(--text-muted); font-size: var(--fs-label); flex: none; }
.phase-head .phase-flag {
  font-family: var(--font-body); font-size: 10px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase;
  color: var(--on-accent); background: var(--accent); padding: 2px var(--space-2); border-radius: var(--radius-pill); flex: none;
}
.phase-body { padding: var(--space-1) 14px 14px; }
.phase-hint { font-size: 13.5px; color: var(--text-muted); margin: var(--space-2) 0; }

/* Active (current) phase: accent number chip + a single accent border so it
   reads as "you're here" without doubling up rails against the cards inside. */
.phase.active { border-color: var(--accent); }
.phase.active .phase-num { background: var(--accent); }

/* Gated Morning Walkthrough: the day's starting point. */
.phase.gate { border-color: var(--accent); }
.phase.gate .phase-num { background: var(--accent); }

/* Locked phases (before the walkthrough is submitted): dimmed + lock. */
.phase.locked { opacity: 0.6; }
.phase.locked .phase-num { background: #aab6c0; }
.phase.locked .phase-title, .phase.complete .phase-title { color: var(--text-muted); }
.phase .lock { font-size: var(--fs-body); flex: none; }

/* ---- Compact to-do rows (To-Do tab / queue) ---- */
.todo-row {
  display: flex; align-items: flex-start; gap: 11px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  padding: 11px 13px; margin: var(--space-2) 0; box-shadow: var(--shadow-sm);
}
.todo-check {
  flex: none; width: 26px; height: 26px; margin-top: 1px; border-radius: 50%;
  border: 2px solid #c3ccd5; background: var(--surface); cursor: pointer; position: relative;
}
.todo-check:hover { border-color: var(--accent); }
.todo-check::after {
  content: "✓"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: var(--fs-body); font-weight: 800; color: var(--check); opacity: 0; transition: opacity .1s;
}
.todo-check:active::after { opacity: .5; }
.todo-body { flex: 1; min-width: 0; }
.todo-top { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.todo-title { font-size: var(--fs-body); font-weight: 600; }
.todo-meta { font-size: var(--fs-caption); color: var(--text-muted); margin-top: var(--space-1); }

/* "Add a to-do" — outline/dashed so it never reads as a primary CTA. */
.btn-add { background: var(--surface); color: var(--accent); border: 1.5px dashed var(--accent); }
.btn-add.active { background: var(--accent); color: var(--on-accent); border-style: solid; }

/* ---- Host Reference screen ---- */
.ref-bar { padding: var(--space-3) 14px 0; }
.reference .ref-body { padding-bottom: var(--space-4); }
.ref-h { font-size: var(--fs-caption); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--accent); margin: var(--space-3) 0 var(--space-1); }
.ref-p { font-size: 14.5px; line-height: 1.5; margin: var(--space-2) 0 0; }
.ref-li { font-size: 14.5px; line-height: 1.45; margin: 6px 0 0; padding-left: var(--space-4); position: relative; }
.ref-li::before { content: "•"; position: absolute; left: 3px; color: var(--accent); font-weight: 800; }
.ref-warn {
  font-size: 14px; line-height: 1.45; margin: 10px 0 0; padding: 9px 11px;
  background: var(--warn-bg); border: 1px solid var(--warn-border); border-radius: var(--r-sm); color: var(--warn-text); font-weight: 600;
}

/* Brief highlight when you jump to a phase from the timeline. */
@keyframes phaseFlash { 0% { background: rgba(28,117,188,0.16); } 100% { background: transparent; } }
.phase.flash { animation: phaseFlash 1.1s ease-out; border-radius: var(--r); }

.newbook-pending { background: var(--surface); border-style: dashed; }
.newbook-pending h3 { color: var(--text-muted); }
.newbook-pending p { font-size: var(--fs-label); color: var(--text-muted); margin: var(--space-1) 0 0; }

.list-caption { font-size: 12.5px; color: var(--text-muted); margin: 0 0 var(--space-2); font-weight: 600; }
.muted-line { font-size: 13.5px; color: var(--text-muted); margin: 0; }

.section-card {
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--r); padding: var(--space-4) var(--space-4) 16px; margin: var(--space-3) 0;
  box-shadow: var(--shadow-sm);
}
.section-card.done { border-left-color: #cdd6df; background: var(--surface-2); }
/* Inside a phase accordion the phase already carries the accent edge — drop the
   card's own accent rail + shadow so it doesn't read as a box-in-a-box with two
   parallel blue lines. The accent rail still shows in the flat All-items list. */
.phase-body .section-card { border-left: 1px solid var(--border); box-shadow: none; }
.phase-body .section-card.done { border-left-color: var(--border); }
.section-head { display: flex; align-items: center; gap: var(--space-2); margin-bottom: var(--space-2); }
/* Section titles outrank the checkbox labels (16px) so the page reads as
   distinct sections, not one undifferentiated form wall. */
.section-card h3 { margin: 0; font-size: 20px; font-weight: 800; letter-spacing: -0.01em; flex: 1; }
.section-done-tag { font-size: 11px; font-weight: 700; color: var(--check); text-transform: uppercase; letter-spacing: .03em; }
.edit-btn {
  flex: none; border: 1px solid var(--border); background: var(--surface); color: var(--accent);
  font-weight: 600; font-size: var(--fs-label); padding: 5px 14px; border-radius: var(--radius-pill); cursor: pointer;
}
.section-card .phase-tag { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.field-label { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-muted); margin: var(--space-3) 0 5px; }
.section-note-readonly { font-size: 14px; color: var(--text); margin: 10px 0 0; white-space: pre-wrap; }

.task { display: flex; align-items: center; gap: var(--space-3); padding: 11px 0; border-bottom: 1px solid var(--surface-sunk); }
.task:last-of-type { border-bottom: none; }
.task input[type=checkbox] { width: 24px; height: 24px; accent-color: var(--accent); flex: none; }
.task label { font-size: 16px; }

.photo-strip { display: flex; gap: var(--space-2); flex-wrap: wrap; align-items: center; margin: var(--space-3) 0 0; }
.photo-strip img, .photo-strip video { width: 64px; height: 64px; border-radius: var(--r-sm); object-fit: cover; border: 1px solid var(--border); background: #000; }
.add-photo {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  height: 40px; padding: 0 var(--space-4); border-radius: var(--radius-pill);
  border: 1.5px dashed var(--accent); color: var(--accent); background: var(--surface);
  font-size: 14px; font-weight: 600;
}
.add-photo .cam, .add-photo .ico { color: var(--accent); }
.add-photo.uploading { opacity: .6; pointer-events: none; border-style: solid; }

.comment-row { display: flex; gap: var(--space-2); align-items: flex-start; }
.comment-row textarea {
  flex: 1; min-height: 50px; border: 1px solid var(--border); border-radius: var(--r-sm);
  padding: 10px; font: inherit; resize: vertical; background: var(--surface);
}
.mic-btn {
  flex: none; width: 44px; height: 44px; border-radius: var(--r-sm); border: 1px solid var(--border);
  background: var(--surface); color: var(--text-muted); display: inline-flex; align-items: center; justify-content: center;
}
.mic-btn.recording { background: #ffe3e3; border-color: #ff8a8a; color: var(--danger); }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  border: none; border-radius: var(--radius-pill); padding: var(--space-3) 18px;
  font-size: var(--fs-body); font-weight: 700; cursor: pointer;
}
.btn-primary { background: var(--action); color: var(--on-accent); box-shadow: var(--shadow-md); }
/* Frequent, repeated actions (Log issue / Assign): present + tappable but quieter
   than a filled CTA. */
.btn-outline { background: var(--surface); color: var(--accent); border: 1.5px solid var(--accent); box-shadow: none; }
/* Submit stays quiet until its section's checkboxes are complete, then it
   swaps to .btn-primary and earns the emphasis. */
.btn-quiet { background: var(--surface-sunk); color: var(--text-muted); box-shadow: none; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; box-shadow: none; }
.btn-section { margin-top: 10px; }

/* ---- Sticky action bar (clock in/out, interruption) ----
   Fixed to the viewport so it stays reachable while scrolling; padded for the
   iOS home-indicator safe area so it isn't hidden behind the system bar. */
.actionbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
  display: flex; gap: var(--space-2); padding: 10px var(--space-3);
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
  background: rgba(255,255,255,0.94); backdrop-filter: saturate(1.4) blur(10px);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 16px rgba(9,41,67,0.08);
}
.actionbar .btn { flex: 1; padding: 13px var(--space-3); }
.btn-clockin { background: var(--success); color: var(--on-accent); box-shadow: 0 2px 6px rgba(9,41,67,0.12); }
/* Clocking out is normal, not destructive — neutral + the quietest of the bar.
   Red is reserved for genuine warnings (--danger). */
.btn-clockout { background: var(--surface-sunk); color: var(--text); box-shadow: none; }
.btn-ghost { background: var(--surface-sunk); color: var(--text); }

/* ---- States ---- */
.notice { padding: 28px 18px; text-align: center; color: var(--text-muted); }
.notice h2 { color: var(--text); }

/* Day-complete moment — closure the worker can feel. */
.day-complete { padding: 40px 22px 32px; text-align: center; }
.day-complete-check {
  width: 76px; height: 76px; margin: 0 auto var(--space-3); border-radius: 50%;
  background: var(--mint); color: #fff; font-size: 42px; line-height: 76px; font-weight: 800;
  box-shadow: 0 8px 22px rgba(16,163,127,0.35); animation: dc-pop .5s cubic-bezier(.18,1.3,.5,1) both;
}
@keyframes dc-pop { 0% { transform: scale(.4); opacity: 0; } 60% { transform: scale(1.12); } 100% { transform: scale(1); opacity: 1; } }
.day-complete-title { margin: 0 0 var(--space-3); color: var(--text); }
.day-complete-stats { display: flex; gap: var(--space-2); justify-content: center; margin: 0 0 var(--space-3); }
.dc-stat { flex: 1; max-width: 120px; background: var(--surface-sunk, var(--surface)); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 12px 6px; }
.dc-stat-num { font-size: 22px; font-weight: 800; color: var(--accent); font-family: var(--font-display, inherit); }
.dc-stat-label { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.day-complete-streak {
  display: inline-block; margin: 0 auto var(--space-3); padding: 8px 16px; border-radius: var(--radius-pill);
  background: linear-gradient(90deg, #ff8a3d, #ff6b3d); color: #fff; font-weight: 800; font-size: 15px;
  box-shadow: 0 6px 16px rgba(255,107,61,0.32);
}
.day-complete-sub { color: var(--text); font-weight: 600; margin: 0 0 4px; }
.day-complete-note { color: var(--text-muted); font-size: 13px; margin: 0 0 var(--space-4); }
.day-complete .btn { max-width: 260px; margin: 0 auto; }
.hidden { display: none !important; }

/* New-task alert toast (slides down from the top, auto-hides) */
.avrv-toast {
  position: fixed; top: calc(env(safe-area-inset-top) + 12px); left: 50%;
  transform: translateX(-50%) translateY(-160%); z-index: 60; max-width: calc(100% - 24px);
  background: var(--app-manager); color: #fff; font-weight: 700; font-size: 14px;
  padding: 11px 16px; border-radius: var(--radius-pill); box-shadow: 0 6px 20px rgba(9,41,67,0.34);
  transition: transform .28s ease; pointer-events: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.avrv-toast.show { transform: translateX(-50%) translateY(0); }

/* ---- Priority pill (background via .cat-* class) ---- */
.pill {
  display: inline-block; padding: 3px 11px; border-radius: var(--radius-pill);
  font-size: 12.5px; font-weight: 700; color: var(--on-accent); letter-spacing: .01em;
  box-shadow: inset 0 -1px 0 rgba(0,0,0,0.12);
}

/* ---- Modal (assign / log issue) ---- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 50; background: rgba(9,41,67,0.45);
  display: flex; align-items: flex-end; justify-content: center;
}
.modal-box {
  width: 100%; max-width: 520px; background: var(--surface);
  border-radius: var(--r-lg) var(--r-lg) 0 0; padding: 18px var(--space-4) 22px;
  max-height: 90vh; overflow-y: auto;
}
.modal-box h3 { margin: 0 0 var(--space-3); }
.modal-field { display: block; margin-bottom: var(--space-3); }
.modal-field > span { display: block; font-size: var(--fs-caption); color: var(--text-muted); margin-bottom: var(--space-1); }
.modal-input {
  width: 100%; min-height: 46px; border: 1px solid var(--border); border-radius: var(--r-sm);
  padding: 10px 12px; font: inherit; background: var(--surface); color: var(--text);
}
.modal-input:focus, .modal-box textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
/* Drop the raw OS look on selects + the date field so the modals don't read as a
   default form. Custom chevron replaces the native one. */
select.modal-input {
  appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235a6b78' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center; background-size: 13px;
}
input[type=date].modal-input { -webkit-appearance: none; appearance: none; }
input[type=date].modal-input::-webkit-calendar-picker-indicator { opacity: .55; cursor: pointer; }
input[type=date].modal-input::-webkit-date-and-time-value { text-align: left; }
.modal-actions { display: flex; gap: 10px; margin-top: 6px; }
.modal-actions .btn { flex: 1; }
/* Stacked variant: full-width choices, one per line (e.g. break vs. done). */
.modal-actions-stack { flex-direction: column; }
.modal-actions-stack .btn { width: 100%; }
/* Read-only to-do detail popup. */
.modal-detail-head { display: flex; align-items: center; gap: var(--space-2); margin-bottom: var(--space-2); }
.modal-detail-head h3 { margin: 0; }
.modal-detail-body { white-space: pre-wrap; word-break: break-word; color: var(--text); line-height: 1.5; margin: 0 0 var(--space-3); }
.modal-detail-meta { font-size: var(--fs-caption); color: var(--text-muted); margin: 0 0 var(--space-3); }
@media (min-width: 560px) { .modal-overlay { align-items: center; } .modal-box { border-radius: var(--r-lg); } }

/* ---- Dashboard (dark) ---- */
body.dash { background: var(--dash-bg); color: var(--dash-text); }
/* The dashboard sits on a dark navy page, so a plain --app-manager header blends
   right into it. Give it a lighter navy gradient + a defined bottom edge so it
   reads as a distinct banner covering the top. */
.dash .topbar {
  background: #0a2b47;                                          /* solid fallback */
  background: linear-gradient(160deg, #1a4a73 0%, #0a2b47 100%);
  border-bottom: 1px solid var(--dash-border);
  box-shadow: 0 3px 16px rgba(0,0,0,0.4);
}
/* minmax(0, 1fr) — NOT the default "1fr" (= minmax(min-content, 1fr)) — so a long
   non-wrapping title (e.g. a repeating-task name) can't force a track, and the
   whole grid, wider than the phone screen. This was clipping the dashboard on
   the right. Pairs with min-width:0 on the cards. */
.dash-grid { padding: 14px; display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-3); max-width: 880px; margin: 0 auto; }
/* Manager "New task" CTA — white on the dark dashboard so it reads as the action. */
.dash-newtask { width: 100%; background: var(--surface); color: var(--app-manager); font-weight: 800; box-shadow: 0 2px 10px rgba(0,0,0,0.25); }
.dash-card { min-width: 0; background: var(--dash-surface); border: 1px solid var(--dash-border); border-radius: var(--r); padding: var(--space-4); box-shadow: 0 2px 10px rgba(0,0,0,0.22); }
.dash-card h3 { font-family: var(--font-body); margin: 0 0 var(--space-2); font-size: var(--fs-caption); text-transform: uppercase; letter-spacing: .06em; color: var(--dash-muted); font-weight: 700; }
.dash-metric { font-family: var(--font-display); font-size: var(--fs-metric); font-weight: 800; letter-spacing: -0.02em; }
.dash-card .dash-alert { color: #ffbf4d; font-weight: 700; }   /* aging assignments: urgency */
.dash-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-3); }
.badge-live { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-caption); }
.badge-live .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dash-live); box-shadow: 0 0 0 3px rgba(58,209,122,0.18); }
.dash-todo { display: flex; align-items: center; gap: 9px; padding: var(--space-2) 0; border-bottom: 1px solid var(--dash-line); flex-wrap: wrap; }
.dash-todo:last-child { border-bottom: none; }
.dash-pill { flex: none; font-size: 10.5px; font-weight: 700; color: var(--on-accent); padding: 2px var(--space-2); border-radius: var(--radius-pill); }
/* Title is a button (tap to read full text) but reads as inline text; it
   truncates to one line so long tasks don't wrap the row. */
.dash-todo-title { flex: 1; min-width: 0; font-size: 13.5px; color: var(--dash-text);
  text-align: left; background: none; border: none; padding: 0; cursor: pointer; font: inherit;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
button.dash-todo-title:hover { color: var(--dash-live); text-decoration: underline; }
/* Completion-streak recognition chip on the manager's app cards. */
.dash-streak { display: inline-block; margin-top: var(--space-2); padding: 4px 12px; border-radius: var(--radius-pill);
  background: linear-gradient(90deg, #ff8a3d, #ff6b3d); color: #fff; font-weight: 800; font-size: 12px; }
/* Team accordion — one row per employee; tap the header to expand hours + tasks. */
.dash-team { padding-top: var(--space-3); }
.team-row { border-top: 1px solid var(--dash-line); }
.team-row:first-of-type { border-top: none; }
.team-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
  width: 100%; background: none; border: none; padding: var(--space-3) 0; cursor: pointer; text-align: left; color: inherit; font: inherit; }
.team-idn { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.team-name { font-weight: 700; font-size: 15px; color: var(--dash-text); }
.team-sub { font-size: 11.5px; color: var(--dash-muted); text-transform: uppercase; letter-spacing: .04em; }
.team-meta { flex: none; display: flex; align-items: center; gap: var(--space-3); }
.team-hours { font-size: 13px; color: var(--dash-muted); font-variant-numeric: tabular-nums; }
.team-hours.on { color: var(--dash-live); font-weight: 700; }
.team-count { font-size: 12px; font-weight: 600; color: var(--dash-text); background: rgba(255, 255, 255, 0.09);
  border: 1px solid var(--dash-border); padding: 2px var(--space-2); border-radius: var(--radius-pill); white-space: nowrap; }
.team-chev { display: inline-block; width: 0; height: 0; border: 5px solid transparent; border-left: 6px solid var(--dash-muted); margin-left: auto; flex-shrink: 0; transition: transform .15s ease; }
.open > .team-head > .team-chev,
.open > .role-head > .team-chev,
.occ-toggle.open > .team-chev { border-left-color: var(--dash-text); transform: rotate(90deg); }
.team-head > .team-meta > .team-chev { margin-left: 0; }
.team-body { padding: 0 0 var(--space-3) var(--space-2); border-left: 2px solid var(--dash-line); margin-left: 2px; }
.team-empty { color: var(--dash-muted); margin: var(--space-2) 0; }
/* Assign shortcut — a clean, quiet secondary button (not a dashed pill). A soft
   surface + hairline border, with the "+" in the live-green accent. */
.team-assign { margin-top: var(--space-3); display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 13px; border-radius: 9px; border: 1px solid var(--dash-border);
  background: rgba(255, 255, 255, 0.045); color: var(--dash-text); font: inherit; font-size: 13px;
  font-weight: 600; cursor: pointer; transition: background .15s ease, border-color .15s ease; }
.team-assign::before { content: "+"; font-size: 16px; line-height: 1; font-weight: 700; color: var(--dash-live); }
.team-assign:hover { background: rgba(255, 255, 255, 0.09); border-color: var(--dash-muted); }
.team-assign:active { transform: translateY(0.5px); }
/* Role group headers — collapsible sections within the team card. */
.role-group { border-top: 1px solid var(--dash-line); }
.role-group:first-child { border-top: none; }
.role-head { display: flex; align-items: center; gap: var(--space-3);
  width: 100%; background: none; border: none; padding: var(--space-3) 0; cursor: pointer;
  text-align: left; color: inherit; font: inherit; }
.role-label { font-weight: 800; font-size: 15px; text-transform: uppercase; letter-spacing: .06em; color: #fff; }
.role-info { flex: 1; font-size: 12px; color: var(--dash-muted); }
.role-onsite { color: var(--dash-live); font-weight: 700; }
.role-streak { white-space: nowrap; }
.role-body { padding: 0 0 var(--space-2); }
/* Repeating-task rule: full name on its own line (wraps normally), then a meta
   row. Two lines keeps long schedule names readable on a phone without forcing
   horizontal overflow. */
.dash-rule { padding: var(--space-2) 0; border-bottom: 1px solid var(--dash-line); }
.dash-rule:last-child { border-bottom: none; }
.dash-rule-title { font-size: 13.5px; font-weight: 600; color: var(--dash-text);
  overflow-wrap: break-word; margin-bottom: 5px; }
.dash-rule-meta { display: flex; align-items: center; gap: 8px; }
.dash-rule-cadence { min-width: 0; font-size: 11.5px; color: var(--dash-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-rule-meta .dash-todo-del { margin-left: auto; }
.dash-todo-due { flex: none; font-size: 11.5px; color: var(--dash-muted); }
/* Tap-to-complete circle + delete ✕ (manager full-access only). */
.dash-todo-check { flex: none; width: 20px; height: 20px; padding: 0; border-radius: 50%;
  border: 2px solid var(--dash-muted); background: transparent; cursor: pointer; color: var(--on-accent);
  font-size: 12px; line-height: 1; transition: background .12s, border-color .12s; }
.dash-todo-check:hover { border-color: var(--dash-live); }
.dash-todo-check.checked { background: var(--dash-live); border-color: var(--dash-live); }
.dash-todo-check.checked::after { content: "✓"; }
.dash-todo-del { flex: none; margin-left: auto; width: 22px; height: 22px; padding: 0; border: none;
  background: transparent; color: var(--dash-muted); font-size: 13px; cursor: pointer; border-radius: 6px; }
.dash-todo-del:hover { color: var(--danger); background: rgba(255,255,255,0.06); }
/* "+N more" reveals the hidden to-dos in place. */
.dash-more { display: block; width: 100%; margin-top: var(--space-2); padding: var(--space-2) 0;
  background: transparent; border: none; color: var(--dash-live); font-size: 13px; font-weight: 600;
  text-align: left; cursor: pointer; }
.dash-more:hover { text-decoration: underline; }
/* To-do lists go full width below the metric tiles so long titles stop
   getting crushed into 3-line wraps in a half-width column. */
.dash-todos { grid-template-columns: 1fr; }
@media (min-width: 720px) { .dash-todos { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }

/* ---- Occupancy history chart ---- */
.occ-toggle { display: flex; align-items: center; gap: 8px; width: 100%; margin-top: var(--space-3); padding: var(--space-2) 0;
  background: transparent; border: none; border-top: 1px solid var(--dash-line);
  color: var(--dash-muted); font: inherit; font-size: 13px; font-weight: 600;
  text-align: left; cursor: pointer; letter-spacing: .02em; }
.occ-toggle:hover { color: var(--dash-text); }
.occ-history { margin-top: var(--space-2); }
.occ-loading { color: var(--dash-muted); font-size: 13px; }
.occ-chart-wrap { margin: var(--space-2) 0; }
.occ-chart { width: 100%; height: auto; display: block; }
.occ-label { font-size: 10px; fill: var(--dash-muted); font-family: var(--font-body); }
.occ-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 6px; font-size: 11.5px; color: var(--dash-muted); }
.occ-swatch { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.occ-swatch-line { display: inline-block; width: 16px; height: 3px; border-radius: 2px; }
.occ-summary { margin-top: var(--space-3); padding-top: var(--space-2); border-top: 1px solid var(--dash-line); }
.occ-summary p { margin: 2px 0; font-size: 12.5px; color: var(--dash-muted); font-variant-numeric: tabular-nums; }

/* ---- To-do row photo thumbnails ---- */
.todo-thumbs { display: flex; gap: 6px; margin-top: 6px; }
.todo-thumbs img { width: 44px; height: 44px; object-fit: cover; border-radius: var(--space-2); border: 1px solid var(--border); }
.dash-todo-thumbs { display: flex; gap: 4px; align-items: center; margin-left: auto; flex-shrink: 0; }
.dash-todo-thumbs img, .dash-todo-thumbs video { width: 28px; height: 28px; object-fit: cover; border-radius: 4px; border: 1px solid var(--border); }
.dash-todo-more { font-size: 11px; color: var(--text-muted); }

/* ---- Midday check-in banner ---- */
.midday-banner {
  display: flex; align-items: center; gap: var(--space-3);
  margin: var(--space-3) var(--space-4) 0; padding: var(--space-3) 14px;
  background: var(--warn-bg); border: 1px solid var(--warn-border); border-radius: var(--r);
}
.midday-text { flex: 1; font-size: 13.5px; line-height: 1.35; color: var(--warn-text); }
.midday-btn { flex: none; background: var(--accent); color: var(--on-accent); }

/* ---- Site Turns (Newbook arrivals/departures) ---- */
.turns-banner {
  margin: 0 0 var(--space-3); padding: 10px var(--space-3); border-radius: var(--r);
  background: var(--surface-sunk); color: var(--text-muted); font-size: var(--fs-label); line-height: 1.4;
}
.turns-banner.pending { background: var(--warn-bg); color: var(--warn-text); border: 1px solid var(--warn-border); }
.turn-row { padding: 10px 0; border-top: 1px solid var(--border); }
.turn-row:first-of-type { border-top: none; }
.turn-row.done .turn-site { color: var(--check); }
.turn-top { display: flex; align-items: baseline; gap: var(--space-2); flex-wrap: wrap; }
.turn-site { font-weight: 700; font-size: var(--fs-body); }
.turn-meta { font-size: 12.5px; color: var(--text-muted); }
.turn-flag { font-size: 11px; font-weight: 700; padding: 2px var(--space-2); border-radius: var(--radius-pill);
  background: var(--warn-bg); color: var(--warn-text); border: 1px solid var(--warn-border); }
/* Site-turn checks use the same plain checkbox rows (.task) as every other
   checklist — one checkbox pattern across the whole app. */
.turn-checks { margin-top: var(--space-1); }
.turn-checks .task { padding: var(--space-2) 0; }

/* ---- v1.3 task control: To-Do scope/group toggles, grouping, task menu ---- */
.todo-controls { display: flex; gap: 12px; flex-wrap: wrap; margin: 4px 0 12px; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius-pill, 999px); overflow: hidden; background: var(--surface); }
.seg-btn { border: 0; background: transparent; padding: 7px 14px; font: inherit; font-size: var(--fs-caption, 13px); color: var(--text-muted); cursor: pointer; }
.seg-btn.active { background: var(--accent); color: var(--on-accent); font-weight: 700; }
.todo-group-head { font-size: var(--fs-caption, 12px); font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--accent); margin: 16px 0 6px; }
.todo-menu { flex: none; margin-left: auto; align-self: flex-start; border: 0; background: transparent; font-size: 22px; line-height: 1; padding: 0 6px; color: var(--text-muted); cursor: pointer; border-radius: 8px; }
.todo-menu:hover { background: rgba(9,41,67,.06); }
.modal-actions.col { flex-direction: column; align-items: stretch; gap: 8px; }
.btn-danger { background: #c0392b; color: #fff; border: 1px solid #c0392b; }
