/* panel-premium.css — پنل دکتر RTL، تم پزشکی روشن/تیره */

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

:root {
  --bg: #f3f8fc;
  --bg-accent: #e8f2fa;
  --bg-glow-a: #d4e8f7;
  --bg-glow-b: #e0f0e8;
  --surface: #ffffff;
  --surface-muted: #f7fafc;
  --surface-soft: #f0f6fb;
  --primary: #4d9fe0;
  --primary-deep: #2f7fc4;
  --primary-soft: #eaf4fc;
  --primary-ring: rgba(77, 159, 224, 0.22);
  --primary-border: #cfe2f2;
  --text: #1e3348;
  --text-secondary: #5a738c;
  --text-muted: #8a9fb4;
  --border: #d8e4ef;
  --border-soft: #e8eef5;
  --green: #22c55e;
  --green-deep: #16a34a;
  --green-soft: #f0fdf4;
  --green-border: #bbf7d0;
  --green-glow: rgba(34, 197, 94, 0.22);
  --red: #ef4444;
  --red-deep: #dc2626;
  --red-soft: #fef2f2;
  --red-border: #fecaca;
  --red-glow: rgba(239, 68, 68, 0.18);
  --red-muted: #f8e8e8;
  --telegram: #2aabee;
  --telegram-deep: #229ed9;
  --bale: #00a884;
  --bale-deep: #009672;
  --shadow-sm: 0 1px 3px rgba(30, 51, 72, 0.05);
  --shadow-md: 0 10px 28px rgba(47, 127, 196, 0.1);
  --shadow-lg: 0 18px 40px rgba(47, 127, 196, 0.12);
  --radius: 20px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --radius-pill: 999px;
  --focus-ring: 0 0 0 3px var(--primary-ring);
  --transition: 0.22s ease;
  --da-width: 150px;
  --switch-w: 52px;
  --switch-h: 30px;
  --switch-knob: 24px;
  --switch-travel: 22px;
}

html[data-theme="dark"] {
  --bg: #0f1720;
  --bg-accent: #15202b;
  --bg-glow-a: #1a3348;
  --bg-glow-b: #1a3a32;
  --surface: #1a2430;
  --surface-muted: #212d3a;
  --surface-soft: #243140;
  --primary: #5aade8;
  --primary-deep: #7bc0f0;
  --primary-soft: #1e3348;
  --primary-ring: rgba(90, 173, 232, 0.28);
  --primary-border: #2e4458;
  --text: #e8eef4;
  --text-secondary: #a8b9c9;
  --text-muted: #7a8fa3;
  --border: #2e3f50;
  --border-soft: #263545;
  --green: #34d399;
  --green-deep: #6ee7b7;
  --green-soft: #143028;
  --green-border: #1f4a3a;
  --green-glow: rgba(52, 211, 153, 0.22);
  --red: #f87171;
  --red-deep: #fca5a5;
  --red-soft: #3a2226;
  --red-border: #5a3036;
  --red-glow: rgba(248, 113, 113, 0.2);
  --red-muted: #322428;
  --telegram: #3bb5f0;
  --telegram-deep: #5cc4f5;
  --bale: #1ec9a0;
  --bale-deep: #3dd9b0;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 10px 28px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 18px 40px rgba(0, 0, 0, 0.45);
}

html {
  overflow-x: hidden;
  scroll-behavior: smooth;
  color-scheme: light;
}

html[data-theme="dark"] {
  color-scheme: dark;
}

body {
  font-family: "Vazirmatn", system-ui, sans-serif;
  background: linear-gradient(165deg, var(--bg) 0%, var(--bg-accent) 45%, var(--bg) 100%);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 1.75rem 1.25rem 3rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.bg-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.bg-glow::before,
.bg-glow::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(110px);
  opacity: 0.35;
}

.bg-glow::before {
  width: 420px;
  height: 420px;
  background: var(--bg-glow-a);
  top: -260px;
  right: -120px;
}

.bg-glow::after {
  width: 360px;
  height: 360px;
  background: var(--bg-glow-b);
  bottom: -140px;
  left: -100px;
}

.skip-link {
  position: absolute;
  top: -100%;
  right: 1rem;
  background: var(--text);
  color: var(--surface);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  z-index: 300;
  text-decoration: none;
}

.skip-link:focus {
  top: 1rem;
}

.layout {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 560px;
}

.card {
  width: 100%;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  padding: 1.6rem 1.45rem 1.5rem;
  animation: fadeUp 0.45s ease both;
  overflow: visible;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── نوار هدر: عنوان + تم ── */
.theme-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.panel-brand {
  flex: 1 1 auto;
  min-width: 0;
  text-align: right;
}

.panel-brand #panel-title,
#panel-title {
  font-size: clamp(0.92rem, 3.4vw, 1.12rem);
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
  letter-spacing: -0.01em;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
  margin: 0;
}

.panel-brand-sub {
  margin: 0.28rem 0 0;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
  line-height: 1.45;
}

.panel-brand .panel-version {
  margin-top: 0.4rem;
}

.theme-toggle {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-width: 40px;
  height: auto;
  padding: 0.45rem 0.95rem;
  gap: 0.45rem;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box,
    linear-gradient(120deg, #5eb0ff, #22c55e, #a78bfa, #5eb0ff) border-box;
  background-size: 100% 100%, 220% 220%;
  color: var(--text);
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(47, 127, 196, 0.16);
  transition: transform 0.25s ease, box-shadow 0.25s ease, color 0.25s ease;
  animation: themeBorderShift 5s linear infinite;
}

.theme-toggle-glow {
  position: absolute;
  inset: -40%;
  background: radial-gradient(circle, rgba(94, 176, 255, 0.28), transparent 62%);
  opacity: 0.55;
  pointer-events: none;
  animation: themeGlowPulse 2.8s ease-in-out infinite;
}

.theme-label {
  position: relative;
  z-index: 1;
  font-family: "Outfit", "Vazirmatn", sans-serif;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  background: linear-gradient(105deg, #2f7fc4, #16a34a);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

html[data-theme="dark"] .theme-label {
  background: linear-gradient(105deg, #7bc0f0, #6ee7b7);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
  position: relative;
  z-index: 1;
}

.theme-toggle:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 10px 24px rgba(47, 127, 196, 0.28);
  background: var(--primary-soft);
  border-color: var(--primary-border);
  color: var(--primary-deep);
}

@keyframes themeBorderShift {
  0% { background-position: 0% 50%, 0% 50%; }
  100% { background-position: 0% 50%, 200% 50%; }
}

@keyframes themeGlowPulse {
  0%, 100% { opacity: 0.35; transform: scale(0.92); }
  50% { opacity: 0.7; transform: scale(1.08); }
}

.theme-toggle:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.theme-toggle svg,
.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
  width: 18px;
  height: 18px;
  display: block;
}

html[data-theme="dark"] .theme-toggle .icon-sun,
.theme-toggle .icon-moon {
  display: none;
}

html[data-theme="dark"] .theme-toggle .icon-moon {
  display: block;
}

html:not([data-theme="dark"]) .theme-toggle .icon-sun {
  display: block;
}

/* ── استیج ربات (بالای کارت‌ها) ── */
.robot-stage {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  margin: 0 0 0.85rem;
  padding: 0.15rem 0.25rem 0;
  min-height: 0;
  overflow: visible;
}

.hero-header {
  display: none;
}

.hero-copy {
  display: none;
}

.hero-title,
.hero-copy h1,
.panel-brand #panel-title {
  font-size: clamp(0.92rem, 3.4vw, 1.12rem);
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
}

.verified-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  flex-shrink: 0;
  vertical-align: middle;
  box-shadow: 0 0 0 3px var(--primary-ring);
}

.verified-badge svg {
  width: 0.7rem;
  height: 0.7rem;
  stroke: #fff;
  stroke-width: 2.5;
}

.panel-version {
  display: inline-flex;
  align-items: center;
  margin-top: 0.55rem;
  padding: 0.22rem 0.65rem;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--primary-deep);
  background: var(--primary-soft);
  border: 1px solid var(--primary-border);
  border-radius: var(--radius-pill);
  letter-spacing: 0.01em;
}

/* ── سکشن‌های پنل ── */
.panel-card {
  border: 1px solid var(--border);
  background: var(--surface-soft);
  border-radius: var(--radius-md);
  margin-bottom: 1.65rem;
  padding: 1.2rem 1.1rem;
}

.panel-card:last-of-type {
  margin-bottom: 0;
}

.bot-status-card {
  margin-bottom: 1.75rem !important;
}

.bot-links-wrap {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
  margin-top: 0.85rem;
}

.bot-links-wrap .panel-card {
  margin-bottom: 0;
}

.panel-card-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.35rem;
}

.panel-card-desc,
.panel-card-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin-bottom: 0.85rem;
}

/* ── وضعیت بات ── */
.bot-status-card {
  border-color: var(--green-border);
  background: linear-gradient(135deg, var(--green-soft) 0%, var(--surface-soft) 100%);
  transition: background var(--transition), border-color var(--transition);
}

.bot-status-card.is-off {
  border-color: var(--red-border);
  background: linear-gradient(135deg, var(--red-muted) 0%, var(--surface-soft) 100%);
}

.bot-status-row {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  gap: 0.85rem;
}

.bot-status-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  flex: 1;
}

.bot-status-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--green-soft);
  border: 1px solid var(--green-border);
  color: var(--green-deep);
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.bot-status-card.is-off .bot-status-icon {
  background: var(--red-soft);
  border-color: var(--red-border);
  color: var(--red-deep);
}

.bot-status-icon svg {
  width: 20px;
  height: 20px;
}

.bot-status-text {
  min-width: 0;
}

.bot-status-text strong,
.bot-status-title {
  display: block;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
}

.bot-status-text span,
.bot-status-desc {
  display: block;
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-top: 0.12rem;
  line-height: 1.45;
}

.bot-status-card.is-off .bot-status-title,
.bot-status-card.is-off .bot-status-text strong {
  color: var(--red-deep);
}

/* ── سوئیچ ── */
.switch {
  position: relative;
  width: var(--switch-w);
  height: var(--switch-h);
  flex-shrink: 0;
}

.switch input,
.switch input#bot-toggle {
  opacity: 0;
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
  z-index: 1;
  cursor: pointer;
  margin: 0;
}

.switch-track {
  position: absolute;
  inset: 0;
  background: #c5cdd6;
  border-radius: var(--radius-pill);
  transition: background 0.28s ease, box-shadow 0.28s ease;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.08);
}

html[data-theme="dark"] .switch-track {
  background: #4a5563;
}

.bot-status-card.is-off .switch-track,
.switch:not(:has(input:checked)) .switch-track {
  background: var(--red);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.04), 0 0 0 3px var(--red-glow);
}

.switch-track::after {
  content: "";
  position: absolute;
  width: var(--switch-knob);
  height: var(--switch-knob);
  background: #fff;
  border-radius: 50%;
  top: 3px;
  right: 3px;
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}

.switch input:checked + .switch-track,
.switch input#bot-toggle:checked + .switch-track {
  background: var(--green);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.04), 0 0 0 3px var(--green-glow);
}

.switch input:checked + .switch-track::after,
.switch input#bot-toggle:checked + .switch-track::after {
  transform: translateX(calc(-1 * var(--switch-travel)));
}

.switch input:focus-visible + .switch-track {
  outline: 2px solid var(--primary-deep);
  outline-offset: 3px;
}

/* ── پیام‌رسان‌ها ── */
.btn-connect {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 0.85rem;
  row-gap: 0.12rem;
  aspect-ratio: auto;
  min-height: 72px;
  width: 100%;
  padding: 1rem 1.15rem;
  border-radius: 16px;
  border: none;
  text-decoration: none;
  color: #fff;
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), filter var(--transition);
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 8px 20px rgba(30, 51, 72, 0.14);
  text-align: right;
}

.btn-connect > .btn-connect-bale-logo,
.btn-connect > .btn-connect-tg,
.btn-connect > .btn-connect-logo {
  grid-row: 1 / span 2;
}

.btn-connect > .btn-connect-title {
  grid-column: 2;
}

.btn-connect > .btn-connect-sub {
  grid-column: 2;
  display: block;
}

.btn-connect:hover {
  transform: translateY(-3px);
  filter: brightness(1.05);
  box-shadow: 0 12px 26px rgba(30, 51, 72, 0.2);
}

.btn-connect:active {
  transform: translateY(0);
}

.messenger-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  align-items: stretch;
}

@media (max-width: 560px) {
  .messenger-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 0.5rem;
    width: min(232px, 100%);
    margin-inline: auto;
  }

  .btn-connect {
    aspect-ratio: 1 / 1;
    min-height: 0;
    max-height: 108px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 0.28rem;
    padding: 0.55rem 0.3rem;
    border-radius: 14px;
    text-align: center;
    grid-template-columns: none;
    grid-template-rows: none;
    box-shadow: 0 5px 14px rgba(30, 51, 72, 0.12);
  }

  .btn-connect > .btn-connect-bale-logo,
  .btn-connect > .btn-connect-tg,
  .btn-connect > .btn-connect-logo,
  .btn-connect > .btn-connect-title,
  .btn-connect > .btn-connect-sub {
    grid-row: auto;
    grid-column: auto;
  }

  .btn-connect-check {
    display: none;
  }

  .btn-connect-bale-logo,
  .btn-connect-tg,
  .btn-connect-logo {
    width: 26px !important;
    height: 26px !important;
    margin: 0 auto;
    padding: 2px;
  }

  .btn-connect-title {
    font-size: 0.65rem;
    line-height: 1.25;
    text-align: center;
  }

  .btn-connect-sub {
    display: none;
  }

  .hero-header {
    display: none;
  }

  .panel-brand #panel-title,
  #panel-title {
    font-size: 0.88rem !important;
    line-height: 1.3 !important;
  }

  .panel-brand-sub {
    font-size: 0.7rem;
  }

  .panel-version {
    font-size: 0.58rem;
    margin-top: 0.3rem;
    padding: 0.12rem 0.45rem;
  }

  #doctor-assistant.da,
  .da {
    width: auto;
    max-width: min(280px, 92%);
    gap: 0.45rem;
    flex-direction: row;
    align-items: flex-end;
    justify-content: center;
  }

  .da-robot,
  .da.da--minimized .da-robot {
    width: 56px;
    align-self: flex-end;
  }

  .da.da--asleep .da-robot,
  .da.da--asleep.da--minimized .da-robot {
    width: 62px;
  }

  .da-bubble {
    max-width: min(128px, 44vw);
    width: auto;
    min-width: 0;
    align-self: flex-start;
    margin-top: 0.1rem;
  }

  .da-bubble::after {
    bottom: auto;
    top: 68%;
    right: -5px;
    left: auto;
    border-right: 1px solid var(--primary-border);
    border-top: 1px solid var(--primary-border);
    border-bottom: none;
    border-left: none;
    transform: rotate(45deg);
  }

  .da-bubble-inner {
    font-size: 0.6rem;
    padding: 0.38rem 0.45rem;
    line-height: 1.4;
  }

  .da-line--title {
    font-size: 0.62rem;
  }

  .da-line--soft {
    display: block !important;
    font-size: 0.56rem;
  }

  .bot-status-card {
    margin-bottom: 1.15rem !important;
  }

  .bot-links-wrap {
    gap: 1.35rem;
    margin-top: 0.75rem;
  }

  .bot-status-row {
    flex-wrap: wrap;
  }

  .bot-status-control {
    width: 100%;
    justify-content: space-between;
    margin-top: 0.25rem;
    padding-top: 0.55rem;
    border-top: 1px dashed var(--border);
  }

  .bot-live-label {
    font-size: 0.8rem;
  }

  .copy-row {
    flex-wrap: nowrap;
  }

  .copy-row input {
    font-size: 0.72rem;
    min-width: 0;
  }

  .btn-copy {
    flex-shrink: 0;
    min-height: 42px;
    padding: 0.55rem 0.75rem;
  }

  .actions .btn {
    min-height: 50px;
    font-size: 0.92rem;
  }

  .card {
    padding: 1.15rem 0.95rem 1.25rem;
  }

  .panel-card {
    padding: 1rem 0.9rem;
  }

  .theme-label {
    display: inline;
  }
}

.btn-connect:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.btn-connect .btn-connect-icon,
.btn-connect svg.platform-icon {
  width: 28px;
  height: 28px;
  display: block;
}

.btn-connect.btn-bale {
  background: linear-gradient(160deg, var(--bale) 0%, var(--bale-deep) 100%);
  box-shadow: 0 8px 20px rgba(0, 168, 132, 0.32);
}

.btn-connect.btn-bale:hover {
  box-shadow: 0 12px 26px rgba(0, 168, 132, 0.4);
}

.btn-connect.btn-telegram {
  background: linear-gradient(160deg, var(--telegram) 0%, var(--telegram-deep) 100%);
  box-shadow: 0 8px 20px rgba(42, 171, 238, 0.32);
}

.btn-connect.btn-telegram:hover {
  box-shadow: 0 12px 26px rgba(42, 171, 238, 0.4);
}

.btn-connect-check {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  color: var(--green-deep);
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

.btn-connect.is-connected .btn-connect-check,
.btn-connect[data-connected="true"] .btn-connect-check {
  display: flex;
}

.btn-connect-check svg {
  width: 12px;
  height: 12px;
}

/* ── لینک بیمار ── */
.patient-links {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.patient-link-row {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
}

.patient-link-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
}

.patient-link-label .platform-icon,
.patient-link-row .platform-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  border-radius: 6px;
}

.copy-row {
  display: flex;
  gap: 0.45rem;
  align-items: stretch;
  flex-wrap: wrap;
}

.copy-row input {
  flex: 1 1 140px;
  min-width: 0;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.74rem;
  color: var(--text-secondary);
  background: var(--surface-muted);
  direction: ltr;
  text-align: left;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.copy-row input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--focus-ring);
}

.btn-copy {
  flex-shrink: 0;
  padding: 0.65rem 0.95rem;
  border: 1px solid var(--primary-border);
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary-deep);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}

.btn-copy:hover:not(:disabled) {
  background: #dceef9;
  border-color: var(--primary);
}

html[data-theme="dark"] .btn-copy:hover:not(:disabled) {
  background: #243d52;
}

.btn-copy:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-copy:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* ── دکمه‌ها و اکشن‌ها ── */
.actions {
  display: flex;
  gap: 0.65rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  flex: 1;
  min-height: 46px;
  padding: 0.7rem 1.1rem;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  border: 1.5px solid transparent;
  text-decoration: none;
  transition: background var(--transition), border-color var(--transition), color var(--transition), transform var(--transition), box-shadow var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.btn-save {
  background: linear-gradient(160deg, var(--green) 0%, var(--green-deep) 100%);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 6px 16px var(--green-glow);
}

.btn-save:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
  box-shadow: 0 8px 20px var(--green-glow);
}

.btn-save:active {
  transform: translateY(0);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border);
  box-shadow: none;
}

.btn-ghost:hover {
  background: var(--surface-muted);
  border-color: var(--text-muted);
  color: var(--text);
}

/* ── یادداشت امنیتی ── */
.secure-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  margin-top: 1rem;
  text-align: center;
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.secure-note svg,
.secure-note .secure-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  opacity: 0.75;
  color: var(--text-muted);
}

/* ── دکمه مشاهده بات (اختیاری کنار کپی) ── */
.btn-view-bot {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--text-secondary);
  text-decoration: none;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  transition: background var(--transition), border-color var(--transition), color var(--transition), transform var(--transition), box-shadow var(--transition);
}

.btn-view-bot svg,
.btn-view-bot img {
  width: 15px;
  height: 15px;
  display: block;
  flex-shrink: 0;
}

.btn-view-bot:hover {
  transform: translateY(-1px);
  border-color: var(--primary-border);
  color: var(--primary-deep);
  background: var(--primary-soft);
}

/* آیکون باز کردن بات: بزرگ‌تر — تلگرام آبی، بله با لوگوی اصلی */
.btn-view-tg,
.btn-view-bale {
  width: 48px;
  height: 48px;
  min-width: 48px;
  min-height: 48px;
  padding: 0;
  border-radius: 50%;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.12);
}

.btn-view-tg {
  border: 1.5px solid rgba(34, 158, 217, 0.4);
  background: linear-gradient(160deg, #2ab0eb 0%, #1a8fd0 100%);
  color: #fff;
  box-shadow: 0 4px 14px rgba(34, 158, 217, 0.28);
}

.btn-view-bale {
  border: 1.5px solid rgba(0, 166, 81, 0.35);
  background: #fff;
  color: #00a651;
  box-shadow: 0 4px 14px rgba(0, 166, 81, 0.18);
}

.btn-view-tg svg,
.btn-view-bale svg {
  width: 24px;
  height: 24px;
  color: #fff;
  fill: currentColor;
}

.btn-view-bale img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  filter: none;
}

.btn-view-tg:hover {
  transform: translateY(-1px) scale(1.04);
  border-color: rgba(34, 158, 217, 0.55);
  color: #fff;
  background: linear-gradient(160deg, #3cbcf2 0%, #1c97db 100%);
  box-shadow: 0 6px 18px rgba(34, 158, 217, 0.35);
}

.btn-view-bale:hover {
  transform: translateY(-1px) scale(1.04);
  border-color: rgba(0, 166, 81, 0.5);
  color: #008f45;
  background: #f3fbf6;
  box-shadow: 0 6px 18px rgba(0, 166, 81, 0.25);
}

.btn-view-tg span,
.btn-view-bale span {
  display: none;
}

/* ── فوتر نسخه ── */
.panel-footer {
  display: flex;
  justify-content: flex-start; /* سمت چپ بصری در RTL */
  margin-top: 1.1rem;
  padding-top: 0.35rem;
}

.panel-version--footer,
.panel-footer .panel-version {
  margin-top: 0;
  font-family: "SF Pro Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 0.62rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  padding: 0.12rem 0.42rem;
  line-height: 1.2;
  opacity: 0.72;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 999px;
  text-transform: none;
}

.actions {
  display: none !important;
}

.messenger-grid,
.btn-connect {
  display: none !important;
}

/* ── پیل وضعیت ── */
.status-pill {
  position: fixed;
  top: 1.25rem;
  left: 50%;
  transform: translate(-50%, calc(-100% - 2rem));
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 1.05rem;
  border-radius: var(--radius-pill);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: none;
  transition:
    transform 0.4s cubic-bezier(0.34, 1.4, 0.64, 1),
    opacity 0.3s,
    visibility 0.3s,
    box-shadow 0.3s;
  z-index: 200;
  opacity: 0;
  visibility: hidden;
}

.status-pill.visible {
  transform: translate(-50%, 0);
  opacity: 1;
  visibility: visible;
  box-shadow: var(--shadow-md);
}

.status-pill.on {
  background: var(--green-soft);
  border-color: var(--green-border);
}

.status-pill.off {
  background: var(--red-soft);
  border-color: var(--red-border);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px var(--green-glow);
}

.status-pill.off .status-dot {
  background: var(--red);
  box-shadow: 0 0 0 3px var(--red-glow);
}

.status-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--green-deep);
}

.status-pill.off .status-label {
  color: var(--red-deep);
}

/* ── توست ── */
.toast {
  position: fixed;
  top: 1.25rem;
  left: 50%;
  transform: translate(-50%, calc(-100% - 2rem));
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--text);
  color: #fff;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-pill);
  font-size: 0.82rem;
  font-weight: 500;
  box-shadow: none;
  transition:
    transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
    opacity 0.3s,
    visibility 0.3s,
    box-shadow 0.3s;
  z-index: 210;
  opacity: 0;
  visibility: hidden;
  max-width: calc(100vw - 2rem);
}

.toast.active {
  transform: translate(-50%, 0);
  opacity: 1;
  visibility: visible;
  box-shadow: var(--shadow-md);
}

html[data-theme="dark"] .toast {
  background: #e8eef4;
  color: #1e3348;
}

.toast-icon {
  width: 18px;
  height: 18px;
  background: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.toast-icon svg {
  width: 10px;
  height: 10px;
  stroke: #fff;
}

/* ── دستیار دکتر — استیج: ربات راست، حباب چپ ── */
#doctor-assistant.da,
.da {
  position: relative;
  z-index: 5;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: flex-end;
  justify-content: center;
  gap: 0.55rem;
  width: auto;
  max-width: min(260px, 88%);
  flex: 0 1 auto;
  min-width: 0;
  margin: 0 auto;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition:
    opacity 0.4s ease,
    transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

#doctor-assistant.da.da--visible,
.da.da--visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

#doctor-assistant.da.da--enter,
.da.da--enter {
  animation: daSlideIn 0.65s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes daSlideIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.da-robot {
  position: relative;
  width: 64px;
  flex: 0 0 auto;
  cursor: default;
  outline: none;
  animation: none;
  align-self: flex-end;
}

.da.da--minimized .da-robot {
  width: 64px;
  transform: none;
  animation: none;
}

.da.da--asleep .da-robot,
.da.da--asleep.da--minimized .da-robot {
  width: 70px;
}

.da-bubble {
  position: relative;
  flex: 1 1 auto;
  max-width: min(140px, 46vw);
  width: auto;
  min-width: 0;
  align-self: flex-start;
  margin-top: 0.15rem;
  background: #fff;
  border: 1px solid var(--primary-border);
  border-radius: 12px 12px 5px 12px;
  box-shadow: 0 6px 14px rgba(47, 127, 196, 0.12);
  padding: 0;
  transform-origin: bottom left;
  transform: scale(0.92) translateY(6px);
  opacity: 0;
  visibility: hidden;
  z-index: 8;
  overflow-wrap: anywhere;
  word-break: break-word;
  transition:
    transform 0.3s cubic-bezier(0.34, 1.3, 0.64, 1),
    opacity 0.25s ease,
    visibility 0.25s;
}

.da.da--bubble-open .da-bubble {
  transform: scale(1) translateY(0);
  opacity: 1;
  visibility: visible;
}

.da-bubble::after {
  content: "";
  position: absolute;
  bottom: auto;
  top: 68%;
  right: -5px;
  left: auto;
  width: 9px;
  height: 9px;
  background: #fff;
  border-right: 1px solid var(--primary-border);
  border-top: 1px solid var(--primary-border);
  border-left: none;
  border-bottom: none;
  transform: rotate(45deg);
}

.da-bubble-inner {
  padding: 0.4rem 0.48rem;
  font-size: 0.62rem;
  color: var(--text);
  line-height: 1.4;
  font-weight: 500;
  text-align: right;
}

.da-bubble-inner.da-bubble-fade {
  animation: daBubbleTextIn 0.3s ease;
}

@keyframes daBubbleTextIn {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: translateY(0); }
}

.da-line {
  margin: 0 0 0.2rem;
}

.da-line:last-child {
  margin-bottom: 0;
}

.da-line--title {
  font-weight: 700;
  color: var(--text);
  font-size: 0.64rem;
}

.da-line--soft {
  color: var(--text-secondary);
  font-size: 0.58rem;
}

.da-robot-img {
  display: block !important;
  width: 100%;
  height: auto;
  background: transparent !important;
  filter: drop-shadow(0 6px 12px rgba(47, 127, 196, 0.18));
  transform: none !important;
  animation: none !important;
  pointer-events: none;
  -webkit-user-drag: none;
  transition: opacity 0.35s ease, filter 0.35s ease;
}

.da.da--asleep .da-robot-img {
  filter: drop-shadow(0 4px 10px rgba(30, 51, 72, 0.14));
  opacity: 1;
}

.da.da--wave .da-robot-img {
  animation: none !important;
}

.da-sparkles,
.da-svg,
.da-robot-fallback {
  display: none !important;
}

html[data-theme="dark"] .da-bubble,
html[data-theme="dark"] .da-bubble::after {
  background: var(--surface);
}

.da-robot:focus-visible {
  border-radius: 16px;
  box-shadow: var(--focus-ring);
}

/* ── موبایل ── */

@media (max-width: 520px) {
  .btn-view-bot {
    padding: 0.5rem 0.55rem;
    font-size: 0.66rem;
    gap: 0.28rem;
  }

  .btn-view-bot span {
    display: none;
  }

  .btn-view-bot {
    min-width: 40px;
    min-height: 40px;
  }

  .btn-view-tg,
  .btn-view-bale {
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
    padding: 0;
  }

  .btn-view-tg svg,
  .btn-view-bale svg {
    width: 24px;
    height: 24px;
  }

  .btn-view-bale img {
    width: 28px;
    height: 28px;
  }

  .card {
    padding: 1.05rem 0.85rem 1rem;
    border-radius: 16px;
  }

  .theme-bar {
    margin-bottom: 0.65rem;
    gap: 0.5rem;
  }

  .panel-brand #panel-title,
  #panel-title {
    font-size: 0.86rem !important;
    line-height: 1.3 !important;
  }

  .robot-stage {
    margin-bottom: 1rem;
  }

  #doctor-assistant.da,
  .da {
    max-width: min(240px, 90%);
    gap: 0.3rem;
    flex-direction: row;
    align-items: flex-end;
    justify-content: center;
  }

  .da-robot,
  .da.da--minimized .da-robot {
    width: 52px;
    align-self: flex-end;
  }

  .da.da--asleep .da-robot,
  .da.da--asleep.da--minimized .da-robot {
    width: 58px;
  }

  .da-bubble {
    max-width: min(120px, 42vw);
    width: auto;
    align-self: flex-start;
    margin-top: 0.08rem;
  }

  .da-bubble::after {
    bottom: auto;
    top: 68%;
    right: -5px;
    left: auto;
    border-right: 1px solid var(--primary-border);
    border-top: 1px solid var(--primary-border);
    border-bottom: none;
    border-left: none;
    transform: rotate(45deg);
  }

  .da-bubble-inner {
    font-size: 0.58rem;
    padding: 0.35rem 0.42rem;
    line-height: 1.4;
  }

  .da-line--title {
    font-size: 0.6rem;
  }

  .da-line--soft {
    display: block !important;
    font-size: 0.54rem;
  }

  .bot-status-card {
    margin-bottom: 1rem !important;
  }

  .bot-links-wrap {
    margin-top: 0.7rem;
    gap: 1.2rem;
  }

  .messenger-grid {
    grid-template-columns: 1fr 1fr !important;
    width: min(220px, 100%);
    margin-inline: auto;
    gap: 0.45rem;
  }

  .panel-card {
    padding: 0.85rem 0.8rem;
  }

  .actions {
    flex-direction: column;
  }

  .bot-status-row {
    gap: 0.65rem;
  }

  .bot-status-icon {
    width: 40px;
    height: 40px;
  }
}

@media (max-width: 380px) {
  .panel-brand #panel-title,
  #panel-title {
    font-size: 0.8rem !important;
  }

  #doctor-assistant.da,
  .da {
    max-width: 100%;
    gap: 0.35rem;
  }

  .da-robot,
  .da.da--minimized .da-robot {
    width: 48px;
  }

  .da.da--asleep .da-robot {
    width: 54px;
  }

  .da-bubble {
    max-width: min(110px, 40vw);
  }

  .da-bubble-inner {
    font-size: 0.56rem;
  }

  .da-line--title {
    font-size: 0.58rem;
  }

  .da-line--soft {
    display: block !important;
    font-size: 0.52rem;
  }

  .btn-connect-title {
    font-size: 0.68rem;
  }
}

/* ── کاهش حرکت ── */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .card {
    animation: none;
  }

  #doctor-assistant.da,
  .da,
  .da.da--visible,
  .da.da--enter {
    transform: none;
    animation: none;
  }

  .da-bubble,
  .da.da--bubble-open .da-bubble {
    transform: none;
  }

  .status-pill,
  .toast {
    transition: opacity 0.01ms, visibility 0.01ms;
  }

  .status-pill.visible,
  .toast.active {
    transform: translate(-50%, 0);
  }
}

/* ── تکمیل کلاس‌های HTML موکاپ ── */
.bot-status-control {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-shrink: 0;
}

.bot-live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px var(--green-glow);
}

.bot-live-dot.is-off {
  background: var(--red);
  box-shadow: 0 0 0 3px var(--red-glow);
}

.bot-live-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--green-deep);
  white-space: nowrap;
}

.bot-status-card.is-off .bot-live-label {
  color: var(--red-deep);
}

.section-head {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  margin-bottom: 0.95rem;
}

.section-head-icon {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: var(--primary-soft);
  color: var(--primary-deep);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.section-head-icon svg {
  width: 17px;
  height: 17px;
}

.section-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.section-sub {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
  line-height: 1.5;
}

.btn-connect-logo,
.btn-connect-tg,
.btn-connect-bale-logo {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 50%;
}

.btn-connect-bale-logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
  background: #fff;
  padding: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
  border: 2px solid rgba(255, 255, 255, 0.85);
}

.btn-connect.btn-bale:hover .btn-connect-bale-logo {
  transform: scale(1.08) rotate(-6deg);
  transition: transform 0.25s ease;
}

.btn-connect-tg {
  background: transparent;
  width: 30px;
  height: 30px;
}

.btn-connect-title {
  font-size: 0.86rem;
  font-weight: 700;
}

.btn-connect-sub {
  font-size: 0.7rem;
  font-weight: 500;
  opacity: 0.9;
}

.patient-link-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.45rem;
}

.patient-plat {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 800;
  flex-shrink: 0;
}

.patient-plat svg {
  width: 14px;
  height: 14px;
}

.patient-plat-tg {
  background: var(--telegram);
}

.patient-plat-bale {
  background: transparent;
  overflow: visible;
  width: 28px;
  height: 28px;
  border-radius: 0;
}

.patient-plat-bale img {
  width: 28px;
  height: 28px;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
}

.btn.btn-save,
.btn.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

.btn.btn-save svg,
.btn.btn-ghost svg {
  width: 16px;
  height: 16px;
}

.btn-copy svg {
  width: 14px;
  height: 14px;
}

.bot-links-wrap[hidden] {
  display: none !important;
}

@media (max-width: 520px) {
  .bot-status-control {
    width: 100%;
    justify-content: space-between;
    margin-top: 0.35rem;
  }

  .theme-label {
    display: none;
  }
}
