/* App shell and the patient screens. Tokens and shared components (buttons, fields, monograms, chat) live in style.css.
   Phones (≤860px): top bar + floating frosted tab bar. Larger screens: a floating rail on the start side. */

/* ---------- shell ---------- */
.shell {
  position: fixed; inset: 0;
  display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr);
  padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right);
  background: radial-gradient(120% 52% at 86% -6%, var(--haze) 0%, transparent 64%), var(--bg);
}

.skip {
  position: absolute; z-index: 100; inset-block-start: 8px; inset-inline-start: 8px;
  min-height: 44px; padding: 0 18px; border: 0; border-radius: 999px;
  background: var(--ink); color: var(--on-ink); font-weight: 500;
  transform: translateY(-220%); transition: transform 160ms ease;
}
.skip:focus { transform: none; }
.noscript { margin: 0; padding: 14px 18px; background: var(--warn-bg); color: var(--warn); text-align: center; }

/* top bar (phones) / rail (larger screens) */
.rail {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  min-height: calc(66px + env(safe-area-inset-top));
  padding: calc(env(safe-area-inset-top) + 10px) 16px 6px;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; min-height: 44px; color: var(--text); text-decoration: none; border-radius: 16px; }
.logo {
  flex: none; width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center;
  background: var(--ink); color: var(--on-ink); box-shadow: 0 8px 18px var(--ring);
}
.logo svg { width: 23px; height: 23px; }
.brand__text { display: flex; flex-direction: column; min-width: 0; line-height: 1.45; }
.brand__name { font-size: 17px; font-weight: 600; }
.brand__sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tools { display: flex; gap: 8px; flex: none; }
#sound { display: none; }  /* typing sound only matters in the chat */
:root[data-route="chat"] #sound { display: inline-grid; }

/* floating frosted tab bar, «گفتگو» is the dark round mic button in the middle */
.nav {
  position: fixed; z-index: 20;
  left: max(12px, env(safe-area-inset-left)); right: max(12px, env(safe-area-inset-right));
  bottom: calc(10px + env(safe-area-inset-bottom));
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: end;
  height: 68px; padding: 0 6px 6px; border-radius: 26px;
  background: var(--card); border: 1px solid var(--border);
  box-shadow: 0 14px 34px rgba(36, 42, 58, 0.15);
}
@supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) {
  .nav { background: var(--glass); border-color: var(--glass-border); -webkit-backdrop-filter: blur(18px) saturate(1.4); backdrop-filter: blur(18px) saturate(1.4); }
}
.nav__item {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 3px;
  min-height: 56px; padding: 0 2px; border-radius: 18px;
  color: var(--muted); text-decoration: none; font-size: 11.5px; font-weight: 500; line-height: 1.3;
  -webkit-user-select: none; user-select: none;
}
.nav__ico { display: grid; place-items: center; width: 54px; height: 30px; border-radius: 999px; transition: background-color 180ms ease, color 180ms ease; }
.nav__ico svg { width: 22px; height: 22px; }
.nav__item:hover .nav__ico { background: var(--tint); }
.nav__item[aria-current="page"] { color: var(--text); font-weight: 600; }
.nav__item[aria-current="page"] .nav__ico { background: var(--sel); color: var(--text); }
.nav__item--chat { color: var(--text); font-weight: 600; }
.nav__item--chat .nav__ico {
  width: 58px; height: 58px; margin-top: -26px; border-radius: 50%;
  background: var(--ink); color: var(--on-ink);
  box-shadow: 0 10px 24px var(--ring), 0 0 0 5px var(--card);
}
.nav__item--chat .nav__ico svg { width: 25px; height: 25px; stroke-width: 2; }
.nav__item--chat:hover .nav__ico { background: var(--ink); filter: brightness(1.2); }
.nav__item--chat[aria-current="page"] .nav__ico { background: var(--ink); color: var(--on-ink); box-shadow: 0 10px 24px var(--ring), 0 0 0 5px var(--card), 0 0 0 7px var(--sel-border); }

/* while the keyboard is up the bar steps aside and the chat gets the room */
:root.kbd .nav { display: none; }

/* ---------- stage and screens ---------- */
.stage {
  min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.screen { --pad: 16px; display: none; padding: 8px var(--pad) calc(112px + env(safe-area-inset-bottom)); animation: screen-in 260ms ease both; }
:root[data-route="home"] #screen-home,
:root[data-route="doctors"] #screen-doctors,
:root[data-route="doctor"] #screen-doctor,
:root[data-route="booking"] #screen-booking,
:root[data-route="ticket"] #screen-ticket,
:root[data-route="info"] #screen-info,
:root[data-route="insurance"] #screen-insurance { display: block; }
:root[data-route="chat"] #screen-chat { display: flex; flex-direction: column; animation: none; }
:root.kbd .screen { padding-bottom: 24px; }
@keyframes screen-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
[tabindex="-1"]:focus { outline: none; }

.wrap { width: 100%; max-width: 920px; margin-inline: auto; }
.wrap--form { max-width: 640px; }
.wrap--profile { max-width: 760px; }

.page-head { padding: 6px 4px 14px; }
.page-head h1 { font-size: 28px; font-weight: 300; line-height: 1.4; }
.page-head__sub { margin-top: 2px; font-size: 14px; color: var(--muted); }

.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--r-card);
  box-shadow: var(--shadow); padding: 20px 18px;
}
.card + .card, .card + .state { margin-top: 14px; }
.card__head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.card__head h2 { flex: 1; min-width: 0; font-size: 19px; font-weight: 500; line-height: 1.5; }
.card__ico { flex: none; width: 40px; height: 40px; border-radius: 14px; display: grid; place-items: center; background: var(--tint); color: var(--brand-text); }
.card__ico svg { width: 21px; height: 21px; }

.badge {
  display: inline-flex; align-items: center; gap: 6px; min-height: 28px; padding: 0 12px; border-radius: 999px;
  background: var(--sel); color: var(--text); font-size: 12.5px; font-weight: 500; white-space: nowrap;
}
.badge--new { background: var(--warn-bg); color: var(--warn); }
.badge--contacted { background: var(--sel); color: var(--text); }
.badge--booked { background: var(--ok-bg); color: var(--ok); }
.badge--cancelled, .badge--unknown { background: var(--panel); color: var(--muted); border: 1px solid var(--border); }

/* loading skeletons and empty / error states */
.skeleton { display: grid; gap: 12px; }
.sk {
  height: 16px; border-radius: 10px;
  background: linear-gradient(90deg, var(--panel) 25%, var(--border) 50%, var(--panel) 75%); background-size: 300% 100%;
  animation: shimmer 1.4s ease infinite;
}
.skeleton--row .sk { height: 80px; border-radius: 24px; }
.skeleton--card .sk { height: 150px; border-radius: var(--r-card); }
.skeleton--text .sk:nth-child(3n + 1) { width: 92%; }
.skeleton--text .sk:nth-child(3n + 2) { width: 78%; }
.skeleton--text .sk:nth-child(3n) { width: 60%; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

.state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 30px 18px; }
.state__ico { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: var(--sel); color: var(--text); }
.state__ico svg { width: 28px; height: 28px; }
.state__title { font-size: 17px; font-weight: 600; }
.state__text { max-width: 38ch; font-size: 14px; color: var(--muted); }
.state__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 6px; }

/* ---------- home ---------- */
.greet {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 22px 22px 22px 16px; border-radius: var(--r-card);
  background: linear-gradient(160deg, var(--hero-a), var(--hero-b)); border: 1px solid var(--glass-border);
  box-shadow: var(--shadow); margin-bottom: 8px;
}
.greet__kicker { font-size: 13.5px; font-weight: 500; color: var(--muted); }
.greet h1 { margin-top: 2px; font-size: 28px; font-weight: 300; line-height: 1.4; }
.greet__role, .greet__name { display: block; }
.greet__name { margin-top: 2px; font-size: 16px; font-weight: 500; color: var(--brand-text); }
.greet__topics { margin-top: 10px; max-width: 46ch; font-size: 14px; color: var(--muted); }
.emblem { position: relative; flex: none; width: 68px; height: 68px; border-radius: 50%; display: grid; place-items: center; }
.emblem::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(var(--brand), var(--brand-2), var(--brand), var(--brand-2), var(--brand));
  -webkit-mask: radial-gradient(circle, transparent 0 56%, #000 57% 100%), repeating-conic-gradient(#000 0 3deg, transparent 3deg 9deg);
  -webkit-mask-composite: source-in;
  mask: radial-gradient(circle, transparent 0 56%, #000 57% 100%), repeating-conic-gradient(#000 0 3deg, transparent 3deg 9deg);
  mask-composite: intersect;
  animation: spin 24s linear infinite;
}
.emblem svg { position: relative; width: 26px; height: 26px; color: var(--ink); }
@keyframes spin { to { transform: rotate(360deg); } }

.sec-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 14px 4px 0; }
.sec-head h2 { font-size: 19px; font-weight: 500; }
.sec-head a, .sec-head button { display: inline-flex; align-items: center; min-height: 44px; font-size: 13.5px; font-weight: 500; }
.link-btn { background: none; border: 0; padding: 0; min-height: 44px; color: var(--brand-text); text-underline-offset: 3px; }
.link-btn:hover { text-decoration: underline; }

/* «پزشکان امروز»: tall photo / monogram cards in a horizontal carousel */
.strip {
  display: flex; gap: 12px; list-style: none; margin: 0 calc(var(--pad) * -1); padding: 4px var(--pad) 18px;
  overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none;
}
.strip::-webkit-scrollbar { display: none; }
.strip > li { flex: none; scroll-snap-align: start; scroll-margin-inline: var(--pad); }
.pcard {
  position: relative; display: block; width: 168px; height: 236px; border-radius: 26px; overflow: hidden;
  background: var(--card); border: 1px solid var(--border); box-shadow: var(--shadow);
  color: var(--text); text-decoration: none;
  transition: transform 160ms ease;
}
a.pcard:hover { transform: translateY(-2px); }
.pcard .mono--lg { position: absolute; inset: 0; border-radius: 0; font-size: 96px; padding-block-end: 54px; }
.pcard__strip {
  position: absolute; inset-inline: 8px; bottom: 8px; display: flex; align-items: center; gap: 8px;
  min-height: 62px; padding: 8px 12px; border-radius: 20px;
  background: var(--card); border: 1px solid var(--border);
}
@supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) {
  .pcard__strip { background: var(--glass); border-color: var(--glass-border); -webkit-backdrop-filter: blur(14px) saturate(1.3); backdrop-filter: blur(14px) saturate(1.3); }
}
.pcard__text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.5; }
.pcard__name { font-size: 13.5px; font-weight: 600; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pcard__sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.arrow { flex: none; width: 38px; height: 38px; }
.arrow svg { width: 18px; height: 18px; }
.pcard--all { display: grid; place-items: center; align-content: center; gap: 12px; text-align: center; background: var(--panel); box-shadow: none; font-weight: 500; padding: 16px; }
.pcard--all .arrow { width: 44px; height: 44px; }

/* the sheet-like card: find a doctor + the four main doors */
.find {
  position: relative; margin-top: 4px; padding: 26px 16px 16px; border-radius: var(--r-card);
  background: var(--card); border: 1px solid var(--border); box-shadow: var(--shadow);
}
.find::before {
  content: ""; position: absolute; top: 9px; left: 50%; width: 36px; height: 4px; margin-left: -18px;
  border-radius: 4px; background: var(--sel-border);
}
.find__title { padding-inline: 4px; font-size: 24px; line-height: 1.5; font-weight: 300; }
.find__title strong { display: block; font-weight: 600; }
.find__row { display: flex; align-items: center; gap: 10px; margin: 14px 0 16px; }
.pill-field { position: relative; flex: 1; min-width: 0; }
.pill-field svg { position: absolute; inset-inline-start: 16px; top: 50%; width: 20px; height: 20px; margin-top: -10px; color: var(--muted); pointer-events: none; }
.pill-field .input { min-height: 52px; padding-inline-start: 46px; padding-inline-end: 14px; border-radius: 999px; background: var(--panel); }
.pill-field .input[type="search"] { -webkit-appearance: none; appearance: none; }
.pill-field .input::-webkit-search-cancel-button { display: none; }
/* round filter button = a real <select> laid over a round icon, so the native picker opens on tap */
.filter-btn { position: relative; flex: none; width: 52px; height: 52px; }
.filter-btn .round-btn { width: 52px; height: 52px; background: var(--panel); box-shadow: none; }
.filter-btn select { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border-radius: 50%; }
.filter-btn:focus-within .round-btn { outline: 2px solid var(--focus); outline-offset: 3px; }
.filter-btn[data-active="true"] .round-btn { background: var(--sel); border-color: var(--sel-border); }
.filter-btn[data-active="true"]::after {
  content: ""; position: absolute; inset-block-start: 4px; inset-inline-end: 4px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--brand-text); border: 2px solid var(--card);
}

.svc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.svc {
  position: relative; display: flex; flex-direction: column; justify-content: space-between; gap: 14px;
  min-height: 136px; padding: 14px 14px 12px; border-radius: var(--r-tile);
  background: var(--panel); border: 1px solid var(--border); color: var(--text); text-decoration: none;
  transition: transform 140ms ease, border-color 160ms ease;
}
.svc:hover { border-color: var(--sel-border); transform: translateY(-1px); }
.svc__title { font-size: 15px; font-weight: 600; line-height: 1.5; }
.svc__desc { margin-top: 2px; font-size: 12.5px; color: var(--muted); line-height: 1.6; }
.svc__foot { display: flex; align-items: center; justify-content: space-between; }
.svc__ico { width: 38px; height: 38px; display: grid; place-items: center; color: var(--brand-text); }
.svc__ico svg { width: 24px; height: 24px; }
.svc .arrow { background: var(--card); color: var(--text); border-color: var(--border); box-shadow: none; }
.svc--dark { background: var(--ink); border-color: transparent; color: var(--on-ink); box-shadow: 0 14px 28px var(--ring); }
.svc--dark .svc__desc { color: var(--on-ink); opacity: 0.82; }
.svc--dark .svc__ico { color: var(--on-ink); }
.svc--dark .arrow { background: var(--sel); color: var(--text); border-color: transparent; }

.today__note { margin: 4px 0 8px; padding: 10px 14px; border-radius: 16px; background: var(--warn-bg); color: var(--warn); font-size: 13px; line-height: 1.7; }
.clinics { list-style: none; margin: 0; padding: 0; }
.clinic { padding: 12px 0; border-top: 1px solid var(--border); }
.clinic:first-child { border-top: 0; }
.clinic__name { font-size: 15px; font-weight: 600; }
.clinic__slots { display: grid; gap: 6px; margin-top: 6px; }
.slot { display: flex; align-items: flex-start; gap: 10px; font-size: 13.5px; line-height: 1.7; }
.slot__time { flex: none; min-width: 78px; padding: 1px 10px; border-radius: 999px; background: var(--sel); color: var(--text); font-size: 12.5px; font-weight: 500; text-align: center; }
.slot__docs { min-width: 0; color: var(--muted); }
.more-btn { margin-top: 8px; }

.home-foot { display: grid; gap: 10px; margin-top: 18px; }
.foot-row {
  display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 6px 16px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--border); color: var(--text); text-decoration: none; font: inherit; font-size: 13.5px; font-weight: 500; text-align: start; width: 100%;
}
.foot-row svg { flex: none; width: 20px; height: 20px; color: var(--brand-text); }
.foot-row span { flex: 1; }
button.foot-row { cursor: pointer; }
.foot-row:hover { background: var(--sel); }

/* ---------- doctors ---------- */
.toolbar {
  position: sticky; top: 0; z-index: 4; display: flex; align-items: center; gap: 10px; margin: 0 calc(var(--pad) * -1); padding: 6px var(--pad) 12px;
  background: var(--bg);
}
@supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) {
  .toolbar { background: color-mix(in srgb, var(--bg) 78%, transparent); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
}
.toolbar .filter-btn .round-btn { background: var(--card); box-shadow: var(--shadow-btn); }
.chips-active { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 10px; }
.chip-x {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 8px 0 16px; border-radius: 999px;
  background: var(--sel); border: 1px solid var(--sel-border); font-size: 13.5px; font-weight: 500;
}
.chip-x svg { width: 18px; height: 18px; }
.result-count { margin: 0 4px 10px; font-size: 13px; color: var(--muted); }
.dlist { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.dlist > li { content-visibility: auto; contain-intrinsic-size: auto 84px; }
.drow {
  display: flex; align-items: center; gap: 14px; min-height: 84px; padding: 12px 14px; border-radius: 24px;
  background: var(--card); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
  color: var(--text); text-decoration: none; transition: border-color 160ms ease, transform 120ms ease;
}
.drow:hover { border-color: var(--sel-border); }
.drow:active { transform: scale(0.99); }
.drow__text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.65; }
.drow__name { font-size: 15px; font-weight: 600; }
.drow__spec { font-size: 13px; color: var(--brand-text); display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.drow__role { font-size: 12.5px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.drow__go { flex: none; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; background: var(--panel); color: var(--muted); }
.drow__go svg { width: 18px; height: 18px; }

/* ---------- doctor profile ---------- */
.pro {
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto 1fr; gap: 10px 16px;
  min-height: 252px; padding: 14px 18px 18px; border-radius: var(--r-card); overflow: hidden;
  background: linear-gradient(165deg, var(--hero-a), var(--hero-b)); border: 1px solid var(--glass-border);
  box-shadow: var(--shadow);
}
.pro__back { grid-column: 1; grid-row: 1; justify-self: start; }
.pro__text { grid-column: 1; grid-row: 2; align-self: end; min-width: 0; }
.pro__tile { grid-column: 2; grid-row: 1 / 3; align-self: end; }
.pro h1 { font-size: 30px; font-weight: 300; line-height: 1.4; overflow-wrap: anywhere; }
.pro__spec { margin-top: 6px; font-size: 14.5px; font-weight: 500; color: var(--brand-text); }
.pro__role { margin-top: 2px; font-size: 13px; color: var(--muted); }
.pro__tile .mono--hero { box-shadow: var(--shadow); }
.pro-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 14px 0; }
.pro-actions__round { display: flex; gap: 10px; }
.details {
  margin: 0 0 14px; padding: 18px; border-radius: var(--r-card); background: var(--card); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
.details h2 { margin-bottom: 6px; font-size: 16px; font-weight: 600; }
.bio { font-size: 14.5px; line-height: 2; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text); }
.bio.is-clamped { display: -webkit-box; -webkit-line-clamp: 9; -webkit-box-orient: vertical; overflow: hidden; }
.details .link-btn { display: inline-flex; align-items: center; margin-top: 4px; font-weight: 500; font-size: 14px; }
.details__link { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-weight: 500; font-size: 14px; }
.details__link svg { width: 18px; height: 18px; }
.stats {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; margin: 0 0 14px; padding: 14px 8px;
  border-radius: 26px; background: var(--card); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
.stats--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stat { display: flex; align-items: center; justify-content: center; gap: 8px; min-width: 0; }
.stat__ico { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--tint); color: var(--brand-text); }
.stat__ico svg { width: 18px; height: 18px; }
.stat__text { display: flex; flex-direction: column; min-width: 0; line-height: 1.45; }
.stat__value { font-size: 16px; font-weight: 600; color: var(--brand-text); }
.stat__label { font-size: 11.5px; color: var(--muted); }

.pick { padding: 20px 16px 18px; border-radius: var(--r-card); background: var(--card); border: 1px solid var(--border); box-shadow: var(--shadow); }
.pick__title { margin-bottom: 14px; padding-inline: 2px; font-size: 17px; font-weight: 500; line-height: 1.6; }
.pick fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.pick__row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; padding-inline: 2px; }
.pick__label { padding: 0; font-size: 13px; font-weight: 500; color: var(--muted); }
.pick__month { font-size: 14px; font-weight: 600; }
.days { display: flex; gap: 8px; margin: 0 -2px 8px; padding: 4px 2px 10px; overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none; }
.days::-webkit-scrollbar { display: none; }
.day { position: relative; flex: none; scroll-snap-align: center; }
.day input, .slot-pill input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.day span {
  display: flex; flex-direction: column; align-items: center; justify-content: center; width: 68px; min-height: 80px; border-radius: 20px;
  background: var(--card); border: 1px solid var(--border); line-height: 1.35; transition: background-color 160ms ease, border-color 160ms ease;
}
.day b { font-size: 22px; font-weight: 300; }
.day small { font-size: 11.5px; color: var(--muted); }
.day input:checked + span { background: var(--sel); border-color: var(--sel-border); }
.day input:checked + span b { font-weight: 500; }
.day input:focus-visible + span, .slot-pill input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }
.slots { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; padding: 2px; }
.slot-pill { position: relative; }
.slot-pill span {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center; min-height: 48px; padding: 4px 20px;
  border-radius: 999px; background: var(--card); border: 1px solid var(--border); font-size: 14px; font-weight: 500; line-height: 1.4;
  transition: background-color 160ms ease, border-color 160ms ease;
}
.slot-pill small { font-size: 11.5px; font-weight: 400; color: var(--muted); }
.slot-pill input:checked + span { background: var(--sel); border-color: var(--sel-border); }
.pick .btn--ink { min-height: 54px; font-size: 15.5px; }
.pick__note { margin-top: 10px; font-size: 12.5px; line-height: 1.8; text-align: center; color: var(--muted); }
.week { list-style: none; margin: 4px 0 0; padding: 0; }
.week li { display: flex; align-items: baseline; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.week li:first-child { border-top: 0; }
.week__day { flex: none; min-width: 84px; font-weight: 600; font-size: 14.5px; }
.week__time { flex: none; padding: 1px 10px; border-radius: 999px; background: var(--sel); font-size: 12.5px; font-weight: 500; }
.week__spec { min-width: 0; font-size: 13px; color: var(--muted); }
.pro-note { margin: 0 0 14px; padding: 14px 16px; border-radius: var(--r-tile); background: var(--card); border: 1px solid var(--border); font-size: 14px; line-height: 1.9; }
.pro-note a { font-weight: 500; }

/* ---------- booking ---------- */
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-bottom: 14px; padding: 4px; border-radius: 999px; background: var(--card); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.seg button { min-height: 46px; padding: 0 10px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font-size: 14px; font-weight: 500; }
.seg button[aria-selected="true"] { background: var(--sel); color: var(--text); font-weight: 600; }
.seg .count { display: inline-grid; place-items: center; min-width: 22px; height: 22px; margin-inline-start: 6px; padding: 0 6px; border-radius: 999px; background: var(--ink); color: var(--on-ink); font-size: 11.5px; }
.form-lead { margin-bottom: 16px; font-size: 14px; color: var(--muted); line-height: 1.9; }
.hp { position: absolute; inset-inline-start: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form-err { margin: 4px 0 12px; padding: 12px 14px; border-radius: 16px; background: var(--danger-bg); color: var(--danger); font-size: 13.5px; font-weight: 500; line-height: 1.8; }
.form-note { margin-top: 12px; font-size: 12.5px; line-height: 1.9; color: var(--muted); }
.alt-link { margin-top: 14px; }
.done { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 30px 18px 24px; }
.done__ico { width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; background: var(--ok-bg); color: var(--ok); }
.done__ico svg { width: 36px; height: 36px; stroke-width: 2; }
.done h2 { font-size: 22px; font-weight: 500; }
.done__id { font-size: 15px; font-weight: 600; }
.done__text { max-width: 40ch; font-size: 14px; line-height: 1.9; color: var(--muted); }
.done__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 8px; }
.reqs { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.req { padding: 16px 18px; border-radius: 24px; background: var(--card); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.req__top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.req__subject { margin-top: 8px; font-size: 15px; font-weight: 600; line-height: 1.7; overflow-wrap: anywhere; }
.req__meta { margin-top: 2px; font-size: 12.5px; color: var(--muted); }
.req__hint { margin-top: 8px; font-size: 12.5px; line-height: 1.8; color: var(--muted); }
.reqs-foot { display: flex; justify-content: center; margin-top: 14px; }
.contact-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }

/* ---------- info ---------- */
.app-row { margin-top: 14px; }
.app-row__title { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.app-row__btns { display: flex; flex-wrap: wrap; gap: 8px; }
.app-btn {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px 0 12px; border-radius: 16px;
  background: var(--panel); border: 1px solid var(--border); color: var(--text); font: inherit; font-size: 14px; font-weight: 500;
  text-decoration: none; cursor: pointer;
}
.app-btn:hover { background: var(--sel); border-color: var(--sel-border); }
.app-btn:active { transform: scale(0.98); }
.app-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.app-btn__img { width: 30px; height: 30px; border-radius: 8px; flex: none; }
.toast {
  position: fixed; inset-inline: 16px; bottom: 96px; z-index: 50; max-width: 420px; margin-inline: auto; padding: 12px 16px;
  border-radius: 16px; background: var(--ink); color: var(--on-ink); font-size: 14px; line-height: 1.8; text-align: center;
  box-shadow: var(--shadow); opacity: 0; transform: translateY(8px); pointer-events: none; transition: opacity .2s, transform .2s;
}
.toast.is-on { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }
.contact-rows { list-style: none; margin: 8px 0 0; padding: 0; }
.contact-row { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); }
.contact-row:first-child { border-top: 0; }
.contact-row__ico { flex: none; width: 40px; height: 40px; border-radius: 14px; display: grid; place-items: center; background: var(--tint); color: var(--brand-text); }
.contact-row__ico svg { width: 20px; height: 20px; }
.contact-row__body { min-width: 0; display: flex; flex-direction: column; line-height: 1.6; }
.contact-row__label { font-size: 12.5px; color: var(--muted); }
.contact-row__value { font-size: 15px; font-weight: 500; overflow-wrap: anywhere; }
.contact-row__value a { font-weight: 500; }
.contact-row__value bdi { unicode-bidi: isolate; }
.alert {
  display: flex; gap: 12px; margin-top: 14px; padding: 16px; border-radius: var(--r-tile);
  background: var(--danger-bg); border: 1px solid color-mix(in srgb, var(--danger) 28%, transparent);
}
.alert > svg { flex: none; width: 24px; height: 24px; margin-top: 2px; color: var(--danger); }
.alert h2 { font-size: 15px; font-weight: 600; color: var(--danger); }
.alert p { margin-top: 2px; font-size: 13.5px; line-height: 1.9; }
.alert a { font-weight: 600; }
.acc { margin-top: 10px; border-radius: 24px; background: var(--card); border: 1px solid var(--border); box-shadow: var(--shadow-sm); overflow: hidden; }
.acc > summary {
  display: flex; align-items: center; gap: 10px; min-height: 58px; padding: 0 18px; list-style: none; cursor: pointer;
  font-size: 15px; font-weight: 600;
}
.acc > summary::-webkit-details-marker { display: none; }
.acc > summary > span { flex: 1; }
.acc > summary .count { font-size: 12.5px; font-weight: 500; color: var(--muted); }
.acc > summary svg { width: 20px; height: 20px; color: var(--muted); transition: transform 180ms ease; }
.acc[open] > summary svg { transform: rotate(180deg); }
.acc__body { padding: 0 18px 8px; }
.entry { padding: 12px 0; border-top: 1px solid var(--border); }
.entry h3 { font-size: 14.5px; font-weight: 600; line-height: 1.7; }
.entry p { margin-top: 2px; font-size: 14px; line-height: 2; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text); }
.entry a { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; font-size: 13.5px; font-weight: 500; }
.entry a svg { width: 16px; height: 16px; }

/* ---------- chat inside the shell ---------- */
.screen--chat { height: 100%; padding: 2px 10px calc(98px + env(safe-area-inset-bottom)); }
:root.kbd .screen--chat { padding-bottom: 8px; }
.screen--chat .layout { flex: 1; min-height: 0; width: 100%; max-width: 1180px; margin-inline: auto; display: flex; gap: 16px; }

/* ---------- larger screens: floating rail on the start side ---------- */
@media (min-width: 861px), (orientation: landscape) and (min-width: 600px) and (max-height: 520px) {
  .shell { grid-template-rows: minmax(0, 1fr); padding-left: 0; padding-right: 0; }
  .rail {
    position: absolute; z-index: 10; inset-block: 16px; inset-inline-start: 16px; width: 232px; min-height: 0;
    flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 6px; padding: 18px 12px 14px;
    background: var(--card); border: 1px solid var(--border); border-radius: var(--r-card); box-shadow: var(--shadow);
  }
  .brand { padding: 4px 6px 16px; }
  .nav {
    position: static; display: flex; flex-direction: column; gap: 4px; height: auto; padding: 0;
    background: none; border: 0; border-radius: 0; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none;
  }
  .nav__item {
    flex-direction: row; justify-content: flex-start; align-items: center; gap: 12px; min-height: 52px; padding: 0 10px;
    border-radius: 999px; font-size: 14.5px;
  }
  .nav__ico, .nav__item--chat .nav__ico { width: 36px; height: 36px; margin-top: 0; border-radius: 50%; background: transparent; box-shadow: none; }
  .nav__ico svg { width: 22px; height: 22px; }
  .nav__item:hover { background: var(--tint); }
  .nav__item:hover .nav__ico { background: transparent; }
  .nav__item[aria-current="page"] { background: var(--sel); }
  .nav__item[aria-current="page"] .nav__ico { background: transparent; }
  .nav__item--chat { background: var(--ink); color: var(--on-ink); margin-block: 6px; box-shadow: 0 10px 22px var(--ring); }
  .nav__item--chat .nav__ico, .nav__item--chat:hover .nav__ico, .nav__item--chat[aria-current="page"] .nav__ico { background: transparent; color: var(--on-ink); box-shadow: none; filter: none; }
  .nav__item--chat:hover { background: var(--ink); filter: brightness(1.2); }
  .nav__item--chat[aria-current="page"] { background: var(--ink); outline: 2px solid var(--sel-border); outline-offset: 2px; }
  .tools { margin-top: auto; justify-content: center; padding-top: 12px; border-top: 1px solid var(--border); }
  :root.kbd .nav { display: flex; }
  .stage { grid-row: 1; padding-inline-start: 264px; }
  .screen { --pad: 32px; padding: 28px var(--pad) 48px; }
  .screen--chat { padding: 20px 28px 24px; }
  .page-head h1 { font-size: 30px; }
  .dlist { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .toolbar { top: -28px; padding-top: 34px; }
  .svc-grid { gap: 14px; }
  .find { padding: 28px 22px 22px; }
}
/* short landscape windows: a tighter rail */
@media (max-height: 560px) and (min-width: 600px) {
  .rail { inset-block: 8px; padding-block: 10px 8px; }
  .brand { padding-bottom: 6px; }
  .brand__sub { display: none; }
  .nav__item { min-height: 44px; }
}

/* ---------- embedded in the hospital website's overlay ---------- */
:root[data-embed] .rail { padding-inline-end: 112px; } /* room for the host page's «خروج» button */
@media (max-width: 499px) {
  :root[data-embed] .logo, :root[data-embed] .brand__sub { display: none; }
}
@media (min-width: 861px), (orientation: landscape) and (min-width: 600px) and (max-height: 520px) {
  :root[data-embed] .rail { padding-inline-end: 12px; }
  :root[data-embed] .logo, :root[data-embed] .brand__sub { display: revert; }
  :root[data-embed] .stage { padding-top: 62px; }
}

/* roomy phones and small tablets */
@media (min-width: 600px) and (max-width: 860px) {
  .screen { --pad: 28px; }
  .dlist { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 359px) {
  .svc-grid { gap: 8px; }
  .svc { padding: 12px 10px 10px; }
  .stat__ico { display: none; }
}

/* ---------- insurance screen (#insurance) ---------- */
.page-head--bar { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.page-head--bar h1 { font-size: 24px; }
.page-head--bar .round-btn { margin-top: 2px; }
.ins-find { margin: 0 0 8px; }
.ins-find .pill-field { display: block; }
.ins-inquire { margin: 0 4px 10px; font-size: 12.5px; line-height: 1.9; color: var(--muted); }
.ins-inquire a { display: inline-block; font-weight: 600; white-space: nowrap; }
#insurance-body .result-count { margin: 0 4px 8px; }
.ins-cols, .ins-row { display: grid; grid-template-columns: minmax(0, 1fr) repeat(3, 54px); align-items: center; }
.ins-cols { padding: 0 14px; margin-bottom: 4px; font-size: 11.5px; color: var(--muted); }
.ins-cols span + span { text-align: center; }
.ins-list { list-style: none; margin: 0; padding: 0; border-radius: var(--r-tile); background: var(--card); border: 1px solid var(--border); box-shadow: var(--shadow-sm); overflow: hidden; }
.ins-list > li[hidden] { display: none; }
.ins-list > li + li { border-top: 1px solid var(--border); }
.ins-row {
  width: 100%; min-height: 52px; padding: 6px 14px; border: 0; background: transparent; color: var(--text);
  font: inherit; text-align: start; cursor: pointer; transition: background-color 140ms ease;
}
.ins-row:hover { background: var(--panel); }
.ins-row:active { background: var(--sel); }
.ins-row:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; background: var(--panel); }
.ins-row__name { padding-inline-end: 8px; font-size: 14.5px; font-weight: 500; line-height: 1.6; overflow-wrap: anywhere; }
.ins-mark { justify-self: center; display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; font-size: 16px; line-height: 1; }
.ins-mark svg { width: 17px; height: 17px; }
.ins-mark--yes { background: var(--ok-bg); color: var(--ok); }
.ins-mark--no { background: var(--panel); color: var(--muted); }
.ins-mark--part { background: var(--warn-bg); color: var(--warn); }
.ins-mark--none { color: var(--muted); }
.ins-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; justify-content: center; margin-top: 12px; font-size: 12px; color: var(--muted); }
.ins-legend__key { display: inline-flex; align-items: center; gap: 6px; }
.ins-legend .ins-mark { width: 22px; height: 22px; }
.ins-legend .ins-mark svg { width: 14px; height: 14px; }
.ins-link { display: flex; align-items: center; gap: 12px; min-height: 64px; text-decoration: none; color: var(--text); }
.ins-link__text { flex: 1; display: flex; flex-direction: column; line-height: 1.6; }
.ins-link__text strong { font-size: 15px; font-weight: 600; }
.ins-link__text small { font-size: 12.5px; color: var(--muted); }
.ins-link > svg:last-child { width: 20px; height: 20px; color: var(--muted); }

/* bottom sheet (a modal <dialog>) */
.sheet--bottom {
  width: min(560px, 100%); max-width: 100%; max-height: 88dvh; margin: auto auto 0; overflow: auto;
  border-radius: var(--r-card) var(--r-card) 0 0; border-bottom: 0; animation: sheet-up 240ms ease both;
}
.sheet--bottom::before { content: ""; display: block; width: 36px; height: 4px; margin: 9px auto 0; border-radius: 4px; background: var(--sel-border); }
.sheet__body { padding: 8px 20px calc(20px + env(safe-area-inset-bottom)); }
.sheet--bottom .sheet__head { margin-bottom: 10px; }
.sheet--bottom h2 { font-size: 17px; font-weight: 600; line-height: 1.7; }
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .sheet--bottom { animation: none; } }
@media (min-width: 861px) { .sheet--bottom { margin: auto; border-radius: var(--r-card); border-bottom: 1px solid var(--border); } }
.ins-facts { list-style: none; margin: 0; padding: 0; }
.ins-facts li { display: flex; align-items: center; gap: 12px; min-height: 52px; border-top: 1px solid var(--border); font-size: 14px; }
.ins-facts li:first-child { border-top: 0; }
.ins-facts li span:nth-child(2) { flex: 1; color: var(--muted); }
.ins-facts strong { font-weight: 600; }
.ins-rule { display: flex; gap: 10px; margin-top: 10px; padding: 12px 14px; border-radius: var(--r-tile); background: var(--warn-bg); color: var(--warn); }
.ins-rule > svg { flex: none; width: 20px; height: 20px; margin-top: 4px; }
.ins-rule p { font-size: 13.5px; line-height: 1.9; }
.ins-rule p + p { margin-top: 4px; }
.ins-actions { display: grid; gap: 10px; margin-top: 16px; }
.ins-block { margin-top: 18px; }
.ins-block h3 { margin: 0 0 4px; font-size: 14.5px; font-weight: 600; }
.ins-block p, .ins-block li, .ins-intro { font-size: 14px; line-height: 2; overflow-wrap: anywhere; }
.ins-block ul, .ins-block ol { margin: 0; padding-inline-start: 22px; }
.ins-block li + li { margin-top: 4px; }
.ins-intro { margin: 0; color: var(--muted); }
.ins-muted { color: var(--muted); font-size: 13px; }
.ins-cols2 { columns: 2; column-gap: 20px; }
.ins-block .ins-contacts { list-style: none; padding: 0; display: grid; gap: 10px; }
.ins-contacts li { display: flex; flex-direction: column; padding: 12px 14px; border-radius: var(--r-tile); background: var(--panel); border: 1px solid var(--border); }
.ins-contacts li span { font-size: 13px; color: var(--muted); }
.ins-contacts li a { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; font-weight: 600; }
.ins-contacts li a svg { width: 16px; height: 16px; }
@media (max-width: 420px) { .ins-cols2 { columns: 1; } }
@media (max-width: 359px) { .ins-cols, .ins-row { grid-template-columns: minmax(0, 1fr) repeat(3, 46px); } }

/* ---------- Tickets: department picker, form, thread ---------- */
.depts { display: grid; gap: 10px; }
.dept { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 64px; padding: 14px 18px; text-align: start; border-radius: 24px; background: var(--card); border: 1px solid var(--border); box-shadow: var(--shadow-sm); color: var(--text); cursor: pointer; }
.dept:hover { border-color: var(--sel-border); }
.dept__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.dept__text strong { font-size: 15.5px; font-weight: 600; }
.dept__text span { font-size: 12.5px; line-height: 1.7; color: var(--muted); }
.dept svg { flex: none; width: 20px; height: 20px; color: var(--muted); }
.ticket-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.ticket-head h2 { font-size: 18px; font-weight: 600; }
.ticket-head .form-note { margin-top: 4px; }
.input--area { min-height: 120px; padding-block: 12px; line-height: 1.9; resize: vertical; }
select.input { appearance: auto; }
.consent { margin: 4px 0 14px; padding: 14px 16px; border-radius: 18px; background: var(--panel); border: 1px solid var(--border); font-size: 13px; line-height: 1.9; }
.consent ul { margin: 0 0 10px; padding-inline-start: 18px; }
.consent__check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 500; }
.consent__check input { width: 22px; height: 22px; flex: none; accent-color: var(--brand); }
.files { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.files li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 14px; border-radius: 14px; background: var(--panel); font-size: 13px; }
.files .link-btn svg { width: 18px; height: 18px; }
.emergency { display: flex; gap: 12px; margin-bottom: 14px; padding: 16px; border-radius: 20px; background: var(--danger-bg); color: var(--danger); font-size: 14px; line-height: 1.9; font-weight: 500; }
.emergency > svg { flex: none; width: 26px; height: 26px; margin-top: 2px; }
.emergency p { margin: 0 0 6px; }
.emergency .btn { margin-top: 8px; }
.code { font-weight: 700; letter-spacing: .06em; unicode-bidi: isolate; }
.reqs-title { margin: 6px 4px 10px; font-size: 15px; font-weight: 600; }
.req--ticket { display: block; }
.thread-msgs { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.tmsg { padding: 10px 14px; border-radius: 16px; background: var(--panel); border: 1px solid var(--border); }
.tmsg--staff { background: var(--tint); border-color: var(--sel-border); }
.tmsg__who { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; font-weight: 600; color: var(--brand-text); }
.tmsg__who span { font-weight: 400; color: var(--muted); }
.tmsg p { margin: 4px 0 0; font-size: 14px; line-height: 1.9; white-space: pre-wrap; overflow-wrap: anywhere; }
.reply { display: grid; gap: 8px; margin-top: 12px; }
.reply .input--area { min-height: 72px; }
.lookup { margin-top: 18px; }
.lookup h3 { font-size: 15px; font-weight: 600; }
.tickets-in-mine { margin-top: 14px; }
.ask-doc { margin-top: 14px; }
.ticket-head .link-btn { white-space: nowrap; }
