:root {
  --brand: #1e8f5f;
  --brand-dark: #0f6b4c;
  --mint: #e8f8ef;
  --ink: #14171a;
  --muted: #6b7280;
  --border: #e5e7eb;
  --card: #ffffff;
  --page-bg: #f7f8fa;
  --warn-bg: #fff8e6;
  --warn-border: #f0dca3;
  --warn-text: #8a5a10;
  --danger-bg: #fdecec;
  --danger-border: #f3b4b0;
  --danger-text: #9f2b22;
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--page-bg); color: var(--ink); }
.icon { width: 18px; height: 18px; vertical-align: -3px; flex-shrink: 0; }

.app { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar { width: 250px; flex-shrink: 0; background: var(--card); border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 20px 14px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 20px; }
.brand-icon { width: 36px; height: 36px; border-radius: 10px; background: var(--brand); display: flex; align-items: center; justify-content: center; color: white; }
.brand-icon .icon { width: 20px; height: 20px; }
.brand-name { font-weight: 700; font-size: 16px; line-height: 1.2; }
.brand-tag { font-size: 11px; color: var(--muted); }
nav.nav-list { display: flex; flex-direction: column; gap: 2px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; border: none; background: none; color: var(--muted); font-size: 14px; text-align: left; cursor: pointer; font-family: inherit; }
.nav-item:hover { background: #f2f3f5; }
.nav-item.active { background: var(--mint); color: var(--brand-dark); font-weight: 600; }
.sidebar-footer { margin-top: auto; padding: 10px; font-size: 12px; color: var(--muted); }

/* Content */
.content { flex: 1; padding: 28px 32px 60px; max-width: 980px; }
.page.hidden { display: none; }
h1, h2, h3 { margin: 0 0 6px; }
h1 { font-size: 22px; }
h2 { font-size: 18px; }
h3 { font-size: 14px; }
p { line-height: 1.55; margin: 6px 0; }
.subtitle { color: var(--muted); font-size: 14px; margin-bottom: 22px; }
.muted { color: var(--muted); }

/* Hero */
.hero { background: linear-gradient(135deg, #147a50, #0c6a52); color: white; /* start colour darkened so white text is >= 5:1 across the whole gradient */ border-radius: 16px; padding: 32px; margin-bottom: 18px; }
.pill { display: inline-flex; align-items: center; gap: 6px; background: rgba(255,255,255,0.18); border-radius: 999px; padding: 5px 12px; font-size: 12px; font-weight: 600; margin-bottom: 14px; }
.hero h1 { font-size: 30px; margin-bottom: 10px; }
.hero p { max-width: 640px; opacity: 0.95; }
.hero .actions { margin-top: 18px; display: flex; gap: 10px; flex-wrap: wrap; }

/* Buttons */
button { font-family: inherit; cursor: pointer; }
.btn { display: inline-flex; align-items: center; gap: 8px; border-radius: 9px; padding: 10px 16px; font-size: 13.5px; font-weight: 600; border: none; }
.btn-dark { background: var(--ink); color: white; }
.btn-dark:hover { background: #000; }
.btn-hero-primary { background: white; color: var(--brand-dark); }
.btn-hero-secondary { background: rgba(255,255,255,0.1); color: white; border: 1px solid rgba(255,255,255,0.5); }
.btn-outline { background: white; color: var(--ink); border: 1px solid var(--border); }
.btn-outline:hover { background: #f7f7f8; }
.btn-danger-outline { background: white; color: var(--danger-text); border: 1px solid var(--danger-border); }
.btn-link { background: none; border: none; color: var(--muted); font-size: 13.5px; padding: 8px 4px; }
.btn:disabled { opacity: 0.55; cursor: default; }

/* Cards */
.card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 20px; margin-bottom: 18px; }
.card-title { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 26px 0 12px; }
.section-head h2 { margin: 0; }
.link { color: var(--brand-dark); font-weight: 600; font-size: 13.5px; text-decoration: none; display: inline-flex; align-items: center; gap: 4px; background: none; border: none; cursor: pointer; padding: 0; }

/* Callouts */
.callout { display: flex; gap: 12px; border-radius: 12px; padding: 14px 16px; border: 1px solid; margin-bottom: 18px; font-size: 13.5px; line-height: 1.5; }
.callout .icon { margin-top: 2px; }
.callout-warn { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn-text); }
.callout-danger { background: var(--danger-bg); border-color: var(--danger-border); color: var(--danger-text); }
.callout-peach { background: linear-gradient(135deg, #fde9e5, #fff3e0); border-color: #f3d8cd; color: #7a3b2e; }
.callout strong { display: block; margin-bottom: 3px; }

/* Choice cards (pairing role picker) */
.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.choice-card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 20px; cursor: pointer; text-align: left; }
.choice-card:hover { border-color: var(--brand); }
.choice-card .choice-icon { width: 38px; height: 38px; border-radius: 10px; background: var(--mint); color: var(--brand-dark); display: flex; align-items: center; justify-content: center; margin-bottom: 10px; }
.choice-card h3 { font-size: 15px; margin-bottom: 4px; }
.choice-card p { font-size: 13px; color: var(--muted); margin: 0; }

/* Forms */
label.field-label { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; display: block; margin-bottom: 6px; }
input:not([type="checkbox"]):not([type="radio"]), select, textarea { border: 1px solid var(--border); border-radius: 8px; padding: 9px 11px; font-size: 13.5px; width: 100%; box-sizing: border-box; margin-bottom: 16px; font-family: inherit; }
input[type="checkbox"], input[type="radio"] { width: 16px; height: 16px; flex-shrink: 0; accent-color: var(--brand); margin: 0; }
.consent-box { background: #f7f8fa; border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; margin-bottom: 16px; }
.consent-box ul { margin: 8px 0 0; padding-left: 18px; font-size: 13.5px; color: #2a2e33; }
.consent-box li { margin-bottom: 6px; }
.consent-check { display: flex; align-items: flex-start; gap: 8px; margin-top: 12px; font-size: 13.5px; }
.consent-check input { width: auto; margin: 2px 0 0; }
.form-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; }

/* Grid for resource cards */
.resource-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.resource-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
.resource-card .icon-badge { width: 32px; height: 32px; border-radius: 9px; background: var(--mint); color: var(--brand-dark); display: flex; align-items: center; justify-content: center; margin-bottom: 10px; }
.resource-card h3 { margin-bottom: 4px; }
.resource-card p { font-size: 13px; color: var(--muted); margin: 0 0 8px; }

/* Misc rows */
.row { display: flex; gap: 10px; align-items: center; }
.status-badge { display: inline-block; padding: 4px 11px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.status-badge.on { background: var(--mint); color: var(--brand-dark); }
.status-badge.off { background: #f1f3f5; color: var(--muted); }
.event { padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; display: flex; justify-content: space-between; }
.event:last-child { border-bottom: none; }
.tag { padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.tag.clean { background: var(--mint); color: var(--brand-dark); }
.tag.questionable { background: #fff3cd; color: #92620a; }
.tag.explicit { background: #fde2e1; color: var(--danger-text); }
.encouragement { background: #f7f8fa; border: 1px solid var(--border); border-radius: 10px; padding: 10px 13px; margin-bottom: 8px; font-size: 13.5px; }
.encouragement .from { font-weight: 700; font-size: 12px; color: var(--brand-dark); margin-bottom: 2px; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); }
.toggle-row:last-child { border-bottom: none; }
.toggle-row .label { font-size: 13.5px; }
.toggle-row .desc { font-size: 12px; color: var(--muted); }
code { background: #f1f3f5; padding: 2px 6px; border-radius: 5px; font-size: 12.5px; }
.footnote { font-size: 12px; color: var(--muted); margin-top: 8px; }
.empty { color: var(--muted); font-size: 13.5px; text-align: center; padding: 20px 0; }

/* Phone-width layout: the sidebar becomes a top icon bar instead of a
   250px-wide column, which would otherwise eat most of a phone screen.
   Desktop/Electron never hits this (window minWidth is 760px). */
@media (max-width: 700px) {
  .app { flex-direction: column; min-height: auto; }
  .sidebar { width: 100%; flex-direction: row; align-items: center; justify-content: space-between; padding: 10px 12px; border-right: none; border-bottom: 1px solid var(--border); }
  .brand { padding: 0; gap: 8px; }
  .brand-tag { display: none; }
  nav.nav-list { flex-direction: row; gap: 2px; }
  .nav-item { flex-direction: column; gap: 2px; padding: 6px 8px; font-size: 10px; }
  .nav-item .icon { width: 20px; height: 20px; }
  .nav-label { font-size: 10px; }
  .sidebar-footer { display: none; }
  .content { padding: 16px 14px 40px; max-width: 100%; }
  .hero { padding: 20px; }
  .hero h1 { font-size: 22px; }
  .hero .actions { flex-direction: column; align-items: stretch; }
  .hero .actions .btn { justify-content: center; }
  .choice-grid, .resource-grid { grid-template-columns: 1fr; }
  .form-actions { flex-wrap: wrap; gap: 8px; }
}

/* ---- accessibility ---- */
.skip-link { position: absolute; left: -9999px; top: 0; background: var(--ink); color: #fff; padding: 10px 14px; z-index: 1000; border-radius: 0 0 8px 0; }
.skip-link:focus { left: 0; }
:focus-visible { outline: 3px solid #0b5cad; outline-offset: 2px; }
button, select, input, textarea, summary { min-height: 40px; }
input[type="checkbox"], input[type="radio"] { min-height: 0; }
.nav-item { min-height: 44px; }
.muted, .subtitle { color: #4b5563; } /* darker than the original #6b7280 so small text clears 4.5:1 on every surface */
main:focus { outline: none; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; } }
@media (forced-colors: active) { .status-badge, .btn { border: 1px solid CanvasText; } }
.status-badge.off { color: #4b5563; } /* 4.35:1 -> 7:1 on the grey chip */

/* ---- home: quick actions and first-run steps ---- */
.greeting { margin-bottom: 4px; }
.quick-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin: 14px 0 18px; }
.quick { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; text-align: left; background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 16px; cursor: pointer; font-family: inherit; color: var(--ink); min-height: 104px; box-shadow: 0 1px 0 rgba(0,0,0,0.02); }
.quick:hover { border-color: var(--brand); box-shadow: 0 2px 10px rgba(20,122,80,0.10); }
.quick .badge { width: 34px; height: 34px; border-radius: 10px; background: var(--mint); color: var(--brand-dark); display: flex; align-items: center; justify-content: center; }
.quick strong { font-size: 15px; }
.quick .sub { font-size: 13px; color: #4b5563; line-height: 1.4; }
.quick.urgent { background: #fff4f1; border-color: #f3b4b0; }
.quick.urgent .badge { background: #fde1db; color: #9f2b22; }
.today-card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px; margin-bottom: 12px; display: flex; gap: 14px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.today-card .num { font-size: 28px; font-weight: 800; color: var(--brand-dark); line-height: 1; }
.today-card .lbl { color: #4b5563; font-size: 13px; }
.steps { display: grid; gap: 12px; margin: 14px 0 18px; }
.step { display: flex; gap: 14px; background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 16px; align-items: flex-start; }
.step .n { flex: 0 0 30px; height: 30px; border-radius: 50%; background: var(--brand-dark); color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.step h3 { margin: 0 0 2px; font-size: 15px; }
.step p { margin: 0 0 10px; color: #4b5563; font-size: 13.5px; }
.empty { text-align: center; color: #4b5563; padding: 22px 10px; }
.btn { transition: background .12s, box-shadow .12s; }
.btn-dark:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.18); }
.card { box-shadow: 0 1px 0 rgba(0,0,0,0.02); }
h1 { letter-spacing: -0.01em; }

/* The hidden attribute must always win, otherwise a warning that is meant to be hidden (display:flex above) shows to everyone. */
[hidden] { display: none !important; }

/* ---- phone layout: bottom tab bar (thumb reach) with a More sheet ---- */
.nav-more { display: none; }
.more-sheet { position: fixed; inset: 0; background: rgba(15,23,42,0.45); z-index: 100; display: flex; align-items: flex-end; justify-content: center; }
.more-sheet[hidden] { display: none; }
.more-panel { background: var(--card); width: 100%; max-width: 520px; border-radius: 18px 18px 0 0; padding: 12px 14px calc(18px + env(safe-area-inset-bottom)); }
.more-panel .grab { width: 40px; height: 4px; border-radius: 2px; background: #d1d5db; margin: 0 auto 10px; }
.more-panel button.more-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px 10px; background: none; border: none; border-bottom: 1px solid var(--border); font-size: 15px; font-family: inherit; color: var(--ink); text-align: left; min-height: 52px; }
.more-panel button.more-item:last-child { border-bottom: none; }
@media (max-width: 700px) {
  .app { padding-bottom: 78px; }
  .sidebar { position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 50; width: 100%; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); border-right: none; border-bottom: none; border-top: 1px solid var(--border); justify-content: center; box-shadow: 0 -2px 12px rgba(0,0,0,0.06); }
  .brand { display: none; }
  nav.nav-list { width: 100%; justify-content: space-around; gap: 0; }
  .nav-item { flex: 1; justify-content: center; align-items: center; min-width: 0; min-height: 54px; }
  .nav-item.secondary { display: none; }
  .nav-item.nav-more { display: flex; }
  .nav-label { font-size: 11px; }
  .content { padding: 16px 14px 24px; }
  .quick-grid { grid-template-columns: 1fr 1fr; }
  .quick { min-height: 92px; padding: 14px; }
  h1 { font-size: 22px; }
}

.ci-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ci-row .btn { justify-content: center; min-height: 48px; text-align: center; padding: 8px 6px; }
.rec-ci[data-status="held"]:hover { background: var(--mint); }
.rec-ci[data-status="slipped"]:hover { background: #fff4f1; }.read-item summary { cursor: pointer; min-height: 40px; display: flex; align-items: center; gap: 6px; }
.read-item[open] { background: #fff; }

.call-btn { text-decoration: none; margin: 10px 0 6px; color: #fff; }
.call-btn:hover { color: #fff; }


/* ---- offline banner ---- */
.net-banner { position: sticky; top: 0; z-index: 60; padding: 9px 14px; font-size: 13.5px; font-weight: 600; text-align: center; }
.net-banner.offline { background: #fff4d6; color: #6b4a00; border-bottom: 1px solid #f0dca3; }
.net-banner.sending { background: #e8f8ef; color: #0f6b4c; border-bottom: 1px solid #bfe8d2; }
.net-banner[hidden] { display: none; }
/* ---- circles: chat ---- */
.small { font-size: 12px; }
.small-callout { padding: 10px 12px; font-size: 12.5px; margin-bottom: 10px; }
.avatar { width: 40px; height: 40px; border-radius: 50%; color: #fff; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 40px; }
.chip { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: #e8f8ef; color: #0f6b4c; vertical-align: middle; }
.chip.warn { background: #fff4d6; color: #6b4a00; }
.chip.pray { background: #f1ecff; color: #4a2fa0; margin-bottom: 4px; }
.circle-row { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 12px; margin-bottom: 10px; cursor: pointer; font-family: inherit; color: var(--ink); min-height: 64px; }
.circle-row:hover { border-color: var(--brand); }
.circle-info { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.chat-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.chat-title { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.chat-tabs { display: flex; gap: 6px; margin-bottom: 8px; }
.chat-tab { flex: 1; border: 1px solid var(--border); background: #fff; border-radius: 999px; padding: 8px 12px; font-family: inherit; font-weight: 600; color: #4b5563; cursor: pointer; min-height: 40px; }
.chat-tab.active { background: var(--brand-dark); color: #fff; border-color: var(--brand-dark); }
.chat-feed { background: #efeae2; background-image: radial-gradient(rgba(0,0,0,0.03) 1px, transparent 1px); background-size: 14px 14px; border: 1px solid var(--border); border-radius: 14px; padding: 12px 10px; height: calc(100vh - 430px); min-height: 280px; overflow-y: auto; scroll-behavior: smooth; }
.chat-feed .empty { color: #4b5563; }
.day { text-align: center; margin: 10px 0; }
.day { font-size: 12px; font-weight: 700; color: #4b5563; }
.msg { display: flex; flex-direction: column; margin-bottom: 8px; max-width: 86%; }
.msg.mine { margin-left: auto; align-items: flex-end; }
.msg.theirs { margin-right: auto; align-items: flex-start; }
.bubble { padding: 8px 12px; border-radius: 14px; box-shadow: 0 1px 1px rgba(0,0,0,0.08); word-wrap: break-word; overflow-wrap: anywhere; }
.msg.mine .bubble { background: #d9f7c9; border-bottom-right-radius: 4px; }
.msg.theirs .bubble { background: #fff; border-bottom-left-radius: 4px; }
.msg.pending .bubble { opacity: 0.7; }
.bubble .who { font-size: 12px; font-weight: 800; margin-bottom: 2px; }
.bubble .text { white-space: pre-wrap; font-size: 14.5px; line-height: 1.4; }
.bubble .meta { font-size: 11px; color: #5b6470; text-align: right; margin-top: 3px; }
.bubble .quote { border-left: 3px solid var(--brand); background: rgba(0,0,0,0.05); padding: 4px 8px; border-radius: 6px; font-size: 12.5px; margin-bottom: 4px; color: #374151; }
.msg-actions { display: flex; gap: 4px; margin-top: 3px; flex-wrap: wrap; }
.react { border: 1px solid var(--border); background: #fff; border-radius: 999px; padding: 2px 9px; font-size: 13px; cursor: pointer; min-height: 30px; font-family: inherit; color: #374151; }
.react.on { background: #e8f8ef; border-color: var(--brand); color: #0f6b4c; font-weight: 700; }
.react.ghost { background: transparent; border-color: transparent; color: #5b6470; }
.react:hover { border-color: var(--brand); }
.msg-menu { background: #fff; border: 1px solid var(--border); border-radius: 10px; margin-top: 4px; box-shadow: 0 4px 14px rgba(0,0,0,0.12); overflow: hidden; }
.msg-menu button { display: block; width: 100%; text-align: left; padding: 10px 14px; background: none; border: none; font-family: inherit; font-size: 14px; min-height: 44px; }
.msg-menu button:hover { background: #f3f4f6; }
.msg-menu[hidden] { display: none; }
.composer { position: sticky; bottom: 0; background: var(--page-bg); padding: 8px 0 4px; z-index: 20; }
.composer-row { align-items: flex-end; gap: 8px; }
.composer-row select { width: auto; margin: 0; min-width: 110px; }
.composer-row textarea { margin: 0; flex: 1; resize: none; max-height: 140px; border-radius: 18px; padding: 10px 14px; }
.send-btn { border-radius: 18px; min-height: 44px; }
.reply-chip { background: #fff; border: 1px solid var(--border); border-left: 4px solid var(--brand); border-radius: 8px; padding: 6px 10px; font-size: 12.5px; margin-bottom: 6px; }
.reply-chip[hidden] { display: none; }
.new-pill { position: sticky; bottom: 70px; margin: -40px auto 0; display: block; background: var(--brand-dark); color: #fff; border: none; border-radius: 999px; padding: 8px 14px; font-weight: 700; z-index: 30; box-shadow: 0 2px 10px rgba(0,0,0,0.25); }
.new-pill[hidden] { display: none; }
@media (max-width: 700px) {
  .chat-feed { height: calc(100vh - 470px); min-height: 220px; }
  .composer { bottom: 70px; }
  .composer-row { flex-wrap: wrap; }
  .composer-row select { min-width: 100%; }
  .new-pill { bottom: 150px; }
}
/* ---- welcome, devices, themes ---- */
.welcome-hero { text-align: center; padding: 8px 0 4px; }
.hero-art { width: min(100%, 360px); height: auto; margin: 0 auto 6px; display: block; }
.welcome-hero h1 { font-size: 30px; margin: 6px 0; }
.welcome-hero p { max-width: 560px; margin: 0 auto 14px; color: #4b5563; }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin: 14px 0 18px; }
.feature { display: flex; flex-direction: column; gap: 4px; background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 14px; }
.feature .badge { width: 34px; height: 34px; border-radius: 10px; background: var(--mint); color: var(--brand-dark); display: flex; align-items: center; justify-content: center; margin-bottom: 4px; }
.feature .sub { font-size: 13px; color: #4b5563; }
.age-group { border: none; padding: 0; margin: 6px 0 12px; }
.age-group legend { padding: 0; }
.btn.big { width: 100%; justify-content: center; min-height: 48px; font-size: 15px; }
.big-code { font-size: 34px; letter-spacing: 6px; font-weight: 800; text-align: center; background: #f1f3f5; border-radius: 12px; padding: 14px; color: var(--brand-dark); }
.link-code { margin-top: 10px; }
.chip.soon { background: #fff4d6; color: #6b4a00; }
.coming-soon { border-style: dashed; background: #fcfcfd; }
/* teen theme: brighter and more playful; same layout and features */
:root[data-theme="teen"] { --brand: #7c4dff; --brand-dark: #5b34d6; --mint: #efe9ff; }
:root[data-theme="teen"] .hero, :root[data-theme="teen"] .welcome-hero h1 { background: none; }
:root[data-theme="teen"] .quick:hover { border-color: var(--brand); box-shadow: 0 2px 12px rgba(124,77,255,0.18); }
:root[data-theme="teen"] .msg.mine .bubble { background: #e7dcff; }
:root[data-theme="teen"] .chat-feed { background-color: #f4efff; }
:root[data-theme="teen"] .btn-dark { background: var(--brand-dark); }
@keyframes pop { 0% { transform: scale(0.6); opacity: 0; } 60% { transform: scale(1.12); opacity: 1; } 100% { transform: scale(1); } }
.celebrate { animation: pop .5s ease-out; background: linear-gradient(135deg, #fff4d6, #e8f8ef); border: 1px solid #f0dca3; border-radius: 14px; padding: 14px 16px; margin-bottom: 14px; font-weight: 700; }
@media (max-width: 700px) { .quick-grid .quick:last-child:nth-child(odd) { grid-column: 1 / -1; min-height: 80px; } }

/* ---- voice notes ---- */
.composer-row[hidden], .row[hidden], .voice-panel[hidden] { display: none !important; }
.voice-mic { min-height: 44px; min-width: 44px; border-radius: 18px; padding: 0 12px; font-size: 18px; line-height: 1; }
.voice-panel { margin: 6px 0 2px; }
.voice-rec { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.voice-dot { width: 12px; height: 12px; border-radius: 50%; background: #c0392b; animation: voice-pulse 1.1s ease-in-out infinite; }
@keyframes voice-pulse { 50% { opacity: 0.25; } }
@media (prefers-reduced-motion: reduce) { .voice-dot { animation: none; } }
.voice-clock { font-variant-numeric: tabular-nums; font-weight: 700; min-width: 90px; }
.voice-review audio { width: 100%; margin-bottom: 8px; }
.voice-note { display: flex; align-items: center; gap: 10px; min-width: 190px; }
.voice-note.gone { color: #5b6470; font-style: italic; }
.voice-play { flex: 0 0 40px; width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--brand-dark); color: #fff; font-size: 14px; cursor: pointer; }
.voice-play:disabled { opacity: 0.6; }
.voice-bar { flex: 1; height: 6px; border-radius: 3px; background: rgba(0,0,0,0.15); overflow: hidden; }
.voice-fill { display: block; height: 100%; width: 0; background: var(--brand-dark); }
.voice-time { font-size: 12px; font-variant-numeric: tabular-nums; color: #374151; }
.voice-error { margin-top: 4px; color: #9b2c2c; }
.enc-del { margin-left: 8px; }
/* ---- group calls ---- */
.call-bar { position: fixed; top: 0; left: 0; right: 0; z-index: 200; background: #0f3d2e; color: #fff; padding: 8px 14px; box-shadow: 0 2px 8px rgba(0,0,0,0.25); }
body.in-call { padding-top: 60px; }
.call-bar .call-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.call-bar .muted { color: #cfe3da; }
.call-bar .btn { min-height: 36px; padding: 4px 12px; }
.call-bar .btn-outline { background: transparent; color: #fff; border-color: #fff; }
.call-bar .btn-danger-outline { background: #fff; }
.call-dot { width: 10px; height: 10px; border-radius: 50%; background: #5ee08a; }
.call-more { margin-top: 4px; }
.call-more summary { cursor: pointer; font-size: 13px; }
.call-people { margin: 6px 0; padding-left: 18px; }
.call-bar .btn-link { color: #ffd2cc; }
.call-notice:empty { display: none; }
.call-banner { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; background: #e6f4ec; border: 1px solid #b9dcc8; border-radius: 12px; padding: 10px 14px; margin-bottom: 10px; font-size: 14px; }
.call-banner.quiet { background: transparent; border-color: var(--border); }
.call-banner.on { background: #d9f7c9; }
/* ---- language switch ---- */
.lang-row { display: flex; justify-content: flex-end; margin-bottom: 8px; }
.lang-switch { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; overflow: hidden; background: #fff; }
.lang-btn { border: 0; background: transparent; padding: 8px 16px; min-height: 40px; font: inherit; font-weight: 600; cursor: pointer; color: #374151; }
.lang-btn.on { background: var(--brand-dark); color: #fff; }
/* ---- signed out: the app is just the sign-in page (no menu) ---- */
.signed-out .sidebar { display: none; }
.signed-out .app { padding-bottom: 0; }
.signed-out .content { max-width: 460px; margin: 0 auto; padding-top: 18px; }
.auth-page { display: flex; flex-direction: column; gap: 14px; }
.auth-brand { text-align: center; padding: 6px 0 2px; }
.auth-logo { display: inline-flex; width: 52px; height: 52px; border-radius: 16px; align-items: center; justify-content: center; background: var(--mint); color: var(--brand-dark); }
.auth-logo svg { width: 28px; height: 28px; }
.auth-name { font-size: 26px; font-weight: 700; letter-spacing: -0.01em; margin-top: 8px; }
.auth-card .auth-title { font-size: 22px; margin: 0 0 4px; }
.auth-card input[type=email], .auth-card input[type=password], .auth-card input[type=text] { width: 100%; box-sizing: border-box; }
.auth-card .field-label { display: block; margin: 12px 0 4px; }
.pw-row { display: flex; align-items: center; gap: 8px; }
.pw-row input { flex: 1; }
.auth-card .big { width: 100%; margin-top: 16px; }
.auth-links { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px 16px; margin-top: 14px; }
.auth-help { text-align: center; margin: 0; }
.auth-more { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px; }
.auth-more summary { cursor: pointer; font-size: 14px; }

/* ---- clean home: welcome, one verse, then the places to go ---- */
.home-clean { min-height: 62vh; display: flex; flex-direction: column; justify-content: center; padding: 8px 0 20px; }
.home-hello { font-size: clamp(30px, 8vw, 46px); line-height: 1.15; margin: 0 0 4px; letter-spacing: -0.02em; }
.hh-word, .hh-name { display: inline-block; }
.hh-name { color: var(--brand-dark); }
.home-sub { margin: 0; min-height: 0; }
.home-verse { margin: 22px 0 26px; padding: 18px 20px; border-left: 4px solid var(--brand-dark); background: var(--mint); border-radius: 0 14px 14px 0; }
.home-verse blockquote { margin: 0; font-size: 18px; line-height: 1.55; font-family: Georgia, "Times New Roman", serif; font-style: italic; }
.home-verse figcaption { margin-top: 8px; font-size: 13px; color: var(--muted); font-style: normal; }
.home-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.home-tile { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; text-align: left; background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 16px; cursor: pointer; font-family: inherit; color: var(--ink); min-height: 88px; }
.home-tile .badge { width: 34px; height: 34px; border-radius: 10px; background: var(--mint); color: var(--brand-dark); display: flex; align-items: center; justify-content: center; }
.home-tile strong { font-size: 15px; }
.home-tile.urgent .badge { background: #fde8e0; color: #b3401f; }
.home-tile:hover, .home-tile:focus-visible { border-color: var(--brand-dark); }
@media (max-width: 700px) { .home-tiles { grid-template-columns: 1fr 1fr; } }
.home-clean.animate .hh-word { animation: hh-up 0.8s ease both; }
.home-clean.animate .hh-name { animation: hh-up 0.8s 0.35s ease both; }
.home-clean.animate .home-verse { animation: hh-fade 1.4s 1.3s ease both; }
.home-clean.animate .home-tile { animation: hh-up 0.6s calc(2.5s + var(--i) * 0.12s) ease both; }
@keyframes hh-up { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes hh-fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .home-clean.animate * { animation-delay: 0s !important; } }

/* ---- progress and milestones (Recovery) ---- */
.prog { border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; margin-top: 12px; }
.prog-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.prog-num { font-size: 40px; font-weight: 800; line-height: 1; color: var(--brand-dark); }
.prog-side { text-align: right; font-size: 13.5px; }
.prog-label { margin: 8px 0 4px; }
.prog-kind { background: var(--mint); border-radius: 10px; padding: 8px 12px; font-size: 13.5px; margin: 6px 0; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin: 10px 0 6px; max-width: 230px; }
.cal-day { display: inline-block; aspect-ratio: 1; border-radius: 5px; background: #eceff3; min-width: 10px; }
.cal-legend .cal-day { width: 10px; height: 10px; vertical-align: -1px; margin-right: 4px; }
.cal-held { background: #3fa772; } .cal-struggled { background: #e7b443; } .cal-slipped { background: #d9826b; } .cal-none { background: #eceff3; }
.cal-today { outline: 2px solid var(--ink); outline-offset: 1px; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 10px; font-size: 12px; color: var(--muted); }
.ms-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.ms { min-width: 34px; height: 34px; padding: 0 6px; border-radius: 17px; border: 1px dashed var(--border); color: var(--muted); display: inline-flex; align-items: center; justify-content: center; font-size: 12.5px; font-weight: 700; }
.ms.earned { border: 1px solid #f0dca3; background: #fff4d6; color: #8a6200; }
.ms.now { background: #e8f8ef; border-color: #3fa772; color: #1f7a4c; }
.prog-month { margin: 8px 0 0; font-size: 12.5px; }
.rec-urge-btn { margin: 6px 0 12px; width: 100%; justify-content: center; }

/* ---- urge tool ---- */
body.urge-open { overflow: hidden; }
.urge { position: fixed; inset: 0; z-index: 1000; background: linear-gradient(180deg, #0f2a33, #17414b); color: #f3f7f8; overflow-y: auto; display: flex; justify-content: center; padding: 16px; }
.urge-panel { width: 100%; max-width: 520px; position: relative; padding: 28px 4px 40px; }
.urge h2 { font-size: 24px; margin: 8px 0 10px; }
.urge .muted { color: #b9cdd2; }
.urge-x { position: absolute; top: 0; right: 0; background: none; border: none; color: #f3f7f8; font-size: 30px; cursor: pointer; padding: 6px 10px; }
.urge-scale { display: flex; gap: 8px; margin: 6px 0; }
.urge-scale .btn { flex: 1; justify-content: center; color: #f3f7f8; border-color: #5d8791; background: transparent; }
.urge-scale .btn.on { background: #f3f7f8; color: #0f2a33; }
.urge-scale-help { font-size: 12px; margin: 0 0 18px; }
.urge .btn-dark { background: #f3f7f8; color: #0f2a33; }
.urge .btn-outline { color: #f3f7f8; border-color: #5d8791; background: transparent; }
.urge .btn-link { color: #b9cdd2; }
.urge-time { display: flex; align-items: baseline; gap: 10px; justify-content: center; }
.urge-time #urge-clock { font-size: 34px; font-weight: 800; font-variant-numeric: tabular-nums; }
.breath { position: relative; width: 170px; height: 170px; margin: 14px auto; display: flex; align-items: center; justify-content: center; }
.breath-ring { position: absolute; inset: 0; border-radius: 50%; background: radial-gradient(circle, rgba(126,214,223,0.55), rgba(126,214,223,0.12)); animation: breathe 14s ease-in-out infinite; }
.breath-text { position: relative; font-weight: 700; font-size: 16px; }
@keyframes breathe { 0% { transform: scale(0.55); } 28.6% { transform: scale(1); } 57.1% { transform: scale(1); } 100% { transform: scale(0.55); } }
@media (prefers-reduced-motion: reduce) { .breath-ring { animation: none; transform: scale(0.85); } }
.urge-verse { margin: 10px 0 16px; padding: 14px 16px; border-left: 3px solid #7ed6df; background: rgba(255,255,255,0.06); border-radius: 0 12px 12px 0; }
.urge-verse blockquote { margin: 0; font-family: Georgia, "Times New Roman", serif; font-style: italic; font-size: 16.5px; line-height: 1.5; }
.urge-verse figcaption { margin-top: 6px; font-size: 12.5px; color: #b9cdd2; }
.urge-reasons, .urge-steps { background: rgba(255,255,255,0.06); border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; }
.urge-reasons ul, .urge-steps ul { margin: 6px 0 0; padding-left: 20px; line-height: 1.6; }
.urge-steps summary { cursor: pointer; font-weight: 700; }
.urge-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.urge-actions .btn { flex: 1 1 200px; justify-content: center; }
.urge select { margin: 8px 0; }

/* ---- first-run steps ---- */
.ob { max-width: 560px; margin: 0 auto; padding: 24px 0; }
.ob-dots { display: flex; gap: 6px; margin-bottom: 18px; }
.ob-dots span { width: 26px; height: 5px; border-radius: 3px; background: var(--border); }
.ob-dots span.on { background: var(--brand-dark); }
.ob-chips { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 22px; }
.ob-chip { border: 1px solid var(--border); background: var(--card); border-radius: 22px; padding: 10px 16px; font: inherit; font-size: 14.5px; cursor: pointer; color: var(--ink); }
.ob-chip.on { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.ob-nav { display: flex; align-items: center; gap: 14px; margin-top: 10px; }
.ob-cards { display: grid; gap: 10px; }
.ob-cards .choice-card { text-align: left; width: 100%; font: inherit; color: var(--ink); cursor: pointer; }

/* ---- admin page ---- */
.adm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-top: 10px; }
.adm-tile { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; border: 1px solid var(--border); background: var(--card); border-radius: 12px; padding: 12px; font: inherit; font-size: 12.5px; color: var(--muted); text-align: left; }
.adm-tile[data-jump] { cursor: pointer; }
.adm-tile .adm-n { font-size: 24px; font-weight: 800; color: var(--ink); }
.adm-tile.warn { border-color: #e7b443; background: #fff8e6; }
.adm-tile.danger { border-color: #d9826b; background: #fdece7; }
.adm-tile.danger .adm-n { color: #b3401f; }
.adm-row { display: grid; grid-template-columns: 1.3fr 1.2fr 1.2fr auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.adm-row input { margin: 0; }
@media (max-width: 800px) { .adm-row { grid-template-columns: 1fr; } }
.adm-quote { border-left: 3px solid var(--border); padding: 4px 10px; margin: 6px 0; font-size: 13.5px; white-space: pre-wrap; }
.adm-log { font-size: 13px; line-height: 1.7; max-height: 360px; overflow-y: auto; }

/* sign-in page: a pointer for people who joined with email codes and have no password yet */
.auth-old-user { background: var(--mint); border-radius: 10px; padding: 10px 12px; font-size: 13.5px; margin: 10px 0 4px; line-height: 1.5; }
.auth-old-user .btn-link { color: var(--brand-dark); font-weight: 700; padding: 2px 0; text-decoration: underline; }
