/* =============================================================
   Sabr — iOS-inspired design
   ============================================================= */

:root {
  /* Sage on warm charcoal — more saturated, higher contrast */
  --bg:              #0f1115;
  --bg-elevated:     #1e2128;
  --bg-grouped:      #282c34;
  --bg-tertiary:     #353a44;
  --separator:       rgba(150, 158, 170, 0.22);
  --separator-strong: rgba(150, 158, 170, 0.38);

  --text:            #f1f2ec;
  --text-secondary:  rgba(241, 242, 236, 0.72);
  --text-tertiary:   rgba(241, 242, 236, 0.42);
  --text-quaternary: rgba(241, 242, 236, 0.22);

  /* Saturated but warm — contemplative without being washed out */
  --accent:          #5fb89a;  /* deeper sage */
  --accent-soft:     rgba(95, 184, 154, 0.18);
  --accent-strong:   #4ea98b;
  --blue:            #5e9bd6;
  --blue-soft:       rgba(94, 155, 214, 0.18);
  --red:             #d8665e;
  --red-soft:        rgba(216, 102, 94, 0.18);
  --orange:          #e0a060;
  --orange-soft:     rgba(224, 160, 96, 0.18);
  --gold:            #d4a548;
  --gold-soft:       rgba(212, 165, 72, 0.18);
  --yellow:          #d4be68;
  --purple:          #a884d4;
  --purple-soft:     rgba(168, 132, 212, 0.18);
  --coral:           #e88c7a;
  --coral-soft:      rgba(232, 140, 122, 0.18);

  /* Per-icon nav colors */
  --nav-home:    var(--coral);
  --nav-todo:    var(--blue);
  --nav-journal: var(--purple);
  --nav-prayer:  var(--gold);
  --nav-duas:    var(--accent);
  --nav-health:  #e85788;

  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-xl: 22px;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 17px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01", "ss02";
  overscroll-behavior: none;
}

body {
  min-height: 100vh;
  padding: 0 0 calc(96px + env(safe-area-inset-bottom));
}

[hidden] { display: none !important; }

.container {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 20px;
}

/* =============================================================
   Boot screen
   ============================================================= */
.boot {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 14px; background: var(--bg);
}
.boot-spinner {
  width: 32px; height: 32px;
  border: 2.5px solid var(--bg-tertiary);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.boot-text {
  color: var(--text-secondary);
  font-size: 15px;
  letter-spacing: 0.01em;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* =============================================================
   Topbar — iOS-style large title that shows in a header row
   ============================================================= */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 22px 0 14px;
  margin-bottom: 8px;
}
.brand { flex: 1; }
.brand-name {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.022em;
  line-height: 1.1;
}
.brand-tag {
  color: var(--text-secondary);
  font-size: 15px;
  margin-top: 4px;
  font-weight: 400;
}
.topbar-actions { display: flex; gap: 8px; align-items: center; }

.icon-btn {
  background: transparent;
  border: none;
  color: var(--accent);
  width: 36px; height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, transform 0.05s;
  font-size: 19px;
  font-weight: 500;
}
.icon-btn:hover { background: var(--bg-elevated); }
.icon-btn:active { transform: scale(0.92); }
.icon-btn.active { color: var(--accent); background: var(--accent-soft); }

/* =============================================================
   Cards — iOS grouped list style
   ============================================================= */
.card {
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  margin-bottom: 14px;
}
.card-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px;
}
.card-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.card.empty {
  text-align: center;
  color: var(--text-secondary);
  padding: 36px 18px;
}

/* Section title (outside card) — iOS group header */
.section-title {
  font-size: 13px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 500;
  margin: 22px 4px 8px;
}

/* =============================================================
   Streak hero
   ============================================================= */
.streak-hero {
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  margin-bottom: 14px;
  text-align: center;
}
.streak-label {
  color: var(--text-secondary);
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 500;
  margin-bottom: 8px;
}
.streak-number {
  font-size: 64px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  letter-spacing: -0.032em;
  font-variant-numeric: tabular-nums;
}
.streak-suffix {
  color: var(--text-secondary);
  font-size: 15px;
  margin-top: 6px;
}

/* =============================================================
   Stat tiles
   ============================================================= */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
.stat-tile {
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  padding: 14px 12px;
  text-align: center;
}
.stat-tile-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
  letter-spacing: 0.02em;
}
.stat-tile-value {
  font-size: 22px;
  font-weight: 600;
  margin-top: 4px;
  letter-spacing: -0.015em;
  font-variant-numeric: tabular-nums;
}
.stat-tile-value.emerald { color: var(--accent); }
.stat-tile-value.gold    { color: var(--orange); }
.stat-tile-value.blue    { color: var(--blue); }
.stat-tile-value.purple  { color: var(--purple); }

/* =============================================================
   Forms
   ============================================================= */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 8px;
}
.form-help {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 6px;
  line-height: 1.4;
}
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=time], select, textarea {
  width: 100%;
  background: var(--bg-grouped);
  border: none;
  color: var(--text);
  padding: 13px 14px;
  border-radius: var(--radius-sm);
  font-size: 17px;
  font-family: inherit;
  transition: background 0.15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  background: var(--bg-tertiary);
}
textarea { resize: vertical; min-height: 100px; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: var(--text-tertiary); }

/* =============================================================
   Buttons
   ============================================================= */
.btn {
  display: inline-flex;
  align-items: center; justify-content: center;
  gap: 6px;
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 14px 22px;
  border-radius: var(--radius-md);
  font-size: 17px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.05s;
  letter-spacing: -0.01em;
}
.btn:hover:not(:disabled) { opacity: 0.92; }
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-secondary {
  background: var(--bg-grouped);
  color: var(--accent);
}
.btn-ghost {
  background: transparent;
  color: var(--accent);
  padding: 10px 14px;
}
.btn-danger { background: var(--red); }
.btn-sm {
  padding: 9px 16px;
  font-size: 15px;
  border-radius: var(--radius-sm);
}

.row { display: flex; gap: 8px; align-items: center; }

/* =============================================================
   Sliders — iOS-style track
   ============================================================= */
.slider-row {
  display: flex;
  align-items: center;
  gap: 14px;
}
input[type=range] {
  flex: 1;
  -webkit-appearance: none; appearance: none;
  height: 4px;
  background: var(--bg-tertiary);
  border-radius: 2px;
  outline: none;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.4), 0 0 0 0.5px rgba(0,0,0,0.1);
}
input[type=range]::-moz-range-thumb {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  border: none;
  box-shadow: 0 1px 4px rgba(0,0,0,0.4);
}
.slider-value {
  min-width: 44px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  color: var(--text-secondary);
  font-size: 15px;
}

/* =============================================================
   Chips
   ============================================================= */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-grouped);
  color: var(--text);
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 400;
  cursor: pointer;
  transition: all 0.12s;
  user-select: none;
  border: none;
}
.chip:hover { background: var(--bg-tertiary); }
.chip.selected {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 500;
}

/* =============================================================
   Toggle — iOS switch
   ============================================================= */
.toggle {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
  font-size: 17px;
}
.toggle-track {
  width: 51px; height: 31px;
  border-radius: 31px;
  background: var(--bg-tertiary);
  position: relative;
  transition: background 0.2s ease;
  flex-shrink: 0;
}
.toggle-thumb {
  position: absolute;
  top: 2px; left: 2px;
  width: 27px; height: 27px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.22s cubic-bezier(.4,0,.2,1);
  box-shadow: 0 2px 6px rgba(0,0,0,0.3), 0 0 0 0.5px rgba(0,0,0,0.04);
}
.toggle.on .toggle-track { background: var(--accent); }
.toggle.on .toggle-thumb { transform: translateX(20px); }

/* =============================================================
   Prayer rows
   ============================================================= */
.prayer-grid {
  display: flex;
  flex-direction: column;
}
.prayer-row {
  background: var(--bg-elevated);
  padding: 14px 16px;
  display: flex; align-items: center; gap: 12px;
  border-bottom: 0.5px solid var(--separator);
}
.prayer-row:first-child { border-radius: var(--radius-md) var(--radius-md) 0 0; }
.prayer-row:last-child  { border-radius: 0 0 var(--radius-md) var(--radius-md); border-bottom: none; }
.prayer-row:only-child  { border-radius: var(--radius-md); }
.prayer-name {
  font-weight: 500;
  min-width: 78px;
  font-size: 17px;
}
.prayer-name .ar {
  display: block;
  color: var(--text-tertiary);
  font-size: 12px;
  font-weight: 400;
  margin-top: 1px;
}
.prayer-toggles {
  display: flex; gap: 6px;
  margin-left: auto;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.prayer-pill {
  background: var(--bg-grouped);
  border: none;
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.12s;
}
.prayer-pill.on {
  background: var(--accent-soft);
  color: var(--accent);
}
.prayer-pill.on.late {
  background: var(--orange-soft);
  color: var(--orange);
}

/* =============================================================
   Bottom nav — iOS tab bar
   ============================================================= */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: rgba(22, 22, 24, 0.85);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 0.5px solid var(--separator);
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  padding: 6px 2px calc(4px + env(safe-area-inset-bottom));
  z-index: 50;
}
.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: var(--text-tertiary);
  text-decoration: none;
  padding: 6px 2px;
  font-size: 9px;
  letter-spacing: 0.01em;
  font-weight: 500;
  transition: color 0.15s;
}
.nav-ico {
  font-size: 22px;
  line-height: 1;
  font-weight: 400;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--icon-color);
  opacity: 0.55;
  transition: opacity 0.15s, transform 0.1s;
}
.nav-ico svg { display: block; stroke-width: 1.9; }
.nav-item.active .nav-ico { opacity: 1; transform: scale(1.05); }
.nav-item.active { color: var(--icon-color); }

.nav-item[data-view="home"]    { --icon-color: var(--nav-home); }
.nav-item[data-view="todo"]    { --icon-color: var(--nav-todo); }
.nav-item[data-view="journal"] { --icon-color: var(--nav-journal); }
.nav-item[data-view="prayer"]  { --icon-color: var(--nav-prayer); }
.nav-item[data-view="duas"]    { --icon-color: var(--nav-duas); }
.nav-item[data-view="health"]  { --icon-color: var(--nav-health); }

/* =============================================================
   Crisis FAB — Apple-like red circular button
   ============================================================= */
.crisis-fab {
  position: fixed;
  bottom: calc(88px + env(safe-area-inset-bottom));
  right: 18px;
  width: 56px; height: 56px;
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.04em;
  cursor: pointer;
  z-index: 60;
  box-shadow: 0 6px 20px rgba(255,69,58,0.35);
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.05s;
}
.crisis-fab:active { transform: scale(0.92); }
.crisis-fab-pulse {
  position: absolute; inset: 0;
  border-radius: 50%;
  background: var(--red);
  animation: pulse 2.4s ease-out infinite;
  z-index: -1;
  opacity: 0.5;
}
@keyframes pulse {
  0% { transform: scale(1); opacity: 0.5; }
  100% { transform: scale(1.5); opacity: 0; }
}

/* =============================================================
   Modal — iOS sheet
   ============================================================= */
.modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: flex-end; justify-content: center;
  z-index: 100;
  animation: fadeIn 0.18s ease-out;
}
.modal-card {
  background: var(--bg-elevated);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  width: 100%; max-width: 600px;
  max-height: 92vh;
  overflow-y: auto;
  padding: 20px;
  padding-bottom: calc(20px + env(safe-area-inset-bottom));
  position: relative;
  animation: slideUp 0.26s cubic-bezier(.32,.72,0,1);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.modal-close {
  position: absolute; top: 14px; right: 14px;
  background: var(--bg-tertiary);
  border: none;
  color: var(--text-secondary);
  font-size: 18px;
  width: 30px; height: 30px;
  border-radius: 50%;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  line-height: 1;
}

/* =============================================================
   Crisis fullscreen
   ============================================================= */
.crisis-screen {
  position: fixed; inset: 0;
  background: var(--bg);
  z-index: 200;
  overflow-y: auto;
  padding: 0 20px calc(20px + env(safe-area-inset-bottom));
}
.crisis-tabs {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px;
  background: var(--bg-grouped);
  padding: 2px;
  border-radius: 10px;
  margin-bottom: 18px;
}
.crisis-tab {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 8px 4px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s, color 0.15s;
}
.crisis-tab.active {
  background: var(--bg-tertiary);
  color: var(--text);
}

/* =============================================================
   Todo list — iOS grouped list
   ============================================================= */
.todo-row {
  background: var(--bg-elevated);
  padding: 14px 16px;
  display: flex; align-items: center; gap: 12px;
  border-bottom: 0.5px solid var(--separator);
  cursor: pointer;
  transition: background 0.12s;
}
.todo-row:active { background: var(--bg-grouped); }
.card .todo-row:first-of-type { border-radius: var(--radius-md) var(--radius-md) 0 0; }
.card .todo-row:last-of-type  { border-radius: 0 0 var(--radius-md) var(--radius-md); border-bottom: none; }
.card .todo-row:only-of-type  { border-radius: var(--radius-md); border-bottom: none; }
.todo-row.done { opacity: 0.5; }
.todo-row.done .todo-text { text-decoration: line-through; color: var(--text-secondary); }
.todo-check {
  width: 24px; height: 24px;
  border: 1.5px solid var(--text-tertiary);
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.todo-check.on {
  background: var(--accent);
  border-color: var(--accent);
}
.todo-check.on::after { content: "✓"; color: #fff; font-weight: 600; font-size: 14px; }
.todo-text { flex: 1; font-size: 17px; }
.todo-meta {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* When .card wraps a stack of .todo-row, remove the card's own padding so rows stretch */
.card.card-list {
  padding: 0;
  overflow: hidden;
}
.card.card-list .card-header {
  padding: 14px 18px 8px;
  margin-bottom: 0;
}

/* =============================================================
   Dua cards
   ============================================================= */
.dua-card {
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  padding: 18px;
  margin-bottom: 10px;
}
.dua-arabic {
  direction: rtl;
  font-family: "Amiri Quran", "Amiri", "Scheherazade New", "Traditional Arabic", serif;
  font-size: 26px;
  line-height: 2;
  color: var(--text);
  margin-bottom: 12px;
  text-align: right;
}
.dua-trans {
  font-style: italic;
  color: var(--text-secondary);
  font-size: 15px;
  margin-bottom: 8px;
}
.dua-en {
  color: var(--text);
  line-height: 1.5;
  font-size: 15px;
}
.dua-cat {
  display: inline-block;
  background: var(--blue-soft);
  color: var(--blue);
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  margin-top: 10px;
}

/* =============================================================
   Trigger rows
   ============================================================= */
.trigger-row {
  background: var(--bg-elevated);
  padding: 12px 14px;
  display: flex; align-items: center; gap: 12px;
  border-bottom: 0.5px solid var(--separator);
}
.trigger-row:first-of-type { border-radius: var(--radius-md) var(--radius-md) 0 0; }
.trigger-row:last-of-type  { border-radius: 0 0 var(--radius-md) var(--radius-md); border-bottom: none; }
.trigger-intensity {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 13px;
  flex-shrink: 0;
  background: var(--orange-soft);
  color: var(--orange);
}
.trigger-intensity.high { background: var(--red-soft); color: var(--red); }

/* =============================================================
   Follow-up reflection
   ============================================================= */
.followup-item {
  background: var(--bg-grouped);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 12px;
}
.followup-q {
  font-weight: 500;
  margin-bottom: 10px;
  color: var(--text);
  font-size: 16px;
  line-height: 1.4;
}
.followup-answer { background: var(--bg-elevated); }

/* =============================================================
   Alerts
   ============================================================= */
.alert {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  font-size: 15px;
  line-height: 1.4;
}
.alert-error   { background: var(--red-soft);    color: var(--red); }
.alert-success { background: var(--accent-soft); color: var(--accent); }
.alert-info    { background: var(--blue-soft);   color: var(--blue); }

/* =============================================================
   Loading
   ============================================================= */
.loading-row {
  display: inline-flex;
  align-items: center; gap: 10px;
  color: var(--text-secondary);
}
.loading {
  width: 16px; height: 16px;
  border: 2px solid var(--bg-tertiary);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

.text-center   { text-align: center; }
.text-dim      { color: var(--text-secondary); }
.text-faint    { color: var(--text-tertiary); }
.text-sm       { font-size: 15px; }
.text-xs       { font-size: 13px; }
.mt-1 { margin-top: 6px; }  .mt-2 { margin-top: 12px; }  .mt-3 { margin-top: 18px; }
.mb-1 { margin-bottom: 6px; } .mb-2 { margin-bottom: 12px; } .mb-3 { margin-bottom: 18px; }

/* =============================================================
   Auth screen
   ============================================================= */
.auth-wrap {
  display: flex; flex-direction: column; justify-content: center;
  min-height: calc(100vh - 60px);
  max-width: 380px;
  margin: 0 auto;
  padding: 24px;
}
.auth-title {
  font-size: 42px;
  font-weight: 700;
  letter-spacing: -0.026em;
  margin-bottom: 6px;
  text-align: center;
}
.auth-tag {
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 36px;
  font-size: 16px;
}
.auth-switch {
  text-align: center;
  margin-top: 22px;
  font-size: 15px;
  color: var(--text-secondary);
}
.auth-switch a {
  color: var(--accent);
  cursor: pointer;
  text-decoration: none;
  font-weight: 500;
}

/* =============================================================
   Crisis Mode animations
   ============================================================= */
.breath-circle {
  width: 200px; height: 200px;
  border-radius: 50%;
  background: var(--accent-soft);
  margin: 36px auto;
  display: flex; align-items: center; justify-content: center;
  color: var(--accent);
  font-weight: 500;
  font-size: 19px;
  transition: transform 4s ease-in-out;
}
.breath-circle.inhale { transform: scale(1.4); }
.breath-circle.hold   { transform: scale(1.4); }
.breath-circle.exhale { transform: scale(1); }

.dhikr-tap {
  margin: 28px auto;
  display: block;
  width: 220px; height: 220px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  color: #fff;
  font-size: 64px;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 10px 28px rgba(48,209,88,0.25);
  transition: transform 0.05s;
}
.dhikr-tap:active { transform: scale(0.96); }

/* =============================================================
   Chat
   ============================================================= */
.chat-msgs {
  max-height: 50vh;
  overflow-y: auto;
  margin-bottom: 12px;
  padding-right: 4px;
}
.chat-msg {
  padding: 10px 14px;
  border-radius: 18px;
  margin-bottom: 8px;
  max-width: 80%;
  line-height: 1.4;
  font-size: 16px;
}
.chat-msg.user {
  background: var(--blue);
  color: #fff;
  margin-left: auto;
  border-bottom-right-radius: 6px;
}
.chat-msg.assistant {
  background: var(--bg-grouped);
  color: var(--text);
  margin-right: auto;
  border-bottom-left-radius: 6px;
  white-space: pre-wrap;
}
.chat-input-row { display: flex; gap: 8px; align-items: flex-end; }
.chat-input-row textarea { min-height: 44px; }

/* =============================================================
   Calendar
   ============================================================= */
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.cal-dow {
  text-align: center;
  font-size: 11px;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 6px 0 4px;
  font-weight: 500;
}
.cal-cell {
  background: transparent;
  border: none;
  color: var(--text);
  aspect-ratio: 1;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
  cursor: pointer;
  position: relative;
  transition: background 0.12s;
}
.cal-cell:hover:not(:disabled):not(.empty) { background: var(--bg-grouped); }
.cal-cell.future { color: var(--text-tertiary); cursor: not-allowed; }
.cal-cell.today { background: var(--bg-grouped); font-weight: 600; }
.cal-cell.empty { cursor: default; }
.cal-num { line-height: 1; }
.cal-dot {
  position: absolute;
  bottom: 4px; left: 50%;
  transform: translateX(-50%);
  width: 5px; height: 5px;
  border-radius: 50%;
}
.cal-dot.clean { background: var(--accent); }
.cal-dot.relapse { background: var(--red); }

/* =============================================================
   Summary content (markdown)
   ============================================================= */
.summary-content { line-height: 1.55; font-size: 16px; }
.summary-content h2 {
  font-size: 17px;
  color: var(--accent);
  margin: 22px 0 8px;
  letter-spacing: -0.01em;
}
.summary-content p { margin-bottom: 12px; }
.summary-content ul { margin: 10px 0 14px 20px; }
.summary-content li { margin-bottom: 4px; }
.summary-content strong { font-weight: 600; }
