@font-face { font-family: 'Vazirmatn'; font-weight: 100 900; font-display: swap; src: url(/static/fonts/vazirmatn-arabic.woff2) format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+200C-200E, U+FB50-FDFF, U+FE70-FEFC; }
@font-face { font-family: 'Vazirmatn'; font-weight: 100 900; font-display: swap; src: url(/static/fonts/vazirmatn-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+2000-206F; }
@font-face { font-family: 'Amiri Quran'; font-display: swap; src: url(/static/fonts/amiri-quran.woff2) format('woff2'); }

:root {
  --bg: #f6f3ec; --card: #fffdf8; --ink: #1f2420; --muted: #6b6f68; --line: #e4ddcf;
  --green: #1f4d3a; --green-soft: #e3efe7; --gold: #a8781f; --warn: #a4461f; --warn-soft: #fbeee6;
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #141714; --card: #1d211d; --ink: #e9e6dc; --muted: #9aa096; --line: #30362f;
    --green: #6fbf94; --green-soft: #213a2c; --gold: #d8ae5c; --warn: #e48a60; --warn-soft: #3a2519; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.7 'Vazirmatn', Tahoma, sans-serif; }
a { color: var(--green); text-decoration: none; }
h1, h2 { line-height: 1.4; margin: 0 0 .4em; }
h1 { font-size: 1.3rem; } h2 { font-size: 1.1rem; }
main > h2 { margin: 1.4em .2em .5em; color: var(--muted); font-size: 1rem; }
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: .8rem; padding: .7rem 1rem; padding-top: max(.7rem, env(safe-area-inset-top));
  background: var(--green); color: #fff; }
@media (prefers-color-scheme: dark) { .top { background: #173a2b; } }
.top a { color: #fff; }
.brand { font-weight: 700; }
.me { margin-inline-start: auto; opacity: .85; font-size: .9rem; }
.back { font-size: 1.3rem; line-height: 1; }
main { max-width: 760px; margin: 0 auto; padding: 1rem .8rem 6rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin-bottom: .9rem; }
.card.done { border-color: var(--green); box-shadow: inset 0 0 0 1px var(--green); }
.card.center, .center { text-align: center; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin-bottom: .4rem; }
.card-head h1, .card-head h2 { margin: 0; }
.khatm-title { font-weight: 700; color: var(--ink); }
.chip { background: var(--green-soft); color: var(--green); border-radius: 999px; padding: .1rem .7rem; font-size: .85rem; white-space: nowrap; }
.chip.ok { background: var(--green); color: #fff; }
.chip.small { font-size: .7rem; padding: 0 .5rem; }
.muted { color: var(--muted); } .small { font-size: .85rem; }
.warn { color: var(--warn); } .warn-text { color: var(--warn) !important; }
.box { background: var(--warn-soft); border-radius: 10px; padding: .6rem .8rem; }
.intention { white-space: pre-line; background: var(--bg); border-radius: 10px; padding: .7rem .9rem; }
.today { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: .4rem 0 .8rem; }
.portion { display: block; font-size: 1.35rem; font-weight: 700; color: var(--ink); }
/* Amiri Quran draws ~30% smaller than Vazirmatn at the same size; scale it up wherever the two sit together. */
.opening { font-family: 'Amiri Quran', serif; font-size: 1.6rem; line-height: 1.6; color: var(--muted); }
.row-actions, .nav, .copy-row, .inline { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.nav { justify-content: space-between; margin: .3rem 0 .6rem; }
.btn { display: inline-block; border: 0; border-radius: 10px; padding: .55rem 1.1rem; background: var(--green); color: #fff; font: inherit; cursor: pointer; text-align: center; }
@media (prefers-color-scheme: dark) { .btn { color: #0f1a14; } }
.btn.ghost { background: transparent; color: var(--green); box-shadow: inset 0 0 0 1px var(--line); }
.btn.small { padding: .3rem .7rem; font-size: .85rem; }
.btn.danger { background: var(--warn); }
.tick-form, .cell-form { margin: 0; display: inline; }
.tick { width: 2.4rem; height: 2.4rem; border-radius: 50%; border: 2px solid var(--line); background: var(--card); color: #fff; font: 700 1.1rem/1 'Vazirmatn', sans-serif; cursor: pointer; flex: none; }
.tick:not(:disabled):hover { border-color: var(--green); }
.tick.on { background: var(--green); border-color: var(--green); }
.tick:disabled { opacity: .35; cursor: default; }
.tick.big { width: auto; height: auto; border-radius: 12px; padding: .8rem 2rem; font-size: 1.1rem; color: var(--green); border-color: var(--green); }
.tick.big.on { color: #fff; }
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: .9rem; }
table { border-collapse: collapse; width: 100%; }
th, td { padding: .35rem .45rem; border-bottom: 1px solid var(--line); text-align: start; white-space: nowrap; }
th { position: sticky; top: 0; background: var(--card); font-size: .8rem; color: var(--muted); font-weight: 400; }
.num { font-variant-numeric: tabular-nums; }
.sheet td { font-size: .92rem; }
.sheet td a { color: var(--ink); }
.sheet td { padding: .35rem .3rem; }
.sheet .day { color: var(--muted); font-size: .8rem; }
.sheet .date span { display: block; line-height: 1.3; }
.sheet .wd { font-size: .75rem; color: var(--muted); }
.sheet .wd.friday { color: var(--gold); }
.sheet .where .juz { display: block; font-size: .7rem; line-height: 1.2; }
.sheet .opening { font-size: 1.4rem; line-height: 1.5; white-space: normal; min-width: 6rem; }
.sheet .opening a { color: var(--muted); }
.sheet .tick { width: 1.8rem; height: 1.8rem; font-size: .9rem; }
.sheet tr.is-today { background: var(--green-soft); }
.sheet tr.is-today td:first-child { box-shadow: inset -4px 0 0 var(--green); }
.sheet tr.future { opacity: .55; }
.sheet tr.missed .tick { border-color: var(--warn); }
.friday { color: var(--gold); font-weight: 700; }
.juz { color: var(--gold); font-weight: 700; }
tr[id] { scroll-margin-top: 5rem; }
.read-head h1 { font-size: 1.15rem; }
.seg { display: flex; gap: .3rem; align-items: center; font-size: .85rem; color: var(--muted); flex-wrap: wrap; }
.seg a { padding: .15rem .6rem; border-radius: 999px; box-shadow: inset 0 0 0 1px var(--line); }
.seg a.on { background: var(--green); color: #fff; box-shadow: none; }
.mushaf { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .5rem 1.1rem; margin-top: .8rem; }
.sura-head { text-align: center; margin: 1rem 0 .3rem; padding: .4rem; border-block: 1px solid var(--line); color: var(--green); }
.basmala { font-family: 'Amiri Quran', serif; font-size: 1.6rem; text-align: center; margin: .3rem 0; }
.mushaf .ar { font-family: 'Amiri Quran', serif; font-size: 1.7rem; line-height: 2.5; margin: .6rem 0; text-align: justify; text-align-last: right; }
.ar .sajda { background: var(--warn-soft); border-radius: 6px; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.ayah-no { display: inline-flex; align-items: center; justify-content: center; min-width: 1.75em; height: 1.75em; border: 1px solid var(--gold); border-radius: 50%;
  font: .7rem/1 'Vazirmatn', sans-serif; color: var(--gold); vertical-align: .35em; padding: 0 .2em; }
.mushaf .tr { margin: -.2rem 0 1rem; padding-bottom: .9rem; border-bottom: 1px dashed var(--line); color: var(--muted); font-size: .97rem; line-height: 2; text-align: justify; }
.mushaf .tr:last-child { border-bottom: 0; }
.nw { white-space: nowrap; }
.read-head .nav { flex-wrap: nowrap; }
.tr-no { color: var(--gold); font-size: .8rem; }
.mushaf .tr[lang="en"] { font-family: Georgia, serif; line-height: 1.7; }
/* Urdu reads best in Nastaliq (built into iOS; Android falls back to Naskh). */
.mushaf .tr[lang="ur"], html[lang="ur"] body { font-family: 'Noto Nastaliq Urdu', 'Jameel Noori Nastaleeq', 'Vazirmatn', serif; }
.mushaf .tr[lang="ur"] { line-height: 2.4; }
html[lang="ur"] body { line-height: 2; }
html[lang="en"] body { font-family: 'Vazirmatn', system-ui, sans-serif; }
.langs { margin-bottom: .6rem; }
.sticky-done { position: fixed; inset-inline: 0; bottom: 0; padding: .7rem; padding-bottom: max(.7rem, env(safe-area-inset-bottom)); text-align: center;
  background: linear-gradient(transparent, var(--bg) 35%); }
.sticky-done .tick.big { background: var(--card); min-width: 14rem; }
.sticky-done .tick.big.on { background: var(--green); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(2.3rem, 1fr)); gap: 4px; }
.cell { display: flex; align-items: center; justify-content: center; width: 100%; height: 2.1rem; border-radius: 6px; border: 1px solid var(--line); background: var(--card);
  font: .72rem 'Vazirmatn', sans-serif; color: var(--ink); cursor: pointer; padding: 0; }
.cell.on { background: var(--green); color: #fff; border-color: var(--green); }
.cell.empty { background: transparent; border-style: dashed; color: var(--muted); cursor: default; }
.stack { display: flex; flex-direction: column; gap: .7rem; margin: .5rem 0; }
.stack label, fieldset { display: flex; flex-direction: column; gap: .25rem; font-size: .9rem; color: var(--muted); }
label.check { flex-direction: row; align-items: center; gap: .5rem; color: var(--ink); }
fieldset.date { flex-direction: row; border: 0; padding: 0; margin: 0; gap: .4rem; flex-wrap: wrap; }
fieldset.date legend { width: 100%; padding: 0; margin-bottom: .25rem; }
fieldset.date input { width: 5rem; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: .5rem .7rem; }
.copy-row input { flex: 1; min-width: 12rem; direction: ltr; font-size: .85rem; }
details summary { cursor: pointer; color: var(--green); margin-top: .6rem; }
details.menu { display: inline-block; position: relative; }
details.menu summary { list-style: none; margin: 0; padding: 0 .5rem; font-size: 1.2rem; }
details.menu[open] > form { position: absolute; inset-inline-end: 0; z-index: 3; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: .7rem; width: 12rem; box-shadow: 0 6px 24px #0002; }
.actions { display: flex; gap: .3rem; align-items: center; }
.list { padding: .2rem 0; }
.list-row { display: flex; justify-content: space-between; gap: .5rem; padding: .7rem 1rem; color: var(--ink); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.list-row:last-child { border-bottom: 0; }
.list-row.accent { color: var(--green); font-weight: 700; }
code { background: var(--bg); padding: 0 .3rem; border-radius: 4px; }
.toast { position: fixed; bottom: 1.2rem; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: .5rem 1rem; border-radius: 999px; z-index: 10; }
.install { position: fixed; inset-inline: .8rem; bottom: max(.8rem, env(safe-area-inset-bottom)); z-index: 8; box-shadow: 0 8px 30px #0003; padding-inline-end: 2.5rem; max-width: 520px; margin-inline: auto; }
.install { padding: .7rem 1rem; padding-inline-end: 2.5rem; }
.install p { margin: .1rem 0 .4rem; }
.install .btn { padding: .35rem 1.2rem; }
.install-close { position: absolute; top: .4rem; inset-inline-end: .5rem; background: none; border: 0; font-size: 1.4rem; color: var(--muted); cursor: pointer; }
.install [hidden] { display: none; }
body:has(.sticky-done) .install { bottom: 5.5rem; }
.today-head strong { font-size: 1.05rem; }
.hijri { margin-top: .2rem; }
.hijri.compact { margin: 0 0 .4rem; }
.events { list-style: none; padding: 0; margin: .4rem 0 0; display: flex; flex-direction: column; gap: .25rem; }
.events li { padding: .3rem .7rem; border-radius: 8px; background: var(--bg); border-inline-start: 3px solid var(--gold); font-size: .92rem; }
.events li.eid { border-color: var(--green); }
.events li.mourning { border-color: #555; }
.hijri-row { display: flex; justify-content: space-between; align-items: center; gap: .6rem; flex-wrap: wrap; padding: .6rem 0; border-top: 1px solid var(--line); }
.shift-btns { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.shift-btns form { margin: 0; }
.shift-btns .btn { width: 100%; display: flex; flex-direction: column; gap: .1rem; }
.confirm-list { list-style: none; padding: 0; margin: .3rem 0 .8rem; display: flex; flex-direction: column; gap: .5rem; }
.confirm-list li { background: var(--green-soft); border-radius: 10px; padding: .6rem .8rem; }
.confirm-list .opening { display: block; }
fieldset.rows { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .4rem; }
fieldset.rows legend { padding: 0; margin-bottom: .25rem; }
.row-pick { display: flex; flex-direction: column; gap: .2rem; }
.row-line { display: flex; gap: .4rem; align-items: center; }
.row-line input { width: 6.5rem; text-align: center; font-size: 1.1rem; }
.row-preview { min-height: 1.6em; font-size: .9rem; }
.row-preview .opening { font-size: 1.4rem; margin-inline-start: .3rem; }
.row-preview .warn { font-size: .85rem; }
.row-pick:only-of-type .row-remove { visibility: hidden; }
.row-add { align-self: flex-start; }
