/* Household Staff App: how everything looks. Built for phones first. */

:root {
  --bg: #f6f4f0;
  --card: #ffffff;
  --text: #1d2327;
  --muted: #5f6b73;
  --line: #e4e0d8;
  --primary: #0f766e;
  --primary-ink: #ffffff;
  --primary-soft: #e2f2ef;
  --danger: #c62828;
  --danger-soft: #fdecea;
  --focus: #f59e0b;
  --radius: 16px;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.05), 0 4px 12px rgb(0 0 0 / 0.04);
  --nav-height: 68px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121615;
    --card: #1c2221;
    --text: #eef2f1;
    --muted: #a3b0ad;
    --line: #2d3634;
    --primary: #2bb3a3;
    --primary-ink: #06201d;
    --primary-soft: #183330;
    --danger: #ef5350;
    --danger-soft: #3a1d1c;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

/* Anything marked hidden stays hidden, even if its style says how to show it. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { line-height: 1.2; margin: 0 0 8px; }
h1 { font-size: 26px; }
h2 { font-size: 21px; }
h3 { font-size: 18px; }
p { margin: 0 0 12px; }

.splash { padding: 40vh 16px 0; text-align: center; color: var(--muted); }

/* ---------- Layout ---------- */

.page {
  max-width: 560px;
  margin: 0 auto;
  padding: 16px 16px calc(var(--nav-height) + 24px + env(safe-area-inset-bottom) + var(--urgent-height, 0px));
}

.page.no-nav { padding-bottom: 32px; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
}

.topbar-inner {
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-title { font-weight: 700; font-size: 19px; flex: 1; }

.stack > * + * { margin-top: 12px; }

/* ---------- Cards ---------- */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

.muted { color: var(--muted); }
.small { font-size: 15px; }

.welcome { padding: 28px 4px 8px; }
.welcome .logo { width: 64px; height: 64px; margin-bottom: 16px; }

/* ---------- Forms ---------- */

.field { display: block; margin-bottom: 16px; }
.field-label { display: block; font-weight: 600; margin-bottom: 6px; }
.field-hint { display: block; color: var(--muted); font-size: 14px; margin-top: 6px; }

input[type="text"],
input[type="password"],
input[type="tel"],
select,
textarea {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 13px 14px;
  min-height: 52px;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.pin-input { letter-spacing: 0.35em; font-size: 22px; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 54px;
  padding: 12px 18px;
  font: inherit;
  font-weight: 700;
  border-radius: 14px;
  border: 1.5px solid transparent;
  cursor: pointer;
  background: var(--primary);
  color: var(--primary-ink);
  -webkit-tap-highlight-color: transparent;
}

.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.6; cursor: default; }
.btn:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.btn-secondary { background: var(--card); color: var(--text); border-color: var(--line); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }

.form-error {
  background: var(--danger-soft);
  color: var(--danger);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 16px;
  font-weight: 600;
}

/* ---------- People ---------- */

.avatar {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-weight: 700;
  font-size: 16px;
  color: #fff;
  overflow: hidden;
}

.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.lg { width: 72px; height: 72px; font-size: 28px; }

.profile { display: flex; align-items: center; gap: 16px; }

.badge {
  display: inline-block;
  font-size: 13px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
}

/* ---------- Bottom navigation ---------- */

.nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  background: var(--card);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}

.nav-inner {
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  height: var(--nav-height);
}

.nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  -webkit-tap-highlight-color: transparent;
}

.nav a svg { width: 26px; height: 26px; }
.nav a[aria-current="page"] { color: var(--primary); }

/* ---------- Top bar extras ---------- */

.back {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-left: -10px;
  color: var(--text);
  border-radius: 50%;
}
.back svg { width: 28px; height: 28px; }
.topbar-me { display: flex; border-radius: 50%; text-decoration: none; }

/* ---------- Lists ---------- */

.card.list { padding: 0; overflow: hidden; }

.row {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 64px;
  padding: 12px 16px;
  color: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.row + .row { border-top: 1px solid var(--line); }
.row:active { background: var(--primary-soft); }
.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 650; }
.row-sub { color: var(--muted); font-size: 15px; overflow-wrap: anywhere; }
.chevron { color: var(--muted); font-size: 26px; line-height: 1; }

.section-title {
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 20px 4px 8px;
}

.avatar-stack { display: flex; }
.avatar-stack .avatar { width: 34px; height: 34px; font-size: 14px; border: 2px solid var(--card); }
.avatar-stack .avatar + .avatar { margin-left: -12px; }
.menu-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--primary-soft);
  color: var(--primary);
}
.menu-icon svg { width: 24px; height: 24px; }

details.archived summary {
  cursor: pointer;
  font-weight: 650;
  color: var(--muted);
  padding: 12px 4px;
  min-height: 48px;
}

/* ---------- More form pieces ---------- */

fieldset { border: 0; padding: 0; margin: 0 0 16px; min-width: 0; }

select {
  appearance: none;
  -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 22px) 50%, calc(100% - 16px) 50%;
  background-size: 6px 6px;
  background-repeat: no-repeat;
  padding-right: 40px;
}

textarea { resize: vertical; min-height: 110px; line-height: 1.45; }

.segmented {
  display: flex;
  gap: 6px;
  padding: 4px;
  background: var(--bg);
  border: 1.5px solid var(--line);
  border-radius: 14px;
}
.segment { flex: 1; position: relative; }
.segment input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.segment span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 6px 10px;
  border-radius: 10px;
  font-weight: 650;
  color: var(--muted);
  text-align: center;
}
.segment input:checked + span { background: var(--card); color: var(--primary); box-shadow: var(--shadow), 0 0 0 1.5px var(--primary); }
.segment input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 1px; }

.form-section { margin: 24px 0 12px; padding-top: 16px; border-top: 1px solid var(--line); }
.role-help { margin-top: -8px; }

.notice {
  background: #fff7e6;
  color: #7a4b00;
  border-radius: 12px;
  padding: 12px 14px;
  font-weight: 600;
}
@media (prefers-color-scheme: dark) {
  .notice { background: #3a2c10; color: #ffd48a; }
}

.btn-small { width: auto; min-height: 44px; padding: 8px 16px; font-size: 15px; }
a.btn { text-decoration: none; }

.photo-picker { display: flex; align-items: center; gap: 16px; }
.photo-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.photo-actions label { cursor: pointer; }

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.badge-quiet { background: var(--bg); color: var(--muted); margin-left: 6px; }
.preserve { white-space: pre-wrap; overflow-wrap: anywhere; }
.loading { padding: 24px 4px; }
.danger-zone { box-shadow: none; }

/* ---------- Toast ("Saved") ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav-height) + 16px + env(safe-area-inset-bottom));
  z-index: 50;
  transform: translate(-50%, 20px);
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  background: var(--text);
  color: var(--bg);
  padding: 12px 20px;
  border-radius: 999px;
  font-weight: 650;
  max-width: calc(100% - 32px);
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Task colors (always paired with words, never color alone) ---------- */

:root {
  --done: #15803d;
  --done-soft: #e7f6ec;
  --moved: #b45309;
  --moved-soft: #fdf1e1;
  --late: #c62828;
  --late-soft: #fdecea;
  --new: #6d28d9;
  --new-soft: #efe7fd;
  --quiet-soft: #eef0ee;
}
@media (prefers-color-scheme: dark) {
  :root {
    --done: #4ade80;
    --done-soft: #12301d;
    --moved: #fbbf24;
    --moved-soft: #3a2a0d;
    --late: #f87171;
    --late-soft: #3a1d1c;
    --new: #c4b5fd;
    --new-soft: #2a2140;
    --quiet-soft: #252b2a;
  }
}

/* ---------- Staff: today header ---------- */

.today-card h2 { font-size: 24px; margin-bottom: 12px; }
.today-date { color: var(--muted); font-weight: 600; margin-bottom: 4px; }
.progress { height: 10px; border-radius: 999px; background: var(--quiet-soft); overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--done); border-radius: 999px; transition: width 0.3s; }

.new-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 52px;
  border: 0;
  border-radius: 14px;
  background: var(--new);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
@media (prefers-color-scheme: dark) { .new-banner { color: #1b1036; } }

.day-off-card { background: var(--primary-soft); border-color: transparent; }

/* Admins: tasks staff added, waiting to be checked. Staff: the "add your own task" box. */
.review-card { border: 2px solid var(--new); background: var(--new-soft); }
.review-card h3 { color: var(--new); }
.review-card .card.list { margin-top: 10px; box-shadow: none; }
.add-own { background: transparent; box-shadow: none; border-style: dashed; }
.add-own p { margin-top: 0; }

/* ---------- Task card ---------- */

.task-card {
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px 16px;
  transition: background 0.2s, border-color 0.2s;
}
.task-card.is-new { border-color: var(--new); box-shadow: 0 0 0 2px var(--new-soft); }
.task-card.flash { animation: flash 1.2s ease 2; }
@keyframes flash { 50% { background: var(--new-soft); } }
.task-card.status-done { background: var(--done-soft); border-color: transparent; }
.task-card.status-skipped,
.task-card.status-moved { background: var(--quiet-soft); border-color: transparent; }
.task-card.status-done .task-title,
.task-card.status-skipped .task-title,
.task-card.status-moved .task-title { text-decoration: line-through; color: var(--muted); }

.task-head { display: block; color: inherit; text-decoration: none; padding-bottom: 12px; }
.task-title { font-size: 19px; margin: 4px 0 2px; overflow-wrap: anywhere; }
.task-place { color: var(--muted); font-size: 15px; }
.how-to-hint { color: var(--primary); font-weight: 600; white-space: nowrap; }

.task-actions { display: flex; gap: 10px; }
.btn-task { flex: 1; font-size: 15px; min-height: 52px; padding: 8px 10px; }
.btn-done {
  flex: 1.4;
  min-height: 56px;
  font-size: 18px;
  background: var(--done);
  color: #fff;
}
@media (prefers-color-scheme: dark) { .btn-done { color: #06210f; } }

.task-after { display: flex; flex-direction: column; gap: 8px; }
.finished-line { display: flex; align-items: center; gap: 14px; }
.finished-text { font-weight: 700; color: var(--done); }
.status-skipped .finished-text,
.status-moved .finished-text { color: var(--muted); }
.link-button {
  background: none;
  border: 0;
  padding: 10px 2px;
  min-height: 44px;
  font: inherit;
  font-weight: 700;
  color: var(--primary);
  text-decoration: underline;
  cursor: pointer;
}
.link-button.small { font-size: 14px; padding: 0; min-height: 0; }
.time-question { margin: 4px 0 0; font-size: 15px; color: var(--muted); }
.time-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.minutes-input { width: 96px !important; min-height: 44px !important; padding: 8px 12px !important; }

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.chip-solid { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }

.card-problem { margin: 10px 0 0; color: var(--late); font-weight: 700; }
.is-saving { opacity: 0.75; }

.tag {
  display: inline-block;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.02em;
  padding: 3px 10px;
  border-radius: 999px;
}
.tag-new { background: var(--new); color: #fff; }
.tag-moved { background: var(--moved-soft); color: var(--moved); }
.tag-late { background: var(--late-soft); color: var(--late); }
.tag-updated { background: var(--primary-soft); color: var(--primary); }
@media (prefers-color-scheme: dark) { .tag-new { color: #1b1036; } }

.later-day {
  flex: none;
  min-width: 76px;
  font-weight: 700;
  color: var(--muted);
  font-size: 15px;
  text-transform: capitalize;
}

/* ---------- Task page ---------- */

.usual { margin: 10px 0 0; font-weight: 650; color: var(--primary); }
.tip { padding: 12px 14px; border-radius: 12px; background: var(--bg); }
.tip-hidden { opacity: 0.55; }
.history-row.status-done .row-title { color: var(--done); }
.history-row.not-done .row-title { color: var(--late); }
.history-row.status-moved .row-title { color: var(--moved); }
.history-more { margin: 4px 16px 8px; }
.events summary { cursor: pointer; font-weight: 650; min-height: 32px; }
.events ul { margin: 12px 0 0; padding-left: 20px; }
.events li { margin-bottom: 10px; overflow-wrap: anywhere; }
.old-text summary { font-size: 14px; color: var(--primary); }

/* ---------- Admin: Day view and All tasks ---------- */

.view-switch { margin-bottom: 4px; }
.segment-link {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  border-radius: 10px;
  font-weight: 650;
  color: var(--muted);
  text-decoration: none;
}
.segment-link.active { background: var(--card); color: var(--primary); box-shadow: var(--shadow), 0 0 0 1.5px var(--primary); }

.date-nav { display: flex; align-items: center; gap: 8px; }
.date-label { flex: 1; text-align: center; display: flex; flex-direction: column; }
.date-arrow {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: var(--card);
  border: 1.5px solid var(--line);
  font-size: 30px;
  line-height: 1;
  color: var(--text);
  text-decoration: none;
}
.date-arrow.disabled { opacity: 0.3; }

.summary-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  display: inline-flex;
  align-items: center;
  flex: none;
  font-size: 13px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.pill-done { background: var(--done-soft); color: var(--done); }
.pill-open { background: var(--primary-soft); color: var(--primary); }
.pill-late { background: var(--late-soft); color: var(--late); }
.pill-skipped,
.pill-removed { background: var(--quiet-soft); color: var(--muted); }
.pill-moved { background: var(--moved-soft); color: var(--moved); }
.pill-dayoff { background: var(--primary-soft); color: var(--primary); }

.person-day { margin-top: 8px; }
.person-day-head { display: flex; align-items: center; gap: 12px; padding: 12px 4px 8px; }
.day-row { align-items: flex-start; }
.day-row .pill { margin-top: 2px; min-width: 74px; justify-content: center; }
.day-row.status-removed .row-title { text-decoration: line-through; color: var(--muted); }
.row-detail { font-size: 14px; }

.filter-chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
.filter-chips .chip { flex: none; }
.room-group + .room-group { margin-top: 10px; }
.room-name { font-weight: 650; color: var(--muted); margin: 0 4px 6px; font-size: 15px; }
.warn { color: var(--late); font-weight: 650; }

/* ---------- Top bar "Need you now" button and tab badges ---------- */

.need-btn {
  flex: none;
  min-height: 40px;
  padding: 6px 12px;
  border: 0;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}
@media (max-width: 359px) { .need-btn { font-size: 13px; padding: 6px 10px; } }

.nav-icon { position: relative; display: inline-flex; }
.nav-badge {
  position: absolute;
  top: -6px;
  right: -12px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  line-height: 20px;
  text-align: center;
}

.new-tasks-pill {
  position: fixed;
  z-index: 6;
  top: calc(72px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  min-height: 44px;
  padding: 8px 18px;
  border: 0;
  border-radius: 999px;
  background: var(--new);
  color: #fff;
  font: inherit;
  font-weight: 800;
  box-shadow: 0 4px 16px rgb(0 0 0 / 0.2);
  cursor: pointer;
}

/* ---------- "Need you now": strip above the tabs ---------- */

.urgent-strip {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--nav-height) + env(safe-area-inset-bottom));
  z-index: 9;
  max-height: 55vh;
  overflow-y: auto;
  padding: 0 8px 8px;
}
.urgent-item {
  max-width: 560px;
  margin: 8px auto 0;
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--danger);
  color: #fff;
  box-shadow: 0 6px 20px rgb(0 0 0 / 0.25);
}
.urgent-item.is-coming { background: #b45309; }
.urgent-line { font-size: 16px; }
.urgent-icon { margin-right: 6px; }
.urgent-body { margin: 4px 0; font-size: 18px; font-weight: 700; overflow-wrap: anywhere; }
.urgent-progress { margin: 0 0 8px; font-size: 14px; opacity: 0.95; }
.urgent-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.urgent-actions .btn { width: auto; flex: 1 1 auto; min-height: 46px; font-size: 15px; padding: 8px 12px; }
.btn-coming { background: #fff; color: var(--danger); }
.btn-call { background: rgb(255 255 255 / 0.18); color: #fff; border-color: rgb(255 255 255 / 0.6); }
.card .btn-call, .row .btn-call { background: var(--done); color: #fff; width: auto; min-height: 44px; padding: 8px 14px; font-size: 15px; }
.btn-call-big { background: #fff; color: var(--done); font-size: 17px; }
.btn-close-urgent { background: transparent; color: #fff; border-color: rgb(255 255 255 / 0.6); }

/* ---------- "Need you now": full-screen alert ---------- */

.urgent-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--danger);
  color: #fff;
  display: grid;
  place-items: center;
  padding: calc(24px + env(safe-area-inset-top)) 20px calc(24px + env(safe-area-inset-bottom));
  overflow-y: auto;
  animation: pulse-bg 1.2s ease-in-out 3;
}
@keyframes pulse-bg { 50% { background: #8e1b1b; } }
.urgent-overlay-inner { width: 100%; max-width: 480px; text-align: center; }
.urgent-kicker { font-size: 15px; font-weight: 900; letter-spacing: 0.2em; opacity: 0.9; }
.urgent-who { display: flex; flex-direction: column; align-items: center; gap: 12px; margin: 12px 0; }
.urgent-who .avatar { border: 3px solid #fff; }
.urgent-who h2 { font-size: 26px; }
.urgent-where { font-weight: 700; opacity: 0.9; }
.urgent-message { font-size: 26px; font-weight: 800; line-height: 1.25; margin: 8px 0 28px; overflow-wrap: anywhere; }
.btn-coming-big { background: #fff; color: var(--danger); min-height: 64px; font-size: 21px; }
.btn-ok { background: transparent; color: #fff; border-color: rgb(255 255 255 / 0.7); }
.urgent-overlay .btn-call-big { min-height: 60px; }

/* ---------- "Need you now": the send sheet ---------- */

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgb(0 0 0 / 0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.sheet {
  width: 100%;
  max-width: 560px;
  max-height: 92vh;
  overflow-y: auto;
  background: var(--card);
  border-radius: 22px 22px 0 0;
  padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.who-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin: 4px 0 8px; }
.who-choice { position: relative; }
.who-choice input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.who-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-height: 96px;
  padding: 10px 6px;
  border: 2px solid var(--line);
  border-radius: 16px;
  font-weight: 650;
  font-size: 14px;
  text-align: center;
  overflow-wrap: anywhere;
}
.who-choice input:checked + .who-tile { border-color: var(--danger); background: var(--danger-soft); color: var(--danger); }
.who-choice input:focus-visible + .who-tile { outline: 3px solid var(--focus); }
.avatar.everyone { background: var(--quiet-soft); font-size: 20px; }
.btn-send-urgent { background: var(--danger); color: #fff; min-height: 60px; font-size: 19px; margin-top: 6px; }

/* ---------- Chat ---------- */

.chat { padding-bottom: 96px; }
.chat-tools { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.older { display: block; margin: 0 auto 12px; }
.chat-list { display: flex; flex-direction: column; gap: 6px; }
.chat-day { align-self: center; margin: 12px 0 4px; padding: 3px 12px; border-radius: 999px; background: var(--quiet-soft); color: var(--muted); font-size: 13px; font-weight: 700; }
.chat-row { display: flex; align-items: flex-end; gap: 8px; max-width: 88%; }
.chat-row.mine { align-self: flex-end; flex-direction: row-reverse; }
.chat-row.same { margin-top: -2px; }
.chat-row .avatar { width: 32px; height: 32px; font-size: 13px; }
.avatar-space { flex: none; width: 32px; }
.bubble {
  padding: 8px 12px 6px;
  border-radius: 18px 18px 18px 6px;
  background: var(--card);
  border: 1px solid var(--line);
  overflow-wrap: anywhere;
}
.mine .bubble { border-radius: 18px 18px 6px 18px; background: var(--primary-soft); border-color: transparent; }
.bubble-name { font-size: 13px; font-weight: 800; color: var(--primary); margin-bottom: 2px; }
.bubble-text { white-space: pre-wrap; }
.bubble-urgent { background: var(--danger-soft) !important; border-color: transparent; color: var(--danger); font-weight: 700; }
.bubble-removed { color: var(--muted); }
.bubble.tappable { cursor: pointer; }
.bubble-actions { align-self: center; }
.chat-time { font-size: 12px; color: var(--muted); text-align: right; margin-top: 2px; }
.chat-notice { align-self: center; max-width: 92%; text-align: center; font-size: 14px; color: var(--muted); padding: 2px 8px; }
.chat-notice .chat-time { display: inline; }
.chat-empty { text-align: center; padding: 32px 0; }

.composer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--nav-height) + env(safe-area-inset-bottom) + var(--urgent-height, 0px));
  z-index: 8;
  display: flex;
  gap: 8px;
  align-items: flex-end;
  max-width: 560px;
  margin: 0 auto;
  padding: 8px 12px;
  background: var(--bg);
  border-top: 1px solid var(--line);
}
.composer textarea { min-height: 48px; max-height: 140px; resize: none; padding: 12px 14px; }
.send-btn { width: auto; min-height: 48px; padding: 8px 18px; }

/* ---------- Small-phone top bar, update note, dark mode contrast ---------- */

.topbar-title { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.new-tasks-pill { white-space: nowrap; }
@media (max-width: 400px) {
  .need-btn { font-size: 13px; padding: 6px 10px; }
  .topbar-title { font-size: 17px; }
}

.update-pill {
  position: fixed;
  z-index: 70;
  left: 50%;
  top: calc(72px + env(safe-area-inset-top));
  transform: translateX(-50%);
  min-height: 44px;
  padding: 8px 18px;
  border: 0;
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  font: inherit;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 4px 16px rgb(0 0 0 / 0.25);
}

@media (prefers-color-scheme: dark) {
  .btn-call-big { color: #15803d; }
  .card .btn-call, .row .btn-call { color: #06210f; }
  .new-tasks-pill { color: #1b1036; }
  .urgent-overlay, .urgent-item { background: #b71c1c; }
  .urgent-item.is-coming { background: #92400e; }
  .btn-coming, .btn-coming-big { color: #b71c1c; }
  .need-btn, .btn-send-urgent, .nav-badge { background: #c62828; }
}
