:root {
  --bg: #f5f7f6;
  --surface: #ffffff;
  --surface-2: #eef2f0;
  --border: #dfe6e3;
  --border-strong: #c9d3cf;
  --text: #11211c;
  --muted: #5d6d68;
  --primary: #0d7a5a;
  --primary-hover: #0a6a4e;
  --primary-ink: #ffffff;
  --primary-soft: #e2f3eb;
  --primary-soft-ink: #0a5c44;
  --open: #12824f;
  --soon: #a86200;
  --closed: #b3372f;
  --unknown: #7a8682;
  --star: #e3a008;
  --shadow: 0 1px 2px rgb(16 32 27 / .05), 0 4px 16px rgb(16 32 27 / .06);
  --shadow-lg: 0 12px 48px rgb(16 32 27 / .18);
  --radius: 14px;
  --font: 'IBM Plex Sans Arabic', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c1311;
    --surface: #131c19;
    --surface-2: #1a2521;
    --border: #24322d;
    --border-strong: #31423c;
    --text: #e4ede9;
    --muted: #93a49e;
    --primary: #33bf8d;
    --primary-hover: #4fd2a1;
    --primary-ink: #04281b;
    --primary-soft: #16372b;
    --primary-soft-ink: #8fe3c2;
    --open: #4bd28b;
    --soon: #f0b44c;
    --closed: #f2827a;
    --unknown: #8b9893;
    --star: #f5c542;
    --shadow: 0 1px 2px rgb(0 0 0 / .3);
    --shadow-lg: 0 12px 48px rgb(0 0 0 / .55);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0c1311;
  --surface: #131c19;
  --surface-2: #1a2521;
  --border: #24322d;
  --border-strong: #31423c;
  --text: #e4ede9;
  --muted: #93a49e;
  --primary: #33bf8d;
  --primary-hover: #4fd2a1;
  --primary-ink: #04281b;
  --primary-soft: #16372b;
  --primary-soft-ink: #8fe3c2;
  --open: #4bd28b;
  --soon: #f0b44c;
  --closed: #f2827a;
  --unknown: #8b9893;
  --star: #f5c542;
  --shadow: 0 1px 2px rgb(0 0 0 / .3);
  --shadow-lg: 0 12px 48px rgb(0 0 0 / .55);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--primary); }
h1, h2, h3, p { margin: 0; }

:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 6px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

.skip {
  position: absolute; inset-inline-start: 16px; top: -48px; z-index: 50;
  background: var(--primary); color: var(--primary-ink); padding: 8px 14px; border-radius: 10px;
}
.skip:focus { top: 12px; }

.wrap { width: 100%; max-width: 1240px; margin-inline: auto; padding-inline: 16px; }
@media (min-width: 720px) { .wrap { padding-inline: 24px; } }

.muted { color: var(--muted); }

/* ---------- header ---------- */

.top { padding-block: 16px 4px; }
.top__inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand__mark { width: 40px; height: 40px; border-radius: 11px; flex: none; }
.brand__title { font-size: 19px; font-weight: 700; letter-spacing: -.01em; line-height: 1.2; }
.brand__sub { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.top__actions { display: flex; align-items: center; gap: 8px; flex: none; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 40px; height: 40px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  transition: background .15s, border-color .15s;
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.icon-btn--sm { width: 34px; height: 34px; border-radius: 10px; color: var(--muted); }
.icon-btn--sm:hover { color: var(--primary); }
.icon-btn--sm svg { width: 18px; height: 18px; }

.i-moon { display: none; }
:root[data-theme="dark"] .i-sun { display: none; }
:root[data-theme="dark"] .i-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .i-sun { display: none; }
  :root:not([data-theme="light"]) .i-moon { display: block; }
}

.lang-btn {
  height: 40px; padding-inline: 14px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface);
  font-weight: 600; font-size: 14px;
}
.lang-btn:hover { background: var(--surface-2); }

/* ---------- controls ---------- */

.controls {
  position: sticky; top: 0; z-index: 10;
  padding-block: 12px 10px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid transparent;
}

.search {
  display: flex; align-items: center; gap: 10px;
  height: 52px; padding-inline: 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: var(--shadow);
  transition: border-color .15s, box-shadow .15s;
}
.search:focus-within { border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 18%, transparent), var(--shadow); }
.search svg { color: var(--muted); }
.search input {
  flex: 1; min-width: 0; height: 100%;
  border: 0; outline: 0; background: transparent;
  font-size: 16px;
}
.search input::placeholder { color: var(--muted); opacity: .85; }
.search input::-webkit-search-cancel-button { cursor: pointer; }
.search__kbd {
  display: none; font: 500 12px var(--font); color: var(--muted);
  border: 1px solid var(--border); border-radius: 6px; padding: 1px 7px;
}
@media (hover: hover) and (min-width: 720px) { .search__kbd { display: inline-block; } }

.filters {
  display: flex; gap: 8px; margin-top: 10px;
  overflow-x: auto; scrollbar-width: none;
  margin-inline: -16px; padding-inline: 16px; padding-block: 2px;
}
.filters::-webkit-scrollbar { display: none; }
@media (min-width: 720px) { .filters { flex-wrap: wrap; overflow: visible; margin-inline: 0; padding-inline: 0; } }

/* Searchable filter dropdowns */
.combo { position: relative; flex: none; }
.combo::after {
  content: ''; position: absolute; inset-inline-end: 14px; top: 50%;
  width: 7px; height: 7px; margin-top: -5px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(45deg); pointer-events: none; transition: transform .15s;
}
.combo:has([aria-expanded="true"])::after { transform: translateY(3px) rotate(-135deg); }
.combo__btn {
  display: block; height: 38px; max-width: 240px;
  padding-inline: 14px 34px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface);
  font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-align: start;
}
.combo__btn:hover { border-color: var(--border-strong); }
.combo__btn[aria-expanded="true"] { border-color: var(--primary); }
.combo.is-set .combo__btn { background: var(--primary-soft); border-color: transparent; color: var(--primary-soft-ink); }
.combo.is-set::after { border-color: var(--primary-soft-ink); }

.combo__pop {
  position: fixed; z-index: 40;
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: var(--shadow-lg); overflow: hidden;
  animation: combo-in .14s cubic-bezier(.2, .8, .2, 1);
}
@keyframes combo-in { from { opacity: 0; transform: translateY(-4px); } }
.combo__search {
  display: flex; align-items: center; gap: 8px; flex: none;
  padding: 4px 12px; border-bottom: 1px solid var(--border);
}
.combo__search svg { width: 18px; height: 18px; color: var(--muted); }
.combo__search input {
  flex: 1; min-width: 0; height: 44px; border: 0; outline: 0; background: transparent;
  font-size: 16px; /* 16px stops iOS zooming on focus */
}
.combo__search input::placeholder { color: var(--muted); }
.combo__list { list-style: none; margin: 0; padding: 6px; overflow-y: auto; overscroll-behavior: contain; }
.combo__list li {
  display: flex; align-items: center; gap: 8px;
  min-height: 40px; padding: 8px 10px; border-radius: 10px;
  font-size: 14.5px; cursor: pointer; user-select: none;
}
.combo__list li.is-active { background: var(--surface-2); }
.combo__list li[aria-selected="true"] { color: var(--primary-soft-ink); font-weight: 600; }
.combo__list li.is-empty { color: var(--muted); }
.combo__check { width: 18px; flex: none; display: grid; place-items: center; visibility: hidden; color: var(--primary); }
.combo__check svg { width: 16px; height: 16px; stroke-width: 2.5; }
.combo__list li[aria-selected="true"] .combo__check { visibility: visible; }
.combo__text { flex: 1; min-width: 0; }
.combo__n { flex: none; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 500; }
.combo__empty { color: var(--muted); justify-content: center; cursor: default; }

.chip {
  display: inline-flex; align-items: center; gap: 7px; flex: none;
  height: 38px; padding-inline: 14px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface);
  font-size: 14px; font-weight: 500; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
.chip:hover { border-color: var(--border-strong); }
.chip svg { width: 17px; height: 17px; color: var(--muted); }
.chip[aria-pressed="true"] { background: var(--primary-soft); border-color: transparent; color: var(--primary-soft-ink); }
.chip[aria-pressed="true"] svg { color: currentColor; }
#savedBtn[aria-pressed="true"] svg { fill: currentColor; }
.chip__count:not(:empty) {
  min-width: 20px; height: 20px; padding-inline: 6px; border-radius: 999px;
  display: inline-grid; place-items: center;
  background: var(--surface-2); font-size: 12px; font-weight: 600;
}
.chip[aria-pressed="true"] .chip__count { background: color-mix(in srgb, var(--primary) 20%, transparent); }

/* ---------- results bar ---------- */

.bar { display: flex; align-items: center; gap: 12px; padding-block: 14px 10px; }
.bar__count { font-weight: 600; font-size: 15px; }
.link-btn { border: 0; background: none; color: var(--primary); font-weight: 600; font-size: 14px; padding: 4px; }
.link-btn:hover { text-decoration: underline; }
.sort { margin-inline-start: auto; display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.sort select {
  border: 0; background: transparent; font-weight: 600; font-size: 14px; color: var(--text);
  padding: 4px 2px; cursor: pointer;
}

/* ---------- status ---------- */

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none; }
.dot--open { background: var(--open); box-shadow: 0 0 0 3px color-mix(in srgb, var(--open) 22%, transparent); }
.dot--soon { background: var(--soon); }
.dot--closed { background: var(--closed); }
.dot--unknown { background: var(--unknown); opacity: .6; }

.status { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 500; white-space: nowrap; }
.status--open { color: var(--open); }
.status--soon { color: var(--soon); }
.status--closed { color: var(--closed); }
.status--unknown { color: var(--muted); font-weight: 400; }

/* ---------- star ---------- */

.star {
  display: inline-grid; place-items: center; flex: none;
  width: 36px; height: 36px; border: 0; border-radius: 10px; background: transparent;
  color: var(--border-strong); transition: color .15s, transform .15s, background .15s;
}
.star:hover { color: var(--star); background: var(--surface-2); }
.star.is-on { color: var(--star); }
.star.is-on svg { fill: currentColor; }
.star:active { transform: scale(.88); }

/* ---------- table (desktop) ---------- */

.table {
  width: 100%; border-collapse: separate; border-spacing: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
.table th, .table td { padding: 12px 14px; text-align: start; vertical-align: middle; }
.table thead th {
  font-size: 12px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; color: var(--muted);
  background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap;
}
:root[dir="rtl"] .table thead th { letter-spacing: 0; font-size: 13px; }
.table tbody tr { cursor: pointer; transition: background .12s; }
.table tbody tr:hover { background: color-mix(in srgb, var(--primary-soft) 55%, transparent); }
.table tbody tr:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; border-radius: 0; }
.table tbody td { border-bottom: 1px solid var(--border); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .name { font-weight: 600; }
.table .alt { font-size: 13px; color: var(--muted); }
.table .num { text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .col-star { width: 48px; padding-inline: 8px 0; }
.table .col-act { width: 52px; padding-inline: 0 12px; }
.table .phones .tel { display: flex; width: fit-content; }

/* Phone numbers: always tappable tel: links. */
.tel {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--primary); font-weight: 600; text-decoration: none; white-space: nowrap;
  font-variant-numeric: tabular-nums; padding-block: 2px;
}
.tel svg { width: 15px; height: 15px; }
.tel:hover span:not(.tel__ext) { text-decoration: underline; text-underline-offset: 3px; }
.tel__ext { font-weight: 400; font-size: .88em; color: var(--muted); }

/* ---------- cards (mobile/tablet) ---------- */

.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
@media (min-width: 620px) { .cards { grid-template-columns: 1fr 1fr; } }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: var(--shadow); padding: 14px 14px 12px;
  display: flex; flex-direction: column; gap: 8px;
}
.card__head { display: flex; align-items: flex-start; gap: 8px; }
.card__main {
  flex: 1; min-width: 0; text-align: start; border: 0; background: none; padding: 0;
  display: flex; flex-direction: column; gap: 2px;
}
.card .name { font-size: 16.5px; font-weight: 600; line-height: 1.35; }
.card .spec { font-size: 14px; color: var(--primary); font-weight: 500; }
.card .star { margin: -6px; margin-inline-start: 0; }
.card__meta { display: flex; flex-wrap: wrap; gap: 6px; font-size: 14px; color: var(--muted); }
.card__phones { display: flex; flex-wrap: wrap; gap: 2px 16px; font-size: 15px; }
.card__phones .tel { min-height: 32px; }
.card__actions { display: flex; gap: 8px; margin-top: 4px; }
.card__actions .btn { flex: 1; }
.card__actions .btn--ghost { flex: 0 0 44px; padding: 0; }
:root[dir="rtl"] .card__actions .btn--ghost svg, :root[dir="rtl"] .card__main + svg { transform: scaleX(-1); }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding-inline: 16px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font-weight: 600; font-size: 14.5px; text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .1s;
}
.btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn:active { transform: scale(.98); }
.btn svg { width: 18px; height: 18px; }
.btn--primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn--primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn--ghost { color: var(--muted); }

/* ---------- empty / loading ---------- */

.empty { text-align: center; padding: 56px 16px; display: grid; justify-items: center; gap: 8px; }
.empty__art {
  width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center;
  background: var(--surface-2); color: var(--muted); margin-bottom: 6px;
}
.empty__art svg { width: 28px; height: 28px; }
.empty h2 { font-size: 17px; font-weight: 600; }
.empty p { color: var(--muted); max-width: 380px; }
.empty .btn { margin-top: 10px; }

.skeleton { display: grid; gap: 10px; }
.skeleton div {
  height: 64px; border-radius: 14px;
  background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%);
  background-size: 200% 100%; animation: shimmer 1.2s infinite linear;
  border: 1px solid var(--border);
}
@keyframes shimmer { to { background-position: -200% 0; } }

#sentinel { height: 1px; }

/* ---------- footer ---------- */

.foot { padding-block: 28px 40px; font-size: 13px; color: var(--muted); text-align: center; }
.foot p { max-width: 640px; margin-inline: auto; }

/* ---------- details sheet ---------- */

.sheet {
  border: 0; padding: 0; color: var(--text); background: var(--surface);
  width: 100%; max-width: 100%; max-height: 90vh; max-height: 90dvh;
  margin: auto 0 0; border-radius: 22px 22px 0 0;
  box-shadow: var(--shadow-lg); overflow-y: auto; overscroll-behavior: contain;
  padding: 8px 20px calc(24px + env(safe-area-inset-bottom));
}
.sheet[open] { animation: sheet-up .26s cubic-bezier(.2, .8, .2, 1); }
.sheet::backdrop { background: rgb(5 12 10 / .45); backdrop-filter: blur(3px); }
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } }

@media (min-width: 720px) {
  .sheet {
    width: 560px; margin: auto; border-radius: 22px; max-height: 86vh;
    padding: 20px 26px 26px;
  }
  .sheet[open] { animation: sheet-pop .2s cubic-bezier(.2, .8, .2, 1); }
  .sheet__grab { display: none; }
}
@keyframes sheet-pop { from { transform: scale(.97); opacity: 0; } }

.sheet__grab { width: 40px; height: 5px; border-radius: 3px; background: var(--border-strong); margin: 0 auto 10px; }
.sheet__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.sheet__spec { color: var(--primary); font-weight: 600; font-size: 14px; }
.sheet__title { font-size: 22px; font-weight: 700; line-height: 1.3; margin-top: 2px; }
.sheet__head .alt { color: var(--muted); font-size: 14px; margin-top: 2px; }
.sheet__tools { display: flex; gap: 4px; flex: none; }
.sheet__tools .star { width: 40px; height: 40px; }
.sheet__status { display: flex; align-items: center; gap: 12px; margin-top: 12px; font-size: 14px; }
.sheet__actions { display: flex; gap: 8px; margin-top: 16px; }
.sheet__actions .btn { flex: 1; }

.sheet__sec { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); display: grid; gap: 3px; }
.sheet__sec h3 { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
:root[dir="rtl"] .sheet__sec h3 { letter-spacing: 0; font-size: 13px; }
.sheet .phones { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.sheet .phones .tel { font-size: 16px; min-height: 36px; }

.hours { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.hours th, .hours td { padding: 7px 10px; text-align: start; font-weight: 400; }
.hours td { text-align: end; font-variant-numeric: tabular-nums; }
.hours tr:nth-child(odd) { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.hours tr.is-today { background: var(--primary-soft); color: var(--primary-soft-ink); font-weight: 600; }
.hours tr.is-today th, .hours tr.is-today td { font-weight: 600; }
.hours th:first-child { border-start-start-radius: 8px; border-end-start-radius: 8px; }
.hours td:last-child { border-start-end-radius: 8px; border-end-end-radius: 8px; }
.tag { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px; background: var(--primary); color: var(--primary-ink); margin-inline-start: 6px; vertical-align: 1px; }
.note { font-size: 12.5px; color: var(--muted); margin-top: 6px; }

.source {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 20px;
  font-size: 13.5px; font-weight: 500; text-decoration: none;
}
.source:hover { text-decoration: underline; }
.source svg { width: 15px; height: 15px; }

/* ---------- toast ---------- */

.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 100;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 12px;
  font-size: 14px; font-weight: 500; box-shadow: var(--shadow-lg);
  transition: opacity .2s, transform .2s;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
