:root {
  color-scheme: light;
  --bg: #f5f6f3;
  --surface: #ffffff;
  --surface-2: #eef3ef;
  --text: #17221e;
  --muted: #69746e;
  --line: #dfe6e1;
  --brand: #123f33;
  --brand-2: #1f6652;
  --brand-soft: #e4efe9;
  --gold: #b98a37;
  --danger: #a83232;
  --shadow: 0 10px 30px rgba(18, 63, 51, .08);
  --radius: 20px;
  --nav-h: 74px;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1310;
  --surface: #121d19;
  --surface-2: #17251f;
  --text: #ffffff;
  --muted: #b9c6c0;
  --line: #2b3d35;
  --brand: #52a687;
  --brand-2: #72c5a6;
  --brand-soft: #17352b;
  --gold: #d5ad63;
  --danger: #ff7c7c;
  --shadow: 0 12px 34px rgba(0, 0, 0, .24);
}

* { box-sizing: border-box; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; font-size: 14px; }
button, input, select { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.app-shell { min-height: 100vh; max-width: 760px; margin: 0 auto; background: var(--bg); }
.topbar { position: sticky; top: 0; z-index: 40; min-height: 70px; padding: calc(12px + env(safe-area-inset-top)) 16px 10px; display: flex; justify-content: space-between; align-items: flex-end; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(16px); border-bottom: 1px solid color-mix(in srgb, var(--line) 68%, transparent); }
.topbar h1 { margin: 2px 0 0; font-size: 20px; line-height: 1.15; letter-spacing: -.02em; }
.eyebrow { margin: 0; color: var(--muted); text-transform: uppercase; letter-spacing: .11em; font-size: 10px; font-weight: 750; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn { width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 12px; display: grid; place-items: center; background: var(--surface); color: var(--text); }
.icon-btn.syncing svg { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.net-pill, .badge { display: inline-flex; align-items: center; min-height: 28px; padding: 0 10px; border-radius: 999px; font-size: 11px; font-weight: 750; white-space: nowrap; }
.net-pill.online { background: var(--brand-soft); color: var(--brand-2); }
.net-pill.offline { background: color-mix(in srgb, var(--danger) 11%, var(--surface)); color: var(--danger); }
.badge { background: var(--surface-2); color: var(--muted); }
.main-content { padding: 14px 14px calc(var(--nav-h) + 24px + env(safe-area-inset-bottom)); }
.screen { display: none; animation: fade .16s ease; }
.screen.active { display: block; }
@keyframes fade { from { opacity: .65; transform: translateY(3px); } }

.hero-card { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px; padding: 20px; border-radius: 24px; color: #fff; background: linear-gradient(135deg, #123f33, #1c5e4a); box-shadow: var(--shadow); }
.hero-copy .arabic { display: block; direction: rtl; font-family: "Noto Naskh Arabic", "Geeza Pro", "Traditional Arabic", serif; font-size: 24px; line-height: 1.5; margin-bottom: 8px; color: #f5e9c6; }
.hero-copy p { margin: 0 0 3px; font-size: 12px; color: rgba(255,255,255,.72); }
.hero-copy strong { font-size: 28px; letter-spacing: -.02em; }
.progress-ring { --pct: 0deg; width: 92px; height: 92px; padding: 7px; border-radius: 50%; background: conic-gradient(#d6b46c var(--pct), rgba(255,255,255,.15) 0); display: grid; place-items: center; }
.ring-inner { width: 100%; height: 100%; border-radius: 50%; background: #174b3c; display: grid; place-content: center; text-align: center; }
.ring-inner strong { font-size: 19px; }
.ring-inner span { font-size: 9px; opacity: .72; }
.kpi-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 12px 0; }
.kpi-card { min-height: 84px; padding: 14px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: 0 4px 16px rgba(18,63,51,.035); display: flex; flex-direction: column; justify-content: space-between; }
.kpi-card span { color: var(--muted); font-size: 11px; font-weight: 650; }
.kpi-card strong { font-size: 21px; letter-spacing: -.02em; }
.panel { margin-top: 12px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 4px 16px rgba(18,63,51,.025); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.panel-head h2 { margin: 2px 0 0; font-size: 15px; }
.trend-chart { min-height: 180px; overflow: hidden; }
.trend-chart svg { width: 100%; height: 180px; stroke-width: 2; }
.chart-label { fill: var(--muted); font-size: 9px; }
.chart-grid { stroke: var(--line); stroke-width: 1; }
.chart-line { stroke: var(--brand-2); fill: none; stroke-width: 2.6; }
.chart-area { fill: color-mix(in srgb, var(--brand-2) 13%, transparent); stroke: none; }
.chart-dot { fill: var(--surface); stroke: var(--brand-2); stroke-width: 2; }
.text-btn { border: 0; background: transparent; color: var(--brand-2); font-weight: 750; padding: 8px; }
.empty-state { color: var(--muted); text-align: center; padding: 24px 8px; }
.member-stats { display: grid; gap: 10px; padding: 0; }
.member-stat { padding: 12px; border-radius: 15px; background: var(--surface-2); }
.member-stat-top { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; }
.member-stat h3 { margin: 0; font-size: 13px; }
.member-stat strong { font-size: 14px; }
.member-meta { margin-top: 5px; display: flex; flex-wrap: wrap; gap: 10px; color: var(--muted); font-size: 10px; }
.mini-bar { height: 5px; margin-top: 9px; overflow: hidden; background: color-mix(in srgb, var(--line) 75%, transparent); border-radius: 999px; }
.mini-bar i { display: block; height: 100%; background: var(--brand-2); border-radius: inherit; }
.activity-list { padding: 0; }
.activity-row, .history-row { display: grid; grid-template-columns: 42px 1fr auto; gap: 10px; align-items: center; padding: 11px 0; border-top: 1px solid var(--line); }
.activity-row:first-child, .history-row:first-child { border-top: 0; }
.avatar { width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-2); font-weight: 850; }
.row-main strong { display: block; font-size: 13px; }
.row-main span { display: block; color: var(--muted); font-size: 10px; margin-top: 3px; }
.row-amount {
  text-align: right;
  font-weight: 850;
  font-size: 15px;
  letter-spacing: -.02em;
  color: var(--brand-2);
  font-variant-numeric: tabular-nums;
  padding: 4px 10px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--brand-soft) 80%, transparent);
}

.entry-card { padding: 18px; border-radius: 24px; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); }
.date-display { margin-bottom: 18px; padding: 12px 14px; border-radius: 15px; background: var(--surface-2); }
.date-display span { display: block; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; font-weight: 750; }
.date-display strong { display: block; margin-top: 3px; font-size: 14px; }
.field-label, .settings-grid label > span, .filter-row label > span { display: block; margin: 14px 0 7px; color: var(--muted); font-size: 11px; font-weight: 750; }
.field-control, .filter-row input, .filter-row select, .settings-grid input { width: 100%; min-height: 48px; padding: 0 13px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--text); outline: none; }
.field-control:focus, .filter-row input:focus, .filter-row select:focus, .settings-grid input:focus { border-color: var(--brand-2); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-2) 13%, transparent); }
.number-wrap { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 17px; background: var(--surface); padding-right: 14px; }
.number-wrap:focus-within { border-color: var(--brand-2); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-2) 13%, transparent); }
.number-input { min-width: 0; width: 100%; height: 68px; padding: 0 14px; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 30px; font-weight: 850; font-variant-numeric: tabular-nums; }
.number-wrap > span { color: var(--muted); font-size: 12px; }
.field-help, .muted { color: var(--muted); font-size: 11px; line-height: 1.55; }
.quick-values, .quick-members { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin-top: 9px; }
.quick-values::-webkit-scrollbar, .quick-members::-webkit-scrollbar { display: none; }
.quick-values button, .quick-members button { flex: 0 0 auto; min-height: 36px; padding: 0 13px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-2); color: var(--text); font-size: 11px; font-weight: 750; }
.quick-members button.selected { border-color: var(--brand-2); color: var(--brand-2); background: var(--brand-soft); }
.primary-btn, .secondary-btn, .danger-btn { min-height: 46px; border-radius: 14px; border: 0; padding: 0 15px; font-weight: 800; cursor: pointer; }
.primary-btn { background: var(--brand); color: #fff; }
html[data-theme="dark"] .primary-btn { color: #07110d; background: var(--brand-2); }
.secondary-btn { border: 1px solid var(--line); background: var(--surface-2); color: var(--text); }
.danger-btn { background: var(--danger); color: #fff; }
.save-btn { width: 100%; margin-top: 18px; display: flex; align-items: center; justify-content: center; gap: 8px; }
.save-btn:active { transform: translateY(1px); }
.compact-panel { margin-top: 12px; }
.daily-summary { display: grid; grid-template-columns: repeat(2,1fr); gap: 9px; }
.daily-summary div { padding: 12px; border-radius: 14px; background: var(--surface-2); }
.daily-summary span { display: block; color: var(--muted); font-size: 10px; }
.daily-summary strong { display: block; margin-top: 4px; font-size: 18px; }
.today-by-member { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.today-chip { padding: 7px 11px; border-radius: 999px; background: var(--brand-soft); color: var(--brand-2); font-size: 11px; font-weight: 750; }
.today-entries-subhead { margin-top: 16px; margin-bottom: 6px; padding-top: 10px; border-top: 1px dashed var(--line); }
.today-entries-list { margin-top: 4px; }
.today-entries-list .activity-row { padding: 8px 4px; }

.filters { margin-top: 0; }
.filter-row { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.filters .secondary-btn { width: 100%; margin-top: 10px; }
.history-list { padding: 0 6px; }
.history-row { grid-template-columns: 42px 1fr auto auto; }
.row-actions { display: flex; gap: 4px; }
.row-actions button, .member-actions button { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--muted); }
.row-actions button.danger, .member-actions button.danger { color: var(--danger); }
.row-actions svg, .member-actions svg { width: 17px; height: 17px; }
.member-form { margin-top: 0; display: grid; grid-template-columns: 1fr auto; gap: 9px; align-items: end; }
.member-form .field-label { margin-top: 0; }
.members-list { padding: 0; }
.member-card { margin-top: 10px; padding: 13px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); display: grid; grid-template-columns: 42px 1fr auto; gap: 10px; align-items: center; }
.member-card.inactive { opacity: .6; }
.member-card h3 { margin: 0; font-size: 13px; }
.member-card p { margin: 3px 0 0; color: var(--muted); font-size: 10px; }
.member-actions { display: flex; gap: 5px; }
.segmented { display: grid; grid-template-columns: repeat(3,1fr); padding: 4px; border-radius: 14px; background: var(--surface-2); }
.segmented button { min-height: 40px; border: 0; border-radius: 11px; background: transparent; color: var(--muted); font-weight: 750; }
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: 0 3px 10px rgba(0,0,0,.06); }
.settings-grid { display: grid; gap: 8px; }
.button-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.file-btn { display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.file-btn input { display: none; }

.bottom-nav { position: fixed; left: 50%; bottom: 0; transform: translateX(-50%); z-index: 50; width: min(760px, 100%); min-height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding: 6px 7px calc(6px + env(safe-area-inset-bottom)); display: grid; grid-template-columns: repeat(5, 1fr); border-top: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(18px); }
.nav-item { min-width: 0; border: 0; background: transparent; color: var(--muted); border-radius: 12px; display: grid; place-items: center; align-content: center; gap: 3px; padding: 6px 2px; }
.nav-item svg { width: 22px; height: 22px; }
.nav-item span { font-size: 9px; font-weight: 700; }
.nav-item.active { color: var(--brand-2); background: var(--brand-soft); }
.toast { position: fixed; z-index: 80; left: 50%; bottom: calc(var(--nav-h) + 18px + env(safe-area-inset-bottom)); transform: translate(-50%, 16px); width: min(92vw, 420px); padding: 12px 14px; border-radius: 14px; background: #17221e; color: #fff; box-shadow: 0 12px 30px rgba(0,0,0,.2); opacity: 0; pointer-events: none; transition: .18s ease; text-align: center; font-size: 12px; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.modal-backdrop { position: fixed; inset: 0; z-index: 100; padding: 20px; background: rgba(0,0,0,.46); display: grid; place-items: center; }
.modal-backdrop[hidden] { display: none; }
.modal-card { width: min(100%, 390px); padding: 18px; border-radius: 20px; background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.modal-card h2 { margin: 0 0 8px; font-size: 17px; }
.modal-card p { color: var(--muted); line-height: 1.5; }
.modal-card .button-row { justify-content: flex-end; }

/* --- Hero Tasbih Launcher --- */
.hero-tasbih-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  margin: 12px 0;
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  box-shadow: 0 4px 16px rgba(18,63,51,.03);
  transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease;
}
.hero-tasbih-btn:hover {
  border-color: var(--brand-2);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(18,63,51,.07);
}
.hero-tasbih-btn:active {
  transform: scale(0.99);
}
.hero-tasbih-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--brand-soft);
  color: var(--brand-2);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.hero-tasbih-text {
  flex: 1;
  min-width: 0;
}
.hero-tasbih-text strong {
  display: block;
  font-size: 14px;
  letter-spacing: -.01em;
}
.hero-tasbih-text span {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}
.hero-tasbih-arrow {
  width: 18px;
  height: 18px;
  color: var(--muted);
  flex-shrink: 0;
}

/* --- Entry Segmented Switcher --- */
.entry-segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 5px;
  margin-bottom: 14px;
  border-radius: 16px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.entry-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font-weight: 750;
  font-size: 13px;
  cursor: pointer;
  transition: all .16s ease;
}
.entry-tab svg {
  width: 18px;
  height: 18px;
}
.entry-tab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 4px 12px rgba(0,0,0,.06);
}

/* --- Interactive Tasbih Card --- */
.tasbih-card {
  padding: 18px;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.tasbih-card[hidden] {
  display: none !important;
}
#manualEntryPane[hidden] {
  display: none !important;
}

.tasbih-member-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 16px;
  background: var(--surface-2);
  border: 1px solid color-mix(in srgb, var(--line) 75%, transparent);
}
.tasbih-member-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.avatar-mini {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--brand-soft);
  color: var(--brand-2);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 12px;
  flex-shrink: 0;
}
.tasbih-member-labels {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.tasbih-member-select {
  border: 0;
  background: transparent;
  padding: 0;
  margin-top: 1px;
  font-weight: 750;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  width: 100%;
  outline: none;
}
.tasbih-toggles {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.tasbih-icon-toggle {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--muted);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all .15s ease;
}
.tasbih-icon-toggle svg {
  width: 18px;
  height: 18px;
}
.tasbih-icon-toggle.active {
  color: var(--brand-2);
  background: var(--brand-soft);
  border-color: color-mix(in srgb, var(--brand-2) 30%, transparent);
}

.tasbih-step-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 4px;
}
.tasbih-step-label {
  font-size: 11px;
  font-weight: 750;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.tasbih-step-pills {
  display: flex;
  gap: 6px;
}
.tasbih-step-pill {
  min-width: 48px;
  height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  cursor: pointer;
  transition: all .15s ease;
}
.tasbih-step-pill.active {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
  box-shadow: 0 2px 8px color-mix(in srgb, var(--brand) 25%, transparent);
}

.tasbih-dhikr-box {
  text-align: center;
  padding: 4px 8px;
}
.tasbih-arabic {
  display: block;
  direction: rtl;
  font-family: "Noto Naskh Arabic", "Geeza Pro", "Traditional Arabic", serif;
  font-size: 26px;
  line-height: 1.4;
  color: var(--brand-2);
  font-weight: 700;
}
.tasbih-translation {
  margin: 3px 0 0;
  font-size: 11px;
  color: var(--muted);
  font-style: italic;
}

.tasbih-circle-area {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 6px 0;
}
.tasbih-circle {
  position: relative;
  width: 216px;
  height: 216px;
  border: 0;
  background: transparent;
  padding: 0;
  border-radius: 50%;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform .09s cubic-bezier(0.2, 0, 0, 1);
  outline: none;
}
.tasbih-circle:active {
  transform: scale(0.96);
}
.tasbih-ring-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
  pointer-events: none;
}
.tasbih-ring-bg {
  fill: none;
  stroke: var(--surface-2);
  stroke-width: 8;
}
.tasbih-ring-progress {
  fill: none;
  stroke: var(--gold);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 597;
  stroke-dashoffset: 597;
  transition: stroke-dashoffset .18s cubic-bezier(0.4, 0, 0.2, 1), stroke .2s ease;
}
.tasbih-circle-content {
  position: absolute;
  inset: 12px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, var(--surface-2), var(--surface));
  border: 2px solid var(--line);
  box-shadow: 0 10px 26px rgba(18, 63, 51, 0.08);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  user-select: none;
  pointer-events: none;
}
.tasbih-lap-badge {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--gold);
  padding: 3px 9px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--gold) 15%, transparent);
  margin-bottom: 2px;
}
.tasbih-counter {
  font-size: 54px;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  color: var(--text);
  letter-spacing: -.02em;
}
.tasbih-tap-legend {
  font-size: 10px;
  font-weight: 650;
  color: var(--muted);
  margin-top: 4px;
}

.tasbih-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.tasbih-meta-box {
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--surface-2);
  text-align: center;
}
.tasbih-meta-box span {
  display: block;
  font-size: 10px;
  font-weight: 750;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.tasbih-meta-box strong {
  display: block;
  font-size: 16px;
  margin-top: 2px;
  letter-spacing: -.01em;
  font-variant-numeric: tabular-nums;
}

.tasbih-bottom-actions {
  display: flex;
  gap: 8px;
  align-items: stretch;
  margin-top: 2px;
}
.tasbih-subtle-btn {
  width: 58px;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 10px;
  font-weight: 750;
  cursor: pointer;
  transition: all .15s ease;
}
.tasbih-subtle-btn svg {
  width: 17px;
  height: 17px;
}
.tasbih-subtle-btn:hover {
  background: var(--surface);
  color: var(--text);
}
.tasbih-subtle-btn:active {
  transform: scale(0.96);
}
.tasbih-save-btn {
  flex: 1;
  min-height: 48px;
  margin: 0;
  font-size: 13px;
  gap: 8px;
}
.tasbih-save-btn:disabled {
  opacity: .42;
  cursor: not-allowed;
  transform: none !important;
}

/* --- Navigation Tasbih Central Button --- */
.nav-item-tasbih {
  position: relative;
  overflow: visible;
  padding: 0 !important;
  display: grid;
  place-items: center;
}
.nav-tasbih-circle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-2), #20725a);
  color: #ffffff;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--brand-2) 45%, transparent);
  border: 3px solid var(--surface);
  transform: translateY(-8px);
  transition: transform .18s cubic-bezier(0.2, 0, 0, 1), box-shadow .18s ease, background .18s ease;
}
.nav-tasbih-circle svg {
  width: 25px;
  height: 25px;
  stroke-width: 2;
}
.nav-item-tasbih.active .nav-tasbih-circle {
  background: linear-gradient(135deg, var(--gold), #e0be77);
  color: #17221e;
  box-shadow: 0 6px 20px color-mix(in srgb, var(--gold) 60%, transparent);
  transform: translateY(-11px) scale(1.08);
}
.nav-item-tasbih:active .nav-tasbih-circle {
  transform: translateY(-5px) scale(0.96);
}

/* --- Goal Param Settings --- */
.goal-input-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.goal-input-row .number-input {
  font-size: 18px;
  font-weight: 750;
  letter-spacing: -.02em;
}
.quick-goals {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.quick-goals button {
  min-height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  cursor: pointer;
  transition: all .15s ease;
}
.quick-goals button:hover, .quick-goals button:focus-visible {
  border-color: var(--brand-2);
  color: var(--text);
}

/* --- QR Sync Tools & Buttons --- */
.qr-sync-box {
  border-top: 1px solid var(--line);
  margin-top: 14px;
  padding-top: 4px;
}
.accent-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 12px;
  border: 0;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  font-weight: 750;
  cursor: pointer;
  transition: transform .12s ease, opacity .12s ease;
}
.accent-btn:active {
  transform: scale(0.98);
}
.accent-btn svg {
  width: 18px;
  height: 18px;
}

/* --- Modals for QR Code & Sharing --- */
.qr-modal-card {
  width: min(100%, 420px);
  padding: 22px;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.modal-header h2 {
  margin: 0;
  font-size: 18px;
}
.close-modal-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 14px;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.modal-sub {
  margin: 0 0 16px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}
.qr-code-wrapper {
  background: #ffffff !important;
  padding: 16px;
  border-radius: 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0 auto 14px;
  width: fit-content;
  border: 1px solid var(--line);
  box-shadow: 0 10px 30px rgba(0,0,0,.15);
}
.qr-code-wrapper svg,
svg.qr-svg {
  width: 220px !important;
  height: 220px !important;
  max-width: 100% !important;
  background: #ffffff !important;
  display: block !important;
  border-radius: 8px;
}
.qr-code-wrapper svg *,
svg.qr-svg * {
  stroke: none !important;
  stroke-width: 0 !important;
}
.qr-family-badge {
  text-align: center;
  padding: 8px 12px;
  border-radius: 12px;
  background: var(--surface-2);
  font-size: 12px;
  margin-bottom: 14px;
}
.qr-family-badge span {
  color: var(--muted);
  margin-right: 6px;
}
.qr-actions-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.whatsapp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 12px;
  border: 0;
  background: #25D366;
  color: #ffffff;
  font-weight: 750;
  cursor: pointer;
  font-size: 12px;
}
.whatsapp-btn svg {
  width: 18px;
  height: 18px;
  stroke: none;
  fill: currentColor;
}

/* --- Camera Viewport for Scanner --- */
.camera-viewport {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  max-width: 280px;
  margin: 0 auto 12px;
  border-radius: 20px;
  overflow: hidden;
  background: #091a13;
  border: 2px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
}
.camera-viewport video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.scanner-frame {
  position: absolute;
  inset: 24px;
  border: 2px dashed var(--brand-2);
  border-radius: 16px;
  pointer-events: none;
  box-shadow: 0 0 0 9999px rgba(0,0,0,.45);
}
.scanner-laser {
  position: absolute;
  top: 24px;
  left: 24px;
  right: 24px;
  height: 3px;
  background: var(--gold);
  box-shadow: 0 0 12px var(--gold);
  animation: scanLaser 2s infinite ease-in-out alternate;
  pointer-events: none;
}
@keyframes scanLaser {
  from { top: 24px; }
  to { top: calc(100% - 28px); }
}
.scanner-status {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 12px;
  min-height: 20px;
}
.qr-scan-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.file-btn {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  text-align: center;
}
.file-btn input[type="file"] {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

/* --- Join Family Modal --- */
.join-info-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--surface-2);
  margin: 10px 0 14px;
}
.join-info-box span {
  color: var(--muted);
  font-size: 12px;
}
.join-info-box strong {
  color: var(--brand-2);
  font-size: 14px;
}

/* --- Dua & Dhikr Customization Styles --- */
.arabic-field {
  font-family: "Noto Naskh Arabic", "Geeza Pro", "Traditional Arabic", serif;
  font-size: 19px !important;
  direction: rtl;
  text-align: right;
}
.hero-dua-trans {
  margin: -4px 0 10px 0 !important;
  font-size: 11px !important;
  color: rgba(255,255,255,.82) !important;
  font-style: italic;
}
.hero-target-label {
  margin: 0 0 3px !important;
  font-size: 12px !important;
  color: rgba(255,255,255,.72) !important;
}

/* --- Goal Celebration / Fin de campagne --- */
.goal-celebration-banner {
  margin: 12px 0;
  padding: 17px;
  border-radius: 20px;
  background:
    radial-gradient(circle at 90% 12%, color-mix(in srgb, var(--gold) 18%, transparent), transparent 34%),
    linear-gradient(145deg, color-mix(in srgb, var(--brand-soft) 64%, var(--surface)), var(--surface));
  border: 1px solid color-mix(in srgb, var(--gold) 62%, var(--line));
  box-shadow: 0 10px 28px color-mix(in srgb, var(--gold) 10%, transparent);
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 13px;
  align-items: start;
}
.goal-celebration-banner[hidden] { display: none !important; }
.celebration-seal {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--gold);
  color: #fff;
  font-size: 20px;
  font-weight: 900;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--gold) 26%, transparent);
}
html[data-theme="dark"] .celebration-seal { color: #101711; }
.celebration-copy { min-width: 0; }
.celebration-copy > strong {
  display: block;
  margin-top: 3px;
  color: var(--gold);
  font-size: 18px;
  letter-spacing: -.01em;
}
.celebration-dua {
  margin: 5px 0 0;
  color: var(--text);
  font-family: "Noto Naskh Arabic", "Geeza Pro", "Traditional Arabic", serif;
  font-size: 19px;
  line-height: 1.7;
  text-align: right;
}
.celebration-translation {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}
.celebration-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}
.celebration-metrics span {
  padding: 6px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 10px;
}
.celebration-metrics b { color: var(--text); }
.celebration-dhikr {
  margin: 9px 0 0;
  padding-top: 9px;
  border-top: 1px solid var(--line);
  color: var(--brand-2);
  font-family: "Noto Naskh Arabic", "Geeza Pro", "Traditional Arabic", serif;
  font-size: 15px;
  line-height: 1.65;
  text-align: right;
}

/* Grande fenêtre affichée une seule fois lorsque le seuil est franchi. */
.goal-completion-backdrop {
  background:
    radial-gradient(circle at 50% 18%, rgba(185,138,55,.20), transparent 34%),
    rgba(6,12,9,.66);
  backdrop-filter: blur(7px);
}
.goal-completion-card {
  width: min(100%, 410px);
  padding: 24px 20px 20px;
  border: 1px solid color-mix(in srgb, var(--gold) 60%, var(--line));
  text-align: center;
  overflow: hidden;
  position: relative;
}
.goal-completion-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 5px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}
.goal-completion-mark {
  width: 58px;
  height: 58px;
  margin: 0 auto 10px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--gold);
  color: #fff;
  font-size: 27px;
  font-weight: 900;
  box-shadow: 0 10px 24px color-mix(in srgb, var(--gold) 28%, transparent);
}
html[data-theme="dark"] .goal-completion-mark { color: #111810; }
.goal-completion-kicker {
  margin: 0 !important;
  color: var(--gold) !important;
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: 9px !important;
  font-weight: 850;
}
.goal-completion-card h2 {
  margin: 5px 0 0;
  color: var(--text);
  font-family: "Noto Naskh Arabic", "Geeza Pro", "Traditional Arabic", serif;
  font-size: 28px;
  line-height: 1.5;
}
.goal-completion-arabic {
  margin: 0 !important;
  color: var(--brand-2) !important;
  font-family: "Noto Naskh Arabic", "Geeza Pro", "Traditional Arabic", serif;
  font-size: 21px !important;
  line-height: 1.8 !important;
}
.goal-completion-text {
  max-width: 335px;
  margin: 7px auto 0 !important;
  font-size: 11px !important;
}
.goal-completion-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 15px;
}
.goal-completion-summary div {
  padding: 11px;
  border-radius: 14px;
  background: var(--surface-2);
}
.goal-completion-summary span {
  display: block;
  color: var(--muted);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: .07em;
}
.goal-completion-summary strong {
  display: block;
  margin-top: 4px;
  color: var(--text);
  font-size: 17px;
}
.goal-completion-dhikr-wrap {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: color-mix(in srgb, var(--brand-soft) 55%, var(--surface));
  text-align: center;
}
.goal-completion-dhikr-wrap > span {
  display: block;
  color: var(--muted);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: .07em;
}
.goal-completion-dhikr-wrap > strong {
  display: block;
  margin-top: 4px;
  color: var(--brand-2);
  font-family: "Noto Naskh Arabic", "Geeza Pro", "Traditional Arabic", serif;
  font-size: 17px;
  line-height: 1.65;
}
.goal-completion-actions {
  display: grid !important;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 15px !important;
}
@media (prefers-reduced-motion: no-preference) {
  .goal-completion-card { animation: goalCompletionIn .28s ease-out; }
  .goal-completion-mark { animation: goalMarkIn .36s .08s both cubic-bezier(.2,.9,.2,1.15); }
}
@keyframes goalCompletionIn {
  from { opacity: 0; transform: translateY(10px) scale(.985); }
}
@keyframes goalMarkIn {
  from { opacity: 0; transform: scale(.7); }
}
@media (max-width: 380px) {
  .goal-celebration-banner { grid-template-columns: 36px 1fr; padding: 14px; }
  .celebration-seal { width: 36px; height: 36px; }
  .goal-completion-card { padding-left: 16px; padding-right: 16px; }
}

.quick-duas {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.quick-dua-btn {
  min-height: 32px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all .12s ease;
}
.quick-dua-btn:hover {
  border-color: var(--brand-2);
  color: var(--text);
}
.quick-dua-btn.active {
  background: var(--brand-soft);
  color: var(--brand-2);
  border-color: var(--brand-2);
}

/* --- Member Management Buttons --- */
.danger-icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
  background: color-mix(in srgb, var(--danger) 8%, transparent);
  color: var(--danger);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background .12s ease, transform .12s ease;
}
.danger-icon-btn:hover {
  background: color-mix(in srgb, var(--danger) 20%, transparent);
  transform: scale(1.04);
}
.danger-icon-btn svg {
  width: 17px;
  height: 17px;
}

/* --- Modal Choice Buttons & Admin Panel --- */
.choice-btn {
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  border-radius: 14px;
  cursor: pointer;
  line-height: 1.35;
}
.choice-btn strong {
  font-size: 13px;
  display: block;
}
.choice-btn span {
  font-size: 11px;
  opacity: .85;
  font-weight: normal;
  display: block;
}
.danger-outline-btn {
  background: transparent;
  border: 1px solid var(--danger);
  color: var(--danger);
}
.admin-panel {
  border-color: color-mix(in srgb, var(--danger) 35%, var(--line));
  background: linear-gradient(180deg, var(--surface), color-mix(in srgb, var(--surface) 96%, var(--danger)));
}
.badge-admin {
  background: color-mix(in srgb, var(--gold) 18%, transparent);
  color: var(--gold);
  border: 1px solid color-mix(in srgb, var(--gold) 40%, transparent);
}
.admin-reset-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  min-height: 42px;
  border-radius: 12px;
  font-weight: 750;
}
.admin-reset-btn svg {
  width: 18px;
  height: 18px;
}

/* --- PWA Install Banner & Guide --- */
.pwa-install-banner {
  background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 18%, var(--surface)), var(--surface));
  border: 1px solid color-mix(in srgb, var(--gold) 45%, var(--line));
  border-radius: 16px;
  padding: 14px 16px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
  animation: fadeIn 0.3s ease;
}
.pwa-install-icon {
  font-size: 28px;
  flex-shrink: 0;
}
.pwa-install-text {
  flex: 1;
  min-width: 0;
}
.pwa-install-text strong {
  display: block;
  font-size: 14px;
  font-weight: 750;
  color: var(--text);
}
.pwa-install-text span {
  display: block;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
  margin-top: 2px;
}
.pwa-install-action-btn {
  background: var(--brand);
  color: #ffffff;
  border: none;
  font-weight: 700;
  font-size: 13px;
  padding: 8px 14px;
  border-radius: 10px;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(18, 63, 51, 0.25);
  transition: transform 0.15s ease, background 0.15s ease;
}
.pwa-install-action-btn:active {
  transform: scale(0.96);
}

.install-step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.install-step:last-child {
  border-bottom: none;
}
.step-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--gold);
  color: #17221e;
  font-weight: 850;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}
.install-step strong {
  font-size: 13px;
  display: block;
  color: var(--text);
}
.install-step p {
  margin: 2px 0 0;
  font-size: 12px;
  line-height: 1.4;
}

/* --- Rappels & Notifications --- */
.reminder-segmented button {
  flex: 1;
  font-size: 12px;
  padding: 8px 4px;
}


@media (min-width: 620px) {
  .main-content { padding-left: 20px; padding-right: 20px; }
  .kpi-grid { grid-template-columns: repeat(4, 1fr); }
  .settings-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 390px) {
  .topbar h1 { font-size: 18px; }
  .net-pill { display: none; }
  .hero-card { padding: 16px; }
  .hero-copy .arabic { font-size: 20px; }
  .progress-ring { width: 82px; height: 82px; }
  .history-row { grid-template-columns: 38px 1fr auto; }
  .history-row .row-actions { grid-column: 2 / 4; justify-content: flex-end; }
  .member-form { grid-template-columns: 1fr; }
}

/* ================================================================
   V2.5 — Tasbih vocal déterministe
   ----------------------------------------------------------------
   Le panneau reste volontairement compact pour préserver l'UX mobile.
   Les couleurs utilisent les variables du thème afin que le mode sombre
   garde un contraste élevé sans styles parallèles fragiles.
   ================================================================ */
.voice-tasbih-panel {
  margin: 12px 0 4px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: color-mix(in srgb, var(--surface-2) 72%, var(--surface));
}
.voice-tasbih-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.voice-tasbih-head > div { min-width: 0; }
.voice-tasbih-head .eyebrow {
  display: block;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.voice-tasbih-head strong {
  display: block;
  color: var(--text);
  font-size: 13px;
  line-height: 1.3;
}
.voice-engine-badge {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-2);
  font-size: 9px;
  font-weight: 800;
  white-space: nowrap;
}
.voice-toggle-btn {
  width: 100%;
  min-height: 52px;
  padding: 8px 13px;
  border: 0;
  border-radius: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--brand);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 7px 18px color-mix(in srgb, var(--brand) 18%, transparent);
}
html[data-theme="dark"] .voice-toggle-btn { color: #07110d; }
.voice-toggle-btn:active { transform: translateY(1px); }
.voice-toggle-btn.listening {
  background: color-mix(in srgb, var(--danger) 78%, var(--brand));
  color: #fff;
}
.voice-toggle-btn:disabled {
  cursor: not-allowed;
  opacity: .55;
  box-shadow: none;
}
.voice-mic-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,.15);
}
.voice-mic-icon svg { width: 18px; height: 18px; }
.voice-toggle-btn.listening .voice-mic-icon {
  animation: voicePulse 1.25s ease-in-out infinite;
}
@keyframes voicePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,255,255,.18); }
  50% { box-shadow: 0 0 0 7px rgba(255,255,255,0); }
}
.voice-live-feedback {
  margin-top: 9px;
  padding: 10px 11px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
}
.voice-session-stat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.voice-session-stat span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}
.voice-session-stat strong {
  color: var(--brand-2);
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}
.voice-transcript {
  min-height: 34px;
  margin: 8px 0 5px;
  color: var(--text);
  font-family: "Noto Naskh Arabic", "Geeza Pro", "Traditional Arabic", serif;
  font-size: 16px;
  line-height: 1.65;
  text-align: right;
  direction: rtl;
}
.voice-transcript.interim { color: var(--muted); }
.voice-match-progress {
  display: block;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.4;
}
.voice-match-progress.matched { color: var(--brand-2); font-weight: 800; }
.voice-privacy-note {
  margin: 8px 2px 0;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.45;
}
.voice-warning {
  margin-top: 8px;
  padding: 9px 10px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--danger) 9%, var(--surface));
  color: var(--danger);
  font-size: 10px;
  line-height: 1.45;
}
.tasbih-circle.voice-listening {
  cursor: default;
  opacity: .92;
}
.tasbih-circle.voice-listening .tasbih-tap-legend { color: var(--brand-2); }

@media (max-width: 380px) {
  .voice-tasbih-panel { padding: 11px; }
  .voice-toggle-btn { min-height: 48px; }
  .voice-transcript { font-size: 15px; }
}
