/* Familje-OS — visual system
   Calm, light base with white rounded cards, thin lines, heavy headings
   (Manrope 800) and big tap targets. A seasonal accent colors the details:
   autumn = warm rust, which the family likes. Dark mode follows the phone. */

:root {
  /* Without this, native controls (date/time pickers, checkboxes) render as
     if on a light background even in dark mode — on iOS that made the date
     placeholder invisible. */
  color-scheme: light dark;

  --bg: #f4f5f2;
  --surface: #ffffff;
  --surface-alt: #eceee9;
  --text: #141a1f;
  --text-muted: #5b6670;
  --border: #dde1db;
  --accent: #3b6e5e;
  --accent-soft: #dceae3;
  --accent-ink: #1f4438;
  --on-accent: #ffffff;
  --coral: #c2496a;
  --coral-soft: #f9e1e7;
  --danger: #b3261e;
  --danger-soft: #fbe4e2;
  --ok: #1e7a46;
  --ok-soft: #e3f3e8;
  --warn: #8a5a00;
  --warn-soft: #fff1d6;
  --overlay: rgba(14, 16, 17, 0.42);

  --radius-lg: 22px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(20, 26, 31, 0.04);
  --shadow-lift: 0 12px 32px -12px rgba(20, 26, 31, 0.28);
  --font-display: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --tap: 48px;

  /* Per-person palette, cycled by member index */
  --m0: var(--accent);
  --m0-soft: var(--accent-soft);
  --m1: var(--coral);
  --m1-soft: var(--coral-soft);
  --m2: #9a6a1c;
  --m2-soft: #f5e7cc;
  --m3: #4d62a3;
  --m3-soft: #e0e5f6;
}

/* Seasonal accent + a faint tint of the background (light mode) */
:root[data-season="var"]    { --accent: #3f7f52; --accent-soft: #dcefe1; --accent-ink: #1e4429; --bg: #f3f5f0; --surface-alt: #e8ede4; }
:root[data-season="sommar"] { --accent: #2f7d3a; --accent-soft: #e0f2dc; --accent-ink: #1d4a1f; --bg: #f4f5ef; --surface-alt: #e9ede2; }
:root[data-season="host"]   { --accent: #a84b22; --accent-soft: #f6e0cf; --accent-ink: #5c2a10; --bg: #f6f3ee; --surface-alt: #eee7de; --border: #e3dcd2; }
:root[data-season="vinter"] { --accent: #2a6670; --accent-soft: #d9eaec; --accent-ink: #143a40; --bg: #f1f4f4; --surface-alt: #e4eaeb; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1011;
    --surface: #181c1e;
    --surface-alt: #22282a;
    --text: #eceee9;
    --text-muted: #a3aba7;
    --border: #2c3432;
    --accent: #6fae98;
    --accent-soft: #1f3a32;
    --accent-ink: #cfeee2;
    --on-accent: #0e1011;
    --coral: #ec8fa6;
    --coral-soft: #43222b;
    --danger: #f2938c;
    --danger-soft: #3f1c19;
    --ok: #7fd6a1;
    --ok-soft: #16311f;
    --warn: #f2c56b;
    --warn-soft: #3a2e12;
    --overlay: rgba(0, 0, 0, 0.6);
    --shadow: none;
    --shadow-lift: 0 12px 32px -12px rgba(0, 0, 0, 0.7);
    --m2: #d9ad5f;
    --m2-soft: #3d311b;
    --m3: #93a3dd;
    --m3-soft: #262d48;
  }
  :root:not([data-theme="light"])[data-season="var"]    { --accent: #7dc296; --accent-soft: #1f3826; --accent-ink: #d7f0dd; --bg: #0d100e; --surface-alt: #212823; }
  :root:not([data-theme="light"])[data-season="sommar"] { --accent: #7ecb6f; --accent-soft: #213f20; --accent-ink: #dff5da; --bg: #0d100d; --surface-alt: #212822; }
  :root:not([data-theme="light"])[data-season="host"]   { --accent: #ec9a66; --accent-soft: #42291a; --accent-ink: #f8e0cb; --bg: #110e0c; --surface: #1c1816; --surface-alt: #29231f; --border: #372f2a; }
  :root:not([data-theme="light"])[data-season="vinter"] { --accent: #6fb6bf; --accent-soft: #1e3639; --accent-ink: #d8eef0; --bg: #0c0f10; --surface-alt: #20282a; }
}
:root[data-theme="dark"] {
  --bg: #0e1011; --surface: #181c1e; --surface-alt: #22282a; --text: #eceee9; --text-muted: #a3aba7; --border: #2c3432;
  --accent: #6fae98; --accent-soft: #1f3a32; --accent-ink: #cfeee2; --on-accent: #0e1011;
  --coral: #ec8fa6; --coral-soft: #43222b; --danger: #f2938c; --danger-soft: #3f1c19; --ok: #7fd6a1; --ok-soft: #16311f;
  --warn: #f2c56b; --warn-soft: #3a2e12; --overlay: rgba(0, 0, 0, 0.6); --shadow: none; --shadow-lift: 0 12px 32px -12px rgba(0, 0, 0, 0.7);
  --m2: #d9ad5f; --m2-soft: #3d311b; --m3: #93a3dd; --m3-soft: #262d48;
}
:root[data-theme="dark"][data-season="var"]    { --accent: #7dc296; --accent-soft: #1f3826; --accent-ink: #d7f0dd; --bg: #0d100e; --surface-alt: #212823; }
:root[data-theme="dark"][data-season="sommar"] { --accent: #7ecb6f; --accent-soft: #213f20; --accent-ink: #dff5da; --bg: #0d100d; --surface-alt: #212822; }
:root[data-theme="dark"][data-season="host"]   { --accent: #ec9a66; --accent-soft: #42291a; --accent-ink: #f8e0cb; --bg: #110e0c; --surface: #1c1816; --surface-alt: #29231f; --border: #372f2a; }
:root[data-theme="dark"][data-season="vinter"] { --accent: #6fb6bf; --accent-soft: #1e3639; --accent-ink: #d8eef0; --bg: #0c0f10; --surface-alt: #20282a; }

/* ---------- Base ---------- */

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  height: 100%;
}
html { -webkit-text-size-adjust: 100%; }
body {
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

/* 16px minimum on inputs keeps iOS from zooming in on focus. */
button, input, select, textarea {
  font-family: inherit;
  font-size: 16px;
  color: inherit;
}
button { cursor: pointer; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; }

h1, h2, h3 { letter-spacing: -0.03em; line-height: 1.15; }
.muted { color: var(--text-muted); }
.no-margin { margin: 0; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- App shell ---------- */

.app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-width: 600px;
  margin: 0 auto;
  background: var(--bg);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px 20px;
  background: var(--bg);
}

.brand {
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -0.035em;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.me-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 4px 4px 4px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  flex-shrink: 0;
}
.me { font-size: 15px; font-weight: 700; }
.me-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--surface-alt);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.me-icon svg { width: 19px; height: 19px; }

.icon-btn {
  background: none;
  border: none;
  font-size: 18px;
  color: var(--text-muted);
  min-width: 44px;
  min-height: 44px;
  padding: 6px;
  line-height: 1;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.views {
  flex: 1;
  overflow-y: auto;
  padding: 8px 16px calc(96px + env(safe-area-inset-bottom));
}

.view-title {
  font-size: 30px;
  font-weight: 800;
  margin: 6px 4px 4px;
  text-wrap: balance;
}

.view-date {
  color: var(--text-muted);
  margin: 0 4px 18px;
  font-size: 16px;
  font-weight: 600;
}

/* ---------- Cards ---------- */

.card-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px 8px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}

.block-title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
  color: var(--text);
}

.stat-line { font-size: 15px; color: var(--text-muted); margin: 0 0 12px; }
.empty-hint { color: var(--text-muted); font-size: 15px; padding: 4px 2px 14px; }

.chip-row { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.chip-row li { font-size: 13px; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: var(--surface-alt); }
.chip-row li.more { color: var(--text-muted); background: none; }

/* ---------- Lists ---------- */

.list, .agenda-list { list-style: none; margin: 0; padding: 0; }

.list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.list li:last-child { border-bottom: none; }

.list li.task-group-header {
  display: block;
  border-bottom: none;
  padding: 18px 0 4px;
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.list li.task-group-header:first-child { padding-top: 2px; }

.list li.task-row { display: block; }
.task-row-top { display: flex; align-items: center; gap: 12px; }
.task-row-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
  padding-left: 40px; /* check (28) + gap (12) */
}
.task-row-meta .delete-btn { margin-left: auto; }

.check {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--text-muted) 45%, transparent);
  background: var(--surface);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--on-accent);
  font-size: 15px;
  font-weight: 800;
  padding: 0;
  line-height: 1;
  position: relative;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
/* Invisible 44px hit area around the 28px circle. */
.check::before { content: ""; position: absolute; inset: -8px; }
.check.checked { background: var(--accent); border-color: var(--accent); }

.item-title {
  flex: 1;
  font-size: 16px;
  font-weight: 600;
  min-width: 0;
  word-break: break-word;
  cursor: pointer;
}
.item-title.done { color: var(--text-muted); text-decoration: line-through; font-weight: 500; }
.item-meta { font-size: 13px; color: var(--text-muted); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 700;
  padding: 3px 10px 3px 3px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  white-space: nowrap;
  border: none;
  font-family: inherit;
}
.pill.tag-only { padding: 4px 10px; background: var(--surface-alt); color: var(--text-muted); }
.pill.m0 { background: var(--m0-soft); color: var(--m0); }
.pill.m1 { background: var(--m1-soft); color: var(--m1); }
.pill.m2 { background: var(--m2-soft); color: var(--m2); }
.pill.m3 { background: var(--m3-soft); color: var(--m3); }
.pill.prio-idag { background: var(--accent-soft); color: var(--accent-ink); }
.pill.prio-snart { background: var(--coral-soft); color: var(--coral); }
.pill.prio-senare { background: var(--m2-soft); color: var(--m2); }
.pill.prio-framtid { background: var(--m3-soft); color: var(--m3); }
button.pill { min-height: 30px; }

.avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  color: var(--on-accent);
  flex-shrink: 0;
  background: var(--m0);
}
.avatar.m0 { background: var(--m0); }
.avatar.m1 { background: var(--m1); }
.avatar.m2 { background: var(--m2); }
.avatar.m3 { background: var(--m3); }
.avatar-lg { width: 44px; height: 44px; font-size: 18px; }

.delete-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 15px;
  min-width: 40px;
  min-height: 40px;
  padding: 0;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.delete-btn:hover, .delete-btn:active { color: var(--danger); background: var(--danger-soft); }

.reminder-btn {
  background: none;
  border: none;
  font-size: 16px;
  min-width: 40px;
  min-height: 40px;
  padding: 0;
  border-radius: 50%;
  flex-shrink: 0;
  opacity: 0.4;
  filter: grayscale(1);
}
.reminder-btn.active { opacity: 1; filter: none; }

.drag-handle {
  flex-shrink: 0;
  color: var(--text-muted);
  font-size: 18px;
  line-height: 1;
  cursor: grab;
  padding: 8px 2px;
  touch-action: none;
}
.drag-handle:active { cursor: grabbing; }
.list .sortable-ghost { opacity: 0.4; }
.list li.sortable-chosen { background: var(--surface-alt); }

.shopping-checked-block { margin-top: 24px; }
.block-title-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  padding: 8px 4px;
  min-height: 44px;
  color: var(--text-muted);
}
.shopping-checked-block .block-title { color: var(--text-muted); font-size: 15px; }

/* ---------- Agenda ---------- */

.agenda-list li {
  display: flex;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
}
.agenda-list li:last-child { border-bottom: none; }

.agenda-date {
  width: 46px;
  flex-shrink: 0;
  text-align: center;
  background: var(--surface-alt);
  border-radius: var(--radius-sm);
  padding: 5px 0 6px;
}
.agenda-date .dow {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  display: block;
}
.agenda-date .dom {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  display: block;
}

.agenda-body { flex: 1; min-width: 0; }
.agenda-title { font-weight: 700; font-size: 16px; }
.agenda-time { font-size: 14px; color: var(--text-muted); margin-top: 2px; }
.agenda-tags { margin-top: 6px; display: flex; gap: 6px; flex-wrap: wrap; }
.agenda-tags:empty { display: none; }
.agenda-notes { margin-top: 4px; font-size: 14px; color: var(--text-muted); }

.agenda-list li.agenda-group-header {
  display: block;
  border-bottom: none;
  padding: 18px 0 2px;
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.agenda-list li.agenda-group-header:first-child { padding-top: 2px; }
.agenda-list li.agenda-group-header.is-today { color: var(--accent); }
.agenda-list li.agenda-day-empty {
  display: block;
  border-bottom: none;
  padding: 2px 0 8px;
  font-size: 14px;
  color: var(--text-muted);
}

/* ---------- Calendar grids ---------- */

.month-grid-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.month-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 12px; }
.month-cell {
  aspect-ratio: 1;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--text);
  padding: 0;
}
.month-cell.is-outside { opacity: 0.35; }
.month-cell.is-today { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.month-cell.is-today .month-cell-dot { background: var(--on-accent); }
.month-cell-num { font-size: 15px; font-weight: 700; }
.month-cell-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }

.year-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.year-cell {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 16px 8px;
  min-height: 76px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.year-cell-name { font-weight: 700; color: var(--text); font-size: 15px; }
.year-cell-count {
  font-size: 12px;
  font-weight: 800;
  color: var(--accent-ink);
  background: var(--accent-soft);
  padding: 2px 9px;
  border-radius: 999px;
}

/* ---------- Forms ---------- */

.add-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow);
}
.add-form.inline-form { flex-direction: row; flex-wrap: wrap; }

.add-form input, .add-form select, .add-form textarea,
.field input, .field select, .field textarea,
.search-input, .setting-inline-form input, .dialog-card input, .dialog-card select, .modal-card input {
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  min-height: var(--tap);
  min-width: 0;
  width: 100%;
  color: var(--text);
}
.add-form input, .add-form select { flex: 1; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.add-form textarea { font-size: 16px; resize: vertical; }
.inline-form input#shopping-name { flex: 2 1 160px; }
.qty-input { flex: 1 1 80px !important; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; min-width: 0; }

.field, .field-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-muted);
  min-width: 0;
}
.field-label { flex: 1; }
.field-label input { width: 100%; }

.checkbox-inline {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  min-height: 40px;
}
input[type="checkbox"] { accent-color: var(--accent); width: 20px; height: 20px; margin: 0; }

#event-end-date-field { border-left: 2px solid var(--border); padding-left: 12px; margin-left: 2px; }

/* ---------- Buttons ---------- */

.primary-btn, .secondary-btn, .ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 16px;
  text-decoration: none;
  transition: transform 0.08s ease;
}
.primary-btn { background: var(--accent); color: var(--on-accent); border: 1px solid var(--accent); }
.secondary-btn { background: var(--surface-alt); color: var(--text); border: 1px solid var(--border); }
.primary-btn:active, .secondary-btn:active, .ghost-btn:active { transform: translateY(1px); }
.primary-btn.full { width: 100%; margin-top: 10px; }
.primary-btn.small, .secondary-btn.small { min-height: 44px; padding: 8px 16px; }

/* "Add more"-style toggles: quiet, full width, dashed outline. */
.ghost-btn {
  background: none;
  border: 1.5px dashed var(--border);
  color: var(--text-muted);
  width: 100%;
  font-size: 15px;
}
.ghost-btn.small { width: auto; min-height: 44px; padding: 8px 14px; }

.danger-text { color: var(--danger) !important; }

.promote-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
  min-height: 40px;
  padding: 4px 6px;
}

button:disabled { opacity: 0.55; cursor: default; }

/* A button mid-request: text hidden (keeps width), spinner in its color. */
button.is-loading { position: relative; color: transparent !important; }
button.is-loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border: 2px solid var(--text-muted);
  border-right-color: transparent;
  border-radius: 50%;
  animation: btn-spin 0.6s linear infinite;
}
.primary-btn.is-loading::after { border-color: var(--on-accent); border-right-color: transparent; }
@keyframes btn-spin { to { transform: rotate(360deg); } }

/* ---------- Tab bar ---------- */

.tabbar {
  display: flex;
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  position: sticky;
  bottom: 0;
}
.tab-btn {
  flex: 1;
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  min-height: 52px;
  padding: 4px 0;
}
.tab-icon { width: 26px; height: 26px; }
.tab-btn.active { color: var(--accent); }
.tab-btn.active .tab-icon { stroke-width: 2.3; }

/* ---------- Auth ---------- */

.auth-screen {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: calc(24px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom));
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 22px;
}
.auth-brand {
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
}
.auth-card h1 { font-size: 28px; font-weight: 800; margin: 0 0 6px; text-wrap: balance; }
.auth-sub { color: var(--text-muted); margin: 0 0 14px; font-size: 16px; }
.auth-card label {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-muted);
  margin-top: 16px;
}
.auth-card input, .auth-card select {
  display: block;
  width: 100%;
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  min-height: 52px;
  margin-top: 6px;
  font-size: 18px;
}
.auth-error { color: var(--danger); font-size: 15px; font-weight: 600; margin: 10px 0 0; }
.auth-success { color: var(--ok); font-size: 15px; font-weight: 600; margin: 10px 0 0; }
.auth-error.pad, .auth-success.pad { padding: 0 16px 14px; }

/* ---------- Modals & dialogs ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 50;
  animation: fade-in 0.15s ease;
}
.dialog-backdrop { z-index: 80; }
.modal-card {
  width: 100%;
  max-width: 420px;
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 20px 18px;
  box-shadow: var(--shadow-lift);
  animation: pop-in 0.18s ease;
}
.modal-card h2 { font-size: 22px; font-weight: 800; margin: 0 0 14px; }
.modal-card label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 700; color: var(--text-muted); margin-bottom: 12px; }
.modal-card label.checkbox-inline { flex-direction: row; color: var(--text); }
.modal-card select { border: 1px solid var(--border); background: var(--bg); border-radius: var(--radius-md); padding: 12px 14px; min-height: var(--tap); width: 100%; }
.modal-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.modal-actions > * { flex: 1 1 auto; }
.modal-actions .ghost-btn { margin-top: 0; }
.modal-subheading { font-size: 15px; font-weight: 800; margin: 18px 0 4px; }
.modal-hint { font-size: 14px; color: var(--text-muted); margin: 0 0 10px; }

.dialog-message { margin: -4px 0 14px; color: var(--text-muted); font-size: 16px; }
.dialog-card .field { margin-bottom: 12px; }
.primary-btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }

/* Bottom sheet (Inställningar): full screen on a phone, a centered panel on
   a wide screen. */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fade-in 0.15s ease;
}
.sheet {
  width: 100%;
  max-width: 600px;
  height: calc(100dvh - env(safe-area-inset-top) - 10px);
  background: var(--bg);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: sheet-up 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 12px 10px 20px;
  border-bottom: 1px solid var(--border);
}
.sheet-head h2 { font-size: 24px; font-weight: 800; margin: 0; }
.sheet-done {
  background: none;
  border: none;
  color: var(--accent);
  font-weight: 800;
  font-size: 17px;
  min-height: 44px;
  padding: 0 12px;
}
.sheet-body {
  flex: 1;
  overflow-y: auto;
  padding: 6px 16px calc(32px + env(safe-area-inset-bottom));
}
@media (min-width: 640px) {
  .sheet-backdrop { align-items: center; }
  .sheet { height: min(820px, calc(100dvh - 48px)); border-radius: var(--radius-lg); }
}

/* ---------- Settings ---------- */

.settings-group { margin-top: 22px; }
.settings-group-title {
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin: 0 4px 6px;
}
.settings-group-hint { font-size: 14px; color: var(--text-muted); margin: 0 4px 8px; }
.settings-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.settings-me { display: flex; align-items: center; gap: 14px; padding: 16px; border-bottom: 1px solid var(--border); }
.settings-me-text { display: flex; flex-direction: column; min-width: 0; }
.settings-me-text strong { font-size: 18px; font-weight: 800; letter-spacing: -0.02em; }
.settings-me-text .muted { font-size: 14px; }

/* One row in a settings card. Works as <details>, <button> or <div>. */
.setting-item { display: block; border-bottom: 1px solid var(--border); }
.setting-item:last-child { border-bottom: none; }
.setting-item > summary, .setting-action, .setting-static, .setting-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 10px 16px;
  list-style: none;
  cursor: pointer;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--text);
  font: inherit;
}
.setting-action { border-bottom: 1px solid var(--border); }
.setting-action:last-child { border-bottom: none; }
.setting-static { cursor: default; }
.setting-item > summary::-webkit-details-marker { display: none; }
.setting-item[open] > summary { background: color-mix(in srgb, var(--surface-alt) 55%, transparent); }

.setting-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 16px;
}
.setting-icon svg { width: 20px; height: 20px; }
.tone-1 { background: var(--m3-soft); color: var(--m3); }
.tone-2 { background: var(--m1-soft); color: var(--m1); }
.tone-3 { background: var(--accent-soft); color: var(--accent-ink); }
.tone-4 { background: var(--m2-soft); color: var(--m2); }

.setting-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.setting-label { font-size: 16px; font-weight: 700; }
.setting-sub { font-size: 14px; color: var(--text-muted); overflow-wrap: anywhere; }

.chevron {
  width: 9px;
  height: 9px;
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  transform: rotate(-45deg);
  flex-shrink: 0;
  margin: 0 4px 0 auto;
  transition: transform 0.15s ease;
}
details[open] > summary .chevron { transform: rotate(45deg); }

.setting-body { display: flex; flex-direction: column; gap: 12px; padding: 4px 16px 16px; }
details > .setting-body { padding-top: 12px; }
.hint { font-size: 15px; color: var(--text-muted); margin: 0; }
.hint.small { font-size: 14px; }

.status-pill {
  font-size: 13px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
  background: var(--surface-alt);
  color: var(--text-muted);
  flex-shrink: 0;
}
.status-pill.ok { background: var(--ok-soft); color: var(--ok); }
.status-pill.warn { background: var(--warn-soft); color: var(--warn); }
.status-pill.bad { background: var(--danger-soft); color: var(--danger); }

.setting-inline-form { display: flex; gap: 8px; padding: 12px 16px 16px; }
.setting-inline-form input { flex: 1; }
.setting-inline-form .secondary-btn { flex-shrink: 0; }

/* Family list inside settings */
.people-list { list-style: none; margin: 0; padding: 0; }
.people-list > li { border-bottom: 1px solid var(--border); }
.person-row > summary { gap: 12px; }
.person-row .avatar { width: 36px; height: 36px; font-size: 15px; }
.person-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 16px 16px 64px; }
.person-actions .secondary-btn { min-height: 44px; padding: 8px 14px; font-size: 15px; }

/* iOS-style switch on a checkbox */
.switch {
  appearance: none;
  -webkit-appearance: none;
  width: 52px !important;
  height: 32px !important;
  border-radius: 999px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  position: relative;
  flex-shrink: 0;
  cursor: pointer;
  transition: background 0.18s ease;
}
.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.18s ease;
}
.switch:checked { background: var(--accent); border-color: var(--accent); }
.switch:checked::after { transform: translateX(20px); }

/* ---------- Kid mode ---------- */

.kid-app {
  max-width: 640px;
  margin: 0 auto;
  min-height: 100dvh;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}
.kid-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(16px + env(safe-area-inset-top)) 20px 12px 24px;
}
.kid-greeting { font-size: 32px; font-weight: 800; letter-spacing: -0.035em; text-wrap: balance; }
.kid-logout { font-size: 22px; }

.kid-main {
  flex: 1;
  overflow-y: auto;
  padding: 4px 16px calc(32px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.kid-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 26px;
  padding: 18px;
}
.kid-section-title { font-size: 21px; font-weight: 800; letter-spacing: -0.02em; margin: 0 0 12px; }

.kid-task-list, .kid-agenda-list, .kid-meal-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.kid-task-item {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface-alt);
  border-radius: 18px;
  padding: 16px;
  min-height: 72px;
  cursor: pointer;
  transition: transform 0.1s ease;
}
.kid-task-item:active { transform: scale(0.98); }
.kid-check {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 3px solid color-mix(in srgb, var(--text-muted) 40%, transparent);
  background: var(--surface);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 800;
  color: var(--on-accent);
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.kid-check.checked { background: var(--accent); border-color: var(--accent); }
.kid-check.pop { animation: check-pop 0.35s ease; }
.kid-task-title { font-size: 20px; font-weight: 700; }
.kid-task-title.done { color: var(--text-muted); text-decoration: line-through; }

.kid-agenda-item {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 12px;
  background: var(--surface-alt);
  border-radius: 18px;
  padding: 14px 16px;
}
.kid-agenda-day { font-weight: 800; color: var(--accent); font-size: 14px; text-transform: uppercase; letter-spacing: 0.04em; flex-shrink: 0; }
.kid-agenda-title { font-size: 18px; font-weight: 700; }
.kid-agenda-time { font-size: 15px; color: var(--text-muted); font-weight: 600; }

.kid-week-label { font-size: 14px; color: var(--text-muted); margin: -6px 0 10px; font-weight: 700; }
.kid-meal-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--surface-alt);
  border-radius: 18px;
  padding: 14px 16px;
}
.kid-meal-day { font-weight: 800; color: var(--accent); font-size: 14px; text-transform: uppercase; width: 42px; flex-shrink: 0; padding-top: 2px; }
.kid-meal-title { font-size: 18px; font-weight: 700; white-space: pre-line; }
.kid-meal-item.is-today { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }

.kid-empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 18px 4px; color: var(--text-muted); }
.kid-empty-icon { font-size: 36px; }
.kid-empty p { margin: 0; font-size: 17px; font-weight: 600; }

/* ---------- Today: progress ---------- */

.progress-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.progress-count { font-size: 14px; font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; }
.progress-track { height: 10px; border-radius: 999px; background: var(--surface-alt); overflow: hidden; margin-bottom: 14px; }
.progress-fill { height: 100%; border-radius: 999px; background: var(--accent); width: 0%; transition: width 0.4s ease; }

/* ---------- Empty states ---------- */

.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 18px 8px 20px; color: var(--text-muted); }
.empty-state .empty-icon { font-size: 30px; }
.empty-state p { margin: 0; font-size: 15px; font-weight: 600; }

/* ---------- Animations ---------- */

.check.pop { animation: check-pop 0.32s ease; }
@keyframes check-pop { 0% { transform: scale(1); } 40% { transform: scale(1.22); } 100% { transform: scale(1); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0.6; } to { transform: none; opacity: 1; } }
@keyframes toast-in { from { opacity: 0; transform: translateX(-50%) translateY(8px); } to { opacity: 1; transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(92px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 700;
  box-shadow: var(--shadow-lift);
  z-index: 100;
  width: max-content;
  max-width: calc(100% - 32px);
  display: flex;
  align-items: center;
  gap: 14px;
  animation: toast-in 0.2s ease;
}
.toast.toast-error { background: var(--danger); color: #fff; }
.toast.toast-success { background: var(--text); color: var(--bg); }
.toast-undo-btn {
  background: none;
  border: none;
  color: inherit;
  font-weight: 800;
  text-decoration: underline;
  min-height: 32px;
  padding: 0 2px;
}

/* ---------- List tabs, segmented, chips ---------- */

.list-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin: 0 -16px 14px;
  padding-left: 16px;
  padding-right: 16px;
  scrollbar-width: none;
}
.list-tabs::-webkit-scrollbar { display: none; }
.list-tab {
  flex-shrink: 0;
  min-height: 40px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-weight: 700;
  font-size: 15px;
  white-space: nowrap;
}
.list-tab.active { background: var(--text); border-color: var(--text); color: var(--bg); }
.list-tab.add-tab { border-style: dashed; color: var(--text-muted); background: none; }

.segmented {
  display: flex;
  background: var(--surface-alt);
  border-radius: var(--radius-md);
  padding: 4px;
  margin-bottom: 16px;
  gap: 4px;
}
.segmented-btn {
  flex: 1;
  border: none;
  background: none;
  min-height: 40px;
  padding: 6px 0;
  border-radius: calc(var(--radius-md) - 4px);
  font-weight: 700;
  font-size: 15px;
  color: var(--text-muted);
}
.segmented-btn.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(20, 26, 31, 0.12); }
.add-form .segmented { margin-bottom: 0; }

.chip-select { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-toggle {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  border-radius: 999px;
  min-height: 40px;
  padding: 7px 16px;
  font-size: 15px;
  font-weight: 700;
}
.chip-toggle.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); }

/* ---------- Week navigation ---------- */

.week-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.week-nav .icon-btn { font-size: 26px; color: var(--text); background: var(--surface); border: 1px solid var(--border); }
.week-label { font-weight: 800; font-size: 18px; letter-spacing: -0.02em; }

/* ---------- Mealplan ---------- */

.day-list { list-style: none; margin: 0 0 18px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.day-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  min-height: 56px;
}
.day-row.is-today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.day-name {
  width: 44px;
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  padding-top: 3px;
  line-height: 1.3;
}
.day-row.is-today .day-name { color: var(--accent); }
.day-input {
  flex: 1;
  border: none;
  background: none;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  min-width: 0;
  resize: none;
  overflow: hidden;
  line-height: 1.5;
  padding: 0;
  /* Safety net alongside the JS auto-grow: iOS can mis-measure scrollHeight
     as the keyboard closes, which once shrank a pasted menu. */
  min-height: calc(1.5em * 2);
}
.day-input:focus { outline: none; box-shadow: none; }
.day-input::placeholder { color: var(--text-muted); font-weight: 500; }
.day-input-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.day-save-status { font-size: 13px; color: var(--text-muted); }
.mealplan-suggestion {
  align-self: flex-start;
  font-size: 14px;
  font-weight: 700;
  color: var(--accent-ink);
  background: var(--accent-soft);
  border: none;
  border-radius: 999px;
  min-height: 34px;
  padding: 5px 12px;
}
.day-recipe-tag { font-size: 12px; color: var(--accent); flex-shrink: 0; }
.day-preview {
  flex: 1;
  min-width: 0;
  text-align: left;
  background: none;
  border: none;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  padding: 0;
  white-space: pre-line;
  line-height: 1.5;
}
.day-preview.is-empty { color: var(--text-muted); font-weight: 500; }

#mealplan-day-edit-backdrop { align-items: flex-start; padding-top: calc(24px + env(safe-area-inset-top)); }
#mealplan-day-edit-backdrop .modal-card { max-width: 480px; max-height: calc(100dvh - 60px); display: flex; flex-direction: column; }
.mealplan-day-edit-textarea {
  flex: 1;
  min-height: 220px;
  width: 100%;
  resize: none;
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
}
.mealplan-day-edit-status { font-size: 13px; color: var(--text-muted); min-height: 16px; margin: 6px 0 0; }

.search-input { display: block; margin-bottom: 10px; }

/* ---------- Recipes ---------- */

.recipe-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.recipe-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  cursor: pointer;
}
.recipe-card-title { font-weight: 700; font-size: 16px; }
.recipe-card-excerpt { font-size: 14px; color: var(--text-muted); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.recipe-detail-card { max-width: 480px; }
.recipe-detail-card h2 { margin: 0 0 8px; }
.recipe-detail-card h3 { font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin: 18px 0 6px; }
.recipe-detail-text { white-space: pre-wrap; font-size: 16px; margin: 0; }
#recipe-detail-url { color: var(--accent); font-weight: 700; font-size: 15px; text-decoration: none; }

@media (min-width: 600px) {
  .app { border-left: 1px solid var(--border); border-right: 1px solid var(--border); }
}

/* ---------- Icons ---------- */

.icon { display: inline-flex; width: 20px; height: 20px; }
.icon svg { width: 100%; height: 100%; }
.icon-inline { width: 14px; height: 14px; margin-left: 4px; vertical-align: -2px; }
.delete-btn .icon { width: 18px; height: 18px; }
.reminder-btn { color: var(--text-muted); filter: none; opacity: 0.55; }
.reminder-btn.active { color: var(--accent); opacity: 1; }
.reminder-btn.active svg { fill: currentColor; fill-opacity: 0.18; }
.drag-handle .icon svg { fill: currentColor; stroke: none; }
.due-pill { display: inline-flex; align-items: center; }
.due-pill.overdue { background: var(--danger-soft); color: var(--danger); }

/* ---------- Form bits ---------- */

.form-label { font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin: 4px 2px -4px; }
.list-card { padding-top: 6px; padding-bottom: 6px; }
.small-text { font-size: 14px !important; font-weight: 500 !important; }
.view-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.view-head .view-title { margin-bottom: 0; }
.list-surface { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 6px 16px; }
.add-form input[type="checkbox"], .modal-card input[type="checkbox"], .dialog-card input[type="checkbox"] {
  flex: none; width: 22px; height: 22px; min-height: 0; padding: 0; margin: 0; display: inline-block;
}
#shopping-form { flex-wrap: nowrap; align-items: stretch; }
#shopping-form input#shopping-name { flex: 1 1 auto; }
#shopping-form .qty-input { flex: 0 0 76px !important; }
#shopping-form .primary-btn { flex: none; }
.shopping-checked-block .list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 2px 16px; opacity: 0.85; }
.action-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.add-details { margin-top: 14px; }
.add-details > summary { list-style: none; }
.add-details > summary::-webkit-details-marker { display: none; }
.add-details[open] > summary { margin-bottom: 10px; }
.recipe-detail-card .modal-actions { flex-direction: column; }
.recipe-detail-card .modal-actions > * { width: 100%; }
.dialog-card textarea { border: 1px solid var(--border); background: var(--bg); border-radius: var(--radius-md); padding: 12px 14px; width: 100%; font-size: 16px; line-height: 1.45; resize: vertical; color: var(--text); }
.kid-logout { background: var(--surface); border: 1px solid var(--border); flex-shrink: 0; }
.kid-logout svg { width: 20px; height: 20px; }

/* ---------- Login names ---------- */

.login-names { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 14px; }
.login-name {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 60px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-weight: 700;
  font-size: 17px;
  text-align: left;
}
.login-name .avatar { width: 36px; height: 36px; font-size: 16px; }
.login-name[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); box-shadow: 0 0 0 1px var(--accent); }
.login-hint { margin-top: 8px; }
.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-weight: 700;
  font-size: 15px;
  min-height: 44px;
  padding: 0 4px;
}
#login-show-guide { display: block; margin: 10px auto 0; }

/* ---------- Welcome guide ---------- */

.welcome-screen {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: var(--bg);
  overflow-y: auto;
  display: flex;
  justify-content: center;
  padding: calc(12px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom));
}
.welcome-card {
  width: 100%;
  max-width: 460px;
  display: flex;
  flex-direction: column;
  min-height: 100%;
}
.welcome-top { display: flex; align-items: center; justify-content: space-between; min-height: 44px; }
.welcome-dots { display: flex; gap: 6px; }
.welcome-dots span { width: 8px; height: 8px; border-radius: 999px; background: var(--border); transition: width 0.2s ease, background 0.2s ease; }
.welcome-dots span.active { width: 24px; background: var(--accent); }
.welcome-dots span.done { background: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.welcome-step { flex: 1; padding: 18px 4px 12px; animation: pop-in 0.2s ease; }
.welcome-illu {
  width: 72px;
  height: 72px;
  border-radius: 22px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
}
.welcome-illu svg { width: 38px; height: 38px; stroke-width: 1.6; }
.welcome-kicker { font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.07em; color: var(--accent); margin: 0 0 6px; }
.welcome-step h1 { font-size: 30px; font-weight: 800; margin: 0 0 12px; text-wrap: balance; }
.welcome-lead { font-size: 17px; margin: 0 0 14px; }
.welcome-note { font-size: 15px; color: var(--text-muted); margin: 12px 0 0; }
.welcome-done { font-size: 17px; font-weight: 700; color: var(--ok); background: var(--ok-soft); border-radius: var(--radius-md); padding: 14px 16px; margin: 0; }
.welcome-fact { display: flex; flex-direction: column; gap: 2px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 14px 16px; margin: 0; font-size: 16px; }
.welcome-list { list-style: none; counter-reset: step; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.welcome-list li {
  counter-increment: step;
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 14px 14px 54px;
  font-size: 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
}
.welcome-list li::before {
  content: counter(step);
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 800;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.share-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--surface-alt);
  color: #0a84ff;
}
.share-icon svg { width: 22px; height: 22px; stroke-width: 2; }
.welcome-nav { display: flex; gap: 10px; padding-top: 12px; position: sticky; bottom: 0; background: var(--bg); }
.welcome-nav > * { flex: 1; }

/* Show only the block that matches the device/state set on .welcome-screen */
.welcome-screen .only-ios, .welcome-screen .only-android, .welcome-screen .only-desktop, .welcome-screen .only-installed,
.welcome-screen .only-visitor, .welcome-screen .only-member, .welcome-screen .only-push-ready, .welcome-screen .only-push-later { display: none; }
.welcome-screen[data-platform="ios"] .only-ios,
.welcome-screen[data-platform="android"] .only-android,
.welcome-screen[data-platform="desktop"] .only-desktop,
.welcome-screen[data-platform="installed"] .only-installed,
.welcome-screen[data-mode="visitor"] .only-visitor,
.welcome-screen[data-mode="member"] .only-member,
.welcome-screen[data-push="ready"] .only-push-ready,
.welcome-screen[data-push="later"] .only-push-later { display: block; }
#notify-actions:not(:has(> :not([hidden]))) { display: none; }
.pad-x { padding: 0 16px 14px; margin: 0; }
