/* Levitate Clinic — a phone-first working tool for reception, therapists and the owner.
   Layout: one column of task cards, top bar + bottom tab bar on phones, side rail on wide screens. */
:root {
  --bg: #f3f6f6;
  --surface: #ffffff;
  --surface-2: #e9efef;
  --line: #d5dfdf;
  --ink: #142326;
  --muted: #5b6c70;
  --accent: #0d6b66;
  --accent-ink: #ffffff;
  --accent-soft: #d6ecea;
  --ok: #1f7a3f;
  --ok-soft: #dcf1e2;
  --warn: #9a5b00;
  --warn-soft: #fbecd2;
  --bad: #b3261e;
  --bad-soft: #f9dedb;
  --info-soft: #e1e8f5;
  --shadow: 0 1px 2px rgba(20, 35, 38, .06), 0 4px 14px rgba(20, 35, 38, .05);
  --font-ui: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, system-ui, sans-serif;
  --font-display: "Readex Pro", "IBM Plex Sans Arabic", "Segoe UI", system-ui, sans-serif;
  --font-num: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --r: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1617; --surface: #152022; --surface-2: #1c2a2c; --line: #2a3b3e; --ink: #e4eeee; --muted: #93a7aa;
    --accent: #4fb8ae; --accent-ink: #062321; --accent-soft: #163b38; --ok: #6fcf8f; --ok-soft: #173524;
    --warn: #f0b45a; --warn-soft: #3b2c12; --bad: #ff8a80; --bad-soft: #43201d; --info-soft: #1d2a40;
    --shadow: 0 1px 2px rgba(0,0,0,.4); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1617; --surface: #152022; --surface-2: #1c2a2c; --line: #2a3b3e; --ink: #e4eeee; --muted: #93a7aa;
  --accent: #4fb8ae; --accent-ink: #062321; --accent-soft: #163b38; --ok: #6fcf8f; --ok-soft: #173524;
  --warn: #f0b45a; --warn-soft: #3b2c12; --bad: #ff8a80; --bad-soft: #43201d; --info-soft: #1d2a40;
  --shadow: 0 1px 2px rgba(0,0,0,.4); color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font-ui); -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.25; margin: 0; text-wrap: balance; }
h1 { font-size: 1.35rem; } h2 { font-size: 1.1rem; } h3 { font-size: .98rem; }
a { color: var(--accent); }
.num, .code { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.code { font-size: .85em; letter-spacing: .02em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.hidden { display: none !important; }

/* shell */
.shell { min-height: 100%; display: flex; flex-direction: column; }
.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; font-family: var(--font-display); font-weight: 600; }
.brand-mark { width: 26px; height: 26px; border-radius: 8px; background: var(--accent); display: grid; place-items: center; color: var(--accent-ink); font-size: 15px; }
.topbar .spacer { flex: 1; }
.who { font-size: .82rem; color: var(--muted); text-align: end; line-height: 1.2; }
.main { flex: 1; width: 100%; max-width: 980px; margin: 0 auto; padding: 16px 16px 96px; display: flex; flex-direction: column; gap: 14px; }
.tabs { position: fixed; inset-inline: 0; bottom: 0; z-index: 20; display: flex; background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px); }
.tabs button { flex: 1; border: 0; background: none; padding: 8px 2px 9px; display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: .72rem; color: var(--muted); cursor: pointer; position: relative; }
.tabs button svg { width: 22px; height: 22px; }
.tabs button[aria-current="page"] { color: var(--accent); font-weight: 600; }
.badge { position: absolute; top: 4px; inset-inline-start: calc(50% + 6px); background: var(--bad); color: #fff; border-radius: 9px; font-size: .66rem;
  min-width: 17px; height: 17px; padding: 0 4px; display: grid; place-items: center; font-family: var(--font-num); }
@media (min-width: 900px) {
  .shell { flex-direction: row; flex-wrap: wrap; }
  .topbar { width: 100%; }
  .tabs { position: sticky; top: 60px; align-self: flex-start; flex-direction: column; width: 190px; border: 0; background: none; padding: 16px 8px; gap: 2px; }
  .tabs button { flex-direction: row; justify-content: flex-start; gap: 10px; padding: 10px 12px; border-radius: 10px; font-size: .9rem; }
  .tabs button[aria-current="page"] { background: var(--accent-soft); }
  .badge { position: static; margin-inline-start: auto; }
  .main { padding-bottom: 32px; }
}

/* blocks */
.head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.head h1, .head h2 { flex: 1; min-width: 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.card.flat { box-shadow: none; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat .label { font-size: .78rem; color: var(--muted); letter-spacing: .02em; }
.stat .value { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-size: 1.35rem; font-weight: 600; }
.stat .sub { font-size: .8rem; color: var(--muted); }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.list { display: flex; flex-direction: column; }
.item { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--line); min-width: 0; }
.item:first-child { border-top: 0; padding-top: 2px; }
.item .grow { flex: 1; min-width: 0; }
.item .time { font-family: var(--font-num); font-weight: 600; min-width: 52px; }
.item.clickable { cursor: pointer; }
.title { font-weight: 600; overflow-wrap: anywhere; }
.meta { font-size: .84rem; color: var(--muted); overflow-wrap: anywhere; }
.alert { border-radius: 10px; padding: 10px 12px; font-size: .9rem; display: flex; gap: 8px; align-items: flex-start; }
.alert.warn { background: var(--warn-soft); color: var(--warn); }
.alert.bad { background: var(--bad-soft); color: var(--bad); }
.alert.ok { background: var(--ok-soft); color: var(--ok); }
.alert.info { background: var(--info-soft); }
.sev { border-inline-start: 4px solid var(--line); padding-inline-start: 10px; }
.sev.alert-sev { border-color: var(--bad); } .sev.warn-sev { border-color: var(--warn); } .sev.info-sev { border-color: var(--accent); }

/* chips */
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: .75rem; font-weight: 600;
  background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.chip.booked { background: var(--info-soft); color: var(--ink); }
.chip.arrived { background: var(--warn-soft); color: var(--warn); }
.chip.done, .chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.no_show, .chip.cancelled, .chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.accent { background: var(--accent-soft); color: var(--accent); }

/* controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: var(--surface);
  border-radius: 10px; padding: 8px 14px; min-height: 40px; cursor: pointer; font-weight: 500; white-space: nowrap; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.danger { color: var(--bad); }
.btn.small { min-height: 32px; padding: 4px 10px; font-size: .84rem; }
.btn.block { width: 100%; }
.btn.wa { color: var(--ok); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field label { font-size: .8rem; color: var(--muted); font-weight: 500; }
.input, select.input, textarea.input { width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 9px 11px; min-height: 42px; }
textarea.input { min-height: 80px; resize: vertical; }
.form { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.form .full { grid-column: 1 / -1; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; flex-wrap: wrap; }
.seg button { border: 0; background: var(--surface); padding: 8px 12px; cursor: pointer; min-height: 40px; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips button { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 5px 12px; cursor: pointer; font-size: .85rem; }
.chips button[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.check { display: flex; align-items: center; gap: 8px; padding: 6px 0; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

/* tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th, td { text-align: start; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .74rem; color: var(--muted); font-weight: 600; letter-spacing: .03em; }
td.n, th.n { unicode-bidi: plaintext; text-align: end; font-family: var(--font-num); font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.void td { color: var(--muted); text-decoration: line-through; }
.total-row td { font-weight: 700; border-bottom: 0; }

/* sheet (modal) */
.sheet-bg { position: fixed; inset: 0; background: rgba(10, 20, 22, .45); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--bg); width: 100%; max-width: 640px; max-height: 92%; overflow-y: auto; border-radius: 16px 16px 0 0;
  padding: 16px 16px calc(20px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 12px; }
@media (min-width: 700px) { .sheet-bg { align-items: center; } .sheet { border-radius: 16px; } }
.toast { position: fixed; inset-inline: 16px; bottom: calc(80px + env(safe-area-inset-bottom, 0px)); z-index: 60; max-width: 420px; margin: 0 auto;
  background: var(--ink); color: var(--bg); padding: 11px 14px; border-radius: 10px; font-size: .9rem; box-shadow: var(--shadow); pointer-events: none; }
.toast.bad { background: var(--bad); color: #fff; }

/* bars chart */
.bars { direction: ltr; display: flex; align-items: flex-end; gap: 3px; height: 120px; padding-top: 8px; }
.bars div { flex: 1; background: var(--accent); opacity: .85; border-radius: 3px 3px 0 0; min-height: 2px; position: relative; }
.bars div.below { background: var(--warn); }
.target-line { position: relative; direction: ltr; }
.target-line .line { position: absolute; inset-inline: 0; border-top: 1px dashed var(--bad); }
.target-line .line span { position: absolute; inset-inline-end: 0; top: -18px; font-size: .7rem; color: var(--bad); background: var(--surface); padding: 0 4px; }
.meter { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.meter > div { height: 100%; background: var(--accent); }

/* stars */
.stars { display: flex; gap: 6px; justify-content: center; direction: ltr; }
.stars button { border: 0; background: none; font-size: 40px; line-height: 1; color: var(--line); cursor: pointer; padding: 2px; }
.stars button.on { color: #e3a008; }

/* login */
.center { min-height: 100%; display: grid; place-items: center; padding-block: 24px; padding-inline: 16px; }
.login { width: 100%; max-width: 380px; }
.demo-pick { display: grid; gap: 8px; }
.demo-pick button { text-align: start; justify-content: flex-start; padding: 12px 14px; min-height: 56px; }
.demo-banner { background: var(--warn-soft); color: var(--warn); font-size: .78rem; text-align: center; padding: 4px 16px; }

@media (prefers-reduced-motion: no-preference) { .sheet { animation: up .18s ease-out; } @keyframes up { from { transform: translateY(24px); opacity: .6; } } }

/* ── v2: booking, pricing, patient file, report, public booking ── */
.linkbtn { border: 0; padding: 0; background: none; cursor: pointer; text-align: start; color: inherit; min-width: 0; }
.linkbtn .title { text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
.item.pick { border-inline: 0; border-bottom: 0; background: none; text-align: start; width: 100%; }
.alert.clickable { cursor: pointer; font: inherit; color: inherit; }
.daychips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.daychips button { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 0; min-width: 54px; padding: 6px 8px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer; }
.daychips button span { font-size: .72rem; color: var(--muted); }
.daychips button strong { font-family: var(--font-num); font-size: 1.05rem; }
.daychips button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.daychips button[aria-pressed="true"] span { color: var(--accent-ink); }
.slotgroup { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 6px; }
.slots button { border: 1px solid var(--accent); color: var(--accent); background: var(--surface); border-radius: 10px; min-height: 42px;
  font-family: var(--font-num); font-variant-numeric: tabular-nums; cursor: pointer; font-weight: 600; }
.slots button:disabled { border-color: var(--line); color: var(--muted); background: var(--surface-2); text-decoration: line-through; cursor: not-allowed; font-weight: 400; }
.slots button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.quotes { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.quote { border: 1px solid var(--line); border-radius: var(--r); padding: 12px; display: flex; flex-direction: column; gap: 2px; background: var(--surface); }
.quote .value { font-family: var(--font-num); font-size: 1.3rem; font-weight: 600; }
.quote.best { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.quote .save { color: var(--ok); font-weight: 600; font-size: .85rem; }
.quote .btn { margin-top: 6px; }
.casecard { border-top: 1px solid var(--line); padding-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.casecard:first-of-type { border-top: 0; padding-top: 0; }
.casecard.closed { opacity: .7; }
.kvgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px 16px; }
.kv { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.kv > span:first-child { font-size: .76rem; color: var(--muted); }
.kv > span:last-child { overflow-wrap: anywhere; white-space: pre-wrap; }
.modgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 12px; }
.hoursrow { display: grid; grid-template-columns: minmax(110px, 1fr) minmax(0, 1fr) auto minmax(0, 1fr); gap: 8px; align-items: center; }
.hoursrow select { min-height: 38px; padding: 4px 8px; }
.codebox { background: var(--surface-2); border-radius: 10px; padding: 10px; font-family: var(--font-num); font-size: .78rem; white-space: pre-wrap; word-break: break-all; margin: 0; }
.stepn { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: var(--accent-ink);
  font-size: .8rem; margin-inline-end: 8px; font-family: var(--font-num); vertical-align: 2px; }
.choice { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; }
.choice button { border: 1px solid var(--line); background: var(--surface); border-radius: var(--r); padding: 12px; text-align: start; cursor: pointer;
  display: flex; flex-direction: column; gap: 2px; min-height: 64px; }
.choice button[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: var(--accent-soft); }
.hp { position: absolute; inset-inline-start: -9999px; width: 1px; height: 1px; overflow: hidden; }
.pub { max-width: 640px; margin: 0 auto; padding-block: 16px 40px; padding-inline: 16px; display: flex; flex-direction: column; gap: 12px; }
.pub-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.pub-head h1 { font-size: 1.15rem; }

/* printable medical report (A4 look) */
.paper { background: #fff; color: #111; border: 1px solid var(--line); border-radius: 4px; padding: 28px 26px; display: flex; flex-direction: column; gap: 12px;
  font-family: "IBM Plex Sans Arabic", Tahoma, sans-serif; line-height: 1.8; max-width: 760px; margin: 0 auto; width: 100%; }
.paper-head { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 2px solid #111; padding-bottom: 10px; gap: 12px; }
.paper-brand { display: flex; flex-direction: column; direction: ltr; text-align: left; }
.paper-brand strong { font-family: "Readex Pro", sans-serif; letter-spacing: .12em; font-size: 1.2rem; }
.paper-brand span { font-size: .8rem; }
.paper-tax { font-size: .82rem; text-align: right; }
.paper-title { text-align: center; font-size: 1.15rem; margin: 6px 0; font-family: "Readex Pro", sans-serif; }
.paper p { margin: 0; }
.paper-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.paper-table th, .paper-table td { border: 1px solid #999; padding: 4px 8px; text-align: center; color: #111; }
.paper-table th { background: #f1f1f1; color: #111; font-size: .85rem; }
.paper-sign { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.sigline { font-size: .82rem; color: #1f5f3a; }
.paper-foot { display: flex; justify-content: space-between; border-top: 1px solid #999; padding-top: 8px; font-size: .78rem; gap: 10px; flex-wrap: wrap; }
@media print {
  .topbar, .tabs, .demo-banner, .no-print, .toast { display: none !important; }
  body, .main { background: #fff !important; padding: 0 !important; }
  .paper { border: 0; padding: 0; max-width: none; }
}
.alert svg { width: 20px; height: 20px; flex: none; }
.pricetable td { vertical-align: top; }
.pricetable tr.clickable { cursor: pointer; }
.pricetable tr.clickable:hover td { background: var(--surface-2); }
.pricetable tr.selrow td { background: var(--accent-soft); }
.pricetable .grouprow td { font-family: var(--font-display); font-weight: 600; color: var(--accent); padding-top: 14px; border-bottom: 2px solid var(--accent-soft); }
@media (max-width: 600px) {
  .pricetable thead { display: none; }
  .pricetable tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
  .pricetable td { border: 0; padding: 2px 0; }
  .pricetable td:first-child, .pricetable .grouprow td { grid-column: 1 / -1; }
  .pricetable td.n { text-align: start; font-weight: 600; }
  .pricetable td.n::before { content: attr(data-label); display: block; font-family: var(--font-ui); font-weight: 400; font-size: .72rem; color: var(--muted); }
}
