/* Mawid — calm clinic. Deep teal = brand; amber = pending hold; green = booked; red = handoff. */
:root {
  color-scheme: light;
  --bg: #F4F7F7; --bg2: #EAF0F0; --surface: #FFFFFF; --surface2: #F7FAFA; --ink: #0F1B24; --muted: #56656F; --faint: #8A98A2;
  --line: #DCE5E6; --line2: #C7D3D5; --brand: #0B7A75; --brand-ink: #FFFFFF; --brand-soft: #E1F2F0;
  --hold: #B7791F; --hold-soft: #FCF1DC; --ok: #1F8A52; --ok-soft: #E2F4EA; --alert: #C2412E; --alert-soft: #FBE6E2;
  --bubble-me: #0B7A75; --bubble-me-ink: #FFFFFF; --bubble-bot: #FFFFFF;
  --shadow: 0 1px 2px rgba(15, 27, 36, .05), 0 20px 44px -26px rgba(15, 27, 36, .35);
  --ui: "Tajawal", system-ui, -apple-system, "Segoe UI", sans-serif; --mono: "IBM Plex Mono", ui-monospace, monospace;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  color-scheme: dark; --bg: #0B1215; --bg2: #0F181C; --surface: #121D22; --surface2: #172429; --ink: #E6EEF0; --muted: #98A8AF; --faint: #66767D;
  --line: #213036; --line2: #2C3E45; --brand: #3CC2B8; --brand-ink: #062522; --brand-soft: #123330; --hold: #E8B04B; --hold-soft: #33280F;
  --ok: #52C98A; --ok-soft: #13301F; --alert: #F07A6A; --alert-soft: #3A1B17; --bubble-me: #1C6E69; --bubble-me-ink: #F2FBFA; --bubble-bot: #172429;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 22px 50px -26px rgba(0, 0, 0, .8); } }
:root[data-theme="dark"] {
  color-scheme: dark; --bg: #0B1215; --bg2: #0F181C; --surface: #121D22; --surface2: #172429; --ink: #E6EEF0; --muted: #98A8AF; --faint: #66767D;
  --line: #213036; --line2: #2C3E45; --brand: #3CC2B8; --brand-ink: #062522; --brand-soft: #123330; --hold: #E8B04B; --hold-soft: #33280F;
  --ok: #52C98A; --ok-soft: #13301F; --alert: #F07A6A; --alert-soft: #3A1B17; --bubble-me: #1C6E69; --bubble-me-ink: #F2FBFA; --bubble-bot: #172429;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 22px 50px -26px rgba(0, 0, 0, .8); }
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100dvh; background: var(--bg); color: var(--ink); font: 400 16px/1.6 var(--ui); }
a { color: var(--brand); }
button, input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2.5px solid var(--brand); outline-offset: 2px; border-radius: 8px; }
h1, h2, h3 { margin: 0; line-height: 1.2; text-wrap: balance; }
p { margin: 0; }
.i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }

.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 10; background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top-in { max-width: 1240px; margin: 0 auto; padding: 10px 20px; display: flex; align-items: center; gap: 14px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.mark { width: 36px; height: 36px; border-radius: 11px; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; }
.brand b { font-size: 19px; font-weight: 800; }
.brand small { display: block; font-size: 12px; color: var(--muted); line-height: 1; }
.spacer { flex: 1; }
.pill-btn { display: inline-flex; align-items: center; gap: 7px; padding: 8px 13px; border-radius: 999px; border: 1px solid var(--line2); background: var(--surface); text-decoration: none; color: var(--ink); font-size: 14px; font-weight: 500; cursor: pointer; }
.pill-btn:hover { border-color: var(--brand); color: var(--brand); }
.icon-btn { width: 38px; height: 38px; border-radius: 11px; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; cursor: pointer; font-weight: 700; }

/* patient page */
.hero-grid { max-width: 1240px; margin: 0 auto; padding: 28px 20px 48px; display: grid; grid-template-columns: minmax(0, 1fr) 460px; gap: 36px; align-items: start; }
@media (max-width: 980px) { .hero-grid { grid-template-columns: 1fr; } .pitch { order: 2; } }
.pitch { display: grid; gap: 18px; padding-top: 18px; }
.eyebrow { display: inline-flex; gap: 8px; align-items: center; font-size: 13px; font-weight: 700; color: var(--brand); background: var(--brand-soft); padding: 5px 12px; border-radius: 999px; justify-self: start; }
.pitch h1 { font-size: clamp(32px, 4.8vw, 54px); font-weight: 800; letter-spacing: -.02em; }
[dir="rtl"] .pitch h1 { letter-spacing: 0; line-height: 1.35; }
.pitch .lede { font-size: 18px; color: var(--muted); max-width: 56ch; }
.feats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .feats { grid-template-columns: 1fr; } }
.feat { padding: 14px 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); display: grid; gap: 4px; }
.feat b { display: flex; gap: 8px; align-items: center; font-size: 15px; }
.feat b .i { color: var(--brand); }
.feat span { font-size: 14px; color: var(--muted); }
.try h3 { font-size: 14px; color: var(--muted); font-weight: 700; margin-bottom: 8px; }
.try-list { display: flex; flex-wrap: wrap; gap: 8px; }
.try-list button { border: 1px solid var(--line2); background: var(--surface); border-radius: 12px; padding: 8px 12px; font-size: 14px; cursor: pointer; text-align: start; }
.try-list button:hover { border-color: var(--brand); color: var(--brand); }
.demo-note { font-size: 13px; color: var(--faint); }

.chat { position: sticky; top: 76px; height: min(760px, calc(100dvh - 100px)); display: flex; flex-direction: column; background: var(--bg2); border: 1px solid var(--line); border-radius: 28px; box-shadow: var(--shadow); overflow: hidden; }
@media (max-width: 980px) { .chat { position: static; height: 78dvh; } }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; font-weight: 800; position: relative; }
.avatar::after { content: ""; position: absolute; inset-inline-end: 0; bottom: 0; width: 11px; height: 11px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 2px var(--surface); }
.chat-head b { display: block; font-size: 15px; }
.chat-head small { color: var(--muted); font-size: 12.5px; }
.chat-head .spacer + button { font-size: 12px; }
.log { flex: 1; overflow-y: auto; padding: 16px 14px; display: flex; flex-direction: column; gap: 10px; scroll-behavior: smooth; }
.msg { max-width: 86%; padding: 10px 14px; border-radius: 18px; font-size: 15px; line-height: 1.55; white-space: pre-wrap; word-wrap: break-word; animation: pop .25s ease both; }
@keyframes pop { from { opacity: 0; transform: translateY(6px); } }
.msg.me { align-self: flex-end; background: var(--bubble-me); color: var(--bubble-me-ink); border-end-end-radius: 6px; }
.msg.bot { align-self: flex-start; background: var(--bubble-bot); border: 1px solid var(--line); border-end-start-radius: 6px; }
.msg.bot ul { margin: 6px 0; padding-inline-start: 18px; }
.meta { align-self: flex-start; font: 400 11px var(--mono); color: var(--faint); margin-top: -4px; }
.typing { align-self: flex-start; display: inline-flex; gap: 4px; padding: 12px 14px; border-radius: 18px; background: var(--bubble-bot); border: 1px solid var(--line); }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

.card { align-self: stretch; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 12px; display: grid; gap: 10px; animation: pop .25s ease both; }
.card-h { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--muted); }
.slots { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.slot { text-align: start; border: 1px solid var(--line2); background: var(--surface2); border-radius: 12px; padding: 9px 10px; cursor: pointer; display: grid; gap: 1px; transition: border-color .15s, transform .15s; }
.slot:hover { border-color: var(--brand); transform: translateY(-1px); }
.slot b { font: 600 17px var(--mono); }
.slot span { font-size: 12.5px; color: var(--muted); }
.summary { display: grid; gap: 4px; font-size: 14.5px; }
.summary div { display: flex; justify-content: space-between; gap: 10px; }
.summary div span:first-child { color: var(--muted); }
.card.hold { border-color: var(--hold); background: linear-gradient(var(--hold-soft), var(--surface) 60%); }
.card.hold .card-h { color: var(--hold); }
.card.booked { border-color: var(--ok); background: linear-gradient(var(--ok-soft), var(--surface) 60%); }
.card.booked .card-h { color: var(--ok); }
.card.handoff { border-color: var(--alert); background: var(--alert-soft); }
.card.handoff .card-h { color: var(--alert); }
.row-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 10px 14px; border-radius: 12px; border: 0; font-weight: 700; cursor: pointer; font-size: 14.5px; }
.btn.primary { background: var(--brand); color: var(--brand-ink); flex: 1; }
.btn.ghost { background: transparent; border: 1px solid var(--line2); color: var(--ink); }
.btn:disabled { opacity: .5; cursor: default; }
.countdown { font: 500 12px var(--mono); color: var(--hold); }

.quick { display: flex; gap: 6px; padding: 0 14px 8px; overflow-x: auto; scrollbar-width: none; }
.quick button { flex: none; border: 1px solid var(--line2); background: var(--surface); border-radius: 999px; padding: 6px 12px; font-size: 13.5px; cursor: pointer; }
.compose { display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px calc(12px + env(safe-area-inset-bottom, 0px)); background: var(--surface); border-top: 1px solid var(--line); }
.compose textarea { flex: 1; resize: none; border: 1px solid var(--line2); border-radius: 16px; padding: 10px 14px; background: var(--surface2); max-height: 120px; outline: none; font-size: 15px; }
.compose textarea:focus { border-color: var(--brand); }
.send { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; cursor: pointer; flex: none; }
.send:disabled { opacity: .45; }
[dir="rtl"] .send .i { transform: scaleX(-1); }
.trace { align-self: flex-start; font: 400 11px var(--mono); color: var(--faint); display: flex; flex-wrap: wrap; gap: 4px; }
.trace span { padding: 1px 6px; border-radius: 6px; border: 1px solid var(--line); }
.trace span.bad { color: var(--alert); border-color: var(--alert); }

/* dashboard */
.dash { max-width: 1240px; margin: 0 auto; padding: 24px 20px 48px; display: grid; gap: 18px; }
.dash h1 { font-size: 28px; font-weight: 800; }
.banner { padding: 10px 14px; border-radius: 12px; background: var(--brand-soft); color: var(--ink); font-size: 14px; }
.kpis { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
@media (max-width: 900px) { .kpis { grid-template-columns: repeat(2, 1fr); } }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; display: grid; gap: 2px; }
.kpi b { font: 700 28px var(--ui); font-variant-numeric: tabular-nums; }
.kpi span { font-size: 13px; color: var(--muted); }
.kpi.alert b { color: var(--alert); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 16px; box-shadow: var(--shadow); min-width: 0; }
.panel h2 { font-size: 17px; font-weight: 800; margin-bottom: 12px; display: flex; gap: 10px; align-items: center; }
.panel h2 .spacer { flex: 1; }
.two { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 18px; }
@media (max-width: 1000px) { .two { grid-template-columns: 1fr; } }
.daybar { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin-bottom: 12px; }
.daybar button { flex: none; border: 1px solid var(--line2); background: var(--surface2); border-radius: 12px; padding: 6px 10px; cursor: pointer; font-size: 13px; display: grid; justify-items: center; }
.daybar button b { font-size: 16px; }
.daybar button[aria-pressed="true"] { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.daybar button .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--hold); margin-top: 2px; }
.sched-wrap { overflow-x: auto; }
.sched { display: grid; min-width: 620px; position: relative; }
.sched .col-h { font-size: 13px; font-weight: 700; padding: 6px 8px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); }
.sched .hours { position: relative; }
.sched .hr { position: absolute; inset-inline: 0; border-top: 1px dashed var(--line); font: 400 10.5px var(--mono); color: var(--faint); padding-inline-start: 2px; }
.sched .col { position: relative; border-inline-start: 1px solid var(--line); }
.sched .off { position: absolute; inset-inline: 0; background: repeating-linear-gradient(45deg, var(--bg2) 0 6px, transparent 6px 12px); }
.appt { position: absolute; inset-inline: 4px; border-radius: 8px; padding: 3px 6px; font-size: 11.5px; line-height: 1.25; overflow: hidden; background: var(--ok-soft); border-inline-start: 3px solid var(--ok); cursor: pointer; }
.appt.held { background: var(--hold-soft); border-color: var(--hold); }
.appt b { display: block; font-size: 12px; }
.clist { display: grid; gap: 8px; max-height: 560px; overflow-y: auto; }
.citem { text-align: start; border: 1px solid var(--line); background: var(--surface2); border-radius: 12px; padding: 10px 12px; cursor: pointer; display: grid; gap: 4px; }
.citem:hover { border-color: var(--brand); }
.citem .top-row { display: flex; gap: 8px; align-items: center; }
.tag { font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--bg2); color: var(--muted); }
.tag.booked, .tag.rescheduled { background: var(--ok-soft); color: var(--ok); }
.tag.needs_human, .tag.handoff { background: var(--alert-soft); color: var(--alert); }
.tag.cancelled { background: var(--hold-soft); color: var(--hold); }
.citem p { font-size: 13.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drawer { position: fixed; top: 0; bottom: 0; inset-inline-end: 0; width: min(520px, 100vw); background: var(--surface); border-inline-start: 1px solid var(--line); box-shadow: var(--shadow); z-index: 30; display: flex; flex-direction: column; }
.drawer-h { display: flex; align-items: center; gap: 10px; padding: 16px; border-bottom: 1px solid var(--line); }
.drawer-b { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.tool { align-self: stretch; font: 400 12px var(--mono); background: var(--bg2); border: 1px dashed var(--line2); border-radius: 10px; padding: 8px 10px; white-space: pre-wrap; word-break: break-word; color: var(--muted); }
.tool b { color: var(--brand); }
.scrim { position: fixed; inset: 0; background: rgba(5, 12, 15, .35); z-index: 29; }
table.list { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.list td, table.list th { padding: 7px 6px; border-bottom: 1px solid var(--line); text-align: start; }
table.list th { color: var(--muted); font-size: 12px; }
.empty { color: var(--muted); font-size: 14px; padding: 18px; text-align: center; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
