/* Always light. Apple HIG look: grouped background, inset grouped lists, system font and colors. */
:root {
  --bg: #F2F2F7; --card: #FFFFFF; --label: #000000;
  --secondary: rgba(60,60,67,.6); --tertiary: rgba(60,60,67,.3); --sep: rgba(60,60,67,.18);
  --fill: rgba(120,120,128,.12); --fill2: rgba(120,120,128,.2);
  --blue: #007AFF; --green: #34C759; --orange: #FF9500; --red: #FF3B30;
  --green-tint: rgba(52,199,89,.16); --orange-tint: rgba(255,149,0,.16); --red-tint: rgba(255,59,48,.12);
  --bar: rgba(242,242,247,.85);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", Inter, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--label); font-family: var(--font);
  font-size: 17px; line-height: 1.35; -webkit-text-size-adjust: 100%; }
main { max-width: 640px; margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-top: calc(env(safe-area-inset-top, 0px) + 28px);
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 32px); }

.eyebrow { margin: 0; font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--secondary); }
h1 { margin: 2px 0 6px; font-size: 34px; line-height: 1.15; font-weight: 700; letter-spacing: -.02em; text-wrap: balance; }
.lede { margin: 0 0 18px; color: var(--secondary); }
section { margin-top: 28px; }
h2 { margin: 0 0 7px 16px; font-size: 13px; font-weight: 400; text-transform: uppercase; letter-spacing: .02em; color: var(--secondary); }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 2px; gap: 2px; background: var(--fill); border-radius: 9px; }
.seg button { border: 0; background: transparent; color: var(--label); font: 500 13px var(--font); padding: 7px 4px; border-radius: 7px; cursor: pointer; }
.seg button[aria-selected="true"] { background: var(--card); font-weight: 600; box-shadow: 0 3px 8px rgba(0,0,0,.12), 0 1px 1px rgba(0,0,0,.04); }

.group { background: var(--card); border-radius: 10px; overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 16px; position: relative; }
.row + .row::before, .row + .detail::before, .detail + .row::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; height: .5px; background: var(--sep); }
.row > .key { flex: 0 0 auto; min-width: 96px; }
.row > .val { margin-left: auto; color: var(--secondary); text-align: right; }
select, input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--label); font: 17px var(--font); padding: 11px 0; outline: none; }
select { -webkit-appearance: none; appearance: none; cursor: pointer; }
input { text-align: right; }
input::placeholder { color: var(--tertiary); }
.row:focus-within { background: var(--fill); }

.note { margin: 8px 16px 0; font-size: 13px; color: var(--secondary); }
.card-note { background: var(--card); border-radius: 10px; padding: 12px 16px; margin: 10px 0 0; font-size: 15px; }
.error { margin: 16px 16px 0; color: var(--red); font-size: 15px; }

.times { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 8px; }
.times button { min-height: 44px; border: 0; border-radius: 10px; background: var(--fill); color: var(--blue);
  font: 500 17px var(--font); font-variant-numeric: tabular-nums; cursor: pointer; padding: 4px; }
.times button[aria-pressed="true"] { background: var(--blue); color: #fff; }
.day { padding: 12px 16px 16px; position: relative; }
.day + .day { border-top: .5px solid var(--sep); }
.day-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.day-head strong { font-weight: 600; }
.day-head span { font-size: 15px; color: var(--secondary); }

button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.primary { display: flex; align-items: center; justify-content: center; width: 100%; height: 50px; border: 0; border-radius: 14px;
  background: var(--blue); color: #fff; font: 600 17px var(--font); cursor: pointer; text-decoration: none; }
.primary:disabled, .primary[aria-disabled="true"] { opacity: .35; cursor: default; pointer-events: none; }
.tinted { border: 0; border-radius: 10px; background: var(--fill); color: var(--blue); font: 600 15px var(--font);
  padding: 10px 14px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.tinted.danger { color: var(--red); background: var(--red-tint); }
.tinted.wa { background: #25D366; color: #fff; }
.tinted[aria-disabled="true"] { opacity: .4; pointer-events: none; }
.plain { border: 0; background: none; color: var(--blue); font: 17px var(--font); padding: 12px; cursor: pointer; }
.bar { position: sticky; bottom: 0; margin: 24px calc(-1 * max(16px, env(safe-area-inset-left, 0px))) 0;
  padding: 12px max(16px, env(safe-area-inset-left, 0px)) calc(12px + env(safe-area-inset-bottom, 0px));
  background: var(--bar); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); }

.pill { display: inline-block; font-size: 13px; font-weight: 600; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.pill.green { background: var(--green-tint); color: var(--green); }
.pill.orange { background: var(--orange-tint); color: var(--orange); }
.pill.red { background: var(--red-tint); color: var(--red); }
.pill.gray { background: var(--fill); color: var(--secondary); }

/* iOS switch */
.switch { position: relative; width: 51px; height: 31px; flex: 0 0 auto; margin-left: auto; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--fill2); transition: background .2s; }
.switch span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%;
  background: #fff; box-shadow: 0 3px 8px rgba(0,0,0,.15), 0 1px 1px rgba(0,0,0,.16); transition: transform .2s; }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 3px solid var(--blue); outline-offset: 2px; }

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  background: var(--label); color: var(--bg); font-size: 15px; font-weight: 500; padding: 10px 18px; border-radius: 999px; z-index: 20;
  box-shadow: 0 8px 24px rgba(0,0,0,.2); max-width: calc(100% - 32px); text-align: center; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
