/* Qaḍāʾ: prayers and fasts to make up, and mannat to fulfil, each a count going down. Kept plain: a list, one button
   on each row, and Add. */
:root {
  --bg: #f7f7fb; --bg-2: #eef0f7; --card: #fffefe; --ink: #23263a; --ink-2: #545a72; --line: #e0e3ee;
  --accent: #5a4fa3; --accent-soft: #e4e8f7; --done: #3f8a5c; --done-bg: #e1f1e7; --warn: #a2611b;
  --shadow: 0 1px 2px rgba(30, 35, 70, .05), 0 8px 24px rgba(30, 35, 70, .07);
  --radius: 18px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #15161f; --bg-2: #1c1e2a; --card: #222433; --ink: #eef0f8; --ink-2: #c3c7da; --line: #343849;
  --accent: #a59cf0; --accent-soft: #2a2747; --done: #86c99d; --done-bg: #1f3327; --warn: #e3a465;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; color: var(--ink); font: 16px/1.55 "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: radial-gradient(1200px 500px at 85% -10%, var(--accent-soft), transparent 60%), var(--bg); background-attachment: fixed; }
button, input, select { font: inherit; color: inherit; }
a { color: var(--accent); }
.wrap { max-width: 640px; margin: 0 auto; padding: 0 16px 96px; }

/* Header, as in the other apps (ui.js turns its buttons into Apps and Settings) */
header.top { position: sticky; top: 0; z-index: 10; backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  background: color-mix(in srgb, var(--bg) 78%, transparent); border-bottom: 1px solid var(--line); }
header.top .wrap { padding-bottom: 0; display: flex; align-items: center; gap: 12px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; margin-right: auto; text-decoration: none; color: var(--ink); }
.brand svg { width: 34px; height: 34px; }
.brand b { font: 600 24px/1 "Noto Serif", "Fraunces", Georgia, serif; }
.brand small { display: block; font-size: 13.5px; color: var(--ink-2); margin-top: 2px; }
.theme-btn { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: var(--bg-2); display: grid; place-items: center; padding: 0; color: var(--ink-2); }
.theme-btn svg { width: 17px; height: 17px; }
.theme-btn .sun { display: none; }

/* Headings and plain text */
.intro { margin: 26px 0 14px; }
.intro h1 { font: 600 28px/1.15 "Noto Serif", "Fraunces", Georgia, serif; margin: 0 0 6px; }
.intro p { margin: 0; color: var(--ink-2); }
h2.sec { font: 600 19px "Noto Serif", "Fraunces", Georgia, serif; margin: 24px 2px 10px; display: flex; align-items: baseline; gap: 8px; }
h2.sec small { font: 500 15px "DM Sans", sans-serif; color: var(--ink-2); }
.muted { color: var(--ink-2); }
.small { font-size: 15px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; padding: 0 20px; border-radius: 14px;
  border: 1.5px solid var(--line); background: var(--card); font-weight: 600; font-size: 17px; cursor: pointer; text-decoration: none; color: var(--ink); }
.btn:hover { border-color: var(--accent); }
.btn svg { width: 20px; height: 20px; flex: 0 0 auto; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--card); }
.btn.wide { display: flex; width: 100%; }
.btn.danger { color: #b3362c; }
.btn[disabled] { opacity: .45; cursor: default; }
.link { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 600; cursor: pointer; font-size: 16px; text-decoration: underline; text-underline-offset: 3px; }
.back { display: inline-flex; align-items: center; min-height: 44px; margin: 10px 0 0; }

/* The list: one row per thing to do, with what's left and one button to count one done */
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 16px; border-radius: var(--radius); background: var(--card);
  border: 1px solid var(--line); box-shadow: var(--shadow); }
.row .main { flex: 1; min-width: 0; text-decoration: none; color: inherit; }
.row .name { display: block; font-weight: 700; font-size: 17px; line-height: 1.25; }
.row .left { display: block; color: var(--ink-2); font-size: 15px; margin-top: 2px; }
.row .left b { color: var(--ink); font-size: 17px; }
.bar { height: 6px; margin-top: 8px; border-radius: 99px; background: var(--bg-2); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 99px; background: var(--accent); }
.one { flex: 0 0 auto; display: grid; place-items: center; width: 68px; min-height: 54px; padding: 6px 4px; border-radius: 16px;
  border: 0; background: var(--accent); color: var(--card); cursor: pointer; font-weight: 700; font-size: 15px; line-height: 1.15; }
.one svg { width: 22px; height: 22px; margin-bottom: 2px; }
.one:active { transform: scale(.96); }
.row.finished { box-shadow: none; background: var(--done-bg); border-color: transparent; }
.row.finished .one { background: var(--done); }
.dayall { margin: 0 0 10px; }
.addrow { margin-top: 16px; }
details.finished-list { margin-top: 20px; }
details.finished-list summary { cursor: pointer; font-weight: 600; color: var(--ink-2); padding: 6px 2px; }
details.finished-list .list { margin-top: 8px; }

/* An empty start */
.empty { margin: 18px 0; padding: 22px 18px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line); text-align: center; }
.empty p { margin: 0 0 16px; color: var(--ink-2); }

/* Adding: big choices, one question at a time */
.q { font: 600 20px/1.25 "Noto Serif", "Fraunces", Georgia, serif; margin: 22px 2px 10px; }
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.choice { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 14px 16px; border-radius: 16px; border: 1.5px solid var(--line);
  background: var(--card); text-align: left; cursor: pointer; }
.choice b { font-size: 17px; }
.choice small { color: var(--ink-2); font-size: 14.5px; line-height: 1.35; }
.choice[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.choices.small-ch { grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); }
.choices.small-ch .choice { align-items: center; text-align: center; padding: 12px 8px; }
select, input[type="text"], input[type="search"] { width: 100%; min-height: 50px; padding: 10px 14px; border-radius: 14px; border: 1.5px solid var(--line);
  background: var(--card); font-size: 17px; }
select:focus, input:focus { outline: none; border-color: var(--accent); }
.results { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; max-height: 340px; overflow-y: auto; }
.results button { width: 100%; text-align: left; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); cursor: pointer; }
.results button b { display: block; }
.results button small { color: var(--ink-2); }
.results button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }

/* How many: − number + */
.count { display: flex; align-items: center; gap: 10px; }
.count button { width: 52px; height: 52px; flex: 0 0 auto; border-radius: 50%; border: 1.5px solid var(--line); background: var(--card); font: 600 26px/1 "DM Sans", sans-serif; cursor: pointer; padding: 0; }
.count input { width: 120px; min-height: 52px; text-align: center; font: 700 24px "DM Sans", sans-serif; border-radius: 14px; border: 1.5px solid var(--line); background: var(--card); }
.helper { margin-top: 12px; padding: 12px 14px; border-radius: 14px; background: var(--bg-2); }
.helper summary { cursor: pointer; font-weight: 600; color: var(--accent); }
.helper .hrow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.helper .hrow input { width: 90px; min-height: 46px; text-align: center; font-weight: 700; border-radius: 12px; border: 1.5px solid var(--line); background: var(--card); padding: 6px; }
.helper .hrow select { width: auto; min-height: 46px; }
.helper p { margin: 8px 0 0; color: var(--ink-2); font-size: 15px; }
.savebar { margin-top: 26px; display: grid; gap: 10px; }
.summary-line { margin: 18px 2px 0; padding: 12px 14px; border-radius: 14px; background: var(--accent-soft); font-weight: 600; }

/* One item's page */
.big { text-align: center; margin: 18px 0 8px; }
.big b { display: block; font: 700 54px/1 "DM Sans", sans-serif; }
.big span { color: var(--ink-2); }
.panel { margin-top: 14px; padding: 14px 16px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line); }
.panel h3 { margin: 0 0 10px; font-size: 16px; }
.panel .count { justify-content: center; }
.danger-zone { margin-top: 26px; text-align: center; }

/* The note shown after counting one, with Undo */
.toast { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 50; display: flex; align-items: center; gap: 14px;
  max-width: calc(100% - 32px); padding: 12px 16px; border-radius: 14px; background: var(--ink); color: var(--bg); box-shadow: var(--shadow); font-size: 16px; }
.toast button { background: none; border: 0; color: var(--accent-soft); font-weight: 700; cursor: pointer; text-decoration: underline; padding: 4px; }
:root[data-theme="dark"] .toast button { color: var(--accent); }

/* The five daily prayers of one person, as one card */
.daycard { margin: 0 0 12px; padding: 16px; border-radius: 22px; color: var(--ink);
  background: linear-gradient(150deg, var(--accent-soft), var(--card) 80%); border: 1px solid var(--line); box-shadow: var(--shadow); }
.dc-top { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.dc-ic { flex: 0 0 auto; width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--accent); color: var(--card); }
.dc-ic svg { width: 26px; height: 26px; }
.dc-t { flex: 1; min-width: 0; }
.dc-t b { display: block; font: 600 19px/1.2 "Noto Serif", "Fraunces", Georgia, serif; }
.dc-t small { display: block; color: var(--ink-2); font-size: 14.5px; margin-top: 2px; }
.dc-n { text-align: right; flex: 0 0 auto; }
.dc-n b { display: block; font: 700 30px/1 "DM Sans", sans-serif; color: var(--accent); }
.dc-n small { color: var(--ink-2); font-size: 14px; }
.dc-pace { margin: 10px 2px 0; font-size: 15px; color: var(--ink-2); }

.tag { display: inline-block; margin-bottom: 3px; padding: 1px 9px; border-radius: 99px; background: var(--bg-2); color: var(--ink-2); font-size: 13px; font-weight: 600; }
.row .left { margin-top: 1px; }
.one span { display: block; }

/* Adding: quick amounts and on/off choices */
.quick { display: flex; gap: 8px; margin-top: 10px; }
.quick button { min-height: 40px; padding: 0 14px; border-radius: 99px; border: 1.5px solid var(--line); background: var(--card); font-weight: 600; cursor: pointer; }
.tog { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.tog input { width: 20px; height: 20px; accent-color: var(--accent); flex: 0 0 auto; }
.big-tog { margin-top: 12px; padding: 12px 14px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--card); }
.big-tog b { display: block; }
.big-tog small { color: var(--ink-2); font-size: 14.5px; }
.count.small { flex-wrap: wrap; }
.count.small button { width: 44px; height: 44px; font-size: 22px; }
.count.small input { width: 86px; min-height: 44px; font-size: 19px; }
.count.small .btn { min-height: 44px; width: auto; height: auto; border-radius: 12px; font-size: 16px; padding: 0 16px; }

/* The week, as seven small bars */
.week .wbars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; align-items: end; height: 96px; padding: 12px 14px 8px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line); }
.wb { position: relative; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; }
.wb i { display: block; width: 100%; max-width: 26px; min-height: 3px; border-radius: 6px; background: var(--accent); opacity: .85; }
.wb span { font-size: 12.5px; color: var(--ink-2); }
.wb b { order: -1; min-height: 15px; font-size: 12px; color: var(--ink-2); }

/* At the foot of the list */
.foot { display: grid; gap: 12px; justify-items: start; margin: 28px 2px 0; padding-top: 16px; border-top: 1px solid var(--line); }
.foot a { font-weight: 600; }
.btn.add { border-style: dashed; color: var(--accent); }
.panel.fold summary { cursor: pointer; font-weight: 600; }
.nums { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 8px; }
.nums input { width: 100px; min-height: 46px; text-align: center; font-weight: 700; border-radius: 12px; border: 1.5px solid var(--line); background: var(--card); }
.danger-zone .link { color: #b3362c; }


/* The guide */
details.ruling { margin: 8px 0; padding: 12px 14px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); }
details.ruling summary { cursor: pointer; font-weight: 600; }
details.ruling summary small { color: var(--ink-2); font-weight: 500; margin-left: 4px; }
details.ruling p { margin: 10px 0 0; line-height: 1.6; }
details.ruling .src { font-size: 14px; }

/* Printed: the list in light colours, without buttons */
.print-only { display: none; }
@media print {
  :root, :root[data-theme="dark"] { --bg: #fff; --bg-2: #f1f2f7; --card: #fff; --ink: #1c1d2a; --ink-2: #555; --line: #d9dbe6; --accent: #4a3f99; --accent-soft: #eceaf8; --shadow: none; color-scheme: light; }
  body { background: #fff; }
  header.top, .no-print, .one, .undo-btn, .daycard .btn, .toast, .ui-btn, .intro p { display: none !important; }
  .print-only { display: block; }
  .print-brand { margin: 0 0 2mm; padding-bottom: 2mm; border-bottom: .6pt solid #4a3f99; font: 600 8.5pt "DM Sans", sans-serif; letter-spacing: .12em; text-transform: uppercase; color: #4a3f99; }
  .print-brand b { text-transform: none; letter-spacing: 0; font-size: 10pt; }
  .print-made { margin-top: 8mm; padding-top: 3mm; border-top: .6pt solid #d9dbe6; font-size: 9pt; color: #555; }
  .wrap { max-width: none; padding: 0; }
  .row, .daycard, .week { break-inside: avoid; box-shadow: none; }
  details.finished-list { display: block; }
  .listview[hidden] { display: block !important; }   /* (printed from the calendar, the list still prints) */
  .wrap .topadd { justify-content: flex-start; margin-top: 0; }   /* (the title at the left, not where the buttons were) */
  .bar i, .wb i, .dc-ic { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Taking back: Undo just after a count, on its row or card; Take one back on a completed row */
.undo-btn { flex: 0 0 auto; min-height: 44px; padding: 0 12px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--card); color: var(--accent);
  font: 700 15px "DM Sans", sans-serif; cursor: pointer; }
.row.finished .undo-btn { background: transparent; border-color: color-mix(in srgb, var(--done) 40%, transparent); color: var(--done); }
.dc-btns { display: flex; gap: 8px; margin-top: 14px; }
.dc-btns .btn { margin: 0; }
.dc-btns .undo-btn { min-height: 50px; padding: 0 18px; }
.center { text-align: center; }
.panel h3 small { font-weight: 500; font-size: 14px; margin-left: 6px; }
/* Did one and Take one back, side by side on an item's page */
.pair { display: flex; gap: 10px; margin: 0 0 12px; }
.pair .btn { flex: 1 1 0; padding: 0 12px; }

/* The list's top: + Add on the right (the first heading follows) */
.topadd { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin: 16px 0 -6px; }
.btn.add-top svg { width: 18px; height: 18px; margin-right: 4px; }
.btn.add-top { min-height: 44px; padding: 0 18px; border-radius: 99px; font-size: 16px; color: var(--accent); }
.topadd + h2.sec { margin-top: 0; }
/* Working out from years: shown first, open */
.open-helper { margin: 0 0 12px; }
.open-helper .hrow { margin-top: 0; font-size: 17px; }
/* Did 2 / 5 / 10, counted at once */
.several { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 12px; }
.several span { color: var(--ink-2); font-weight: 600; margin-right: 2px; }
.several button { min-height: 44px; padding: 0 16px; border-radius: 99px; border: 1.5px solid var(--line); background: var(--card); font-weight: 700; cursor: pointer; }
.several button:hover { border-color: var(--accent); }
.note { margin: 0 0 12px; padding: 12px 14px; border-radius: 14px; background: color-mix(in srgb, var(--warn) 14%, var(--card)); border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); font-size: 15.5px; }
details.more { margin-top: 6px; }
details.more > summary { font-weight: 600; color: var(--ink-2); }
details.more[open] > summary { margin-bottom: 8px; }
details.more .panel { margin: 0 0 14px; padding: 0; border: 0; background: none; }
details.more h3 { margin: 6px 0 4px; font-size: 16px; }
details.more .danger-zone { margin: 20px 0 4px; text-align: left; }
.tog small { display: block; font-size: 14px; }
/* The empty list's badge */
.empty .e-ic { display: grid; place-items: center; width: 52px; height: 52px; margin: 0 auto 12px; border-radius: 16px; background: var(--accent-soft); color: var(--accent); }
.empty .e-ic svg { width: 28px; height: 28px; }

/* The whole Qurʾān: the thirty ajzāʾ of the khatm under way */
.juz { margin: 6px 0 14px; }
.jgrid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin-bottom: 12px; }
.jz { min-height: 48px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--card); font: 700 16px "DM Sans", sans-serif; cursor: pointer; color: var(--ink); }
.jz:hover { border-color: var(--accent); }
.jz.on { background: var(--accent); border-color: var(--accent); color: var(--card); }

/* Put it in Dawām: Dawām's own colour and icon, Add, and Open Dawām beside it */
.dawam-card { display: flex; align-items: center; gap: 12px; margin: 0 0 14px; padding: 12px 14px; border-radius: 16px;
  border: 1px solid color-mix(in srgb, #995845 35%, var(--line)); background: linear-gradient(150deg, color-mix(in srgb, #995845 12%, var(--card)), var(--card) 80%); }
.dw-ic { flex: 0 0 auto; width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: #995845; color: #fff; }
.dw-ic svg { width: 24px; height: 24px; }
.dw-t { flex: 1; min-width: 0; }
.dw-t b { display: block; font-size: 16px; }
.dw-t small { display: block; color: var(--ink-2); font-size: 14px; line-height: 1.35; }
.dw-b { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.btn.dw-add { min-height: 40px; padding: 0 16px; font-size: 15px; border-color: #995845; color: #995845; }
:root[data-theme="dark"] .btn.dw-add, :root[data-theme="dark"] .dw-open { color: #e3a465; border-color: #e3a465; }
.dw-open { font-weight: 600; font-size: 14.5px; color: #995845; text-decoration: none; white-space: nowrap; }
.dw-open:hover { text-decoration: underline; }
@media print { .dawam-card { display: none; } }
.khatm-b { display: flex; flex-wrap: wrap; gap: 8px; }

/* Change the order: each with ↑ and ↓ */
.order { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.order li { display: flex; align-items: center; gap: 8px; padding: 8px 10px 8px 14px; border: 1.5px solid var(--line); border-radius: 14px; background: var(--card); }
.order li span { flex: 1; min-width: 0; font-weight: 600; }
.order .ord { min-width: 48px; min-height: 44px; padding: 0; font-size: 20px; }
.order .ord:disabled { opacity: .3; }
.center { text-align: center; }
.order li span small { display: inline-block; min-width: 1.6em; color: var(--ink-2); font-weight: 600; }
/* the one just moved, lit for a moment */
.order li.moved { animation: moved 1.4s ease-out; border-color: var(--accent); }
@keyframes moved { from { background: color-mix(in srgb, var(--accent) 22%, var(--card)); transform: scale(1.02); } to { background: var(--card); transform: none; } }
@media (prefers-reduced-motion: reduce) { .order li.moved { animation: none; background: color-mix(in srgb, var(--accent) 12%, var(--card)); } }
.ord-msg { min-height: 1.4em; margin: 0 2px 4px; color: var(--accent); font-weight: 600; }

/* The guide: a card a newcomer can see, not a link at the foot */
.guide-card { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 10px; width: 100%; min-height: 56px; padding: 12px 14px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); color: var(--ink) !important; text-decoration: none !important; }
.guide-card b { font-size: 16px; } .guide-card small { grid-column: 1; color: var(--ink-2); font-size: 14px; } .guide-card span { grid-row: 1 / span 2; grid-column: 2; color: var(--accent); font-size: 22px; }

/* Days in a row: how far the run under way has come */
.runask { margin: 8px 0 18px; padding: 14px; border-radius: 14px; background: var(--accent-soft); }
.runask p { margin: 0 0 2px; }
.runask .tog { margin-top: 8px; min-height: 44px; }
.runask #runsave { margin-top: 6px; width: 100%; }
.runline { margin: -4px 2px 12px; color: var(--accent); font-size: 16px; }

/* An on/off switch (a checkbox with role="switch"): the words on the left, the switch on the right, the whole row to tap */
.tog.sw { justify-content: space-between; gap: 14px; min-height: 56px; }
.tog.sw > span { flex: 1; min-width: 0; }
.tog.sw > span b { display: block; font-size: 16px; }
.tog.sw input[role="switch"] { -webkit-appearance: none; appearance: none; position: relative; flex: 0 0 auto; width: 52px; height: 32px; margin: 0;
  border-radius: 999px; background: color-mix(in srgb, var(--ink-2) 38%, var(--card)); cursor: pointer; transition: background .18s ease-out; }
.tog.sw input[role="switch"]::before { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .18s cubic-bezier(.25, 1, .5, 1); }
.tog.sw input[role="switch"]:checked { background: var(--accent); }
.tog.sw input[role="switch"]:checked::before { transform: translateX(20px); }
.tog.sw input[role="switch"]:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .tog.sw input[role="switch"], .tog.sw input[role="switch"]::before { transition: none; } }

/* The calendar (app.js calendarHtml): a month of days, each done day lit with a tick (one item) or how many (the whole
   list); a day tapped opens under the month. Laid out as the Calendar app's month. */
.cal { margin: 22px 0 8px; }
.cal .mhead { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; align-items: center; gap: 2px 8px; margin: 4px 0 2px; }
.cal .nav { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); color: var(--ink); display: grid; place-items: center; padding: 0; cursor: pointer; }
.cal .nav svg { width: 20px; height: 20px; }
.cal .nav:disabled { opacity: .35; cursor: default; }
.cal .mtitle { text-align: center; font: 600 20px/1.2 "Noto Serif", "Fraunces", Georgia, serif; }
/* the Hijri months, under the month and its arrows, the full width */
.cal .mhij { grid-column: 1 / -1; text-align: center; color: var(--ink-2); font-size: 14px; line-height: 1.35; }
.cal .nw { white-space: nowrap; }
.cal-today { margin: 2px 0 0; text-align: center; }
.cal-today .link { min-height: 44px; }
.cgrid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin: 10px 0 10px; container-type: inline-size; }
.cgrid .wd { text-align: center; color: var(--ink-2); font: 600 13px "DM Sans", sans-serif; }
.cgrid .wd .s { display: none; }
/* too narrow for Sun, Mon… (a small phone, or the largest text): S, M… */
@container (max-width: 300px) { .cgrid .wd .l { display: none; } .cgrid .wd .s { display: inline; } }
.cgrid .d { display: grid; justify-items: center; align-content: center; gap: 1px; min-height: 50px; padding: 3px 0; border-radius: 10px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink); font: 600 16px/1.1 "DM Sans", sans-serif; font-variant-numeric: tabular-nums; cursor: pointer; }
/* (the tick and ×n a shade deeper than the green, for contrast on its tint) */
.cgrid .d svg { width: 16px; height: 16px; color: color-mix(in srgb, var(--done) 82%, var(--ink)); }
.cgrid .d .k { font-size: 13px; font-weight: 700; color: color-mix(in srgb, var(--done) 82%, var(--ink)); }
.cgrid .d.on { background: var(--done-bg); border-color: color-mix(in srgb, var(--done) 45%, var(--line)); }
/* today: its date in a filled circle; the day open: an outline (the two never alike) */
.cgrid .d .dn { display: grid; place-items: center; min-width: 26px; height: 26px; border-radius: 13px; }
.cgrid .d.today .dn { background: var(--accent); color: var(--card); }
.cgrid .d.picked { outline: 3px solid var(--accent); outline-offset: 1px; }
.cgrid .d.part { border-color: color-mix(in srgb, var(--done) 45%, var(--line)); border-style: dashed; }
.cgrid .d.before:not(.on) { color: var(--ink-2); background: transparent; }
.cgrid .d.later { color: var(--ink-2); opacity: .75; background: transparent; border-color: transparent; cursor: default; }
.cgrid .d:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px; }
.calnote { margin: 0 2px 6px; color: var(--ink-2); font-size: 15px; }
/* The day open: each thing owed with how many that day (− n +), or for a fast, Mark fasted / Fasted */
.calday { container-type: inline-size; margin: 4px 0 10px; padding: 14px 16px 8px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); }
.calday h3 { margin: 0 0 6px; font: 600 19px/1.25 "Noto Serif", "Fraunces", Georgia, serif; }
.calday h3 small { display: block; margin-top: 2px; font: 500 14px "DM Sans", sans-serif; color: var(--ink-2); }
.calday .srow { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.calday .srow > b { grid-column: 1; font-size: 17px; line-height: 1.25; }
.calday .srow > .sub { grid-column: 1; color: var(--ink-2); font-size: 14px; line-height: 1.3; }
.calday .srow > .step, .calday .srow > .tick { grid-column: 2; grid-row: 1 / span 2; }
.calday .step { display: flex; align-items: center; gap: 4px; }
.calday .step button { width: 46px; height: 46px; border-radius: 50%; border: 1.5px solid var(--line); background: var(--card); color: var(--ink); font: 600 24px/1 "DM Sans", sans-serif; padding: 0; cursor: pointer; }
.calday .step button:disabled { opacity: .35; cursor: default; }
.calday .step b { min-width: 30px; text-align: center; font-size: 20px; font-variant-numeric: tabular-nums; }
.calday .tick { min-height: 46px; padding: 0 14px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--card); color: var(--ink);
  font: 600 16px "DM Sans", sans-serif; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.calday .tick svg { width: 18px; height: 18px; }
.calday .tick.on { background: var(--done); border-color: var(--done); color: var(--card); }
.calday .tick:disabled { opacity: .45; cursor: default; }
.calday > .link { min-height: 44px; margin-top: 2px; }
/* too narrow for the name and its buttons side by side (a small phone at the largest text): the buttons under the name */
@container (max-width: 280px) {
  .calday .srow { grid-template-columns: minmax(0, 1fr); row-gap: 6px; }
  .calday .srow > .step, .calday .srow > .tick { grid-column: 1; grid-row: auto; justify-self: start; }
}
.had { display: grid; gap: 6px; }
.had input { width: 120px; min-height: 52px; text-align: center; font: 700 22px "DM Sans", sans-serif; border-radius: 14px; border: 1.5px solid var(--line); background: var(--card); color: var(--ink); }
