/* =========================================================
   بخش بیمار — موبایل‌محور
   ========================================================= */

.app { max-width: 560px; margin: 0 auto; min-height: 100vh; padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px)); }
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px max(16px, env(safe-area-inset-left, 0px)) 12px max(16px, env(safe-area-inset-right, 0px));
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); }
.brand img { width: 44px; height: 44px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 1px var(--line); }
.brand b { display: block; font-size: 16px; font-weight: 800; }
.brand small { display: block; font-size: 12px; color: var(--muted); margin-top: -2px; }

.page { padding: 4px max(16px, env(safe-area-inset-right, 0px)) 24px max(16px, env(safe-area-inset-left, 0px)); display: grid; gap: 16px; }
.page-head { display: flex; align-items: center; gap: 10px; }
.page-head h1 { font-size: 20px; font-weight: 800; }
.page-head p { margin: 0; color: var(--muted); font-size: 13px; }
.back-btn { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; cursor: pointer; flex: none; color: var(--text); }
.back-btn svg { width: 18px; height: 18px; }

/* قهرمان صفحه اصلی */
.hero {
  position: relative; overflow: hidden;
  border-radius: 22px; padding: 26px 22px 22px; color: #fff;
  background:
    radial-gradient(120% 90% at 0% 100%, rgba(255, 255, 255, .10), transparent 55%),
    linear-gradient(200deg, #1d5597 0%, var(--primary) 45%, var(--primary-700) 100%);
}
.hero::after {
  content: ""; position: absolute; inset-inline-start: -40px; top: -40px; width: 180px; height: 180px;
  background-image: linear-gradient(rgba(255,255,255,.09) 2px, transparent 2px), linear-gradient(90deg, rgba(255,255,255,.09) 2px, transparent 2px);
  background-size: 22px 22px; transform: rotate(12deg); border-radius: 24px; pointer-events: none;
}
.hero h1 { font-size: 24px; font-weight: 800; position: relative; }
.hero p { margin: 6px 0 18px; opacity: .88; font-size: 14px; position: relative; }
.hero .btn { position: relative; background: #fff; color: var(--primary); border-color: #fff; font-weight: 800; }
.hero .btn:hover { background: #f1f5fb; }

.next-appt { display: flex; gap: 14px; align-items: center; padding: 14px 16px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); color: var(--text); }
.turn-chip { flex: none; width: 64px; height: 64px; border-radius: 16px; background: var(--primary); color: #fff; display: grid; place-items: center; text-align: center; line-height: 1.1; }
.turn-chip small { font-size: 10.5px; opacity: .85; display: block; }
.turn-chip b { font-size: 24px; font-weight: 800; }

/* کارت‌های میان‌بُر */
.nav-card { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); color: var(--text); transition: border-color .15s, box-shadow .15s; }
.nav-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.nav-card .ico { width: 46px; height: 46px; border-radius: 14px; background: var(--primary-tint); color: var(--primary); display: grid; place-items: center; flex: none; }
.nav-card .ico svg { width: 22px; height: 22px; }
.nav-card b { display: block; font-size: 15.5px; }
.nav-card small { display: block; color: var(--muted); font-size: 12.5px; }
.nav-card .chev { margin-inline-start: auto; color: var(--faint); width: 20px; height: 20px; }

.footer-note { text-align: center; color: var(--muted); font-size: 12.5px; display: grid; gap: 2px; padding-top: 4px; }

/* تخصص‌ها */
.spec-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.spec-item { padding: 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); color: var(--text); display: grid; gap: 2px; text-align: start; cursor: pointer; }
.spec-item:hover { border-color: var(--primary); }
.spec-item b { font-size: 14.5px; line-height: 1.5; }
.spec-item small { color: var(--muted); font-size: 12px; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); font-size: 13px; cursor: pointer; white-space: nowrap; }
.chip.on { background: var(--primary); border-color: var(--primary); color: #fff; }

/* پزشک */
.doc-card { display: flex; gap: 14px; align-items: center; padding: 14px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); color: var(--text); }
.doc-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.doc-card b { display: block; font-size: 15.5px; }
.doc-card .spec { color: var(--primary); font-size: 13px; font-weight: 600; }
.doc-card .chev { color: var(--faint); width: 20px; height: 20px; flex: none; }
.next-tag { display: inline-block; margin-top: 6px; font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 999px; background: var(--ok-soft); color: var(--ok); }
.next-tag.none { background: var(--surface-2); color: var(--muted); }

.profile-card { padding: 20px 16px; border-radius: 20px; background: var(--surface); border: 1px solid var(--line); display: grid; gap: 14px; }
.profile-top { display: flex; gap: 16px; align-items: center; }
.profile-top h2 { font-size: 19px; font-weight: 800; }
.profile-top .spec { color: var(--primary); font-weight: 600; font-size: 14px; }
.profile-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--muted); font-size: 12.5px; }
.profile-bio { color: var(--muted); font-size: 14px; margin: 0; white-space: pre-line; }

.section-title { font-size: 15px; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.section-title svg { width: 18px; height: 18px; color: var(--primary); }

.days { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.day-opt { position: relative; padding: 12px; border-radius: 16px; border: 1.5px solid var(--line); background: var(--surface); cursor: pointer; text-align: start; display: grid; gap: 2px; }
.day-opt:hover:not(:disabled) { border-color: var(--primary); }
.day-opt.sel { border-color: var(--primary); background: var(--primary-tint); box-shadow: 0 0 0 3px var(--primary-soft); }
.day-opt:disabled { cursor: not-allowed; opacity: .55; background: var(--surface-2); }
.day-opt .wd { font-size: 12.5px; color: var(--muted); }
.day-opt .dt { font-size: 15.5px; font-weight: 800; }
.day-opt .hr { font-size: 12.5px; color: var(--muted); }
.day-opt .cap { margin-top: 6px; font-size: 12px; font-weight: 700; color: var(--ok); }
.day-opt .cap.low { color: var(--warn); }
.day-opt .cap.full { color: var(--danger); }

.sticky-cta {
  position: fixed; inset-inline: 0; bottom: calc(68px + env(safe-area-inset-bottom, 0px)); z-index: 40;
  padding: 10px max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px));
  background: linear-gradient(to top, var(--bg) 70%, transparent);
}
.sticky-cta > div { max-width: 528px; margin: 0 auto; }

/* مراحل رزرو */
.steps { display: flex; gap: 6px; }
.steps span { flex: 1; height: 4px; border-radius: 4px; background: var(--line); }
.steps span.on { background: var(--primary); }
.otp-input { font-size: 26px; letter-spacing: 12px; text-align: center; font-weight: 800; direction: ltr; min-height: 58px; }
.test-code { background: var(--warn-soft); color: #6d4408; border: 1px dashed #e2bd7b; border-radius: 12px; padding: 10px 14px; font-size: 13.5px; }
.test-code b { font-size: 18px; letter-spacing: 3px; }

.summary { display: grid; gap: 0; }
.summary .r { display: flex; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.summary .r:last-child { border-bottom: 0; }
.summary .r span:first-child { color: var(--muted); }
.summary .r span:last-child { font-weight: 700; text-align: end; }

/* برگه نوبت (موفق / جزئیات) */
.ticket { border-radius: 22px; background: var(--surface); border: 1px solid var(--line); overflow: hidden; }
.ticket-top { background: var(--primary); color: #fff; padding: 20px; text-align: center; position: relative; }
.ticket-top .lbl { font-size: 13px; opacity: .85; }
.ticket-top .big { font-size: 64px; font-weight: 900; line-height: 1.1; font-variant-numeric: tabular-nums; }
.ticket-top .win { font-size: 14px; background: rgba(255,255,255,.14); display: inline-block; padding: 4px 14px; border-radius: 999px; margin-top: 6px; }
.ticket-cut { height: 0; border-top: 2px dashed var(--line); margin: 0 18px; position: relative; }
.ticket-cut::before, .ticket-cut::after { content: ""; position: absolute; top: -12px; width: 22px; height: 22px; border-radius: 50%; background: var(--bg); border: 1px solid var(--line); }
.ticket-cut::before { inset-inline-start: -30px; }
.ticket-cut::after { inset-inline-end: -30px; }
.ticket-body { padding: 16px 20px 20px; }
.success-mark { width: 64px; height: 64px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); display: grid; place-items: center; margin: 0 auto; }
.success-mark svg { width: 34px; height: 34px; }
.live-box { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.live-box > div { padding: 12px; border-radius: 14px; background: var(--primary-tint); text-align: center; }
.live-box b { display: block; font-size: 26px; font-weight: 900; color: var(--primary); }
.live-box small { color: var(--muted); font-size: 12px; }

.tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface-2); border-radius: 12px; padding: 4px; }
.tabs button { border: 0; background: none; padding: 8px; border-radius: 9px; font-weight: 600; cursor: pointer; color: var(--muted); }
.tabs button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

.appt-card { display: flex; gap: 12px; align-items: center; padding: 14px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); color: var(--text); }
.appt-card .turn-chip { width: 56px; height: 56px; border-radius: 14px; }
.appt-card .turn-chip b { font-size: 20px; }
.appt-card.past .turn-chip { background: var(--surface-2); color: var(--muted); }

/* ناوبری پایین */
.bottom-nav {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 60;
  background: var(--surface); border-top: 1px solid var(--line);
  padding: 6px max(8px, env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px));
}
.bottom-nav > div { max-width: 560px; margin: 0 auto; display: grid; grid-template-columns: repeat(4, 1fr); }
.bottom-nav a { display: grid; justify-items: center; gap: 2px; padding: 6px 0; color: var(--faint); font-size: 11.5px; font-weight: 600; border-radius: 12px; }
.bottom-nav a svg { width: 22px; height: 22px; }
.bottom-nav a.on { color: var(--primary); }
.bottom-nav a.on svg { stroke-width: 2.2; }

@media (min-width: 600px) {
  .page { padding-top: 8px; }
  .hero h1 { font-size: 27px; }
}

/* ---------- برنامه هفتگی ---------- */
body.wide .app { max-width: 1120px; }
.wk-nav { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.wk-nav .btn.disabled { opacity: .4; pointer-events: none; }
.wk-range { text-align: center; display: grid; line-height: 1.5; }
.wk-range b { font-size: 15px; }
.wk-range span { font-size: 12.5px; color: var(--muted); }
.wk-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.wk-tools .select { width: auto; min-width: 160px; flex: 1 1 160px; }
.wk-tools .search-box { flex: 2 1 200px; }
.wk-toggle { flex: 1 1 200px; }
.wk-days { padding-bottom: 4px; }
.wk-day { display: grid; justify-items: center; gap: 0; padding: 6px 12px; border-radius: 14px; line-height: 1.5; min-width: 74px; }
.wk-day b { font-size: 13px; }
.wk-day span { font-size: 12px; }
.wk-day small { font-size: 11px; opacity: .75; }
.wk-day.is-past:not(.on) { opacity: .5; }
.wk-row .spec { font-size: 12.5px; }
.wk-tag { flex: none; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.wk-tag.full { background: var(--danger-soft); color: var(--danger); }
.wk-tag.off { background: var(--warn-soft); color: var(--warn); }

.wk-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.wk-table { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 760px; font-size: 13px; }
.wk-table th, .wk-table td { border-bottom: 1px solid var(--line); padding: 6px; text-align: center; vertical-align: middle; }
.wk-table thead th { background: var(--surface-2); font-weight: 600; position: sticky; top: 0; }
.wk-table thead th b { display: block; font-size: 13px; }
.wk-table thead th span { display: block; font-size: 11.5px; color: var(--muted); font-weight: 500; }
.wk-table thead th.today { background: var(--primary); color: #fff; }
.wk-table thead th.today span { color: rgba(255,255,255,.8); }
.wk-table th.is-past, .wk-table th.is-past span { color: var(--faint); }
.wk-table td.today { background: var(--primary-tint); }
.wk-table tbody tr:last-child > * { border-bottom: 0; }
.wk-doc { position: sticky; inset-inline-start: 0; z-index: 1; background: var(--surface); text-align: start !important; min-width: 190px; box-shadow: -1px 0 0 var(--line) inset; }
thead .wk-doc { background: var(--surface-2); z-index: 2; }
.wk-doc a { display: flex; gap: 8px; align-items: center; color: var(--text); }
.wk-doc b { display: block; font-size: 13.5px; }
.wk-doc small { display: block; font-size: 11.5px; color: var(--primary); font-weight: 600; }
.wk-cell { display: grid; gap: 0; padding: 6px 4px; border-radius: 10px; line-height: 1.45; font-variant-numeric: tabular-nums; }
.wk-cell b { font-size: 13.5px; }
.wk-cell span { font-size: 11.5px; color: var(--muted); }
.wk-cell small { font-size: 10.5px; font-weight: 700; margin-top: 2px; }
.wk-cell.ok { background: var(--ok-soft); }
.wk-cell.ok small { color: var(--ok); }
.wk-table a .wk-cell.ok:hover { box-shadow: 0 0 0 2px var(--ok) inset; }
.wk-cell.full { background: var(--danger-soft); }
.wk-cell.full small { color: var(--danger); }
.wk-cell.past { background: var(--surface-2); opacity: .7; }
.wk-cell.past small { color: var(--faint); }
.wk-cell.off { background: var(--warn-soft); color: var(--warn); font-weight: 700; font-size: 12px; }
.wk-none { color: var(--line-strong); }
.wk-legend { gap: 14px; }
.wk-legend span { display: inline-flex; align-items: center; gap: 6px; }
.wk-legend i { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }
.wk-legend i.ok { background: var(--ok-soft); box-shadow: 0 0 0 1px var(--ok) inset; }
.wk-legend i.full { background: var(--danger-soft); box-shadow: 0 0 0 1px var(--danger) inset; }
.wk-legend i.off { background: var(--warn-soft); box-shadow: 0 0 0 1px var(--warn) inset; }

.page > * { min-width: 0; }
.wk-wrap, .wk-days { max-width: 100%; }
