/* Hearth — Skylight-style family calendar */

:root {
  --font: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --radius: 18px;
  --radius-sm: 12px;
  --accent: #ff7a59;
  --accent-soft: rgba(255, 122, 89, 0.16);
  --gold: #ffc75f;
  /* iOS Dynamic Island / notch / home-indicator clearance when installed as a standalone app */
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
}

:root[data-theme='dark'] {
  /* warm charcoal — no blue tint */
  --bg: #151210;
  --bg-grad: radial-gradient(1200px 800px at 80% -10%, #2a211a 0%, #151210 55%);
  --card: #1e1a16;
  --card-2: #282219;
  --line: rgba(255, 244, 230, 0.08);
  --text: #f6f1ea;
  --text-dim: #a89d8f;
  --cell-hover: rgba(255, 244, 230, 0.05);
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
  --chip-text: #1d150f;
}

:root[data-theme='light'] {
  --bg: #f4f2ee;
  --bg-grad: radial-gradient(1200px 800px at 80% -10%, #ffffff 0%, #f4f2ee 55%);
  --card: #ffffff;
  --card-2: #faf8f5;
  --line: rgba(20, 24, 40, 0.08);
  --text: #262a38;
  --text-dim: #7b8194;
  --cell-hover: rgba(20, 24, 40, 0.04);
  --shadow: 0 10px 40px rgba(60, 50, 40, 0.12);
  --chip-text: #262a38;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  background-image: var(--bg-grad);
  background-attachment: fixed;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button { font-family: var(--font); cursor: pointer; border: none; background: none; color: inherit; }
input {
  font-family: var(--font);
  font-size: 1rem;
  color: var(--text);
  background: var(--card-2);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  width: 100%;
  outline: none;
  transition: border-color 0.15s;
}
input:focus { border-color: var(--accent); }
input::placeholder { color: var(--text-dim); }

.screen { height: 100dvh; width: 100vw; }
[hidden] { display: none !important; }

/* ---------- buttons ---------- */
.btn-primary {
  background: linear-gradient(135deg, var(--gold), var(--accent));
  color: #2b1408;
  font-weight: 800;
  font-size: 1rem;
  border-radius: 999px;
  padding: 13px 26px;
  box-shadow: 0 6px 20px rgba(255, 122, 89, 0.35);
  transition: transform 0.12s, box-shadow 0.12s;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 8px 26px rgba(255, 122, 89, 0.45); }
.btn-primary:active { transform: translateY(0); }
.btn-primary.round { width: 52px; height: 52px; padding: 0; font-size: 1.6rem; line-height: 1; }
.btn-ghost {
  color: var(--text-dim);
  font-weight: 700;
  border-radius: 999px;
  padding: 10px 16px;
  border: 1.5px solid var(--line);
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.btn-ghost:hover { color: var(--text); border-color: var(--text-dim); }
.btn-ghost.small { font-size: 0.85rem; padding: 8px 14px; }
.btn-danger { color: #ff8a7a; font-weight: 700; border-radius: 999px; padding: 10px 18px; border: 1.5px solid rgba(255, 138, 122, 0.4); }
.btn-danger:hover { background: rgba(255, 138, 122, 0.12); }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%;
  font-size: 1.5rem; color: var(--text-dim);
  display: grid; place-items: center;
  transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: var(--cell-hover); color: var(--text); }

/* ---------- login ---------- */
#login-screen {
  display: grid; place-items: center; overflow-y: auto;
  padding: calc(20px + var(--safe-t)) calc(20px + var(--safe-r)) calc(20px + var(--safe-b)) calc(20px + var(--safe-l));
}
.login-card {
  width: min(420px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 40px 36px;
  box-shadow: var(--shadow);
  text-align: center;
}
.logo-flame { width: 64px; height: 64px; }
.logo-flame.small { width: 30px; height: 30px; }
.logo h1 { font-size: 2.2rem; font-weight: 900; letter-spacing: -0.5px; margin-top: 4px; }
.tagline { color: var(--text-dim); margin: 6px 0 30px; font-weight: 600; }
.field-label { display: block; text-align: left; font-size: 0.82rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-dim); margin: 16px 0 8px; }
.field-label.centered { text-align: center; }
#name-continue, #reg-submit { width: 100%; margin-top: 22px; }
.login-alt { margin-top: 18px; font-size: 0.9rem; color: var(--text-dim); }
.login-alt a { color: var(--accent); font-weight: 700; text-decoration: none; }
.login-error { margin-top: 16px; color: #ff8a7a; font-weight: 700; font-size: 0.9rem; }
.pin-greeting { font-size: 1.15rem; margin-bottom: 4px; }
.pin-dots { display: flex; justify-content: center; gap: 16px; margin: 18px 0 26px; }
.pin-dot { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--text-dim); transition: all 0.15s; }
.pin-dot.filled { background: var(--accent); border-color: var(--accent); transform: scale(1.15); }
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; max-width: 260px; margin: 0 auto; }
.pin-pad button {
  height: 68px; border-radius: 50%;
  background: var(--card-2); border: 1px solid var(--line);
  font-size: 1.5rem; font-weight: 800; color: var(--text);
  transition: background 0.1s, transform 0.1s;
}
.pin-pad button:hover { background: var(--cell-hover); }
.pin-pad button:active { transform: scale(0.93); background: var(--accent-soft); }
.pin-pad .pad-aux { font-size: 1.1rem; color: var(--text-dim); }
#pin-back { margin-top: 22px; border: none; }
.register-title { font-size: 1.4rem; font-weight: 900; }
.reg-member-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.reg-member-row input[type='text'] { flex: 1; }
.color-dot-btn { width: 38px; height: 38px; min-width: 38px; border-radius: 50%; border: 3px solid var(--card); box-shadow: 0 0 0 1.5px var(--line); }
.remove-member { color: var(--text-dim); font-size: 1.2rem; padding: 6px; }
#reg-add-member { margin: 6px 0 4px; }

/* ---------- login trust note ---------- */
.trust-note { margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--line); }
.trust-subhead { font-size: 0.88rem; font-weight: 800; color: var(--text-dim); }
.trust-headline { font-size: 0.88rem; font-weight: 800; color: var(--text-dim); }
.trust-details { margin-top: 8px; font-size: 0.82rem; color: var(--text-dim); }
.trust-details summary {
  cursor: pointer; font-weight: 700; color: var(--accent);
  list-style: none; display: inline-block;
}
.trust-details summary::after { content: ' ▾'; font-size: 0.7rem; }
.trust-details[open] summary::after { content: ' ▴'; }
.trust-details ul { text-align: left; margin: 10px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 8px; line-height: 1.45; }
.trust-details strong { color: var(--text); }

/* ---------- task suggestions ---------- */
.task-suggest { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); }
.task-suggest .ts-label {
  display: block; font-size: 0.72rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--accent); margin-bottom: 8px;
}
.ts-chip {
  display: inline-block; margin: 0 6px 6px 0;
  padding: 6px 12px; border-radius: 999px;
  border: 1.5px dashed var(--text-dim);
  font-size: 0.8rem; font-weight: 700; color: var(--text-dim);
  transition: all 0.12s; text-align: left;
}
.ts-chip:hover { border-color: var(--accent); color: var(--accent); border-style: solid; background: var(--accent-soft); }

/* ---------- app layout ---------- */
#app-screen { display: flex; }
.sidebar {
  width: 250px; min-width: 250px;
  display: flex; flex-direction: column;
  padding: calc(26px + var(--safe-t)) 20px calc(26px + var(--safe-b)) calc(20px + var(--safe-l));
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--card) 55%, transparent);
  backdrop-filter: blur(10px);
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 26px; }
.brand-name { font-size: 1.35rem; font-weight: 900; letter-spacing: -0.3px; }
.sidebar-clock { margin-bottom: 28px; }
.clock-time { font-size: 2.4rem; font-weight: 900; letter-spacing: -1px; line-height: 1; }
.clock-date { color: var(--text-dim); font-weight: 700; margin-top: 6px; }
.member-filter { display: flex; flex-direction: column; gap: 6px; flex: 1; overflow-y: auto; }
.member-chip {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  font-weight: 700; color: var(--text-dim);
  transition: background 0.12s, color 0.12s;
  text-align: left;
}
.member-chip:hover { background: var(--cell-hover); }
.member-chip.active { background: var(--cell-hover); color: var(--text); }
.member-avatar {
  width: 34px; height: 34px; min-width: 34px; border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 900; font-size: 0.95rem; color: var(--chip-text);
  background-size: cover; background-position: center;
  overflow: hidden;
}
.member-avatar.photo { color: transparent; }
.section-nav { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.section-nav button {
  display: flex; align-items: center; gap: 14px;
  text-align: left; font-weight: 800; font-size: 1.05rem; color: var(--text-dim);
  padding: 14px 16px; border-radius: var(--radius);
  border: 1.5px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.12s;
}
.section-nav .sn-icon { font-size: 1.35rem; line-height: 1; }
.section-nav button:hover { background: var(--cell-hover); color: var(--text); transform: translateX(2px); }
.section-nav button.active {
  background: var(--accent-soft); color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 35%, transparent);
  box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 12%, transparent);
}
.sidebar-footer { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.sidebar-footer .btn-ghost { text-align: left; border: none; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; padding: calc(22px + var(--safe-t)) calc(26px + var(--safe-r)) calc(22px + var(--safe-b)) 26px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.topbar-title { display: flex; align-items: center; gap: 6px; }
#period-title { font-size: 1.6rem; font-weight: 900; letter-spacing: -0.5px; min-width: 200px; text-align: center; }
.topbar-actions { display: flex; align-items: center; gap: 14px; }
.view-switch { display: flex; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 4px; }
.view-switch button { padding: 8px 18px; border-radius: 999px; font-weight: 800; font-size: 0.9rem; color: var(--text-dim); }
.view-switch button.active { background: var(--accent-soft); color: var(--accent); }

/* ---------- month view ---------- */
.calendar { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.month-grid {
  flex: 1; display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-template-rows: auto repeat(6, 1fr);
  gap: 6px; min-height: 0;
}
.dow {
  text-align: center; font-size: 0.75rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-dim);
  padding: 6px 0;
}
.day-cell {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 8px;
  min-height: 0; overflow: hidden;
  display: flex; flex-direction: column; gap: 4px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.day-cell:hover { background: var(--card-2); border-color: var(--text-dim); }
.day-cell.other-month { opacity: 0.38; }
.day-num {
  font-weight: 800; font-size: 0.9rem; color: var(--text-dim);
  width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%;
}
.day-cell.today .day-num { background: linear-gradient(135deg, var(--gold), var(--accent)); color: #2b1408; }
.event-pill {
  font-size: 0.74rem; font-weight: 800;
  padding: 3px 8px; border-radius: 7px;
  color: var(--chip-text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  flex-shrink: 0;
}
.event-more { font-size: 0.72rem; font-weight: 800; color: var(--text-dim); padding-left: 4px; }

/* ---------- week view ---------- */
.week-grid { flex: 1; display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; min-height: 0; }
.week-col { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; cursor: pointer; }
.week-col.today { border-color: var(--accent); }
.week-col-head { text-align: center; margin-bottom: 4px; }
.week-col-head .wd { font-size: 0.72rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-dim); }
.week-col-head .wn { font-size: 1.5rem; font-weight: 900; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; margin: 2px auto 0; }
.week-col.today .wn { background: linear-gradient(135deg, var(--gold), var(--accent)); color: #2b1408; }
.event-card {
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  border-left: 4px solid;
  background: var(--card-2);
  cursor: pointer;
  flex-shrink: 0;
}
.event-card .ec-time { font-size: 0.7rem; font-weight: 800; color: var(--text-dim); }
.event-card .ec-title { font-size: 0.86rem; font-weight: 800; overflow: hidden; text-overflow: ellipsis; }
.ec-members { display: flex; gap: 3px; margin-top: 5px; }
.ec-members .dot { width: 9px; height: 9px; border-radius: 50%; }

/* ---------- day timeline view ---------- */
.day-wrap {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
}
.day-header {
  display: grid; grid-template-columns: var(--gutter, 64px) repeat(var(--day-cols), minmax(0, 1fr));
  padding: 14px 12px 10px 0;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 6;
  background: var(--card);
}
.day-member { text-align: center; min-width: 0; padding: 0 6px; }
.day-member .member-avatar { width: 46px; height: 46px; min-width: 46px; margin: 0 auto; font-size: 1.15rem; box-shadow: 0 0 0 3px var(--card), 0 0 0 5px var(--ring, var(--line)); }
.day-member .dm-name { font-weight: 800; font-size: 0.88rem; margin-top: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.day-allday {
  display: block; margin: 6px auto 0; max-width: 95%;
  font-size: 0.72rem; font-weight: 800; color: var(--chip-text);
  padding: 3px 10px; border-radius: 999px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  cursor: pointer;
}
.day-scroll { flex: 1; overflow: auto; }
.day-grid {
  position: relative;
  display: grid; grid-template-columns: var(--gutter, 64px) repeat(var(--day-cols), minmax(0, 1fr));
}
.time-gutter { position: relative; }
.time-label {
  position: absolute; right: 10px; transform: translateY(-50%);
  font-size: 0.72rem; font-weight: 800; color: var(--text-dim);
}
.time-label.night { font-size: 0.62rem; opacity: 0.75; }
.day-col {
  position: relative; border-left: 1px solid var(--line); cursor: pointer;
}
.hour-line {
  position: absolute; left: var(--gutter, 64px); right: 0; height: 1px;
  background: var(--line); pointer-events: none;
}
.day-block {
  position: absolute; left: 5px; right: 5px;
  border-radius: 10px; padding: 5px 9px; overflow: hidden;
  color: var(--chip-text); cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
  transition: filter 0.12s;
}
.day-block:hover { filter: brightness(1.08); }
.day-block .db-title { font-size: 0.82rem; font-weight: 800; line-height: 1.25; }
.day-block .db-time { font-size: 0.7rem; font-weight: 800; opacity: 0.75; }
.now-line {
  position: absolute; left: var(--gutter, 64px); right: 0; height: 2px;
  background: #ff4d4d; z-index: 5; pointer-events: none;
}
.now-line::before { content: ''; position: absolute; left: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: #ff4d4d; }
.now-chip {
  position: absolute; right: calc(100% + 8px); top: -9px;
  background: #ff4d4d; color: #fff; font-size: 0.68rem; font-weight: 900;
  padding: 2px 7px; border-radius: 6px; white-space: nowrap;
}

/* ---------- agenda view ---------- */
.agenda-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 18px; padding-right: 6px; }
.agenda-day-head { font-size: 0.95rem; font-weight: 900; color: var(--text-dim); position: sticky; top: 0; background: var(--bg); padding: 4px 0; }
.agenda-day-head.is-today { color: var(--accent); }
.agenda-group { display: flex; flex-direction: column; gap: 8px; }
.agenda-empty { color: var(--text-dim); font-weight: 700; text-align: center; padding: 60px 0; }

/* ---------- meals view ---------- */
.meals-wrap { flex: 1; min-height: 0; overflow: auto; }
.meals-grid {
  display: grid;
  grid-template-columns: 110px repeat(7, minmax(120px, 1fr));
  gap: 6px;
}
.meals-grid .dow { padding: 8px 0; }
.meals-grid .dow.today-dow { color: var(--accent); }
.meal-slot-label {
  display: flex; align-items: center; gap: 8px;
  font-weight: 800; font-size: 0.85rem; color: var(--text-dim);
  padding: 8px 4px;
}
.meal-cell {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  min-height: 74px; padding: 10px;
  font-weight: 700; font-size: 0.86rem;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
  display: flex; align-items: flex-start;
  word-break: break-word;
}
.meal-cell:hover { background: var(--card-2); border-color: var(--text-dim); }
.meal-cell.today-col { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.meal-cell.empty { color: var(--text-dim); font-weight: 800; align-items: center; justify-content: center; opacity: 0.5; }
.meal-cell input {
  padding: 4px 6px; font-size: 0.86rem; font-weight: 700;
  background: transparent; border: none; border-bottom: 1.5px solid var(--accent); border-radius: 0;
}

/* ---------- tasks view ---------- */
.tasks-wrap { flex: 1; min-height: 0; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; align-content: start; padding-right: 4px; }
.task-group {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px;
}
.task-group-head { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.task-group-head .tg-name { font-weight: 900; font-size: 1.05rem; flex: 1; }
.task-group-head .tg-count { font-weight: 800; font-size: 0.85rem; color: var(--text-dim); }
.task-progress { height: 8px; border-radius: 999px; background: var(--card-2); overflow: hidden; margin: 8px 0 14px; }
.task-progress-fill { height: 100%; border-radius: 999px; transition: width 0.3s ease; }
.task-row { display: flex; align-items: center; gap: 12px; padding: 7px 0; }
.task-check {
  width: 26px; height: 26px; min-width: 26px; border-radius: 50%;
  border: 2px solid var(--text-dim); background: none;
  display: grid; place-items: center;
  font-size: 0.85rem; color: transparent;
  transition: all 0.15s;
}
.task-check.done { border-color: transparent; color: var(--chip-text); }
.task-title { flex: 1; font-weight: 700; }
.task-row.done .task-title { text-decoration: line-through; opacity: 0.5; }
.task-del { color: var(--text-dim); opacity: 0; padding: 4px 8px; transition: opacity 0.15s; }
.task-row:hover .task-del { opacity: 1; }
.task-add { display: flex; gap: 8px; margin-top: 10px; }
.task-add input { padding: 9px 12px; font-size: 0.9rem; }
.tasks-empty-hint { color: var(--text-dim); font-weight: 700; font-size: 0.9rem; padding: 4px 0; }

/* ---------- avatar photo picking ---------- */
.avatar-pick { font-size: 1.05rem; padding: 6px; border-radius: 50%; }
.avatar-pick:hover { background: var(--cell-hover); }
.color-dot-btn { background-size: cover; background-position: center; }

/* ---------- modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(8, 10, 16, 0.6); backdrop-filter: blur(6px);
  display: grid; place-items: center;
  padding: calc(20px + var(--safe-t)) calc(20px + var(--safe-r)) calc(20px + var(--safe-b)) calc(20px + var(--safe-l));
}
.modal {
  width: min(480px, 100%);
  max-height: 90dvh; overflow-y: auto;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 24px; padding: 28px;
  box-shadow: var(--shadow);
}
.modal h3 { font-size: 1.3rem; font-weight: 900; margin-bottom: 16px; }
.emoji-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.emoji-row button { font-size: 1.3rem; width: 42px; height: 42px; border-radius: 50%; transition: background 0.1s, transform 0.1s; }
.emoji-row button:hover { background: var(--cell-hover); }
.emoji-row button.selected { background: var(--accent-soft); transform: scale(1.1); }
.form-row { display: flex; gap: 12px; }
.form-col { flex: 1; }
.allday-col { flex: 0 0 90px; }
.switch { position: relative; display: inline-block; width: 52px; height: 30px; margin-top: 4px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; inset: 0; border-radius: 999px; background: var(--card-2); border: 1.5px solid var(--line); transition: 0.2s; cursor: pointer; }
.slider::before { content: ''; position: absolute; width: 22px; height: 22px; border-radius: 50%; left: 3px; top: 2.5px; background: var(--text-dim); transition: 0.2s; }
.switch input:checked + .slider { background: var(--accent-soft); border-color: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(21px); background: var(--accent); }
.select-input {
  font-family: var(--font); font-size: 1rem; font-weight: 700;
  color: var(--text); background: var(--card-2);
  border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px 14px; width: 100%; outline: none; cursor: pointer;
}
.select-input:focus { border-color: var(--accent); }
.repeat-toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.repeat-toggle-row .field-label { margin: 10px 0; }
#repeat-options { padding: 4px 0 8px; }
.dow-picker { display: flex; gap: 8px; justify-content: space-between; }
.dow-picker button {
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--card-2); border: 1.5px solid var(--line);
  font-weight: 900; font-size: 0.9rem; color: var(--text-dim);
  transition: all 0.12s;
}
.dow-picker button:hover { border-color: var(--text-dim); }
.dow-picker button.selected {
  background: linear-gradient(135deg, var(--gold), var(--accent));
  border-color: transparent; color: #2b1408;
}
.member-picker { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.picker-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 14px 7px 8px; border-radius: 999px;
  border: 1.5px solid var(--line); font-weight: 800; font-size: 0.88rem; color: var(--text-dim);
  transition: all 0.12s;
}
.picker-chip .member-avatar { width: 26px; height: 26px; min-width: 26px; font-size: 0.75rem; }
.picker-chip.selected { color: var(--text); border-color: currentColor; }
#ev-title { font-size: 1.15rem; font-weight: 700; margin-bottom: 4px; }
#ev-notes { margin-top: 4px; }
.modal-actions { display: flex; align-items: center; gap: 10px; margin-top: 22px; }
.spacer { flex: 1; }
.settings-row { display: flex; align-items: center; justify-content: space-between; margin-top: 20px; font-weight: 700; }
.install-lead { color: var(--text-dim); font-weight: 600; line-height: 1.5; margin-bottom: 16px; }
.install-steps { list-style: none; display: flex; flex-direction: column; gap: 14px; }
.install-steps li { display: flex; align-items: center; gap: 14px; font-weight: 700; line-height: 1.4; }
.install-step-icon {
  flex-shrink: 0; width: 38px; height: 38px; border-radius: 50%;
  background: var(--card-2); border: 1.5px solid var(--line);
  display: grid; place-items: center; font-size: 1.1rem; color: var(--accent);
}
.install-steps strong { color: var(--accent); }
#settings-members .reg-member-row { margin-top: 8px; }

/* ---------- display (always-on) mode ---------- */
#display-screen {
  display: flex; align-items: stretch;
  padding: calc(6vh + var(--safe-t)) calc(6vw + var(--safe-r)) calc(6vh + var(--safe-b)) calc(6vw + var(--safe-l));
  gap: 6vw;
  cursor: none;
}
#display-screen:hover { cursor: default; }
.display-left { flex: 0 0 42%; display: flex; flex-direction: column; justify-content: center; }
.display-clock { font-size: clamp(4rem, 11vw, 10rem); font-weight: 900; letter-spacing: -4px; line-height: 0.95; }
.display-ampm { font-size: clamp(1.2rem, 2.5vw, 2rem); font-weight: 800; color: var(--accent); margin-top: 8px; }
.display-date { font-size: clamp(1.1rem, 2.2vw, 1.8rem); font-weight: 700; color: var(--text-dim); margin-top: 18px; }
.display-family { font-size: clamp(0.9rem, 1.6vw, 1.2rem); font-weight: 800; margin-top: 30px; color: var(--text-dim); }
.display-family strong { background: linear-gradient(135deg, var(--gold), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.display-right { flex: 1; display: flex; flex-direction: column; justify-content: center; min-width: 0; overflow: hidden; }
.display-heading {
  font-size: clamp(1rem, 1.8vw, 1.4rem); font-weight: 900;
  text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--accent); margin-bottom: 14px;
}
.display-heading.dim { color: var(--text-dim); margin-top: 34px; }
.display-events { display: flex; flex-direction: column; gap: 10px; }
.display-events.dim { opacity: 0.6; }
.display-event {
  display: flex; align-items: center; gap: 16px;
  background: color-mix(in srgb, var(--card) 80%, transparent);
  border: 1px solid var(--line);
  border-left: 5px solid;
  border-radius: var(--radius);
  padding: 14px 18px;
}
.display-event .de-time { font-size: clamp(0.85rem, 1.4vw, 1.1rem); font-weight: 800; color: var(--text-dim); min-width: 90px; }
.display-event .de-title { font-size: clamp(1rem, 1.8vw, 1.4rem); font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.display-event .de-members { display: flex; gap: 5px; margin-left: auto; }
.display-event .de-members .member-avatar { width: 30px; height: 30px; min-width: 30px; font-size: 0.8rem; }
.display-empty { color: var(--text-dim); font-weight: 700; font-size: clamp(0.95rem, 1.6vw, 1.25rem); padding: 10px 4px; }
.display-meals {
  margin-top: 30px; padding-top: 18px; border-top: 1px solid var(--line);
  font-weight: 700; color: var(--text-dim);
  font-size: clamp(0.9rem, 1.5vw, 1.15rem);
  display: flex; flex-wrap: wrap; gap: 8px 22px;
}
.display-meals strong { color: var(--text); font-weight: 800; }
.exit-display {
  position: fixed; top: calc(18px + var(--safe-t)); right: calc(18px + var(--safe-r));
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--card); border: 1px solid var(--line); color: var(--text-dim);
  opacity: 0; transition: opacity 0.3s;
}
#display-screen:hover .exit-display { opacity: 0.8; }

/* ---------- toast ---------- */
.toast {
  position: fixed; bottom: calc(28px + var(--safe-b)); left: 50%; transform: translateX(-50%);
  max-width: calc(100vw - 32px);
  background: var(--card); border: 1px solid var(--line);
  border-radius: 999px; padding: 12px 24px;
  font-weight: 800; box-shadow: var(--shadow); z-index: 100;
}

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  body { overflow: auto; }
  #app-screen { flex-direction: column; height: auto; min-height: 100dvh; }
  .sidebar {
    width: 100%; min-width: 0; flex-direction: row; align-items: center; flex-wrap: wrap;
    padding: calc(12px + var(--safe-t)) calc(16px + var(--safe-r)) 12px calc(16px + var(--safe-l));
    gap: 10px; border-right: none; border-bottom: 1px solid var(--line);
    position: sticky; top: 0; z-index: 10;
  }
  .sidebar-brand { margin-bottom: 0; margin-right: auto; }
  .sidebar-clock { display: none; }
  .member-filter { order: 3; flex: 1 1 100%; flex-direction: row; overflow-x: auto; overflow-y: hidden; }
  .member-chip { padding: 5px 12px 5px 6px; flex-shrink: 0; border: 1.5px solid var(--line); border-radius: 999px; }
  .member-chip .member-avatar { width: 26px; height: 26px; min-width: 26px; font-size: 0.78rem; }
  .sidebar-footer { flex-direction: row; margin-top: 0; gap: 2px; }
  .sidebar-footer .btn-ghost { white-space: nowrap; }
  .sidebar-footer .btn-ghost { padding: 6px 8px; }
  .main { padding: 14px calc(14px + var(--safe-r)) calc(14px + var(--safe-b)) calc(14px + var(--safe-l)); }
  .calendar { min-height: 70dvh; }
  #period-title { font-size: 1.15rem; min-width: 0; }
  .month-grid { gap: 3px; }
  .day-cell { padding: 4px; border-radius: 8px; }
  .event-pill { font-size: 0.6rem; padding: 2px 4px; }
  .week-grid { grid-template-columns: 1fr; }
  .day-wrap { --gutter: 52px; }
  .day-header, .day-grid { grid-template-columns: var(--gutter) repeat(var(--day-cols), minmax(118px, 1fr)); }
  .calendar:has(.day-wrap) { min-height: 78dvh; }
  .section-nav { flex-direction: row; margin-top: 0; padding-top: 0; border-top: none; order: 2; }
  .section-nav button { padding: 7px 12px; font-size: 0.9rem; white-space: nowrap; gap: 7px; border-radius: 999px; }
  .section-nav .sn-icon { font-size: 1.05rem; }
  .section-nav button:hover { transform: none; }
  .meals-grid { grid-template-columns: 84px repeat(7, minmax(130px, 1fr)); }
  .tasks-wrap { grid-template-columns: 1fr; }
  #display-screen {
    flex-direction: column; gap: 4vh; overflow-y: auto;
    padding: calc(8vh + var(--safe-t)) calc(8vw + var(--safe-r)) calc(8vh + var(--safe-b)) calc(8vw + var(--safe-l));
  }
  .display-left { flex: none; }
}
