/* مواعيد المتلوي — self-contained, no CDNs */
:root {
  --bg: #f6f1e8;
  --bg-2: #efe7d8;
  --card: #fffdf8;
  --ink: #1c2422;
  --muted: #4a5854;
  --line: #e4d9cc;
  --teal: #0e443e;
  --teal-deep: #0a332e;
  --teal-soft: #e4eeec;
  --urgent: #b42318;
  --urgent-dark: #8b1a14;
  --urgent-soft: #fdecea;
  --warn: #9a3412;
  --warn-soft: #fff1e6;
  --ok: #0e443e;
  --ok-soft: #e6f2ef;
  --shadow: 0 1px 2px rgba(28, 36, 34, 0.06), 0 8px 24px rgba(28, 36, 34, 0.06);
  --radius: 16px;
  --tap: 52px;
  --max: 40rem;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  color-scheme: light;
}

*,
*::before,
*::after { box-sizing: border-box; }

html {
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: auto;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(800px 240px at 50% calc(-80px + var(--safe-t)), #eadfcb 0%, transparent 70%),
    var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", sans-serif;
  font-size: 1.0625rem;
  line-height: 1.55;
  padding: 0;
}

html[lang="ar"] body {
  font-family: "Noto Naskh Arabic", "Noto Sans Arabic", "SF Arabic", "Geeza Pro", "Tahoma", "Segoe UI", sans-serif;
  line-height: 1.75;
}

[hidden] { display: none !important; }

html[lang="fr"] .t-ar { display: none !important; }
html[lang="ar"] .t-fr { display: none !important; }
html:not([lang="fr"]) .t-fr { display: none !important; }

:focus { outline: 2px solid var(--teal); outline-offset: 3px; }
:focus:not(:focus-visible) { outline: none; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; }

.skip {
  position: absolute;
  inset-inline-start: 0.75rem;
  top: -4rem;
  z-index: 20;
  background: var(--teal);
  color: #fff;
  padding: 0.5rem 0.85rem;
  border-radius: 8px;
  text-decoration: none;
}
.skip:focus { top: calc(0.5rem + var(--safe-t)); }

.wrap {
  width: min(100%, var(--max));
  margin: 0 auto;
  padding-inline: calc(1rem + var(--safe-l)) calc(1rem + var(--safe-r));
  padding-bottom: calc(1.5rem + var(--safe-b));
}

.top {
  position: sticky;
  top: 0;
  z-index: 8;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
  padding-top: var(--safe-t);
}
.top.is-stuck { border-bottom-color: var(--line); }

.top-inner {
  width: min(100%, var(--max));
  margin: 0 auto;
  padding: 0.7rem 1rem;
  padding-inline: calc(1rem + var(--safe-l)) calc(1rem + var(--safe-r));
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  flex: 1;
  text-decoration: none;
  color: inherit;
}

.brand img {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  flex-shrink: 0;
}

.brand-text { min-width: 0; }

.brand h1 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.25;
  color: var(--teal-deep);
}

.brand p {
  margin: 0;
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.3;
}

.lang-toggle {
  flex-shrink: 0;
  display: inline-flex;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}

.lang-toggle button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  min-height: 36px;
  min-width: 44px;
  padding: 0 0.7rem;
  border-radius: 999px;
  cursor: pointer;
}

.lang-toggle button[aria-pressed="true"] {
  background: var(--teal);
  color: #fff;
}

.demo-banner {
  margin: 0.75rem 0 0;
  padding: 0.45rem 0.85rem;
  background: var(--warn-soft);
  border: 1px solid #f0d3b8;
  color: #5c2e12;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 650;
  text-align: center;
}


/* Home hero (hospital façade photo) */
.hero {
  position: relative;
  margin: 0.85rem 0 0.15rem;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  isolation: isolate;
  background: var(--teal-deep);
}
.hero picture,
.hero img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 474 / 262;
  object-fit: cover;
  object-position: center;
}
.hero-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 1.15rem 1rem 0.9rem;
  background: linear-gradient(
    to top,
    rgba(8, 22, 20, 0.78) 0%,
    rgba(8, 22, 20, 0.42) 38%,
    rgba(8, 22, 20, 0.12) 68%,
    rgba(8, 22, 20, 0.04) 100%
  );
  color: #fff8f0;
  pointer-events: none;
}
.hero-title {
  margin: 0;
  font-size: 1.32rem;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: 0;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}
.hero-sub {
  margin: 0.12rem 0 0;
  font-size: 0.86rem;
  line-height: 1.35;
  opacity: 0.94;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.back-btn {
  appearance: none;
  border: 0;
  background: var(--teal-soft);
  color: var(--teal-deep);
  font: inherit;
  font-weight: 650;
  font-size: 0.9rem;
  min-height: 40px;
  padding: 0 0.85rem;
  border-radius: 999px;
  cursor: pointer;
  flex-shrink: 0;
}

.view-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0.85rem 0 0.9rem;
}
.view-head h2 {
  margin: 0;
  font-size: 1.28rem;
  color: var(--teal-deep);
  line-height: 1.3;
}

.lead {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.section-title {
  margin: 1.35rem 0 0.65rem;
  font-size: 1.05rem;
  font-weight: 750;
  color: var(--teal-deep);
}

.grid { display: grid; gap: 0.65rem; }

.card-link {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 1rem;
  min-height: 64px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
  cursor: pointer;
  font: inherit;
  text-align: inherit;
  width: 100%;
}
.card-link:active { background: #fbf6ec; }

.card-ico {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--teal-soft);
  color: var(--teal);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.card-ico svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.card-link strong {
  display: block;
  font-size: 1.02rem;
  font-weight: 700;
  line-height: 1.3;
}
.card-link .card-sub {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.35;
  margin-top: 0.1rem;
}

.chev {
  margin-inline-start: auto;
  color: var(--muted);
  flex-shrink: 0;
}
html[lang="ar"] .chev { transform: scaleX(-1); }

.btn,
.share-btn {
  appearance: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  min-height: var(--tap);
  padding: 0.65rem 1rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--teal-deep);
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
}
.btn:active, .share-btn:active { background: var(--bg-2); }

.btn-primary {
  background: var(--teal);
  color: #fff;
  border-color: var(--teal-deep);
}
.btn-primary:active { background: var(--teal-deep); }

.btn-danger {
  background: var(--urgent-soft);
  color: var(--urgent-dark);
  border-color: #f5c2c0;
}
.btn-danger:active { background: #fadad7; }

.btn-row {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.85rem;
}
.btn-row.two { grid-template-columns: 1fr 1fr; }

.credit {
  margin: 1.35rem 0 0.4rem;
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--ink);
  text-align: center;
}
.credit a {
  color: var(--teal);
  font-weight: 650;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.site-foot {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}
.site-foot p { margin: 0 0 0.5rem; }
.site-foot a { color: var(--teal); }

.disclaimer-box {
  margin: 1rem 0;
  padding: 0.9rem 1rem;
  background: var(--warn-soft);
  border: 1px solid #f0d3b8;
  border-radius: 12px;
  font-size: 0.92rem;
  color: #5c2e12;
}
.disclaimer-box p { margin: 0 0 0.45rem; }
.disclaimer-box p:last-child { margin-bottom: 0; }

.note-box {
  margin: 1rem 0;
  padding: 0.9rem 1rem;
  background: var(--ok-soft);
  border: 1px solid #c5ddd7;
  border-radius: 12px;
  font-size: 0.92rem;
}
.note-box p { margin: 0 0 0.45rem; }
.note-box p:last-child { margin-bottom: 0; }

/* Week nav + segments */
.week-nav,
.seg {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0 0 0.9rem;
}
.week-nav .week-label {
  flex: 1;
  text-align: center;
  font-weight: 700;
  color: var(--teal-deep);
  font-size: 0.95rem;
  line-height: 1.35;
}
.week-nav button,
.seg button {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--teal-deep);
  font: inherit;
  font-weight: 650;
  font-size: 0.88rem;
  min-height: 40px;
  padding: 0 0.75rem;
  border-radius: 999px;
  cursor: pointer;
}
.seg {
  background: var(--bg-2);
  border-radius: 999px;
  padding: 3px;
  border: 1px solid var(--line);
  gap: 2px;
}
.seg button {
  flex: 1;
  border: 0;
  background: transparent;
  min-height: 38px;
}
.seg button[aria-pressed="true"] {
  background: var(--teal);
  color: #fff;
}

/* Day / roster cards */
.day-card,
.info-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.95rem 1rem;
  box-shadow: var(--shadow);
}
.day-card {
  appearance: none;
  font: inherit;
  color: inherit;
  text-align: inherit;
  width: 100%;
  cursor: pointer;
}
.day-card:disabled,
.day-card.is-full {
  cursor: not-allowed;
  opacity: 0.7;
}
.day-card h3,
.info-card h3 {
  margin: 0 0 0.25rem;
  font-size: 1.02rem;
  color: var(--teal-deep);
}
.day-card p,
.info-card p { margin: 0; color: var(--muted); font-size: 0.9rem; }

.badge {
  display: inline-block;
  margin-top: 0.45rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  background: var(--ok-soft);
  color: var(--teal-deep);
}
.badge-full {
  background: var(--urgent-soft);
  color: var(--urgent-dark);
}
.badge-closed {
  background: var(--bg-2);
  color: var(--muted);
}

.cal-strip {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.3rem;
  margin: 0 0 0.9rem;
}
.cal-cell {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 10px;
  padding: 0.35rem 0.1rem 0.4rem;
  text-align: center;
  font: inherit;
  color: inherit;
  min-height: 58px;
  cursor: default;
}
.cal-cell.is-work { cursor: pointer; background: var(--ok-soft); border-color: #c5ddd7; }
.cal-cell.is-full { background: var(--urgent-soft); border-color: #f5c2c0; cursor: not-allowed; }
.cal-cell.is-today { outline: 2px solid var(--teal); outline-offset: 0; }
.cal-cell.is-off { background: transparent; color: var(--muted); box-shadow: none; }
.cal-cell .dow {
  display: block;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--muted);
}
.cal-cell .dom {
  display: block;
  font-size: 0.95rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  font-family: system-ui, "Segoe UI", sans-serif;
  line-height: 1.2;
}
.cal-cell .mini {
  display: block;
  font-size: 0.6rem;
  color: var(--teal);
  font-weight: 700;
  line-height: 1.2;
}
.cal-cell.is-full .mini { color: var(--urgent-dark); }
.cal-cell.is-off .mini { color: transparent; }

/* Forms */
.form-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1rem 1.15rem;
  box-shadow: var(--shadow);
}
.field { margin: 0 0 0.85rem; }
.field label {
  display: block;
  font-weight: 700;
  font-size: 0.92rem;
  margin-bottom: 0.3rem;
  color: var(--teal-deep);
}
.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: var(--tap);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  padding: 0.5rem 0.85rem;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: 2px solid var(--teal);
  outline-offset: 1px;
  border-color: var(--teal);
}
.field .hint { margin: 0.3rem 0 0; font-size: 0.8rem; color: var(--muted); }

.form-error {
  margin: 0 0 0.75rem;
  padding: 0.65rem 0.8rem;
  background: var(--urgent-soft);
  color: var(--urgent-dark);
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 650;
}

.confirm-code {
  margin: 0.5rem 0 1rem;
  padding: 1.1rem 1rem;
  background: var(--ok-soft);
  border: 1px solid #c5ddd7;
  border-radius: var(--radius);
  text-align: center;
}
.confirm-code .code {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--teal-deep);
  direction: ltr;
  unicode-bidi: isolate;
  margin: 0.35rem 0;
}
.confirm-code p { margin: 0.25rem 0; }

.booking-item {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.95rem 1rem;
  box-shadow: var(--shadow);
}
.booking-item.is-cancelled { opacity: 0.7; }
.booking-item h3 { margin: 0 0 0.2rem; font-size: 1.05rem; color: var(--teal-deep); }
.booking-item p { margin: 0.15rem 0; font-size: 0.9rem; color: var(--muted); }
.booking-item .code {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  direction: ltr;
  unicode-bidi: isolate;
  font-weight: 700;
  color: var(--teal-deep);
}

/* Staff */
.pin-note {
  font-size: 0.88rem;
  color: var(--muted);
  margin: 0 0 0.85rem;
}
.staff-day {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--line);
}
.staff-day:last-child { border-bottom: 0; }
.staff-day .dow {
  flex: 1 1 7rem;
  font-weight: 700;
  color: var(--teal-deep);
  min-width: 0;
}
.staff-day label.chk {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.9rem;
  font-weight: 600;
  min-height: 40px;
}
.staff-day input[type="checkbox"] {
  width: 1.15rem;
  height: 1.15rem;
  accent-color: var(--teal);
}
.staff-day input[type="number"],
.staff-day select {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font: inherit;
  padding: 0.3rem 0.55rem;
  background: #fff;
  max-width: 100%;
}
.staff-day input[type="number"] { width: 5.2rem; }
.staff-day select { flex: 1 1 10rem; }

.save-status {
  margin: 0.55rem 0 0;
  font-size: 0.88rem;
  color: var(--teal);
  font-weight: 650;
  min-height: 1.2em;
}
.save-status.is-error { color: var(--urgent-dark); }

.today-mark {
  display: inline-block;
  margin-inline-start: 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  background: var(--teal);
  color: #fff;
  border-radius: 999px;
  padding: 0.05rem 0.45rem;
  vertical-align: middle;
}

.empty {
  margin: 0.5rem 0;
  padding: 1rem;
  text-align: center;
  color: var(--muted);
  background: var(--card);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

.noscript {
  margin: 1rem 0;
  padding: 0.9rem 1rem;
  background: var(--warn-soft);
  border-radius: 12px;
}

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