/* Patient portal v4: patient app (mobile-first) and public booking page.
   Same tokens as the staff app; the look follows pics/color reference.jpg:
   pale steel-blue page, white cards, steel-blue bands, pill buttons, line-art department tiles. */
body.portal { font-size: 16px; background: var(--c-bg); }
.portal .brand__logo { width: 36px; height: 36px; border-radius: 10px; background: var(--brand-mark); display: grid; place-items: center; color: #fff; flex: none; }
.portal .brand__logo svg { width: 20px; height: 20px; fill: currentColor; stroke: none; }

/* ---------- Patient app (phone) ---------- */
.p-shell { width: 100%; max-width: 520px; margin: 0 auto; min-height: 100vh; background: var(--c-bg); display: flex; flex-direction: column; }
.p-top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--c-surface); border-bottom: 1px solid var(--c-border); }
.p-top__title { font-weight: 700; font-size: 17px; line-height: 1.2; }
.p-top .segmented span { padding: 5px 12px; }
.p-body { padding: 18px 16px 24px; display: flex; flex-direction: column; gap: 18px; flex: 1; min-width: 0; }
.p-hello { font-size: 15px; color: var(--c-text-2); }
.p-hello b { display: block; font-size: 24px; color: var(--c-text); }

.p-hero { display: flex; flex-direction: column; gap: 12px; padding: 18px; border-radius: var(--r-xl); background: var(--blue-700); color: #fff; min-width: 0; }
.p-hero__top { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; font-weight: 650; }
.p-hero__chip { display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: 99px; background: rgba(255, 255, 255, .16); font-size: 13px; font-weight: 650; }
.p-token { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: end; padding: 14px 16px; border-radius: var(--r-lg); background: rgba(255, 255, 255, .12); }
.p-token__k { font-size: 13px; opacity: .9; }
.p-token__n { font-size: 44px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.p-token__now { font-size: 24px; font-weight: 700; line-height: 1.1; text-align: right; }
.p-hero__big { font-size: 18px; font-weight: 700; }
.p-hero__sub { font-size: 14px; opacity: .92; }
.p-hero .progress { background: rgba(255, 255, 255, .22); }
.p-hero .progress > span { background: #fff; }
.p-hero .ur { color: #fff; font-size: 16px; line-height: 2; }

.p-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.p-tile { display: flex; align-items: center; gap: 12px; min-height: 72px; padding: 14px; border-radius: var(--r-lg); background: var(--c-surface); border: 1px solid var(--c-border); color: var(--c-text); font-size: 16px; font-weight: 700; }
.p-tile:hover { text-decoration: none; border-color: var(--c-primary); }
.p-tile__icon { width: 44px; height: 44px; flex: none; border-radius: 12px; display: grid; place-items: center; background: var(--blue-100); color: var(--blue-700); }
.p-tile__icon .icon { width: 24px; height: 24px; }

.p-members { display: flex; gap: 14px; overflow-x: auto; padding: 2px 2px 6px; scrollbar-width: none; }
.p-member { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 64px; font-size: 14px; font-weight: 650; color: var(--c-text); }
.p-member:hover { text-decoration: none; }
.p-member .avatar { width: 52px; height: 52px; font-size: 16px; }
.p-member.is-active .avatar { box-shadow: 0 0 0 3px var(--c-surface), 0 0 0 5px var(--blue-600); }
.p-section-title { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-weight: 700; font-size: 17px; }
.p-card { display: flex; flex-direction: column; gap: 12px; padding: 16px; border-radius: var(--r-lg); background: var(--c-surface); border: 1px solid var(--c-border); min-width: 0; }
.p-doc { display: flex; gap: 12px; align-items: center; }
.p-shell .btn { min-height: 46px; }
.p-shell .btn--sm { min-height: 38px; }
.p-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.p-actions .btn { flex: 1 1 120px; }

.p-tabbar { position: sticky; bottom: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--c-surface); border-top: 1px solid var(--c-border); padding-bottom: env(safe-area-inset-bottom); }
.p-tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 60px; font-size: 13px; font-weight: 650; color: var(--c-text-3); }
.p-tabbar a .icon { width: 22px; height: 22px; }
.p-tabbar a:hover { text-decoration: none; color: var(--c-text); }
.p-tabbar a.is-active { color: var(--blue-800); }
.p-tabbar a.is-active .icon { color: var(--blue-700); }
.lang-switch { margin-left: auto; font-size: 15px; font-weight: 650; }

/* Dates and slots (booking) */
.date-strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.date-pill { position: relative; display: flex; flex-direction: column; align-items: center; min-width: 64px; padding: 10px 0; border-radius: var(--r-md); border: 1px solid var(--c-input-border); background: var(--c-surface); cursor: pointer; font-size: 13px; color: var(--c-text-2); }
.date-pill b { font-size: 20px; color: var(--c-text); }
.date-pill input { position: absolute; opacity: 0; pointer-events: none; }
.date-pill:has(input:checked) { background: var(--c-primary); border-color: var(--c-primary); color: var(--c-on-primary); }
.date-pill:has(input:checked) b { color: var(--c-on-primary); }
.date-pill--off { opacity: .45; cursor: not-allowed; }

/* ---------- Public booking site (desktop) ---------- */
.site { max-width: 1200px; margin: 0 auto; padding: 16px 20px 0; }
.site-nav { display: flex; align-items: center; gap: 18px; padding: 10px 10px 10px 16px; border-radius: var(--r-full); background: var(--c-surface); border: 1px solid var(--c-border); box-shadow: var(--shadow-sm); }
.site-nav .brand { padding: 0; gap: 10px; }
.site-nav .brand__name { font-size: 17px; }
.site-nav__links { display: flex; gap: 4px; margin-left: auto; }
.site-nav__links a { padding: 8px 14px; border-radius: var(--r-full); color: var(--c-text-2); font-weight: 650; font-size: 15px; }
.site-nav__links a:hover { background: var(--c-surface-3); text-decoration: none; color: var(--c-text); }
.site-hero { position: relative; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 32px; align-items: center; padding: 48px 8px 36px; }
.site-hero h1 { font-size: 44px; line-height: 1.12; }
.site-hero__lead { font-size: 18px; color: var(--c-text-2); max-width: 52ch; margin-top: 14px; }
.site-stats { display: flex; flex-wrap: wrap; gap: 0; margin-top: 26px; border-radius: var(--r-lg); background: var(--c-surface); border: 1px solid var(--c-border); width: max-content; max-width: 100%; }
.site-stats div { padding: 12px 22px; border-right: 1px solid var(--c-border); }
.site-stats div:last-child { border-right: 0; }
.site-stats b { display: block; font-size: 22px; }
.site-stats span { font-size: 14px; color: var(--c-text-3); }
.site-art { position: relative; min-height: 390px; }
.site-art__blob { position: absolute; inset: 0 0 0 10%; border-radius: 46% 54% 42% 58% / 52% 44% 56% 48%; background: var(--blue-400); }
.site-art__blob::after { content: ""; position: absolute; width: 90px; height: 90px; right: -18px; bottom: 26px; border-radius: 50%; background: var(--blue-300); }
.site-art__card { position: absolute; display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: var(--r-lg); background: var(--c-surface); box-shadow: var(--shadow-lg); font-size: 14px; }
.site-art__card b { display: block; font-size: 15px; }
.site-art__card--a { left: 0; top: 0; }
.site-art__card--b { right: 0; bottom: 0; }
.site-art__icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--c-text); color: #fff; flex: none; }
.site-art__icon--ok { background: var(--st-ok); }
.site-art__docs { position: absolute; left: 55%; top: 50%; translate: -50% -50%; display: grid; grid-template-columns: repeat(2, 92px); gap: 12px; }
.site-art__docs .dept-tile { padding: 12px 6px 10px; font-size: 13px; }
.site-art__docs .dept-tile svg { width: 40px; height: 40px; }

/* Search strip: the steel-blue band from the reference, with white fields */
.search-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) auto; gap: 12px; align-items: end; padding: 18px; border-radius: var(--r-xl); background: var(--blue-600); }
.search-strip .field > label { color: #fff; }
.search-strip .select { border-color: transparent; }
.search-strip .btn { height: 44px; background: #fff; border-color: #fff; color: var(--blue-800); }
.search-strip .btn:hover { background: var(--blue-100); }

.site-section { padding: 40px 0 8px; display: flex; flex-direction: column; gap: 18px; }
.site-section__head { text-align: center; }
.site-section__head h2 { font-size: 26px; }
.site-section__head p { color: var(--c-text-3); margin-top: 4px; }
.site .dept-tiles { grid-template-columns: repeat(8, minmax(0, 1fr)); }
.site .dept-tile svg { width: 60px; height: 60px; }

.book-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; padding: 8px 0 48px; }
.step-card { display: flex; flex-direction: column; gap: 16px; padding: 20px; border-radius: var(--r-lg); background: var(--c-surface); border: 1px solid var(--c-border); }
.step-card__h { display: flex; align-items: center; gap: 12px; font-size: 19px; font-weight: 700; }
.step-card__n { width: 32px; height: 32px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--c-primary); color: var(--c-on-primary); font-size: 15px; }
.doc-pick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.doc-opt { position: relative; display: flex; gap: 14px; padding: 16px; border-radius: var(--r-lg); border: 1px solid var(--c-border-strong); background: var(--c-surface); cursor: pointer; }
.doc-opt input { position: absolute; opacity: 0; pointer-events: none; }
.doc-opt:hover { border-color: var(--c-primary); }
.doc-opt:has(input:checked) { border-color: var(--c-primary); background: var(--blue-50); box-shadow: inset 0 0 0 1px var(--c-primary); }
.doc-opt:has(input:focus-visible) { outline: 2px solid var(--c-primary); outline-offset: 2px; }
.doc-opt__name { font-weight: 700; font-size: 16px; }
.doc-opt__meta { font-size: 14px; color: var(--c-text-3); }
.doc-opt__row { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 6px; font-size: 14px; }
.doc-opt__next { color: var(--st-ok); font-weight: 700; }
.book-summary { position: sticky; top: 16px; }
.site-foot { padding: 28px 0 36px; border-top: 1px solid var(--c-border); color: var(--c-text-3); font-size: 14px; display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; }

@media (max-width: 1080px) {
  .site .dept-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .search-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .search-strip .btn { grid-column: 1 / -1; }
}
@media (max-width: 900px) {
  .site-hero { grid-template-columns: minmax(0, 1fr); padding-top: 28px; }
  .site-art { display: none; }
  .site-hero h1 { font-size: 34px; }
  .book-grid { grid-template-columns: minmax(0, 1fr); }
  .book-summary { position: static; }
  .site-nav__links { display: none; }
}
@media (max-width: 600px) {
  .site { padding: 12px 16px 0; }
  .site-nav { border-radius: var(--r-lg); }
  .site-nav .btn span { display: none; }
  .site-hero h1 { font-size: 30px; }
  .site-stats { width: 100%; }
  .site-stats div { flex: 1 1 45%; padding: 10px 14px; }
  .search-strip { grid-template-columns: minmax(0, 1fr); }
  .site .dept-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .doc-pick { grid-template-columns: minmax(0, 1fr); }
}
