/* Design language adapted from the DoctorHunt mobile kit, recoloured blue */
:root {
  --primary: #1f6feb;
  --primary-600: #1a5fd0;
  --primary-50: #eaf2ff;
  --primary-100: #d6e6ff;
  --grad: linear-gradient(135deg, #2f80ff 0%, #1f6feb 55%, #1757c7 100%);
  --bg: #f7f9fc;
  --surface: #ffffff;
  --ink: #222b45;
  --ink-2: #333333;
  --muted: #677294;
  --line: #e8edf5;
  --danger: #e5484d;
  --danger-soft: #fdecec;
  --warn: #b7791f;
  --warn-soft: #fff6e0;
  --ok: #1f9d55;
  --ok-soft: #e6f6ed;
  --star: #f6d060;
  --r-sm: 6px;
  --r: 12px;
  --r-lg: 20px;
  --shadow: 0 4px 18px rgba(31, 60, 120, .07);
  --shadow-lg: 0 10px 30px rgba(31, 60, 120, .12);
  --nav-h: 72px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  font-family: 'Rubik', system-ui, 'Segoe UI', Tahoma, sans-serif;
  background: var(--bg);
  color: var(--ink-2);
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
}
/* soft background blobs like the kit */
body.blobs { background:
  radial-gradient(420px 300px at 100% 0%, var(--primary-50), transparent 70%),
  radial-gradient(380px 300px at 0% 100%, #eef5ff, transparent 70%), var(--bg); background-attachment: fixed; }
a { color: var(--primary); text-decoration: none; }
h1, h2, h3, h4 { color: var(--ink); line-height: 1.3; margin: 0 0 .4em; font-weight: 500; }
h1 { font-size: 24px; } h2 { font-size: 20px; } h3 { font-size: 17px; } h4 { font-size: 15px; }
p { margin: 0 0 .8em; }
.muted { color: var(--muted); font-size: 13px; }
.hidden { display: none !important; }
svg.i { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }

/* ---------- buttons ---------- */
.btn, button {
  font: inherit; font-weight: 500;
  display: inline-flex; align-items: center; justify-content: center; gap: .45em;
  border: 0; border-radius: var(--r-sm); cursor: pointer;
  background: var(--primary); color: #fff;
  padding: 0 18px; height: 44px; white-space: nowrap;
  transition: background .15s, transform .05s;
}
.btn:hover, button:hover { background: var(--primary-600); }
.btn:active, button:active { transform: translateY(1px); }
.btn.block, button.block { width: 100%; height: 54px; font-size: 16px; }
.btn.ghost, button.ghost { background: var(--primary-50); color: var(--primary); }
.btn.ghost:hover, button.ghost:hover { background: var(--primary-100); }
.btn.outline, button.outline { background: transparent; color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.btn.link, button.link { background: none; color: var(--primary); height: auto; padding: 0; }
button.danger { background: var(--danger); }
button.small, .btn.small { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 6px; }
button.icon { width: 40px; height: 40px; padding: 0; border-radius: 10px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
button.icon:hover { background: var(--primary-50); }
button:disabled { opacity: .55; cursor: default; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ---------- forms ---------- */
label { display: block; margin-bottom: 14px; }
label > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
input, select, textarea {
  font: inherit; width: 100%; color: var(--ink-2);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm);
  height: 54px; padding: 0 16px;
}
textarea { height: auto; min-height: 96px; padding: 12px 16px; resize: vertical; }
input::placeholder, textarea::placeholder { color: #a1a9c0; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px var(--primary-50); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@media (max-width: 560px) { .grid2 { grid-template-columns: 1fr; } }
.msg { padding: 12px 14px; border-radius: var(--r-sm); margin: 12px 0; font-size: 14px; }
.msg.error { background: var(--danger-soft); color: var(--danger); }
.msg.success { background: var(--ok-soft); color: var(--ok); }
.msg.info { background: var(--primary-50); color: var(--primary-600); }

/* ---------- cards & lists ---------- */
.card { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); padding: 16px; }
.card + .card { margin-top: 12px; }
.section-title { display: flex; justify-content: space-between; align-items: center; margin: 22px 0 12px; }
.section-title h3 { margin: 0; }
.list { display: grid; gap: 10px; }
.item { display: flex; gap: 12px; align-items: center; background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); padding: 12px 14px; }
.item .grow { flex: 1; min-width: 0; }
.item .title { color: var(--ink); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .sub { color: var(--muted); font-size: 13px; }
a.item { color: inherit; }
a.item:hover { box-shadow: var(--shadow-lg); }
.avatar { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--primary-50); color: var(--primary); font-weight: 500; font-size: 17px; }
.avatar.lg { width: 72px; height: 72px; font-size: 26px; }
.empty { padding: 32px 16px; text-align: center; color: var(--muted); }

.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; background: #eef1f6; color: var(--muted); white-space: nowrap; }
.badge.pending { background: var(--warn-soft); color: var(--warn); }
.badge.confirmed, .badge.info { background: var(--primary-50); color: var(--primary); }
.badge.done, .badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.cancelled, .badge.noshow, .badge.fail, .badge.low { background: var(--danger-soft); color: var(--danger); }
.dot { display: inline-block; min-width: 20px; height: 20px; border-radius: 10px; padding: 0 6px; background: var(--danger); color: #fff; font-size: 11px; line-height: 20px; text-align: center; }

/* stats tiles */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.stat { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); padding: 14px; }
.stat .num { font-size: 24px; font-weight: 500; color: var(--primary); line-height: 1.2; }
.stat .lbl { color: var(--muted); font-size: 13px; }

/* responsive table -> cards on phones */
.table-wrap { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 12px 14px; text-align: start; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 500; font-size: 13px; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.actions { white-space: nowrap; }
td.actions button { margin-inline-end: 4px; }
.pre { white-space: pre-wrap; }
@media (max-width: 700px) {
  .table-wrap { background: none; box-shadow: none; overflow: visible; }
  table, tbody, tr, td { display: block; width: 100%; }
  thead { display: none; }
  tr { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); margin-bottom: 10px; padding: 6px 0; }
  td { border: 0; padding: 6px 14px; display: flex; justify-content: space-between; gap: 12px; }
  td::before { content: attr(data-label); color: var(--muted); font-size: 12px; flex: none; }
  td:empty { display: none; }
  td.actions { justify-content: flex-start; flex-wrap: wrap; gap: 6px; padding-top: 10px; }
  td.actions::before { display: none; }
}

/* ---------- app shell ---------- */
.shell { min-height: 100vh; padding-bottom: calc(var(--nav-h) + 16px); }
.topbar { position: sticky; top: 0; z-index: 20; background: rgba(247, 249, 252, .92); backdrop-filter: blur(8px);
  display: flex; align-items: center; gap: 10px; padding: 14px 16px; }
.topbar h2 { margin: 0; flex: 1; font-size: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.content { padding: 4px 16px 16px; max-width: 980px; margin: 0 auto; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.toolbar input, .toolbar select { height: 44px; flex: 1; min-width: 140px; }

/* hero header (home) */
.hero { background: var(--grad); color: #fff; border-radius: 0 0 var(--r-lg) var(--r-lg); padding: 22px 18px 64px; margin: -4px -16px 0; position: relative; overflow: hidden; }
.hero::after { content: ''; position: absolute; width: 220px; height: 220px; border-radius: 50%; background: rgba(255,255,255,.08); inset-inline-end: -60px; top: -80px; }
.hero .hi { opacity: .85; font-size: 14px; }
.hero h1 { color: #fff; font-size: 24px; margin: 2px 0 0; }
.hero .avatar { background: rgba(255,255,255,.2); color: #fff; position: absolute; inset-inline-end: 18px; top: 22px; }
.hero-card { margin: -44px 0 0; position: relative; z-index: 2; }

/* bottom navigation (phone) */
.bottom-nav { position: fixed; bottom: 0; inset-inline: 0; z-index: 30; height: var(--nav-h); background: var(--surface);
  box-shadow: 0 -6px 24px rgba(31, 60, 120, .08); border-radius: 18px 18px 0 0;
  display: flex; justify-content: space-around; align-items: center; padding: 0 6px env(safe-area-inset-bottom); }
.bottom-nav button { background: none; color: #9aa3bd; height: 56px; width: 56px; padding: 0; border-radius: 50%; flex-direction: column; gap: 2px; font-size: 10px; font-weight: 400; position: relative; }
.bottom-nav button:hover { background: none; color: var(--primary); }
.bottom-nav button .lbl { display: none; }
.bottom-nav button.active { color: #fff; }
.bottom-nav button.active .ic { background: var(--primary); box-shadow: 0 6px 14px rgba(31, 111, 235, .35); }
.bottom-nav .ic { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; transition: background .15s; }
.bottom-nav .dot { position: absolute; top: 4px; inset-inline-end: 4px; }

/* side rail on wide screens */
@media (min-width: 900px) {
  .shell { padding-bottom: 24px; padding-inline-start: 240px; }
  .bottom-nav { top: 0; bottom: 0; inset-inline-start: 0; inset-inline-end: auto; width: 240px; height: auto; flex-direction: column; justify-content: flex-start; align-items: stretch;
    border-radius: 0; padding: 18px 12px; gap: 4px; box-shadow: 1px 0 0 var(--line); }
  .bottom-nav .brand { display: flex !important; }
  .bottom-nav button { width: 100%; height: 46px; border-radius: 10px; flex-direction: row; justify-content: flex-start; gap: 10px; padding: 0 10px; font-size: 14px; color: var(--muted); }
  .bottom-nav button .lbl { display: inline; }
  .bottom-nav .ic { width: 30px; height: 30px; background: none !important; box-shadow: none !important; }
  .bottom-nav button.active { background: var(--primary-50); color: var(--primary); }
  .bottom-nav button.more-btn { display: none; }
  .bottom-nav button.wide-only { display: flex; }
  .bottom-nav .dot { position: static; margin-inline-start: auto; }
  .hero { margin: 0; border-radius: var(--r-lg); }
}
.bottom-nav .brand { display: none; align-items: center; gap: 10px; padding: 4px 8px 18px; color: var(--ink); font-weight: 500; }
.bottom-nav button.wide-only { display: none; }

/* sheet / modal */
.sheet-bg { position: fixed; inset: 0; z-index: 50; background: rgba(20, 30, 55, .45); display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--surface); width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; border-radius: var(--r-lg) var(--r-lg) 0 0; padding: 10px 18px 22px; animation: up .2s ease-out; }
.sheet::before { content: ''; display: block; width: 44px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 14px; }
.sheet .foot { display: flex; gap: 10px; margin-top: 8px; }
.sheet .foot button { flex: 1; height: 50px; }
@media (min-width: 700px) { .sheet-bg { align-items: center; } .sheet { border-radius: var(--r-lg); } }
@keyframes up { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }

.toast { position: fixed; bottom: calc(var(--nav-h) + 16px); left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 10px; z-index: 60; font-size: 14px; }

/* menu list (More) */
.menu { display: grid; gap: 8px; }
.menu button { justify-content: flex-start; background: var(--surface); color: var(--ink); height: 56px; border-radius: var(--r); box-shadow: var(--shadow); gap: 12px; padding: 0 16px; font-weight: 400; }
.menu button:hover { background: var(--primary-50); }
.menu button .ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--primary-50); color: var(--primary); }

/* tabs */
.tabs { display: flex; gap: 6px; overflow-x: auto; margin: 16px 0 12px; padding-bottom: 2px; scrollbar-width: none; }
.tabs button { background: var(--surface); color: var(--muted); height: 38px; border-radius: 19px; box-shadow: var(--shadow); font-weight: 400; font-size: 14px; }
.tabs button.active { background: var(--primary); color: #fff; }

/* patient file header */
.profile { display: flex; gap: 14px; align-items: center; }
.profile .meta { color: var(--muted); font-size: 13px; }
.alert-allergy { background: var(--danger-soft); color: var(--danger); padding: 10px 12px; border-radius: var(--r-sm); margin-top: 12px; font-size: 14px; display: flex; gap: 8px; align-items: flex-start; }

/* odontogram */
.odonto { display: grid; gap: 6px; direction: ltr; overflow-x: auto; padding: 4px 0 8px; }
.odonto .row { display: flex; justify-content: center; gap: 3px; min-width: max-content; }
.odonto .row.sep { border-bottom: 2px dashed var(--line); padding-bottom: 8px; margin-bottom: 2px; }
.odonto .gap { width: 12px; }
.tooth { width: 36px; min-width: 36px; height: 50px; padding: 0; border-radius: 8px 8px 14px 14px; background: #fff; color: var(--ink);
  box-shadow: inset 0 0 0 1.5px #c9d3e6; flex-direction: column; gap: 0; font-size: 12px; font-weight: 500; }
.tooth:hover { background: var(--primary-50); }
.tooth .st { font-size: 9px; font-weight: 400; }
.tooth.s-caries { background: #fde3e3; box-shadow: inset 0 0 0 1.5px #e5484d; }
.tooth.s-filled { background: #dbe8ff; box-shadow: inset 0 0 0 1.5px #1f6feb; }
.tooth.s-crown { background: #fff1c9; box-shadow: inset 0 0 0 1.5px #d4a017; }
.tooth.s-root_canal { background: #ece6ff; box-shadow: inset 0 0 0 1.5px #7c3aed; }
.tooth.s-extracted, .tooth.s-missing { background: #eceff3; box-shadow: inset 0 0 0 1.5px #8a94a6; color: #8a94a6; text-decoration: line-through; }
.tooth.s-implant { background: #d9f6fb; box-shadow: inset 0 0 0 1.5px #0891b2; }
.tooth.s-bridge { background: #fde7f2; box-shadow: inset 0 0 0 1.5px #db2777; }
.tooth.s-to_extract { background: #ffecd9; box-shadow: inset 0 0 0 1.5px #ea580c; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--muted); margin-top: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }

/* gallery */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.gallery figure { margin: 0; background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.gallery img { width: 100%; height: 130px; object-fit: cover; display: block; background: #0f172a; cursor: zoom-in; }
.gallery figcaption { padding: 8px 10px; font-size: 12px; display: flex; justify-content: space-between; align-items: center; gap: 6px; color: var(--muted); }
.viewer img { max-width: 100%; max-height: 75vh; display: block; margin: 0 auto; border-radius: var(--r-sm); }

/* chat */
.chat { display: flex; flex-direction: column; height: calc(100vh - 150px); height: calc(100dvh - 150px); }
@media (min-width: 900px) { .chat { height: calc(100dvh - 90px); } }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 4px 0 12px; }
.chat-log { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 8px 2px; }
.bubble { max-width: 78%; padding: 10px 14px; border-radius: 16px; font-size: 14px; line-height: 1.5; white-space: pre-wrap; word-wrap: break-word; }
.bubble .t { display: block; font-size: 10px; opacity: .7; margin-top: 4px; }
.bubble.me { align-self: flex-start; background: var(--primary); color: #fff; border-end-start-radius: 4px; }
.bubble.them { align-self: flex-end; background: var(--surface); color: var(--ink-2); box-shadow: var(--shadow); border-end-end-radius: 4px; }
.chat-input { display: flex; gap: 8px; align-items: center; background: var(--surface); border-radius: 28px; box-shadow: var(--shadow); padding: 6px; margin-top: 8px; }
.chat-input input { border: 0; height: 44px; box-shadow: none !important; background: transparent; }
.chat-input button { width: 44px; height: 44px; border-radius: 50%; padding: 0; flex: none; }

/* auth screens */
.auth { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 32px 22px; max-width: 440px; margin: 0 auto; }
.auth h1 { text-align: center; font-size: 24px; }
.auth .lead { text-align: center; color: var(--muted); font-size: 14px; margin-bottom: 26px; }
.auth .alt { text-align: center; margin-top: 18px; font-size: 14px; color: var(--muted); }
.auth .alt a, .auth .alt button { color: var(--primary); }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 18px; }
.seg button { background: var(--surface); color: var(--muted); box-shadow: var(--shadow); height: 48px; font-weight: 400; }
.seg button.active { background: var(--primary); color: #fff; }
.logo-mark { width: 64px; height: 64px; border-radius: 18px; background: var(--grad); display: grid; place-items: center; color: #fff; margin: 0 auto 16px; box-shadow: 0 10px 24px rgba(31, 111, 235, .3); }
.logo-mark svg { width: 34px; height: 34px; stroke: #fff; }

.code-box { font-family: ui-monospace, Consolas, monospace; font-size: 26px; letter-spacing: 3px; text-align: center; background: var(--primary-50); color: var(--primary-600); padding: 16px; border-radius: var(--r); direction: ltr; user-select: all; }

/* print */
#print-area { display: none; padding: 32px; font-size: 15px; color: #000; }
#print-area .ph { border-bottom: 2px solid #000; padding-bottom: 10px; margin-bottom: 18px; }
#print-area .ph h2 { margin: 0; color: #000; }
#print-area ol { line-height: 2; }
@media print {
  body { background: #fff !important; }
  body.printing > *:not(#print-area) { display: none !important; }
  #print-area { display: block !important; }
}

/* ================= public screens (doctor ads, account chooser) ================= */
.pub { min-height: 100vh; padding-bottom: 30px; }
.pub-top { position: sticky; top: 0; z-index: 20; display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; padding-top: calc(12px + env(safe-area-inset-top));
  background: rgba(247,249,252,.85); backdrop-filter: blur(10px); }
.pub-brand { display: flex; align-items: center; gap: 10px; font-size: 18px; color: var(--ink); }
.pub-brand b { font-weight: 500; }
.pub-brand .mark { width: 38px; height: 38px; border-radius: 12px; background: var(--grad); display: grid; place-items: center; color: #fff; box-shadow: 0 6px 16px rgba(31,111,235,.35); }
.acct-btn { height: 40px; border-radius: 20px; padding: 0 16px; font-size: 14px; box-shadow: 0 6px 16px rgba(31,111,235,.3); color: #fff; background: var(--primary); display: inline-flex; align-items: center; gap: 6px; }
.acct-btn:hover { color: #fff; }
.acct-btn svg { width: 18px; height: 18px; }
.pub-hero { position: relative; overflow: hidden; margin: 4px 16px 0; border-radius: 24px; background: var(--grad); color: #fff; padding: 26px 20px 22px; }
.pub-hero .hi { margin: 0; opacity: .85; font-size: 14px; }
.pub-hero h1 { color: #fff; font-size: 26px; margin: 2px 0 18px; position: relative; }
.pub-hero .blob { position: absolute; border-radius: 50%; background: rgba(255,255,255,.1); animation: drift 9s ease-in-out infinite; }
.pub-hero .b1 { width: 200px; height: 200px; inset-inline-start: -60px; top: -90px; }
.pub-hero .b2 { width: 120px; height: 120px; inset-inline-end: -30px; bottom: -40px; animation-delay: -4s; }
.search { position: relative; display: flex; align-items: center; gap: 8px; background: #fff; border-radius: 14px; padding: 0 14px; color: var(--muted); box-shadow: 0 10px 24px rgba(10,40,100,.18); }
.search input { border: 0; box-shadow: none !important; background: transparent; height: 50px; padding: 0; }
.pub-body { padding: 0 16px; max-width: 720px; margin: 0 auto; }
.pub-body .card + .card { margin-top: 14px; }

.carousel { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 0; border-radius: 20px; scrollbar-width: none; }
.carousel::-webkit-scrollbar { display: none; }
.ad-card { flex: 0 0 100%; scroll-snap-align: start; min-height: 150px; border-radius: 20px; padding: 18px; display: flex; justify-content: space-between; align-items: center; gap: 12px; color: #fff;
  background: linear-gradient(120deg, #0f2a5c, #1f6feb); position: relative; overflow: hidden; }
.ad-card::before { content: ''; position: absolute; width: 180px; height: 180px; border-radius: 50%; border: 24px solid rgba(255,255,255,.07); inset-inline-end: -50px; top: -60px; }
.ad-card .ad-text { display: grid; gap: 4px; position: relative; z-index: 1; }
.ad-card .ad-text b { font-size: 19px; font-weight: 500; }
.ad-card .ad-text span { opacity: .85; font-size: 13px; }
.ad-card .tag { justify-self: start; background: rgba(255,255,255,.18); padding: 2px 10px; border-radius: 10px; opacity: 1 !important; }
.btn.light, button.light { background: #fff; color: var(--primary); justify-self: start; margin-top: 6px; opacity: 1 !important; }
.ad-photo { width: 110px; height: 120px; border-radius: 18px; object-fit: cover; flex: none; position: relative; z-index: 1; box-shadow: 0 10px 24px rgba(0,0,0,.25); }
.ad-card .ph-fallback { background: rgba(255,255,255,.14); color: #fff; }
.empty-ad { justify-content: center; text-align: center; }
.empty-ad div { display: grid; gap: 4px; }
.dots { display: flex; justify-content: center; gap: 6px; margin: 10px 0 4px; }
.dots i { width: 7px; height: 7px; border-radius: 4px; background: #c9d3e6; transition: width .3s, background .3s; }
.dots i.on { width: 22px; background: var(--primary); }

.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin-top: 16px; }
.chip { height: 36px; border-radius: 18px; background: var(--surface); color: var(--muted); box-shadow: var(--shadow); font-weight: 400; font-size: 13px; flex: none; }
.chip.on { background: var(--primary); color: #fff; }

.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.doc-card { background: var(--surface); border-radius: 18px; box-shadow: var(--shadow); padding: 12px; display: grid; gap: 10px; color: inherit; animation: rise .45s both; animation-delay: var(--d, 0ms); transition: transform .2s, box-shadow .2s; }
.doc-card:active { transform: scale(.97); }
.doc-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.doc-photo { width: 100%; aspect-ratio: 1 / 1; border-radius: 14px; object-fit: cover; background: var(--primary-50); }
.ph-fallback { display: grid; place-items: center; background: linear-gradient(135deg, var(--primary-50), #f2f7ff); color: var(--primary); }
.ph-fallback svg { width: 42%; height: 42%; stroke-width: 1.4; }
.doc-info { display: grid; gap: 2px; text-align: center; }
.doc-info b { color: var(--ink); font-weight: 500; font-size: 14px; }
.doc-info .spec { color: var(--primary); font-size: 12px; }
.doc-info .city { color: var(--muted); font-size: 12px; display: inline-flex; gap: 3px; align-items: center; justify-content: center; }
.doc-info .city svg { width: 13px; height: 13px; }

.doc-hero { text-align: center; display: grid; justify-items: center; gap: 4px; margin-top: 8px; }
.doc-hero-photo { width: 120px; height: 120px; border-radius: 34px; object-fit: cover; box-shadow: 0 12px 28px rgba(31,111,235,.25); margin-bottom: 8px; animation: popin .5s both; }
.doc-hero h2 { margin: 0; }
.doc-hero .spec { color: var(--primary); }
.hero-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 10px; }
.center { text-align: center; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.choices { display: grid; gap: 12px; padding-bottom: 6px; }
.choice { height: auto; padding: 16px; justify-content: flex-start; gap: 14px; background: var(--surface); color: var(--ink); border-radius: 18px; box-shadow: inset 0 0 0 1.5px var(--line); text-align: start; animation: rise .35s both; }
.choice:nth-child(2) { animation-delay: .07s; }
.choice:hover { background: var(--primary-50); box-shadow: inset 0 0 0 1.5px var(--primary); }
.choice .ic { width: 52px; height: 52px; border-radius: 16px; background: var(--grad); color: #fff; display: grid; place-items: center; flex: none; }
.choice .txt { display: grid; gap: 2px; flex: 1; }
.choice .txt b { font-weight: 500; font-size: 16px; }
.choice .txt small { color: var(--muted); font-weight: 400; }
.choice .arrow { color: var(--muted); transform: scaleX(-1); }

/* ================= motion ================= */
.page-enter { animation: pagein .38s cubic-bezier(.2,.8,.2,1) both; }
.rise { animation: rise .45s both; }
.rise:nth-of-type(2) { animation-delay: .06s; } .rise:nth-of-type(3) { animation-delay: .12s; } .rise:nth-of-type(4) { animation-delay: .18s; }
.stagger > label { animation: rise .4s both; animation-delay: var(--d, 0ms); }
.list > *, .menu > *, .stats > * { animation: rise .4s both; }
.list > *:nth-child(2), .menu > *:nth-child(2), .stats > *:nth-child(2) { animation-delay: .05s; }
.list > *:nth-child(3), .menu > *:nth-child(3), .stats > *:nth-child(3) { animation-delay: .1s; }
.list > *:nth-child(4), .menu > *:nth-child(4), .stats > *:nth-child(4) { animation-delay: .15s; }
.list > *:nth-child(n+5), .menu > *:nth-child(n+5) { animation-delay: .2s; }
.float { animation: float 4s ease-in-out infinite; }
.pop { animation: popin .35s both; }
.shake { animation: shake .4s; }
.bubble { animation: bubble .25s ease-out both; }
.bubble.me { transform-origin: bottom left; } .bubble.them { transform-origin: bottom right; }
button, .btn { transition: background .15s, transform .12s, box-shadow .2s; }
button:active, .btn:active { transform: scale(.96); }
button.loading { position: relative; color: transparent !important; }
button.loading::after { content: ''; position: absolute; width: 20px; height: 20px; border-radius: 50%; border: 2.5px solid #fff; border-top-color: transparent; animation: spin .7s linear infinite; }
.bottom-nav button.active .ic { animation: navpop .35s; }
.skeleton { position: relative; overflow: hidden; min-height: 190px; background: #e9eef6 !important; box-shadow: none !important; }
.skeleton.tall { min-height: 320px; margin-top: 10px; }
.skeleton::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,.6), transparent); animation: shimmer 1.2s infinite; }
.stat, .item { transition: transform .2s, box-shadow .2s; }
a.stat:active, a.item:active { transform: scale(.98); }
@keyframes pagein { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(16px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes popin { 0% { opacity: 0; transform: scale(.8); } 70% { transform: scale(1.04); } 100% { opacity: 1; transform: none; } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes drift { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(14px, 10px); } }
@keyframes shake { 0%, 100% { transform: none; } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
@keyframes bubble { from { opacity: 0; transform: scale(.85); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes navpop { 0% { transform: scale(.7); } 60% { transform: scale(1.12); } 100% { transform: none; } }
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* splash */
#splash { position: fixed; inset: 0; z-index: 100; background: var(--grad); display: grid; place-items: center; transition: opacity .4s, visibility .4s; }
#splash.gone { opacity: 0; visibility: hidden; }
#splash .in { display: grid; justify-items: center; gap: 14px; color: #fff; animation: popin .6s both; }
#splash .m { width: 86px; height: 86px; border-radius: 26px; background: rgba(255,255,255,.18); display: grid; place-items: center; }
#splash svg { width: 50px; height: 50px; stroke: #fff; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
#splash b { font-size: 24px; font-weight: 500; letter-spacing: .5px; }

/* ================= native app feel ================= */
html, body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; overscroll-behavior-y: none; touch-action: manipulation; }
input, textarea, select, .pre, .bubble, .code-box, [contenteditable] { -webkit-user-select: text; user-select: text; }
img { -webkit-user-drag: none; }
@media (hover: none) {
  .doc-card:hover, a.item:hover, .menu button:hover, .choice:hover { transform: none; box-shadow: var(--shadow); background: var(--surface); }
}
.slide-fwd { animation: slidefwd .32s cubic-bezier(.2,.8,.2,1) both; }
.slide-back { animation: slideback .32s cubic-bezier(.2,.8,.2,1) both; }
@keyframes slidefwd { from { opacity: .4; transform: translateX(-28%); } to { opacity: 1; transform: none; } }
@keyframes slideback { from { opacity: .4; transform: translateX(28%); } to { opacity: 1; transform: none; } }
.sheet-bg { animation: fadein .2s both; }
.sheet-bg.closing { animation: fadeout .2s both; }
.sheet-bg.closing .sheet { animation: down .2s both; }
.sheet { transition: transform .15s; overscroll-behavior: contain; padding-bottom: calc(22px + env(safe-area-inset-bottom)); }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeout { from { opacity: 1; } to { opacity: 0; } }
@keyframes down { to { transform: translateY(100%); } }
.loading-page { display: grid; gap: 12px; }
.loading-page .skeleton { min-height: 120px; }

/* area picker */
.area-btn { margin-top: 12px; height: 40px; border-radius: 20px; background: rgba(255,255,255,.16); color: #fff; font-weight: 400; font-size: 14px; position: relative; gap: 6px; padding: 0 14px; }
.area-btn:hover { background: rgba(255,255,255,.24); }
.area-btn svg { width: 17px; height: 17px; }
.area-btn svg:last-child { transform: rotate(90deg); opacity: .8; }
.area-list { display: grid; gap: 6px; max-height: 55vh; overflow-y: auto; overscroll-behavior: contain; }
.area-row { justify-content: space-between; background: var(--bg); color: var(--ink); height: 50px; border-radius: 12px; font-weight: 400; }
.area-row:hover { background: var(--primary-50); }
.area-row.on { background: var(--primary); color: #fff; }
.area-row small { color: inherit; opacity: .7; }

/* doctor list rows */
.doc-list { display: grid; gap: 10px; }
.doc-row { display: flex; align-items: center; gap: 12px; background: var(--surface); border-radius: 18px; box-shadow: var(--shadow); padding: 10px; cursor: pointer; animation: rise .4s both; animation-delay: var(--d, 0ms); transition: transform .15s; }
.doc-row:active { transform: scale(.98); }
.doc-row.skeleton { min-height: 92px; }
.doc-thumb { width: 72px; height: 72px; border-radius: 16px; object-fit: cover; flex: none; }
.doc-row .grow { display: grid; gap: 2px; min-width: 0; }
.doc-row b { color: var(--ink); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-row .spec { color: var(--primary); font-size: 13px; }
.doc-row .city { color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 3px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.doc-row .city svg { width: 13px; height: 13px; flex: none; }
.book-btn { height: 38px; border-radius: 19px; padding: 0 18px; flex: none; }
.ad-card { cursor: pointer; }

/* booking sheet */
.book .lbl { font-size: 13px; color: var(--muted); margin: 14px 0 8px; }
.book-doc { display: flex; gap: 12px; align-items: center; background: var(--primary-50); border-radius: 16px; padding: 10px; }
.book-photo { width: 52px; height: 52px; border-radius: 14px; object-fit: cover; flex: none; }
.book-doc b { color: var(--ink); font-weight: 500; }
.day-row { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; overscroll-behavior-x: contain; }
.day-row::-webkit-scrollbar { display: none; }
.day { flex: none; width: 62px; height: 70px; flex-direction: column; gap: 2px; border-radius: 16px; background: var(--bg); color: var(--ink); font-weight: 400; box-shadow: inset 0 0 0 1px var(--line); }
.day small { font-size: 11px; color: var(--muted); }
.day b { font-size: 19px; font-weight: 500; }
.day:hover { background: var(--primary-50); }
.day.on { background: var(--primary); color: #fff; box-shadow: 0 8px 18px rgba(31,111,235,.3); }
.day.on small { color: rgba(255,255,255,.85); }
.time-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.slot { height: 38px; padding: 0; border-radius: 10px; background: var(--bg); color: var(--ink); font-weight: 400; font-size: 13px; box-shadow: inset 0 0 0 1px var(--line); direction: ltr; }
.slot:hover { background: var(--primary-50); }
.slot.on { background: var(--primary); color: #fff; box-shadow: none; }
.book label { margin-top: 12px; margin-bottom: 0; }
.success { text-align: center; padding: 10px 0 4px; }
.success .check { width: 92px; height: 92px; margin: 0 auto 14px; }
.success svg { width: 92px; height: 92px; }
.success circle { fill: var(--ok-soft); stroke: var(--ok); stroke-width: 2; stroke-dasharray: 152; stroke-dashoffset: 152; animation: draw .5s .05s forwards; }
.success path { fill: none; stroke: var(--ok); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 40; stroke-dashoffset: 40; animation: draw .35s .45s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.sticky-cta { position: sticky; bottom: 0; padding: 12px 0 calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--bg) 30%); margin-top: 6px; }
.sticky-cta button { box-shadow: 0 10px 24px rgba(31,111,235,.35); }

/* doctor home promo */
.card.promo { display: flex; align-items: center; gap: 12px; margin-top: 18px; color: inherit; }
.card.promo .ic { width: 46px; height: 46px; border-radius: 14px; background: var(--grad); color: #fff; display: grid; place-items: center; flex: none; }
.card.promo b { color: var(--ink); font-weight: 500; }
.card.promo .arrow { color: var(--muted); transform: scaleX(-1); }

/* inside the Android app: no web splash, solid backgrounds */
.in-app #splash { display: none; }
.in-app body.blobs { background-attachment: scroll; }
