
:root{
  --bg:#eef4ff;
  --shell:#f7f9ff;
  --card:#ffffff;
  --text:#111827;
  --muted:#5f6d83;
  --primary:#0b5cff;
  --primary-soft:#eaf2ff;
  --line:#dfe7f5;
  --good:#16803b;
  --warn:#b45309;
  --danger:#b42318;
  --shadow:0 18px 42px rgba(15, 23, 42, 0.08);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: linear-gradient(180deg, #edf4ff 0%, #eef7f3 100%);
  color: var(--text);
}

button, input, select, textarea { font: inherit; }
button {
  border: 0;
  background: var(--primary);
  color: #fff;
  padding: 0.82rem 1rem;
  border-radius: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease;
}
button:active { transform: translateY(1px); }
button.secondary { background: var(--primary-soft); color: var(--primary); }
button.ghost {
  background: transparent;
  color: var(--primary);
  border: 1px solid #cedcff;
}
button:disabled { opacity: 0.55; cursor: not-allowed; }
.hidden { display: none !important; }

#app {
  width: min(100%, 430px);
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--shell);
  box-shadow: var(--shadow);
}

.mobile-main {
  max-width: 100%;
  margin: 0 auto;
  padding: 0 14px calc(110px + env(safe-area-inset-bottom));
}

#authView,
#dashboardView {
  max-width: 100%;
  margin: 0 auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 14px 12px;
  background: rgba(247, 249, 255, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(223, 231, 245, 0.9);
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary) 0%, #7ba7ff 100%);
  color: white;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.topbar h1 {
  margin: 0.22rem 0 0;
  font-size: 1.08rem;
}

.eyebrow {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--primary);
  margin: 0;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: 0 18px 30px rgba(15, 23, 42, 0.03);
}

.card h2, .card h3 { margin-top: 0; }

.muted { color: var(--muted); }

.auth-screen {
  max-width: 100%;
  margin: 4vh auto 0;
  padding: clamp(22px, 6vw, 36px);
}

.welcome-screen {
  min-height: 340px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  background: linear-gradient(135deg, #ffffff 0%, #f2f6ff 50%, #edf8f2 100%);
}

.welcome-screen h2 {
  font-size: clamp(2rem, 8vw, 2.7rem);
  line-height: 1.08;
  margin: 0.75rem 0;
  max-width: 11ch;
}

.welcome-screen > .muted,
.auth-screen .muted {
  line-height: 1.6;
}

.auth-screen label {
  display: block;
  margin: 16px 0;
  font-size: 0.9rem;
  font-weight: 700;
}

.auth-screen > button:not(.text-button):not(.back-button) {
  width: 100%;
  margin-top: 4px;
}

.auth-switch {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 18px 0 0;
}

.text-button, .back-button {
  padding: 0;
  background: transparent;
  color: var(--primary);
  font-weight: 700;
  border-radius: 0;
}

.back-button {
  margin-top: 14px;
  padding: 0.35rem 0;
  color: var(--muted);
}

input, select, textarea {
  width: 100%;
  padding: 0.9rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  margin-top: 6px;
  color: var(--text);
}

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

label { display: block; font-size: 0.9rem; font-weight: 700; margin-bottom: 12px; }

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.stat {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 12px;
  margin-bottom: 0;
}

.stat span { font-size: 1.5rem; }
.stat strong, .stat small { display: block; }
.stat strong { font-size: 1.05rem; }
.stat small { color: var(--muted); margin-top: 2px; }

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-head.compact { margin-bottom: 12px; }

.profile-card { margin-top: 14px; }
.profile-identity-card { display: grid; gap: 12px; padding: 16px; }
.profile-identity-card .profile-identity-row { min-width: 0; margin: 0; gap: 14px; }
.profile-identity-card .profile-copy h3 { overflow-wrap: anywhere; }
.profile-identity-card .profile-copy p { margin: 4px 0 0; font-size: .86rem; overflow-wrap: anywhere; }
.profile-identity-card #profileSaveStatus { min-height: 0; margin: 0; }
.profile-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}
.profile-row-large {
  align-items: center;
  margin-bottom: 16px;
}
.profile-copy { flex: 1; min-width: 0; }
.profile-copy h3 {
  margin: 0;
  font-size: 1.05rem;
}
.avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #d7e8ff 0%, #cbeedb 100%);
  color: var(--primary);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 1.05rem;
  object-fit: cover;
  overflow: hidden;
  border: 2px solid #edf3ff;
}
.avatar.large {
  width: 64px;
  height: 64px;
  font-size: 1.4rem;
}
.profile-avatar-button { flex: none; padding: 0; cursor: pointer; }
.profile-edit-form { display: flex; flex-direction: column; gap: 14px; width: 100%; min-width: 0; max-height: min(88dvh, 760px); overflow-y: auto; padding: 18px; box-sizing: border-box; }
.profile-edit-form .section-head { margin: 0 0 2px; }
.profile-edit-form .section-head h2 { margin: 0; font-size: 1.25rem; }
.profile-edit-form .section-head > button { flex: none; width: 40px; height: 40px; min-height: 40px; padding: 0; border-radius: 12px; }
.profile-photo-edit { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.profile-photo-edit > .avatar { flex: 0 0 64px; width: 64px; min-width: 64px; height: 64px; aspect-ratio: 1; }
.profile-photo-edit > div { display: grid; gap: 3px; }
.profile-photo-edit small { color: var(--muted); line-height: 1.4; }
.profile-edit-section { display: grid; gap: 9px; min-width: 0; }
.profile-edit-section h3 { margin: 0; padding-bottom: 7px; border-bottom: 1px solid var(--line); font-size: .95rem; }
.profile-edit-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; min-width: 0; }
.profile-edit-grid label { min-width: 0; margin: 0; font-size: .79rem; }
.profile-edit-grid input, .profile-edit-grid select { min-width: 0; height: 46px; margin-top: 5px; padding: 10px 12px; border-radius: 11px; font-size: .88rem; }
.profile-edit-grid .profile-field-wide { grid-column: 1 / -1; }
.profile-field-hint { display: block; margin-top: 5px; color: var(--muted); font-size: .72rem; font-weight: 400; line-height: 1.35; }
.profile-privacy-note { margin: 0; color: var(--muted); font-size: .78rem; line-height: 1.5; }
.profile-consent { display: flex; align-items: flex-start; gap: 9px; font-size: .78rem; line-height: 1.45; }
.profile-consent input { flex: none; width: 18px; height: 18px; margin: 2px 0 0; }
#editProfileDialog { width: min(620px, calc(100% - 24px)); max-width: 620px; }
.profile-edit-form > .row { flex: none; margin: 0; padding: 0; background: transparent; }
@media (max-width: 520px) {
  #editProfileDialog { width: calc(100% - 20px); max-width: none; }
  .profile-edit-grid { grid-template-columns: minmax(0, 1fr); }
  .profile-edit-grid .profile-field-wide { grid-column: auto; }
  .profile-edit-form { gap: 12px; padding: 15px; }
  .profile-edit-form > .row { gap: 8px; }
}
.policy-links { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px 18px; margin: 12px 0; font-size: .78rem; }
.policy-page { width: min(100% - 32px, 760px); margin: 0 auto; padding: 32px 0 64px; line-height: 1.65; }
.policy-page h1 { margin: 14px 0; font-size: 2rem; }
.policy-page h2 { margin: 28px 0 8px; font-size: 1.15rem; }
.policy-page p, .policy-page li { color: var(--muted); }
.policy-page ul { padding-left: 22px; }
.policy-back { display: inline-block; margin-bottom: 20px; font-weight: 700; }
.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.bottom-nav {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 14px;
  padding: 6px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid var(--line);
  position: sticky;
  top: 82px;
  z-index: 10;
}

.nav-btn {
  background: transparent;
  color: var(--muted);
  border-radius: 12px;
  padding: 0.72rem 0.4rem;
  font-size: 0.8rem;
  font-weight: 700;
}

.nav-btn.active {
  background: var(--primary);
  color: white;
}

.tabs {
  display: flex;
  gap: 8px;
  margin: 12px 0 16px;
}

.tab {
  flex: 1;
  background: #edf2fb;
  color: #3d4b60;
  border-radius: 12px;
}

.tab.active {
  background: var(--primary);
  color: #fff;
}

.session-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.timer-box {
  margin-top: 18px;
  text-align: center;
  border: 1px dashed #cddaf5;
  border-radius: 18px;
  padding: 22px 18px 16px;
  background: linear-gradient(180deg, #f8fbff 0%, #eef7f3 100%);
}

#timerDisplay {
  font-size: clamp(2.2rem, 9vw, 3.2rem);
  font-weight: 800;
  letter-spacing: 0.04em;
}

#timerDisplay.timer-done {
  color: var(--good);
  animation: alarmPulse 0.35s ease-in-out 3;
}

@keyframes alarmPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

.status {
  font-size: 0.9rem;
  min-height: 1.2em;
  margin-top: 10px;
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.row > button {
  flex: 1;
}

@media (max-width: 640px) {
  .mobile-main {
    padding-left: 12px;
    padding-right: 12px;
  }

  .topbar {
    padding-left: 12px;
    padding-right: 12px;
  }

  .brand-wrap {
    min-width: 0;
  }

  .topbar h1 {
    font-size: 0.96rem;
  }

  .stats {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .session-form {
    grid-template-columns: 1fr;
  }

  .row {
    flex-direction: column;
    align-items: stretch;
  }

  .row > button {
    width: 100%;
  }

  .bottom-nav {
    position: sticky;
    top: 78px;
  }
}

@media (max-width: 420px) {
  .topbar {
    gap: 8px;
  }

  .brand-wrap {
    gap: 8px;
  }

  .brand-mark {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    font-size: 0.72rem;
  }

  .eyebrow {
    letter-spacing: 0.08em;
  }

  .welcome-screen h2 {
    max-width: 100%;
  }

  .auth-screen {
    padding: clamp(18px, 6vw, 24px);
  }

  .tabs {
    flex-direction: column;
  }

  .bottom-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 768px) {
  body {
    display: flex;
    justify-content: center;
    align-items: stretch;
    padding: 24px 0;
  }

  #app {
    min-height: calc(100dvh - 48px);
    border-radius: 28px;
    overflow: hidden;
  }

  .mobile-main {
    padding-top: 18px;
  }

  .card {
    padding: 22px;
  }

  .welcome-screen {
    min-height: 420px;
  }
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.item {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  background: #fbfcff;
}

.item-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  margin-bottom: 6px;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.28rem 0.52rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
}

.badge.good { background: #eaf8ef; color: var(--good); }
.badge.warn { background: #fff7ed; color: var(--warn); }
.badge.bad { background: #fff0f0; color: var(--danger); }

.member {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-top: 1px solid #edf2f7;
}

dialog {
  border: 0;
  border-radius: 22px;
  padding: 0;
  max-width: 460px;
  width: calc(100% - 28px);
}

dialog::backdrop { background: rgba(15, 23, 42, 0.5); }
.dialog-card { padding: 20px; }
.member-profile-dialog { min-width: min(100%, 340px); }
.progress-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}
.progress-day {
  background: #f5f7ff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 4px;
  text-align: center;
}
.progress-day strong {
  display: block;
  font-size: 0.62rem;
  color: var(--muted);
  margin-bottom: 6px;
}
.progress-badge {
  display: inline-flex;
  width: 22px;
  height: 22px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 0.72rem;
  font-weight: 800;
  background: #edf2f7;
  color: var(--muted);
}
.progress-badge.done {
  background: #eaf8ef;
  color: var(--good);
}
.progress-badge.partial {
  background: #fff7ed;
  color: var(--warn);
}
.close-profile-btn {
  width: 100%;
  margin-top: 4px;
}

.member-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: transparent;
  color: var(--text);
  border: 0;
  padding: 0;
  text-align: left;
  font-weight: 600;
}
.member-button span:last-child {
  color: var(--primary);
  font-size: 1.2rem;
}

@media (max-width: 420px) {
  .session-form,
  .stats {
    grid-template-columns: 1fr;
  }

  .topbar { padding-top: 14px; }
}

/* Header profile picture */
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-profile {
  width: 44px;
  height: 44px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  overflow: hidden;
}

.header-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #e8f0ff;
  font-size: 18px;
  font-weight: 800;
  color: #1760ff;
  overflow: hidden;
}

.header-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.daily-status-text {
  font-size: 0.76rem !important;
  line-height: 1.12;
  white-space: nowrap;
}

.remind-btn {
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 8px;
  width: auto;
  min-width: auto;
}

.streak-calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin-top: 12px;
}

.streak-day {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border-radius: 10px;
  font-weight: 600;
}

.streak-day.completed {
  background: #1769ff;
  color: white;
  border-radius: 10px;
}

.streak-day.empty {
  visibility: hidden;
}

/* Keep daily progress cards aligned in one row */
.daily-status {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 10px !important;
  width: 100%;
}

/* Keep streak, prayer and Bible aligned */
.stats {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 10px !important;
  width: 100%;
}

.stats .stat {
  width: 100% !important;
  min-width: 0 !important;
  margin: 0 !important;
}

.topbar-actions { display: flex; align-items: center; gap: 10px; }
.header-profile { width: 42px; height: 42px; padding: 0; border-radius: 50%; overflow: hidden; }
.header-avatar { width: 42px; height: 42px; display: grid; place-items: center; overflow: hidden; border-radius: 50%; background: #e8f0ff; color: var(--primary); font-weight: 800; }
.header-avatar img { width: 100%; height: 100%; object-fit: cover; }

.bottom-nav {
  position: fixed;
  z-index: 30;
  left: 50%;
  top: auto;
  bottom: calc(12px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100vw - 24px);
  grid-template-columns: repeat(5, 48px);
  gap: 4px;
  margin: 0;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px);
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.16);
}

.nav-btn {
  display: grid;
  place-items: center;
  min-width: 0;
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 12px;
  color: var(--muted);
  background: transparent;
}

.nav-btn svg {
  display: block;
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-btn:focus-visible {
  outline: 3px solid #9bbcff;
  outline-offset: 2px;
}

.nav-btn.active {
  color: #ffffff;
  background: var(--primary);
}

.metric-icon-wrap {
  display: grid;
  flex: 0 0 28px;
  place-items: center;
}

.metric-icon {
  display: block;
  width: 25px;
  height: 25px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.flame-icon { color: #c76b2a; }
.prayer-icon { color: #a64d6a; }
.bible-icon { color: #247f73; }
.activity-icon { display: block; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.activity-icon-prayer { color: #a64d6a; }
.activity-icon-bible { color: #247f73; }
.history-icon { display: inline-block; vertical-align: -4px; margin-right: 7px; }
.history-icon-prayer { color: #a64d6a; }
.history-icon-bible { color: #247f73; }
.history-heading { align-items: center; margin-bottom: 12px; }
.history-heading h2 { margin: 4px 0 0; font-size: 1.1rem; }
.history-toggle { display: inline-flex; align-items: center; gap: 5px; padding: 8px 10px; border-radius: 10px; background: var(--primary-soft); color: var(--primary); font-size: 0.78rem; }
.history-toggle svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform 140ms ease; }
.history-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
.session-history { gap: 7px; }
.session-history .history-item { padding: 9px 11px; border-radius: 12px; box-shadow: none; }
.session-history .item-head { margin: 0; align-items: center; }
.session-history .item-head strong { display: flex; align-items: center; gap: 2px; font-size: 0.84rem; }
.session-history .history-icon { width: 17px; height: 17px; margin-right: 4px; vertical-align: 0; }
.session-history .badge { padding: 0.23rem 0.45rem; font-size: 0.67rem; }
.session-history .history-item p { margin: 4px 0 0; font-size: 0.72rem; line-height: 1.3; }

.appearance-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.appearance-row h3 { margin: 5px 0 3px; font-size: 1rem; }
.appearance-row .muted { margin: 0; font-size: 0.82rem; }
.theme-toggle {
  position: relative;
  flex: 0 0 54px;
  width: 54px;
  height: 32px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #dfe5ec;
  transition: background-color 160ms ease;
}
.theme-toggle[aria-checked="true"] { background: var(--primary); }
.theme-toggle-thumb {
  display: block;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform 160ms ease;
}
.theme-toggle[aria-checked="true"] .theme-toggle-thumb { transform: translateX(22px); }

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #05080f;
  --shell: #090e18;
  --card: #0e1624;
  --text: #edf4ff;
  --muted: #9daec6;
  --primary: #0b5cff;
  --primary-soft: #182d4e;
  --line: #263650;
  --good: #9dc2ff;
  --warn: #f0c77e;
  --danger: #ff9a9a;
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.42);
}

html[data-theme="dark"] body { background: linear-gradient(180deg, #05080f 0%, #0b1425 100%); }
html[data-theme="dark"] .topbar { background: rgba(9, 14, 24, 0.94); border-bottom-color: var(--line); }
html[data-theme="dark"] .card { box-shadow: 0 18px 30px rgba(0, 0, 0, 0.12); }
html[data-theme="dark"] button.ghost { border-color: var(--line); }
html[data-theme="dark"] .welcome-screen { background: linear-gradient(135deg, #0e1624 0%, #132644 55%, #101b30 100%); }
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea { background: #0a111d; border-color: var(--line); color: var(--text); }
html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder { color: #8496b0; }
html[data-theme="dark"] .brand-mark { background: linear-gradient(135deg, #2047a5 0%, #0b5cff 100%); }
html[data-theme="dark"] .tab { background: #172235; color: #d9e6fa; }
html[data-theme="dark"] .tab.active { background: var(--primary); color: #071225; }
html[data-theme="dark"] .timer-box { border-color: #314b75; background: linear-gradient(180deg, #0d1728 0%, #101f38 100%); }
html[data-theme="dark"] .item { background: #0b1423; border-color: var(--line); }
html[data-theme="dark"] .history-icon-prayer,
html[data-theme="dark"] .history-icon-bible { color: #6d9cff; }
html[data-theme="dark"] .badge.good { background: #142644; color: #b6d2ff; }
html[data-theme="dark"] .badge.warn { background: #473b25; color: #f2d394; }
html[data-theme="dark"] .badge.bad { background: #482d31; color: #ffb1b1; }
html[data-theme="dark"] .member { border-top-color: #263650; }
html[data-theme="dark"] dialog { background: var(--card); color: var(--text); }
html[data-theme="dark"] dialog::backdrop { background: rgba(0, 0, 0, 0.72); }
html[data-theme="dark"] .streak-day { background: #152033; color: var(--text); }
html[data-theme="dark"] .streak-day.day-missed { background: #101721; color: #9ba9bd; }
html[data-theme="dark"] .streak-day.both-complete { background: #18355f; color: #d2e3ff; }
html[data-theme="dark"] .streak-day.partially-complete { background: #1b2b48; color: #c2d8ff; }
html[data-theme="dark"] .day-marks i { background: #293750; color: #d8e4f7; }
html[data-theme="dark"] .day-marks .prayer-mark.marked { background: #315895; color: #e0ecff; }
html[data-theme="dark"] .day-marks .bible-mark.marked { background: #4774b5; color: #e7f0ff; }
html[data-theme="dark"] .both-complete .day-marks .marked { background: #5482c7; color: #ffffff; }
html[data-theme="dark"] .legend-dot { background: #18355f; border-color: #4774b5; }
html[data-theme="dark"] .legend-dot.partial { background: #1b2b48; border-color: #5279b2; }
html[data-theme="dark"] .legend-dot.none { background: #101721; border-color: #53627a; }
html[data-theme="dark"] .day-activity { background: #0b1423; }
html[data-theme="dark"] .day-activity.is-complete { background: #142644; }
html[data-theme="dark"] .day-activity-icon { background: #17243a; }
html[data-theme="dark"] .day-activity-state { color: #b1bfd4; }
html[data-theme="dark"] .day-activity.is-complete .day-activity-state { color: #b6d2ff; }
html[data-theme="dark"] .activity-icon-prayer { color: #0b5cff; }
html[data-theme="dark"] .activity-icon-bible { color: #0b5cff; }
html[data-theme="dark"] .flame-icon,
html[data-theme="dark"] .prayer-icon,
html[data-theme="dark"] .bible-icon { color: #0b5cff; }
html[data-theme="dark"] .header-avatar { background: #182d4e; color: #c5dcff; }
html[data-theme="dark"] .avatar { background: linear-gradient(135deg, #1b2e4d 0%, #24477d 100%); color: #d2e3ff; border-color: #314b75; }
html[data-theme="dark"] .bottom-nav { background: rgba(14, 22, 36, 0.96); border-color: #263650; box-shadow: 0 8px 28px rgba(0, 0, 0, 0.55); }
html[data-theme="dark"] .nav-btn { color: #b1c1d9; }
html[data-theme="dark"] .nav-btn.active { color: #071225; background: var(--primary); }
html[data-theme="dark"] .theme-toggle { background: #293750; border-color: #405573; }
html[data-theme="dark"] .theme-toggle[aria-checked="true"] { background: var(--primary); }
html[data-theme="dark"] .theme-toggle-thumb { background: #f4f8ff; }

.app-page:not(.hidden) { animation: page-arrive 180ms ease-out; }
@keyframes page-arrive {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-heading { padding: 12px 4px 6px; }
.page-heading h2 { margin: 6px 0; font-size: 1.65rem; }
.page-heading .muted { margin: 0 0 10px; line-height: 1.45; }
.home-hero { padding: 16px 18px; }
.home-hero h2 { margin: 6px 0; font-size: 1.55rem; }
.home-hero .muted { margin: 0; }
.daily-status { margin-top: 12px; }
.daily-status .stat { gap: 6px; padding: 12px 8px; border-radius: 16px; }
.daily-status .stat > span { font-size: 1.15rem; }
.daily-status .stat strong { font-size: 0.78rem; white-space: nowrap; }
.daily-status .stat small { font-size: 0.7rem; }

.calendar-card { padding: 16px 14px; }
.calendar-heading { align-items: center; margin-bottom: 16px; }
.calendar-heading h2 { margin: 5px 0 0; font-size: 1.2rem; }
.streak-month-nav { display: flex; align-items: center; gap: 8px; }
.streak-month-nav strong { min-width: 92px; text-align: center; font-size: 0.82rem; }
.calendar-nav { width: 34px; height: 34px; padding: 0; border-radius: 50%; font-size: 1.35rem; line-height: 1; }
.calendar-nav:disabled { opacity: 0.35; }
.streak-weekdays { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin-bottom: 5px; }
.streak-weekdays span { padding: 5px 0; text-align: center; color: var(--muted); font-size: 0.68rem; font-weight: 700; }
.streak-calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin: 0; }
.streak-day {
  position: relative;
  display: grid;
  grid-template-rows: 1fr auto;
  align-items: center;
  justify-items: center;
  width: 100%;
  min-width: 0;
  min-height: 54px;
  padding: 5px 2px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: #f3f6fb;
  color: var(--text);
  font-weight: 700;
  scroll-margin-block: 96px;
}
.streak-day.empty { visibility: hidden; }
.streak-day:disabled { opacity: 0.45; cursor: default; }
.streak-day.day-missed { background: #f4f5f7; color: #8c96a6; }
.streak-day.both-complete { background: #e8f6ec; color: #176b35; }
.streak-day.partially-complete { background: #eaf3ff; color: #184e9e; }
.streak-day.is-today { border-color: var(--primary); }
.streak-day.is-selected { box-shadow: inset 0 0 0 2px var(--primary); }
.day-number { font-size: 0.82rem; line-height: 1.1; }
.day-marks { display: flex; gap: 3px; min-height: 13px; }
.day-marks i { display: grid; place-items: center; width: 13px; height: 13px; border-radius: 50%; background: #dce2eb; color: #667085; font-size: 0.48rem; font-style: normal; font-weight: 800; }
.day-marks .prayer-mark.marked { background: #f0bf61; color: #543a0a; }
.day-marks .bible-mark.marked { background: #67b4a1; color: #073d32; }
.both-complete .day-marks .marked { background: #b6dfc1; color: #14532d; }
.calendar-legend { display: flex; flex-wrap: wrap; gap: 10px 14px; padding: 12px 2px 4px; color: var(--muted); font-size: 0.68rem; }
.calendar-legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot { width: 9px; height: 9px; border-radius: 50%; background: #e8f6ec; border: 1px solid #97cba5; }
.legend-dot.partial { background: #eaf3ff; border-color: #9abce9; }
.legend-dot.none { background: #f4f5f7; border-color: #cdd2dc; }
.selected-day { margin-top: 10px; padding-top: 14px; border-top: 1px solid var(--line); }
.selected-day-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.selected-day-heading h3 { margin: 4px 0 0; font-size: 0.96rem; }
.day-activity-list { display: grid; gap: 8px; }
.day-activity { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 9px; border-radius: 12px; background: #f7f9fc; }
.day-activity.is-complete { background: #f0f8f2; }
.day-activity-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 10px; background: white; }
.day-activity strong, .day-activity small { display: block; }
.day-activity strong { font-size: 0.8rem; }
.day-activity small { margin-top: 2px; color: var(--muted); font-size: 0.67rem; line-height: 1.25; }
.day-activity-state { max-width: 94px; text-align: right; color: var(--muted); font-size: 0.64rem; }
.day-activity.is-complete .day-activity-state { color: var(--good); font-weight: 700; }
.profile-row-large { margin: 0 0 16px; }
.full-width { width: 100%; }
.profile-summary { padding-top: 14px; }
.profile-summary-row { display: flex; justify-content: space-between; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line); font-size: 0.9rem; }
.profile-summary-row:last-child { border-bottom: 0; }
.profile-summary-row strong { text-align: right; }

.meditation-timer { position: relative; display: grid; justify-items: center; gap: 7px; padding: 22px 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--shell); overflow: hidden; }
.meditation-orbit { position: absolute; top: 50%; left: 50%; width: 150px; height: 150px; border: 1px solid color-mix(in srgb, var(--primary) 18%, transparent); border-radius: 50%; transform: translate(-50%,-50%); pointer-events: none; }
.meditation-timer strong { position: relative; color: var(--primary); font-size: 2.4rem; font-variant-numeric: tabular-nums; line-height: 1; }
.meditation-timer span:last-child { position: relative; color: var(--muted); font-size: 0.78rem; }
.meditation-actions > button { min-width: 0; }
.confession-privacy { margin: 0 0 12px; font-size: 0.8rem; line-height: 1.4; }
#confessionText { min-height: 150px; resize: vertical; }
.confession-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; }
.confession-footer span { font-size: 0.72rem; }
.confession-footer button { flex: 0 0 auto; padding: 0.68rem 0.78rem; font-size: 0.78rem; }

.auth-screen:not(.welcome-screen) {
  margin-top: 2vh;
  border-top: 3px solid var(--primary);
}
.auth-screen h2 { font-size: 1.7rem; }
.password-field { position: relative; display: block; }
.password-field input { padding-right: 3.25rem; }
.password-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  transform: translateY(-50%);
  border-radius: 10px;
  color: var(--muted);
  background: transparent;
}
.password-toggle:hover { background: var(--primary-soft); }
.password-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.password-slash { opacity: 0; transition: opacity 120ms ease; }
.password-toggle[aria-pressed="true"] .password-slash { opacity: 1; }

.bible-controls { padding-bottom: 12px; }
.bible-reference-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 0.75fr); gap: 12px; }
.bible-reader { scroll-margin-top: 90px; }
.bible-reader-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.bible-reader-head h2 { margin: 5px 0 0; font-size: 1.3rem; }
.bible-chapter-nav { display: flex; gap: 6px; }
.bible-chapter-nav button { width: 40px; height: 40px; padding: 0; font-size: 1.4rem; }
.bible-chapter-nav button:disabled { opacity: 0.35; }
.bible-license-note { margin: 0 0 12px; font-size: 0.77rem; }
.bible-content { max-width: 65ch; margin: 18px auto; color: var(--text); font-family: "Source Serif 4", Georgia, serif; font-size: 1.08rem; line-height: 1.8; overflow-wrap: anywhere; }
.bible-verse { display: grid; grid-template-columns: 1.5rem minmax(0, 1fr) 32px; align-items: start; gap: 5px; margin: 0; padding: 9px 0; border-bottom: 1px solid color-mix(in srgb, var(--line) 75%, transparent); }
.bible-verse-number { padding-top: 1px; color: var(--primary); font-family: Inter, system-ui, sans-serif; font-size: 0.72rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.verse-highlight-toggle { display: grid; place-items: center; width: 30px; height: 32px; padding: 0; color: var(--muted); background: transparent; border-radius: 9px; }
.verse-highlight-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.verse-highlight-toggle:hover,
.verse-highlight-toggle[aria-pressed="true"] { color: var(--primary); background: var(--primary-soft); }
.bible-verse.is-highlighted { background: color-mix(in srgb, var(--primary) 8%, transparent); }
.bible-paragraph { display: block; }
.bible-attribution { padding-top: 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.72rem; line-height: 1.5; }

.auth-screen:not(.welcome-screen) {
  border: 1px solid var(--line);
  border-top: 3px solid var(--primary);
  box-shadow: var(--shadow);
  animation: page-arrive 180ms ease-out;
}
.auth-screen:not(.welcome-screen) h2 { margin-bottom: 8px; font-size: 1.8rem; }
.auth-screen:not(.welcome-screen) > .muted { margin: 0 0 22px; }
.auth-screen:not(.welcome-screen) label { margin: 18px 0; color: var(--text); }
.auth-screen input:focus-visible,
.auth-screen select:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 32%, transparent); border-color: var(--primary); }
.password-toggle:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 32%, transparent); }
.bible-controls .status { margin-bottom: 0; }
.bible-reader { animation: page-arrive 180ms ease-out; }

html[data-theme="dark"] .bible-content { color: #e7efff; }
html[data-theme="dark"] .bible-attribution { color: #aab9d1; }
html[data-theme="dark"] .bible-verse.is-highlighted { background: rgba(11,92,255,0.12); }
html[data-theme="dark"] .verse-highlight-toggle[aria-pressed="true"] { color: #78a8ff; background: #182d4e; }
html[data-theme="dark"] .password-toggle { color: #b6c8e3; }
html[data-theme="dark"] .auth-screen:not(.welcome-screen) { background: var(--card); }
html[data-theme="dark"] .meditation-timer { background: #0a111d; border-color: #263650; }
html[data-theme="dark"] .meditation-orbit { border-color: rgba(11,92,255,0.28); }

@media (max-width: 360px) {
  .bottom-nav { grid-template-columns: repeat(5, 42px); gap: 2px; padding: 5px; }
  .nav-btn { width: 42px; height: 42px; }
  .daily-status .stat { padding: 10px 5px; }
  .daily-status .stat > span { font-size: 1rem; }
  .daily-status .stat strong { font-size: 0.68rem; }
  .daily-status-text { font-size: 0.68rem !important; }
  .day-activity { grid-template-columns: 28px minmax(0, 1fr); }
  .day-activity-state { grid-column: 2; max-width: none; text-align: left; }
  .bible-reference-fields { grid-template-columns: 1fr; gap: 0; }
  .meditation-actions { flex-direction: row; }
  .meditation-actions > button { padding-left: 0.5rem; padding-right: 0.5rem; font-size: 0.78rem; }
}

.reading-badge-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.reading-badge { display: flex; align-items: flex-start; gap: 9px; min-width: 0; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--shell); }
.reading-badge-icon { display: grid; flex: 0 0 34px; place-items: center; width: 34px; height: 34px; border-radius: 10px; color: var(--muted); background: var(--primary-soft); }
.reading-badge-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.reading-badge.earned .reading-badge-icon { color: var(--primary); background: color-mix(in srgb, var(--primary) 15%, var(--card)); }
.reading-badge-copy { display: grid; min-width: 0; gap: 3px; }
.reading-badge-copy strong { font-size: 0.75rem; line-height: 1.2; }
.reading-badge-copy small { color: var(--muted); font-size: 0.63rem; line-height: 1.25; }
.reading-badge-progress { color: var(--muted); font-size: 0.64rem; font-weight: 700; }
.reading-badge.earned .reading-badge-progress { color: var(--primary); }

.highlight-entry { display: grid; gap: 7px; }
.highlight-entry > strong { color: var(--primary); font-size: 0.8rem; }
.highlight-entry > p { margin: 0; font-family: "Source Serif 4", Georgia, serif; font-size: 0.94rem; line-height: 1.5; }
.highlight-open { justify-self: start; padding: 0.5rem 0.68rem; font-size: 0.74rem; }
.bible-verse { position: relative; }
.bible-verse.is-highlighted { border-radius: 8px; }
.verse-highlight-toggle[aria-pressed="true"] svg { fill: color-mix(in srgb, currentColor 22%, transparent); }
.instrumental-add-row { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr) auto; gap: 8px; align-items: end; }
.instrumental-add-row label { margin-bottom: 0; font-size: 0.78rem; }
.instrumental-add-row button { min-height: 44px; padding: 0 0.8rem; font-size: 0.78rem; }
.instrumental-track audio { display: block; width: 100%; height: 40px; margin-top: 8px; }
.instrumental-track .item-head { margin: 0; }
.practice-notes-card textarea { min-height: 120px; }
.confession-entry { display: grid; gap: 8px; }
.confession-entry-body { margin: 0; font-size: 0.84rem; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.confession-entry-actions { display: flex; justify-content: flex-end; gap: 7px; }
.confession-entry-actions button { padding: 0.48rem 0.65rem; font-size: 0.72rem; }
.confession-list-heading { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.confession-list-heading h3 { margin: 0; font-size: 0.98rem; }
html[data-theme="dark"] .highlight-entry > p { color: #dce8f8; }

@media (max-width: 430px) {
  .instrumental-add-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .instrumental-add-row button { grid-column: 1 / -1; }
}

.circle-chat-button { display: flex; justify-content: center; width: 100%; margin-top: 9px; }
.circle-chat-dialog { display: grid; grid-template-rows: auto minmax(150px, 1fr) auto auto; width: 100%; max-height: min(82dvh, 720px); gap: 12px; padding: 16px; }
.chat-heading { margin: 0; }
.chat-heading h2 { margin: 4px 0 0; font-size: 1.15rem; }
.chat-heading button { flex: 0 0 40px; width: 40px; height: 40px; padding: 0; border-radius: 50%; font-size: 1.3rem; }
.circle-chat-messages { display: flex; flex-direction: column; gap: 8px; min-height: 150px; max-height: 46vh; overflow-y: auto; padding: 8px 2px; }
.chat-message { align-self: flex-start; width: fit-content; max-width: 88%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 13px 13px 13px 4px; background: var(--shell); overflow-wrap: anywhere; }
.chat-message.mine { align-self: flex-end; border-color: color-mix(in srgb, var(--primary) 25%, var(--line)); border-radius: 13px 13px 4px 13px; background: var(--primary-soft); }
.chat-message-meta { display: flex; align-items: baseline; gap: 8px; margin-bottom: 3px; }
.chat-message-meta strong { color: var(--primary); font-size: 0.7rem; }
.chat-message-meta time { color: var(--muted); font-size: 0.62rem; }
.chat-message p { margin: 0; font-size: 0.82rem; line-height: 1.4; white-space: pre-wrap; }
.chat-empty { margin: auto; text-align: center; }
.circle-chat-form { display: grid; grid-template-columns: minmax(0, 1fr) 46px; gap: 8px; align-items: end; }
.circle-chat-form textarea { min-height: 46px; max-height: 110px; margin: 0; resize: vertical; }
.circle-chat-form button { display: grid; place-items: center; width: 46px; height: 46px; padding: 0; border-radius: 13px; }
.circle-chat-form button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.circle-chat-form button:disabled { opacity: 0.6; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

html[data-theme="dark"] .reading-badge { background: #0b1423; border-color: var(--line); }
html[data-theme="dark"] .reading-badge-icon { background: #17243a; }
html[data-theme="dark"] .reading-badge.earned .reading-badge-icon { background: #18355f; }
html[data-theme="dark"] .chat-message { background: #0b1423; }
html[data-theme="dark"] .chat-message.mine { background: #142644; }
html[data-theme="dark"] .circle-chat-dialog { background: var(--card); }

@media (max-width: 350px) {
  .reading-badge-grid { grid-template-columns: 1fr; }
}
.circle-actions { display: flex; gap: 8px; margin-top: 9px; }
.circle-actions button { flex: 1; }
button.danger { background: transparent; color: #c62828; border: 1px solid #c62828; }
html[data-theme="dark"] button.danger { color: #ff8a80; border-color: #ff8a80; }
#circleInviteDialog .dialog-card { display: grid; gap: 10px; }

/* Circle members */
.circle-members { display: grid; gap: 8px; margin: 10px 0; }
.member { display: flex; align-items: center; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 16px; background: var(--primary-soft); }
.member-button { gap: 12px; }
.member-avatar { flex: none; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #fff; background: linear-gradient(135deg, #0b5cff, #6aa0ff); }
.member-info { flex: 1; min-width: 0; }
.member-name { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-weight: 700; margin-bottom: 6px; }
.member-tag { font-style: normal; font-size: .62rem; font-weight: 700; padding: 2px 7px; border-radius: 999px; background: var(--line); color: var(--muted); }
.member-tag.owner { background: #0b5cff; color: #fff; }
.week-strip { display: flex; gap: 4px; }
.week-dot { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: .6rem; font-weight: 800; background: var(--line); color: var(--muted); transition: transform .15s; }
.week-dot.done { background: #1fa971; color: #fff; }
.week-dot.partial { background: #f5a524; color: #fff; }
.week-dot.today { outline: 2px solid var(--primary); outline-offset: 1px; }
.member-button:active .week-dot { transform: scale(1.15); }
.streak-chip { flex: none; display: grid; place-items: center; min-width: 58px; padding: 6px 8px; border-radius: 14px; background: var(--line); color: var(--muted); line-height: 1.1; }
.streak-chip b { font-size: 1.15rem; }
.streak-chip small { font-size: .56rem; font-weight: 700; }
.streak-chip.active { background: linear-gradient(135deg, #ff7a18, #ff3d6e); color: #fff; box-shadow: 0 4px 12px rgba(255, 90, 60, .35); }
.streak-chip.active b::before { content: "🔥"; font-size: .9rem; margin-right: 2px; }
html[data-theme="dark"] .member { background: #14213a; border-color: #263650; }

.member.pending { opacity: .75; border-style: dashed; }
.member.pending .member-avatar { background: var(--line); color: var(--muted); }

/* Circle layout fit */
.circle-item { min-width: 0; overflow: hidden; }
.circle-item .item-head { flex-wrap: wrap; gap: 6px; }
.circle-members { min-width: 0; }
.member { min-width: 0; flex-wrap: wrap; padding: 8px; }
.member-button { flex: 1 1 0; width: auto; min-width: 0; gap: 8px; }
.member-avatar { width: 36px; height: 36px; font-size: .9rem; }
.member-name { min-width: 0; overflow-wrap: anywhere; font-size: .9rem; }
.week-strip { gap: 3px; }
.week-dot { width: 17px; height: 17px; font-size: .55rem; }
.streak-chip { min-width: 48px; padding: 5px 6px; }
.member .remind-btn { flex: 0 0 auto; margin-left: auto; }
.circle-actions { flex-wrap: wrap; }
.circle-actions button, .circle-chat-button { min-width: 0; }

/* Equal week dots, smaller streak chip */
.week-strip { gap: 3px; flex-wrap: nowrap; }
.week-dot { flex: 0 0 16px; width: 16px; height: 16px; min-width: 16px; padding: 0; line-height: 1; font-size: .52rem; box-sizing: border-box; }
.streak-chip { min-width: 40px; padding: 3px 5px; border-radius: 12px; }
.streak-chip b { font-size: .9rem; }
.streak-chip small { font-size: .48rem; }
.streak-chip.active b::before { font-size: .7rem; margin-right: 1px; }
.member .remind-btn { padding: 5px 8px; font-size: 11px; }

/* Today ring stays inside the dot so all dots are equal; streak and Remind stack */
.week-dot.today { outline: none; background: #0b5cff; color: #fff; }
.week-dot.today.done { background: #1fa971; box-shadow: inset 0 0 0 2px #0b5cff; }
.week-dot.today.partial { background: #f5a524; box-shadow: inset 0 0 0 2px #0b5cff; }
.member { flex-wrap: nowrap; align-items: center; }
.member-side { flex: 0 0 auto; display: flex; flex-direction: column; align-items: stretch; gap: 5px; width: 62px; }
.member-side .streak-chip { min-width: 0; width: 100%; }
.member-side .remind-btn { width: 100%; margin: 0; padding: 4px 0; text-align: center; }

.week-dot.today { color: #fff !important; font-weight: 900; }

.week-dot.today { font-size: .52rem !important; font-weight: 800 !important; line-height: 1 !important; }

/* Music player */
.music-player { margin: 10px 0; padding: 10px; border-radius: 16px; background: var(--primary-soft); border: 1px solid var(--line); min-height: 60px; }
.music-player iframe { display: block; width: 100%; border: 0; border-radius: 12px; margin-top: 8px; }
.music-player audio { display: block; width: 100%; margin-top: 8px; }
.music-now { display: block; font-size: .9rem; }
.music-add { display: grid; gap: 8px; }
.music-find { font-size: .78rem; margin: 8px 0 0; }
.instrumental-track { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 10px; }
.instrumental-track strong { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .88rem; }
.instrumental-track button { flex: none; min-height: 34px; padding: 0 12px; font-size: .78rem; }
.music-badge { flex: none; padding: 3px 8px; border-radius: 999px; font-size: .62rem; font-weight: 800; color: #fff; background: #64748b; }
.music-badge.youtube { background: #e62117; }
.music-badge.spotify { background: #1db954; }

/* Music player redesign */
.np { padding: 14px; border-radius: 22px; color: #fff; background: linear-gradient(160deg, #0b5cff 0%, #1b2f6b 100%); box-shadow: 0 10px 26px rgba(11, 92, 255, .28); }
.np-art { position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: 16px; overflow: hidden; background: rgba(255,255,255,.12); }
.np-art iframe, .np-art > div { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.np-art iframe { pointer-events: none; }
.np-placeholder { display: grid; place-items: center; }
.np-placeholder svg { width: 54px; height: 54px; fill: none; stroke: #fff; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; opacity: .85; }
.np-meta { display: grid; gap: 2px; margin: 12px 2px 6px; min-width: 0; }
.np-meta strong { font-size: 1.02rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.np-meta span { font-size: .78rem; opacity: .8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.np-seek { width: 100%; accent-color: #fff; height: 18px; margin: 4px 0 0; padding: 0; background: transparent; border: 0; }
.np-times { display: flex; justify-content: space-between; font-size: .7rem; opacity: .8; }
.np-controls { display: flex; justify-content: center; align-items: center; gap: 22px; margin-top: 8px; }
.np-btn { width: 44px; height: 44px; padding: 0; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.16); border: 0; color: #fff; }
.np-btn svg { width: 22px; height: 22px; fill: #fff; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.np-main { width: 58px; height: 58px; background: #fff; }
.np-main svg { fill: #0b5cff; stroke: #0b5cff; width: 26px; height: 26px; }
.music-chips { display: flex; gap: 8px; overflow-x: auto; padding: 14px 0 6px; scrollbar-width: none; }
.music-chip { flex: none; min-height: 34px; padding: 0 14px; border-radius: 999px; font-size: .78rem; background: var(--primary-soft); color: var(--primary); border: 1px solid var(--line); }
.music-chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.music-list { display: grid; gap: 8px; margin-top: 6px; }
.music-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px; text-align: left; border-radius: 14px; background: transparent; color: var(--text); border: 1px solid var(--line); min-width: 0; }
.music-row img { flex: none; width: 64px; height: 44px; border-radius: 10px; object-fit: cover; background: var(--line); }
.music-row-meta { display: grid; gap: 2px; min-width: 0; }
.music-row-meta strong { font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.music-row-meta small { font-size: .72rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.music-row.playing { background: var(--primary-soft); border-color: var(--primary); }
.music-row.playing strong { color: var(--primary); }

/* Onboarding */
.onboarding { position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; align-items: center; padding: max(20px, env(safe-area-inset-top)) 24px max(24px, env(safe-area-inset-bottom)); background: linear-gradient(160deg, #0b5cff 0%, #1b2f6b 100%); color: #fff; }
.onboard-skip { align-self: flex-end; background: transparent; color: #fff; border: 0; padding: 8px 4px; font-weight: 600; opacity: .85; }
.onboard-slides { flex: 1; width: 100%; max-width: 420px; display: grid; align-items: center; }
.onboard-slide { grid-area: 1 / 1; display: none; flex-direction: column; align-items: center; text-align: center; gap: 14px; }
.onboard-slide.active { display: flex; animation: onboard-in .35s ease-out; }
.onboard-slide h1 { margin: 6px 0 0; font-size: 1.9rem; line-height: 1.15; color: #fff; }
.onboard-slide p { margin: 0; max-width: 300px; font-size: 1rem; line-height: 1.5; opacity: .9; color: #fff; }
.onboard-logo { width: 132px; height: 132px; border-radius: 30px; box-shadow: 0 16px 40px rgba(0, 0, 0, .35); }
.onboard-icon { width: 112px; height: 112px; border-radius: 30px; display: grid; place-items: center; background: rgba(255, 255, 255, .16); }
.onboard-icon svg { width: 56px; height: 56px; fill: none; stroke: #fff; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.onboard-dots { display: flex; gap: 8px; margin: 12px 0 18px; }
.onboard-dots span { width: 8px; height: 8px; border-radius: 999px; background: rgba(255, 255, 255, .4); transition: width .2s; }
.onboard-dots span.active { width: 24px; background: #fff; }
.onboard-next { width: 100%; max-width: 420px; min-height: 52px; border-radius: 16px; background: #fff; color: #0b5cff; font-weight: 800; border: 0; }
@keyframes onboard-in { from { opacity: 0; transform: translateX(18px); } to { opacity: 1; transform: none; } }

/* App tour */
.tour { position: fixed; inset: 0; z-index: 90; }
.tour-spot { position: fixed; border-radius: 18px; box-shadow: 0 0 0 9999px rgba(8, 16, 40, .72); outline: 3px solid #fff; transition: all .25s ease; pointer-events: none; }
.tour-card { position: fixed; left: 16px; right: 16px; bottom: calc(96px + env(safe-area-inset-bottom)); max-width: 420px; margin: 0 auto; padding: 18px; border-radius: 20px; background: var(--card, #fff); color: var(--text); box-shadow: 0 16px 40px rgba(0, 0, 0, .35); }
.tour-card h3 { margin: 4px 0 6px; font-size: 1.2rem; }
.tour-card p:not(.eyebrow) { margin: 0 0 14px; color: var(--muted); line-height: 1.45; }
.tour-card .row { display: flex; gap: 10px; }
.tour-card .row button { flex: 1; }

/* Onboarding mobile fit */
.onboarding { height: 100vh; height: 100dvh; width: 100%; overflow-y: auto; overscroll-behavior: contain; box-sizing: border-box; padding-left: max(24px, env(safe-area-inset-left)); padding-right: max(24px, env(safe-area-inset-right)); }
.onboard-skip { width: auto; min-height: 44px; min-width: 44px; margin: 0; }
.onboard-slides { min-height: 0; padding: 8px 0; }
.onboard-slide h1, .onboard-slide p { overflow-wrap: anywhere; }
.onboard-dots { flex: none; }
.onboard-next { flex: none; margin: 0; }
@media (max-height: 640px) {
  .onboard-logo { width: 96px; height: 96px; border-radius: 22px; }
  .onboard-icon { width: 80px; height: 80px; border-radius: 22px; }
  .onboard-icon svg { width: 40px; height: 40px; }
  .onboard-slide { gap: 10px; }
  .onboard-slide h1 { font-size: 1.5rem; }
  .onboard-slide p { font-size: .92rem; }
}
@media (max-width: 360px) {
  .onboard-slide h1 { font-size: 1.6rem; }
  .onboard-slide p { font-size: .94rem; }
}
@media (min-width: 700px) {
  .onboarding { justify-content: center; }
  .onboard-slides { flex: 0 1 auto; }
}

/* Header logo image */
img.brand-mark, html[data-theme="dark"] img.brand-mark { display: block; flex: none; background: none; object-fit: cover; }

/* Circle message notifications */
.nav-btn { position: relative; }
.nav-badge { position: absolute; top: 2px; right: 6px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: #e5334b; color: #fff; font-size: .62rem; font-weight: 800; display: grid; place-items: center; line-height: 1; }
.chat-toast { position: fixed; left: 12px; right: 12px; top: calc(12px + env(safe-area-inset-top)); z-index: 120; max-width: 420px; margin: 0 auto; display: grid; gap: 2px; text-align: left; padding: 12px 14px; border-radius: 16px; background: var(--card, #fff); color: var(--text); border: 1px solid var(--line); box-shadow: 0 12px 32px rgba(0, 0, 0, .28); transform: translateY(-140%); opacity: 0; pointer-events: none; transition: transform .25s ease, opacity .25s ease; }
.chat-toast.show { transform: none; opacity: 1; pointer-events: auto; }
.chat-toast strong { font-size: .85rem; color: var(--primary); }
.chat-toast span { font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Chat reply and edit */
.chat-message-actions { display: flex; gap: 12px; margin-top: 4px; }
.chat-action { min-height: 0; padding: 0; background: transparent; border: 0; color: var(--muted); font-size: .68rem; font-weight: 700; }
.chat-action:hover { color: var(--primary); }
.chat-quote { display: grid; gap: 1px; margin-bottom: 5px; padding: 5px 8px; border-left: 3px solid var(--primary); border-radius: 6px; background: color-mix(in srgb, var(--primary) 8%, transparent); }
.chat-quote strong { font-size: .64rem; color: var(--primary); }
.chat-quote span { font-size: .72rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-context { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 10px; border-radius: 10px; background: var(--primary-soft); border-left: 3px solid var(--primary); font-size: .74rem; color: var(--text); }
.chat-context span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.circle-chat-form .chat-context button { width: 26px; height: 26px; flex: none; border-radius: 50%; background: transparent; color: var(--muted); font-size: 1.1rem; padding: 0; }

/* Reminders */
.reminders-card .section-head h2 { font-size: 1.05rem; }
.reminders-count { min-width: 24px; height: 24px; padding: 0 8px; border-radius: 999px; display: grid; place-items: center; background: var(--primary); color: #fff; font-size: .72rem; font-weight: 800; }
.reminder-row { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 14px; background: var(--primary-soft); border: 1px solid var(--line); }
.reminder-avatar { flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-size: .8rem; font-weight: 800; color: #fff; background: linear-gradient(135deg, #0b5cff, #6aa0ff); }
.reminder-body { flex: 1; min-width: 0; display: grid; gap: 1px; }
.reminder-body strong { font-size: .82rem; }
.reminder-body span { font-size: .74rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reminder-row time { flex: none; font-size: .66rem; color: var(--muted); }
.reminder-toggle { justify-self: center; min-height: 32px; padding: 0 14px; background: transparent; border: 0; color: var(--primary); font-size: .76rem; font-weight: 700; }
.reminder-empty { display: grid; justify-items: center; gap: 8px; padding: 14px 10px; text-align: center; border: 1px dashed var(--line); border-radius: 14px; }
.reminder-empty svg { width: 28px; height: 28px; fill: none; stroke: var(--muted); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.reminder-empty p { margin: 0; font-size: .78rem; color: var(--muted); max-width: 240px; }
html[data-theme="dark"] .reminder-row { background: #14213a; border-color: #263650; }
html[data-theme="dark"] .chat-context { background: #14213a; }

/* Receipts, chat header, circle photo */
.circle-chat-dialog { grid-template-rows: auto auto minmax(150px, 1fr) auto auto; }
.chat-title-wrap { display: flex; align-items: center; gap: 10px; min-width: 0; }
.circle-avatar { position: relative; flex: none; width: 40px; height: 40px; padding: 0; border-radius: 50%; display: grid; place-items: center; overflow: visible; font-weight: 800; color: #fff; background: linear-gradient(135deg, #0b5cff, #6aa0ff); border: 0; }
.circle-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.circle-avatar-badge { position: absolute; right: -3px; bottom: -3px; width: 16px; height: 16px; border-radius: 50%; display: grid; place-items: center; background: #fff; color: #0b5cff; font-style: normal; font-size: .8rem; font-weight: 800; border: 1px solid var(--line); line-height: 1; }
.circle-head { display: flex; align-items: center; gap: 10px; }
.circle-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-members { display: flex; flex-wrap: wrap; gap: 6px; }
.chat-member-chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; background: var(--primary-soft); border: 1px solid var(--line); font-size: .7rem; font-weight: 600; }
.chat-tick { min-height: 0; padding: 0; background: transparent; border: 0; font-size: .7rem; font-weight: 800; letter-spacing: -2px; color: var(--muted); }
.chat-tick.read { color: #1a8cff; }
.chat-message-meta .chat-tick { margin-left: auto; }
.chat-receipts { margin-top: 4px; font-size: .64rem; color: var(--muted); }
html[data-theme="dark"] .chat-member-chip { background: #14213a; border-color: #263650; }

/* Bible reader and activity selectors */
.bible-reference-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 0.72fr); gap: 12px; }
.bible-controls label { min-width: 0; }
.bible-controls select { min-width: 0; height: 48px; }
@media (max-width: 420px) {
  .bible-reference-fields { grid-template-columns: minmax(0, 1fr) minmax(92px, 0.58fr); gap: 8px; }
}
/* Bible activity selectors */
.bible-session-form { align-items: end; }
.bible-open-button { grid-column: 1 / -1; width: 100%; min-height: 44px; }
