/* fastdoc — shared styles. Mobile-first. Light + dark. LTR + RTL (ar). */
:root {
  --ink: #0f1729;
  --ink-2: #45506b;
  --ink-3: #7a869f;
  --line: #e6e8ef;
  --surface: #ffffff;
  --surface-2: #f5f6fa;
  --surface-3: #eef0f6;
  --accent: #0aa88a;          /* fastdoc mint — distinct from the sister sites */
  --accent-ink: #05715c;
  --accent-soft: #daf3ee;
  --danger: #d64545;
  --danger-soft: #fdecec;
  --amber: #b6791f;
  --amber-soft: #fdf1dc;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 8px 24px rgba(16, 24, 40, .06);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --maxw: 480px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #eef1f8; --ink-2: #b3bdd4; --ink-3: #7f8bA6;
    --line: #26304a; --surface: #0e1626; --surface-2: #131d31; --surface-3: #1a2745;
    --accent: #24c3a3; --accent-ink: #9beedd; --accent-soft: #123b34;
    --danger: #f2857f; --danger-soft: #3a1f1f;
    --amber: #e0b05f; --amber-soft: #3a2f18;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.4);
  }
}
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--surface-2);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
[dir="rtl"] { direction: rtl; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font-family: inherit; font-size: 16px; color: inherit; }
a { color: var(--accent-ink); }
img { max-width: 100%; display: block; }

/* ─── app shell ─── */
.app {
  max-width: var(--maxw);
  margin: 0 auto;
  min-height: 100dvh;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  position: relative;
}
.topbar {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: -.02em; font-size: 17px; }
.brand .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); flex: none; }
.brand small { font-weight: 500; color: var(--ink-3); font-size: 12px; }
#tagline { display: none; }
@media (min-width: 460px) { #tagline { display: inline; } }
.topbar .spacer { flex: 1; }
.lang-select {
  appearance: none; -webkit-appearance: none;
  background: var(--surface-3); color: var(--ink); border: 1px solid var(--line);
  border-radius: 999px; padding: 6px 26px 6px 12px; font-size: 12px; font-weight: 600;
  max-width: 40vw; text-overflow: ellipsis;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237a869f' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center;
}
[dir="rtl"] .lang-select { padding: 6px 12px 6px 26px; background-position: left 9px center; }
.lang-select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ─── status card ─── */
.status {
  margin: 12px; padding: 14px 16px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow);
}
.status.state-waiting { border-color: var(--accent); background: linear-gradient(0deg, var(--accent-soft), transparent 60%); }
.status.state-claimed { border-color: var(--accent); }
.status.state-delivered { border-color: var(--accent); background: var(--accent-soft); }
.status.state-declined, .status.state-expired { border-color: var(--line); background: var(--surface-2); }
.status h2 { font-size: 15px; display: flex; align-items: center; gap: 8px; }
.status p { font-size: 13px; color: var(--ink-2); margin-top: 4px; }
.status .pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  padding: 3px 8px; border-radius: 999px; background: var(--surface-3); color: var(--ink-3);
}
.status .clock { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--accent-ink); }
.status .docs { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.status .docs a {
  display: flex; align-items: center; gap: 8px; text-decoration: none;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink); font-size: 13px; font-weight: 600;
}
.hold-note { display: flex; gap: 8px; align-items: flex-start; font-size: 12px; color: var(--ink-2); margin-top: 8px; }
.hold-note svg { flex: none; margin-top: 1px; }

/* ─── web push opt-in card (shown while WAITING / CLAIMED) ─── */
.push-card {
  margin: 0 12px 12px; padding: 12px 14px;
  border: 1px dashed var(--accent); border-radius: var(--radius); background: var(--surface);
  font-size: 13px;
}
.push-card h3 { font-size: 14px; display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.push-card p { color: var(--ink-2); margin-bottom: 8px; line-height: 1.45; }
.push-card p:last-child { margin-bottom: 0; }
.push-card .cta { padding: 10px; font-size: 14px; margin-top: 2px; }
.push-card.on { border-style: solid; background: var(--accent-soft); }
.push-card.on h3 { color: var(--accent-ink); margin-bottom: 0; }

.redflag {
  margin: 0 12px 12px; padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--danger-soft); border: 1px solid var(--danger);
  font-size: 12.5px; color: var(--danger); display: flex; gap: 8px;
}

/* ─── chat ─── */
.thread {
  flex: 1; overflow-y: auto;
  padding: 8px 12px 16px;
  display: flex; flex-direction: column; gap: 8px;
  scroll-behavior: smooth;
}
.day-sep { text-align: center; font-size: 11px; color: var(--ink-3); margin: 8px 0; }
.msg { max-width: 82%; padding: 9px 12px; border-radius: 16px; font-size: 14px; white-space: pre-wrap; word-wrap: break-word; }
.msg.them { align-self: flex-start; background: var(--surface-3); border-bottom-left-radius: 5px; }
.msg.me { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 5px; }
[dir="rtl"] .msg.them { border-bottom-left-radius: 16px; border-bottom-right-radius: 5px; }
[dir="rtl"] .msg.me { border-bottom-right-radius: 16px; border-bottom-left-radius: 5px; }
.msg .who { display: block; font-size: 11px; font-weight: 700; margin-bottom: 3px; opacity: .8; }
.msg.them.doctor { background: var(--ink); color: #fff; }
.msg.photo { padding: 4px; background: var(--surface-3); }
.msg.photo img { border-radius: 12px; max-height: 260px; object-fit: cover; }
.msg .t { display: block; font-size: 10px; opacity: .6; margin-top: 4px; text-align: end; }
.typing { align-self: flex-start; display: flex; gap: 4px; padding: 12px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); animation: blink 1.2s infinite both; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 60%, 100% { opacity: .25; } 30% { opacity: 1; } }

/* ─── composer ─── */
.composer {
  position: sticky; bottom: 0;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line); background: var(--surface);
  display: flex; flex-direction: column; gap: 8px;
}
.intake-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  font-size: 12px; font-weight: 600; padding: 7px 11px; border-radius: 999px;
  background: var(--surface-3); color: var(--ink-2); border: 1px solid transparent;
}
.chip.on { background: var(--accent-soft); color: var(--accent-ink); border-color: var(--accent); }
.composer-row { display: flex; align-items: flex-end; gap: 8px; }
.composer textarea {
  flex: 1; resize: none; border: 1px solid var(--line); border-radius: 20px;
  padding: 10px 14px; max-height: 120px; background: var(--surface-2); outline: none;
}
.composer textarea:focus { border-color: var(--accent); }
.icon-btn {
  width: 42px; height: 42px; border-radius: 50%; flex: none;
  display: grid; place-items: center; background: var(--surface-3); color: var(--ink-2);
}
.icon-btn.send { background: var(--accent); color: #fff; }
.icon-btn:disabled { opacity: .4; }
.cta {
  width: 100%; padding: 13px; border-radius: 12px; background: var(--accent); color: #fff;
  font-weight: 700; font-size: 15px; display: flex; align-items: center; justify-content: center; gap: 8px;
}
.cta.secondary { background: var(--surface-3); color: var(--ink); }
.cta:disabled { opacity: .5; }
.hint { font-size: 11px; color: var(--ink-3); text-align: center; }
.hint a { color: var(--ink-3); text-decoration: underline; }

/* ─── sheet (send / sign-in) ─── */
.sheet-wrap { position: fixed; inset: 0; background: rgba(4, 10, 22, .5); display: none; z-index: 50; }
.sheet-wrap.open { display: block; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0;
  max-width: var(--maxw); margin: 0 auto;
  background: var(--surface); border-radius: 20px 20px 0 0; padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
  box-shadow: var(--shadow);
}
.sheet h3 { font-size: 17px; }
.sheet p { font-size: 13px; color: var(--ink-2); margin: 6px 0 14px; }
.sheet label { display: block; font-size: 12px; font-weight: 700; color: var(--ink-2); margin: 10px 0 5px; }
.sheet input {
  width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); outline: none;
}
.sheet input:focus { border-color: var(--accent); }
.sheet .price { font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.sheet .muted { color: var(--ink-3); font-size: 12px; }
.oauth-row { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.oauth-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 11px; border: 1px solid var(--line); border-radius: 10px; font-weight: 600; font-size: 14px; background: var(--surface);
}
.oauth-btn.apple { background: #000; color: #fff; border-color: #000; }
.err { color: var(--danger); font-size: 12.5px; margin-top: 8px; }
.consent { display: flex; align-items: flex-start; gap: 9px; font-size: 12.5px; color: var(--ink-2); cursor: pointer; line-height: 1.4; }
.consent input { flex: none; margin-top: 2px; width: 16px; height: 16px; accent-color: var(--accent); }
.consent a { color: var(--accent-ink); font-weight: 600; }

/* ─── doctor dashboard ─── */
.doc { max-width: 900px; margin: 0 auto; padding: 0 0 40px; }
.doc-top { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 20; }
.doc-grid { display: grid; grid-template-columns: 320px 1fr; gap: 0; min-height: calc(100dvh - 56px); }
@media (max-width: 760px) { .doc-grid { grid-template-columns: 1fr; } .doc-case.empty { display: none; } }
.queue { border-right: 1px solid var(--line); background: var(--surface-2); overflow-y: auto; }
.queue h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); padding: 14px 16px 6px; }
.qcard { padding: 12px 16px; border-bottom: 1px solid var(--line); cursor: pointer; }
.qcard:hover { background: var(--surface-3); }
.qcard.active { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.qcard .m { font-weight: 600; font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.qcard .meta { display: flex; gap: 8px; align-items: center; font-size: 11.5px; color: var(--ink-3); margin-top: 4px; }
.qcard .wait { font-variant-numeric: tabular-nums; font-weight: 700; }
.qcard .wait.warn { color: var(--amber); } .qcard .wait.hot { color: var(--danger); }
.qcard .rf { color: var(--danger); font-weight: 700; }
.doc-case { padding: 20px 22px; overflow-y: auto; }
.doc-case.empty { display: grid; place-items: center; color: var(--ink-3); font-size: 14px; }
.case-h { display: flex; align-items: flex-start; gap: 12px; justify-content: space-between; }
.case-h h2 { font-size: 18px; }
.case-sub { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.panel { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); padding: 14px 16px; margin-top: 14px; }
.panel h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); margin-bottom: 8px; }
.kv { font-size: 13.5px; margin: 3px 0; } .kv b { color: var(--ink-2); font-weight: 600; }
.case-photo { border-radius: 10px; border: 1px solid var(--line); max-height: 320px; width: auto; }
.mini-thread { display: flex; flex-direction: column; gap: 6px; max-height: 280px; overflow-y: auto; }
.mini-thread .m { font-size: 13px; padding: 7px 10px; border-radius: 10px; max-width: 88%; }
.mini-thread .m.them { align-self: flex-start; background: var(--surface-3); }
.mini-thread .m.me { align-self: flex-end; background: var(--accent-soft); }
.mini-thread .m.concierge { align-self: flex-start; background: var(--surface-2); border: 1px dashed var(--line); }
.rx-kinds { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.rx-kinds button { font-size: 12px; font-weight: 600; padding: 6px 10px; border-radius: 8px; background: var(--surface-3); color: var(--ink-2); }
.rx-kinds button.on { background: var(--accent); color: #fff; }
.doc-case textarea { width: 100%; min-height: 120px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--surface-2); resize: vertical; }
.rx-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.rx-item { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; }
.rx-item .k { font-weight: 700; text-transform: uppercase; font-size: 10px; letter-spacing: .04em; color: var(--accent-ink); }
.rx-item a { margin-inline-start: auto; }
.actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.btn { padding: 11px 16px; border-radius: 10px; font-weight: 700; font-size: 14px; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.ghost { background: var(--surface-3); color: var(--ink); }
.btn.danger { background: var(--danger-soft); color: var(--danger); }
.btn:disabled { opacity: .5; }
.login-box { max-width: 340px; margin: 12vh auto; padding: 24px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); }
.login-box input { width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 10px; margin: 12px 0; background: var(--surface-2); }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: 20px; background: var(--ink); color: var(--surface); padding: 10px 16px; border-radius: 999px; font-size: 13px; z-index: 80; opacity: 0; transition: opacity .2s; }
.toast.show { opacity: 1; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
