/* Mobile Web App shell — یکپارچه با پالت پروژه */
:root {
  --app-radius: 1rem;
  --app-radius-sm: 0.75rem;
  --app-shadow: 0 8px 24px rgba(26, 43, 50, 0.08);
  --app-topbar-h: 56px;
  --app-tabbar-h: 68px;
  --app-pad: 1rem;
  --btn-h: 48px;
}

.mobile-shell {
  padding-bottom: calc(var(--app-tabbar-h) + env(safe-area-inset-bottom, 0px) + 0.5rem);
  min-height: 100dvh;
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 1030;
  background: color-mix(in srgb, var(--or-surface) 92%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--or-border);
  padding-top: env(safe-area-inset-top, 0px);
}

.app-topbar-inner {
  height: var(--app-topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0 var(--app-pad);
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
}

/* منوی افقی فقط برای دسکتاپ وب — روی موبایل/PWA/APK مخفی */
.app-web-nav {
  display: none;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 0.35rem;
  min-width: 0;
}

.app-web-nav-link {
  appearance: none;
  border: 0;
  background: transparent;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  text-decoration: none !important;
  color: var(--or-muted) !important;
  font-size: 0.9rem;
  font-weight: 650;
  white-space: nowrap;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s ease, color 0.15s ease;
}

.app-web-nav-link i {
  font-size: 1.05rem;
  line-height: 1;
}

.app-web-nav-link:hover,
.app-web-nav-link:focus-visible {
  color: var(--or-text) !important;
  background: color-mix(in srgb, var(--or-accent) 10%, transparent);
}

.app-web-nav-link.active {
  color: #fff !important;
  background: linear-gradient(145deg, #2ea0b3, #23889B);
  box-shadow: 0 6px 14px rgba(35, 136, 155, 0.28);
}

.app-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--or-text) !important;
  font-weight: 700;
}

.app-brand-mark {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: transparent;
  overflow: hidden;
  flex-shrink: 0;
}

.app-brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  border-radius: 6px;
}

.app-topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.app-icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--or-border);
  background: var(--or-surface);
  color: var(--or-text) !important;
  display: grid;
  place-items: center;
  text-decoration: none;
}

.app-chip {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  background: var(--or-surface-2);
  color: var(--or-muted) !important;
}

.app-chip.online { background: rgba(21,183,107,.18); color: #0f9456 !important; }
.app-chip.offline { background: rgba(224,160,32,.2); color: #8a6500 !important; }

.app-main {
  max-width: 720px;
  margin: 0 auto;
  padding: 1rem max(var(--app-pad), env(safe-area-inset-left, 0px)) 1.25rem max(var(--app-pad), env(safe-area-inset-right, 0px));
  width: 100%;
  box-sizing: border-box;
}

/* چارچوب ملایم صفحات کلینیکال روی دسکتاپ */
@media (min-width: 992px) {
  html:not(.is-app-shell) body.or-app:not(.admin-wide) .app-main {
    background: var(--page-frame-bg, #FFFEFB);
    border: 1px solid var(--or-border);
    border-radius: 1.25rem;
    box-shadow: var(--page-frame-shadow, 0 10px 36px rgba(40, 36, 28, 0.06));
    padding: 1.35rem 1.5rem 1.75rem;
    margin-top: 0.85rem;
    margin-bottom: 1.25rem;
    min-height: calc(100dvh - 7rem);
  }
}

.app-toast {
  border-radius: var(--app-radius-sm);
  padding: 0.75rem 1rem;
  margin-bottom: 0.85rem;
  font-size: 0.92rem;
}
.app-toast-ok { background: rgba(21,183,107,.15); color: var(--or-text) !important; }
.app-toast-err { background: rgba(241,84,18,.12); color: var(--or-text) !important; }

.app-tab {
  appearance: none;
  background: transparent;
  border: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  width: 100%;
  text-decoration: none;
}

/* Bottom tab bar */
.app-tabbar {
  position: fixed;
  bottom: 0;
  inset-inline: 0;
  z-index: 1040;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  height: calc(var(--app-tabbar-h) + env(safe-area-inset-bottom, 0px));
  padding: 0.35rem 0.25rem calc(0.35rem + env(safe-area-inset-bottom, 0px));
  background: color-mix(in srgb, var(--or-surface) 94%, transparent);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--or-border);
  box-shadow: 0 -8px 24px rgba(26, 43, 50, 0.06);
}

.app-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  text-decoration: none;
  color: var(--or-muted) !important;
  font-size: 0.68rem;
  font-weight: 600;
  border-radius: 14px;
  min-height: 52px;
  transition: color 0.18s ease, background 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.app-tab i {
  font-size: 1.25rem;
  line-height: 1;
  transition: transform 0.18s ease, color 0.18s ease;
}

.app-tab.active {
  color: #fff !important;
  font-weight: 800;
  font-size: 0.72rem;
  background: linear-gradient(145deg, #2ea0b3, #23889B);
  box-shadow: 0 8px 18px rgba(35, 136, 155, 0.35);
  transform: translateY(-2px);
}

.app-tab.active i {
  color: #fff !important;
  font-size: 1.4rem;
  transform: scale(1.08);
}

/* Unified buttons */
.btn,
.app-btn {
  min-height: var(--btn-h);
  border-radius: 14px !important;
  font-weight: 700 !important;
  padding-inline: 1.1rem !important;
}

.btn-primary,
.app-btn-primary {
  background: linear-gradient(145deg, #2ea0b3, #23889B) !important;
  border: none !important;
  color: #fff !important;
  box-shadow: 0 8px 16px rgba(35, 136, 155, 0.28);
}

.btn-outline-secondary,
.btn-outline-light {
  border-color: var(--or-border) !important;
  color: var(--or-text) !important;
  background: var(--or-surface) !important;
}

.form-control,
.form-select {
  min-height: var(--btn-h);
  border-radius: 14px !important;
  border-color: var(--or-border) !important;
  background-color: var(--or-surface) !important;
  color: var(--or-text) !important;
}

/* دراپ‌داون سفارشی شیک (لیست بازشونده) — سراسری */
.hx-select-wrap.hx-dd,
.or-select-wrap.or-dd,
.or-select-wrap.hx-dd {
  position: relative;
  display: block;
  z-index: 1;
}
.hx-select-wrap.hx-dd.is-open,
.or-select-wrap.or-dd.is-open,
.or-dd.is-open,
.hx-dd.is-open {
  z-index: 120;
}
/* ستون Bootstrap زیر دراپ‌داون باز نیاید */
.history-wizard .row > [class*="col"]:has(.hx-dd.is-open),
.row > [class*="col"]:has(.or-dd.is-open),
.adm-form-card .mb-3:has(.or-dd.is-open),
.adm-step-body .mb-3:has(.or-dd.is-open) {
  position: relative;
  z-index: 60;
}
.history-wizard .or-wizard-body,
.history-wizard,
.history-wizard .hx-step-panel,
.history-wizard .hx-panel,
.history-wizard .hx-panel-body,
.history-wizard .row,
.adm-form-card,
.adm-panel,
.adm-step,
.adm-step-body,
.manage-panel {
  overflow: visible !important;
}
.hx-select-native {
  position: absolute !important;
  opacity: 0 !important;
  pointer-events: none !important;
  width: 1px !important;
  height: 1px !important;
  inset-inline-start: 0;
  top: 0;
}
.hx-dd-btn,
.or-dd-btn {
  width: 100%;
  min-height: var(--btn-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0.65rem 0.95rem;
  border-radius: 12px;
  border: 1px solid var(--or-border);
  background: #fff;
  color: var(--or-text);
  font-weight: 600;
  font-size: 0.92rem;
  box-shadow: 0 4px 12px rgba(40, 36, 28, 0.04);
  cursor: pointer;
  text-align: start;
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}
.hx-dd.is-open .hx-dd-btn,
.or-dd.is-open .or-dd-btn,
.or-dd.is-open .hx-dd-btn {
  border-color: color-mix(in srgb, var(--or-accent) 55%, var(--or-border));
  box-shadow: 0 0 0 0.2rem rgba(35, 136, 155, 0.12);
}
.hx-dd-label.is-placeholder,
.or-dd-label.is-placeholder {
  color: var(--or-muted);
  font-weight: 500;
}
.hx-dd-chevron,
.or-dd-chevron {
  color: #4a5f66;
  font-size: 0.95rem;
  transition: transform 0.18s ease;
  flex-shrink: 0;
}
.hx-dd.is-open .hx-dd-chevron,
.or-dd.is-open .or-dd-chevron,
.or-dd.is-open .hx-dd-chevron {
  transform: rotate(180deg);
  color: var(--or-accent);
}
.hx-dd-menu,
.or-dd-menu {
  list-style: none;
  margin: 0.4rem 0 0;
  padding: 0.4rem;
  position: absolute;
  inset-inline: 0;
  top: calc(100% + 2px);
  z-index: 130;
  border-radius: 0.9rem;
  border: 1px solid color-mix(in srgb, var(--or-accent) 18%, var(--or-border));
  background: #FFFEFB;
  box-shadow: 0 18px 40px rgba(40, 36, 28, 0.18);
  max-height: 14rem;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  animation: hxDdIn 0.16s ease;
}
.or-dd-menu-fixed {
  margin: 0 !important;
}
@keyframes hxDdIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
.hx-dd-item,
.or-dd-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.7rem 0.85rem;
  border-radius: 0.65rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--or-text);
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
.hx-dd-item:hover,
.hx-dd-item:focus,
.or-dd-item:hover,
.or-dd-item:focus {
  background: rgba(35, 136, 155, 0.1);
  color: #165a68;
}
.hx-dd-item.is-selected,
.or-dd-item.is-selected {
  background: linear-gradient(135deg, rgba(35, 136, 155, 0.16), rgba(21, 183, 107, 0.1));
  color: #0f4f5c;
}
.hx-dd-item.is-selected::after,
.or-dd-item.is-selected::after {
  content: "✓";
  font-size: 0.85rem;
  color: var(--or-accent);
  font-weight: 800;
}
.hx-dd-item.is-placeholder-item,
.or-dd-item.is-placeholder-item {
  color: var(--or-muted);
  font-weight: 500;
}
.hx-dd-item.is-disabled,
.or-dd-item.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* رادیوهای شرح حال (جنسیت / سابقه) */
.hx-radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.hx-radio {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 40px;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--or-border);
  background: #fff;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--or-text);
  cursor: pointer;
  margin: 0;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.hx-radio input {
  accent-color: #23889B;
  margin: 0;
}
.hx-radio:has(input:checked) {
  background: rgba(35, 136, 155, 0.12);
  border-color: color-mix(in srgb, #23889B 55%, var(--or-border));
  color: #1a6b7a;
}
.history-wizard .hx-panel-compact .hx-radio {
  min-height: 36px;
  font-size: 0.8rem;
  padding: 0.3rem 0.65rem;
}
.history-wizard .fa-digits-input {
  font-variant-numeric: normal;
  letter-spacing: 0.02em;
  font-weight: 600;
}

/* Home mobile */
.home-hero {
  margin-bottom: 1.15rem;
}

.home-hero-v2 {
  padding: 0.15rem 0 0.35rem;
}

.home-brand-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1.55rem 1.25rem 1.7rem;
  margin-bottom: 0.9rem;
  border-radius: 1.25rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 16px 34px rgba(10, 28, 70, 0.28);
  position: relative;
  overflow: hidden;
  color: #fff;
  background: linear-gradient(145deg, #0b1f4a 0%, #15356e 48%, #0a1840 100%);
  animation: none;
}

.home-brand-card::before {
  content: "";
  position: absolute;
  width: 11rem;
  height: 11rem;
  border-radius: 50%;
  top: -4.5rem;
  inset-inline-end: -3.5rem;
  background: radial-gradient(circle, rgba(90, 140, 220, 0.35), transparent 68%);
  pointer-events: none;
  z-index: 0;
}

.home-brand-card::after {
  content: "";
  position: absolute;
  width: 8rem;
  height: 8rem;
  border-radius: 50%;
  bottom: -3.2rem;
  inset-inline-start: -2.5rem;
  background: radial-gradient(circle, rgba(60, 110, 200, 0.28), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.home-hero h1 {
  font-size: 1.15rem;
  font-weight: 800;
  margin: 0;
  letter-spacing: -0.015em;
  line-height: 1.5;
  color: #fff !important;
  position: relative;
  z-index: 1;
  max-width: 16rem;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
}

.home-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.home-search-wrap > i {
  position: absolute;
  inset-inline-start: 0.95rem;
  color: var(--or-muted);
  font-size: 1.05rem;
  pointer-events: none;
  z-index: 1;
}

.home-search-wrap .form-control {
  min-height: 52px;
  border-radius: 1rem;
  font-size: 0.95rem;
  padding-inline-start: 2.55rem;
  background: var(--or-surface);
  border: 1px solid var(--or-border);
  box-shadow: 0 8px 20px rgba(26, 43, 50, 0.06);
  direction: rtl;
  text-align: right;
  unicode-bidi: plaintext;
}

.home-search-wrap .form-control::placeholder,
.offline-filter .form-control::placeholder,
.fa-rtl-search::placeholder,
.fa-digits-input::placeholder,
.form-control::placeholder {
  font-size: 0.82rem;
  font-weight: 400;
  color: color-mix(in srgb, var(--or-muted) 72%, transparent);
  opacity: 1;
}

.home-search-wrap .form-control:focus {
  border-color: color-mix(in srgb, var(--or-accent) 45%, var(--or-border));
  box-shadow: 0 10px 24px rgba(35, 136, 155, 0.12);
}

.home-hero + .organ-grid,
.home-hero + .home-entry-grid {
  margin-top: 0.35rem;
}

.home-entry-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.85rem;
  margin: 0.85rem 0.15rem 1rem;
}
@media (min-width: 520px) {
  .home-entry-grid { grid-template-columns: 1fr 1fr; }
}

.home-entry-card {
  display: flex;
  align-items: center;
  gap: 0.95rem;
  padding: 1.15rem 1.25rem;
  border-radius: 1.15rem;
  text-decoration: none !important;
  color: #fff !important;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 12px 28px rgba(16, 30, 60, 0.18);
  min-height: 5.25rem;
  transition: transform 0.15s ease, filter 0.15s ease, box-shadow 0.15s ease;
}
.home-entry-card * { color: #fff !important; }
.home-entry-card.entry-history {
  background: linear-gradient(135deg, #1f4b8f 0%, #2f6fb3 55%, #1a3f78 100%);
}
.home-entry-card.entry-reminders {
  background: linear-gradient(135deg, #0f6b5c 0%, #18967f 55%, #0c574b 100%);
}
.home-entry-card:active,
.home-entry-card.is-pressed {
  transform: scale(0.97);
  filter: brightness(1.18) saturate(1.1);
  box-shadow: inset 0 0 0 999px rgba(255, 255, 255, 0.16);
}
.home-entry-ico {
  width: 2.85rem;
  height: 2.85rem;
  border-radius: 0.95rem;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
  margin-inline: 0.1rem;
}
.home-entry-ico i { font-size: 1.35rem; }
.home-entry-body { flex: 1; min-width: 0; }
.home-entry-body strong {
  display: block;
  font-size: 1.05rem;
  font-weight: 800;
  margin-bottom: 0.2rem;
}
.home-entry-body small {
  display: block;
  opacity: 0.9;
  font-size: 0.82rem;
  line-height: 1.45;
}
.home-entry-go {
  width: 2rem;
  height: 2rem;
  border-radius: 0.65rem;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.22);
  font-size: 0.95rem;
  margin-inline-end: 0.1rem;
  flex-shrink: 0;
  opacity: 1;
}

.home-collection-card {
  border: 1px solid var(--or-border);
  border-radius: 1.2rem;
  background: var(--or-surface);
  box-shadow: var(--app-shadow);
  overflow: hidden;
  margin-bottom: 0.5rem;
}
.home-collection-head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  border: 0;
  background: linear-gradient(180deg, var(--or-surface-2), var(--or-surface));
  padding: 0.95rem 1rem;
  text-align: start;
  color: var(--or-text);
}
.home-collection-titles strong {
  display: block;
  font-size: 1rem;
  font-weight: 800;
}
.home-collection-titles small {
  display: block;
  color: var(--or-muted);
  font-size: 0.8rem;
  margin-top: 0.15rem;
}
.home-collection-chevron {
  transition: transform 0.2s ease;
  font-size: 1.15rem;
  color: var(--or-muted);
}
.home-collection-card.collapsed .home-collection-chevron { transform: rotate(-90deg); }
.home-collection-body {
  padding: 0.75rem;
  border-top: 1px solid var(--or-border);
}
.home-collection-card.collapsed .home-collection-body { display: none; }

/* —— صفحه شرح حال —— */
.hx-page-head { margin-bottom: 1rem; }
.hx-back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.84rem;
  color: var(--or-muted) !important;
  text-decoration: none !important;
  margin-bottom: 0.65rem;
}
.hx-page-title-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}
.hx-page-ico {
  width: 2.85rem;
  height: 2.85rem;
  border-radius: 0.95rem;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  color: #fff;
  background: linear-gradient(145deg, #1f4b8f, #2f6fb3);
  box-shadow: 0 10px 22px rgba(31, 75, 143, 0.28);
  font-size: 1.25rem;
}
.hx-page-title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--or-heading) !important;
  letter-spacing: -0.015em;
  line-height: 1.35;
}
.hx-page-sub {
  margin: 0.2rem 0 0;
  font-size: 0.82rem;
  color: var(--or-muted) !important;
  line-height: 1.45;
}

.history-wizard {
  position: relative;
  display: grid;
  gap: 0.9rem;
  border: 0 !important;
  padding: 0 !important;
  background: transparent !important;
}
.history-wizard.or-wizard,
.history-wizard .or-wizard-body {
  border: 0 !important;
  padding: 0 !important;
  background: transparent !important;
}

.hx-panel {
  border: 1px solid var(--or-border);
  border-radius: 1.15rem;
  background: var(--or-surface);
  box-shadow: 0 10px 24px rgba(26, 43, 50, 0.06);
  overflow: visible;
}
.hx-panel-head {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.85rem 1rem;
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--or-heading);
  background: linear-gradient(180deg, var(--or-surface-2), var(--or-surface));
  border-bottom: 1px solid var(--or-border);
  border-radius: 1.15rem 1.15rem 0 0;
}
.hx-panel-head i {
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 0.55rem;
  display: grid;
  place-items: center;
  font-size: 0.95rem;
  color: #1a6b7a;
  background: rgba(35, 136, 155, 0.12);
}
.hx-panel-body {
  padding: 1rem;
}
.history-wizard .form-label {
  font-size: 0.84rem;
  margin-bottom: 0.35rem;
  color: var(--or-heading);
}
.history-wizard .form-control,
.history-wizard .hx-dd-btn {
  min-height: 48px;
}
.history-wizard .hx-field .form-control.is-invalid {
  border-color: #c45c5c;
  box-shadow: 0 0 0 0.2rem rgba(196, 92, 92, 0.15);
}
.history-wizard .hx-field-error {
  margin-top: 0.3rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: #b42318;
  line-height: 1.35;
}
.history-wizard .hx-req {
  color: #b42318;
  font-weight: 800;
}
.history-wizard .hx-field.has-error .hx-radio-group {
  outline: 1px solid color-mix(in srgb, #c45c5c 55%, transparent);
  outline-offset: 2px;
  border-radius: 999px;
}
@media (min-width: 768px) {
  .history-wizard .hx-field.col-md-2 .form-label {
    font-size: 0.78rem;
  }
}
/* سابقه + بیماری‌های زمینه‌ای فشرده‌تر */
.history-wizard .hx-panel-compact .hx-dd-btn {
  min-height: 40px;
  padding: 0.45rem 0.75rem;
  font-size: 0.84rem;
  border-radius: 12px;
}
.history-wizard .hx-panel-compact .form-label,
.history-wizard .hx-panel-compact .hx-section {
  font-size: 0.78rem;
}
.history-wizard .hx-panel-compact .hx-checks label {
  min-height: 40px;
  padding: 0.4rem 0.55rem;
  font-size: 0.78rem;
  border-radius: 0.75rem;
}
.history-wizard .hx-panel-compact .hx-checks {
  gap: 0.4rem;
}
.history-wizard .hx-panel-compact .hx-checks input[type="checkbox"] {
  width: 0.95rem;
  height: 0.95rem;
}

.hx-section {
  margin: 1.15rem 0 0.55rem;
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--or-heading);
}
.hx-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.55rem;
}
.hx-metric {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.7rem 0.75rem;
  border-radius: 0.85rem;
  background: linear-gradient(165deg, rgba(35, 136, 155, 0.12), rgba(35, 136, 155, 0.04));
  border: 1px solid rgba(35, 136, 155, 0.22);
  text-align: center;
}
.hx-metric-k {
  font-size: 0.72rem;
  font-weight: 700;
  color: #1a6b7a;
}
.hx-metric strong {
  font-size: 0.98rem;
  font-weight: 800;
  color: var(--or-heading);
  line-height: 1.3;
}
@media (max-width: 420px) {
  .hx-metrics { grid-template-columns: 1fr; }
}

.hx-checks {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
}
@media (max-width: 380px) {
  .hx-checks { grid-template-columns: 1fr; }
}
.hx-checks label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 48px;
  padding: 0.55rem 0.7rem;
  border: 1.5px solid var(--or-border);
  border-radius: 0.85rem;
  background: #fff;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--or-text);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.hx-checks label:has(input:checked) {
  border-color: rgba(35, 136, 155, 0.55);
  background: rgba(35, 136, 155, 0.1);
  box-shadow: 0 0 0 0.15rem rgba(35, 136, 155, 0.1);
  color: #145562;
}
.hx-checks input[type="checkbox"] {
  width: 1.05rem;
  height: 1.05rem;
  flex-shrink: 0;
  accent-color: #23889B;
  margin: 0;
}

.hx-evaluate-btn {
  --hx-press-fg: #1a6b7a;
  width: 100%;
  min-height: 54px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  border: 1.5px solid transparent;
  border-radius: 1rem;
  font-weight: 800;
  font-size: 1.02rem;
  color: #fff;
  background: linear-gradient(135deg, #1f6f7e 0%, #23889B 50%, #15a07a 100%);
  box-shadow: 0 14px 28px rgba(35, 136, 155, 0.28);
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, transform 0.16s ease;
}
.hx-evaluate-btn:active,
.hx-evaluate-btn.is-pressed {
  background: #fff;
  color: var(--hx-press-fg);
  border-color: #23889B;
  box-shadow: 0 0 0 3px color-mix(in srgb, #23889B 18%, transparent);
  transform: scale(0.97);
}
.hx-evaluate-btn i { font-size: 1.15rem; }

.hx-result { margin-top: 0.15rem; }
.hx-result-top {
  display: grid;
  gap: 0.75rem;
}
.hx-new-patient-wrap {
  display: flex;
  justify-content: flex-end; /* در RTL = سمت چپ */
  margin: 0.15rem 0 0.15rem;
}
.hx-new-patient-btn {
  --hx-press-fg: #1a6b7a;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 40px;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  border: 1.5px solid #23889B;
  background: #23889B;
  color: #fff;
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
  width: auto;
  white-space: nowrap;
  box-shadow: 0 6px 14px color-mix(in srgb, #23889B 28%, transparent);
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, transform 0.16s ease;
}
.hx-new-patient-btn:active,
.hx-new-patient-btn.is-pressed {
  background: #fff;
  color: var(--hx-press-fg);
  border-color: #23889B;
  box-shadow: 0 0 0 3px color-mix(in srgb, #23889B 18%, transparent);
  transform: scale(0.96);
}
.hx-sex-row-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.65rem 1rem;
}
.hx-sex-fields { flex: 1 1 auto; min-width: 12rem; }
.hx-new-patient-btn-inline {
  flex: 0 0 auto;
  margin-bottom: 0.1rem;
}
.hx-new-patient-wrap .hx-new-patient-btn {
  width: auto;
}
.hx-reset-overlay {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: color-mix(in srgb, #1a2b32 28%, transparent);
  backdrop-filter: blur(2px);
  border-radius: inherit;
  animation: hx-reset-in 0.16s ease-out;
}
@keyframes hx-reset-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
.hx-reset-card {
  width: min(100%, 22rem);
  padding: 1.25rem 1.2rem 1.1rem;
  border-radius: 1.1rem;
  border: 1px solid var(--or-border);
  background: #fff;
  box-shadow: 0 18px 40px rgba(26, 43, 50, 0.18);
  text-align: center;
}
.hx-reset-ico {
  width: 2.6rem;
  height: 2.6rem;
  margin: 0 auto 0.65rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, #23889B 14%, #fff);
  color: #1a6b7a;
  font-size: 1.2rem;
}
.hx-reset-title {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--or-heading);
}
.hx-reset-text {
  margin: 0 0 1rem;
  font-size: 0.86rem;
  line-height: 1.55;
  color: var(--or-muted);
}
.hx-reset-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.45rem;
}
.hx-reset-btn {
  min-height: 42px;
  padding: 0.45rem 1rem;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 800;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, transform 0.16s ease;
}
.hx-reset-ok {
  --hx-press-fg: #1a6b7a;
  background: #23889B;
  border-color: #23889B;
  color: #fff;
}
.hx-reset-cancel {
  --hx-press-fg: #0f9a58;
  background: #15B76B;
  border-color: #15B76B;
  color: #fff;
}
.hx-reset-btn:active,
.hx-reset-btn.is-pressed {
  background: #fff;
  color: var(--hx-press-fg);
  border-color: var(--hx-press-fg);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--hx-press-fg) 18%, transparent);
  transform: scale(0.96);
}
.hx-out {
  border: 1px solid var(--or-border);
  border-radius: 1.15rem;
  background: var(--or-surface);
  box-shadow: 0 12px 28px rgba(26, 43, 50, 0.07);
  overflow: hidden;
}
.hx-out-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.95rem 1.05rem;
  background: linear-gradient(135deg, #16343c 0%, #1f5f6e 100%);
  color: #fff;
}
.hx-out-banner strong {
  display: block;
  font-size: 1.02rem;
  font-weight: 800;
}
.hx-out-banner small {
  display: block;
  opacity: 0.85;
  font-size: 0.8rem;
  margin-top: 0.15rem;
}
.hx-out-banner i { font-size: 1.45rem; opacity: 0.9; }

.hx-profile-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.75rem 0.95rem;
  border-bottom: 1px solid var(--or-border);
  background: color-mix(in srgb, var(--or-surface-2) 70%, #fff);
}
.hx-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--or-border);
  background: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--or-heading);
}
.hx-chip-src {
  color: var(--or-muted);
  font-weight: 600;
}
.hx-sec { border-top: 1px solid var(--or-border); }
.hx-sec-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}
.hx-sec-head .hx-block-label { margin-bottom: 0; }
.hx-sec-num {
  width: 1.45rem;
  height: 1.45rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: #16343c;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
}
.hx-sum-head em {
  margin-inline-start: auto;
  font-style: normal;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.06);
}
.hx-group > summary.hx-group-head {
  list-style: none;
  cursor: pointer;
  user-select: none;
}
.hx-group > summary.hx-group-head::-webkit-details-marker { display: none; }
.hx-group:not([open]) > summary.hx-group-head { border-bottom: 0; }

.hx-stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.55rem;
  padding: 0.85rem;
  background: color-mix(in srgb, var(--or-surface-2) 80%, #fff);
  border-bottom: 1px solid var(--or-border);
}
.hx-stat {
  text-align: center;
  padding: 0.65rem 0.35rem;
  border-radius: 0.85rem;
  background: #fff;
  border: 1px solid var(--or-border);
}
.hx-stat-label {
  display: block;
  font-size: 0.72rem;
  color: var(--or-muted);
  margin-bottom: 0.2rem;
}
.hx-stat-value {
  display: block;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--or-heading);
  line-height: 1.2;
}
.hx-stat-value-sm { font-size: 1.05rem; }
.hx-stat-sub {
  display: block;
  font-size: 0.75rem;
  color: var(--or-muted);
  margin-top: 0.15rem;
}

.hx-sum-block,
.hx-detail-block,
.hx-dose-block,
.hx-guide-out { padding: 0.9rem 0.95rem 1rem; }
.hx-block-label {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--or-muted);
  margin-bottom: 0.65rem;
  letter-spacing: -0.01em;
}
.hx-dose-block {
  background: linear-gradient(180deg, color-mix(in srgb, #23889B 6%, #fff), #fff);
}
.hx-dose-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}
.hx-dose-card {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.7rem 0.75rem;
  border-radius: 0.85rem;
  border: 1px solid color-mix(in srgb, #23889B 22%, var(--or-border));
  background: #fff;
  box-shadow: 0 4px 12px rgba(35, 136, 155, 0.06);
  min-height: 4.1rem;
}
.hx-dose-name {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--or-heading);
  line-height: 1.35;
}
.hx-dose-val {
  font-size: 0.9rem;
  font-weight: 800;
  color: #1a6b7a;
  letter-spacing: -0.01em;
  direction: ltr;
  unicode-bidi: isolate;
  text-align: right;
}
@media (max-width: 360px) {
  .hx-dose-grid { grid-template-columns: 1fr; }
}
.hx-sum-grid {
  display: grid;
  gap: 0.65rem;
}
.hx-sum-card {
  border-radius: 0.95rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--or-border);
  background: #fff;
}
.hx-sum-sub {
  font-size: 0.72rem;
  color: var(--or-muted);
  margin: -0.25rem 0 0.45rem;
  line-height: 1.4;
}
.hx-sum-head {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 800;
  font-size: 0.92rem;
  margin-bottom: 0.55rem;
}
.hx-sum-forbid {
  border-color: rgba(241, 84, 18, 0.45);
  background: rgba(241, 84, 18, 0.06);
}
.hx-sum-forbid .hx-sum-head { color: #c43d0d; }
.hx-sum-avoid {
  border-color: rgba(224, 160, 32, 0.5);
  background: rgba(224, 160, 32, 0.08);
}
.hx-sum-avoid .hx-sum-head { color: #8a6500; }
.hx-sum-prefer {
  border-color: rgba(21, 183, 107, 0.45);
  background: rgba(21, 183, 107, 0.07);
}
.hx-sum-prefer .hx-sum-head { color: #0f9456; }
.hx-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.hx-pill {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  border: 1px solid transparent;
  background: #fff;
}
.hx-pill.forbid { color: #c43d0d; border-color: rgba(241, 84, 18, 0.35); }
.hx-pill.avoid { color: #8a6500; border-color: rgba(224, 160, 32, 0.4); }
.hx-pill.prefer { color: #0f9456; border-color: rgba(21, 183, 107, 0.35); }
.hx-empty-sum {
  margin: 0.85rem 0.95rem;
  padding: 0.75rem 0.85rem;
  border-radius: 0.85rem;
  background: var(--or-surface-2);
  color: var(--or-muted);
  font-size: 0.88rem;
}

.hx-group {
  border: 1px solid var(--or-border);
  border-radius: 0.95rem;
  overflow: hidden;
  margin-bottom: 0.65rem;
  background: #fff;
}
.hx-group-head {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.65rem 0.85rem;
  font-weight: 800;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--or-border);
}
.hx-group-head em {
  margin-inline-start: auto;
  font-style: normal;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.06);
}
.hx-group-forbid .hx-group-head { background: rgba(241, 84, 18, 0.1); color: #c43d0d; }
.hx-group-avoid .hx-group-head { background: rgba(224, 160, 32, 0.12); color: #8a6500; }
.hx-group-recommend .hx-group-head { background: rgba(21, 183, 107, 0.1); color: #0f9456; }
.hx-group-info .hx-group-head { background: rgba(35, 136, 155, 0.1); color: #1a6b7a; }
.hx-item-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.hx-item {
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid color-mix(in srgb, var(--or-border) 80%, transparent);
}
.hx-item:last-child { border-bottom: 0; }
.hx-item-title {
  font-weight: 800;
  font-size: 0.9rem;
  color: var(--or-heading);
  margin-bottom: 0.25rem;
}
.hx-item-text {
  font-size: 0.88rem;
  line-height: 1.7;
  color: var(--or-text);
}
@media (max-width: 420px) {
  .hx-stat-row { grid-template-columns: 1fr; }
}

.reminders-list {
  display: grid;
  gap: 0.9rem;
}
.reminder-card {
  --rem-accent: var(--or-accent);
  --rem-soft: rgba(35, 136, 155, 0.1);
  position: relative;
  border-radius: 1.15rem;
  border: 1.5px solid color-mix(in srgb, var(--rem-accent) 55%, var(--or-border));
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--rem-accent) 12%, #fff) 0%, #fff 42%),
    var(--or-surface);
  padding: 1rem 1.05rem 1.05rem 1.15rem;
  box-shadow:
    0 10px 24px rgba(26, 43, 50, 0.07),
    inset 0 0 0 1px rgba(255, 255, 255, 0.65);
  overflow: hidden;
}
.reminder-card::before {
  content: "";
  position: absolute;
  inset-block: 0;
  inset-inline-start: 0;
  width: 5px;
  background: linear-gradient(180deg, var(--rem-accent), color-mix(in srgb, var(--rem-accent) 55%, #fff));
  border-start-start-radius: 1.15rem;
  border-end-start-radius: 1.15rem;
}
.reminder-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.65rem;
  margin-bottom: 0.55rem;
}
.reminder-card h2 {
  font-size: 1.02rem;
  font-weight: 800;
  margin: 0;
  line-height: 1.35;
  color: var(--or-heading) !important;
  letter-spacing: -0.01em;
}
.reminder-badge {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  color: #fff !important;
  background: var(--rem-accent);
  box-shadow: 0 6px 14px color-mix(in srgb, var(--rem-accent) 35%, transparent);
  white-space: nowrap;
}
.reminder-badge i { font-size: 0.78rem; }
.reminder-card p,
.reminder-card li {
  font-size: 0.9rem;
  line-height: 1.75;
  margin-bottom: 0.4rem;
  color: var(--or-text) !important;
}
.reminder-card p:last-child,
.reminder-card ul:last-child { margin-bottom: 0; }
.reminder-card ul {
  margin: 0.15rem 0 0;
  padding-inline-start: 1.15rem;
}
.reminder-card.rem-warn {
  --rem-accent: #d4920a;
  --rem-soft: rgba(212, 146, 10, 0.12);
}
.reminder-card.rem-forbid {
  --rem-accent: #e24a12;
  --rem-soft: rgba(226, 74, 18, 0.12);
}
.reminder-card.rem-ok {
  --rem-accent: #12965a;
  --rem-soft: rgba(18, 150, 90, 0.12);
}
.reminder-card.rem-info {
  --rem-accent: #1f7f93;
  --rem-soft: rgba(31, 127, 147, 0.12);
}

.home-search-hits {
  margin-top: 0.65rem;
  border-radius: var(--app-radius);
  background: var(--or-surface);
  border: 1px solid var(--or-border);
  box-shadow: var(--app-shadow);
  overflow: hidden;
}

.home-search-hit {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.85rem 1rem;
  text-decoration: none;
  color: var(--or-text) !important;
  border-bottom: 1px solid var(--or-border);
}

.home-search-hit:active {
  background: var(--or-surface-2);
}

.home-search-hit strong {
  font-size: 0.95rem;
}

.home-search-hit small {
  color: var(--or-muted) !important;
  font-size: 0.78rem;
}

.home-search-more,
.home-search-hint {
  display: block;
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--or-accent) !important;
  text-decoration: none;
}

.home-search-hint {
  color: var(--or-muted) !important;
  font-weight: 600;
}

.quick-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
  margin-bottom: 1.2rem;
}

.quick-row-v2 .qa-featured {
  grid-column: 1 / -1;
  min-height: 76px;
  flex-direction: row;
  align-items: center;
  gap: 0.85rem;
  padding: 1rem 1.05rem;
}

.quick-action {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.95rem 0.9rem;
  border-radius: 1.1rem;
  text-decoration: none;
  color: #fff !important;
  min-height: 96px;
  box-shadow: 0 10px 22px rgba(26, 43, 50, 0.12);
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, filter 0.2s ease, box-shadow 0.2s ease;
}

.quick-action::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(145deg, rgba(255,255,255,0.22), transparent 48%);
  pointer-events: none;
}

.quick-action:hover,
.quick-action:focus-visible {
  transform: translateY(-2px);
  filter: brightness(1.04);
  box-shadow: 0 14px 28px rgba(26, 43, 50, 0.16);
}

.quick-action:active {
  transform: scale(0.98);
  filter: brightness(0.94);
}

.quick-action * { color: #fff !important; position: relative; z-index: 1; }
.qa-ico {
  width: 2.15rem;
  height: 2.15rem;
  border-radius: 0.7rem;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.22);
  flex-shrink: 0;
}
.qa-ico i { font-size: 1.1rem; }
.qa-copy {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}
.quick-action strong { font-size: 0.98rem; font-weight: 800; }
.qa-copy > span { font-size: 0.78rem; opacity: 0.92; }
.qa-chevron {
  margin-inline-start: auto;
  font-size: 1.1rem;
  opacity: 0.9;
}

.qa-heart { background: linear-gradient(145deg, #ff6d3a, #F15412); }
.qa-organs { background: linear-gradient(145deg, #4f92bd, #3B7CA8); }
.qa-search { background: linear-gradient(145deg, #2ea0b3, #23889B); }
.qa-sync { background: linear-gradient(145deg, #2ecf82, #15B76B); }

.section-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--or-muted) !important;
  margin: 0.4rem 0 0.65rem;
  letter-spacing: 0.02em;
}

.section-label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}

.section-label-hint {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--or-accent) !important;
}

/* Cardiac hub */
.hub-grid {
  display: grid;
  gap: 0.75rem;
}

.hub-card {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 1rem;
  border-radius: var(--app-radius);
  background: var(--or-surface);
  border: 1px solid var(--or-border);
  text-decoration: none;
  color: var(--or-text) !important;
  box-shadow: var(--app-shadow);
  min-height: 76px;
}

.hub-card:active { transform: scale(0.98); }

.hub-card:hover,
.hub-card:focus-visible {
  border-color: color-mix(in srgb, var(--or-accent) 45%, var(--or-border));
  box-shadow: 0 12px 28px rgba(26, 43, 50, 0.12);
  transform: translateY(-2px);
  outline: none;
}

.condition-card {
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.condition-card:hover .condition-card-chevron,
.condition-card:focus-visible .condition-card-chevron {
  transform: translateX(-4px);
  color: var(--or-accent) !important;
}

.condition-card:active {
  transform: scale(0.975);
  background: var(--or-surface-2);
}

.condition-card-body {
  flex: 1;
  min-width: 0;
}

.condition-card-chevron {
  color: var(--or-muted) !important;
  font-size: 1.1rem;
  transition: transform 0.18s ease, color 0.18s ease;
  flex-shrink: 0;
}

.system-page-head {
  padding: 0.15rem 0 0.25rem;
}

.system-back {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--or-muted) !important;
  margin-bottom: 0.45rem;
}

.system-back:hover {
  color: var(--or-accent) !important;
}

.system-page-title-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem;
}

.system-page-title {
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0;
  line-height: 1.25;
  color: var(--or-heading) !important;
}

.system-page-en {
  font-size: 0.82rem;
  color: var(--or-muted) !important;
  margin-top: 0.2rem;
}

.system-count-chip {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.4rem 0.75rem;
  border-radius: 0.65rem;
  background: rgba(35, 136, 155, 0.12);
  color: var(--or-accent) !important;
  white-space: nowrap;
}

.system-page-head.tone-cardiac .system-count-chip { background: rgba(220, 20, 60, 0.12); color: #DC143C !important; }
.system-page-head.tone-pulm .system-count-chip { background: rgba(3, 175, 103, 0.12); color: #03af67 !important; }
.system-page-head.tone-renal .system-count-chip { background: rgba(0, 0, 139, 0.1); color: #00008B !important; }
.system-page-head.tone-gi .system-count-chip { background: rgba(255, 140, 0, 0.14); color: #FF8C00 !important; }
.system-page-head.has-accent .system-count-chip {
  background: color-mix(in srgb, var(--tile-accent, #23889B) 14%, transparent);
  color: var(--tile-accent, #23889B) !important;
}
.disease-grid.has-accent {
  --disease-accent: var(--tile-accent, var(--or-accent));
}

.system-empty {
  text-align: center;
  padding: 2rem 1rem;
  border-radius: 1.1rem;
  background: var(--or-surface);
  border: 1px dashed var(--or-border);
}
.system-empty strong { display: block; margin-bottom: 0.35rem; }
.system-empty p { margin: 0; color: var(--or-muted) !important; font-size: 0.9rem; }

.system-filter {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.35rem 0.85rem;
  border-radius: 1rem;
  background: var(--or-surface);
  border: 1px solid var(--or-border);
  box-shadow: 0 8px 20px rgba(26, 43, 50, 0.06);
}

.system-filter > i {
  color: var(--or-muted);
  font-size: 1.05rem;
}

.system-filter .form-control {
  border: none !important;
  box-shadow: none !important;
  background: transparent !important;
  min-height: 46px;
  padding-inline: 0;
  font-size: 0.95rem;
  direction: rtl;
  text-align: right;
  unicode-bidi: isolate;
}

.system-filter:focus-within {
  border-color: color-mix(in srgb, var(--or-accent) 45%, var(--or-border));
  box-shadow: 0 10px 24px rgba(35, 136, 155, 0.1);
}

/* فهرست بیماری‌ها — دو ستونه + شماره پویا */
.disease-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  --disease-accent: var(--or-accent);
}

.disease-grid.tone-cardiac { --disease-accent: #DC143C; }
.disease-grid.tone-pulm { --disease-accent: #03af67; }
.disease-grid.tone-renal { --disease-accent: #00008B; }
.disease-grid.tone-gi { --disease-accent: #FF8C00; }

.disease-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  min-height: 118px;
  padding: 0.85rem 0.7rem 2.15rem !important;
  border-radius: 1.15rem;
  text-decoration: none;
  text-align: center;
  color: var(--or-text) !important;
  background:
    linear-gradient(160deg, color-mix(in srgb, var(--disease-accent) 28%, #fff) 0%, color-mix(in srgb, var(--disease-accent) 8%, #fff) 38%, var(--or-surface) 72%),
    var(--or-surface);
  border: 1.5px solid color-mix(in srgb, var(--disease-accent) 70%, #fff);
  box-shadow:
    0 10px 24px color-mix(in srgb, var(--disease-accent) 14%, rgba(26, 43, 50, 0.06)),
    inset 0 0 0 1px color-mix(in srgb, var(--disease-accent) 12%, transparent);
  position: relative;
  overflow: hidden;
  animation: diseaseIn 0.4s cubic-bezier(.2,.8,.2,1) both;
  animation-delay: calc(min(var(--i, 1), 12) * 35ms);
  transition: transform 0.12s ease, background 0.12s ease, color 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.disease-tile::after {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--disease-accent);
  border-radius: 0 3px 3px 0;
  z-index: 1;
}

.disease-tile::before {
  content: "";
  position: absolute;
  width: 4.4rem;
  height: 4.4rem;
  inset-inline-end: -0.95rem;
  bottom: -1.1rem;
  border-radius: 1.1rem;
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--disease-accent) 22%, transparent), color-mix(in srgb, var(--disease-accent) 4%, transparent));
  border: 1px solid color-mix(in srgb, var(--disease-accent) 28%, transparent);
  box-shadow:
    -14px -14px 0 -5px color-mix(in srgb, var(--disease-accent) 12%, transparent),
    -26px -26px 0 -10px color-mix(in srgb, var(--disease-accent) 7%, transparent);
  transform: rotate(18deg);
  pointer-events: none;
  z-index: 0;
  opacity: 0.95;
  transition: transform 0.35s ease, opacity 0.25s ease, box-shadow 0.35s ease;
}

.disease-tile:hover,
.disease-tile:focus-visible {
  transform: translateY(-3px);
  border-color: var(--disease-accent);
  box-shadow: 0 16px 32px color-mix(in srgb, var(--disease-accent) 22%, rgba(26, 43, 50, 0.1));
  outline: none;
}

.disease-tile:hover::before,
.disease-tile:focus-visible::before {
  transform: rotate(24deg) translate(-4px, -6px);
  opacity: 1;
  box-shadow:
    -16px -16px 0 -5px color-mix(in srgb, var(--disease-accent) 16%, transparent),
    -30px -30px 0 -10px color-mix(in srgb, var(--disease-accent) 9%, transparent);
}

.disease-tile:active,
.disease-tile.is-pressed {
  transform: scale(0.97);
  background: var(--disease-accent) !important;
  border-color: var(--disease-accent);
  color: #fff !important;
}
.disease-tile:active .disease-title,
.disease-tile:active .disease-en,
.disease-tile:active .disease-go,
.disease-tile.is-pressed .disease-title,
.disease-tile.is-pressed .disease-en,
.disease-tile.is-pressed .disease-go {
  color: #fff !important;
}
.disease-tile:active .disease-num,
.disease-tile.is-pressed .disease-num {
  background: #fff;
  color: var(--disease-accent) !important;
}
.disease-tile:active .disease-go,
.disease-tile.is-pressed .disease-go {
  background: rgba(255, 255, 255, 0.22);
}
.disease-tile:active::after,
.disease-tile.is-pressed::after {
  background: #fff;
}

.disease-num {
  width: clamp(1.75rem, 7.5vw, 2.15rem);
  height: clamp(1.75rem, 7.5vw, 2.15rem);
  border-radius: 0.7rem;
  display: grid;
  place-items: center;
  font-size: clamp(0.78rem, 3.2vw, 0.95rem);
  font-weight: 800;
  color: #fff !important;
  background: var(--disease-accent);
  box-shadow: 0 8px 16px color-mix(in srgb, var(--disease-accent) 35%, transparent);
  position: relative;
  z-index: 1;
  margin-inline: auto;
}

.disease-tile-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  flex: 1;
  width: 100%;
  min-width: 0;
  position: relative;
  z-index: 1;
  text-align: center;
}

.disease-title {
  font-size: clamp(0.68rem, 2.8vw + 0.35rem, 0.95rem);
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: var(--or-heading) !important;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-height: calc(1.3em * 2);
  text-align: center;
  width: 100%;
  padding-inline: 0.15rem;
}

.disease-en {
  font-size: clamp(0.58rem, 2.2vw + 0.3rem, 0.74rem);
  line-height: 1.3;
  color: var(--or-muted) !important;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-align: center;
  width: 100%;
}

.disease-go {
  position: absolute;
  left: 50%;
  bottom: 0.55rem;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 0.55rem;
  display: grid;
  place-items: center;
  font-size: 0.85rem;
  color: var(--disease-accent) !important;
  background: color-mix(in srgb, var(--disease-accent) 12%, transparent);
  transition: transform 0.18s ease, background 0.18s ease;
  z-index: 1;
  transform: translateX(-50%);
}

.disease-tile:hover .disease-go,
.disease-tile:focus-visible .disease-go {
  background: color-mix(in srgb, var(--disease-accent) 20%, transparent);
}

@keyframes diseaseIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .disease-tile { animation: none; }
}

@media (min-width: 640px) {
  .disease-tile {
    min-height: 148px;
    padding: 1.1rem;
  }
  .disease-title { font-size: 1rem; }
}

.hub-ico {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: #fff !important;
  flex-shrink: 0;
}

.hub-ico i { color: #fff !important; font-size: 1.25rem; }
.hub-ico.red { background: #DC143C; }
.hub-ico.teal { background: #23889B; }
.hub-ico.green { background: #03af67; }
.hub-ico.blue { background: #00008B; }
.hub-ico.amber { background: #FF8C00; }

.hub-card strong { display: block; font-size: 1rem; }
.hub-card small { color: var(--or-muted) !important; }

/* Valve compare — swipe cards on mobile */
.valve-compare {
  display: grid;
  gap: 0.75rem;
}

.valve-card {
  border-radius: var(--app-radius);
  background: var(--or-surface);
  border: 1px solid var(--or-border);
  overflow: hidden;
  box-shadow: var(--app-shadow);
}

.valve-card-head {
  padding: 0.75rem 1rem;
  color: #fff !important;
  font-weight: 700;
}

.valve-card-head * { color: #fff !important; }
.vh-as { background: linear-gradient(145deg, #2ea0b3, #23889B); }
.vh-ar { background: linear-gradient(145deg, #2ecf82, #15B76B); }
.vh-ms { background: linear-gradient(145deg, #4f92bd, #3B7CA8); }
.vh-mr { background: linear-gradient(145deg, #ff6d3a, #F15412); }

.valve-rows { padding: 0.35rem 0; }
.valve-row {
  display: grid;
  grid-template-columns: 38% 1fr;
  gap: 0.5rem;
  padding: 0.55rem 1rem;
  border-top: 1px solid var(--or-border);
  font-size: 0.88rem;
}
.valve-row:first-child { border-top: none; }
.valve-k { color: var(--or-muted) !important; font-weight: 600; }
.valve-v { color: var(--or-text) !important; font-weight: 700; }

/* Sticky forbidden dock */
.forbid-dock {
  position: sticky;
  bottom: calc(var(--app-tabbar-h) + env(safe-area-inset-bottom, 0px) + 0.4rem);
  z-index: 1020;
  margin-top: 0.75rem;
  border-radius: var(--app-radius);
  background: #fff5f2;
  border: 1px solid rgba(241, 84, 18, 0.35);
  box-shadow: 0 10px 28px rgba(241, 84, 18, 0.18);
  padding: 0.65rem 0.75rem;
}

.forbid-dock-title {
  font-size: 0.78rem;
  font-weight: 800;
  color: #F15412 !important;
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.forbid-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.forbid-pill {
  background: #F15412;
  color: #fff !important;
  border-radius: 999px;
  padding: 0.3rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 700;
}

/* Compact decision / reduce essay feel */
.or-decision { border-radius: var(--app-radius) !important; }
.or-goal-card { border-radius: var(--app-radius-sm) !important; min-height: 96px; }
.or-drug-chip { border-radius: var(--app-radius-sm) !important; }

.or-accordion .accordion-button {
  min-height: 52px;
  font-size: 0.95rem;
}

.content-panel {
  font-size: 0.94rem;
  line-height: 1.75;
}

.breadcrumb { font-size: 0.8rem; margin-bottom: 0.65rem; }

/* Hide desktop leftovers */
.or-footer { display: none; }

/*
  دسکتاپ وب (مرورگر عریض، نه PWA/APK):
  منوی افقی بالا + عرض استاندارد محتوا — بدون تب‌بار موبایل
*/
@media (min-width: 992px) {
  html:not(.is-app-shell) body.or-app.mobile-shell:not(.admin-wide) {
    padding-bottom: 1.5rem;
  }

  html:not(.is-app-shell) body.or-app:not(.admin-wide) .app-tabbar {
    display: none !important;
  }

  html:not(.is-app-shell) body.or-app .app-web-nav {
    display: flex;
  }

  html:not(.is-app-shell) body.or-app:not(.admin-wide) .app-topbar-inner,
  html:not(.is-app-shell) body.or-app:not(.admin-wide) .app-main {
    max-width: 1120px;
  }

  html:not(.is-app-shell) body.or-app:not(.admin-wide) .app-main {
    padding: 1.35rem 1.5rem 2rem;
  }

  html:not(.is-app-shell) body.or-app:not(.admin-wide) .user-welcome-inner {
    max-width: 1120px;
  }

  html:not(.is-app-shell) body.or-app:not(.admin-wide) .home-entry-grid {
    grid-template-columns: 1fr 1fr;
    gap: 1.15rem;
    max-width: none;
  }

  html:not(.is-app-shell) body.or-app:not(.admin-wide) .disease-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
  }

  html:not(.is-app-shell) body.or-app:not(.admin-wide) .organ-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  html:not(.is-app-shell) body.or-app:not(.admin-wide) .hx-page-title {
    font-size: 1.55rem;
  }

  html:not(.is-app-shell) body.or-app:not(.admin-wide) .hx-checks {
    grid-template-columns: 1fr 1fr;
  }

  html:not(.is-app-shell) body.or-app:not(.admin-wide) .hx-metrics {
    grid-template-columns: repeat(4, 1fr);
  }

  html:not(.is-app-shell) body.or-app:not(.admin-wide) .hx-sum-grid,
  html:not(.is-app-shell) body.or-app:not(.admin-wide) .hx-dose-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  html:not(.is-app-shell) body.or-app:not(.admin-wide) .hx-panel-body {
    padding: 1.15rem 1.25rem;
  }
}

/* PWA / Capacitor / fullscreen: همیشه شل موبایل با تب‌بار */
@media (display-mode: standalone),
       (display-mode: fullscreen),
       (display-mode: minimal-ui) {
  body.or-app .app-web-nav {
    display: none !important;
  }

  body.or-app:not(.admin-wide) .app-tabbar {
    display: grid !important;
  }

  body.or-app:not(.admin-wide) .app-topbar-inner,
  body.or-app:not(.admin-wide) .app-main,
  body.or-app:not(.admin-wide) .user-welcome-inner {
    max-width: 720px;
  }

  body.or-app.mobile-shell:not(.admin-wide) {
    padding-bottom: calc(var(--app-tabbar-h) + env(safe-area-inset-bottom, 0px) + 0.5rem);
  }
}

html.is-app-shell body.or-app .app-web-nav {
  display: none !important;
}

html.is-app-shell body.or-app:not(.admin-wide) .app-tabbar {
  display: grid !important;
}

html.is-app-shell body.or-app:not(.admin-wide) .app-topbar-inner,
html.is-app-shell body.or-app:not(.admin-wide) .app-main,
html.is-app-shell body.or-app:not(.admin-wide) .user-welcome-inner {
  max-width: 720px;
}

/* —— صفحه ورود / محدودیت استفاده (وب + موبایل) —— */
body.gate-locked .app-topbar,
body.gate-locked .app-tabbar,
body.gate-locked .app-web-nav,
body.gate-locked .user-welcome-bar {
  display: none !important;
}
body.gate-locked {
  background: #0b1a36;
}
body.gate-locked .app-main {
  max-width: none;
  margin: 0;
  padding: 0;
  min-height: 100dvh;
}
/* فقط محتوای اصلی مخفی شود؛ صفحه ورود (#webAccessGate یا .gate-screen) دیده شود */
body.gate-locked .app-main > :not(#webAccessGate):not(.gate-screen) {
  display: none !important;
}
body.gate-locked .app-main #webAccessGate,
body.gate-locked .app-main .gate-screen {
  display: block !important;
  visibility: visible !important;
}

.gate-screen {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 1.5rem 1.15rem 2rem;
  background:
    radial-gradient(720px 420px at 100% 0%, rgba(120, 175, 255, 0.42), transparent 58%),
    radial-gradient(560px 360px at 0% 100%, rgba(80, 200, 175, 0.28), transparent 55%),
    linear-gradient(160deg, #163a66 0%, #2a5f9a 48%, #1a4570 100%);
  color: #fff;
}
.gate-card {
  width: min(100%, 26rem);
  border-radius: 1.45rem;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.1));
  box-shadow: 0 22px 48px rgba(0, 0, 0, 0.22);
  padding: 1.55rem 1.3rem 1.4rem;
  backdrop-filter: blur(10px);
}
.gate-logo {
  width: 3.1rem;
  height: 3.1rem;
  border-radius: 0.9rem;
  object-fit: contain;
  background: rgba(255, 255, 255, 0.1);
  padding: 0.35rem;
  display: block;
  margin: 0 auto 0.95rem;
}
.gate-title {
  margin: 0;
  text-align: center;
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.gate-sub {
  margin: 0.4rem 0 1.15rem;
  text-align: center;
  font-size: 0.86rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.78);
}
.gate-label {
  display: block;
  font-size: 0.86rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
  color: rgba(255, 255, 255, 0.92);
}
.gate-input {
  width: 100%;
  min-height: 52px;
  border-radius: 0.95rem;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.16);
  color: #fff !important;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  font-weight: 600;
  direction: rtl;
  text-align: right;
  unicode-bidi: plaintext;
}
.gate-input::placeholder { color: rgba(255, 255, 255, 0.45); }
.gate-input:focus {
  outline: none;
  border-color: rgba(100, 180, 255, 0.7);
  box-shadow: 0 0 0 0.2rem rgba(80, 150, 240, 0.22);
}
.gate-hint {
  margin: 0.55rem 0 0;
  font-size: 0.8rem;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.68);
}
.gate-error {
  margin: 0.75rem 0 0;
  padding: 0.65rem 0.8rem;
  border-radius: 0.8rem;
  background: rgba(241, 84, 18, 0.18);
  border: 1px solid rgba(241, 84, 18, 0.45);
  color: #ffd2c2;
  font-size: 0.86rem;
  line-height: 1.55;
}
.gate-btn {
  width: 100%;
  min-height: 52px;
  margin-top: 1.05rem;
  border: 0;
  border-radius: 0.95rem;
  font-weight: 800;
  font-size: 1rem;
  color: #0b1a36 !important;
  background: linear-gradient(135deg, #7ec8ff 0%, #4aa3e8 55%, #2f8fd6 100%);
  box-shadow: 0 12px 24px rgba(40, 120, 210, 0.35);
  cursor: pointer;
}
.gate-btn:active { transform: scale(0.985); }
.gate-foot {
  margin: 1rem 0 0;
  text-align: center;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.5);
}

/* —— بازگشت داخل صفحه (دور از دکمه خروج) —— */
.page-back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  width: auto !important;
  margin: 0 0 0.85rem;
  padding: 0.45rem 0.85rem !important;
  border: 1px solid var(--or-border) !important;
  border-radius: 999px;
  background: var(--or-surface);
  color: var(--or-text) !important;
  font-size: 0.88rem;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(26, 43, 50, 0.05);
  transition: background 0.15s ease, color 0.15s ease, transform 0.12s ease;
}
.page-back-link:active,
.page-back-link.is-pressed {
  background: var(--or-heading) !important;
  color: #fff !important;
  transform: scale(0.97);
  border-color: var(--or-heading) !important;
}
.page-back-link:active i,
.page-back-link.is-pressed i {
  color: #fff !important;
}

/* —— حس کلیک روی کارت‌ها و دکمه‌ها —— */
.system-tile {
  transition: transform 0.12s ease, filter 0.12s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.system-tile:active,
.system-tile.is-pressed {
  transform: scale(0.97);
  filter: brightness(1.12) saturate(1.15);
  box-shadow: inset 0 0 0 999px rgba(255, 255, 255, 0.14);
}
.app-tab {
  transition: background 0.12s ease, color 0.12s ease, transform 0.12s ease;
}
.app-tab:active {
  background: var(--or-heading);
  color: #fff !important;
  border-radius: 0.85rem;
  transform: scale(0.96);
}
.app-tab:active i,
.app-tab:active span { color: #fff !important; }
.app-icon-btn:active {
  background: var(--or-heading) !important;
  color: #fff !important;
  transform: scale(0.94);
}
.gate-btn:active,
.btn-primary:active,
.btn:active {
  filter: invert(1) hue-rotate(180deg);
  transform: scale(0.98);
}
.home-search-hit:active {
  background: var(--or-heading) !important;
  color: #fff !important;
}
.home-search-hit:active strong,
.home-search-hit:active small { color: #fff !important; }
.offline-acc-btn:active {
  background: var(--or-heading) !important;
  color: #fff !important;
}
.offline-acc-btn:active .offline-acc-chevron { color: #fff !important; }

/* آکاردئون آفلاین + ماتریس دارو */
.offline-acc {
  border: 1px solid var(--or-border);
  border-radius: var(--app-radius-sm);
  background: var(--or-surface);
  margin-bottom: 0.55rem;
  overflow: hidden;
}
.offline-acc-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  text-align: start;
  border: 0;
  background: var(--or-surface-2);
  padding: 0.9rem 1rem;
  font-weight: 700;
  color: var(--or-text);
}
.offline-acc-chevron {
  font-size: 1rem;
  opacity: 0.75;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}
.offline-acc.open .offline-acc-chevron {
  transform: rotate(180deg);
}
.offline-acc .body {
  display: none;
  padding: 0.85rem 1rem;
  font-size: 0.92rem;
  line-height: 1.7;
}
.offline-acc.open .body { display: block; }

.drug-row {
  border: 1px solid var(--or-border);
  border-radius: 0.85rem;
  padding: 0.75rem 0.9rem;
  margin-bottom: 0.5rem;
  background: var(--or-surface);
}
.drug-row-top {
  display: flex;
  justify-content: space-between;
  gap: 0.65rem;
  align-items: flex-start;
}
.drug-row.risk-red {
  border-color: rgba(241, 84, 18, 0.4);
  background: rgba(241, 84, 18, 0.08);
  box-shadow: inset -5px 0 0 #F15412;
}
.drug-row.risk-yellow {
  border-color: rgba(224, 160, 32, 0.4);
  background: rgba(224, 160, 32, 0.1);
  box-shadow: inset -5px 0 0 #e0a020;
}
.drug-row.risk-green {
  border-color: rgba(21, 183, 107, 0.4);
  background: rgba(21, 183, 107, 0.08);
  box-shadow: inset -5px 0 0 #15B76B;
}
.drug-note {
  font-size: 0.86rem;
  font-weight: 700;
  margin-top: 0.35rem;
  color: var(--or-text);
}
.drug-reason {
  font-size: 0.82rem;
  margin-top: 0.25rem;
  color: var(--or-muted);
  line-height: 1.55;
}
.drug-badge {
  font-weight: 800;
  font-size: 0.72rem;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}
.drug-badge.risk-red,
.risk-badge.risk-red { background: #F15412; color: #fff !important; }
.drug-badge.risk-yellow,
.risk-badge.risk-yellow { background: #e0a020; color: #1a1400 !important; }
.drug-badge.risk-green,
.risk-badge.risk-green { background: #15B76B; color: #fff !important; }

/* Bootstrap accordion chevron همیشه دیده شود */
.or-accordion .accordion-button::after {
  display: block !important;
  flex-shrink: 0;
  width: 1.15rem;
  height: 1.15rem;
  margin-inline-start: auto;
  content: "";
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%231a2b32'%3e%3cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-size: 1.15rem;
  transition: transform 0.2s ease;
}
.or-accordion .accordion-button:not(.collapsed)::after {
  transform: rotate(-180deg);
}

/* —— ویزارد استپی شرح حال + راهنمای قلب —— */
.hx-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.9rem;
}
.hx-step {
  flex: 1 1 auto;
  min-width: 4.4rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.55rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--or-border);
  background: var(--or-surface);
  color: var(--or-muted);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}
.hx-step span {
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--or-surface-2);
  color: var(--or-heading);
  font-size: 0.72rem;
}
.hx-step.is-active {
  border-color: color-mix(in srgb, #DC143C 45%, var(--or-border));
  background: color-mix(in srgb, #DC143C 10%, #fff);
  color: var(--or-heading);
}
.hx-step.is-active span {
  background: #DC143C;
  color: #fff;
}
.hx-step[aria-disabled="true"],
.hx-step.is-locked {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}
.hx-step[data-requires-result].is-ready:not(.is-locked) {
  opacity: 1;
  cursor: pointer;
  pointer-events: auto;
}
.history-wizard .hx-nav-next:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.hx-step-hint {
  font-size: 0.82rem;
  color: var(--or-muted);
  margin: 0 0 0.85rem;
  line-height: 1.55;
}
.hx-step-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.85rem;
}
.hx-nav-btn {
  --hx-press-fg: #1a6b7a;
  min-height: 48px;
  padding: 0.65rem 1.1rem;
  border-radius: 999px;
  border: 1.5px solid #23889B;
  background: #23889B;
  font-weight: 800;
  color: #fff;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  box-shadow: 0 6px 14px color-mix(in srgb, #23889B 28%, transparent);
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, transform 0.16s ease;
}
.hx-nav-next {
  margin-inline-start: auto;
  --hx-press-fg: #0f9a58;
  background: #15B76B;
  border-color: #15B76B;
  color: #fff;
  box-shadow: 0 6px 14px color-mix(in srgb, #15B76B 28%, transparent);
}
.hx-nav-btn:active,
.hx-nav-btn.is-pressed {
  background: #fff;
  color: var(--hx-press-fg);
  border-color: var(--hx-press-fg);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--hx-press-fg) 18%, transparent);
  transform: scale(0.96);
}
.hx-nav-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}
.hx-nav-btn:disabled:active,
.hx-nav-btn:disabled.is-pressed {
  background: #23889B;
  color: #fff;
  border-color: #23889B;
  box-shadow: none;
  transform: none;
}
.hx-step-nav .hx-evaluate-btn { flex: 1 1 100%; margin-top: 0.15rem; }

.hx-cardio-list { display: grid; gap: 0.65rem; }
.hx-cardio-item {
  border: 1px solid var(--or-border);
  border-radius: 1rem;
  background: #fff;
  overflow: hidden;
}
.hx-cardio-main {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.85rem 0.95rem;
  font-weight: 800;
  font-size: 0.92rem;
  margin: 0;
  cursor: pointer;
  background: linear-gradient(180deg, color-mix(in srgb, #DC143C 8%, #fff), #fff);
}
.hx-cardio-expand {
  padding: 0 0.85rem 0.85rem;
  border-top: 1px solid var(--or-border);
}
.hx-cardio-opt {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  padding: 0.55rem 0.35rem;
  font-size: 0.84rem;
  font-weight: 700;
  margin: 0.35rem 0 0;
  cursor: pointer;
}
.hx-tip {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.55rem;
  align-items: start;
  margin-top: 0.55rem;
  padding: 0.65rem 0.75rem;
  border-radius: 0.85rem;
  border: 1px solid var(--or-border);
  background: var(--or-surface-2);
}
.hx-tip-badge {
  font-size: 0.7rem;
  font-weight: 800;
  padding: 0.22rem 0.5rem;
  border-radius: 999px;
  white-space: nowrap;
  background: #dee2e6;
  color: #212529;
}
.hx-tip-text {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.6;
  color: var(--or-text);
}
.hx-tip-forbid { background: rgba(241, 84, 18, 0.1); border-color: rgba(241, 84, 18, 0.35); }
.hx-tip-forbid .hx-tip-badge { background: #F15412; color: #fff; }
.hx-tip-must { background: rgba(13, 110, 253, 0.08); border-color: rgba(13, 110, 253, 0.28); }
.hx-tip-must .hx-tip-badge { background: #0d6efd; color: #fff; }
.hx-tip-avoid { background: rgba(224, 160, 32, 0.12); border-color: rgba(224, 160, 32, 0.4); }
.hx-tip-avoid .hx-tip-badge { background: #e0a020; color: #1a1400; }
.hx-tip-rec { background: rgba(21, 183, 107, 0.1); border-color: rgba(21, 183, 107, 0.35); }
.hx-tip-rec .hx-tip-badge { background: #15B76B; color: #fff; }
.hx-tip-decision { background: rgba(111, 66, 193, 0.1); border-color: rgba(111, 66, 193, 0.3); }
.hx-tip-decision .hx-tip-badge { background: #6f42c1; color: #fff; }
.hx-tip-info { background: rgba(35, 136, 155, 0.08); border-color: rgba(35, 136, 155, 0.28); }
.hx-tip-info .hx-tip-badge { background: #23889B; color: #fff; }
.hx-tip-compact {
  margin-top: 0.35rem;
  padding: 0.4rem 0.55rem;
  gap: 0.4rem;
  border-radius: 0.65rem;
}
.hx-tip-compact .hx-tip-badge { font-size: 0.65rem; padding: 0.15rem 0.4rem; }
.hx-tip-compact .hx-tip-text { font-size: 0.78rem; line-height: 1.45; }

/* مصاحبه بیماری‌ها */
.hx-cx-q {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--or-heading);
  margin: 0 0 0.85rem;
  line-height: 1.5;
}
.hx-cx-actions {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.85rem;
}
.hx-cx-actions-inline {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end; /* در RTL = سمت چپ صفحه */
  align-items: center;
  gap: 0.5rem;
}
.hx-cx-actions-inline .hx-cx-btn {
  width: auto;
  min-width: 0;
  flex: 0 0 auto;
  min-height: 42px;
  padding: 0.5rem 1.05rem;
  font-size: 0.84rem;
  border-radius: 999px;
}
.hx-cx-btn {
  --hx-cx-accent: #15B76B;
  --hx-cx-accent-deep: #0f9a58;
  min-height: 48px;
  border-radius: 999px;
  border: 1.5px solid var(--hx-cx-accent);
  background: var(--hx-cx-accent);
  color: #fff;
  font-weight: 800;
  font-size: 0.9rem;
  padding: 0.65rem 1.15rem;
  cursor: pointer;
  box-shadow: 0 6px 14px color-mix(in srgb, var(--hx-cx-accent) 28%, transparent);
  transition:
    background 0.18s ease,
    color 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.16s ease;
}
.hx-cx-yes {
  --hx-cx-accent: #15B76B;
  --hx-cx-accent-deep: #0f9a58;
}
.hx-cx-no {
  --hx-cx-accent: #23889B;
  --hx-cx-accent-deep: #1a6b7a;
}
.hx-cx-btn:hover {
  background: var(--hx-cx-accent-deep);
  border-color: var(--hx-cx-accent-deep);
  color: #fff;
}
.hx-cx-btn:active,
.hx-cx-btn.is-pressed {
  background: #fff;
  color: var(--hx-cx-accent-deep);
  border-color: var(--hx-cx-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--hx-cx-accent) 18%, transparent);
  transform: scale(0.96);
}
.hx-cx-back-main {
  margin-top: 0.75rem;
  width: 100%;
  justify-content: center;
}
.hx-cx-done {
  margin: 0.65rem 0 0.85rem;
}
.hx-cx-done-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.hx-cx-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: color-mix(in srgb, #15B76B 14%, #fff);
  border: 1px solid color-mix(in srgb, #15B76B 35%, var(--or-border));
  font-size: 0.75rem;
  font-weight: 700;
  color: #0d5c36;
}
button.hx-cx-chip-edit {
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  color: #0d5c36;
}
button.hx-cx-chip-edit:hover,
button.hx-cx-chip-edit:focus-visible {
  background: color-mix(in srgb, #15B76B 22%, #fff);
  border-color: color-mix(in srgb, #15B76B 55%, var(--or-border));
}
button.hx-cx-chip-edit .bi-pencil {
  font-size: 0.7rem;
  opacity: 0.75;
}
.hx-cx-sys-list {
  display: grid;
  gap: 0.5rem;
}
.hx-cx-sys {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  text-align: start;
  min-height: 52px;
  padding: 0.75rem 0.9rem;
  border-radius: 0.95rem;
  border: 1px solid var(--or-border);
  background: #fff;
  font-weight: 800;
  color: var(--or-heading);
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, transform 0.14s ease;
}
.hx-cx-num {
  flex: 0 0 auto;
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, #DC143C 12%, #fff);
  color: #DC143C;
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1;
  transition: background 0.16s ease, color 0.16s ease;
}
.hx-cx-num-sm {
  width: 1.35rem;
  height: 1.35rem;
  font-size: 0.7rem;
  background: color-mix(in srgb, #15B76B 18%, #fff);
  color: #0d5c36;
}
.hx-cx-sys:active,
.hx-cx-sys.is-pressed {
  background: #e1457a;
  border-color: #DC143C;
  color: #fff;
  box-shadow: 0 0 0 3px color-mix(in srgb, #DC143C 22%, transparent);
  transform: scale(0.98);
}
.hx-cx-sys:active .hx-cx-num,
.hx-cx-sys.is-pressed .hx-cx-num {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}
.hx-cx-sys:active .hx-cx-tag,
.hx-cx-sys.is-pressed .hx-cx-tag {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}
.hx-cx-sys.is-done {
  background: color-mix(in srgb, #15B76B 8%, #fff);
  border-color: color-mix(in srgb, #15B76B 30%, var(--or-border));
}
.hx-cx-sys.is-done .hx-cx-num {
  background: color-mix(in srgb, #15B76B 18%, #fff);
  color: #0d5c36;
}
.hx-cx-sys.is-done:active,
.hx-cx-sys.is-done.is-pressed {
  background: #15B76B;
  border-color: #15B76B;
  color: #fff;
}
.hx-cx-sys.is-done:active .hx-cx-num,
.hx-cx-sys.is-done.is-pressed .hx-cx-num,
.hx-cx-sys.is-done:active .hx-cx-tag,
.hx-cx-sys.is-done.is-pressed .hx-cx-tag {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}
.hx-cx-tag {
  margin-inline-start: auto;
  font-style: normal;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 0.18rem 0.45rem;
  border-radius: 999px;
  background: color-mix(in srgb, #DC143C 12%, #fff);
  color: #DC143C;
}
.hx-cx-tag-done {
  background: color-mix(in srgb, #15B76B 16%, #fff);
  color: #0d5c36;
}
.hx-tick-list { display: grid; gap: 0.45rem; }
.hx-tick-block {
  border: 1px solid var(--or-border);
  border-radius: 0.85rem;
  background: #fff;
  padding: 0.15rem 0.55rem 0.35rem;
}
.hx-tick-block.is-on {
  border-color: color-mix(in srgb, #DC143C 40%, var(--or-border));
  background: color-mix(in srgb, #DC143C 5%, #fff);
}
.hx-tick {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.55rem 0.25rem;
  margin: 0;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
}
.hx-tick input { margin-top: 0.2rem; flex-shrink: 0; }
.hx-tick-main { font-size: 0.92rem; font-weight: 800; }
.hx-tick-tips { padding: 0 0.15rem 0.35rem 1.55rem; }
.hx-tick-subs {
  margin: 0.15rem 0 0.35rem 1.1rem;
  padding-inline-start: 0.55rem;
  border-inline-start: 2px solid color-mix(in srgb, #DC143C 25%, var(--or-border));
}
.hx-guide-out.hx-sec { margin: 0; }
.hx-tick-block.is-forced {
  border: 1px solid color-mix(in srgb, #DC143C 35%, var(--or-border));
  border-radius: 0.85rem;
  padding: 0.55rem 0.65rem;
  background: color-mix(in srgb, #DC143C 5%, #fff);
}
.hx-forced-tag {
  font-style: normal;
  font-size: 0.72rem;
  font-weight: 800;
  color: #DC143C;
  margin-inline-start: 0.35rem;
}
.hx-guide-block {
  border: 1px solid var(--or-border);
  border-radius: 0.95rem;
  background: #fff;
  padding: 0.75rem 0.85rem;
  margin-bottom: 0.55rem;
}
.hx-guide-block-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}
.hx-guide-block-head strong { font-size: 0.92rem; color: var(--or-heading); }
.hx-guide-block-head span {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--or-muted);
}

.hx-force-group {
  margin: 0.45rem 0 0.55rem;
  padding: 0.45rem 0.55rem;
  border-radius: 0.75rem;
  background: color-mix(in srgb, #0d6efd 6%, #fff);
  border: 1px solid color-mix(in srgb, #0d6efd 22%, var(--or-border));
}
.hx-force-avoid {
  background: color-mix(in srgb, #F15412 6%, #fff);
  border-color: color-mix(in srgb, #F15412 28%, var(--or-border));
}
.hx-force-label {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--or-muted);
  margin: 0.2rem 0 0.35rem;
}
.hx-force-inline {
  margin: 0.35rem 0 0.45rem 0.35rem;
  padding: 0.35rem 0.45rem;
  border-radius: 0.65rem;
  background: color-mix(in srgb, #e0a020 8%, #fff);
  border: 1px dashed color-mix(in srgb, #e0a020 45%, var(--or-border));
}
.hx-branch { margin-top: 0.45rem; }
.hx-opt-group {
  margin-top: 0.55rem;
  border: 1px dashed var(--or-border);
  border-radius: 0.75rem;
  padding: 0.35rem 0.55rem 0.55rem;
  background: var(--or-surface-2);
}
.hx-opt-group summary {
  cursor: pointer;
  font-weight: 800;
  font-size: 0.82rem;
  color: var(--or-muted);
  padding: 0.35rem 0;
}
.hx-tick-body {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}
.hx-tick-kind {
  font-style: normal;
  font-size: 0.65rem;
  font-weight: 800;
  width: fit-content;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: #dee2e6;
  color: #212529;
}
.hx-tick-must .hx-tick-kind { background: #0d6efd; color: #fff; }
.hx-tick-avoid .hx-tick-kind { background: #e0a020; color: #1a1400; }
.hx-tick-forbid .hx-tick-kind { background: #F15412; color: #fff; }
.hx-tick-rec .hx-tick-kind { background: #15B76B; color: #fff; }
.hx-tick.is-missing,
.hx-tick-choice.is-missing {
  outline: 2px solid #F15412;
  outline-offset: 1px;
  border-radius: 0.55rem;
  animation: hx-miss-shake 0.35s ease;
}
@keyframes hx-miss-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(3px); }
  75% { transform: translateX(-3px); }
}
.hx-cx-warn {
  margin: 0 0 0.75rem;
  padding: 0.65rem 0.75rem;
  border-radius: 0.75rem;
  background: rgba(241, 84, 18, 0.1);
  border: 1px solid rgba(241, 84, 18, 0.35);
  color: #8a2a0a;
  font-weight: 800;
  font-size: 0.84rem;
}
.hx-tick-choice {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.45rem 0.25rem;
  margin: 0;
  font-weight: 700;
  font-size: 0.86rem;
  cursor: pointer;
}

/* —— صفحه لاگین Identity: فوکوس روی فرم، بدون تب‌بار —— */
body:has(.login-page) .app-tabbar {
  display: none !important;
}

body:has(.login-page).mobile-shell {
  padding-bottom: max(1rem, env(safe-area-inset-bottom, 0px));
}

body:has(.login-page) .app-main {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: calc(100dvh - var(--app-topbar-h, 56px) - env(safe-area-inset-top, 0px) - 1rem);
}

@media (min-width: 992px) {
  html:not(.is-app-shell) body.or-app:has(.login-page):not(.admin-wide) .app-main {
    background: transparent;
    border: 0;
    box-shadow: none;
    border-radius: 0;
    margin-top: 0;
    margin-bottom: 0;
    min-height: calc(100dvh - var(--app-topbar-h, 56px) - 2rem);
    padding-top: 1.5rem;
    padding-bottom: 2rem;
  }
}

/* —— ریسپانسیو سراسری: وب / موبایل / APK —— */
html, body {
  overflow-x: clip;
  max-width: 100%;
}

img, svg, video, canvas {
  max-width: 100%;
  height: auto;
}

.app-topbar-inner {
  padding-left: max(var(--app-pad), env(safe-area-inset-left, 0px));
  padding-right: max(var(--app-pad), env(safe-area-inset-right, 0px));
  box-sizing: border-box;
}

.user-welcome-bar {
  padding-left: max(1rem, env(safe-area-inset-left, 0px));
  padding-right: max(1rem, env(safe-area-inset-right, 0px));
}

@media (max-width: 360px) {
  :root {
    --app-pad: 0.75rem;
  }

  .app-brand-text {
    font-size: 0.92rem;
  }
}

@media (min-width: 576px) and (max-width: 991.98px) {
  body.or-app:not(.admin-wide) .app-main {
    max-width: 840px;
  }

  body.or-app:not(.admin-wide) .organ-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  body.or-app:not(.admin-wide) .home-entry-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 1200px) {
  html:not(.is-app-shell) body.or-app:not(.admin-wide) .app-topbar-inner,
  html:not(.is-app-shell) body.or-app:not(.admin-wide) .app-main,
  html:not(.is-app-shell) body.or-app:not(.admin-wide) .user-welcome-inner {
    max-width: 1200px;
  }
}

/* جلوگیری از zoom ناخواسته روی iOS در فیلدهای فرم */
@supports (-webkit-touch-callout: none) {
  .login-page .form-control,
  .account-form .form-control,
  .gate-input {
    font-size: 16px !important;
  }
}
