:root {
  --bg: #faf7f2;
  --surface: #ffffff;
  --ink: #2f2a26;
  --muted: #7a6f66;
  --line: #e8e0d6;
  --accent: #7d8b6a;        /* sage */
  --accent-dark: #5f6c4f;
  --accent-soft: #eef1e8;
  --clay: #c08a6b;
  --clay-soft: #f7ebe3;
  --danger: #b4483c;
  --danger-soft: #fbecea;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(47, 42, 38, 0.04), 0 8px 24px rgba(47, 42, 38, 0.06);
  --serif: 'Cormorant Garamond', Georgia, serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 var(--sans);
}

h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.15; margin: 0 0 0.5em; }
h1 { font-size: clamp(2.4rem, 7vw, 4rem); }
h2 { font-size: clamp(1.8rem, 4vw, 2.4rem); }
h3 { font-size: 1.35rem; }
p { margin: 0 0 1em; }
a { color: var(--accent-dark); }

.wrap { max-width: 960px; margin: 0 auto; padding: 0 16px; }

/* ------------------------------------------------------------------ header */
.site-header { border-bottom: 1px solid var(--line); background: var(--surface); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 16px; }
.brand { font-family: var(--serif); font-size: 1.5rem; font-weight: 600; color: var(--ink); text-decoration: none; }
.nav { display: flex; align-items: center; white-space: nowrap; }
.nav a { color: var(--muted); text-decoration: none; margin-inline-start: 20px; font-size: 0.95rem; }
.nav a:hover { color: var(--ink); }

/* -------------------------------------------------------------------- hero */
.hero { padding-top: 72px; padding-bottom: 56px; text-align: center; }
.hero .eyebrow { text-transform: uppercase; letter-spacing: 0.18em; font-size: 0.78rem; color: var(--clay); font-weight: 600; margin-bottom: 12px; }
.hero p { color: var(--muted); font-size: 1.15rem; max-width: 560px; margin: 0 auto 28px; }

/* ----------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: 999px; padding: 11px 22px;
  font: 600 0.95rem var(--sans); cursor: pointer; text-decoration: none;
  background: var(--accent); color: #fff; transition: background 0.15s, opacity 0.15s;
}
.btn:hover { background: var(--accent-dark); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn.secondary { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.secondary:hover { background: var(--accent-soft); }
.btn.clay { background: var(--clay); }
.btn.clay:hover { background: #a8735a; }
.btn.danger { background: transparent; color: var(--danger); border-color: #e6c3be; }
.btn.danger:hover { background: var(--danger-soft); }
.btn.small { padding: 7px 14px; font-size: 0.85rem; }
.btn.block { width: 100%; }

/* ----------------------------------------------------------------- sections */
section { padding: 48px 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.section-head p { color: var(--muted); margin: 0; font-size: 0.92rem; }


/* ----------------------------------------------------------------- schedule */
.week-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
/* Home page: week buttons stay on one swipeable row instead of wrapping. */
#week-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; margin-left: -16px; margin-right: -16px; padding: 0 16px; }
#week-tabs::-webkit-scrollbar { display: none; }
#week-tabs button { flex: 0 0 auto; }
.week-tabs button {
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  border-radius: 999px; padding: 7px 16px; font: 500 0.9rem var(--sans); cursor: pointer;
}
.week-tabs button[aria-selected="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }

.day { margin-bottom: 28px; }
.day-label { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); font-weight: 600; margin: 0 0 10px; }

.class-card {
  display: grid; grid-template-columns: 84px 1fr auto; gap: 16px; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; margin-bottom: 10px; box-shadow: var(--shadow);
}
.class-card .time { font-family: var(--serif); font-size: 1.6rem; font-weight: 600; line-height: 1; }
.class-card .time small { display: block; font-family: var(--sans); font-size: 0.75rem; color: var(--muted); font-weight: 400; margin-top: 6px; }
.class-card h3 { margin: 0 0 2px; }
.class-card .meta { color: var(--muted); font-size: 0.9rem; }
.class-card .actions { text-align: end; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.class-card.cancelled { opacity: 0.6; }

.badge { display: inline-block; font-size: 0.78rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-dark); white-space: nowrap; }
.badge.low { background: var(--clay-soft); color: #9a6146; }
.badge.full { background: #efe9e3; color: var(--muted); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }

.empty { text-align: center; color: var(--muted); padding: 40px 16px; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); }

@media (max-width: 600px) {
  .class-card { grid-template-columns: 64px 1fr; }
  .class-card .actions { grid-column: 1 / -1; flex-direction: row; justify-content: space-between; align-items: center; }
  .nav a { margin-inline-start: 14px; }
  .nav a.hide-sm { display: none; }
}

/* -------------------------------------------------------------------- modal */
dialog {
  border: none; border-radius: 18px; padding: 0; width: min(460px, calc(100vw - 32px));
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.2); color: var(--ink); background: var(--surface);
}
dialog::backdrop { background: rgba(47, 42, 38, 0.45); }
.modal-body { padding: 28px; }
.modal-close { float: inline-end; background: none; border: none; font-size: 1.6rem; line-height: 1; color: var(--muted); cursor: pointer; }
.modal-class { background: var(--bg); border-radius: 10px; padding: 12px 14px; margin: 12px 0 20px; font-size: 0.95rem; }
.modal-class strong { display: block; }

/* -------------------------------------------------------------------- forms */
fieldset.choice { border: none; padding: 0; margin: 0 0 14px; }
fieldset.choice legend { font-size: 0.88rem; font-weight: 600; padding: 0; margin-bottom: 6px; }
fieldset.choice label { display: flex; align-items: center; gap: 8px; font-weight: 400; margin: 0 0 6px; }
fieldset.choice input { width: auto; margin: 0; accent-color: var(--accent); }
.hero-notice { margin: 20px auto 0 !important; font-size: 0.95rem !important; color: var(--clay) !important; font-weight: 600; }
.transfer-box { white-space: pre-line; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; font-size: 0.95rem; margin: 12px 0 16px; }
label { display: block; font-size: 0.88rem; font-weight: 600; margin-bottom: 14px; }
label .opt { color: var(--muted); font-weight: 400; }
input, textarea, select {
  display: block; width: 100%; margin-top: 6px; padding: 11px 13px;
  border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink);
  font: 1rem var(--sans);
}
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
textarea { min-height: 70px; resize: vertical; }

.notice { padding: 12px 14px; border-radius: 10px; font-size: 0.92rem; margin-bottom: 16px; }
.notice.info { background: var(--accent-soft); color: var(--accent-dark); }
.notice.warn { background: var(--clay-soft); color: #8a5338; }
.notice.error { background: var(--danger-soft); color: var(--danger); }
.fine { font-size: 0.82rem; color: var(--muted); }

/* ------------------------------------------------------------- status pages */
.panel {
  max-width: 520px; margin: 56px auto; background: var(--surface); border: 1px solid var(--line);
  border-radius: 18px; padding: 32px; box-shadow: var(--shadow);
}
.panel .icon { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; font-size: 1.6rem; margin-bottom: 16px; background: var(--accent-soft); color: var(--accent-dark); }
.panel .icon.warn { background: var(--clay-soft); color: var(--clay); }
.panel .icon.muted { background: #efe9e3; color: var(--muted); }
.details { border-top: 1px solid var(--line); margin: 20px 0; padding-top: 16px; }
.details div { display: flex; justify-content: space-between; gap: 16px; padding: 4px 0; font-size: 0.95rem; }
.details dt, .details span:first-child { color: var(--muted); }
.stack { display: flex; flex-direction: column; gap: 10px; }

footer { padding: 32px 0 48px; color: var(--muted); font-size: 0.88rem; text-align: center; }
footer a { color: var(--muted); }

.demo-banner { background: #fff6d6; color: #6b5a12; text-align: center; font-size: 0.85rem; padding: 8px 16px; }

/* --------------------------------------------------------- accounts & selection */
.nav a.nav-strong { color: var(--accent-dark); font-weight: 600; }
.class-card.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft), var(--shadow); }
.select-bar { position: fixed; left: 0; right: 0; bottom: 0; background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -6px 20px rgba(47, 42, 38, 0.08); z-index: 20; }
.select-bar .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 68px; flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; }
.select-bar #select-summary { font-weight: 600; }
.select-actions { display: flex; gap: 8px; }
body:has(.select-bar:not([hidden])) footer { padding-bottom: 110px; }

.auth { max-width: 460px; margin: 48px auto; }
.auth .panel { margin: 0; }
.auth .switch { text-align: center; margin-top: 16px; font-size: 0.92rem; color: var(--muted); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .row2 { grid-template-columns: 1fr; } }

/* account page */
.account { padding: 32px 16px 64px; max-width: 820px; margin: 0 auto; }
.account-nav { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 24px; }
.account-nav a { border: 1px solid var(--line); background: var(--surface); color: var(--muted); border-radius: 999px; padding: 7px 14px; font-size: 0.9rem; text-decoration: none; }
.account-nav a:hover { color: var(--ink); }
.account-nav a[aria-selected="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.account-nav .count:empty { display: none; }
.account-nav .count { display: inline-block; min-width: 20px; padding: 0 6px; margin-inline-start: 4px; border-radius: 999px; background: var(--clay); color: #fff; font-size: 0.75rem; font-weight: 600; text-align: center; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 18px; box-shadow: var(--shadow); }
.card h2 { font-size: 1.6rem; margin-bottom: 4px; }
.card .lead { color: var(--muted); margin-bottom: 14px; font-size: 0.95rem; }
.item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.item:first-of-type { border-top: none; }
.item .what strong { display: block; }
.item .what span { color: var(--muted); font-size: 0.88rem; }
.item .acts { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.item label.check { display: flex; align-items: center; gap: 12px; margin: 0; font-weight: 400; cursor: pointer; flex: 1; }
.item label.check input { width: 20px; height: 20px; margin: 0; accent-color: var(--accent); flex-shrink: 0; }
.pay-total { display: flex; justify-content: space-between; font-weight: 600; padding: 12px 0; border-top: 2px solid var(--line); margin-top: 4px; }
.credit-big { font-family: var(--serif); font-size: 2.2rem; font-weight: 600; }
.ledger { font-size: 0.9rem; }
.ledger div { display: flex; justify-content: space-between; padding: 6px 0; border-top: 1px solid var(--line); }
.plus { color: var(--accent-dark); font-weight: 600; }
.minus { color: var(--muted); }

@media (max-width: 600px) {
  .brand { font-size: 1.15rem; white-space: nowrap; }
  .site-header .nav a.nav-strong { font-size: 0.85rem; }
  .site-header .nav a { margin-inline-start: 12px; white-space: nowrap; font-size: 0.9rem; }
  .site-header .nav a.hide-sm { display: none; }
}

/* ------------------------------------------------------- home: compact info */
.schedule-notice { margin: -8px 0 16px; color: var(--clay); font-weight: 600; font-size: 0.9rem; }
.how-section { padding: 0 0 8px; }
.how { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.how > summary { cursor: pointer; padding: 14px 16px; font-weight: 600; list-style: none; display: flex; justify-content: space-between; align-items: center; }
.how summary::-webkit-details-marker { display: none; }
.how > summary::after { content: '+'; font-size: 1.3rem; line-height: 1; color: var(--muted); }
.how[open] > summary::after { content: '\2212'; }

/* Timeline: numbered dots joined by a line; each step opens for details. */
.steps { list-style: none; margin: 0; padding: 4px 16px 16px; counter-reset: step; }
.steps li { position: relative; padding-inline-start: 44px; counter-increment: step; }
.steps li::before {
  content: counter(step); position: absolute; inset-inline-start: 0; top: 8px; width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent-dark); border: 1px solid var(--accent);
  display: grid; place-items: center; font-weight: 600; font-size: 0.85rem; z-index: 1;
}
.steps li:last-child::before { background: var(--accent); color: #fff; }
.steps li:not(:last-child)::after { content: ''; position: absolute; inset-inline-start: 14px; top: 36px; bottom: -8px; width: 1px; background: var(--line); }
.steps details { padding: 6px 0 10px; }
.steps summary { cursor: pointer; list-style: none; display: grid; grid-template-columns: 1fr auto; column-gap: 8px; }
.steps summary::after { content: '\203A'; grid-row: 1 / span 2; grid-column: 2; align-self: center; color: var(--muted); font-size: 1.3rem; transition: transform 0.15s; }
.steps details[open] summary::after { transform: rotate(90deg); }
.step-title { font-weight: 600; padding-top: 6px; }
.step-hint { color: var(--muted); font-size: 0.88rem; }
.steps p { margin: 8px 0 0; color: var(--muted); font-size: 0.9rem; background: var(--bg); border-radius: 10px; padding: 10px 12px; }
.steps p b { color: var(--ink); font-weight: 600; }
@media (max-width: 640px) {
  .hero { padding-top: 40px; padding-bottom: 32px; }
  .hero p { max-width: 300px; }
  .hero p { font-size: 1rem; margin-bottom: 20px; }
  #schedule { padding-top: 24px; }
}

/* ------------------------------------------------------------- language */
.lang-toggle {
  margin-inline-start: 12px; flex-shrink: 0;
  background: none; border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px;
  font: inherit; font-size: 0.85rem; color: var(--muted); cursor: pointer;
}
.lang-toggle:hover { color: var(--ink); border-color: var(--muted); }
.lang-toggle:lang(ar) { font-family: 'IBM Plex Sans Arabic', var(--sans); }

/* Arabic: an Arabic typeface (the Latin ones have no Arabic letters) and mirrored details. */
html[lang="ar"] { --sans: 'IBM Plex Sans Arabic', 'Inter', system-ui, sans-serif; --serif: 'IBM Plex Sans Arabic', Georgia, serif; }
html[lang="ar"] .hero .eyebrow, html[lang="ar"] .day-label { letter-spacing: 0; }
html[dir="rtl"] .steps summary::after { content: '\2039'; }
html[dir="rtl"] .steps details[open] summary::after { transform: rotate(-90deg); }
@media (max-width: 640px) {
  /* Room for the language switch: the brand and the hero button already lead to the timetable. */
  .site-header .nav a:not(.nav-strong) { display: none; }
  .site-header .wrap { gap: 8px; }
  .lang-toggle { margin-inline-start: 0; padding: 3px 8px; }
  .brand { font-size: 1.15rem; white-space: nowrap; }
  .site-header .nav a.nav-strong { font-size: 0.85rem; }
}

/* WhatsApp group link under the homepage heading */
.hero .wa-row { margin: 16px auto 0; font-size: 0.95rem; }
.wa-link { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: none; font-weight: 500; }
.wa-link svg { color: #25d366; }
.wa-link:hover { color: var(--accent-dark); text-decoration: underline; }
.wa-link[hidden] { display: none; }
.item .auto-book { flex-basis: 100%; display: flex; align-items: center; gap: 8px; margin: 0; font-weight: 400; color: var(--muted); cursor: pointer; }
.item .auto-book input { width: auto; flex: none; margin: 0; }
