/* Kasr Alainy Staff — one stylesheet, four color themes, RTL/LTR via logical properties. */

:root, [data-theme="nile"] {
  --primary: #0B4F6C; --primary-ink: #073A50; --primary-tint: #E3EFF2;
  --accent: #D9A441; --on-accent: #2A1C03;
  --hero-1: #0B4F6C; --hero-2: #0E6585; --hero-line: #E9C46A;
}
[data-theme="kasr"] {
  --primary: #8C1D2A; --primary-ink: #6A1520; --primary-tint: #F6E8EA;
  --accent: #1F3A5F; --on-accent: #FFFFFF;
  --hero-1: #7A1824; --hero-2: #9B2433; --hero-line: #F1D3A8;
}
[data-theme="emerald"] {
  --primary: #0F6B4B; --primary-ink: #0A4F37; --primary-tint: #E4F2EC;
  --accent: #D4A72C; --on-accent: #241A00;
  --hero-1: #0B5A3F; --hero-2: #127A55; --hero-line: #F0D27A;
}
[data-theme="indigo"] {
  --primary: #2E3A87; --primary-ink: #222B68; --primary-tint: #E8EAF6;
  --accent: #F2A541; --on-accent: #2B1800;
  --hero-1: #26306F; --hero-2: #36449A; --hero-line: #F7C77E;
}
:root {
  --bg: #F3F6F7; --surface: #FFFFFF; --ink: #15232A; --muted: #5A6A72; --line: #DCE4E7; --line-strong: #C5D1D5;
  --ok: #157347; --ok-tint: #E2F3EA; --warn: #9A5B00; --warn-tint: #FFF2D9; --bad: #B42318; --bad-tint: #FDECEA;
  --star: #E8A317; --wa: #1F9D55;
  --r-sm: 6px; --r: 10px; --r-lg: 16px;
  --font: "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  --topbar-h: 64px; --bottomnav-h: 64px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { overflow-x: clip; margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.6; color: var(--ink); background: var(--bg); min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; outline: none; }
h1, h2, h3 { line-height: 1.3; margin: 0 0 .6em; font-weight: 700; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.25rem; } .h3, h3 { font-size: 1.05rem; font-weight: 600; margin-top: 1.5em; }
p { margin: 0 0 1em; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
button { font: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.skip { position: absolute; inset-inline-start: -999px; top: 0; background: var(--surface); padding: 8px 12px; z-index: 100; }
.skip:focus { inset-inline-start: 8px; }
.container { width: 100%; max-width: 1180px; margin-inline: auto; padding-inline: 20px; }
.narrow { max-width: 680px; padding-block: 28px; }
.muted { color: var(--muted); } .small { font-size: .875rem; } .center { text-align: center; }
.ic { width: 20px; height: 20px; flex: none; vertical-align: middle; }
[dir="rtl"] .ic[data-flip] { transform: scaleX(-1); }
.page-loading { padding: 80px 20px; text-align: center; color: var(--muted); }
.empty { text-align: center; padding: 48px 16px; color: var(--muted); }
.empty h1 { color: var(--ink); }

/* ---------- buttons & form controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 18px; border-radius: var(--r-sm); border: 1px solid transparent; font-weight: 600; font-size: .95rem; text-decoration: none !important; white-space: nowrap; transition: background .15s, border-color .15s; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-ink); }
.btn-accent { background: var(--accent); color: var(--on-accent); }
.btn-accent:hover { filter: brightness(.95); }
.btn-ghost { background: var(--surface); color: var(--primary); border-color: var(--line-strong); }
.btn-ghost:hover { border-color: var(--primary); }
.btn-danger-ghost { background: transparent; color: var(--bad); border-color: transparent; }
.btn-danger-ghost:hover { background: var(--bad-tint); }
.btn-wa { background: var(--wa); color: #fff; }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: .85rem; }
.btn-lg { min-height: 50px; font-size: 1.05rem; }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent; color: inherit; }
.icon-btn:hover { background: rgba(0,0,0,.06); }
.text-btn { display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; color: inherit; font-weight: 600; padding: 8px; }

input, select, textarea { font: inherit; width: 100%; min-height: 44px; padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); color: var(--ink); }
textarea { resize: vertical; min-height: 88px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-tint); }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; min-height: 0; accent-color: var(--primary); }
.form { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; }
.field-label { font-size: .9rem; font-weight: 600; }
.hint { color: var(--muted); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.form-error { color: var(--bad); min-height: 1em; margin: 0; font-size: .9rem; }
.note { background: var(--primary-tint); padding: 10px 14px; border-radius: var(--r-sm); font-size: .9rem; margin: 0; }
.notice { background: var(--warn-tint); color: var(--warn); padding: 12px 16px; border-radius: var(--r); margin-bottom: 18px; font-weight: 500; }
.check { display: flex; align-items: center; gap: 10px; padding: 5px 0; cursor: pointer; }
fieldset { border: 0; padding: 0; margin: 0 0 18px; }
legend { font-weight: 700; margin-bottom: 6px; padding: 0; }
.switch { display: flex; align-items: center; gap: 12px; cursor: pointer; padding: 6px 0; }
.switch input { position: absolute; opacity: 0; }
.switch .track { width: 44px; height: 26px; border-radius: 13px; background: var(--line-strong); position: relative; flex: none; transition: background .2s; }
.switch .track::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: inset-inline-start .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + .track { background: var(--primary); }
.switch input:checked + .track::after { inset-inline-start: 21px; }
.switch input:focus-visible + .track { outline: 3px solid var(--accent); outline-offset: 2px; }
.switch input:disabled + .track { opacity: .5; }
.choice { display: grid; gap: 10px; }
.choice-card { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border: 1px solid var(--line-strong); border-radius: var(--r); cursor: pointer; }
.choice-card:has(input:checked) { border-color: var(--primary); background: var(--primary-tint); }
.choice-card input { margin-top: 4px; }
.choice-card small { display: block; color: var(--muted); }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 40; background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-inner { height: var(--topbar-h); display: flex; align-items: center; gap: 24px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 700; font-size: 1.1rem; text-decoration: none !important; }
.brand-mark { width: 30px; height: 44px; flex: none; background: var(--primary); -webkit-mask: url(/img/ka-tower.png) center / contain no-repeat; mask: url(/img/ka-tower.png) center / contain no-repeat; }
.brand-text { display: grid; line-height: 1.2; }
.brand-text small { font-size: .7rem; font-weight: 500; color: var(--muted); }
.topnav { display: flex; gap: 4px; }
.topnav a { color: var(--ink); padding: 8px 12px; border-radius: var(--r-sm); font-weight: 500; text-decoration: none; }
.topnav a:hover, .topnav a.active { color: var(--primary); background: var(--primary-tint); }
.topbar-actions { margin-inline-start: auto; display: flex; align-items: center; gap: 6px; }
.menu-wrap { position: relative; }
.menu { position: absolute; top: calc(100% + 6px); inset-inline-end: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 6px; min-width: 180px; box-shadow: 0 10px 30px rgba(10,30,40,.14); z-index: 50; }
.theme-opt { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; background: none; border-radius: var(--r-sm); text-align: start; color: var(--ink); }
.theme-opt:hover { background: var(--bg); }
.swatch { width: 22px; height: 22px; border-radius: 50%; flex: none; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line-strong); }
.sw-nile { background: linear-gradient(135deg, #0B4F6C 55%, #D9A441 55%); }
.sw-kasr { background: linear-gradient(135deg, #8C1D2A 55%, #1F3A5F 55%); }
.sw-emerald { background: linear-gradient(135deg, #0F6B4B 55%, #D4A72C 55%); }
.sw-indigo { background: linear-gradient(135deg, #2E3A87 55%, #F2A541 55%); }

/* ---------- bottom nav (phones) ---------- */
.bottomnav { display: none; }

/* ---------- hero ---------- */
.hero { background: linear-gradient(160deg, var(--hero-1), var(--hero-2)); color: #fff; overflow: hidden; }
.hero-inner { position: relative; padding-block: 56px 56px; display: grid; gap: 28px; }
.hero-copy { max-width: 620px; position: relative; z-index: 1; }
.hero h1 { font-size: clamp(1.9rem, 4vw, 2.9rem); margin-bottom: .35em; letter-spacing: -.01em; }
.hero p { font-size: 1.1rem; opacity: .88; margin: 0; }
.hero-tower { position: absolute; inset-inline-end: 4%; bottom: 0; width: 230px; height: 108%; background: var(--hero-line); opacity: .28; pointer-events: none; -webkit-mask: url(/img/ka-tower.png) bottom center / contain no-repeat; mask: url(/img/ka-tower.png) bottom center / contain no-repeat; }
.searchbox { position: relative; z-index: 1; display: flex; background: var(--surface); border-radius: var(--r); padding: 6px; gap: 0; box-shadow: 0 14px 40px rgba(0,0,0,.18); max-width: 960px; }
.sb-field { display: flex; align-items: center; gap: 8px; padding-inline: 12px; flex: 1 1 0; min-width: 0; color: var(--muted); border-inline-end: 1px solid var(--line); }
.sb-field.sb-grow { flex: 1.4 1 0; border-inline-end: 0; }
.sb-field select, .sb-field input { border: 0; padding-inline: 0; box-shadow: none !important; background: transparent; color: var(--ink); min-height: 48px; }
.sb-btn { min-height: 52px; padding-inline: 30px; font-size: 1.05rem; }
.searchbox-compact { box-shadow: none; border: 1px solid var(--line); }
.searchbox-compact .sb-btn { min-height: 46px; }
.searchbox-compact .sb-field select, .searchbox-compact .sb-field input { min-height: 44px; }

/* ---------- sections ---------- */
.section { padding-block: 40px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.section-head h1, .section-head h2 { margin: 0; }
.spec-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.spec { display: grid; justify-items: center; text-align: center; gap: 4px; padding: 20px 10px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); color: var(--ink); text-decoration: none !important; }
.spec:hover { border-color: var(--primary); }
.spec-ic { font-size: 1.8rem; width: 56px; height: 56px; display: grid; place-items: center; border-radius: 50%; background: var(--primary-tint); margin-bottom: 4px; }
.spec-name { font-weight: 600; font-size: .95rem; line-height: 1.35; }
.spec small { color: var(--muted); }
.how { background: var(--surface); border-block: 1px solid var(--line); }
.steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; }
.steps li { display: flex; gap: 14px; align-items: flex-start; }
.steps p { margin: 0; color: var(--muted); }
.step-n { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--primary); color: #fff; font-weight: 700; flex: none; }
.featured { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(210px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x mandatory; }
.mini-doc { scroll-snap-align: start; display: grid; justify-items: center; text-align: center; gap: 4px; padding: 20px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); color: var(--ink); text-decoration: none !important; }
.mini-doc:hover { border-color: var(--primary); }
.mini-doc .muted { font-size: .85rem; }
.mini-doc .fee { font-weight: 700; color: var(--primary); }
.join-band { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 28px 32px; border-radius: var(--r-lg); background: var(--primary-tint); border: 1px solid var(--line); }
.join-band p { margin: 0; color: var(--muted); }

/* ---------- avatars, stars, badges ---------- */
.avatar { border-radius: 50%; object-fit: cover; flex: none; background: var(--primary-tint); }
.avatar-initials { display: inline-grid; place-items: center; color: var(--primary); font-weight: 700; }
.avatar-sm { width: 36px; height: 36px; font-size: .8rem; }
.avatar-md { width: 52px; height: 52px; }
.avatar-lg { width: 76px; height: 76px; font-size: 1.4rem; }
.avatar-xl { width: 104px; height: 104px; font-size: 1.8rem; }
.avatar-xxl { width: 136px; height: 136px; font-size: 2.4rem; }
.stars { color: #D3DADD; letter-spacing: 1px; font-size: 1.05rem; line-height: 1; }
.stars .on { color: var(--star); }
.stars.sm { font-size: .9rem; }
.rating-line { display: inline-flex; align-items: center; gap: 8px; }
.rating-line small { color: var(--muted); }
.title-chip { display: inline-block; font-size: .78rem; font-weight: 600; color: var(--primary); background: var(--primary-tint); padding: 1px 8px; border-radius: 4px; vertical-align: middle; }
.badge { display: inline-block; font-size: .78rem; font-weight: 600; padding: 2px 9px; border-radius: 99px; background: var(--bg); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.st-pending { background: var(--warn-tint); color: var(--warn); border-color: transparent; }
.st-confirmed, .st-completed { background: var(--ok-tint); color: var(--ok); border-color: transparent; }
.st-cancelled, .st-no_show { background: var(--bad-tint); color: var(--bad); border-color: transparent; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 22px; margin-bottom: 16px; }

/* ---------- search ---------- */
.search-top { background: var(--surface); border-bottom: 1px solid var(--line); padding-block: 14px; }
.search-layout { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 24px; padding-block: 24px 40px; align-items: start; }
.filters { position: sticky; top: calc(var(--topbar-h) + 16px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px; max-height: calc(100vh - var(--topbar-h) - 32px); overflow-y: auto; }
.filters-head { display: flex; justify-content: space-between; align-items: center; }
.filter-actions { display: grid; gap: 8px; }
.results-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.results-head h1 { margin: 0; font-size: 1.3rem; }
.results-tools { display: flex; gap: 8px; align-items: center; }
.sort { display: flex; align-items: center; gap: 8px; font-size: .9rem; color: var(--muted); white-space: nowrap; }
.sort select { min-height: 38px; width: auto; }
.res-list { display: grid; gap: 14px; }
.doc-card { display: grid; grid-template-columns: minmax(0, 1fr) 300px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.doc-main { display: flex; gap: 18px; padding: 20px; }
.doc-info { min-width: 0; display: grid; gap: 4px; align-content: start; }
.doc-name { font-size: 1.15rem; font-weight: 700; color: var(--ink); }
.doc-headline { margin: 0; color: var(--muted); font-size: .92rem; }
.doc-facts { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 6px; font-size: .92rem; }
.doc-facts li { display: flex; gap: 8px; align-items: flex-start; }
.doc-facts .ic { color: var(--primary); width: 18px; height: 18px; margin-top: 3px; }
.doc-book { border-inline-start: 1px solid var(--line); background: #FAFCFC; padding: 16px; display: grid; align-content: center; gap: 10px; }
.mini-slots { display: grid; gap: 10px; }
.ms-days { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--surface); }
.ms-day + .ms-day { border-inline-start: 1px solid var(--line); }
.ms-head { background: var(--primary); color: #fff; text-align: center; font-size: .8rem; font-weight: 600; padding: 6px 2px; }
.ms-times { display: grid; gap: 4px; padding: 6px; }
.ms-times a { text-align: center; font-size: .82rem; padding: 4px 2px; border-radius: 4px; background: var(--primary-tint); color: var(--primary); font-weight: 600; text-decoration: none; }
.ms-times a:hover { background: var(--primary); color: #fff; }
.ms-times .more { background: transparent; text-decoration: underline; }
.ms-times .none { text-align: center; color: var(--muted); padding: 6px 0; }
.contact-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.contact-btns.col { flex-direction: column; }
.pager { display: flex; gap: 6px; justify-content: center; margin-top: 20px; flex-wrap: wrap; }
.pager button { min-width: 40px; height: 40px; border: 1px solid var(--line-strong); background: var(--surface); border-radius: var(--r-sm); }
.pager .current { background: var(--primary); color: #fff; border-color: var(--primary); }
.only-sm { display: none !important; }

/* ---------- doctor page ---------- */
.doc-page { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 24px; padding-block: 28px 48px; align-items: start; }
.doc-hero { display: flex; gap: 24px; align-items: flex-start; }
.doc-hero h1 { font-size: 1.5rem; margin-bottom: .2em; }
.doc-hero p { margin: 0 0 .3em; }
.social { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.social a { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line-strong); color: var(--primary); }
.social a:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.facts-strip { display: grid; grid-template-columns: 1fr 1fr 2fr; padding: 0; overflow: hidden; }
.facts-strip > div { padding: 16px 18px; display: grid; gap: 2px; align-content: start; }
.facts-strip > div + div { border-inline-start: 1px solid var(--line); }
.facts-strip .ic { color: var(--primary); }
.facts-strip span { color: var(--muted); font-size: .85rem; }
.prose { white-space: normal; max-width: 70ch; margin: 0; }
.book-col { position: sticky; top: calc(var(--topbar-h) + 16px); }
.book-panel { padding: 0; overflow: hidden; }
.book-panel h2 { background: var(--primary); color: #fff; margin: 0; padding: 14px 20px; font-size: 1.05rem; }
.book-panel > p, .book-panel > .contact-btns, .book-panel > #slotPicker { padding: 16px 20px; margin: 0; }
.book-panel > p + .contact-btns { padding-top: 0; }
.day-tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x proximity; }
.day-tabs button { flex: none; scroll-snap-align: start; display: grid; text-align: center; min-width: 84px; padding: 8px 6px; border: 1px solid var(--line-strong); background: var(--surface); border-radius: var(--r); color: var(--ink); }
.day-tabs button small { color: var(--muted); font-size: .78rem; }
.day-tabs button.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.day-tabs button.on small { color: rgba(255,255,255,.8); }
.day-tabs button.empty:not(.on) { opacity: .6; }
.time-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.time { text-align: center; padding: 9px 4px; border-radius: var(--r-sm); border: 1px solid var(--primary); color: var(--primary); font-weight: 600; font-size: .9rem; text-decoration: none !important; }
.time:hover { background: var(--primary); color: #fff; }
.time.taken { border-color: var(--line); color: #A9B4B8; text-decoration: line-through !important; background: var(--bg); }
.reviews { list-style: none; margin: 0; padding: 0; }
.reviews li { padding: 14px 0; border-bottom: 1px solid var(--line); }
.reviews.panel li { padding-inline: 4px; }
.reviews li:last-child { border-bottom: 0; }
.reviews li p { margin: 6px 0 0; }
.rv-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rating-big { display: flex; align-items: center; gap: 8px; }
.rating-big strong { font-size: 1.6rem; color: var(--ink); }
.review-form { display: grid; gap: 10px; padding: 16px; background: var(--bg); border-radius: var(--r); margin-bottom: 8px; }
.star-input { display: inline-flex; flex-direction: row-reverse; justify-content: flex-end; gap: 2px; margin: 0; }
.star-input legend { width: 100%; }
.star-input input { position: absolute; opacity: 0; }
.star-input label { font-size: 1.8rem; color: #D3DADD; cursor: pointer; line-height: 1; }
.star-input input:checked ~ label, .star-input label:hover, .star-input label:hover ~ label { color: var(--star); }
.star-input input:focus-visible + label { outline: 2px solid var(--accent); border-radius: 4px; }
[dir="ltr"] .star-input { flex-direction: row-reverse; }

/* ---------- booking ---------- */
.book-summary { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; align-items: center; }
.book-summary dl { grid-column: 1 / -1; margin: 10px 0 4px; display: grid; gap: 10px; }
.book-summary dl > div { display: flex; justify-content: space-between; gap: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.book-summary dt { color: var(--muted); display: flex; gap: 6px; align-items: center; }
.book-summary dd { margin: 0; font-weight: 600; text-align: end; }
.done { text-align: center; padding: 40px 24px; }
.done-ic { display: inline-grid; place-items: center; width: 72px; height: 72px; border-radius: 50%; background: var(--ok-tint); color: var(--ok); margin-bottom: 12px; }
.done-ic .ic { width: 38px; height: 38px; stroke-width: 2.4; }
.auth { max-width: 460px; padding-block: 40px; }
.auth.wide { max-width: 760px; }

/* ---------- ads ---------- */
.ad-wrap:empty { display: none; }
.ad-wrap { margin-block: 16px; }
.ad { display: flex; align-items: stretch; gap: 0; border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; background: var(--surface); color: var(--ink); text-decoration: none !important; }
.ad:hover { border-color: var(--line-strong); }
.ad img { width: 34%; max-width: 260px; object-fit: cover; aspect-ratio: 2 / 1; }
.ad-body { display: grid; align-content: center; gap: 2px; padding: 14px 20px; }
.ad-body span:last-child { color: var(--muted); font-size: .92rem; }
.ad-tag { font-size: .72rem; font-weight: 600; color: var(--muted); border: 1px solid var(--line-strong); border-radius: 4px; padding: 0 6px; justify-self: start; }
.ad-tile { flex-direction: column; }
.ad-tile img { width: 100%; max-width: none; }
.ad-thumb { width: 72px; border-radius: 6px; }
.ad-preview { max-width: 260px; border-radius: var(--r); }
.ad-img { position: relative; display: block; width: 100%; margin-inline: auto; border-radius: var(--r-lg); overflow: hidden; background: var(--surface); border: 1px solid var(--line); }
.ad-img img { display: block; width: 100%; height: 100%; object-fit: cover; }
.ad-img .ad-tag { position: absolute; inset-block-start: 6px; inset-inline-start: 6px; background: rgba(255,255,255,.88); color: #444; border-color: transparent; }
.ad-size { font-weight: 600; }
.ad-size-warn { color: var(--danger, #b42318); }

/* ---------- portals ---------- */
.portal { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 24px; padding-block: 28px 48px; align-items: start; }
.portal-nav { position: sticky; top: calc(var(--topbar-h) + 16px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 10px; }
.portal-id { padding: 10px 12px 14px; border-bottom: 1px solid var(--line); margin-bottom: 8px; display: grid; overflow-wrap: anywhere; }
.tabs { display: grid; gap: 2px; }
.tabs a { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: var(--r-sm); color: var(--ink); font-weight: 500; text-decoration: none; }
.tabs a:hover { background: var(--bg); }
.tabs a.on { background: var(--primary-tint); color: var(--primary); font-weight: 600; }
.tabs .ic { width: 18px; height: 18px; }
.portal-body { min-width: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; display: grid; }
.stat strong { font-size: 1.8rem; line-height: 1.2; color: var(--primary); }
.stat span { color: var(--muted); font-size: .88rem; }
.stat.hot { border-color: var(--accent); background: #FFFAF0; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { padding: 11px 14px; text-align: start; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-size: .82rem; color: var(--muted); font-weight: 600; background: #FAFCFC; white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
td.acts { display: table-cell; text-align: end; white-space: nowrap; }
.row-hot td { background: #FFFBF2; }
.dim { opacity: .55; }
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 4px; gap: 4px; margin-bottom: 16px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 7px 14px; border-radius: var(--r-sm); color: var(--ink); font-weight: 500; }
.seg button.on { background: var(--primary); color: #fff; }
.appt { display: flex; gap: 14px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; margin-bottom: 12px; }
.appt-main { flex: 1; display: grid; gap: 2px; min-width: 0; }
.appt-when { font-weight: 600; display: flex; gap: 6px; align-items: center; margin-top: 4px; }
.appt-side { display: grid; gap: 8px; justify-items: end; }
.week { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; margin-bottom: 4px; }
.wday { margin: 0; padding: 16px; }
.wday-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.period { display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 8px; align-items: end; padding: 10px 0; border-top: 1px solid var(--line); }
.period label { font-size: .78rem; color: var(--muted); display: grid; gap: 2px; }
.period input { min-height: 38px; padding: 4px 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 12px; border-radius: 99px; background: var(--primary-tint); font-size: .88rem; }
[dir="rtl"] .chip { padding: 4px 12px 4px 6px; }
.chip button { border: 0; background: transparent; width: 24px; height: 24px; border-radius: 50%; font-size: 1.1rem; line-height: 1; color: var(--primary); }
.inline-form { display: flex; gap: 8px; max-width: 360px; }
.sticky-save { position: sticky; bottom: 12px; display: flex; justify-content: flex-end; margin-top: 16px; z-index: 5; pointer-events: none; }
.sticky-save .btn { pointer-events: auto; box-shadow: 0 6px 18px rgba(10,30,40,.18); }
.photo-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.row-form { display: grid; grid-template-columns: 1fr 1fr 80px auto auto; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.row-form:has(.icon-in) { grid-template-columns: 64px 1fr 1fr 80px auto auto; }
.new-row { background: var(--bg); margin: -8px -8px 8px; padding: 8px; border-radius: var(--r); }
.new-row .row-form { border: 0; }
.icon-in { text-align: center; font-size: 1.2rem; }

/* ---------- external reviews ---------- */
.src-ic { width: 32px; height: 32px; border-radius: 8px; display: inline-grid; place-items: center; font-weight: 700; color: #fff; flex: none; font-size: 1rem; }
.src-google { background: #4285F4; } .src-facebook { background: #1877F2; } .src-other { background: var(--muted); }
.ext-head { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.ext-title { flex: 1; min-width: 200px; display: grid; gap: 2px; }
.ext-head .acts { align-items: center; }
.err-line { color: var(--bad); }
.switch.sm { font-size: .85rem; gap: 8px; padding: 0; }
.ext-summary { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.ext-summary input { width: 120px; min-height: 36px; }
.ext-add { margin-top: 12px; }
.ext-add summary { cursor: pointer; color: var(--primary); font-weight: 600; padding: 6px 0; }
.ext-add .form { padding: 12px; background: var(--bg); border-radius: var(--r); margin-top: 6px; }
.acts.start { justify-content: flex-start; margin-top: 6px; }
.inline-form.wide { max-width: 560px; }
.g-results { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 8px; }
.g-results li { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r); }
.g-results li > div { display: grid; }
.ext-public { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.ext-public .h3 { margin-top: 0; }
.ext-chips { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.ext-chip { display: flex; gap: 10px; align-items: center; padding: 8px 14px 8px 8px; border: 1px solid var(--line); border-radius: var(--r); color: var(--ink); text-decoration: none !important; }
[dir="rtl"] .ext-chip { padding: 8px 8px 8px 14px; }
a.ext-chip[href]:hover { border-color: var(--primary); }
.ext-chip > span:last-child { display: grid; line-height: 1.35; }
.ext-chip small { color: var(--muted); }
.src-tag { font-size: .74rem; font-weight: 600; padding: 1px 8px; border-radius: 4px; color: #fff; }

/* ---------- footer & toast ---------- */
.footer { background: var(--surface); border-top: 1px solid var(--line); padding-block: 28px; margin-top: 24px; }
.footer-inner { display: grid; grid-template-columns: 1fr auto; gap: 14px 24px; align-items: center; }
.footer-brand { display: flex; gap: 12px; align-items: center; }
.footer-brand img { height: 64px; width: auto; }
.footer-brand .fl-ka { height: 72px; }
.footer-brand > div { padding-inline-start: 8px; border-inline-start: 1px solid var(--line); }
.footer-brand p { margin: 0; color: var(--muted); font-size: .9rem; }
.footer-links { display: flex; gap: 18px; flex-wrap: wrap; }
.footer small { grid-column: 1 / -1; color: var(--muted); }
.toast { position: fixed; z-index: 90; inset-inline: 0; margin-inline: auto; bottom: 24px; width: fit-content; max-width: calc(100% - 32px); padding: 12px 20px; border-radius: var(--r); background: var(--ink); color: #fff; font-weight: 500; opacity: 0; transform: translateY(12px); transition: opacity .25s, transform .25s; }
.toast.show { opacity: 1; transform: none; }
.toast-err { background: var(--bad); }

/* ================= TABLET ================= */
@media (max-width: 1024px) {
  .doc-card { grid-template-columns: minmax(0, 1fr); }
  .doc-book { border-inline-start: 0; border-top: 1px solid var(--line); }
  .doc-page { grid-template-columns: minmax(0, 1fr); }
  .book-col { position: static; order: -1; }
  .doc-page .doc-col { display: contents; }
  .doc-page .doc-hero, .doc-page .clinics-pub { order: -2; }
}

/* ================= PHONE ================= */
@media (max-width: 760px) {
  :root { --topbar-h: 56px; }
  body { padding-bottom: calc(var(--bottomnav-h) + env(safe-area-inset-bottom)); }
  h1 { font-size: 1.35rem; }
  .container { padding-inline: 16px; }
  .topnav, .hide-sm, .footer { display: none !important; }
  .only-sm { display: inline-flex !important; }
  .brand-text span { font-size: .98rem; }
  .brand-text small { display: none; }
  .brand-mark { width: 24px; height: 36px; }
  .lang-btn span { font-size: .9rem; }
  .bottomnav { display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; inset-inline: 0; bottom: 0; z-index: 45; background: var(--surface); border-top: 1px solid var(--line); height: calc(var(--bottomnav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); }
  .bottomnav a { display: grid; justify-items: center; align-content: center; gap: 2px; color: var(--muted); font-size: .72rem; font-weight: 500; text-decoration: none; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; padding-inline: 2px; }
  .bottomnav a span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  .bottomnav a.active { color: var(--primary); font-weight: 700; }
  .bottomnav .ic { width: 24px; height: 24px; }

  .hero-inner { padding-block: 28px 32px; }
  .hero p { font-size: 1rem; }
  .hero-tower { width: 150px; height: 230px; top: 6px; bottom: auto; inset-inline-end: -24px; opacity: .16; -webkit-mask-position: top center; mask-position: top center; }
  .searchbox { flex-direction: column; padding: 8px; }
  .sb-field { border-inline-end: 0; border-bottom: 1px solid var(--line); }
  .sb-field.sb-grow { border-bottom: 0; }
  .sb-btn { margin-top: 6px; }
  .search-top { padding-block: 10px; }
  .searchbox-compact { flex-direction: row; flex-wrap: wrap; }
  .searchbox-compact .sb-field:not(.sb-grow) { display: none; }
  .searchbox-compact .sb-grow { flex: 1; }
  .searchbox-compact .sb-btn { margin: 0; padding-inline: 16px; }

  .section { padding-block: 28px; }
  .spec-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .spec { padding: 12px 6px; }
  .spec-ic { width: 44px; height: 44px; font-size: 1.4rem; }
  .spec-name { font-size: .8rem; }
  .spec small { display: none; }
  .steps { grid-template-columns: 1fr; gap: 16px; }
  .join-band { flex-direction: column; align-items: stretch; text-align: center; padding: 22px; }

  .search-layout { grid-template-columns: minmax(0, 1fr); padding-top: 14px; }
  .filters { display: none; position: fixed; inset: 0; z-index: 60; border-radius: 0; max-height: none; border: 0; padding: 18px 16px calc(24px + env(safe-area-inset-bottom)); }
  .filters.open { display: block; }
  .filters .ad-wrap { display: none; }
  .results-head h1 { font-size: 1.1rem; }
  .sort { font-size: 0; gap: 0; }
  .sort select { font-size: .88rem; max-width: 160px; }
  .doc-main { padding: 16px; gap: 12px; }
  .doc-main .avatar-xl { width: 72px; height: 72px; font-size: 1.3rem; }
  .doc-name { font-size: 1.02rem; }
  .doc-facts { font-size: .86rem; }
  .doc-book { padding: 12px; }

  .doc-page { padding-block: 14px 32px; gap: 12px; }
  .doc-hero { flex-direction: column; align-items: center; text-align: center; padding: 18px; }
  .doc-hero .avatar-xxl { width: 104px; height: 104px; font-size: 1.8rem; }
  .doc-hero .social, .doc-hero .rating-line { justify-content: center; }
  .facts-strip { grid-template-columns: 1fr 1fr; }
  .facts-strip > div:last-child { grid-column: 1 / -1; border-inline-start: 0; border-top: 1px solid var(--line); }
  .time-grid { grid-template-columns: repeat(3, 1fr); }
  .panel { padding: 16px; border-radius: var(--r); }
  .grid2 { grid-template-columns: 1fr; }
  .ad img { width: 38%; }
  .ad-body { padding: 10px 14px; font-size: .9rem; }

  .portal { grid-template-columns: minmax(0, 1fr); padding-block: 0 24px; gap: 14px; }
  .portal-nav { position: sticky; top: var(--topbar-h); z-index: 20; border-radius: 0; border-inline: 0; border-top: 0; margin-inline: -16px; padding: 0; }
  .portal-id { display: none; }
  .tabs { display: flex; overflow-x: auto; gap: 0; padding: 0 8px; scrollbar-width: none; }
  .tabs a { flex: none; border-radius: 0; padding: 12px 12px; border-bottom: 2px solid transparent; font-size: .9rem; }
  .tabs a.on { background: transparent; border-bottom-color: var(--primary); }
  .tabs .ic { display: none; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat strong { font-size: 1.5rem; }
  /* tables become stacked cards on phones */
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .table td { border: 0; padding: 3px 0; }
  .table td[data-l]::before { content: attr(data-l) ": "; color: var(--muted); font-size: .82rem; }
  td.acts { display: flex; justify-content: flex-start; padding-top: 8px; white-space: normal; }
  .appt { flex-wrap: wrap; }
  .appt-side { width: 100%; grid-auto-flow: column; justify-content: start; align-items: center; }
  .week { grid-template-columns: 1fr; }
  .period { grid-template-columns: 1fr 1fr; }
  .period label:nth-child(3) { grid-column: 1; }
  .row-form, .row-form:has(.icon-in) { grid-template-columns: 1fr 1fr; }
  .row-form .icon-in, .row-form .sort-in { grid-column: span 1; }
  .sticky-save { bottom: calc(var(--bottomnav-h) + 10px); }
  .sticky-save .btn { width: 100%; }
  .toast { bottom: calc(var(--bottomnav-h) + 16px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- documents ---------- */
.step-h { display: flex; align-items: center; gap: 10px; margin: 0; }
.step-n.sm { width: 28px; height: 28px; font-size: .9rem; }
.doc-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.doc-row { display: flex; gap: 14px; justify-content: space-between; align-items: flex-start; padding: 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.doc-row.has { border-color: var(--ok); background: #F6FBF8; }
.doc-info { display: grid; gap: 4px; min-width: 0; flex: 1; }
.doc-title { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.doc-actions { display: grid; gap: 8px; justify-items: end; flex: none; }
.file-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px 3px 10px; border-radius: 6px; background: var(--bg); font-size: .85rem; max-width: 100%; justify-self: start; }
[dir="rtl"] .file-chip { padding: 3px 10px 3px 4px; }
.file-chip button { border: 0; background: none; font-size: 1.1rem; line-height: 1; color: var(--muted); width: 24px; height: 24px; }
.doc-file { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; padding: 8px 0 2px; border-top: 1px dashed var(--line); margin-top: 4px; }
.doc-note { flex-basis: 100%; color: var(--bad); }
.link-btn { border: 0; background: none; padding: 0; color: var(--primary); font-weight: 600; text-align: start; overflow-wrap: anywhere; }
.link-btn:hover { text-decoration: underline; }
.doc-summary { display: grid; gap: 2px; padding: 12px 16px; border-radius: var(--r); margin-bottom: 12px; }
.doc-summary.ok { background: var(--ok-tint); color: var(--ok); }
.doc-summary.warn { background: var(--warn-tint); color: var(--warn); }
.doc-summary .muted { color: inherit; opacity: .85; }
.notice.ok { background: var(--ok-tint); color: var(--ok); }
.chips-check { display: flex; flex-wrap: wrap; gap: 4px 18px; align-items: center; }
.chips-check .field { display: flex; align-items: center; gap: 8px; }
.chips-check .sort-in { width: 80px; }
.titles { padding: 6px 0 0; }
.titles input:disabled + span { opacity: .55; }
details.panel > summary { cursor: pointer; margin: 0; }
details.panel[open] > summary { margin-bottom: 12px; }
select.auto-w { width: auto; min-width: 200px; }
.searchbox .sb-field { min-width: 0; }
@media (max-width: 760px) {
  .doc-row { flex-direction: column; }
  .doc-actions { justify-items: start; width: 100%; }
  .row-form:not(:has(.icon-in)) { grid-template-columns: 1fr 1fr; }
}

/* ---------- import ---------- */
.imp-src { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 14px; border-radius: var(--r); margin-bottom: 8px; font-size: .92rem; }
.imp-src strong { overflow-wrap: anywhere; font-weight: 600; }
.imp-src.ok { background: var(--ok-tint); color: var(--ok); }
.imp-src.bad { background: var(--bad-tint); color: var(--bad); }
.imp-table th { width: 160px; background: transparent; color: var(--muted); font-size: .85rem; vertical-align: top; }
.imp-table td { overflow-wrap: anywhere; }
.field.imported input, .field.imported select, .field.imported textarea { border-color: var(--ok); background: #F6FBF8; }
.field.imported .field-label::after { content: " ✓"; color: var(--ok); }
@media (max-width: 760px) { .imp-table th { width: auto; padding: 0; border: 0; } .imp-table td { border: 0; } }
.spec-grid .spec-more { display: none; }
.spec-grid.show-all .spec-more { display: grid; }
.spec-grid + .center { margin-top: 16px; }

/* ---------- clinics ---------- */
.clinic-list { display: grid; gap: 12px; margin-bottom: 12px; }
.panel.clinic { padding: 0; overflow: hidden; margin: 0; }
.clinic-head { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; border: 0; background: none; text-align: start; color: var(--ink); }
.clinic-head:hover { background: var(--bg); }
.clinic.open .clinic-head { border-bottom: 1px solid var(--line); background: var(--primary-tint); }
.clinic-sum { display: grid; gap: 2px; }
.clinic-sum .badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.chev { transition: transform .2s; color: var(--muted); }
.clinic.open .chev { transform: rotate(180deg); }
.clinic-body { padding: 18px; display: grid; gap: 14px; }
.clinic-body .h3 { margin: 6px 0 0; }
.mode-choice { grid-template-columns: repeat(3, 1fr); display: grid; gap: 10px; }
.mode-choice legend { grid-column: 1 / -1; }
.clinic-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.clinic-card { display: grid; gap: 2px; text-align: start; padding: 12px 14px; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface); color: var(--ink); }
.clinic-card:hover { border-color: var(--primary); }
.clinic-card.on { border-color: var(--primary); background: var(--primary-tint); box-shadow: inset 0 0 0 1px var(--primary); }
.book-panel h2 small { display: block; font-size: .8rem; font-weight: 500; opacity: .85; }
.contact-block { padding: 0 20px 18px; }
.contact-block .h3 { margin: 4px 0 10px; font-size: .95rem; }
.book-panel > .contact-block:first-of-type:not(:only-child) { border-top: 1px solid var(--line); padding-top: 14px; }
#slotPicker + .contact-block { border-top: 1px solid var(--line); padding-top: 14px; }
.contact-link { display: inline-flex; align-items: center; gap: 6px; justify-content: center; font-weight: 600; font-size: .9rem; }
.ms-clinic { display: flex; align-items: center; gap: 6px; font-size: .82rem; font-weight: 600; color: var(--muted); }
.ms-clinic .ic { width: 16px; height: 16px; }
@media (max-width: 760px) { .mode-choice { grid-template-columns: 1fr; } .clinic-cards { grid-template-columns: 1fr 1fr; } }
.map-embed { width: 100%; height: 320px; border: 0; border-radius: var(--r); display: block; background: var(--bg); }
.map-embed.sm { height: 200px; }
.map-panel .h3 { margin-top: 0; }
@media (max-width: 760px) { .map-embed { height: 260px; } }
.web-results { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 6px; }
.web-results li { border: 1px solid var(--line); border-radius: var(--r); padding: 8px 12px; }
.web-results .check { align-items: flex-start; }
.web-results .check > span { display: grid; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.web-results input { margin-top: 4px; }
.ai-panel { border-color: var(--primary); }
.ai-steps { margin: 0; padding-inline-start: 22px; display: grid; gap: 18px; }
.ai-steps li { display: grid; gap: 8px; }
.ai-steps li::marker { font-weight: 700; color: var(--primary); }
.ai-steps textarea { font-family: ui-monospace, Consolas, monospace; font-size: .8rem; }
.choice.imported .choice-card:has(input:checked) { border-color: var(--ok); }
.choice.imported legend::after { content: " ✓"; color: var(--ok); }
.photo-picker { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.pp-actions { display: grid; gap: 8px; flex: 1; min-width: 220px; }
.pp-link { display: flex; gap: 8px; max-width: 460px; }
.pp-link input { min-height: 38px; }
