/* Minarem. Three kinds of surface, so nothing looks like anything else:
   the navy hero (what is next), white cards on a tinted ground (things to read or set),
   and the tab bar (where you are). Colours come from the logo. */
:root {
  --ground: #eef1f5;
  --card: #ffffff;
  --field: #f6f8fa;
  --ink: #0f2138;
  --soft: #51627a;
  --faint: #8794a6;
  --line: #e4e9ef;
  --navy: #0c2a55;
  --hero-a: #0c2a55;
  --hero-b: #1a4a86;
  --hero-ink: #f5f8fc;
  --hero-soft: #b3c6e2;
  --teal: #0f7f8d;
  --teal-wash: #e4f3f4;
  --red: #b5222b;
  --gold: #e2bd6b;
  --ok: #1d7a4c;
  --warn: #8f5d00;
  --bad: #b5222b;
  --shadow: 0 1px 2px rgba(15, 33, 56, 0.06), 0 8px 24px rgba(15, 33, 56, 0.05);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --tabbar: 62px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ground: #070f1b;
    --card: #101d30;
    --field: #0b1626;
    --ink: #e9eef4;
    --soft: #a9b6c6;
    --faint: #74839a;
    --line: #1f3048;
    --navy: #dbe6f5;
    --hero-a: #143a78;
    --hero-b: #0e2650;
    --hero-ink: #f5f8fc;
    --hero-soft: #a9bfe0;
    --teal: #5fc4cf;
    --teal-wash: #0f2a3a;
    --red: #f07a78;
    --gold: #e2bd6b;
    --ok: #74cf9a;
    --warn: #e3b765;
    --bad: #f07a78;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
body { margin: 0; background: var(--ground); color: var(--ink); font: 16px/1.5 var(--sans); padding-bottom: 120px; }
.wrap { max-width: 680px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
h1, h2, p { margin: 0; }
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; border-radius: 6px; }
main { display: grid; gap: 22px; padding-top: 18px; }

/* Header: the name, and nothing that competes with it */
.top { background: var(--card); border-bottom: 1px solid var(--line); }
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 56px; }
.brand { font-family: var(--serif); font-size: 1.25rem; color: var(--navy); text-decoration: none; display: inline-flex; align-items: center; gap: 9px; }
.brand img { display: block; width: 30px; height: 30px; }
.langs { display: inline-flex; background: var(--ground); border-radius: 999px; padding: 3px; }
.langs button { background: none; border: 0; border-radius: 999px; min-width: 38px; min-height: 30px; padding: 0 8px; font-size: 0.78rem; font-weight: 600; letter-spacing: 0.04em; color: var(--faint); }
.langs button[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(15, 33, 56, 0.15); }
@media (prefers-color-scheme: dark) { .brand img, .hero-logo { background: #fcfbf8; border-radius: 22%; padding: 3px; box-sizing: content-box; } }

/* Tabs: a bar at the bottom on a phone, pills in the header on a wide screen */
.tabs { display: flex; }
.tabs button { background: none; border: 0; display: flex; align-items: center; justify-content: center; gap: 7px; color: var(--faint); font-weight: 600; }
.tabs svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.tabs button[aria-current="page"] { color: var(--teal); }
@media (max-width: 719px) {
  .tabs { position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); box-shadow: 0 -6px 20px rgba(15, 33, 56, 0.06); }
  .tabs button { flex: 1; flex-direction: column; gap: 3px; height: var(--tabbar); font-size: 0.72rem; letter-spacing: 0.02em; }
  .tabs button[aria-current="page"] svg { stroke-width: 2.1; }
}
@media (min-width: 720px) {
  .tabs { gap: 4px; }
  .tabs button { padding: 8px 16px; border-radius: 999px; font-size: 0.94rem; }
  .tabs button:hover { color: var(--ink); }
  .tabs button[aria-current="page"] { background: var(--teal-wash); }
  .tabs svg { width: 18px; height: 18px; }
}

.loading { padding: 80px 0; text-align: center; color: var(--faint); }

/* The hero: the one dark block on the page */
.hero { background: linear-gradient(150deg, var(--hero-a), var(--hero-b)); color: var(--hero-ink); border-radius: 20px; padding: 22px 22px 20px; display: grid; gap: 4px; }
.hero-where { font-size: 0.86rem; color: var(--hero-soft); display: flex; flex-wrap: wrap; gap: 2px 10px; font-weight: 600; }
.hero-where span { font-weight: 400; }
.hero-main { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; margin-top: 14px; font-family: var(--serif); line-height: 1; }
.hero-name { font-family: var(--serif); font-size: clamp(2.3rem, 10vw, 3.1rem); letter-spacing: -0.015em; }
.hero-time { font-size: clamp(2.3rem, 10vw, 3.1rem); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.hero-in { color: var(--gold); font-weight: 600; margin-top: 8px; min-height: 1.5em; }
.hero-status { margin-top: 14px; padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, 0.16); font-size: 0.9rem; color: var(--hero-soft); display: flex; gap: 9px; align-items: baseline; }
.hero-status::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--hero-soft); transform: translateY(-1px); }
.hero-status.ok::before { background: #6fd39b; }
.hero-status.warn { color: #ffd88a; }
.hero-status.warn::before { background: #ffc24d; }
.hero-status.bad { color: #ffb1ad; }
.hero-status.bad::before { background: #ff7b75; }
.hero .btn { margin-top: 12px; }

/* Landing */
.hero.landing { gap: 12px; padding: 30px 24px; }
.hero.landing h1 { font-family: var(--serif); font-weight: 500; font-size: clamp(1.9rem, 7vw, 2.5rem); line-height: 1.12; color: var(--hero-ink); text-wrap: balance; }
.hero-logo { display: block; width: 72px; height: 72px; background: #fcfbf8; border-radius: 22%; padding: 4px; box-sizing: content-box; }
.hero .lead { color: var(--hero-soft); font-size: 1.05rem; }
.hero .fine { color: var(--hero-soft); font-size: 0.84rem; }
.hero .msg { color: #ffd88a; background: none; box-shadow: none; border: 0; padding: 0; }

/* Groups: a small label, then one card */
.group { display: grid; gap: 8px; min-width: 0; }
.group-title { font: 600 0.76rem/1.2 var(--sans); letter-spacing: 0.09em; text-transform: uppercase; color: var(--faint); padding: 0 6px; }
.group-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card { background: var(--card); border-radius: 16px; padding: 16px; box-shadow: var(--shadow); min-width: 0; }
.card.rows, .card.more { padding: 4px 16px; }

/* Today's list */
.row { display: grid; grid-template-columns: 4.4rem 1fr auto; column-gap: 12px; align-items: center; min-height: 56px; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; }
.row .at { font-size: 1.2rem; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.row .what { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .state { font-size: 0.84rem; color: var(--faint); white-space: nowrap; }
.row.past .at, .row.past .what { color: var(--faint); font-weight: 500; }
.row.extra { min-height: 44px; }
.row.extra .at { font-size: 0.95rem; font-weight: 500; color: var(--soft); }
.row.extra .what { font-weight: 400; font-size: 0.94rem; color: var(--soft); }
.row.off .at, .row.off .what { color: var(--faint); font-weight: 400; }
.row.is-next { margin: 0 -16px; padding: 0 16px; background: var(--teal-wash); box-shadow: inset 4px 0 0 var(--teal); border-top-color: transparent; }
.row.is-next + .row { border-top-color: transparent; }
.row.is-next .at, .row.is-next .what { color: var(--teal); }
.st::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: currentColor; margin-right: 6px; vertical-align: 1px; }
.st.played { color: var(--ok); }
.st.sent { color: var(--warn); }
.st.missed, .st.failed { color: var(--bad); }

/* Each prayer, opened to change it */
.card:has(> .erow) { padding: 4px 16px; }
.erow { border-top: 1px solid var(--line); }
.erow:first-child { border-top: 0; }
.rowhead { display: grid; grid-template-columns: 5rem 1fr 14px; column-gap: 12px; align-items: center; width: 100%; min-height: 54px; padding: 0; background: none; border: 0; text-align: left; }
.rowhead b { font-weight: 600; }
.rowhead .sum { color: var(--soft); font-size: 0.9rem; text-align: right; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.erow.off .sum { color: var(--faint); }
.chev { width: 8px; height: 8px; border-right: 1.7px solid var(--faint); border-bottom: 1.7px solid var(--faint); transform: translateY(-2px) rotate(45deg); justify-self: center; transition: transform 0.15s; }
.erow.open .chev { transform: translateY(2px) rotate(-135deg); }
.erow.open .rowhead b { color: var(--teal); }
.edit { display: grid; gap: 14px; padding: 6px 0 18px; }

/* Fields: a plain label, then the control */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 14px; }
@media (max-width: 560px) { .grid { grid-template-columns: 1fr; } }
.field { display: grid; gap: 6px; align-content: start; min-width: 0; }
.field > span { font-size: 0.88rem; color: var(--soft); }
select, input[type="search"] { width: 100%; min-height: 46px; padding: 9px 12px; background: var(--field); border: 1px solid var(--line); border-radius: 10px; color: var(--ink); }
select { appearance: none; -webkit-appearance: none; padding-right: 34px; text-overflow: ellipsis; font-weight: 500;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%238794a6' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; }
select:hover, input[type="search"]:hover { border-color: var(--teal); }
.err { color: var(--bad); font-size: 0.9rem; margin-top: 6px; }

/* Buttons: red is the one thing to press; everything else is quiet */
.btn { border: 1px solid var(--red); background: var(--red); color: #fff; border-radius: 10px; padding: 12px 22px; font-weight: 600; min-height: 48px; }
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.quiet { background: var(--card); color: var(--ink); border-color: var(--line); font-weight: 500; }
.btn.quiet:hover { border-color: var(--teal); color: var(--teal); filter: none; }
.btn.small { padding: 8px 14px; min-height: 44px; font-size: 0.94rem; }
@media (prefers-color-scheme: dark) { .btn:not(.quiet) { background: #c9363d; border-color: #c9363d; } }
.textbtn { background: none; border: 0; padding: 0 2px; min-height: 44px; color: var(--teal); font-weight: 600; font-size: 0.92rem; }
.pick { display: flex; gap: 10px; align-items: center; }
.pick select { flex: 1; min-width: 0; }
.listen { flex: none; background: var(--teal-wash); border: 0; border-radius: 10px; min-height: 46px; min-width: 76px; padding: 0 14px; color: var(--teal); font-weight: 600; font-size: 0.92rem; white-space: nowrap; }
.listen.on { background: var(--red); color: #fff; }

/* Location */
.loc { display: grid; gap: 12px; }
.locrow { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.locname { flex: 1 1 100%; font-family: var(--serif); font-weight: 500; font-size: 1.35rem; line-height: 1.2; color: var(--navy); }
.locrow .btn { flex: 1 1 auto; }
.addr { display: flex; gap: 10px; align-items: stretch; }
.addr input { flex: 1 1 auto; min-width: 0; }
.addr .btn { flex: 0 0 auto; white-space: nowrap; }
.results { list-style: none; margin: 0; padding: 0; }
.results:empty { display: none; }
.results button { display: block; width: 100%; text-align: left; background: none; border: 0; border-top: 1px solid var(--line); padding: 13px 2px; }
.results button:hover:not(:disabled) { color: var(--teal); }
.results button:disabled { color: var(--faint); cursor: default; }

/* Switch lists */
.list { display: grid; }
.item { padding: 13px 0; border-top: 1px solid var(--line); }
.item:first-child { border-top: 0; padding-top: 2px; }
.item:last-child { padding-bottom: 2px; }
.sw { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: center; min-height: 44px; }
.sw b { font-weight: 600; }
.desc { color: var(--soft); font-size: 0.88rem; margin-top: 1px; }
.item.soon b, .item.soon .desc { color: var(--faint); }
.soon-tag { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); background: var(--ground); border-radius: 999px; padding: 4px 10px; }
.whenrow { margin-top: 10px; }
.switch { position: relative; width: 52px; height: 32px; flex: none; }
.switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.switch i { position: absolute; inset: 0; border-radius: 999px; background: var(--line); transition: background 0.15s; pointer-events: none; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); transition: transform 0.15s; }
.switch input:checked + i { background: var(--teal); }
.switch input:checked + i::after { transform: translateX(20px); }
.switch input:focus-visible + i { outline: 2px solid var(--teal); outline-offset: 3px; }

.adjusts { margin-top: 6px; }
.adjust { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); }
.adjust:first-child { border-top: 0; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; background: var(--field); }
.stepper button { width: 46px; height: 44px; border: 0; background: none; font-size: 1.25rem; color: var(--teal); }
.stepper output { min-width: 64px; text-align: center; font-variant-numeric: tabular-nums; font-weight: 600; font-size: 0.94rem; }
.h3 { font-weight: 600; margin: 22px 0 4px; }

/* Alexa routine */
.seg { display: inline-flex; background: var(--card); border-radius: 999px; padding: 3px; box-shadow: var(--shadow); }
.seg button { background: none; border: 0; border-radius: 999px; padding: 6px 12px; min-height: 32px; font-size: 0.8rem; font-weight: 600; color: var(--faint); }
.seg button[aria-pressed="true"] { background: var(--navy); color: var(--card); }
.recipe { list-style: none; margin: 0 0 4px; padding: 0; display: grid; gap: 10px; counter-reset: r; }
.recipe li { counter-increment: r; display: grid; grid-template-columns: 26px 1fr; gap: 10px; align-items: baseline; }
.recipe li::before { content: counter(r); width: 26px; height: 26px; border-radius: 50%; background: var(--navy); color: var(--card); font-size: 0.8rem; font-weight: 700; display: grid; place-items: center; }
code { font: 0.92em/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--teal-wash); color: var(--teal); padding: 10px 12px; border-radius: 8px; overflow-wrap: anywhere; }
.phraselist { display: grid; margin: 12px 0; }
.phrase { display: grid; grid-template-columns: 1fr auto; column-gap: 12px; align-items: center; padding: 4px 0 12px; }
.phrase span { grid-column: 1; grid-row: 1; font-weight: 600; font-size: 0.92rem; }
.phrase .textbtn { grid-column: 2; grid-row: 1; justify-self: end; }
.phrase code { grid-column: 1 / -1; grid-row: 2; }
.sub { color: var(--soft); font-size: 0.9rem; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; counter-reset: s; }
.steps > li { counter-increment: s; display: grid; grid-template-columns: 26px 1fr; gap: 12px; align-items: baseline; }
.steps > li::before { content: counter(s); width: 26px; height: 26px; border-radius: 50%; background: var(--teal-wash); color: var(--teal); font-size: 0.8rem; font-weight: 700; display: grid; place-items: center; }

/* Folded groups */
.fold { border-top: 1px solid var(--line); margin-top: 14px; }
.more .fold { margin: 0; }
.more .fold:first-child { border-top: 0; }
.fold > summary { display: grid; grid-template-columns: 1fr auto 14px; column-gap: 12px; align-items: center; min-height: 52px; cursor: pointer; list-style: none; }
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary::after { content: ""; grid-column: 3; width: 8px; height: 8px; border-right: 1.7px solid var(--faint); border-bottom: 1.7px solid var(--faint); transform: translateY(-2px) rotate(45deg); justify-self: center; transition: transform 0.15s; }
.fold[open] > summary::after { transform: translateY(2px) rotate(-135deg); }
.ft { font-weight: 600; }
.fh { color: var(--faint); font-size: 0.88rem; font-variant-numeric: tabular-nums; }
.fb { padding: 2px 0 18px; }
.card > .fold:last-child .fb { padding-bottom: 6px; }
.log { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.log td { padding: 9px 0; border-top: 1px solid var(--line); vertical-align: baseline; }
.log tr:first-child td { border-top: 0; padding-top: 0; }
.log td:nth-child(2) { color: var(--faint); font-variant-numeric: tabular-nums; white-space: nowrap; padding-left: 10px; padding-right: 10px; }
.log td:last-child { text-align: right; white-space: nowrap; }
.none { color: var(--faint); }

/* Messages */
.todo, .msg { background: var(--card); border-radius: 14px; padding: 14px 16px; box-shadow: var(--shadow); border-left: 4px solid var(--line); }
.todo { border-color: var(--warn); display: grid; gap: 8px; }
.todo span { color: var(--soft); font-size: 0.92rem; }
.mini { margin: 0; padding-left: 1.3em; color: var(--soft); font-size: 0.92rem; display: grid; gap: 4px; }
.msg { font-weight: 600; font-size: 0.95rem; }
.msg.ok { border-color: var(--ok); color: var(--ok); }
.msg.warn { border-color: var(--warn); color: var(--warn); }
.msg.bad { border-color: var(--bad); color: var(--bad); }

/* Save bar: sits above the tab bar on a phone */
.savebar { position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; background: var(--hero-a); color: var(--hero-ink); padding: 10px 0 calc(10px + env(safe-area-inset-bottom)); }
.savebar-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.savebar-row > div { display: flex; gap: 8px; flex: none; }
#savemsg { font-size: 0.88rem; line-height: 1.3; min-width: 0; }
.savebar .btn.quiet { background: none; color: inherit; border-color: rgba(255, 255, 255, 0.35); }
.savebar .btn.quiet:hover { color: inherit; border-color: #fff; }
@media (max-width: 719px) {
  body.signed { padding-bottom: calc(var(--tabbar) + 110px + env(safe-area-inset-bottom)); }
  body.signed .savebar { bottom: calc(var(--tabbar) + env(safe-area-inset-bottom)); padding-bottom: 10px; }
}

.out { display: flex; justify-content: center; }
.foot { color: var(--faint); font-size: 0.82rem; text-align: center; }
.foot a { color: inherit; display: inline-block; padding: 10px 0; }
.eyebrow { color: var(--faint); font-size: 0.8rem; letter-spacing: 0.09em; text-transform: uppercase; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
