/* D'Sara Flex — mobile-first housekeeping app. No framework: one file, works offline. */

:root {
  --bg: #eef3f1;
  --surface: #ffffff;
  --surface-2: #f6f9f8;
  --surface-3: #ecf2f0;
  --text: #0e1d1a;
  --muted: #5d6e6a;
  --faint: #93a39f;
  --line: #e1e9e6;
  --brand: #0f766e;
  --brand-strong: #0b5c55;
  --brand-ink: #062b27;
  --brand-soft: #d9f3ef;
  --accent: #f4b740;
  --danger: #e11d48;
  --shadow-sm: 0 1px 2px rgba(6, 43, 39, .06), 0 1px 1px rgba(6, 43, 39, .04);
  --shadow: 0 6px 18px -6px rgba(6, 43, 39, .14), 0 2px 6px -2px rgba(6, 43, 39, .08);
  --shadow-lg: 0 24px 48px -16px rgba(6, 43, 39, .30);
  --radius: 18px;
  --radius-sm: 12px;

  /* Room status colours: ink / soft background */
  --dirty: #e11d48;     --dirty-bg: #ffe4ea;
  --cleaning: #d97706;  --cleaning-bg: #fff1d6;
  --inspect: #7c3aed;   --inspect-bg: #efe6ff;
  --ready: #059669;     --ready-bg: #d8f8e8;
  --ooo: #475569;       --ooo-bg: #e5ebf1;
  --inhouse: #0284c7;   --inhouse-bg: #ddf1fd;
  --arrive: #0d9488;    --arrive-bg: #d5f5f0;
  --depart: #ea580c;    --depart-bg: #ffe8d9;

  --tabbar-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #07110f; --surface: #0f1d1a; --surface-2: #132522; --surface-3: #1a2f2b;
    --text: #e8f2ef; --muted: #9db1ac; --faint: #6b807b; --line: #1f3632;
    --brand: #2dd4bf; --brand-strong: #5eead4; --brand-ink: #ccfbf1; --brand-soft: #0f3a35;
    --dirty-bg: #3a0f1b; --cleaning-bg: #3a2708; --inspect-bg: #2a1650; --ready-bg: #0b3324;
    --ooo-bg: #1f2a36; --inhouse-bg: #0b2a3d; --arrive-bg: #0b302c; --depart-bg: #3a1c0a;
    --dirty: #fb7185; --cleaning: #fbbf24; --inspect: #a78bfa; --ready: #34d399; --ooo: #94a3b8;
    --inhouse: #38bdf8; --arrive: #2dd4bf; --depart: #fb923c;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.4); --shadow: 0 6px 18px -6px rgba(0,0,0,.6); --shadow-lg: 0 24px 48px -16px rgba(0,0,0,.7);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh; overscroll-behavior-y: contain;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); text-decoration: none; }
img { max-width: 100%; display: block; }
.hidden, [hidden] { display: none !important; }
.icon { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon.sm { width: 16px; height: 16px; }
.icon.lg { width: 26px; height: 26px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.tiny { font-size: 11.5px; }
.bold { font-weight: 700; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.center { text-align: center; }
.mt { margin-top: 12px; } .mt-lg { margin-top: 20px; } .mb { margin-bottom: 12px; }

/* ── Top bar ─────────────────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 40;
  padding: calc(var(--safe-t) + 10px) 16px 12px;
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(45, 212, 191, .35) 0%, transparent 55%),
    linear-gradient(135deg, #0a3a33 0%, #0f5f57 60%, #117a6f 100%);
  color: #fff; display: flex; align-items: center; gap: 12px;
  box-shadow: 0 8px 24px -14px rgba(6, 43, 39, .7);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 12px; flex: none;
  background: linear-gradient(145deg, #2dd4bf, #0f766e); display: grid; place-items: center;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 4px 12px -4px rgba(0,0,0,.4);
  font-weight: 900; font-size: 20px; letter-spacing: -.5px;
}
.brand-mark span { color: var(--accent); }
.brand-name { font-weight: 800; font-size: 17px; letter-spacing: -.2px; line-height: 1.1; }
.brand-sub { font-size: 12px; color: rgba(255,255,255,.75); display: flex; align-items: center; gap: 6px; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #94a3b8; box-shadow: 0 0 0 0 rgba(52, 211, 153, .6); }
.live-dot.on { background: #34d399; animation: pulse 2.4s infinite; }
.live-dot.off { background: #fb7185; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(52,211,153,.6); } 70% { box-shadow: 0 0 0 8px rgba(52,211,153,0); } 100% { box-shadow: 0 0 0 0 rgba(52,211,153,0); } }
.top-btn {
  position: relative; width: 40px; height: 40px; border-radius: 50%; border: 0; flex: none;
  background: rgba(255,255,255,.12); color: #fff; display: grid; place-items: center; cursor: pointer;
}
.top-btn:active { background: rgba(255,255,255,.22); }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; flex: none; display: grid; place-items: center;
  font-weight: 800; font-size: 14px; color: #fff; background: linear-gradient(145deg, #f4b740, #e0892b);
  border: 2px solid rgba(255,255,255,.6); cursor: pointer;
}
.avatar.sm { width: 26px; height: 26px; font-size: 11px; border-width: 0; }
.avatar.md { width: 34px; height: 34px; font-size: 13px; border-width: 0; }
.badge {
  position: absolute; top: -2px; right: -2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--danger); color: #fff; font-size: 11px; font-weight: 800; display: grid; place-items: center;
  border: 2px solid #0f5f57;
}

/* ── Banners ─────────────────────────────────────────────────────────────── */
.banners { padding: 10px 14px 0; display: grid; gap: 8px; }
.banner {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px;
  background: var(--surface); box-shadow: var(--shadow-sm); border: 1px solid var(--line); font-size: 14px;
}
.banner .icon { color: var(--brand); }
.banner.warn { background: #fff7e6; border-color: #fde3a7; color: #7a4b00; }
.banner.warn .icon { color: #d97706; }
.banner.off { background: #fff1f3; border-color: #fecdd6; color: #9f1239; }
.banner.off .icon { color: var(--danger); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .banner.warn { background: #2f2207; border-color: #5b420b; color: #fde68a; }
  :root:not([data-theme="light"]) .banner.off { background: #33101a; border-color: #5c1a2b; color: #fecdd3; }
}

/* ── Layout ──────────────────────────────────────────────────────────────── */
main { padding: 14px 14px calc(var(--tabbar-h) + var(--safe-b) + 90px); max-width: 760px; margin: 0 auto; }
.section-title {
  display: flex; align-items: center; gap: 8px; margin: 22px 4px 10px;
  font-size: 13px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
}
.section-title .count {
  background: var(--surface-3); color: var(--text); border-radius: 10px; padding: 1px 8px; font-size: 12px; letter-spacing: 0;
}
.section-title .grow + * { text-transform: none; letter-spacing: 0; }
.card {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-sm);
  border: 1px solid var(--line); padding: 14px;
}
.card + .card { margin-top: 10px; }
.stack > * + * { margin-top: 10px; }
.empty { text-align: center; color: var(--muted); padding: 28px 16px; }
.empty .icon { width: 40px; height: 40px; color: var(--faint); margin: 0 auto 8px; stroke-width: 1.5; }

/* ── Hero (Today) ────────────────────────────────────────────────────────── */
.hero {
  position: relative; overflow: hidden; border-radius: 22px; padding: 18px; color: #fff;
  background:
    radial-gradient(90% 120% at 110% -10%, rgba(244,183,64,.35), transparent 50%),
    radial-gradient(70% 90% at -10% 120%, rgba(45,212,191,.35), transparent 55%),
    linear-gradient(140deg, #0b4038, #0f766e);
  box-shadow: var(--shadow);
}
.hero h1 { margin: 0; font-size: 22px; letter-spacing: -.3px; }
.hero .date { color: rgba(255,255,255,.75); font-size: 13px; margin-top: 2px; }
.hero-body { display: flex; align-items: center; gap: 16px; margin-top: 14px; }
.ring { position: relative; width: 92px; height: 92px; flex: none; }
.ring svg { width: 92px; height: 92px; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 9; }
.ring .track { stroke: rgba(255,255,255,.16); }
.ring .bar { stroke: url(#ringGrad); stroke-linecap: round; transition: stroke-dashoffset .8s cubic-bezier(.2,.8,.2,1); }
.ring .val { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; line-height: 1; }
.ring .val b { font-size: 24px; display: block; }
.ring .val small { font-size: 10.5px; color: rgba(255,255,255,.75); }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; flex: 1; }
.stat { background: rgba(255,255,255,.1); border-radius: 12px; padding: 8px 10px; backdrop-filter: blur(4px); }
.stat b { font-size: 20px; display: block; line-height: 1.1; }
.stat span { font-size: 11.5px; color: rgba(255,255,255,.8); }
.stat.alert { background: rgba(244, 63, 94, .32); }

/* ── Chips / pills ───────────────────────────────────────────────────────── */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; scrollbar-width: none; margin: 0 -14px; padding-left: 14px; padding-right: 14px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 7px 13px;
  font-size: 13.5px; font-weight: 600; white-space: nowrap; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  color: var(--text);
}
.chip.on { background: var(--brand-ink); color: #fff; border-color: transparent; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .chip.on { background: var(--brand); color: #04201c; } }
.chip .n { font-size: 12px; opacity: .7; }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; }

.pill {
  display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 3px 9px;
  font-size: 12px; font-weight: 700; white-space: nowrap; line-height: 1.35;
}
.pill .icon { width: 13px; height: 13px; }
.s-dirty    { color: var(--dirty);    background: var(--dirty-bg); }
.s-cleaning { color: var(--cleaning); background: var(--cleaning-bg); }
.s-inspect  { color: var(--inspect);  background: var(--inspect-bg); }
.s-ready    { color: var(--ready);    background: var(--ready-bg); }
.s-ooo      { color: var(--ooo);      background: var(--ooo-bg); }
.s-inhouse  { color: var(--inhouse);  background: var(--inhouse-bg); }
.s-arrive   { color: var(--arrive);   background: var(--arrive-bg); }
.s-depart   { color: var(--depart);   background: var(--depart-bg); }
.s-urgent   { color: #fff; background: var(--danger); }
.s-high     { color: #9a3412; background: #ffedd5; }
.s-plain    { color: var(--muted); background: var(--surface-3); }
.s-dnd      { color: #6d28d9; background: #ede4ff; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  border: 0; border-radius: 14px; padding: 11px 16px; font-weight: 700; font-size: 14.5px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap;
  background: var(--surface-3); color: var(--text); transition: transform .08s ease, filter .15s;
  min-height: 44px;
}
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn-primary { background: linear-gradient(180deg, #14897f, #0f766e); color: #fff; box-shadow: 0 6px 16px -8px rgba(15,118,110,.8); }
.btn-dark { background: var(--brand-ink); color: #fff; }
.btn-good { background: linear-gradient(180deg, #10b981, #059669); color: #fff; box-shadow: 0 6px 16px -8px rgba(5,150,105,.8); }
.btn-warn { background: #fff1d6; color: #92400e; }
.btn-bad  { background: #ffe4ea; color: #be123c; }
.btn-ghost { background: transparent; color: var(--brand); padding-left: 8px; padding-right: 8px; }
.btn-line { background: transparent; border: 1.5px solid var(--line); }
.btn-sm { min-height: 36px; padding: 7px 12px; font-size: 13.5px; border-radius: 11px; }
.btn-lg { min-height: 56px; font-size: 16.5px; border-radius: 16px; padding: 14px 20px; }
.btn-block { display: flex; width: 100%; }
.btn-row { display: flex; gap: 8px; }
.btn-row > .btn { flex: 1; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .btn-dark { background: var(--brand); color: #04201c; }
  :root:not([data-theme="light"]) .btn-warn { background: var(--cleaning-bg); color: var(--cleaning); }
  :root:not([data-theme="light"]) .btn-bad  { background: var(--dirty-bg); color: var(--dirty); }
}

/* ── Job cards ───────────────────────────────────────────────────────────── */
.job {
  position: relative; display: flex; gap: 12px; align-items: stretch; padding: 12px; padding-left: 16px;
  background: var(--surface); border-radius: var(--radius); border: 1px solid var(--line); box-shadow: var(--shadow-sm);
  cursor: pointer; overflow: hidden;
}
.job + .job { margin-top: 10px; }
.job::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--line); }
.job.k-dirty::before { background: var(--dirty); }
.job.k-cleaning::before { background: var(--cleaning); }
.job.k-inspect::before { background: var(--inspect); }
.job.k-ready::before { background: var(--ready); }
.job.k-skipped::before { background: var(--ooo); }
.job.is-done { opacity: .72; }
.job-icon {
  width: 44px; height: 44px; border-radius: 14px; flex: none; display: grid; place-items: center;
  background: var(--surface-3); color: var(--brand);
}
.job-room { font-weight: 800; font-size: 16px; letter-spacing: -.2px; }
.job-kind { font-size: 13px; color: var(--muted); }
.job-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.job-side { display: flex; flex-direction: column; align-items: flex-end; justify-content: space-between; gap: 8px; }
.due { font-size: 12px; font-weight: 700; color: var(--muted); display: inline-flex; gap: 4px; align-items: center; }
.due.late { color: var(--danger); }

/* ── Room tiles ──────────────────────────────────────────────────────────── */
.statusbar { display: flex; height: 10px; border-radius: 6px; overflow: hidden; background: var(--surface-3); margin: 4px 0 12px; }
.statusbar span { display: block; height: 100%; transition: width .4s; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 5px; }
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 560px) { .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.tile {
  position: relative; border-radius: var(--radius); padding: 12px; min-height: 112px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 6px; overflow: hidden; transition: transform .1s;
}
.tile:active { transform: scale(.98); }
.tile::after { content: ""; position: absolute; inset: auto 0 0 0; height: 4px; }
.tile.st-dirty::after { background: var(--dirty); }
.tile.st-cleaning::after { background: var(--cleaning); }
.tile.st-inspect::after { background: var(--inspect); }
.tile.st-ready::after { background: var(--ready); }
.tile.st-ooo::after { background: repeating-linear-gradient(45deg, var(--ooo) 0 6px, transparent 6px 12px); }
.tile.st-dirty { background: linear-gradient(180deg, var(--surface) 55%, var(--dirty-bg)); }
.tile.st-cleaning { background: linear-gradient(180deg, var(--surface) 55%, var(--cleaning-bg)); }
.tile.st-inspect { background: linear-gradient(180deg, var(--surface) 55%, var(--inspect-bg)); }
.tile.st-ooo { background: linear-gradient(180deg, var(--surface) 55%, var(--ooo-bg)); }
.tile-name { font-weight: 800; font-size: 15.5px; letter-spacing: -.2px; line-height: 1.2; }
.tile-type { font-size: 11.5px; color: var(--muted); }
.tile-icons { display: flex; gap: 5px; flex-wrap: wrap; margin-top: auto; }
.tile-flag { position: absolute; top: 10px; right: 10px; width: 10px; height: 10px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 0 3px var(--dirty-bg); }

/* ── Detail screens ──────────────────────────────────────────────────────── */
.back { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--brand); padding: 4px 2px 10px; cursor: pointer; background: none; border: 0; }
.head-card { border-radius: 22px; padding: 16px; color: #fff; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.head-card h1 { margin: 0; font-size: 24px; letter-spacing: -.4px; }
.head-card .sub { color: rgba(255,255,255,.82); font-size: 13.5px; }
.head-card .pill { background: rgba(255,255,255,.18); color: #fff; }
.hc-dirty    { background: linear-gradient(140deg, #9f1239, #e11d48); }
.hc-cleaning { background: linear-gradient(140deg, #92400e, #d97706); }
.hc-inspect  { background: linear-gradient(140deg, #4c1d95, #7c3aed); }
.hc-ready    { background: linear-gradient(140deg, #065f46, #059669); }
.hc-ooo      { background: linear-gradient(140deg, #1e293b, #475569); }
.hc-brand    { background: linear-gradient(140deg, #0b4038, #0f766e); }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.fact { background: rgba(255,255,255,.13); border-radius: 12px; padding: 8px 10px; }
.fact small { display: block; font-size: 11px; color: rgba(255,255,255,.75); }
.fact b { font-size: 14px; }
.timer { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 28px; letter-spacing: -.5px; }

/* Checklist */
.check {
  display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 14px; cursor: pointer;
  background: var(--surface-2); border: 1.5px solid transparent; user-select: none; min-height: 56px;
}
.check + .check { margin-top: 8px; }
.check .box {
  width: 30px; height: 30px; border-radius: 10px; flex: none; border: 2px solid var(--faint);
  display: grid; place-items: center; transition: all .15s; background: var(--surface);
}
.check .box .icon { width: 18px; height: 18px; color: #fff; opacity: 0; stroke-width: 3; }
.check.on { background: var(--ready-bg); border-color: color-mix(in srgb, var(--ready) 30%, transparent); }
.check.on .box { background: var(--ready); border-color: var(--ready); }
.check.on .box .icon { opacity: 1; }
.check.on .label { text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--ready) 60%, transparent); }
.check.redo { border-color: var(--dirty); }
.check .label { flex: 1; font-weight: 600; }
.check .label small { display: block; font-weight: 500; color: var(--muted); font-size: 12px; }
.cam {
  width: 44px; height: 44px; border-radius: 12px; border: 0; flex: none; display: grid; place-items: center; cursor: pointer;
  background: var(--brand-soft); color: var(--brand);
}
.cam.has { background: var(--ready); color: #fff; }
.progress { height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.progress span { display: block; height: 100%; background: linear-gradient(90deg, #14b8a6, #059669); border-radius: 4px; transition: width .3s; }

.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.photo { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--surface-3); cursor: zoom-in; }
.photo img { width: 100%; height: 100%; object-fit: cover; }
.photo .pending { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,.35); color: #fff; font-size: 11px; font-weight: 700; }

/* Timeline */
.timeline { position: relative; padding-left: 18px; }
.timeline::before { content: ""; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.tl { position: relative; padding: 4px 0 12px; }
.tl::before { content: ""; position: absolute; left: -17px; top: 9px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--brand); }
.tl .when { font-size: 11.5px; color: var(--faint); }

/* ── Chat ────────────────────────────────────────────────────────────────── */
.msgs { display: flex; flex-direction: column; gap: 6px; padding-bottom: 8px; }
.msg { max-width: 82%; align-self: flex-start; }
.msg .bubble { background: var(--surface); border: 1px solid var(--line); border-radius: 18px 18px 18px 6px; padding: 9px 12px; box-shadow: var(--shadow-sm); white-space: pre-wrap; word-wrap: break-word; }
.msg.me { align-self: flex-end; }
.msg.me .bubble { background: linear-gradient(180deg, #14897f, #0f766e); color: #fff; border-color: transparent; border-radius: 18px 18px 6px 18px; }
.msg .who { font-size: 11.5px; color: var(--muted); margin: 0 6px 2px; font-weight: 700; }
.msg .meta { font-size: 11px; color: var(--faint); margin: 2px 8px 0; }
.msg.me .meta { text-align: right; }
.msg .room-tag { font-size: 11px; font-weight: 800; color: var(--brand); display: block; }
.msg.me .room-tag { color: #bff3ea; }
.sys { align-self: center; max-width: 92%; text-align: center; font-size: 12.5px; color: var(--muted); background: var(--surface-3); border-radius: 12px; padding: 5px 10px; }
.day-sep { align-self: center; font-size: 11px; font-weight: 800; color: var(--faint); text-transform: uppercase; letter-spacing: .08em; margin: 8px 0 2px; }
.note-card {
  border-radius: 16px; padding: 12px 14px; background: #fff8e6; border: 1px solid #fde3a7; color: #5c3b00;
  display: flex; gap: 10px; align-items: flex-start;
}
.note-card.urgent { background: #fff0f3; border-color: #fecdd6; color: #881337; }
.note-card + .note-card { margin-top: 8px; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .note-card { background: #2f2207; border-color: #5b420b; color: #fde68a; }
  :root:not([data-theme="light"]) .note-card.urgent { background: #33101a; border-color: #5c1a2b; color: #fecdd3; }
}
.composer {
  position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar-h) + var(--safe-b)); z-index: 30;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line); padding: 8px 12px;
}
.composer-inner { max-width: 760px; margin: 0 auto; }
.composer .opts { display: flex; gap: 6px; margin-bottom: 6px; overflow-x: auto; }
.composer .opts select, .composer .opts .chip { font-size: 12.5px; padding: 5px 10px; }
.composer form { display: flex; gap: 8px; align-items: flex-end; }
.composer textarea {
  flex: 1; resize: none; border: 1px solid var(--line); background: var(--surface); border-radius: 20px; padding: 10px 14px;
  max-height: 120px; min-height: 44px; line-height: 1.35; outline: none;
}
.send-btn { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--brand); color: #fff; display: grid; place-items: center; flex: none; cursor: pointer; }

/* ── Forms ───────────────────────────────────────────────────────────────── */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.input, select.input, textarea.input {
  width: 100%; border: 1.5px solid var(--line); background: var(--surface); border-radius: 12px; padding: 11px 12px; outline: none; min-height: 46px;
}
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
textarea.input { min-height: 90px; resize: vertical; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 12px; border: 1.5px solid var(--line); font-weight: 600; font-size: 13.5px; background: var(--surface); }
.seg input:checked + span { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-strong); }
.switch { display: flex; align-items: center; gap: 12px; padding: 12px 0; cursor: pointer; }
.switch + .switch { border-top: 1px solid var(--line); }
.switch input { appearance: none; -webkit-appearance: none; width: 48px; height: 28px; border-radius: 14px; background: var(--surface-3); position: relative; flex: none; cursor: pointer; transition: background .2s; border: 1px solid var(--line); }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .2s; }
.switch input:checked { background: var(--brand); border-color: var(--brand); }
.switch input:checked::after { transform: translateX(20px); }

/* ── List rows (More, alerts) ────────────────────────────────────────────── */
.list { background: var(--surface); border-radius: var(--radius); border: 1px solid var(--line); overflow: hidden; box-shadow: var(--shadow-sm); }
.li { display: flex; align-items: center; gap: 12px; padding: 13px 14px; cursor: pointer; border: 0; background: none; width: 100%; text-align: left; }
.li + .li { border-top: 1px solid var(--line); }
.li .li-icon { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); flex: none; }
.li .chev { color: var(--faint); }
.li.unseen { background: color-mix(in srgb, var(--brand-soft) 45%, transparent); }

/* Workload */
.wl { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.wl + .wl { border-top: 1px dashed var(--line); }
.wl .bar { flex: 1; height: 10px; border-radius: 5px; background: var(--surface-3); overflow: hidden; }
.wl .bar span { display: block; height: 100%; border-radius: 5px; background: linear-gradient(90deg, #2dd4bf, #0f766e); }
.wl .bar span.heavy { background: linear-gradient(90deg, #fbbf24, #ea580c); }

/* ── Tab bar ─────────────────────────────────────────────────────────────── */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
  padding-bottom: var(--safe-b); height: calc(var(--tabbar-h) + var(--safe-b));
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(5, 1fr);
}
.tab {
  position: relative; border: 0; background: none; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--faint); font-size: 11px; font-weight: 700;
}
.tab .icon { width: 24px; height: 24px; }
.tab.on { color: var(--brand); }
.tab.on::before { content: ""; position: absolute; top: 0; width: 32px; height: 3px; border-radius: 0 0 3px 3px; background: var(--brand); }
.tab .badge { top: 6px; right: calc(50% - 22px); border-color: var(--surface); }

.fab {
  position: fixed; right: 18px; bottom: calc(var(--tabbar-h) + var(--safe-b) + 18px); z-index: 35;
  height: 56px; padding: 0 20px; border-radius: 28px; border: 0; cursor: pointer;
  background: linear-gradient(180deg, #14897f, #0f766e); color: #fff; font-weight: 800; font-size: 15px;
  display: inline-flex; align-items: center; gap: 8px; box-shadow: var(--shadow-lg);
}

/* ── Sheets, toast, viewer ───────────────────────────────────────────────── */
.scrim { position: fixed; inset: 0; z-index: 60; background: rgba(4, 20, 18, .5); backdrop-filter: blur(2px); animation: fade .2s; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 61; max-height: 88vh; overflow: auto;
  background: var(--surface); border-radius: 24px 24px 0 0; padding: 10px 18px calc(18px + var(--safe-b));
  box-shadow: var(--shadow-lg); animation: up .28s cubic-bezier(.2,.9,.25,1);
  max-width: 760px; margin: 0 auto;
}
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 12px; }
.sheet h2 { margin: 0 0 4px; font-size: 19px; letter-spacing: -.2px; }
.sheet p.lead { margin: 0 0 14px; color: var(--muted); font-size: 14px; }
@keyframes up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + var(--safe-b) + 20px); z-index: 80;
  transform: translateX(-50%) translateY(20px); opacity: 0; pointer-events: none; transition: all .25s;
  background: #0b2a26; color: #fff; padding: 11px 16px; border-radius: 14px; font-weight: 600; font-size: 14px;
  box-shadow: var(--shadow-lg); max-width: calc(100% - 32px); display: flex; align-items: center; gap: 8px;
}
.toast.show { opacity: 1; transform: translateX(-50%); }
.toast.bad { background: #9f1239; }
.viewer { position: fixed; inset: 0; z-index: 90; background: rgba(0,0,0,.92); display: grid; place-items: center; animation: fade .2s; }
.viewer img { max-width: 100%; max-height: 100%; object-fit: contain; }
.viewer button { position: absolute; top: calc(var(--safe-t) + 12px); right: 12px; }

/* ── Sign in ─────────────────────────────────────────────────────────────── */
.signin { min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(80% 60% at 80% 0%, rgba(45,212,191,.35), transparent 60%), linear-gradient(160deg, #062b27, #0f766e); color: #fff; }
.signin-card { width: 100%; max-width: 380px; text-align: center; }
.signin-logo { width: 88px; height: 88px; margin: 0 auto 18px; border-radius: 26px; box-shadow: 0 20px 40px -16px rgba(0,0,0,.6); }
.signin h1 { margin: 0; font-size: 30px; letter-spacing: -.6px; }
.signin p { color: rgba(255,255,255,.8); margin: 8px 0 26px; }
.signin .btn-primary { background: #fff; color: #0b4038; }
.signin .feat { display: grid; gap: 10px; margin-top: 28px; text-align: left; }
.signin .feat div { display: flex; gap: 10px; align-items: center; background: rgba(255,255,255,.08); padding: 10px 12px; border-radius: 12px; font-size: 14px; }
.msg-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--bg); }
.msg-card { max-width: 380px; background: var(--surface); padding: 28px; border-radius: 22px; box-shadow: var(--shadow); text-align: center; }
.msg-logo { margin: 0 auto 12px; border-radius: 18px; }

/* Skeleton */
.skel { background: linear-gradient(90deg, var(--surface-3) 0%, var(--surface-2) 50%, var(--surface-3) 100%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: var(--radius); height: 84px; }
.skel + .skel { margin-top: 10px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* Big, simple mode for cleaners: larger text and targets */
body.big { font-size: 16.5px; }
body.big .job-room { font-size: 18px; }
body.big .btn { min-height: 50px; font-size: 16px; }
body.big .check { min-height: 64px; }
body.big .check .label { font-size: 16.5px; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
