/* Public inner pages (planner, schedule, privacy). Builds on site.css variables; logical properties for RTL. */
body.app {
  display: block;
  text-align: start;
  align-items: initial;
  justify-content: initial;
  overscroll-behavior: auto;
  padding: calc(max(12px, env(safe-area-inset-top)) + 56px) max(16px, env(safe-area-inset-right)) calc(max(24px, env(safe-area-inset-bottom)) + 24px) max(16px, env(safe-area-inset-left));
}
:root { --card: rgba(35, 31, 32, 0.035); --line: rgba(35, 31, 32, 0.14); --ok: #2f7d4f; --warn: #a8641d; --bad: #b3372f; --gold-ink: #fff; }
:root[data-theme="dark"] { --card: rgba(255, 255, 255, 0.05); --line: rgba(255, 255, 255, 0.16); --ok: #5fc08a; --warn: #e0a152; --bad: #ef7a72; --gold-ink: #17120a; }

.topbar { position: fixed; top: max(12px, env(safe-area-inset-top)); left: max(12px, env(safe-area-inset-left)); z-index: 10; direction: ltr; }
.backlink { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 14px; border-radius: 999px; color: var(--ink); text-decoration: none; font-size: .85rem; font-weight: 500; }
.backlink svg { width: 16px; height: 16px; }

.wrap { width: 100%; max-width: 560px; margin-inline: auto; }
.wrap.wide { max-width: 860px; }
.wrap h1 { font-size: clamp(1.4rem, 5vw, 1.9rem); font-weight: 400; line-height: 1.25; margin-bottom: 8px; text-wrap: balance; }
html[lang="ar"] .wrap h1 { font-weight: 500; }
.lead { color: var(--muted); font-size: .95rem; margin-bottom: 22px; }
.rule-sm { width: 44px; height: 1px; background: var(--gold); margin: 14px 0 18px; }

/* steps */
.steps { display: flex; gap: 6px; margin: 14px 0 24px; list-style: none; }
.steps li { flex: 1; height: 4px; border-radius: 4px; background: var(--line); }
.steps li.on { background: var(--gold); }
.steplabel { font-size: .8rem; color: var(--gold-text); font-weight: 500; letter-spacing: .06em; text-transform: uppercase; margin-top: -14px; margin-bottom: 18px; }
html[lang="ar"] .steplabel { text-transform: none; letter-spacing: 0; font-size: .9rem; }

/* form */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field > label, .legend { font-size: .85rem; font-weight: 500; }
.hint { font-size: .78rem; color: var(--muted); }
input[type="text"], input[type="tel"], input[type="email"], input[type="date"], input[type="number"], input[type="password"], input[type="search"], select, textarea {
  width: 100%; min-height: 48px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--ink);
  font: inherit; font-size: 16px; font-weight: 400; -webkit-appearance: none; appearance: none;
}
select { background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%); background-position: calc(100% - 20px) 21px, calc(100% - 15px) 21px; background-size: 5px 5px; background-repeat: no-repeat; padding-inline-end: 38px; }
html[dir="rtl"] select { background-position: 20px 21px, 15px 21px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
input.bad, select.bad { border-color: var(--bad); }
.err { color: var(--bad); font-size: .82rem; }
input[dir="ltr"], .ltr { direction: ltr; text-align: start; }
html[dir="rtl"] input[type="date"] { text-align: end; }
/* phone and email stay left-aligned (they are written left to right) so a tap beside the text puts the caret at the end, not before "+961" */

.chips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; cursor: pointer; }
.chip span { display: grid; place-items: center; text-align: center; min-height: 48px; padding: 6px 8px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); font-size: .85rem; font-weight: 500; line-height: 1.25; }
.chip input:checked + span { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset; color: var(--gold-text); }
.chip input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 2px; }

.check { display: flex; gap: 12px; align-items: flex-start; font-size: .88rem; line-height: 1.4; cursor: pointer; }
.check input { flex: none; width: 22px; height: 22px; margin-top: 1px; accent-color: var(--gold); }

.card { border: 1px solid var(--line); background: var(--card); border-radius: 16px; padding: 18px; margin-bottom: 16px; }
.card h2 { font-size: 1rem; font-weight: 500; margin-bottom: 14px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.subtle-btn { background: none; border: 0; color: var(--muted); font: inherit; font-size: .82rem; cursor: pointer; padding: 8px; min-height: 36px; text-decoration: underline; }
.warnbox { border: 1px solid var(--warn); border-radius: 12px; padding: 10px 12px; font-size: .82rem; color: var(--ink); background: color-mix(in srgb, var(--warn) 10%, transparent); margin-bottom: 14px; }
.infobox { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; font-size: .82rem; color: var(--muted); margin-bottom: 14px; }
.banner { border: 1px solid var(--gold); border-radius: 12px; padding: 10px 14px; margin-bottom: 18px; font-size: .88rem; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 22px; border-radius: 999px; border: 1px solid var(--gold); background: transparent; color: var(--gold-text); font: inherit; font-size: .95rem; font-weight: 500; cursor: pointer; text-decoration: none; -webkit-tap-highlight-color: transparent; }
.btn.primary { background: var(--gold-text); color: var(--gold-ink); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.block { width: 100%; }
.actions { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }
@media (min-width: 520px) { .actions.row { flex-direction: row; justify-content: space-between; } .actions.row .btn { flex: 0 1 auto; } }

/* results */
.badge { display: inline-block; border-radius: 999px; padding: 4px 12px; font-size: .78rem; font-weight: 500; border: 1px solid currentColor; white-space: nowrap; }
.badge.ok { color: var(--ok); } .badge.warn { color: var(--warn); } .badge.neutral { color: var(--muted); } .badge.gold { color: var(--gold-text); }
.res p { margin-bottom: 10px; font-size: .93rem; line-height: 1.55; }
.heats { list-style: none; margin: 10px 0; display: grid; gap: 8px; }
.heats li { border-inline-start: 3px solid var(--line); padding: 4px 12px; font-size: .88rem; }
.heats li.in { border-color: var(--ok); }
.heats li small { display: block; color: var(--muted); font-size: .8rem; }
.heats li.in small { color: var(--ok); }
.cal { color: var(--gold-text); font-size: .85rem; text-decoration: underline; background: none; border: 0; cursor: pointer; padding: 8px 0; font-family: inherit; min-height: 40px; }
.note { color: var(--muted); font-size: .8rem; text-align: center; margin-top: 22px; line-height: 1.5; }

.big-ok { text-align: center; padding: 20px 0; }
.big-ok .tick { width: 64px; height: 64px; margin: 0 auto 16px; border-radius: 50%; border: 1px solid var(--gold); display: grid; place-items: center; color: var(--gold-text); }
.big-ok .tick svg { width: 30px; height: 30px; }

.footlinks { display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; margin-top: 28px; }
.footlinks a { color: var(--muted); font-size: .82rem; text-decoration: none; border-bottom: 1px solid var(--line); padding-bottom: 2px; }

/* visits table */
.vgrid { display: grid; gap: 10px; }
.vrow { display: flex; justify-content: space-between; align-items: center; gap: 10px; border: 1px solid var(--line); background: var(--card); border-radius: 12px; padding: 12px 16px; font-size: .92rem; }
.vrow b { font-weight: 500; }
.vrow span { color: var(--muted); font-size: .85rem; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.pill { min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--ink); font: inherit; font-size: .85rem; cursor: pointer; }
.pill.on { border-color: var(--gold); color: var(--gold-text); }

.home-actions { display: flex; flex-direction: column; gap: 12px; align-items: center; margin-top: 8px; }
.cf-slot { min-height: 70px; display: flex; justify-content: center; margin: 14px 0 6px; }
.hp { position: absolute; inset-inline-start: -5000px; width: 1px; height: 1px; opacity: 0; }
.loading { text-align: center; color: var(--muted); padding: 40px 0; }
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
.footlink { color: var(--muted); font-size: .85rem; text-decoration: none; border-bottom: 1px solid var(--line); padding-bottom: 2px; }
.home-actions[hidden], .footlink[hidden] { display: none; }
.copy .home-actions { margin-top: 6px; }

/* dropdown list readable in dark mode (the field background is translucent, the list needs a solid one) */
select option, select optgroup { background-color: #ffffff; color: #231f20; }
:root[data-theme="dark"] select option, :root[data-theme="dark"] select optgroup { background-color: #181512; color: #f2ede4; }

/* tighter on phones: fewer screens to scroll */
.actions.row { flex-direction: row; gap: 10px; }
.actions.row .btn { flex: 1 1 0; padding: 0 12px; }
.actions.row .btn.primary { flex: 2 1 0; }
.card { padding: 16px; margin-bottom: 12px; }
.field { margin-bottom: 14px; }
.actions { margin-top: 16px; }
.cf-slot:empty { display: none; min-height: 0; margin: 0; }

@media (min-width: 900px) {
  .topbar { left: max(12px, calc(50% - 340px)); }
  .controls { right: max(12px, calc(50% - 340px)); }
}

/* heat periods (from - to) and result notes */
.hrow { display: grid; gap: 6px; margin: 6px 0 10px; }
.hrow .hn { display: flex; justify-content: space-between; align-items: center; font-size: .82rem; color: var(--muted); }
.hpair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.hpair label { display: flex; flex-direction: column; gap: 4px; font-size: .78rem; color: var(--muted); }
.hpair input { min-width: 0; }
textarea { resize: vertical; min-height: 64px; font: inherit; }
.heats li small.near { color: var(--muted); }
.note.obs { margin-top: 8px; }
.field > .btn.small { align-self: flex-start; margin-top: 6px; }
.note.obs { text-align: start; }
