/* ============================================================
   JTA Clean & Safe — JTA Residential Care green, mobile-first
   ============================================================ */
:root {
  --brand: #176554;
  --brand-dark: #0f4a3d;
  --brand-soft: #e5f2ee;
  --ink: #1f2937;
  --muted: #6b7280;
  --paper: #f3f1eb;
  --card: #ffffff;
  --line: #e5e7eb;
  --ok: #166534;
  --ok-soft: #dcfce7;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --bad: #b4463d;
  --bad-soft: #fee2e2;
  --info-soft: #e0f2fe;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(15, 55, 45, 0.10), 0 4px 14px rgba(15, 55, 45, 0.06);
  font-size: 16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--paper);
  color: var(--ink);
  min-height: 100vh;
}
h1, h2, h3 { line-height: 1.2; margin: 0 0 8px; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
button { font: inherit; cursor: pointer; }
input, select, textarea {
  font: inherit;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  width: 100%;
  background: #fff;
  color: var(--ink);
}
input:focus, select:focus, textarea:focus, button:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
}
label { display: block; font-size: 0.92rem; font-weight: 600; margin: 10px 0 4px; }
label > input, label > select, label > textarea { margin-top: 4px; font-weight: 400; }

/* ---------- Buttons ---------- */
.primary-button {
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 11px 18px;
  font-weight: 600;
}
.primary-button:disabled { background: #9db5ae; cursor: not-allowed; }
.ghost-button {
  background: var(--brand-soft);
  color: var(--brand-dark);
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 9px 14px;
  font-weight: 600;
}
.warn-button {
  background: var(--warn-soft);
  color: var(--warn);
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 600;
}
.text-button {
  background: none;
  border: none;
  color: var(--brand-dark);
  padding: 6px 4px;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.button-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }

/* ---------- Auth ---------- */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background:
    radial-gradient(1000px 500px at 15% -10%, #d9ece6 0%, transparent 60%),
    radial-gradient(800px 420px at 110% 110%, #e8e3d3 0%, transparent 55%),
    var(--paper);
}
body:not(.auth-pending):not(.auth-signed-out) .auth-screen { display: none; }

/* Access-not-yet-approved screen (default-deny gate) */
.access-screen {
  min-height: 100vh;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background:
    radial-gradient(1000px 500px at 15% -10%, #d9ece6 0%, transparent 60%),
    radial-gradient(800px 420px at 110% 110%, #e8e3d3 0%, transparent 55%),
    var(--paper);
}
body.auth-access-pending .access-screen { display: flex; }
.access-status-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  margin-bottom: 8px;
}
.access-status-badge.is-pending  { background: #fff3d6; color: #8a5a00; }
.access-status-badge.is-rejected { background: #fde2e1; color: #8a1c17; }
.access-status-badge.is-none     { background: #e4efe9; color: #1f5c46; }

.auth-card {
  background: var(--card);
  border-radius: 20px;
  box-shadow: var(--shadow);
  max-width: 440px;
  width: 100%;
  padding: 28px;
}
.auth-brand, .brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  background: var(--brand);
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.05em;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 1.05rem;
}
.auth-brand strong, .brand strong { display: block; font-size: 1.02rem; }
.auth-brand small, .brand small { color: var(--muted); }
.auth-ethos {
  color: var(--brand-dark);
  font-style: italic;
  font-size: 0.9rem;
  margin: 10px 0 4px;
}
.section-kicker {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--brand);
  margin: 14px 0 2px;
}
.auth-copy h1 { font-size: 1.35rem; }
.auth-copy p { color: var(--muted); margin: 6px 0 0; }
.auth-form { margin-top: 12px; }
.auth-submit { width: 100%; margin-top: 14px; }
.auth-message { min-height: 1.2em; color: var(--bad); font-size: 0.9rem; }
.auth-safeguarding {
  margin-top: 14px;
  background: var(--brand-soft);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 0.85rem;
}
.auth-safeguarding p { margin: 4px 0 0; color: var(--brand-dark); }

/* ---------- Shell ---------- */
.app-shell { display: none; }
body.auth-signed-in .app-shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
body.auth-signed-in .auth-screen { display: none; }

.sidebar {
  background: var(--brand-dark);
  color: #eaf4f0;
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.sidebar .brand small { color: #a9c9bf; }
.sidebar .brand-mark { background: #fff; color: var(--brand-dark); }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-button {
  background: none;
  border: none;
  color: #d7e8e2;
  text-align: left;
  padding: 11px 12px;
  border-radius: 10px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}
.nav-button:hover { background: rgba(255, 255, 255, 0.08); }
.nav-button.is-active { background: var(--brand); color: #fff; }
.nav-badge {
  margin-left: auto;
  background: var(--bad);
  color: #fff;
  border-radius: 999px;
  font-size: 0.72rem;
  padding: 1px 8px;
}
.sidebar-footer { margin-top: auto; font-size: 0.88rem; }
.sidebar-footer .text-button { color: #cfe5de; display: block; }
.signed-in { margin: 0 0 4px; font-weight: 700; cursor: pointer; }
.signed-in small { display: block; font-weight: 400; font-size: 0.72rem; color: #a9c9bf; margin-top: 2px; }
.sidebar-ethos { color: #a9c9bf; font-style: italic; font-size: 0.78rem; margin-top: 12px; }

.main { padding: 16px 18px 90px; max-width: 1080px; width: 100%; }
.topbar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.menu-button {
  display: none;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 1.1rem;
}
.home-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.home-chip {
  border: 1.5px solid var(--line);
  background: var(--card);
  border-radius: 999px;
  padding: 8px 16px;
  font-weight: 700;
  color: var(--muted);
}
.home-chip.is-active { background: var(--brand); border-color: var(--brand); color: #fff; }
/* Howards House is orange — its selected state must match its identity */
.home-chip.is-active[data-home="Howards House"] { background: #ea580c; border-color: #ea580c; }
.sync-state { margin-left: auto; font-size: 0.8rem; color: var(--muted); }

/* ---------- Views & cards ---------- */
.view { display: none; }
.view.is-active { display: block; }
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 14px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.card-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.view-note { color: var(--muted); font-size: 0.88rem; margin: 0 0 12px; }
.view-note p { margin: 0 0 8px; }

/* ---------- Shift header ---------- */
.shift-header { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: space-between; }
.shift-header .shift-title h2 { font-size: 1.25rem; margin: 0; }
.shift-header .shift-title p { margin: 2px 0 0; color: var(--muted); font-size: 0.9rem; }
.shift-progress { text-align: right; }
.shift-progress strong { font-size: 1.3rem; color: var(--brand-dark); }
.deadline-chip {
  display: inline-block;
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.8rem;
  font-weight: 700;
  background: var(--brand-soft);
  color: var(--brand-dark);
}
.deadline-chip.is-late { background: var(--bad-soft); color: var(--bad); }
.deadline-chip.t-amber { background: var(--warn-soft); color: var(--warn); }
.deadline-chip.t-orange { background: #ffedd5; color: #c2410c; font-size: 0.95rem; }
.deadline-chip.t-red { background: var(--bad-soft); color: var(--bad); font-size: 0.95rem; }

.shift-progress { display: flex; flex-direction: column; gap: 5px; align-items: flex-end; }
.progress-chip {
  display: inline-block;
  background: var(--brand-soft);
  color: var(--brand-dark);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.85rem;
  font-weight: 700;
}
.progress-chip.is-warn { background: var(--warn-soft); color: var(--warn); }
.progress-chip.is-done { background: var(--ok-soft); color: var(--ok); }
.unassigned-warning {
  flex-basis: 100%;
  background: var(--warn-soft);
  color: var(--warn);
  border: 1.5px solid #f4d38a;
  border-radius: 10px;
  padding: 9px 13px;
  font-size: 0.88rem;
  font-weight: 600;
  margin: 4px 0 0;
  text-align: left;
  cursor: pointer;
  width: 100%;
}
.shift-banner {
  flex-basis: 100%;
  border-radius: 10px;
  padding: 10px 13px;
  font-size: 0.9rem;
  font-weight: 600;
  margin: 6px 0 0;
}
.shift-banner.is-warn { background: var(--warn-soft); color: var(--warn); }
.shift-banner.is-critical { background: var(--bad-soft); color: var(--bad); }
.shift-banner.is-info { background: var(--info-soft); color: #0369a1; }
.handover-alerts { margin: 8px 0; padding-left: 20px; font-weight: 500; }
.handover-alerts li { margin: 3px 0; }
.item-row.is-optional { background: #fafaf7; border-radius: 10px; padding-left: 10px; padding-right: 10px; }
.progress-chip.is-optional { background: #f1f5f9; color: #64748b; }
.progress-chip.is-bad { background: var(--bad-soft); color: var(--bad); }
.progress-chip.is-purple { background: #ede9fe; color: #6d28d9; }

/* Home Ready Score — the shift's single headline number */
.home-ready {
  background: linear-gradient(135deg, #0f4a3d, #176554);
  color: #fff;
  border-radius: 14px;
  padding: 14px 20px;
  text-align: center;
  min-width: 160px;
}
.home-ready-label { display: block; font-size: 0.68rem; letter-spacing: 0.16em; opacity: 0.85; font-weight: 700; }
.home-ready strong { font-size: 2.1rem; line-height: 1.15; }
.home-ready small { display: block; font-size: 0.72rem; opacity: 0.9; max-width: 220px; margin: 2px auto 0; }
.home-ready.is-ready { background: linear-gradient(135deg, #166534, #16a34a); }
.home-ready.is-close { background: linear-gradient(135deg, #0f4a3d, #b45309); }

/* My progress — personal snapshot */
.my-progress {
  background: var(--brand-soft);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 12px;
}
.my-progress-head { display: flex; justify-content: space-between; font-size: 0.95rem; color: var(--brand-dark); }
.my-progress-head span { font-weight: 800; }
.my-progress-bar { background: #fff; border-radius: 999px; height: 8px; margin: 8px 0; overflow: hidden; }
.my-progress-bar div { background: var(--brand); height: 100%; border-radius: 999px; transition: width 0.4s; }
.my-progress small { color: var(--brand-dark); }

.insight {
  background: #f8fafc;
  border-left: 3px solid var(--brand);
  border-radius: 0 10px 10px 0;
  padding: 9px 13px;
  margin: 6px 0;
  font-size: 0.92rem;
}
#allocate-summary.is-bad { color: var(--warn); }

/* Auth extras */
.auth-links { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px; }
.auth-help { margin: 12px 0; font-size: 0.85rem; }
.auth-help summary { cursor: pointer; font-weight: 600; color: var(--brand-dark); }
.auth-help ol { margin: 10px 0 0; padding-left: 20px; color: var(--muted); }
.auth-help li { margin: 6px 0; }

/* Evidence-quality confirmation */
#evidence-confirm { border: 1px solid var(--line); border-radius: 12px; padding: 8px 14px; margin-top: 10px; }
#evidence-confirm legend { font-weight: 700; font-size: 0.88rem; padding: 0 6px; }
#evidence-confirm label { display: flex; gap: 8px; align-items: flex-start; font-weight: 500; margin: 7px 0; font-size: 0.9rem; }
#evidence-confirm input { width: auto; }

/* Verification checklist */
#verify-checklist label { display: flex; gap: 8px; align-items: flex-start; font-weight: 500; margin: 7px 0; }
#verify-checklist input { width: auto; }

/* Shift status headline */
.shift-status-chip {
  display: inline-block;
  border-radius: 999px;
  padding: 3px 12px;
  font-size: 0.82rem;
  font-weight: 700;
  background: var(--info-soft);
  color: #0369a1;
}
.shift-status-chip.is-ready { background: var(--ok-soft); color: var(--ok); }
.shift-status-chip.is-warn { background: var(--warn-soft); color: var(--warn); }
.shift-status-chip.is-bad { background: var(--bad-soft); color: var(--bad); }

/* Handover countdown */
.handover-countdown { font-weight: 700; color: var(--brand-dark); background: var(--brand-soft); border-radius: 10px; padding: 8px 13px; margin: 0 0 10px; }
.handover-countdown.is-late { background: var(--warn-soft); color: var(--warn); }

/* Ask Clean Assistant */
.ask-answer { background: #f8fafc; border-radius: 12px; padding: 12px 14px; margin-top: 10px; font-size: 0.92rem; }
.ask-answer .ask-reply { margin: 6px 0 0; color: var(--brand-dark); }

/* Greeting + clock */
.greeting-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: linear-gradient(135deg, #176554, #0f4a3d);
  color: #fff;
  border-radius: 14px;
  padding: 13px 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.greeting-card strong { display: block; font-size: 1.1rem; }
.greeting-card small { color: #cfe5de; }
.greeting-clock {
  font-size: 1.35rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

/* Help section */
.help-item { border-bottom: 1px solid var(--line); padding: 4px 0; }
.help-item summary { cursor: pointer; font-weight: 700; color: var(--brand-dark); padding: 10px 4px; font-size: 1rem; }
.help-item[open] summary { color: var(--brand); }
.help-item p, .help-item ul, .help-item ol { margin: 4px 0 12px; color: var(--ink); font-size: 0.92rem; }
.help-item ul, .help-item ol { padding-left: 22px; }
.help-item li { margin: 5px 0; }

/* Dashboard live Home Ready badge */
.home-dash-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 4px 2px 10px; }
.home-dash-head h2 { margin: 0; }
.dash-ready { display: flex; align-items: baseline; gap: 8px; border-radius: 10px; padding: 6px 14px; color: #fff; background: var(--brand); }
.dash-ready span { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; opacity: 0.9; }
.dash-ready strong { font-size: 1.3rem; }
.dash-ready small { font-size: 0.72rem; opacity: 0.92; }
.dash-ready.is-ready { background: #16a34a; }
.dash-ready.is-close { background: #b45309; }
.dash-ready.is-low { background: var(--bad); }

/* Locked home selector (shared tablet) */
.home-locked-note { font-size: 0.78rem; color: var(--muted); align-self: center; }
.home-chip[disabled] { opacity: 1; cursor: default; }

/* Cleaning calendar */
.cal-home { margin-bottom: 14px; }
.cal-home > strong { display: block; margin-bottom: 6px; }
.cal-grid { display: grid; grid-template-columns: 52px repeat(14, 1fr); gap: 3px; align-items: center; max-width: 640px; }
.cal-label { font-size: 0.75rem; color: var(--muted); font-weight: 600; }
.cal-cell { display: block; aspect-ratio: 1; border-radius: 4px; background: #eef1f4; min-height: 16px; }
.cal-cell.is-good { background: #16a34a; }
.cal-cell.is-part { background: #f59e0b; }
.cal-cell.is-bad { background: var(--bad); }
.cal-cell.is-none { background: #eef1f4; }
.cal-date { font-size: 0.62rem; color: var(--muted); text-align: center; }

/* Category check tasks + section counts */
.item-row.is-check { border-left: 3px solid var(--info-soft); padding-left: 10px; }
.section-count { font-size: 0.8rem; color: var(--muted); font-weight: 600; }
#zone-min-row { transition: none; }

/* Back button */
.back-button {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  font-weight: 600;
  color: var(--brand-dark);
}

/* Key-messages ticker */
.ticker {
  overflow: hidden;
  background: var(--brand-soft);
  border-radius: 10px;
  margin-bottom: 12px;
  white-space: nowrap;
  position: relative;
}
.ticker-track {
  display: inline-block;
  padding: 8px 0;
  animation: ticker-scroll 40s linear infinite;
}
.ticker:hover .ticker-track { animation-play-state: paused; }
.ticker-item { color: var(--brand-dark); font-weight: 600; font-size: 0.9rem; padding: 0 34px; }
@keyframes ticker-scroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .ticker-track { animation: none; white-space: normal; } .ticker { white-space: normal; } }

/* Appointments */
.appt-row.is-good { border-left: 3px solid var(--ok); padding-left: 10px; }
.appt-row.is-warn { border-left: 3px solid var(--warn); padding-left: 10px; }
.appt-row.is-none { opacity: 0.6; }
.status-chip[data-status="Confirmed"] { background: var(--ok-soft); color: var(--ok); }
.status-chip[data-status="Scheduled"] { background: var(--info-soft); color: #0369a1; }
.status-chip[data-status="Preparation needed"] { background: var(--warn-soft); color: var(--warn); }
.status-chip[data-status="Completed"] { background: var(--ok-soft); color: var(--ok); }
.status-chip[data-status="Cancelled"] { background: #f1f5f9; color: var(--muted); }
.form-2col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.form-2col label { margin: 10px 0 0; }
@media (max-width: 560px) { .form-2col { grid-template-columns: 1fr 1fr; } }

/* Outstanding actions panel */
.outstanding-card { border: 1.5px solid var(--warn); }
.outstanding-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  margin: 6px 0;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--ink);
}
.outstanding-row .outstanding-go { margin-left: auto; color: var(--muted); }
.outstanding-row.critical { border-left: 4px solid var(--bad); }
.outstanding-row.urgent { border-left: 4px solid var(--warn); }
.outstanding-row.due { border-left: 4px solid #0369a1; }
.outstanding-row:hover { background: var(--brand-soft); }
.outstanding-sev { flex: 0 0 auto; }

/* Notification bell */
.bell-button {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 7px 11px;
  font-size: 1.05rem;
}
.bell-button.has-critical { border-color: var(--bad); animation: bell-pulse 2s infinite; }
@keyframes bell-pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(180,70,61,0.4); } 50% { box-shadow: 0 0 0 5px rgba(180,70,61,0); } }
.bell-count {
  position: absolute;
  top: -6px; right: -6px;
  background: var(--bad);
  color: #fff;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 800;
  min-width: 18px;
  padding: 1px 5px;
  text-align: center;
}
@media (prefers-reduced-motion: reduce) { .bell-button.has-critical { animation: none; } }

/* Notification rows */
.notif-row {
  display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 10px;
  padding: 11px 13px;
  margin: 7px 0;
}
.notif-row.critical { border-left-color: var(--bad); }
.notif-row.urgent { border-left-color: var(--warn); }
.notif-row.due { border-left-color: #0369a1; }

/* Live shift assurance table */
.assurance-table td { vertical-align: top; }
.assurance-table tbody tr { cursor: pointer; }
.assurance-table tbody tr:hover { background: var(--brand-soft); }

/* Diary agenda day headers */
.diary-day { margin: 16px 0 4px; color: var(--brand-dark); font-size: 1rem; }
.diary-day:first-child { margin-top: 4px; }

/* Owner-protected team member */
.owner-lock { color: var(--muted); font-size: 0.85rem; font-weight: 600; }

/* Com Book */
.com-tag {
  display: inline-block;
  background: var(--brand-soft);
  color: var(--brand-dark);
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 1px 8px;
  margin-right: 6px;
}
.com-row .item-main strong { font-weight: 500; }

/* Incomplete-handover backlog */
.incomplete-handovers { border: 1.5px solid var(--warn); margin-top: 14px; }
.handover-incomplete-hint { margin: 8px 0 0; }
.status-chip[data-status="Support recorded"] { background: var(--ok-soft); color: var(--ok); }

/* Appointments in handover */
.handover-appts { background: var(--info-soft); border-radius: 12px; padding: 12px 14px; margin: 10px 0; }
.handover-appts .kv { margin: 4px 0; }
.allocate-row { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 7px 0; border-bottom: 1px dashed var(--line); }
.allocate-row span { font-weight: 600; font-size: 0.92rem; }
.allocate-row small { color: var(--muted); font-weight: 400; }
.allocate-row input { flex: 0 1 220px; }
.board-section-title { margin: 18px 0 4px; color: var(--brand-dark); }
.board-section-title:first-child { margin-top: 4px; }
.tile-group-title {
  margin: 12px 2px 6px;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.tile.is-nodata strong { color: var(--muted); font-size: 0.95rem; line-height: 2; }

/* ---------- Big actions ---------- */
.big-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.big-action {
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 12px;
  font-weight: 700;
  font-size: 0.98rem;
  box-shadow: var(--shadow);
}
.big-action:hover { border-color: var(--brand); }
.big-action.is-warn { border-color: var(--warn); color: var(--warn); }

/* ---------- Round board ---------- */
.round-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.round-table th {
  text-align: left;
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 8px 8px 6px;
  border-bottom: 1px solid var(--line);
}
.round-table td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.round-table tr:last-child td { border-bottom: none; }
.zone-name { font-weight: 700; }
.zone-name small { display: block; color: var(--muted); font-weight: 400; }
.task-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.task-actions button { padding: 7px 10px; font-size: 0.85rem; }

.status-chip {
  display: inline-block;
  border-radius: 999px;
  padding: 4px 11px;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}
.status-chip[data-status="Not started"] { background: #f1f5f9; color: var(--muted); }
.status-chip[data-status="In progress"] { background: var(--info-soft); color: #0369a1; }
.status-chip[data-status="Awaiting verification"] { background: var(--warn-soft); color: var(--warn); }
.status-chip[data-status="Accepted"] { background: var(--ok-soft); color: var(--ok); }
.status-chip[data-status="Partially accepted"] { background: var(--warn-soft); color: var(--warn); }
.status-chip[data-status="Reclean required"] { background: var(--bad-soft); color: var(--bad); }
.status-chip[data-status="Manager review"] { background: #ede9fe; color: #6d28d9; }
.status-chip[data-status="Exception"] { background: var(--warn-soft); color: var(--warn); }
.status-chip[data-status="Optional — not scheduled"] { background: #f8fafc; color: #94a3b8; border: 1px dashed #e2e8f0; }
.status-chip[data-status="Optional — planned"] { background: var(--info-soft); color: #0369a1; }
.status-chip[data-status="Support recorded"] { background: var(--ok-soft); color: var(--ok); }

.flag-chip {
  display: inline-block;
  background: var(--bad-soft);
  color: var(--bad);
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 6px;
  margin: 2px 3px 0 0;
}

/* ---------- Lists (verify / maintenance / exceptions / dashboard) ---------- */
.item-row {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  padding: 12px 4px;
  border-bottom: 1px solid var(--line);
}
.item-row:last-child { border-bottom: none; }
.item-main { flex: 1 1 240px; min-width: 0; }
.item-main strong { display: block; }
.item-main small { color: var(--muted); display: block; margin-top: 2px; }
.empty-note { color: var(--muted); font-size: 0.9rem; padding: 14px 4px; text-align: center; }

/* ---------- Dashboard ---------- */
.filter-row { display: flex; gap: 10px; flex-wrap: wrap; }
.filter-row label { flex: 1 1 140px; margin: 0; font-size: 0.82rem; }
.home-dash { margin-bottom: 14px; }
.home-dash > h2 { margin: 4px 2px 10px; }
.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.tile {
  background: var(--card);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 12px;
}
.tile strong { display: block; font-size: 1.35rem; color: var(--brand-dark); }
.tile.is-bad strong { color: var(--bad); }
.tile.is-warn strong { color: var(--warn); }
.tile span { font-size: 0.78rem; color: var(--muted); }
.mini-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.mini-table th { text-align: left; color: var(--muted); font-size: 0.74rem; text-transform: uppercase; padding: 6px; border-bottom: 1px solid var(--line); }
.mini-table td { padding: 8px 6px; border-bottom: 1px solid var(--line); }
.mini-table tr:last-child td { border-bottom: none; }

/* ---------- Forms ---------- */
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.inline-form input, .inline-form select { flex: 1 1 160px; width: auto; }
.inline-form button { flex: 0 0 auto; }

/* ---------- Dialogs ---------- */
.app-dialog {
  border: none;
  border-radius: 18px;
  box-shadow: 0 10px 40px rgba(15, 55, 45, 0.25);
  padding: 20px;
  width: min(560px, calc(100vw - 28px));
  max-height: calc(100vh - 40px);
}
.app-dialog::backdrop { background: rgba(15, 45, 38, 0.45); }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.close-button {
  background: #f1f5f9;
  border: none;
  border-radius: 8px;
  padding: 6px 10px;
  color: var(--muted);
}
.dialog-note { color: var(--muted); font-size: 0.86rem; margin: 6px 0 10px; }
.dialog-sub { color: var(--muted); margin: 2px 0 12px; font-size: 0.9rem; }
.dialog-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 16px; }
.identity-dialog::backdrop { background: rgba(15, 45, 38, 0.75); }

/* ---------- Task workflow ---------- */
.task-stage { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }
.task-stage:first-of-type { border-top: none; margin-top: 4px; }
.stage-status { font-size: 0.85rem; font-weight: 600; color: var(--brand-dark); min-height: 1.1em; margin: 8px 0 0; }
.stage-status.is-bad { color: var(--bad); }
#qr-reader { margin: 10px 0; border-radius: 12px; overflow: hidden; }
.task-steps { list-style: none; padding: 0; margin: 0; }
.task-steps li { padding: 7px 0; border-bottom: 1px dashed var(--line); }
.task-steps li.is-locked { opacity: 0.35; }
.task-steps label { display: flex; gap: 10px; align-items: flex-start; margin: 0; font-weight: 500; }
.task-steps input[type="checkbox"] { width: 20px; height: 20px; flex: 0 0 auto; margin-top: 1px; }
.photo-label {
  display: inline-block;
  background: var(--brand-soft);
  color: var(--brand-dark);
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
  margin-top: 8px;
}
.photo-label input { display: none; }
#photo-preview { max-width: 100%; border-radius: 10px; margin-top: 8px; }
.verdict-set { border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; margin-top: 10px; }
.verdict-set legend { font-weight: 700; font-size: 0.9rem; padding: 0 6px; }
.verdict-set label { display: flex; gap: 8px; align-items: center; font-weight: 500; margin: 8px 0; }
.verdict-set input { width: auto; }

.verify-photo { max-width: 100%; border-radius: 10px; margin-top: 8px; }
.kv { font-size: 0.9rem; margin: 3px 0; }
.kv b { color: var(--brand-dark); }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  border-radius: 12px;
  padding: 11px 18px;
  font-size: 0.92rem;
  box-shadow: var(--shadow);
  z-index: 60;
  max-width: calc(100vw - 32px);
}

/* ---------- Handover ---------- */
.handover-declaration {
  background: var(--brand-soft);
  border-radius: 12px;
  padding: 14px;
  margin: 10px 0;
  font-size: 0.95rem;
}
.reject-zone-list label { display: flex; gap: 8px; align-items: center; font-weight: 500; margin: 6px 0; }
.reject-zone-list input[type="checkbox"] { width: 18px; height: 18px; }
.handover-resolved { background: var(--brand-soft); border: 1px solid var(--brand); }
.handover-resolved.handover-rejected { background: #fde2e1; border-color: #d98884; }
.handover-detail { margin: 10px 0; }
.handover-detail > summary { cursor: pointer; font-weight: 600; color: var(--brand-dark); padding: 6px 0; }

/* ---------- Access requests & approvals ---------- */
.access-group-title { font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted, #6b7280); margin: 16px 0 8px; }
.access-req { border: 1px solid var(--line, #e3e6e4); border-radius: 12px; padding: 12px 14px; margin: 8px 0; background: var(--card); }
.access-req-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.access-req-head strong { font-size: 0.98rem; word-break: break-all; }
.access-req-note { display: block; color: var(--muted, #6b7280); margin: 6px 0 10px; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 0.75rem; font-weight: 600; background: #eef1f0; color: #3b423f; }
.pill.is-good { background: var(--brand-soft); color: var(--brand-dark); }
.pill.is-warn { background: var(--warn-soft); color: var(--warn); }
.pill.is-bad { background: #fde2e1; color: #8a1c17; }
.access-decide { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 4px 0 8px; }
.access-decide select { padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line, #cfd4d1); min-width: 150px; }
.access-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.warn-text { color: #8a1c17; }
.access-settled { font-weight: 600; margin: 4px 0 8px; padding: 8px 12px; border-radius: 8px; background: var(--brand-soft); color: var(--brand-dark); }
.access-settled.is-suspended { background: var(--warn-soft); color: var(--warn); }
.access-settled.is-declined { background: #fde2e1; color: #8a1c17; }
.access-change { margin: 4px 0 8px; }
.access-change > summary { cursor: pointer; font-weight: 600; color: var(--brand-dark); padding: 4px 0; font-size: 0.9rem; }

/* ---------- Mobile ---------- */
@media (max-width: 840px) {
  body.auth-signed-in .app-shell { display: block; }
  .sidebar {
    position: fixed;
    inset: 0 84px 0 0;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    max-width: 300px;
  }
  .sidebar.is-open { transform: translateX(0); }
  .menu-button { display: block; }
  .main { padding: 12px 12px 90px; }
  .round-table thead { display: none; }
  .round-table tr { display: block; border-bottom: 1px solid var(--line); padding: 8px 0; }
  .round-table td { display: block; border: none; padding: 3px 4px; }
  .task-actions { justify-content: flex-start; }
  .shift-progress { align-items: flex-start; }
}

@media print {
  .sidebar, .topbar, .big-actions, .dialog-actions, .toast { display: none !important; }
}

/* ========================================================================
   Rolling messages & acknowledgements — v30
   ======================================================================== */
.ticker {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: var(--brand-soft);
  border-radius: 12px;
  margin-bottom: 12px;
  white-space: normal;
  overflow: visible;
}
.ticker.priority-important { background: #fff7ed; border-color: #fed7aa; }
.ticker.priority-urgent { background: var(--warn-soft); border-color: #f59e0b; }
.ticker.priority-critical { background: var(--bad-soft); border-color: #fca5a5; }
.ticker-icon { font-size: 1.25rem; }
.ticker-copy {
  border: 0;
  background: transparent;
  text-align: left;
  color: var(--text);
  min-width: 0;
  padding: 0;
  cursor: pointer;
}
.ticker-copy strong,
.ticker-copy span { display: block; }
.ticker-copy strong { color: var(--brand-dark); font-size: 0.95rem; }
.ticker-copy span { color: var(--muted); font-size: 0.82rem; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ticker-nav,
.ticker-control {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 9px;
  min-height: 36px;
  padding: 6px 10px;
  color: var(--brand-dark);
  font-weight: 700;
}
.ticker-nav { font-size: 1.25rem; min-width: 38px; }
.ticker-count { color: var(--muted); font-size: 0.78rem; white-space: nowrap; }

.message-attention-card { border: 1.5px solid #f59e0b; }
.message-attention-row {
  width: 100%;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 10px;
  padding: 11px 12px;
  margin-bottom: 8px;
  text-align: left;
}
.message-attention-row span:nth-child(2) { min-width: 0; }
.message-attention-row strong,
.message-attention-row small { display: block; }
.message-attention-row small { margin-top: 3px; color: var(--muted); }
.message-attention-row.priority-critical { border-left: 5px solid var(--bad); }
.message-attention-row.priority-urgent { border-left: 5px solid var(--warn); }
.message-attention-row.priority-important { border-left: 5px solid #ea580c; }
.message-attention-row.priority-information { border-left: 5px solid var(--brand); }

.message-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.message-card {
  border: 1px solid var(--line);
  border-left: 5px solid var(--brand);
  border-radius: 12px;
  padding: 14px;
  background: var(--card);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.message-card.priority-important { border-left-color: #ea580c; }
.message-card.priority-urgent { border-left-color: var(--warn); }
.message-card.priority-critical { border-left-color: var(--bad); }
.message-card.is-history { opacity: 0.78; }
.message-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.message-card-head h3 { margin: 4px 0 0; font-size: 1.05rem; }
.message-priority { font-size: 0.76rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); }
.message-meta { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 0.78rem; color: var(--muted); }
.message-status { font-size: 0.84rem; font-weight: 700; color: var(--ok); }
.message-status.is-outstanding { color: var(--warn); }
.message-report-group { border: 1px solid var(--line); border-radius: 10px; margin: 10px 0; overflow: hidden; }
.message-report-group summary { padding: 12px; cursor: pointer; background: #f8fafc; }
.message-report-group .table-scroll { padding: 0 10px 10px; }
.message-management-summary { padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #f8fafc; }

.message-form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.message-form-grid select[multiple] { min-height: 120px; }
.checkbox-line { display: flex; align-items: flex-start; gap: 8px; }
.checkbox-line input { width: auto; margin-top: 3px; }
.split-actions { align-items: center; }
.action-spacer { flex: 1; }
.message-view-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.message-view-head h2 { margin: 0; }
.icon-button { border: 0; background: transparent; font-size: 1.6rem; line-height: 1; color: var(--muted); }
.message-view-meta { color: var(--muted); line-height: 1.5; }
.message-view-body { white-space: pre-wrap; line-height: 1.65; background: #f8fafc; border: 1px solid var(--line); border-radius: 10px; padding: 14px; }
.message-view-history { margin-top: 12px; padding: 10px 12px; border-radius: 9px; background: var(--brand-soft); }
.message-view-history:empty { display: none; }
.message-response-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }

@media (max-width: 760px) {
  .ticker { grid-template-columns: auto minmax(0, 1fr) auto; }
  .ticker-icon { display: none; }
  .ticker-count { grid-column: 2; }
  .ticker-control { grid-column: 2; justify-self: start; }
  .ticker-nav:last-child { grid-column: 3; grid-row: 1; }
  .ticker-copy span { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .message-grid { grid-template-columns: 1fr; }
  .message-form-grid { grid-template-columns: 1fr; }
  .message-response-actions > * { width: 100%; }
}

/* v30 dialog, table and destructive-action safeguards */
.app-dialog.wide-dialog {
  width: min(780px, calc(100vw - 28px));
  max-height: min(90dvh, 900px);
  overflow-y: auto;
  overflow-x: hidden;
}
.danger-button {
  border: 1px solid #b91c1c;
  background: #fff1f2;
  color: #991b1b;
  border-radius: 9px;
  min-height: 40px;
  padding: 8px 13px;
  font-weight: 800;
}
.danger-button:hover, .danger-button:focus-visible { background: #ffe4e6; }
.table-scroll { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
@media (max-width: 760px) {
  .app-dialog.wide-dialog { width: calc(100vw - 16px); max-height: calc(100dvh - 16px); }
  .message-form-grid select[multiple] { min-height: 150px; }
}

.message-report-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 12px 0;
}

/* ---------- Temporary photo requirement (manager control) ---------- */
.photo-rule-box {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  margin: 12px 0;
  background: var(--paper);
}
.photo-rule-box > legend { font-weight: 700; font-size: 0.9rem; color: var(--brand-dark); padding: 0 6px; }
.photo-rule-box .inline-check { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.photo-rule-box .inline-check input { width: 18px; height: 18px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 560px) { .two-col { grid-template-columns: 1fr; } }

/* ---------- Handover: property condition evidence ---------- */
.hphoto-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.hphoto { margin: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--card); }
.hphoto img { width: 100%; height: 130px; object-fit: cover; display: block; background: var(--paper); }
.hphoto figcaption { padding: 8px 10px; font-size: 0.85rem; display: flex; flex-direction: column; gap: 2px; }
.hphoto figcaption small { color: var(--muted); font-size: 0.75rem; }
#hphoto-preview { width: 100%; max-height: 240px; object-fit: contain; border-radius: 10px; margin-top: 8px; background: var(--paper); }

/* ---------- Handover evidence summary (verification at a glance) ---------- */
.ev-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin: 10px 0 12px; }
.ev-cell { background: var(--paper); border-radius: 12px; padding: 10px 12px; text-align: center; }
.ev-val { display: block; font-size: 1.25rem; font-weight: 800; color: var(--ink); }
.ev-val.is-good { color: var(--ok); }
.ev-val.is-warn { color: var(--warn); }
.ev-lab { display: block; font-size: 0.75rem; color: var(--muted); margin-top: 2px; }
