@font-face { font-family: "Lalezar"; src: url("../fonts/Lalezar-Regular.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "Reem Kufi"; src: url("../fonts/ReemKufi.ttf") format("truetype"); font-weight: 400 700; font-display: swap; }

:root {
  --bg: #f5f6f2; --card: #fff; --ink: #202923; --muted: #7d877f; --line: #e8ece6; --soft: #f6f8f5;
  --green: #315d48; --green2: #eaf2ec; --green-ink: #fff; --orange: #f3a45a; --orange-pale: #fff4e9; --orange-ink: #a85f1f;
  --blue: #eaf3f8; --blue-ink: #4d8ca8; --red: #b5544f; --red-pale: #f9eded;
  --warn-bg: #fff4e5; --warn-line: #f5ddb9; --warn-ink: #865a2d;
  --shadow: 0 12px 36px rgba(31, 50, 38, .055);
  --body: "Lalezar", Tahoma, sans-serif; --head: "Reem Kufi", Tahoma, sans-serif;
  --quran: "Noto Naskh Arabic", "Amiri", "Scheherazade New", serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme=light]) {
    --bg: #111612; --card: #1a211c; --ink: #e6ede8; --muted: #93a097; --line: #29332c; --soft: #212a24;
    --green: #8cc7a5; --green2: #1f2e26; --green-ink: #10251a; --orange-pale: #33281c; --orange-ink: #f3b77a;
    --blue: #1c2a31; --blue-ink: #8dc2da; --red: #e08f8a; --red-pale: #3a2423;
    --warn-bg: #33281b; --warn-line: #4d3b26; --warn-ink: #f0c48f; --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme=dark] {
    --bg: #111612; --card: #1a211c; --ink: #e6ede8; --muted: #93a097; --line: #29332c; --soft: #212a24;
    --green: #8cc7a5; --green2: #1f2e26; --green-ink: #10251a; --orange-pale: #33281c; --orange-ink: #f3b77a;
    --blue: #1c2a31; --blue-ink: #8dc2da; --red: #e08f8a; --red-pale: #3a2423;
    --warn-bg: #33281b; --warn-line: #4d3b26; --warn-ink: #f0c48f; --shadow: none;
    color-scheme: dark;
}
:root[data-theme=light] { color-scheme: light; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 15px; line-height: 1.7; }
body.noscroll { overflow: hidden; }
h1, h2, h3 { font-family: var(--head); font-weight: 700; line-height: 1.4; margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
input, select, textarea {
  min-width: 0; width: 100%; border: 1px solid var(--line); background: var(--soft); border-radius: 10px;
  padding: 10px 11px; font-size: 14px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--green); }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--green); padding: 0; flex: none; }
a { color: var(--green); }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.center { text-align: center; }
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }
.pad { padding: 14px 4px; }

.shell { max-width: 640px; margin: auto; padding: 14px 16px calc(96px + env(safe-area-inset-bottom)); }
.topbar { display: flex; justify-content: space-between; align-items: center; margin: 4px 0 16px; }
.greeting { font-size: 12px; color: var(--muted); }
.topbar h1 { font-size: 22px; }
.top-actions { display: flex; gap: 8px; }
.iconbtn { width: 40px; height: 40px; background: var(--card); border: 1px solid var(--line); border-radius: 13px; display: grid; place-items: center; font-size: 18px; }

/* cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 15px; box-shadow: var(--shadow); margin-bottom: 12px; }
.card.empty { text-align: center; padding: 28px 18px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 20px 2px 10px; }
.section-head h2 { font-size: 17px; }
.quiet-link { color: var(--green); font-size: 13px; }
.module-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.module-top h3 { font-size: 15px; }
.module-kicker { font-size: 11px; color: var(--muted); }
.module-note { margin: 9px 0 0; color: var(--muted); font-size: 12px; line-height: 1.7; }
.pill { border-radius: 999px; background: var(--green2); color: var(--green); padding: 3px 10px; font-size: 12px; white-space: nowrap; }
.pill.hot { background: var(--orange-pale); color: var(--orange-ink); }
.ok { color: var(--green); font-size: 13px; }

/* week card */
.week-card { background: #315d48; color: #fff; border-radius: 22px; padding: 18px; position: relative; overflow: hidden; box-shadow: 0 15px 34px #315d4821; }
.week-card::after { content: ''; position: absolute; width: 220px; height: 220px; border: 1px solid #ffffff19; border-radius: 50%; left: -76px; top: -100px; box-shadow: 0 0 0 22px #ffffff0c, 0 0 0 45px #ffffff08; pointer-events: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme=light]) .week-card { background: #23453a; box-shadow: none; } }
:root[data-theme=dark] .week-card { background: #23453a; box-shadow: none; }
.week-head { position: relative; z-index: 1; display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.eyebrow { font-size: 12px; color: #c8d8ce; }
.daycount { font-size: 21px; margin-top: 2px; }
.daycount small { font-size: 12px; color: #c8d8ce; }
.muted-light { color: #c8d8ce; font-size: 13px; position: relative; z-index: 1; }
.date-nav { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #d6e1d8; white-space: nowrap; }
.date-nav button { background: #ffffff19; color: #fff; width: 30px; height: 30px; border-radius: 9px; font-size: 18px; line-height: 1; }
.dayprogress { height: 5px; background: #ffffff25; border-radius: 8px; margin-top: 14px; position: relative; z-index: 1; overflow: hidden; }
.dayprogress span { display: block; height: 100%; border-radius: 8px; background: #efad70; transition: width .25s; }
.sleep-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; position: relative; z-index: 1; }
.sleep-item { background: #ffffff11; border: 1px solid #ffffff14; border-radius: 12px; padding: 8px 10px; }
.sleep-item label { display: block; color: #c8d8ce; font-size: 11px; }
.sleep-item b { font-size: 14px; font-weight: 400; }
.sleep-item:last-child b { color: #ffd1a0; }

/* next */
.next-card { background: var(--card); border: 1px solid var(--line); border-radius: 17px; padding: 13px; display: flex; align-items: center; gap: 11px; box-shadow: var(--shadow); }
.next-time { min-width: 60px; text-align: center; }
.next-time strong { display: block; font-size: 19px; color: var(--green); font-weight: 400; }
.next-time small { font-size: 11px; color: var(--muted); }
.next-symbol { width: 40px; height: 40px; flex: none; border-radius: 13px; background: var(--orange-pale); display: grid; place-items: center; color: var(--orange-ink); font-size: 18px; }
.next-info { flex: 1; min-width: 0; }
.next-info strong { font-size: 14px; display: block; font-weight: 400; }
.next-info small { font-size: 12px; color: var(--muted); display: block; line-height: 1.5; }
.alarm-tag { background: var(--green2); color: var(--green); font-size: 11px; padding: 4px 9px; border-radius: 20px; white-space: nowrap; }

.permission { margin-top: 11px; padding: 10px 12px; border-radius: 12px; background: var(--warn-bg); border: 1px solid var(--warn-line); display: flex; align-items: center; gap: 9px; color: var(--warn-ink); font-size: 12px; line-height: 1.5; }
.permission b { font-size: 13px; font-weight: 400; }
.permission button { background: #efab68; color: #402b17; border-radius: 9px; padding: 7px 12px; font-size: 12px; flex: none; }

/* goals */
.goal-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.goal { border-radius: 15px; background: var(--card); border: 1px solid var(--line); padding: 11px; min-height: 88px; text-align: start; }
.goal-icon { width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; font-size: 14px; margin-bottom: 6px; background: var(--soft); }
.goal small { display: block; font-size: 11px; color: var(--muted); line-height: 1.4; }
.goal strong { display: block; font-size: 13px; font-weight: 400; line-height: 1.4; }
.goal.done { border-color: #a9c9b0; background: var(--green2); }
.goal.done strong { color: var(--green); }
.goal.done .goal-icon { background: var(--green); color: var(--green-ink); }

/* water */
.water-card { background: var(--card); border: 1px solid var(--line); border-radius: 17px; padding: 12px 14px; display: flex; align-items: center; gap: 10px; }
.water-icon { width: 38px; height: 38px; background: var(--blue); border-radius: 13px; display: grid; place-items: center; font-size: 17px; flex: none; }
.water-main { flex: 1; min-width: 0; }
.water-row { display: flex; justify-content: space-between; align-items: baseline; }
.water-row strong { font-size: 13px; font-weight: 400; }
.water-row span { font-size: 12px; color: var(--blue-ink); }
.water-track { display: flex; gap: 3px; margin-top: 7px; }
.water-track i { height: 5px; flex: 1; border-radius: 5px; background: var(--line); }
.water-track i.on { background: #75a9bf; }
.water-plus, .water-minus { width: 36px; height: 36px; border-radius: 11px; background: var(--blue); color: var(--blue-ink); font-size: 22px; line-height: 1; flex: none; }
.water-minus { width: 28px; font-size: 18px; background: transparent; }

/* chips */
.chip-row, .chips { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 10px; }
.chip { background: var(--card); border: 1px solid var(--line); color: var(--green); border-radius: 999px; padding: 6px 12px; font-size: 12px; }
.chip.warn { color: var(--orange-ink); border-color: var(--warn-line); }
.chip-check { display: inline-flex; align-items: center; gap: 6px; background: var(--soft); border: 1px solid var(--line); border-radius: 999px; padding: 5px 10px; font-size: 12px; }

/* timeline */
.timeline { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 4px 11px; box-shadow: var(--shadow); }
.event { min-height: 62px; display: grid; grid-template-columns: 54px 14px 1fr 30px; align-items: center; gap: 8px; position: relative; cursor: pointer; }
.event:not(:last-child)::after { content: ''; position: absolute; top: 40px; bottom: -18px; width: 1px; background: var(--line); }
.event.current { background: var(--orange-pale); margin: 0 -7px; padding: 0 7px; border-radius: 12px; }
.event-time { font-size: 11px; color: var(--muted); white-space: nowrap; }
.event.current .event-time { color: var(--orange-ink); }
.event-dot { width: 11px; height: 11px; border-radius: 4px; background: #93b79a; z-index: 1; }
.event.meal .event-dot, .event.snack .event-dot { background: #e4ac6b; }
.event.drink .event-dot { background: #c99a7a; }
.event.study .event-dot { background: #9aaed0; }
.event.water .event-dot { background: #7bb0c5; }
.event.work .event-dot { background: #aa9dc3; }
.event.prayer .event-dot, .event.dhikr .event-dot, .event.quran .event-dot { background: #90b5aa; }
.event.sleep .event-dot, .event.phone .event-dot { background: #566e89; }
.event.exam .event-dot { background: #d9776f; }
.event.exercise .event-dot { background: #e0c063; }
.event-copy { min-width: 0; padding: 8px 0; }
.event-copy strong { font-size: 13px; display: block; font-weight: 400; line-height: 1.5; }
.event-copy small { font-size: 11px; color: var(--muted); display: block; line-height: 1.5; }
.event-copy small b { color: var(--green); font-weight: 400; }
.event-check { width: 28px; height: 28px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: transparent; display: grid; place-items: center; font-size: 14px; z-index: 1; }
.event-check.checked { background: var(--green); border-color: var(--green); color: var(--green-ink); }
.now-marker { color: var(--orange-ink); font-size: 10px; display: block; }
.event.done-row { opacity: .6; }
.event.done-row .event-copy strong { text-decoration: line-through; text-decoration-color: #9fb3a3; }
.event.missed-row .event-time { color: var(--red); }

/* week strip */
.week-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 10px; }
.week-strip button { border-radius: 12px; padding: 5px 0; display: grid; justify-items: center; gap: 1px; }
.week-strip small { font-size: 10px; color: var(--muted); }
.week-strip b { font-weight: 400; font-size: 14px; }
.week-strip i { width: 70%; height: 4px; border-radius: 4px; background: linear-gradient(to left, var(--green) var(--p), var(--line) var(--p)); }
.week-strip .selected { background: var(--green2); }
.week-strip .today b { color: var(--green); }

/* metrics, inputs */
.metric-row { display: flex; gap: 8px; }
.metric-box { flex: 1; background: var(--soft); border-radius: 12px; padding: 9px 10px; min-width: 0; text-align: start; }
.metric-box b { display: block; font-size: 18px; color: var(--green); font-weight: 400; line-height: 1.4; }
.metric-box small { font-size: 11px; color: var(--muted); }
.btnbox.done { background: var(--green2); }
.input-row { display: flex; gap: 7px; margin-top: 10px; flex-wrap: wrap; align-items: center; }
.input-row input { flex: 1 1 150px; }
.input-row select { flex: 0 1 auto; width: auto; }
.mini-btn { background: var(--green); color: var(--green-ink); border-radius: 10px; padding: 9px 14px; font-size: 13px; white-space: nowrap; }
.soft-btn { background: var(--green2); color: var(--green); border-radius: 10px; padding: 8px 12px; font-size: 12px; white-space: nowrap; }
.icon-small { border: 1px solid var(--line); background: var(--card); color: var(--green); border-radius: 9px; padding: 5px 9px; font-size: 12px; white-space: nowrap; }
.icon-small.ok { background: var(--green); color: var(--green-ink); border-color: var(--green); }
.meter { height: 6px; border-radius: 9px; background: var(--line); overflow: hidden; margin-top: 8px; }
.meter.big { height: 9px; margin: 6px 0 14px; }
.meter i { display: block; height: 100%; background: #83ad8e; border-radius: 9px; transition: width .25s; }
.meter.blue i { background: #75a9bf; }
.ib-upload { margin: 8px 0; }
.ib-img { display: block; width: 100%; max-height: 240px; object-fit: contain; border-radius: 12px; border: 1px solid var(--line); background: var(--soft); margin-top: 8px; }
.ib-img.full-img { max-height: 75vh; }
.coach-card { background: var(--soft); border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
.coach-card b { display: block; font-size: 14px; font-weight: 400; color: var(--green); }
.coach-card p { margin: 4px 0 0; }
.coach-card .row-actions { margin-top: 10px; }
.log-list { display: grid; gap: 6px; margin-top: 10px; }
.log-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; border-top: 1px solid var(--line); padding-top: 7px; font-size: 13px; }
.log-row:first-child { border-top: 0; }
.log-row small { color: var(--muted); }
.switch-row { display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: 13px; margin-top: 10px; }
.segmented { display: flex; gap: 5px; background: var(--soft); border-radius: 11px; padding: 4px; margin-bottom: 10px; }
.segmented button { flex: 1; color: var(--muted); border-radius: 8px; padding: 7px; font-size: 13px; }
.segmented button.active { background: var(--card); color: var(--green); box-shadow: 0 2px 7px #20392a12; }
.health-rule { background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: 11px; padding: 9px 11px; margin-top: 9px; font-size: 12px; color: var(--warn-ink); line-height: 1.8; }
.kv { display: flex; flex-wrap: wrap; gap: 8px 14px; font-size: 13px; color: var(--muted); }
.kv b { color: var(--ink); font-weight: 400; }
.spark { display: flex; align-items: flex-end; gap: 6px; height: 54px; margin-top: 10px; }
.spark i { flex: 1; height: var(--h); background: var(--green2); border-top: 3px solid var(--green); border-radius: 6px 6px 0 0; }

/* study */
.lecture-line { display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--line); padding: 8px 0; }
.lecture-main { flex: 1; min-width: 0; cursor: pointer; }
.lecture-main b { display: block; font-size: 13px; font-weight: 400; }
.lecture-main small { font-size: 11px; color: var(--muted); }
.lecture-line.done b { color: var(--green); }
.tick { width: 26px; height: 26px; border-radius: 8px; border: 1px solid var(--line); color: transparent; flex: none; }
.tick.checked { background: var(--green); border-color: var(--green); color: var(--green-ink); }
.lec-list { margin: 8px 0; }

/* work */
.task { display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--line); padding: 9px 0; }
.task:first-child { border-top: 0; }
.task.running { background: var(--orange-pale); margin: 0 -8px; padding: 9px 8px; border-radius: 12px; }
.task-main { flex: 1; min-width: 0; }
.task-main b { font-weight: 400; font-size: 13px; display: block; }
.task-main small { color: var(--muted); font-size: 11px; }
.star { color: var(--line); font-size: 18px; }
.star.on { color: var(--orange); }

/* worship */
.prayer-card { margin-bottom: 12px; }
.prayer-list { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; }
.prayer-item { text-align: center; background: var(--soft); border-radius: 12px; padding: 8px 2px; display: grid; gap: 3px; justify-items: center; }
.prayer-item.next { background: var(--green2); outline: 1px solid var(--green); }
.prayer-item b { font-weight: 400; font-size: 13px; }
.prayer-item small { font-size: 11px; color: var(--muted); white-space: nowrap; }
.mode-chip { border-radius: 999px; padding: 3px 9px; font-size: 11px; background: var(--green2); color: var(--green); white-space: nowrap; }
.mode-chip.notif { background: var(--blue); color: var(--blue-ink); }
.mode-chip.off { background: var(--soft); color: var(--muted); text-decoration: line-through; }
.mode-chip.adhan, .mode-chip.alarm { background: var(--green); color: var(--green-ink); }
.az-list { display: grid; gap: 9px; }
.az { text-align: start; background: var(--soft); border: 1px solid var(--line); border-radius: 14px; padding: 12px 13px 12px 52px; position: relative; font-family: var(--quran); font-size: 18px; line-height: 2; }
.az .az-title { display: block; font-family: var(--body); font-size: 12px; color: var(--green); }
.az .az-count { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; border-radius: 50%; background: var(--green); color: var(--green-ink); display: grid; place-items: center; font-family: var(--body); font-weight: 400; font-size: 14px; }
.az.done { opacity: .55; }
.az.done .az-count { background: var(--line); color: var(--green); }
.mushaf { display: flex; flex-direction: column; height: 100%; }
.mushaf-tools { display: flex; gap: 8px; margin-bottom: 8px; }
.mushaf-tools input { width: 90px; flex: none; }
.mushaf-page { flex: 1; overflow: auto; background: var(--soft); border: 1px solid var(--line); border-radius: 16px; padding: 16px 14px; font-family: var(--quran); font-size: 22px; line-height: 2.25; text-align: justify; }
.sura-head { text-align: center; font-family: var(--head); font-size: 17px; color: var(--green); background: var(--green2); border-radius: 12px; margin: 10px 0 6px; padding: 4px; }
.basmala { text-align: center; margin-bottom: 4px; }
.aya-n { color: var(--green); font-size: .8em; }
.mushaf-nav { display: flex; gap: 8px; margin-top: 10px; }
.mushaf-nav .btn { flex: 1; }
.tanzil { font-size: 11px; color: var(--muted); text-align: center; margin: 8px 0 0; }

/* settings */
.prefs { display: grid; }
.pref { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.pref:last-child { border: 0; }
.test-alarm { width: 100%; margin-top: 12px; border: 1px solid var(--line); background: var(--green2); color: var(--green); border-radius: 11px; padding: 10px; font-size: 13px; }

/* buttons */
.btn { border-radius: 12px; padding: 11px 16px; font-size: 14px; text-align: center; }
.btn.primary { background: var(--green); color: var(--green-ink); }
.btn.soft { background: var(--green2); color: var(--green); }
.btn.ghost { background: var(--soft); color: var(--muted); }
.btn.danger { background: var(--red-pale); color: var(--red); }
.btn.small { padding: 7px 12px; font-size: 12px; }
.btn.wide { width: 100%; }
.link { color: var(--green); font-size: 12px; }
.link.danger { color: var(--red); }
.row-actions { display: flex; gap: 8px; justify-content: flex-start; margin-top: 14px; flex-wrap: wrap; }
.row-actions .btn { flex: 1 1 auto; }
.list-actions { display: grid; gap: 8px; margin-top: 10px; }

/* modals */
.modal-backdrop { position: fixed; inset: 0; background: #1b2922b8; backdrop-filter: blur(6px); z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: min(100%, 560px); max-height: 88vh; overflow: auto; scrollbar-width: thin; background: var(--card); border-radius: 24px 24px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); box-shadow: 0 -10px 60px #0c171144; animation: up .18s ease-out; }
.sheet.tall { max-height: 94vh; }
.sheet.full { height: 100%; max-height: 100%; border-radius: 0; width: 100%; max-width: 640px; display: flex; flex-direction: column; }
.sheet.full > div { flex: 1; display: flex; flex-direction: column; min-height: 0; }
@media (min-width: 700px) { .modal-backdrop { align-items: center; } .sheet { border-radius: 24px; } .sheet.full { height: 92vh; border-radius: 24px; } }
@keyframes up { from { transform: translateY(30px); opacity: .4; } to { transform: none; opacity: 1; } }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.sheet-head h2 { font-size: 19px; }
.sheet-head p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.sheet h3 { font-size: 15px; margin: 14px 0 4px; }
.sheet p { margin: 6px 0; }
.x { width: 34px; height: 34px; border-radius: 11px; background: var(--soft); color: var(--muted); font-size: 20px; flex: none; }
.field { display: grid; gap: 4px; font-size: 12px; color: var(--muted); margin-top: 10px; }
.field > input, .field > select { color: var(--ink); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 8px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 8px; align-items: end; }
.preview { background: var(--soft); border-radius: 12px; padding: 11px 12px; color: var(--ink); font-size: 13px; line-height: 1.9; margin-top: 10px; }
textarea { resize: none; }
.builder-list { display: grid; gap: 7px; margin-bottom: 10px; }
.builder-row { display: grid; grid-template-columns: 96px 1fr 104px 34px; gap: 6px; align-items: center; }
.builder-row input, .builder-row select { padding: 8px 6px; font-size: 13px; }
.welcome-mark { width: 56px; height: 56px; border-radius: 18px; background: var(--green2); color: var(--green); display: grid; place-items: center; font-size: 26px; margin: 0 auto 12px; }
.welcome-list { display: grid; gap: 8px; margin: 14px 0; padding: 13px; background: var(--soft); border-radius: 15px; font-size: 13px; }
.welcome-list b { color: var(--green); font-weight: 400; }

/* wizard */
#wz { padding-top: 4px; }
.wz-dots { display: flex; gap: 5px; margin-bottom: 14px; }
.wz-dots i { flex: 1; height: 4px; border-radius: 4px; background: var(--line); }
.wz-dots i.on { background: var(--green); }
.wz-body { flex: 1; overflow: auto; padding-bottom: 10px; }
.wz-body h2 { font-size: 21px; text-align: start; }
.wz-body > .welcome-mark + h2 { text-align: center; }
.ai-steps { margin: 4px 0 12px; padding: 0; display: grid; gap: 14px; }
[dir=rtl] .ai-steps { padding-right: 22px; }
[dir=ltr] .ai-steps { padding-left: 22px; }
.ai-steps li > b { display: block; margin-bottom: 6px; }
.ai-steps .muted { display: block; }
.ai-steps textarea { width: 100%; margin-top: 6px; font-size: 13px; }
.ai-prompt summary { cursor: pointer; color: var(--muted); font-size: 14px; margin-top: 8px; }
.wz-lang { max-width: 220px; margin: 0 auto 10px; }
.welcome-logo { width: 72px; height: 72px; display: block; background: none; border-radius: 17px; }
.wz-nav { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 0; }
.subj-row { background: var(--soft); border: 1px solid var(--line); border-radius: 14px; padding: 4px 11px 9px; margin: 10px 0; }
.subj-row input, .subj-row select { background: var(--card); }

/* nav */
.bottomnav { position: fixed; bottom: 0; right: 0; left: 0; height: calc(64px + env(safe-area-inset-bottom)); padding: 6px max(10px, calc((100vw - 620px) / 2)) env(safe-area-inset-bottom);
  background: var(--card); background: color-mix(in srgb, var(--card) 92%, transparent); border-top: 1px solid var(--line); backdrop-filter: blur(14px); display: flex; justify-content: space-around; z-index: 10; }
.bottomnav button { color: var(--muted); display: grid; place-items: center; gap: 1px; font-size: 11px; flex: 1; }
.bottomnav svg { width: 21px; height: 21px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.bottomnav button.active { color: var(--green); }
.bottomnav button.active svg { stroke-width: 2.3; }
.floating-voice { position: fixed; bottom: calc(76px + env(safe-area-inset-bottom)); left: max(14px, calc((100vw - 640px) / 2 + 14px)); z-index: 12; border-radius: 16px; background: var(--green); color: var(--green-ink); padding: 10px 14px; box-shadow: 0 8px 20px #315d4840; font-size: 13px; }
.toast { position: fixed; bottom: calc(132px + env(safe-area-inset-bottom)); left: 50%; transform: translate(-50%, 15px); background: #26392e; color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 13px; opacity: 0; pointer-events: none; transition: .2s; z-index: 60; max-width: 90vw; text-align: center; line-height: 1.6; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 380px) {
  .shell { padding-left: 12px; padding-right: 12px; }
  .event { grid-template-columns: 48px 12px 1fr 28px; gap: 6px; }
  [dir=rtl] .event:not(:last-child)::after { right: 59px; }
  [dir=ltr] .event:not(:last-child)::after { left: 59px; }
  .goal { padding: 9px; }
  .grid3 { grid-template-columns: 1fr 1fr; }
  .builder-row { grid-template-columns: 84px 1fr 30px; }
  .builder-row select { display: none; }
  .prayer-item b { font-size: 12px; }
}

/* 2.1: focus, report bars, cards, support */
.ocr-hit { border-color: var(--green) !important; background: var(--green2) !important; }
.alarm-live { text-align: center; }
.alarm-live .big { font-size: 22px; margin: 6px 0 14px; }
.warn-text { color: var(--orange-ink); margin: 4px 0 0; }
.mic-pulse { width: 110px; height: 110px; margin: 16px auto 8px; border-radius: 50%; background: var(--green2); display: grid; place-items: center; font-size: 40px; transition: transform .3s; }
.mic-pulse.on { animation: pulse 1.1s ease-in-out infinite; background: var(--green); }
@keyframes pulse { 0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 #315d4855; } 50% { transform: scale(1.08); box-shadow: 0 0 0 16px #315d4800; } }
.mic-text { min-height: 52px; font-size: 16px; }
.mt { margin-top: 10px; }
.good { color: var(--green); font-weight: 400; }
.bad { color: var(--red); font-weight: 400; }
.good-box { background: var(--green2); border-color: transparent; color: var(--green); }
.focus-banner { display: block; width: 100%; margin-top: 11px; padding: 11px 13px; border-radius: 12px; background: var(--orange-pale); color: var(--orange-ink); text-align: start; font-size: 13px; }
.focus-ring { --p: 0%; width: 220px; height: 220px; margin: 18px auto; border-radius: 50%; display: grid; place-content: center; text-align: center;
  background: radial-gradient(closest-side, var(--card) 86%, transparent 87%), conic-gradient(var(--green) var(--p), var(--line) 0); }
.focus-ring b { font-size: 46px; font-weight: 400; color: var(--green); line-height: 1.1; direction: ltr; }
.focus-ring small { color: var(--muted); font-size: 12px; }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 90px; margin: 8px 0 4px; }
.bar { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 3px; }
.bar i { width: 100%; height: var(--h); min-height: 2px; background: var(--green); border-radius: 6px 6px 2px 2px; opacity: .85; }
.bars.blue .bar i { background: #75a9bf; }
.bar small { font-size: 10px; color: var(--muted); }
.flash { background: var(--soft); border: 1px solid var(--line); border-radius: 16px; padding: 18px 14px; min-height: 150px; display: grid; gap: 12px; align-content: center; text-align: center; margin-bottom: 12px; }
.flash-q { font-size: 17px; }
.flash-a { font-size: 15px; color: var(--green); border-top: 1px dashed var(--line); padding-top: 12px; }
.breath { width: 190px; height: 190px; margin: 14px auto; border-radius: 50%; background: var(--green2); display: grid; place-content: center; text-align: center; transform: scale(.75); transition: transform 4s ease-in-out; }
.breath.in { transform: scale(1); }
.breath.hold { transform: scale(1); }
.breath.out { transform: scale(.72); transition-duration: 6s; }
.breath b { font-size: 26px; font-weight: 400; color: var(--green); }
.breath small { color: var(--muted); }

/* Toasts move to the top while a sheet is open, so they never cover its buttons. */
body.noscroll .toast { bottom: auto; top: calc(14px + env(safe-area-inset-top)); }

/* Quran and adhkar stay right-to-left in every app language. */
.az, .az-list, .mushaf-page, .mushaf-tools { direction: rtl; }
[dir=ltr] body { font-family: "Reem Kufi", system-ui, sans-serif; }
[dir=ltr] .bottomnav button span, [dir=ltr] .goal strong { letter-spacing: 0; }

/* Direction-dependent spacing written per direction (old WebViews lack logical CSS properties). */
[dir=rtl] .next-time { border-left: 1px solid var(--line); padding-left: 11px; }
[dir=ltr] .next-time { border-right: 1px solid var(--line); padding-right: 11px; }
[dir=rtl] .permission button { margin-right: auto; }
[dir=ltr] .permission button { margin-left: auto; }
[dir=rtl] .event:not(:last-child)::after { right: 68px; }
[dir=ltr] .event:not(:last-child)::after { left: 68px; }
[dir=rtl] .now-marker { margin-right: 3px; }
[dir=ltr] .now-marker { margin-left: 3px; }
@media (max-width: 380px) {
  [dir=rtl] .event:not(:last-child)::after { right: 59px; }
  [dir=ltr] .event:not(:last-child)::after { left: 59px; }
}

/* ---------------------------------------------------------------- habits */
.habit-list { display: grid; gap: 10px; }
.habit-empty p { margin: 0 0 10px; color: var(--muted); font-size: 14px; }
.habit-row { display: flex; align-items: center; gap: 10px; }
.habit-row.rest { opacity: .55; }
.habit-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; background: none; border: 0; padding: 0; color: inherit; font: inherit; text-align: start; cursor: pointer; }
.habit-icon { width: 38px; height: 38px; flex: none; border-radius: 12px; display: inline-grid; place-items: center; font-size: 19px; background: var(--soft); border: 2px solid var(--hc); vertical-align: middle; }
.sheet-head h2 .habit-icon { width: 32px; height: 32px; font-size: 16px; border-radius: 10px; }
.habit-text { min-width: 0; display: grid; gap: 3px; }
.habit-text b { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.habit-text small { color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 6px; }
.habit-dots { display: inline-flex; gap: 3px; }
.habit-dots i { width: 8px; height: 8px; border-radius: 2px; background: var(--line); }
.habit-dots i.on { background: var(--hc); }
.habit-dots i.off { background: transparent; border: 1px dashed var(--line); width: 6px; height: 6px; }
.habit-check { width: 40px; height: 40px; flex: none; border-radius: 50%; border: 2px solid var(--hc); background: transparent; color: var(--hc); font-size: 18px; font-weight: 700; cursor: pointer; }
.habit-check.on { background: var(--hc); color: #fff; }
.habit-list > .chip { justify-self: start; }
.habit-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 4px 0 14px; }
.habit-stats div { background: var(--soft); border-radius: 12px; padding: 10px 6px; text-align: center; display: grid; gap: 2px; }
.habit-stats b { font-size: 18px; }
.habit-stats small { color: var(--muted); font-size: 11px; }
.habit-grid-wrap { overflow-x: auto; padding-bottom: 4px; }
.habit-months { display: grid; grid-template-columns: repeat(20, 14px); gap: 3px; font-size: 9px; color: var(--muted); height: 12px; white-space: nowrap; }
.habit-grid { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 14px); grid-auto-columns: 14px; gap: 3px; }
.hc { width: 14px; height: 14px; border-radius: 3px; border: 0; padding: 0; background: var(--line); }
.hc.on { background: var(--hc); }
.hc.rest { background: var(--soft); outline: 1px dashed var(--line); outline-offset: -1px; }
.hc.future, .hc.before { background: transparent; }
.hc.today { box-shadow: 0 0 0 2px var(--ink); }
button.hc { cursor: pointer; }
.habit-colors { display: flex; gap: 10px; margin-top: 6px; }
.habit-colors input { position: absolute; opacity: 0; }
.habit-colors span { display: block; width: 30px; height: 30px; border-radius: 50%; border: 3px solid transparent; }
.habit-colors input:checked + span { border-color: var(--ink); }
.habit-icons .chip-check { font-size: 18px; padding: 4px 8px; }
.habit-month-row { padding: 10px 0; border-bottom: 1px solid var(--line); display: grid; gap: 8px; }
.habit-month-top { display: flex; align-items: center; gap: 10px; }
.habit-month-top b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.habit-month-top span { color: var(--muted); font-size: 13px; }
.habit-strip { display: flex; flex-wrap: wrap; gap: 3px; }
.habit-strip i { width: 12px; height: 12px; border-radius: 3px; background: var(--line); }
.habit-strip i.on { background: var(--hc); }
.habit-strip i.rest { background: var(--soft); outline: 1px dashed var(--line); outline-offset: -1px; }
.habit-strip i.future { background: transparent; outline: 1px solid var(--line); outline-offset: -1px; }
.habit-month-nav { justify-content: space-between; margin-bottom: 4px; }
.moved-tag { color: var(--orange-ink); }
.conflict-tag { color: var(--red); font-weight: 600; }
.pref-btns { display: inline-flex; gap: 6px; align-items: center; }
.import-preview p { margin: 0 0 6px; }
.import-mode label { display: flex; align-items: flex-start; gap: 10px; justify-content: flex-start; text-align: start; }
.import-mode input { margin-top: 4px; flex: none; width: auto; }
.sep { font-style: normal; }

/* ---------------------------------------------------------------- 3.0: lifecycle, capacity */
.event.skipped-row { opacity: .5; }
.event.skipped-row .event-copy strong { text-decoration: line-through; }
.event.active-row .event-dot { box-shadow: 0 0 0 4px rgba(243, 164, 90, .35); background: var(--orange); }
.state-tag { margin: 0 0 10px; font-size: 13px; color: var(--muted); }
.state-tag.active { color: var(--orange-ink); font-weight: 600; }
.capacity { margin: 0 0 10px; display: grid; gap: 4px; }
.capacity-bar { height: 6px; border-radius: 4px; background: var(--line); overflow: hidden; }
.capacity-bar i { display: block; height: 100%; background: var(--green); }
.capacity.busy .capacity-bar i { background: var(--orange); }
.capacity.full .capacity-bar i { background: var(--red); }
.capacity small { color: var(--muted); font-size: 12px; }
.conflict-list { margin: 6px 0 0; padding: 0; list-style: none; display: grid; gap: 6px; font-size: 13px; }
.snap-list .pref small { font-size: 11px; }

/* ---------------------------------------------------------------- 3.2: academic, analytics, daily review */
.exam-banner { display: block; width: 100%; margin: 0 0 10px; padding: 12px 14px; border: 0; border-radius: 14px; background: var(--orange-pale); color: var(--orange-ink); font: inherit; font-weight: 600; text-align: start; cursor: pointer; }
.a-row { display: grid; grid-template-columns: minmax(70px, 34%) 1fr auto; gap: 8px; align-items: center; font-size: 13px; margin: 6px 0; }
.a-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.a-bar { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.a-bar i { display: block; height: 100%; background: var(--green); }
.a-row b { font-size: 12px; color: var(--muted); }
.dr-miss { padding: 8px 0; border-bottom: 1px solid var(--line); }
.chip.on { background: var(--green); color: var(--green-ink); border-color: var(--green); }
.topic-list .switch-row { justify-content: space-between; }
.prio-tag { color: var(--red); font-weight: 600; }
.insights { margin: 4px 0 10px; padding-inline-start: 0; list-style: none; display: grid; gap: 6px; font-size: 13px; }
.insights li::before { content: "• "; color: var(--green); }

.code-box { font: 600 1.15rem/1.6 ui-monospace, Consolas, monospace; text-align: center; letter-spacing: .04em; padding: 14px; border-radius: 12px; background: var(--card-2, rgba(127,127,127,.12)); user-select: all; word-break: break-all; }
