:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f1f4f6;
  --border: #e2e6ea;
  --text: #17212b;
  --muted: #5d6b78;
  --accent: #7b1e3a;
  --accent-soft: #f7e7ec;
  --accent-text: #6d1a33;
  --chip: #eef1f4;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --radius: 12px;
  --g-doctor: #7b1e3a;
  --g-practitioner: #7c3aed;
  --g-institution: #2563eb;
  --g-department: #b45309;
  --g-owner: #64748b;
  --star: #e3a008;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1419;
    --surface: #161d24;
    --surface-2: #1c252e;
    --border: #2a3540;
    --text: #e6edf3;
    --muted: #9aa8b5;
    --accent: #a8365a;
    --accent-soft: #3a1622;
    --accent-text: #f2a3ba;
    --chip: #222c36;
    --shadow: none;
    --g-doctor: #e0839f;
    --g-practitioner: #a78bfa;
    --g-institution: #60a5fa;
    --g-department: #fbbf24;
    --g-owner: #94a3b8;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select { font: inherit; color: inherit; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 1000;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1320px; margin: 0 auto; padding: 12px 16px;
  display: flex; gap: 24px; align-items: center;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px; background: var(--accent); color: #fff;
  display: grid; place-items: center;
}
.brand-mark svg { width: 22px; height: 22px; }
.brand strong { display: block; font-size: 17px; letter-spacing: -.01em; }
.brand small { display: block; color: var(--muted); font-size: 12px; margin-top: -2px; }
.searchbar { flex: 1; position: relative; max-width: 720px; }
.searchbar input {
  width: 100%; padding: 10px 14px 10px 40px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface-2); outline: none;
}
.searchbar input:focus { border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-icon {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round;
}

.lang-switch { display: inline-flex; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; margin-left: auto; flex: none; }
.lang-switch a { padding: 6px 11px; font-size: 13px; font-weight: 600; color: var(--muted); }
.lang-switch a:hover { text-decoration: none; color: var(--text); }
.lang-switch a[aria-current="true"] { background: var(--accent); color: #fff; }

main { max-width: 1320px; margin: 0 auto; padding: 20px 16px 40px; min-height: 70vh; }

/* Group tabs */
.groups { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.group-tab {
  border: 1px solid var(--border); background: var(--surface); border-radius: 999px;
  padding: 7px 14px; cursor: pointer; display: inline-flex; gap: 8px; align-items: center;
}
.group-tab .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dot, var(--muted)); }
.group-tab .n { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.group-tab[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.group-tab[aria-pressed="true"] .n { color: inherit; }

.layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 24px; align-items: start; }

/* Filters */
.filters { position: sticky; top: 84px; max-height: calc(100vh - 100px); overflow: auto; padding-right: 4px; }
.filters-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.filters-head h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0; }
.link-btn { background: none; border: 0; color: var(--accent-text); cursor: pointer; padding: 0; font-size: 13px; }
.facet { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 12px; }
.facet h3 { font-size: 13px; margin: 0 0 8px; font-weight: 600; }
.facet-filter { width: 100%; padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); margin-bottom: 6px; font-size: 13px; }
.facet label.opt { display: flex; align-items: center; gap: 8px; padding: 3px 0; cursor: pointer; font-size: 14px; }
.facet label.opt span.v { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.facet label.opt span.c { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.facet input[type=checkbox] { accent-color: var(--accent); margin: 0; }
.facet .text-input { width: 100%; padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); }
.facet select { width: 100%; padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); }
.facet .hint { color: var(--muted); font-size: 12px; margin-top: 4px; }

/* Results */
.results-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.results-head .count { font-size: 15px; color: var(--muted); flex: 1; }
.results-head .count strong { color: var(--text); font-variant-numeric: tabular-nums; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: none; padding: 6px 14px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--accent); color: #fff; }
.sort-select { padding: 6px 10px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); }
.active-filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 6px 3px 10px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent-text); font-size: 13px; border: 0; cursor: pointer;
}
.pill b { font-weight: 500; opacity: .7; }
.pill .x { font-size: 15px; line-height: 1; padding: 0 3px; }

.cards { display: grid; gap: 10px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow); display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 14px;
  color: inherit;
}
a.card:hover { text-decoration: none; border-color: var(--accent); }
.avatar {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 600; font-size: 15px; color: #fff; background: var(--dot, var(--muted));
}
.avatar.sq { border-radius: 10px; }
.card h3 { margin: 0; font-size: 16px; line-height: 1.3; }
.card .sub { color: var(--muted); font-size: 13.5px; margin-top: 2px; }
.card .meta { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 13px; margin-top: 6px; }
.card .meta span { display: inline-flex; gap: 5px; align-items: center; }
.card .side { text-align: right; font-size: 12px; color: var(--muted); white-space: nowrap; }
.chips { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 7px; }
.chip { background: var(--chip); border-radius: 6px; padding: 1px 8px; font-size: 12.5px; }
.chip.main { background: var(--accent-soft); color: var(--accent-text); }
.badge {
  display: inline-block; font-size: 11.5px; padding: 1px 8px; border-radius: 6px; font-weight: 600;
  color: var(--dot); border: 1px solid currentColor; white-space: nowrap;
}
.ico { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

.pager { display: flex; justify-content: center; align-items: center; gap: 6px; margin-top: 18px; flex-wrap: wrap; }
.pager button {
  min-width: 36px; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); cursor: pointer;
}
.pager button[aria-current="page"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.pager button:disabled { opacity: .45; cursor: default; }
.pager .gap { color: var(--muted); padding: 0 4px; }

.empty, .loading { text-align: center; color: var(--muted); padding: 48px 16px; background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius); }
.loading-bar { height: 2px; background: linear-gradient(90deg, transparent, var(--accent), transparent); background-size: 200% 100%; animation: slide 1s linear infinite; border-radius: 2px; margin-bottom: 8px; visibility: hidden; }
.busy .loading-bar { visibility: visible; }
@keyframes slide { from { background-position: 100% 0; } to { background-position: -100% 0; } }

#bigmap { height: calc(100vh - 220px); min-height: 420px; border-radius: var(--radius); border: 1px solid var(--border); }
.map-note { color: var(--muted); font-size: 13px; margin-top: 6px; }

/* Detail page */
.back { display: inline-flex; gap: 6px; align-items: center; margin-bottom: 14px; color: var(--muted); }
.crumbs { display: flex; gap: 6px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--accent-text); }
.hero { display: flex; gap: 18px; align-items: center; margin-bottom: 20px; }
.hero .avatar { width: 64px; height: 64px; font-size: 22px; }
.hero h1 { margin: 0; font-size: 28px; letter-spacing: -.015em; line-height: 1.2; }
.hero .sub { color: var(--muted); margin-top: 4px; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); margin-bottom: 16px; }
.panel h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 12px; display: flex; justify-content: space-between; }
.panel h2 .n { font-variant-numeric: tabular-nums; }
dl.kv { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 7px 14px; margin: 0; }
dl.kv dt { color: var(--muted); font-size: 13.5px; }
dl.kv dd { margin: 0; overflow-wrap: anywhere; }
.contact-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.btn {
  display: inline-flex; gap: 7px; align-items: center; padding: 8px 14px; border-radius: 9px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font-size: 14px;
}
.btn:hover { text-decoration: none; border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
#minimap { height: 280px; border-radius: 10px; }
.list-compact { display: grid; gap: 2px; }
.list-compact a { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 10px; align-items: center; padding: 7px 8px; border-radius: 8px; color: inherit; }
.list-compact a:hover { background: var(--surface-2); text-decoration: none; }
.list-compact .avatar { width: 30px; height: 30px; font-size: 12px; }
.list-compact .t { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-compact .s { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.show-more { margin-top: 6px; }

/* Google ratings */
.stars { display: inline-block; font-size: 20px; letter-spacing: 2px; line-height: 1; }
.stars::before {
  content: "★★★★★";
  background: linear-gradient(90deg, var(--star) var(--p), var(--border) var(--p));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.g-big { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.g-score { font-size: 30px; font-weight: 700; letter-spacing: -.02em; line-height: 1; }
.g-count { color: var(--muted); }
.g-note { color: var(--muted); font-size: 13.5px; margin: 0 0 12px; }
.g-attr { color: var(--muted); font-size: 12px; margin-top: 12px; }
.g-mini { margin-top: 6px; color: var(--text); font-weight: 600; font-size: 13px; }
.g-mini .star { color: var(--star); }
.g-mini .n { color: var(--muted); font-weight: 400; }

/* Patient reviews */
.stars.sm { font-size: 15px; letter-spacing: 1px; }
.stars.accent::before { background: linear-gradient(90deg, var(--accent-text) var(--p), var(--border) var(--p)); -webkit-background-clip: text; background-clip: text; }
.r-mini .star { color: var(--accent-text); }
.g-mini .src { color: var(--muted); font-weight: 400; font-size: 11.5px; }
.r-summary { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.r-summary .g-big { margin-bottom: 0; }
.r-dist { flex: 1; min-width: 180px; max-width: 280px; display: grid; gap: 3px; font-size: 12.5px; color: var(--muted); }
.r-dist-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) 28px; gap: 8px; align-items: center; font-variant-numeric: tabular-nums; }
.r-dist-row .bar { height: 7px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.r-dist-row .bar span { display: block; height: 100%; background: var(--accent-text); border-radius: 4px; }
.r-dist-row .n { text-align: right; }
.review-list { margin-top: 14px; }
.review { border-top: 1px solid var(--border); padding: 12px 0; }
.review-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.review-meta { color: var(--muted); font-size: 12.5px; }
.review-meta .verified { color: var(--accent-text); }
.review-text { margin: 6px 0 0; white-space: pre-line; overflow-wrap: anywhere; }
.review-form { display: grid; gap: 14px; margin-top: 6px; padding: 16px; background: var(--surface-2); border-radius: 10px; }
.review-form .f-row { display: grid; gap: 5px; font-size: 13.5px; font-weight: 600; }
.review-form input:not([type=checkbox]):not([type=radio]), .review-form textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); font-weight: 400; font-size: 15px;
}
.review-form textarea { resize: vertical; min-height: 100px; font: inherit; }
.review-form input:focus, .review-form textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.review-form .hint { color: var(--muted); font-weight: 400; font-size: 12px; }
.review-form .req { color: var(--accent-text); }
.review-form .consent { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; cursor: pointer; }
.review-form .consent input { margin-top: 3px; accent-color: var(--accent); }
.star-input { border: 0; padding: 0; margin: 0; }
.star-input legend { font-size: 13.5px; font-weight: 600; padding: 0; margin-bottom: 4px; }
.star-row { display: inline-flex; gap: 2px; }
.star-row input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.star-row label { font-size: 32px; line-height: 1; color: var(--muted); opacity: .35; cursor: pointer; padding: 0 2px; border-radius: 6px; }
.star-row label.on { color: var(--accent-text); opacity: 1; }
.star-row input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 1px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.review-rules { font-size: 13.5px; }
.review-rules summary { cursor: pointer; font-weight: 600; color: var(--accent-text); }
.review-rules p { margin: 8px 0 4px; }
.review-rules ul { margin: 0; padding-left: 20px; color: var(--muted); }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.turnstile:empty { display: none; }
.form-msg { color: #b42318; font-size: 13.5px; }
.form-msg:empty { display: none; }
.form-actions { display: flex; gap: 14px; align-items: center; }
.form-actions .btn { cursor: pointer; }
.form-actions .btn:disabled { opacity: .6; cursor: default; }
#reviewsPanel > .r-body > .btn { cursor: pointer; }
.notice { padding: 14px 16px; background: var(--accent-soft); color: var(--accent-text); border-radius: 10px; margin-top: 6px; }
.verify { max-width: 560px; margin: 40px auto; }
.verify h1 { font-size: 24px; margin: 0 0 8px; letter-spacing: -.01em; }
.verify .btn { cursor: pointer; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .form-msg { color: #f97066; }
}

.footer { max-width: 1320px; margin: 0 auto; padding: 16px; color: var(--muted); font-size: 12.5px; border-top: 1px solid var(--border); }

.leaflet-popup-content { font: 13px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
.leaflet-container { background: var(--surface-2); }

/* Landing page */
body[data-page="landing"] .searchbar { display: none; }
.landing {
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 56px;
  align-items: center; padding: 28px 0 24px;
}
.landing h1 {
  font-size: clamp(32px, 4.2vw, 52px); line-height: 1.08; letter-spacing: -.025em;
  margin: 0 0 16px; font-weight: 750; text-wrap: balance;
}
.landing .lead { font-size: 17.5px; color: var(--muted); margin: 0 0 26px; max-width: 34em; text-wrap: pretty; }
.finder {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 18px;
  box-shadow: 0 10px 30px -12px rgba(16, 24, 40, .18), var(--shadow);
}
.field { display: block; min-width: 0; }
.field-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.field-control { position: relative; display: block; }
.field-control > .ico {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 17px; height: 17px; color: var(--muted); pointer-events: none;
}
.field-control select, .field-control input {
  width: 100%; height: 46px; padding: 0 12px 0 38px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface-2); outline: none; font-size: 15px;
  text-overflow: ellipsis;
}
.field-control select { cursor: pointer; }
.field-control select:focus, .field-control input:focus {
  border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-soft);
}
.finder-go {
  grid-column: 1 / -1; justify-content: center; height: 48px; font-size: 16px; font-weight: 600; cursor: pointer;
}
.finder-go .ico { width: 18px; height: 18px; }
.finder-go:hover { filter: brightness(1.08); }
.popular { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 18px; }
.popular-label { color: var(--muted); font-size: 13.5px; margin-right: 2px; }
.chip-btn {
  border: 1px solid var(--border); background: var(--surface); border-radius: 999px;
  padding: 5px 12px; font-size: 13.5px; cursor: pointer;
}
.chip-btn:hover { border-color: var(--accent); color: var(--accent-text); }
.landing-note { color: var(--muted); font-size: 13px; margin: 22px 0 0; min-height: 1.5em; }
.landing-photo {
  position: relative; margin: 0; border-radius: 22px; overflow: hidden;
  height: clamp(380px, 64vh, 600px); background: var(--surface-2);
  box-shadow: 0 24px 48px -24px rgba(16, 24, 40, .35);
}
.landing-photo img { width: 100%; height: 100%; object-fit: cover; object-position: 52% center; display: block; }
.landing-photo figcaption {
  position: absolute; right: 10px; bottom: 10px; padding: 2px 8px; border-radius: 6px;
  background: rgba(0, 0, 0, .45); color: rgba(255, 255, 255, .9); font-size: 11px;
}
.landing-photo figcaption a { color: inherit; text-decoration: underline; }

.filters-toggle { display: none; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .filters { position: static; max-height: none; display: none; }
  .filters.open { display: block; }
  .filters-toggle { display: inline-flex; }
  .detail-grid { grid-template-columns: 1fr; }
  .topbar-inner { flex-wrap: wrap; gap: 10px; }
  .searchbar { order: 3; flex-basis: 100%; max-width: none; }
  .brand small { display: none; }
  .filters { top: 0; }
  .landing { grid-template-columns: 1fr; gap: 24px; padding-top: 4px; }
  .landing-photo { order: -1; height: clamp(200px, 34vh, 320px); border-radius: 16px; }
}
@media (max-width: 560px) {
  .card { grid-template-columns: 36px minmax(0, 1fr); }
  .card .avatar { width: 36px; height: 36px; font-size: 13px; }
  .card .side { grid-column: 2; text-align: left; }
  dl.kv { grid-template-columns: 1fr; gap: 0 0; }
  dl.kv dd { margin-bottom: 8px; }
  .hero h1 { font-size: 22px; }
  .hero .avatar { width: 48px; height: 48px; font-size: 17px; }
  .finder { grid-template-columns: 1fr; padding: 14px; }
  .landing .lead { font-size: 16px; }
}
