/* ==========================================================================
   JTA Weekly Audit Hub — design system. JTA Residential Care green branding,
   large tap targets (waking-night staff, often on a phone), no emoji.
   ========================================================================== */

:root {
  --brand:        #15803d;
  --brand-dark:   #14532d;
  --brand-darker: #0f3d21;
  --brand-light:  #e9f7ee;
  --brand-tint:   #f3faf5;

  --ink:      #10181f;
  --ink-soft: #334155;
  --muted:    #64748b;
  --border:   #e2e8f0;
  --border-strong: #cbd5e1;
  --bg:       #f5f8f6;
  --card:     #ffffff;

  --green:     #15803d;
  --green-bg:  #f0fdf4;
  --amber:     #b45309;
  --amber-bg:  #fffbeb;
  --red:       #b91c1c;
  --red-bg:    #fef2f2;
  --info:      #1d4ed8;
  --info-bg:   #eff6ff;
  --neutral-bg:#f1f5f9;

  --radius:    12px;
  --radius-sm: 8px;
  --shadow:    0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .05);
  --shadow-lg: 0 4px 16px rgba(15, 23, 42, .12);

  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink); }
body { min-height: 100vh; -webkit-font-smoothing: antialiased; }
button { font-family: inherit; }
[hidden] { display: none !important; }

#app { max-width: 720px; margin: 0 auto; padding: 16px 16px 48px; }
#app.wide { max-width: 1100px; }
#app.landing { max-width: none; padding: 0; }

/* ===================================================================
   Animated landing / pre-auth journey (brief addendum, 2026-09-11).
   One continuous branded shell — home select -> name -> identity confirm
   -> week select -> existing/new audit — rather than a chain of plain
   pages. Premium-but-calm: slow background motion, no bouncing/spinning.
   =================================================================== */
.landing-shell {
  position: relative; min-height: calc(100vh - 34px); overflow: hidden;
  background: linear-gradient(135deg, var(--brand-tint) 0%, #eef7f1 45%, var(--brand-light) 100%);
  background-size: 200% 200%;
  display: flex; flex-direction: column;
}
@media (prefers-reduced-motion: no-preference) {
  .landing-shell { animation: landing-gradient 18s ease-in-out infinite; }
}
@keyframes landing-gradient {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* Faint drifting line-shapes — quality/homes/accountability motifs at
   5-10% opacity, purely decorative, never competing with content. */
.landing-shapes { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.landing-shapes svg { position: absolute; stroke: var(--brand-dark); fill: none; stroke-width: 1.4; opacity: .07; }
.landing-shapes svg.s1 { top: 8%; left: 6%; width: 90px; }
.landing-shapes svg.s2 { top: 65%; left: 12%; width: 70px; }
.landing-shapes svg.s3 { top: 20%; right: 8%; width: 100px; }
.landing-shapes svg.s4 { top: 72%; right: 14%; width: 60px; }
.landing-shapes svg.s5 { top: 42%; left: 48%; width: 50px; }
@media (prefers-reduced-motion: no-preference) {
  .landing-shapes svg.s1 { animation: drift-a 22s ease-in-out infinite; }
  .landing-shapes svg.s2 { animation: drift-b 26s ease-in-out infinite; }
  .landing-shapes svg.s3 { animation: drift-a 30s ease-in-out infinite reverse; }
  .landing-shapes svg.s4 { animation: drift-b 20s ease-in-out infinite reverse; }
  .landing-shapes svg.s5 { animation: drift-a 34s ease-in-out infinite; }
}
@keyframes drift-a { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(18px, -14px); } }
@keyframes drift-b { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(-16px, 12px); } }

.landing-header {
  position: relative; z-index: 2; display: flex; align-items: flex-start; justify-content: space-between;
  padding: 20px 28px; flex-wrap: wrap; gap: 10px;
}
.landing-header .brand-block { display: flex; align-items: center; gap: 12px; }
.landing-header .brand-block img { height: 36px; display: block; }
.landing-header .brand-text .name { font-weight: 800; color: var(--brand-darker); font-size: 15px; line-height: 1.2; }
.landing-header .brand-text .ethos { font-size: 11.5px; color: var(--muted); }
.landing-header .header-right { text-align: right; font-size: 13px; color: var(--ink-soft); }
.landing-header .live-clock { font-weight: 700; color: var(--brand-darker); }
.landing-header .header-links { margin-top: 4px; }
.landing-header .header-links a, .landing-header .header-links button {
  font-size: 12.5px; color: var(--brand-dark); text-decoration: none; margin-left: 12px;
  background: none; border: none; cursor: pointer; font-weight: 600; padding: 0;
}
.landing-header .header-links a:hover, .landing-header .header-links button:hover { text-decoration: underline; }

.landing-main {
  position: relative; z-index: 1; flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 20px 20px 40px; gap: 6px;
}
.hero-eyebrow {
  font-size: 12.5px; font-weight: 800; letter-spacing: .14em; color: var(--brand);
  text-transform: uppercase;
}
.hero-title {
  font-size: clamp(28px, 4.4vw, 44px); font-weight: 800; color: var(--brand-darker); margin: 6px 0 10px; letter-spacing: -.01em;
}
.hero-desc { max-width: 560px; color: var(--ink-soft); font-size: 15.5px; line-height: 1.55; margin-bottom: 22px; }
.hero-cta { margin-bottom: 30px; }
.hero-cta .btn { padding: 16px 32px; font-size: 16px; box-shadow: var(--shadow-lg); }

/* Two-column landing hero (Sam's own mockup, reused here for the
   anonymous pre-login page minus anything needing a signed-in session). */
.landing-hero-split {
  display: grid; grid-template-columns: 1.15fr 1fr; gap: 32px; align-items: center;
  width: 100%; max-width: 960px; text-align: left; margin: 0 auto 26px;
}
@media (max-width: 760px) { .landing-hero-split { grid-template-columns: 1fr; text-align: center; } }
.landing-hero-split .hero-desc { margin: 0 0 18px; }
.hero-sub { font-size: 17px; font-weight: 700; color: var(--brand-dark); margin: 0 0 8px; }
.hero-cta-row { display: flex; gap: 12px; flex-wrap: wrap; }
@media (max-width: 760px) { .hero-cta-row { justify-content: center; } }
.btn.outline { background: #fff; border: 2px solid var(--brand); color: var(--brand-dark); }
.btn.outline:hover { background: var(--brand-tint); }
.lhs-panel {
  position: relative; overflow: hidden; border-radius: 18px; padding: 24px 20px; min-height: 180px;
  display: flex; align-items: flex-end; background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 65%, var(--brand-darker) 100%);
}
.lhs-panel::before {
  content: ""; position: absolute; inset: 0; opacity: .18;
  background: radial-gradient(circle at 28% 22%, #fff 0%, transparent 45%), radial-gradient(circle at 82% 78%, #fff 0%, transparent 42%);
}
.lhs-quote { position: relative; background: rgba(255,255,255,.95); border-radius: 12px; padding: 12px 16px; font-weight: 700; color: var(--brand-darker); font-size: 14px; box-shadow: var(--shadow); }
.landing-hero-pills { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
@media (max-width: 760px) { .landing-hero-pills { justify-content: center; } }
.landing-ethos-wrap { max-width: 960px; width: 100%; margin: 0 auto; }

.landing-footer { position: relative; z-index: 1; text-align: center; padding: 0 20px 28px; }
.landing-footer .ethos-line { font-style: italic; color: var(--brand-dark); font-size: 14px; margin-bottom: 4px; }
.landing-footer .system-line { font-size: 11.5px; color: var(--muted); }

/* Fade-and-rise entrance — staggered, ~1-1.3s total, instant under
   reduced-motion. */
.rise-in { opacity: 0; }
@media (prefers-reduced-motion: no-preference) {
  .rise-in { animation: rise-in .5s ease-out forwards; }
  .rise-in.d1 { animation-delay: .05s; } .rise-in.d2 { animation-delay: .2s; }
  .rise-in.d3 { animation-delay: .38s; } .rise-in.d4 { animation-delay: .56s; }
  .rise-in.d5 { animation-delay: .74s; }
}
@media (prefers-reduced-motion: reduce) { .rise-in { opacity: 1; } }
@keyframes rise-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }

/* Home cards — large, fully clickable, gentle lift + brighten on hover. */
.home-card-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 18px; max-width: 620px; width: 100%;
}
@media (max-width: 620px) { .home-card-grid { grid-template-columns: 1fr; } }
.home-card {
  background: rgba(255,255,255,.72); backdrop-filter: blur(6px); border: 2px solid var(--border);
  border-radius: var(--radius); padding: 22px 20px; text-align: left; cursor: pointer;
  display: flex; flex-direction: column; gap: 10px; transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.home-card:hover, .home-card:focus-visible {
  transform: translateY(-4px); border-color: var(--brand); box-shadow: var(--shadow-lg);
}
.home-card .hc-icon {
  width: 44px; height: 44px; border-radius: 10px; background: var(--brand-light); color: var(--brand-dark);
  display: flex; align-items: center; justify-content: center;
}
.home-card .hc-name { font-size: 18px; font-weight: 800; color: var(--brand-darker); }
.home-card .hc-sub { font-size: 13px; color: var(--muted); }
.hc-arrow {
  display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--brand); font-size: 13.5px;
  transition: gap .16s ease; margin-top: 8px;
}
.home-card:hover .hc-arrow, .mgmt-house-card.clickable:hover .hc-arrow { gap: 10px; }

/* Wide home-select grid using the Management Dashboard's own house-card
   look (photo-band + body) — no new classes duplicated, same visual
   language, just reused on the anonymous landing page. */
.home-card-grid-wide { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; max-width: 720px; width: 100%; margin: 0 auto 24px; }
@media (max-width: 620px) { .home-card-grid-wide { grid-template-columns: 1fr; } }
.mgmt-house-card.clickable {
  cursor: pointer; text-align: left; width: 100%; padding: 0; font-size: inherit;
  transition: box-shadow .16s ease, border-color .16s ease, transform .16s ease;
}
.mgmt-house-card.clickable:hover, .mgmt-house-card.clickable:focus-visible {
  border-color: var(--brand); box-shadow: var(--shadow-lg); transform: translateY(-2px);
}

/* Centred glass panel used by every step after the landing hero (name
   picker, identity confirm, week select). */
.identity-shell {
  position: relative; z-index: 1; flex: 1; display: flex; align-items: center; justify-content: center; padding: 20px;
  min-height: 0; overflow-y: auto;
}
.identity-panel {
  background: rgba(255,255,255,.85); backdrop-filter: blur(8px); border: 1px solid rgba(255,255,255,.6);
  border-radius: 18px; box-shadow: var(--shadow-lg); padding: 28px 26px; width: 100%; max-width: 460px;
  max-height: calc(100vh - 140px); overflow-y: auto;
}
.identity-panel.wide { max-width: 620px; }
.identity-panel h2 { margin: 0 0 4px; font-size: 20px; color: var(--brand-darker); }
.identity-search {
  display: flex; align-items: center; gap: 8px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 10px 12px; background: #fff; margin-bottom: 12px; color: var(--muted);
}
.identity-search input { border: none; outline: none; flex: 1; font-size: 15px; padding: 0; }
.avatar-initials {
  width: 40px; height: 40px; border-radius: 50%; background: var(--brand); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px; flex-shrink: 0;
}
.avatar-initials.lg { width: 64px; height: 64px; font-size: 20px; margin: 0 auto 12px; }
.picker-item { align-items: center; }
.picker-item .pi-left { display: flex; align-items: center; gap: 12px; }

/* Live clock updates in place — no layout shift. */
.live-clock { font-variant-numeric: tabular-nums; }


/* ---------------------------------------------------------------- topbar */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 0; margin-bottom: 12px; border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--brand-dark); }
.brand .mark {
  width: 34px; height: 34px; border-radius: 9px; background: var(--brand);
  color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 15px;
}
.topbar-meta { text-align: right; font-size: 13px; color: var(--muted); }
.topbar-meta button { margin-left: 10px; }

.week-bar {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  background: var(--brand-tint); border: 1px solid var(--brand-light);
  color: var(--brand-darker); font-weight: 700; font-size: 12px; letter-spacing: .02em;
  padding: 8px 12px; border-radius: 8px; margin: -4px 0 14px;
}
.week-bar .sep { color: var(--brand); opacity: .5; font-weight: 400; }
.week-bar .btn.xs { margin-left: auto; padding: 3px 9px; font-size: 11px; }
.btn.xs { padding: 3px 9px; font-size: 11px; }

.ethos-strip {
  background: var(--brand-dark); color: #fff; text-align: center;
  font-size: 12.5px; letter-spacing: .02em; padding: 7px 10px;
}

/* ---------------------------------------------------------------- layout */
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px; margin-bottom: 14px;
}
.card h2 { margin: 0 0 4px; font-size: 18px; }
.card h3 { margin: 0 0 8px; font-size: 15px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 560px) { .grid-2 { grid-template-columns: 1fr; } }
hr.sep { border: none; border-top: 1px solid var(--border); margin: 14px 0; }

/* --------------------------------------------------------------- buttons */
.btn {
  appearance: none; border: 1px solid var(--border-strong); background: #fff; color: var(--ink);
  border-radius: var(--radius-sm); padding: 12px 16px; font-size: 15px; font-weight: 600;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: background .12s, border-color .12s, transform .05s;
}
.btn:hover { background: var(--neutral-bg); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.danger:hover { background: #991b1b; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--brand-dark); }
.btn.block { width: 100%; }
.btn.lg { padding: 16px 18px; font-size: 16px; border-radius: var(--radius); }
.btn-list { display: flex; flex-direction: column; gap: 10px; }

/* ----------------------------------------------------------------- forms */
label { font-size: 13.5px; font-weight: 600; color: var(--ink-soft); display: block; margin-bottom: 4px; }
input[type=text], input[type=password], input[type=date], input[type=datetime-local], textarea, select {
  width: 100%; padding: 11px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  font-size: 15px; font-family: inherit; background: #fff; color: var(--ink);
}
textarea { min-height: 72px; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
.field { margin-bottom: 12px; }
.help { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.error-text { color: var(--red); font-size: 13.5px; margin-top: 6px; }

/* ---------------------------------------------------------------- badges */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px;
  font-size: 12.5px; font-weight: 700; letter-spacing: .01em; text-transform: uppercase;
}
.badge.green { background: var(--green-bg); color: var(--green); }
.badge.amber { background: var(--amber-bg); color: var(--amber); }
.badge.red { background: var(--red-bg); color: var(--red); }
.badge.info { background: var(--info-bg); color: var(--info); }
.badge.neutral { background: var(--neutral-bg); color: var(--ink-soft); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot.green { background: var(--green); } .dot.amber { background: var(--amber); } .dot.red { background: var(--red); }

/* --------------------------------------------------------------- picker */
.picker-list { display: flex; flex-direction: column; gap: 8px; }
.picker-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: #fff; cursor: pointer; text-align: left; width: 100%; font-size: 15.5px;
}
.picker-item:hover { border-color: var(--brand); background: var(--brand-tint); }
.picker-item .name { font-weight: 700; }
.picker-item .role { font-size: 12.5px; color: var(--muted); }
.picker-item .chev { color: var(--muted); }

/* --------------------------------------------------- week calendar picker */
.calendar-week-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 13px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: #fff; cursor: pointer; text-align: left; width: 100%; font-size: 14.5px;
}
.calendar-week-row:disabled, .calendar-week-row.disabled { cursor: not-allowed; opacity: .55; }
.calendar-week-row:not(:disabled):hover { border-color: var(--brand); background: var(--brand-tint); }
.calendar-week-row.selected { border-color: var(--brand); background: var(--brand-tint); box-shadow: 0 0 0 2px var(--brand-light); }
.calendar-week-row .cw-dates { font-weight: 700; }
.calendar-week-row .cw-sub { font-size: 12px; color: var(--muted); font-weight: 400; }

/* --------------------------------------------------- full calendar view */
.cal-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 4px 0 10px; }
.cal-nav-jump { display: flex; gap: 6px; }
.cal-nav-jump select {
  padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; background: #fff;
  font-size: 13px; color: var(--ink-soft);
}
.cal-dow-row, .cal-week-row { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-dow-row { font-size: 11.5px; font-weight: 700; color: var(--muted); text-align: center; margin-bottom: 4px; text-transform: uppercase; letter-spacing: .04em; }
.cal-dow-row span { padding: 2px 0; }
.cal-grid { display: flex; flex-direction: column; gap: 4px; }
.cal-day-cell {
  position: relative; aspect-ratio: 1 / 1; min-height: 40px; display: flex; align-items: center; justify-content: center;
  border-radius: 8px; font-size: 13px; border: none; background: transparent; color: var(--ink-soft);
}
.cal-day-cell.other-day { color: var(--muted); }
.cal-day-cell.dim { opacity: .4; }
.cal-day-cell.cal-monday { cursor: pointer; font-weight: 700; border: 1px solid var(--border); background: #fff; }
.cal-day-cell.cal-monday:disabled, .cal-day-cell.cal-monday.disabled { cursor: not-allowed; opacity: .45; }
.cal-day-cell.cal-monday:not(:disabled):hover { box-shadow: 0 0 0 2px var(--brand-light); }
.cal-day-cell.cal-monday.green { background: var(--green-bg); border-color: var(--green); color: var(--green); }
.cal-day-cell.cal-monday.amber { background: var(--amber-bg); border-color: var(--amber); color: var(--amber); }
.cal-day-cell.cal-monday.red { background: var(--red-bg); border-color: var(--red); color: var(--red); }
.cal-day-cell.cal-monday.info { background: var(--info-bg); border-color: var(--info); color: var(--info); }
.cal-day-cell.cal-monday.neutral { background: var(--neutral-bg); border-color: var(--border-strong); color: var(--ink-soft); }
.cal-day-dot { position: absolute; bottom: 4px; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
@media (max-width: 520px) {
  .cal-day-cell { min-height: 32px; font-size: 11.5px; }
  .cal-day-dot { display: none; }
}

/* ------------------------------------------------------------------ pin */
.pin-dots { display: flex; justify-content: center; gap: 14px; margin: 18px 0; }
.pin-dot { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--border-strong); }
.pin-dot.filled { background: var(--brand); border-color: var(--brand); }
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 280px; margin: 0 auto; }
.pin-pad button {
  padding: 18px 0; font-size: 20px; font-weight: 700; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: #fff; cursor: pointer;
}
.pin-pad button:active { background: var(--brand-tint); }
.pin-pad button.wide { grid-column: span 1; }

/* --------------------------------------------------------------- status */
.status-card { text-align: left; }
.progress-bar { height: 10px; border-radius: 999px; background: var(--neutral-bg); overflow: hidden; margin: 10px 0; }
.progress-bar > div { height: 100%; background: var(--brand); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 14px; margin-top: 10px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; }

/* ------------------------------------------------------------------ item */
.item-card { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; margin-bottom: 10px; background: #fff; }
.item-card.answered.green { border-left: 4px solid var(--green); background: linear-gradient(90deg, var(--green-bg) 0%, #fff 60px); }
.item-card.answered.amber { border-left: 4px solid var(--amber); background: linear-gradient(90deg, var(--amber-bg) 0%, #fff 60px); }
.item-card.answered.red { border-left: 4px solid var(--red); background: linear-gradient(90deg, var(--red-bg) 0%, #fff 60px); }
.item-card.answered.na { border-left: 4px solid var(--border-strong); background: linear-gradient(90deg, var(--neutral-bg) 0%, #fff 60px); }
.item-card.unanswered { border-left: 4px solid var(--border-strong); }
.item-label { font-weight: 600; margin-bottom: 8px; }
.seg { display: flex; gap: 8px; }
.seg button {
  flex: 1; padding: 10px 0; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: #fff; font-weight: 700; cursor: pointer; font-size: 14px;
}
.seg button.active.yes { background: var(--green-bg); border-color: var(--green); color: var(--green); }
.seg button.active.partial { background: var(--amber-bg); border-color: var(--amber); color: var(--amber); }
.seg button.active.no { background: var(--red-bg); border-color: var(--red); color: var(--red); }
.seg button.active.na { background: var(--neutral-bg); border-color: var(--border-strong); color: var(--ink-soft); }

/* ===================================================================
   Sidebar-nav audit workspace (brief addendum, 2026-09-11) — one section
   at a time instead of one long scroll, matching Sam's mockup layout.
   =================================================================== */
#app.workspace-app { max-width: none; padding: 0 0 32px; }
.workspace { display: grid; grid-template-columns: 260px 1fr; gap: 0; align-items: start; max-width: 1200px; margin: 0 auto; }
@media (max-width: 860px) { .workspace { grid-template-columns: 1fr; } }

.workspace-sidebar {
  position: sticky; top: 0; align-self: start; padding: 16px 14px; border-right: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 4px; max-height: 100vh; overflow-y: auto;
}
@media (max-width: 860px) {
  .workspace-sidebar { position: static; max-height: none; border-right: none; border-bottom: 1px solid var(--border); flex-direction: row; overflow-x: auto; padding: 10px; }
}
.section-nav-item {
  display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: var(--radius-sm);
  border: 1px solid transparent; background: transparent; cursor: pointer; text-align: left; width: 100%; font-size: 14px;
}
@media (max-width: 860px) { .section-nav-item { width: auto; white-space: nowrap; } }
.section-nav-item:hover { background: var(--neutral-bg); }
.section-nav-item.active { background: var(--brand-tint); border-color: var(--brand-light); font-weight: 700; }
.section-nav-item .sn-num {
  width: 24px; height: 24px; border-radius: 50%; background: var(--neutral-bg); color: var(--ink-soft);
  display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex-shrink: 0;
}
.section-nav-item.complete .sn-num { background: var(--green); color: #fff; }
.section-nav-item.has-red .sn-num { background: var(--red); color: #fff; }
.section-nav-item.has-amber .sn-num { background: var(--amber); color: #fff; }
.section-nav-item.active .sn-num { background: var(--brand); color: #fff; }
.section-nav-item .sn-title { flex: 1; }
.section-nav-item .sn-count { font-size: 11.5px; color: var(--muted); }
.sidebar-footer { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 6px; }
@media (max-width: 860px) { .sidebar-footer { display: none; } }

.workspace-main { padding: 16px 20px 0; min-width: 0; }
.progress-ring-wrap { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.progress-ring-wrap .pr-label { font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.current-section-card { display: flex; align-items: center; gap: 16px; }
.current-section-card .cs-icon {
  width: 46px; height: 46px; border-radius: 10px; background: var(--brand-light); color: var(--brand-dark);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}

/* Strong, always-labelled RAG panel (brief §2/§3) — colour is never the only
   signal, the word GREEN/AMBER/RED/NOT APPLICABLE is always shown too. */
.rag-panel {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: var(--radius-sm);
  font-weight: 800; font-size: 14px; letter-spacing: .02em; margin: 10px 0; border: 2px solid transparent;
}
.rag-panel.green { background: var(--green-bg); color: var(--green); border-color: var(--green); }
.rag-panel.amber { background: var(--amber-bg); color: var(--amber); border-color: var(--amber); }
.rag-panel.red { background: var(--red-bg); color: var(--red); border-color: var(--red); animation: rag-flash .5s ease-out; }
.rag-panel.grey { background: var(--neutral-bg); color: var(--ink-soft); border-color: var(--border-strong); }
.rag-panel .rag-icon { font-size: 18px; line-height: 1; }
@keyframes rag-flash { 0% { box-shadow: 0 0 0 4px var(--red-bg); } 100% { box-shadow: 0 0 0 0 transparent; } }
.item-card.item-highlight { animation: item-flash 2.2s ease-out; }
@keyframes item-flash {
  0% { box-shadow: 0 0 0 3px var(--brand-light); }
  70% { box-shadow: 0 0 0 3px var(--brand-light); }
  100% { box-shadow: 0 0 0 0 transparent; }
}
.item-meta { font-size: 12px; color: var(--muted); margin-top: 8px; }
.item-extra { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border); }

/* --------------------------------------------------------------- section */
.section-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 4px; cursor: pointer; user-select: none;
}
.section-head h3 { margin: 0; }
.section-count { font-size: 13px; color: var(--muted); }

/* ---------------------------------------------------------------- modal */
.overlay {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .45); display: flex;
  align-items: flex-end; justify-content: center; z-index: 50; padding: 0;
}
@media (min-width: 640px) { .overlay { align-items: center; padding: 20px; } }
.modal {
  background: #fff; border-radius: 16px 16px 0 0; width: 100%; max-width: 520px;
  max-height: 92vh; overflow-y: auto; padding: 20px; box-shadow: var(--shadow-lg);
}
@media (min-width: 640px) { .modal { border-radius: 16px; } }
.modal h2 { margin-top: 0; }
.modal-close { position: sticky; top: 0; float: right; }

/* ------------------------------------------------------------- timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
  position: relative; padding: 0 0 16px 22px; border-left: 2px solid var(--border);
  margin-left: 6px; font-size: 14px;
}
.timeline li:last-child { border-color: transparent; padding-bottom: 0; }
.timeline li::before {
  content: ""; position: absolute; left: -6px; top: 2px; width: 10px; height: 10px;
  border-radius: 50%; background: var(--brand); border: 2px solid #fff;
}
.timeline .t-when { color: var(--muted); font-size: 12.5px; }

/* --------------------------------------------------------------- alerts */
.callout { border-radius: var(--radius-sm); padding: 14px 16px; font-size: 14px; margin-bottom: 12px; }
.callout.warn { background: var(--amber-bg); color: #7c4a03; border: 1px solid #fcd9a6; }
.callout.danger { background: var(--red-bg); color: #7f1d1d; border: 1px solid #f3b4b4; }
.callout.info { background: var(--info-bg); color: #1e3a8a; border: 1px solid #bfdbfe; }
.callout.ok { background: var(--green-bg); color: #14532d; border: 1px solid #bbf7d0; }
.callout strong { display: block; margin-bottom: 4px; }

/* --------------------------------------------------------------- toast */
#toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px;
  font-size: 13.5px; box-shadow: var(--shadow-lg); z-index: 100; opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }
#toast.error { background: var(--red); }

/* ------------------------------------------------------- section progress */
.section-progress-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.section-progress-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: #fff; cursor: pointer; width: 100%; text-align: left;
}
.section-progress-row:hover { border-color: var(--brand); }
.section-progress-row .name { flex: 1; font-weight: 600; font-size: 13.5px; }
.section-progress-row .pct { font-size: 12.5px; color: var(--muted); min-width: 70px; text-align: right; }
.section-progress-row .mini-bar { flex-basis: 90px; height: 6px; border-radius: 999px; background: var(--neutral-bg); overflow: hidden; }
.section-progress-row .mini-bar > div { height: 100%; background: var(--brand); }
.section-progress-row.complete .mini-bar > div { background: var(--green); }

/* ===================================================================
   Management Mode shell (brief addendum, 2026-09-11) — genuinely separate
   from Staff Audit Mode: All-Homes default, permanent sidebar, home filter
   instead of "Switch Person" as the primary control.
   =================================================================== */
#app.mgmt-app { max-width: none; padding: 0; }
.mgmt-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px; border-bottom: 1px solid var(--border); background: #fff;
}
.mgmt-topbar-right { display: flex; align-items: center; gap: 14px; font-size: 13px; color: var(--ink-soft); }
.mgmt-greeting { font-weight: 700; color: var(--brand-darker); }
.mgmt-shell { display: grid; grid-template-columns: 240px 1fr; max-width: 1300px; margin: 0 auto; align-items: start; }
@media (max-width: 820px) { .mgmt-shell { grid-template-columns: 1fr; } }
.mgmt-sidebar {
  position: sticky; top: 0; padding: 18px 12px; border-right: 1px solid var(--border);
  display: flex; flex-direction: column; max-height: 100vh; overflow-y: auto;
}
@media (max-width: 820px) { .mgmt-sidebar { position: static; max-height: none; border-right: none; border-bottom: 1px solid var(--border); } }
.mgmt-sidebar .section-nav-item .sn-num { background: var(--neutral-bg); color: var(--ink-soft); }
.mgmt-sidebar .section-nav-item.active .sn-num { background: var(--brand); color: #fff; }
.mgmt-main { padding: 20px 24px 40px; min-width: 0; }

/* ------------------------------------------------- mgmt top horizontal nav */
.mgmt-topbar { flex-wrap: wrap; row-gap: 10px; }
.mgmt-topbar-right { flex-wrap: wrap; row-gap: 8px; }
@media (max-width: 700px) {
  #app.mgmt-app, .mgmt-shell, .mgmt-topbar, .mgmt-main { max-width: 100vw; overflow-x: hidden; }
  .mgmt-date { display: none; }
  .mgmt-stats-grid { grid-template-columns: 1fr 1fr; }
}
.mgmt-hnav { display: flex; gap: 4px; flex-wrap: wrap; }
.mgmt-hnav button {
  display: flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 999px;
  border: none; background: transparent; color: var(--ink-soft); font-weight: 600; font-size: 14px; cursor: pointer;
}
.mgmt-hnav button:hover { background: var(--neutral-bg); }
.mgmt-hnav button.active { background: var(--brand-light); color: var(--brand-darker); }
.mgmt-bell {
  position: relative; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--border);
  background: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--ink-soft);
}
.mgmt-bell .dot { position: absolute; top: 5px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--red); }
.mgmt-bell-badge {
  position: absolute; top: -4px; right: -4px; min-width: 17px; height: 17px; padding: 0 3px; border-radius: 999px;
  background: var(--red); color: #fff; font-size: 10px; font-weight: 800; line-height: 17px; text-align: center;
}
.mgmt-profile { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.mgmt-profile .avatar-initials { width: 34px; height: 34px; font-size: 12px; }
.mgmt-profile .mp-name { font-weight: 700; color: var(--ink); font-size: 13.5px; line-height: 1.1; }
.mgmt-profile .mp-role { font-size: 11.5px; color: var(--muted); }
.mgmt-date { text-align: right; font-size: 12.5px; color: var(--muted); }
.mgmt-date .d1 { font-weight: 700; color: var(--ink); }

/* --------------------------------------------------------- dashboard hero */
.mgmt-hero {
  position: relative; overflow: hidden; border-radius: 16px; padding: 30px 32px; margin-bottom: 18px;
  background: linear-gradient(120deg, var(--brand-tint) 0%, #eef7f1 60%, var(--brand-light) 100%);
  border: 1px solid var(--brand-light);
}
.mgmt-hero .eyebrow { font-size: 12px; font-weight: 800; letter-spacing: .12em; color: var(--brand); text-transform: uppercase; }
.mgmt-hero h1 { margin: 6px 0 4px; font-size: 30px; font-weight: 800; color: var(--brand-darker); }
.mgmt-hero .sub { font-size: 16px; font-weight: 700; color: var(--brand-dark); margin-bottom: 8px; }
.mgmt-hero p.desc { max-width: 480px; color: var(--ink-soft); margin-bottom: 16px; }
.mgmt-hero-pills { display: flex; flex-direction: column; gap: 8px; position: absolute; right: 26px; top: 26px; }
@media (max-width: 760px) { .mgmt-hero-pills { display: none; } }
.mgmt-pill {
  display: flex; align-items: center; gap: 8px; background: rgba(255,255,255,.85); border-radius: 999px;
  padding: 7px 14px 7px 8px; font-size: 12.5px; font-weight: 700; color: var(--brand-darker); box-shadow: var(--shadow);
}
.mgmt-pill .pi { width: 26px; height: 26px; border-radius: 50%; background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center; }

/* -------------------------------------------------------------- houses */
.mgmt-house-card {
  background: #fff; border: 1px solid var(--border); border-radius: 14px; overflow: hidden; box-shadow: var(--shadow);
}
.mgmt-house-photo {
  height: 84px; background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  display: flex; align-items: center; justify-content: center; color: rgba(255,255,255,.9); position: relative;
}
.mgmt-house-photo .badge { position: absolute; top: 10px; right: 10px; }
.mgmt-house-body { padding: 14px 16px; }
.mgmt-house-body h3 { margin: 0 0 2px; }
.mgmt-house-body .hb-progress { display: flex; align-items: center; gap: 8px; margin: 10px 0 8px; }
.mgmt-house-body .hb-progress .progress-bar { flex: 1; margin: 0; }
.mgmt-house-body .hb-progress .pct { font-weight: 800; font-size: 13px; color: var(--brand-darker); min-width: 34px; text-align: right; }
.mgmt-house-body .hb-meta { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); }

/* ---------------------------------------------------------------- stats */
.mgmt-stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 18px 0; }
@media (max-width: 760px) { .mgmt-stats-grid { grid-template-columns: 1fr 1fr; } }
.mgmt-stat-card { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; display: flex; gap: 12px; align-items: flex-start; }
.mgmt-stat-card .si { width: 36px; height: 36px; border-radius: 9px; background: var(--brand-light); color: var(--brand-dark); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.mgmt-stat-card .sv { font-size: 22px; font-weight: 800; color: var(--ink); line-height: 1.1; }
.mgmt-stat-card .sl { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* --------------------------------------------------- reminder intelligence */
.mgmt-reminder-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
@media (max-width: 560px) { .mgmt-reminder-grid { grid-template-columns: 1fr; } }
.mgmt-reminder-item { display: flex; gap: 10px; padding: 10px; border-radius: 10px; background: var(--neutral-bg); }
.mgmt-reminder-item .ri-icon { width: 30px; height: 30px; border-radius: 8px; background: #fff; color: var(--brand-dark); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.mgmt-reminder-item .ri-title { font-weight: 700; font-size: 13px; }
.mgmt-reminder-item .ri-sub { font-size: 11.5px; color: var(--muted); }
.mgmt-reminder-item.disabled { opacity: .5; }

/* --------------------------------------------------------- week-at-a-glance */
.mgmt-week-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-top: 10px; }
.mgmt-week-day { text-align: center; padding: 10px 4px; border-radius: 10px; border: 1px solid var(--border); }
.mgmt-week-day.today { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-light); }
.mgmt-week-day .wd-label { font-size: 11px; color: var(--muted); font-weight: 700; }
.mgmt-week-day .wd-num { font-size: 15px; font-weight: 800; margin: 4px 0; }
.mgmt-week-day .wd-dot { width: 8px; height: 8px; border-radius: 50%; margin: 0 auto; }

/* ------------------------------------------------------------ ethos banner */
.mgmt-ethos-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 18px;
  background: linear-gradient(120deg, var(--brand-tint), var(--brand-light)); border-radius: 14px; padding: 18px 22px;
}
.mgmt-ethos-banner h3 { margin: 0 0 2px; color: var(--brand-darker); }
.mgmt-ethos-banner p { margin: 0; color: var(--ink-soft); font-size: 13.5px; }

/* ------------------------------------------------------------ contributors */
.contributor-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.contributor-row:last-child { border-bottom: none; }
.contributor-row .name { font-weight: 700; }
.contributor-row .meta { color: var(--muted); font-size: 12.5px; }

/* ---------------------------------------------------------------- saved */
.saved-indicator { font-size: 12.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 5px; }
.saved-indicator.ok { color: var(--green); }
.offline-banner {
  position: sticky; top: 0; z-index: 40; background: var(--amber-bg); color: #7c4a03; border-bottom: 1px solid #fcd9a6;
  padding: 8px 14px; font-size: 13px; text-align: center;
}

/* --------------------------------------------------------------- footer */
.app-footer { text-align: center; padding: 24px 0 8px; font-size: 12px; color: var(--muted); }

/* --------------------------------------------------------------- tables */
table.plain { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.plain th, table.plain td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
table.plain th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
.table-wrap { overflow-x: auto; }
