/* The reception desk (my.caeloryn.net/bookings). Same palettes and theme key as the owner app (owner/index.html), in
   the layout of the approved mockup (design/booking/mockups.html, d1-calendar and s1-form-settings). Every size here
   keeps the owner's spacing rules: touch targets 44px tall, text 12px or more off a card's border, nothing on an edge. */
@font-face { font-family: 'Archivo'; font-style: normal; font-weight: 100 900; font-stretch: 62% 125%; font-display: swap;
  src: url(fonts/Archivo-100-900-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'IBM Plex Sans Arabic'; font-style: normal; font-weight: 400; font-display: swap;
  src: url(fonts/IBMPlexSansArabic-400-arabic.woff2) format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FEFC; }
@font-face { font-family: 'IBM Plex Sans Arabic'; font-style: normal; font-weight: 600; font-display: swap;
  src: url(fonts/IBMPlexSansArabic-600-arabic.woff2) format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FEFC; }
@font-face { font-family: 'IBM Plex Sans Arabic'; font-style: normal; font-weight: 700; font-display: swap;
  src: url(fonts/IBMPlexSansArabic-700-arabic.woff2) format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FEFC; }

:root, :root[data-theme="dark"] {
  --bg: #011207; --panel: #012F13; --panel2: #06371A; --line: #0A3D1E; --line2: #12592C;
  --accent: #8BC53D; --accent-ink: #011207; --text: #E2F0CC; --muted: #A8C08A; --danger: #f87171; --danger-line: #7f2a26;
  --lane: #021a0b; --lane-rule: #0c3a1d; --now: #f0b43c; --late-bg: #3d2c06; --late-ink: #fcd27a;
  --st-c: #8fb8ff; --st-c-bg: #10284d; --st-a: #6fdccb; --st-a-bg: #0c3a35; --st-d: #b3dc84; --st-d-bg: #1d3a12;
  --st-n: #ff9a8f; --st-n-bg: #4a1712; --st-p: #f6c160; --st-p-bg: #43310a; --st-x: #8aa07b; --st-x-bg: #10261a;
  --hold-bg: #13301d; --hold-ink: #a8c08a; --shadow: 0 18px 40px -16px rgba(0,0,0,.6);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #F4F7F1; --panel: #FFFFFF; --panel2: #EEF3E8; --line: #DFE6D8; --line2: #C6D4B8;
  --accent: #5C9A28; --accent-ink: #FFFFFF; --text: #17231A; --muted: #5C7350; --danger: #B42318; --danger-line: #F0C8C3;
  --lane: #FFFFFF; --lane-rule: #E7ECE3; --now: #E0A12B; --late-bg: #FFF4D6; --late-ink: #8A5A00;
  --st-c: #1B57C4; --st-c-bg: #E5EDFB; --st-a: #0F6F66; --st-a-bg: #DCF1EC; --st-d: #3D6A27; --st-d-bg: #E7F1DC;
  --st-n: #B42318; --st-n-bg: #FBE7E4; --st-p: #8A5A00; --st-p-bg: #FFF1CC; --st-x: #6B7768; --st-x-bg: #EEF1EC;
  --hold-bg: #EEF1EC; --hold-ink: #5C7350; --shadow: 0 18px 40px -18px rgba(14,20,17,.35);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text);
  font-family: 'Archivo', 'IBM Plex Sans Arabic', 'Segoe UI', system-ui, sans-serif; font-size: 15px; line-height: 1.45;
  -webkit-font-smoothing: antialiased; }
:lang(ar) body, body:lang(ar) { font-family: 'IBM Plex Sans Arabic', 'Archivo', 'Segoe UI', system-ui, sans-serif; }
[hidden] { display: none !important; }
.ltr { direction: ltr; unicode-bidi: isolate; }
[dir="rtl"] .flip { transform: scaleX(-1); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; }
svg { flex: none; }

/* ---------- buttons and fields ---------- */
.btn { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 16px;
  border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font-weight: 600;
  font-size: 14.5px; white-space: nowrap; text-decoration: none; }
.btn:hover { border-color: var(--line2); }
.btn.pri { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.bad { color: var(--danger); border-color: var(--danger-line); }
.btn.icon { width: 44px; padding: 0; }
.btn.small { min-height: 44px; padding: 0 12px; font-size: 13.5px; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.field { display: grid; gap: 6px; min-width: 0; }
.field > span { font-size: 13px; color: var(--muted); font-weight: 600; }
.field input, .field select, .field textarea, .inp { min-height: 44px; width: 100%; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--panel2); color: var(--text); min-width: 0; }
.field textarea { min-height: 80px; resize: vertical; }
.field.bad input, .field.bad select { border-color: var(--danger); }
.hint { font-size: 12.5px; color: var(--muted); }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.grow { flex: 1; }
.err { color: var(--danger); font-size: 13.5px; }

/* ---------- top bar ---------- */
.dbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px 16px; background: var(--panel);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.mark { font-weight: 800; font-stretch: 75%; letter-spacing: .02em; text-transform: uppercase; font-size: 15px; }
.shopname { color: var(--muted); font-size: 13.5px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }
.shoppick { min-height: 44px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel2); padding: 0 10px; max-width: 240px; }
.datenav { display: flex; align-items: center; gap: 8px; }
.datelabel { font-weight: 700; font-size: 14.5px; min-width: 170px; text-align: center; white-space: nowrap; }
.search { display: flex; align-items: center; gap: 8px; min-height: 44px; flex: 1 1 300px; max-width: 520px; border: 1px solid var(--line);
  border-radius: 10px; padding: 0 12px; background: var(--bg); color: var(--muted); }
.search input { border: 0; background: transparent; min-height: 42px; flex: 1; min-width: 0; outline: none; color: var(--text); }
.prefs { display: flex; align-items: center; gap: 8px; }
.langpick { display: flex; gap: 4px; border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.langpick button { min-width: 44px; min-height: 38px; border: 0; border-radius: 999px; background: none; color: var(--muted); font-weight: 700; font-size: 12.5px; }
.langpick button.on { background: var(--accent); color: var(--accent-ink); }
.themepick { width: 44px; height: 44px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); display: inline-grid; place-items: center; }
.bar-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.tabs { display: flex; gap: 8px; padding: 12px 16px 0; flex-wrap: wrap; align-items: center; }
.tabs .btn { min-width: 88px; }
.asof { color: var(--muted); font-size: 13px; margin-inline-start: auto; }

/* ---------- banners ---------- */
.banners { display: grid; gap: 8px; padding: 12px 16px 0; }
.banner { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--panel); font-size: 14px; }
.banner.warn { background: var(--late-bg); color: var(--late-ink); border-color: transparent; }
.banner.bad { border-color: var(--danger-line); color: var(--danger); }
.banner .grow { min-width: 180px; }

/* ---------- day view ---------- */
.dmain { display: grid; grid-template-columns: minmax(0, 1fr); min-height: 0; }
.cal { padding: 14px 16px 24px; min-width: 0; }
.calscroll { overflow-x: auto; overscroll-behavior-x: contain; padding-bottom: 8px; }
.calgrid { display: grid; gap: 0 10px; position: relative; }
.colh { font-weight: 700; font-size: 13.5px; padding: 0 4px 8px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.colh small { display: block; color: var(--muted); font-weight: 400; font-size: 12px; }
.rail, .lane { position: relative; }
.rail span { position: absolute; inset-inline-end: 6px; transform: translateY(-50%); font-size: 11.5px; color: var(--muted);
  font-variant-numeric: tabular-nums; white-space: nowrap; }
.rail span.first { transform: none; }
.lane { border-radius: 8px; background-color: var(--lane);
  background-image: repeating-linear-gradient(to bottom, var(--lane-rule) 0 1px, transparent 1px var(--hour-px, 120px)); }
.lane .closed { position: absolute; inset-inline: 0; background: repeating-linear-gradient(135deg, transparent 0 6px, var(--lane-rule) 6px 8px); opacity: .7; border-radius: 6px; }
.bk { position: absolute; inset-inline: 4px; border-radius: 7px; padding: 4px 8px; font-size: 12px; line-height: 1.3;
  border: 0; border-inline-start: 3px solid currentColor; overflow: hidden; text-align: start; touch-action: none;
  display: block; width: auto; }
.bk b { font-weight: 600; color: var(--text); }
.bk .when { opacity: .9; }
.bk.c { color: var(--st-c); background: var(--st-c-bg); }
.bk.a { color: var(--st-a); background: var(--st-a-bg); }
.bk.d { color: var(--st-d); background: var(--st-d-bg); }
.bk.n { color: var(--st-n); background: var(--st-n-bg); }
.bk.p { color: var(--st-p); background: var(--st-p-bg); }
.bk.x { color: var(--st-x); background: var(--st-x-bg); opacity: .75; }
.bk.hold { color: var(--hold-ink); background: var(--hold-bg); background-image: repeating-linear-gradient(135deg, transparent 0 6px, var(--lane-rule) 6px 8px); }
.bk.picked { box-shadow: 0 0 0 2px var(--text); }
.bk.dragging { opacity: .85; box-shadow: var(--shadow); z-index: 5; }
.bk .tag { display: inline-block; font-size: 10.5px; font-weight: 700; border-radius: 4px; padding: 0 5px; margin-inline-start: 4px;
  background: var(--panel); color: var(--accent); }
.bk .tag.queued { color: var(--late-ink); background: var(--late-bg); }
.bk .tag.late { color: var(--st-n); }
.now { position: absolute; inset-inline: 0; border-top: 2px solid var(--now); z-index: 3; pointer-events: none; }
.now::before { content: ""; position: absolute; inset-inline-start: -5px; top: -6px; width: 10px; height: 10px; border-radius: 50%; background: var(--now); }
.empty { color: var(--muted); text-align: center; padding: 32px 16px; }

/* ---------- side panel / sheet ---------- */
.panel { background: var(--panel); padding: 18px; display: flex; flex-direction: column; gap: 14px; overflow-y: auto; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.panel-head h2 { font-size: 18px; margin: 0; min-width: 0; overflow-wrap: anywhere; }
.pill { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.pill.c { color: var(--st-c); background: var(--st-c-bg); } .pill.a { color: var(--st-a); background: var(--st-a-bg); }
.pill.d { color: var(--st-d); background: var(--st-d-bg); } .pill.n { color: var(--st-n); background: var(--st-n-bg); }
.pill.p { color: var(--st-p); background: var(--st-p-bg); } .pill.x { color: var(--st-x); background: var(--st-x-bg); }
.pill.hold { color: var(--hold-ink); background: var(--hold-bg); }
.meta { color: var(--muted); font-size: 13.5px; display: grid; gap: 4px; }
.late { justify-self: start; font-size: 13px; font-weight: 600; color: var(--late-ink); background: var(--late-bg); border-radius: 8px; padding: 6px 12px; }
.differ { display: grid; gap: 10px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--danger-line); }
.differ b { color: var(--danger); }
.info { display: grid; border: 1px solid var(--line); border-radius: 12px; }
.info > div { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 14px; font-size: 14px; }
.info > div + div { border-top: 1px solid var(--line); }
.info span { color: var(--muted); }
.info b { font-weight: 600; text-align: end; overflow-wrap: anywhere; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.grid2 .btn { width: 100%; }
.hist { display: grid; gap: 6px; }
.hist .lbl { color: var(--muted); font-size: 13px; font-weight: 600; }
.hist button { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 13.5px; padding: 12px 14px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px; min-height: 44px; text-align: start; }
.hist button span:last-child { font-weight: 600; white-space: nowrap; }
.panel-close { display: none; }

/* ---------- lists (week, tomorrow, search, patient) ---------- */
.view { padding: 14px 16px 24px; display: grid; gap: 14px; max-width: 980px; }
.daygroup h3 { font-size: 14px; color: var(--muted); margin: 0 0 8px; font-weight: 700; }
.list { display: grid; gap: 8px; }
.lrow { display: flex; align-items: center; gap: 12px; padding: 12px 14px; min-height: 56px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--panel); text-align: start; width: 100%; }
.lrow .t { font-variant-numeric: tabular-nums; font-weight: 700; min-width: 64px; }
.lrow .who { flex: 1; min-width: 0; }
.lrow .who b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lrow .who small { color: var(--muted); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lrow .acts { display: flex; gap: 8px; flex: none; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px; display: grid; gap: 12px; }
.card h2 { font-size: 16px; margin: 0; }

/* ---------- sheets (dialogs) ---------- */
.sheet-back { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 50; display: grid; place-items: center; padding: 16px; }
.sheet { background: var(--panel); color: var(--text); border-radius: 16px; width: min(560px, 100%); max-height: calc(100vh - 32px);
  overflow-y: auto; padding: 18px; display: grid; gap: 14px; box-shadow: var(--shadow); }
.sheet h2 { margin: 0; font-size: 18px; }
/* The sheet's buttons stay in reach however long its form or list of times. */
.sheet .acts { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; position: sticky; bottom: -18px; margin-bottom: -18px;
  padding: 12px 0 18px; background: var(--panel); border-top: 1px solid var(--line); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 44px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel2); font-weight: 600; font-variant-numeric: tabular-nums; }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 12px 16px;
  border-radius: 12px; z-index: 60; display: flex; gap: 12px; align-items: center; max-width: calc(100vw - 32px); box-shadow: var(--shadow); }
.toast .btn { min-height: 36px; background: transparent; color: var(--bg); border-color: currentColor; }

/* ---------- setup ---------- */
.setup { padding: 14px 16px 32px; display: grid; gap: 14px; max-width: 860px; }
.setup details { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; }
.setup summary { list-style: none; cursor: pointer; padding: 16px; min-height: 56px; display: flex; align-items: center; justify-content: space-between; gap: 12px; font-weight: 700; }
.setup summary::-webkit-details-marker { display: none; }
.setup summary small { color: var(--muted); font-weight: 400; font-size: 13px; }
.setup .body { padding: 0 16px 16px; display: grid; gap: 14px; }
.frow { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line); min-height: 52px; }
.frow > span:first-child { font-weight: 500; }
.state { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--muted); white-space: nowrap; }
/* A 44px-tall touch target around a 48x28 track. */
.switch { width: 56px; height: 44px; position: relative; border: 0; flex: none; padding: 0; background: transparent; border-radius: 999px; }
.switch::before { content: ""; position: absolute; top: 8px; inset-inline-start: 4px; width: 48px; height: 28px; border-radius: 999px; background: var(--line2); }
.switch::after { content: ""; position: absolute; top: 11px; inset-inline-start: 7px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: inset-inline-start .15s; }
.switch[aria-checked="true"]::before { background: var(--accent); }
.switch[aria-checked="true"]::after { inset-inline-start: 27px; }
.note { background: var(--panel2); border-radius: 12px; padding: 12px 14px; font-size: 13.5px; color: var(--muted); }
.item { border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: grid; gap: 12px; }
.item-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.item-head b { overflow-wrap: anywhere; }
.week { display: grid; gap: 8px; }
.wday { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 12px; align-items: start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.wday > span { font-weight: 600; padding-top: 10px; }
.wins { display: grid; gap: 8px; }
.win { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.win input[type="time"] { width: 128px; }
.qrbox { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; }
.qrbox svg { width: 168px; height: 168px; border-radius: 8px; border: 1px solid var(--line); }
.logo-preview { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; border: 1px solid var(--line); background: var(--panel2); }
#printArea { display: none; }

/* ---------- tablet and up: the mockup's side panel ---------- */
@media (min-width: 1000px) {
  .dmain.with-panel { grid-template-columns: minmax(0, 1fr) 360px; }
  /* --bar-h: the top bar's real height (it wraps to two rows on a tablet), kept by desk.js. */
  .dmain.with-panel .panel { border-inline-start: 1px solid var(--line); position: sticky; top: var(--bar-h, 69px); height: calc(100vh - var(--bar-h, 69px)); }
}
/* ---------- phone and narrow tablet: the panel is a sheet over the calendar ---------- */
@media (max-width: 999.98px) {
  .dmain .panel { position: fixed; inset: 0; z-index: 40; padding-top: 16px; }
  .panel-close { display: inline-flex; }
}
@media (max-width: 720px) {
  .dbar { gap: 10px; padding: 12px; }
  .brand { flex: 1 1 100%; }
  .prefs { margin-inline-start: auto; }
  .datenav { flex: 1 1 100%; justify-content: space-between; }
  .datelabel { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; }
  .search { width: 100%; flex: 1 1 100%; }
  .bar-actions { flex: 1 1 100%; }
  .bar-actions .btn { flex: 1 1 0; padding: 0 10px; }
  .tabs { padding: 12px 12px 0; }
  .tabs .btn { min-width: 0; flex: 1 1 0; padding: 0 10px; }
  .asof { flex: 1 1 100%; margin: 0; }
  .banners, .cal, .view, .setup { padding-inline: 12px; }
  .pair { grid-template-columns: 1fr; }
  .wday { grid-template-columns: 1fr; gap: 4px; }
  .wday > span { padding-top: 0; }
  .lrow { flex-wrap: wrap; }
  .lrow .acts { width: 100%; }
  .lrow .acts .btn { flex: 1 1 0; }
}

@media print {
  body > *:not(#printArea) { display: none !important; }
  #printArea { display: grid !important; place-items: center; gap: 16px; padding: 24px; color: #000; background: #fff; text-align: center; }
  #printArea svg { width: 9cm; height: 9cm; }
  #printArea img { width: 2.5cm; height: 2.5cm; border-radius: 50%; object-fit: cover; }
  #printArea h1 { font-size: 26pt; margin: 0; }
  #printArea p { font-size: 15pt; margin: 0; }
}
.panel p, .sheet p, .view p, .setup p, .card p { margin: 0; }
/* A row inside a card (tomorrow's list, the patient view) draws no second border: the card is the box. */
.card > .lrow { border-color: transparent; background: transparent; padding-inline: 0; }
