/* За Здоровье — навигация, шапка, дашборд, страницы */
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, sans-serif; background: #f8fafc; color: #1e293b; }
.hidden { display: none !important; }
.muted { color: #64748b; font-size: 0.9rem; }
.hint { font-size: 0.9rem; color: #64748b; margin: 0.5rem 0; }

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(2, 6, 23, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.auth-gate.hidden { display: none !important; }
.auth-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: 14px;
  padding: 1rem;
  box-shadow: 0 8px 32px rgba(0,0,0,0.22);
}
.auth-card h2 { margin: 0 0 0.5rem; }
.auth-card label { display: block; margin-top: 0.6rem; font-size: 0.9rem; color: #334155; }
.auth-card input { width: 100%; padding: 0.55rem 0.7rem; border: 1px solid #cbd5e1; border-radius: 8px; margin-top: 0.2rem; }
.auth-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.85rem; }

.app-header {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.5rem 1rem;
  background: #0f766e; color: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.header-btn { background: transparent; border: none; color: inherit; font-size: 1.25rem; padding: 0.5rem; cursor: pointer; border-radius: 8px; }
a.header-btn { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.header-btn:hover { background: rgba(255,255,255,0.15); }
.header-btn-bell { position: relative; }
.header-right { display: flex; align-items: center; gap: 0.5rem; }
.header-actions { display: flex; align-items: center; gap: 0.25rem; }
.header-btn-home {
  line-height: 1;
  padding: 0.5rem 0.65rem;
  background: rgba(255,255,255,0.22);
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.35);
  flex-shrink: 0;
}
.header-btn-home:hover {
  background: rgba(255,255,255,0.35);
  border-color: rgba(255,255,255,0.5);
}
.header-btn-home svg { display: block; }
.notifications-badge { position: absolute; top: 2px; right: 2px; min-width: 16px; height: 16px; font-size: 10px; line-height: 16px; text-align: center; background: #dc2626; border-radius: 8px; }
.notifications-badge.hidden { display: none !important; }
.header-severity { display: flex; align-items: center; gap: 0.35rem; font-size: 0.85rem; }
.severity-dot { width: 18px; height: 18px; border-radius: 50%; flex-shrink: 0; }
.severity-green { background: #22c55e; }
.severity-yellow { background: #eab308; }
.severity-red { background: #ef4444; }

/* ═══════════════════════════════════════════════════════════════
   SIDEBAR — SaaS-grade medical navigation
   ═══════════════════════════════════════════════════════════════ */
.drawer {
  position: fixed; top: 0; left: 0; bottom: 0; width: 240px;
  background: #fff; border-right: 1px solid #e2e8f0;
  z-index: 200; display: flex; flex-direction: column;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}
.drawer.closed { transform: translateX(-100%); }

/* Logo bar */
.drawer-logo {
  display: flex; align-items: center; gap: 0.625rem;
  padding: 1.125rem 1.25rem;
  border-bottom: 1px solid #e2e8f0; flex-shrink: 0;
}
.drawer-logo-icon { font-size: 1.375rem; line-height: 1; }
.drawer-logo-name { font-size: 0.9375rem; font-weight: 700; color: #0f766e; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drawer-close-btn {
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; flex-shrink: 0;
  background: none; border: none; color: #94a3b8; cursor: pointer;
  border-radius: 6px; padding: 0;
}
.drawer-close-btn:hover { background: #f1f5f9; color: #475569; }

/* Nav scroll container */
.drawer-nav { padding: 0.625rem 0 0.75rem; overflow-y: auto; flex: 1; min-height: 0; }

/* Group labels */
.drawer-nav-group {
  display: block; padding: 0.625rem 1.25rem 0.25rem;
  font-size: 0.625rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.07em; color: #94a3b8; user-select: none;
}
.drawer-nav-group:first-child { padding-top: 0.25rem; }

/* Nav link items */
.drawer-nav-link {
  display: flex; align-items: center; gap: 0.625rem;
  padding: 0.5rem 1.25rem;
  font-size: 0.8125rem; font-weight: 500; color: #475569;
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: background 0.1s, color 0.1s;
  position: relative;
}
.drawer-nav-link:hover {
  background: #f8fafc; color: #1e293b;
}
.drawer-nav-link.active {
  border-left-color: #0f766e;
  background: #f0fdfa; color: #0f766e; font-weight: 600;
}
.drawer-nav-link.active .nav-icon { color: #0f766e; opacity: 1; }
.drawer-nav-link:hover .nav-icon { opacity: 0.85; }

/* Icon */
.nav-icon {
  width: 18px; height: 18px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: #64748b; opacity: 0.75;
  transition: color 0.1s, opacity 0.1s;
}
.nav-icon svg { display: block; }
.nav-label { flex: 1; line-height: 1.3; }

/* Numeric badge (notifications) */
.nav-badge {
  min-width: 18px; height: 18px; padding: 0 4px;
  background: #ef4444; color: #fff;
  font-size: 0.625rem; font-weight: 700; text-align: center;
  line-height: 18px; border-radius: 9px; flex-shrink: 0;
}
.nav-badge.hidden { display: none !important; }

/* Footer version */
.drawer-version {
  flex-shrink: 0; padding: 0.625rem 1.25rem; margin: 0;
  font-size: 0.75rem; border-top: 1px solid #e2e8f0;
}

/* Backdrop (mobile overlay) */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.35); z-index: 199; backdrop-filter: blur(2px); }
.drawer-backdrop.hidden { display: none !important; }

/* ═══════════════════════════════════════════════════════════════
   LAYOUT — main content areas
   ═══════════════════════════════════════════════════════════════ */
.app-main { padding: 1rem; padding-bottom: 4.5rem; max-width: 720px; margin: 0 auto; min-height: 60vh; }

/* ═══════════════════════════════════════════════════════════════
   DESKTOP: persistent left sidebar
   ═══════════════════════════════════════════════════════════════ */
@media (min-width: 960px) {
  /* Sidebar: always visible, no transform */
  .drawer { transform: none !important; box-shadow: none; border-right: 1px solid #e2e8f0; }
  .drawer.closed { transform: none !important; }
  .drawer-close-btn { display: none; }
  .drawer-backdrop { display: none !important; }
  /* Hamburger hidden on desktop */
  #drawerBtn { display: none; }
  /* Push header + content + bottom-nav right by sidebar width */
  .app-header { margin-left: 240px; }
  .app-main { margin-left: 240px; max-width: calc(100% - 240px - 2rem); }
  .bottom-nav { left: 240px; }
}
.page { display: block; }
.page.hidden { display: none !important; }

.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  display: flex; justify-content: space-around; align-items: center;
  padding: 0.5rem; padding-bottom: calc(0.5rem + env(safe-area-inset-bottom, 0));
  background: #fff; border-top: 1px solid #e2e8f0; z-index: 90;
}
.bottom-nav .nav-item { font-size: 0.75rem; color: #64748b; text-decoration: none; padding: 0.35rem 0.5rem; border-radius: 8px; }
.bottom-nav .nav-item:hover { color: #0f766e; }
.bottom-nav .nav-item.active { color: #0f766e; font-weight: 600; }

.widget { background: #fff; border-radius: 12px; padding: 1rem; margin: 0.75rem 0; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.widget h3 { margin: 0 0 0.5rem; font-size: 1rem; }
.widget-red-flags { border-left: 4px solid #fef3c7; }
.guide-list { margin: 0.5rem 0; padding-left: 1.25rem; }
.guide-list li { margin: 0.35rem 0; }
.search-input { width: 100%; padding: 0.5rem 0.75rem; border: 1px solid #cbd5e1; border-radius: 8px; font-size: 1rem; box-sizing: border-box; }
.specialty-tags { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.5rem; }
.specialty-tag { display: inline-block; padding: 0.4rem 0.75rem; background: #e2e8f0; border-radius: 8px; font-size: 0.9rem; color: #334155; cursor: default; }
.specialty-tag:hover { background: #cbd5e1; }
.find-doctor-section .widget, .offline-guide-section .widget, .privacy-section .widget { margin: 0.75rem 0; }
.offline-list { margin-top: 0.75rem; max-height: 60vh; overflow-y: auto; }
.offline-items-ul { list-style: none; margin: 0; padding: 0; }
.offline-card { padding: 0.75rem 0; border-bottom: 1px solid #e2e8f0; }
.offline-card:last-child { border-bottom: none; }
.offline-desc { margin: 0.35rem 0; font-size: 0.9rem; }
.urgent-hint { color: #b91c1c; font-size: 0.9rem; margin: 0.35rem 0; }
.privacy-section .widget h3 { margin-top: 1rem; }
.privacy-section .widget h3:first-of-type { margin-top: 0; }
.notifications-list { list-style: none; margin: 0; padding: 0; }
.notification-item { padding: 0.75rem 0; border-bottom: 1px solid #e2e8f0; }
.notification-item:last-child { border-bottom: none; }
.notification-date { font-size: 0.8rem; display: block; margin-bottom: 0.25rem; }
.notification-body { margin: 0.35rem 0 0; font-size: 0.9rem; }

.card-form label { display: block; margin-top: 0.75rem; margin-bottom: 0.25rem; font-size: 0.9rem; color: #475569; }
.card-form input, .card-form textarea { width: 100%; padding: 0.5rem 0.75rem; border: 1px solid #cbd5e1; border-radius: 8px; font-size: 1rem; box-sizing: border-box; }
.labs-upload-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.labs-upload-row .btn-primary,
.labs-upload-row .btn-secondary {
  font-size: 0.95rem;
  padding: 0.6rem 1.2rem;
  min-height: 2.5rem;
  border-radius: 8px;
  font-weight: 500;
  line-height: 1.25;
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}
.labs-upload-row .btn-primary {
  background: #0f766e;
  color: #fff;
  border: none;
}
.labs-upload-row .btn-primary:hover { background: #0d5c55; }
.labs-upload-row .btn-secondary {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
}
.labs-upload-row .btn-secondary:hover { background: #e2e8f0; }
.labs-upload-row .labs-camera-btn {
  position: relative;
}
.labs-upload-row .labs-camera-btn .labs-camera-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.15);
  border: 2px solid rgba(255, 255, 255, 0.9);
  position: relative;
  flex: 0 0 auto;
}
.labs-upload-row .labs-camera-btn .labs-camera-icon::before {
  content: "";
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.95);
  position: absolute;
}
.labs-upload-row .labs-camera-btn .labs-camera-icon::after {
  content: "";
  width: 0.15rem;
  height: 0.15rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.95);
  position: absolute;
  top: 0.12rem;
  right: 0.14rem;
}
.labs-choose-file-label {
  display: block;
  margin-top: 0.75rem;
  margin-bottom: 0.25rem;
  font-size: 0.9rem;
  color: #475569;
}
.labs-file-input {
  margin-top: 0;
}
.labs-upload-row + .labs-upload-row {
  margin-top: 0.75rem;
}
.btn-primary { margin-top: 0.75rem; padding: 0.6rem 1.2rem; background: #0f766e; color: #fff; border: none; border-radius: 8px; font-size: 1rem; cursor: pointer; }
.btn-primary:hover { background: #0d5c55; }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.radio-label, .checkbox-label { display: block; margin: 0.35rem 0; font-size: 0.9rem; }
.setting-label { margin-top: 1rem; font-weight: 600; font-size: 0.9rem; }
.unified-hint { margin-bottom: 0.5rem; }
.tariff-accordion { display: flex; flex-direction: column; gap: 0.5rem; margin: 0.5rem 0 1rem; }
.tariff-expand { border: 1px solid #e2e8f0; border-radius: 12px; background: #f8fafc; overflow: hidden; }
.tariff-expand.tariff-free { border-color: #cbd5e1; }
.tariff-expand.expanded { border-color: #0f766e; background: #fff; box-shadow: 0 2px 8px rgba(15,118,110,0.08); }
.tariff-expand-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.875rem 1rem;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 1rem;
  text-align: left;
  color: #1e293b;
}
.tariff-expand-header:hover { background: rgba(15,118,110,0.06); }
.tariff-expand-title { font-weight: 700; color: #0f766e; }
.tariff-expand-desc { font-size: 0.875rem; color: #64748b; margin-left: auto; }
.tariff-expand-chevron {
  font-size: 0.7rem;
  color: #64748b;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}
.tariff-expand.expanded .tariff-expand-chevron { transform: rotate(180deg); color: #0f766e; }
.tariff-expand-body {
  display: none;
  padding: 0 1rem 1rem;
  border-top: 1px solid #f1f5f9;
}
.tariff-expand.expanded .tariff-expand-body { display: block; }
.tariff-options-list { margin: 0.75rem 0 0; padding-left: 1.25rem; font-size: 0.875rem; color: #475569; line-height: 1.6; }
.tariff-options-list li { margin-bottom: 0.35rem; }
.tariff-btn { margin-top: 0.75rem; display: inline-block; }
/* Модальное окно редактирования документа */
.doc-edit-modal { position: fixed; inset: 0; z-index: 350; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.doc-edit-modal.hidden { display: none !important; }
.doc-edit-modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.4); }
.doc-edit-modal-content { position: relative; background: #fff; border-radius: 12px; max-width: 520px; width: 100%; max-height: 90vh; overflow-y: auto; box-shadow: 0 4px 20px rgba(0,0,0,0.2); }
.doc-edit-modal-header { display: flex; justify-content: space-between; align-items: center; padding: 1rem; border-bottom: 1px solid #e2e8f0; }
.doc-edit-modal-body { padding: 1rem; }
.doc-edit-modal-body label { display: block; margin-top: 0.75rem; margin-bottom: 0.25rem; font-size: 0.9rem; }
.doc-edit-modal-body .input-text { width: 100%; padding: 0.5rem; border: 1px solid #e2e8f0; border-radius: 8px; }
.doc-edit-modal-body .input-textarea { width: 100%; padding: 0.5rem; border: 1px solid #e2e8f0; border-radius: 8px; resize: vertical; font-family: inherit; }
.doc-edit-modal-footer { display: flex; gap: 0.5rem; justify-content: flex-end; padding: 1rem; border-top: 1px solid #e2e8f0; }
.btn-secondary { padding: 0.5rem 1rem; background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; border-radius: 8px; cursor: pointer; }
.btn-secondary:hover { background: #e2e8f0; }

.labs-doc-item { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 0.75rem; }
.labs-doc-name { flex: 1 1 auto; min-width: 0; }
.labs-doc-badge { color: #0f766e; font-weight: bold; }
.labs-doc-actions { display: flex; gap: 0.35rem; }
.btn-sm { padding: 0.25rem 0.5rem; font-size: 0.85rem; border-radius: 6px; cursor: pointer; border: 1px solid transparent; }
.btn-edit { background: #f0fdfa; color: #0f766e; border-color: #0f766e; }
.btn-edit:hover { background: #ccfbf1; }
.btn-danger { background: #fef2f2; color: #dc2626; border-color: #dc2626; }
.btn-danger:hover { background: #fee2e2; }
.labs-report-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-top: 0.75rem; }
.labs-report-select { min-width: 180px; padding: 0.35rem 0.5rem; border-radius: 8px; border: 1px solid #e2e8f0; }

.payment-modal { position: fixed; inset: 0; z-index: 400; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.payment-modal.hidden { display: none !important; }
.payment-modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.4); }
.payment-modal-content { position: relative; background: #fff; border-radius: 12px; max-width: 400px; width: 100%; max-height: 90vh; overflow-y: auto; box-shadow: 0 4px 20px rgba(0,0,0,0.2); }
.payment-modal-header { display: flex; justify-content: space-between; align-items: center; padding: 1rem; border-bottom: 1px solid #e2e8f0; }
.payment-close { font-size: 1.5rem; }
.payment-step { padding: 1rem; }
.payment-methods { display: flex; flex-direction: column; gap: 0.5rem; }
.payment-method-btn { padding: 0.6rem 1rem; border: 1px solid #cbd5e1; border-radius: 8px; background: #fff; cursor: pointer; font-size: 1rem; text-align: left; }
.payment-method-btn:hover { background: #f1f5f9; border-color: #0f766e; }
.payment-back-btn { margin-bottom: 0.75rem; padding: 0.35rem 0; background: none; border: none; color: #0f766e; cursor: pointer; font-size: 0.9rem; }
.payment-method-screen { min-height: 80px; }
.save-row { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; margin-top: 0.5rem; }
.save-feedback { font-size: 0.85rem; color: #64748b; }
.save-salute { position: fixed; inset: 0; z-index: 9999; display: flex; align-items: center; justify-content: center; pointer-events: none; opacity: 0; transition: opacity 0.2s; }
.save-salute.save-salute-visible { opacity: 1; }
.save-salute-text { background: #0f766e; color: #fff; padding: 0.75rem 1.5rem; border-radius: 12px; font-weight: 600; }

.vitals-last { margin-bottom: 0.75rem; font-size: 0.9rem; }
.health-subsection { margin-top: 1.25rem; margin-bottom: 0.35rem; font-size: 1rem; }
.vitals-form .vitals-row { margin-top: 0.75rem; }
.vitals-inline { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.vitals-inline input { width: 5rem; min-width: 4rem; }
.vitals-sep { color: #64748b; font-weight: 600; }

.ad-or-news-block { margin: 0.5rem 0; padding: 0.75rem; background: #f0fdf4; border-radius: 8px; font-size: 0.9rem; }
.symptom-history-list { padding-left: 1.25rem; margin: 0.5rem 0; }
.symptom-history-list li { margin-bottom: 0.35rem; }

.recommendations-list { margin-top: 1rem; }
.recommendations-list-ul { list-style: none; padding: 0; margin: 0; }
.recommendation-item { padding: 0.75rem 0; border-bottom: 1px solid #e2e8f0; }
.recommendation-item:last-child { border-bottom: none; }
.recommendation-date { font-size: 0.85rem; }

.labs-docs-ul { list-style: none; padding: 0; margin: 0.5rem 0 0; }
.labs-doc-item { padding: 0.5rem 0; border-bottom: 1px solid #e2e8f0; font-size: 0.9rem; }
.labs-doc-item:last-child { border-bottom: none; }
.labs-doc-name { font-weight: 500; }
.recommendation-title { margin: 0.25rem 0 0; font-weight: 600; font-size: 0.95rem; color: #0f766e; }
.recommendation-summary { margin: 0.35rem 0 0; font-size: 0.9rem; color: #334155; }
.recommendation-actions {
  margin-top: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.recommendation-export-btn {
  font-size: 0.8rem;
  padding: 0.35rem 0.7rem;
}
.recommendation-sequence {
  margin-top: 0.55rem;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
  padding: 0.5rem 0.65rem;
}
.recommendation-sequence-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  color: #0f766e;
  font-size: 0.82rem;
}
.recommendation-sequence-status {
  font-size: 0.72rem;
  color: #475569;
  background: #e2e8f0;
  border-radius: 999px;
  padding: 0.1rem 0.45rem;
}
.recommendation-sequence-line {
  margin: 0.22rem 0 0;
  font-size: 0.82rem;
  color: #334155;
}
.recommendation-seq-toggle {
  margin-top: 0.45rem;
  font-size: 0.78rem;
  padding: 0.3rem 0.65rem;
}
.recommendation-sequence-details {
  margin-top: 0.5rem;
  border-top: 1px dashed #cbd5e1;
  padding-top: 0.5rem;
}
.recommendation-sequence-phases {
  margin: 0;
  padding-left: 1rem;
}
.recommendation-sequence-phase {
  margin: 0.15rem 0 0.55rem;
}
.recommendation-sequence-phase-title {
  margin: 0;
  font-size: 0.84rem;
  font-weight: 700;
  color: #0f766e;
}
.recommendation-sequence-list {
  margin: 0.2rem 0 0;
  padding-left: 1rem;
}
.recommendation-sequence-list li {
  font-size: 0.8rem;
  margin: 0.12rem 0;
}
.recommendation-sequence-collected { color: #0f766e; }
.recommendation-sequence-needs { color: #7c2d12; }
.severity-pill { display: inline-block; padding: 0.2rem 0.5rem; border-radius: 6px; font-size: 0.8rem; margin-left: 0.5rem; }
.severity-pill.severity-green { background: #dcfce7; color: #166534; }
.severity-pill.severity-yellow { background: #fef9c3; color: #854d0e; }
.severity-pill.severity-red { background: #fee2e2; color: #991b1b; }

.chat-panel {
  position: fixed; right: 0; top: 0; bottom: 0; width: 100%; max-width: 400px;
  background: #fff; box-shadow: -2px 0 12px rgba(0,0,0,0.15); z-index: 300;
  display: flex; flex-direction: column; transition: transform 0.2s ease;
}
.chat-panel.closed { transform: translateX(100%); }
.chat-panel-header { display: flex; justify-content: space-between; align-items: center; padding: 0.75rem 1rem; border-bottom: 1px solid #e2e8f0; }
.chat-messages { flex: 1; overflow-y: auto; padding: 1rem; }
.chat-msg { margin-bottom: 0.75rem; }
.chat-msg-bubble { display: inline-block; max-width: 85%; padding: 0.5rem 0.75rem; border-radius: 12px; font-size: 0.9rem; }
.chat-msg-user .chat-msg-bubble { background: #0f766e; color: #fff; margin-left: auto; }
.chat-msg-assistant .chat-msg-bubble { background: #f1f5f9; color: #1e293b; }
.chat-thinking { padding: 0 1rem 0.5rem; }
.chat-thinking .chat-msg-bubble { background: #f1f5f9; font-style: italic; }
.chat-form { padding: 1rem; border-top: 1px solid #e2e8f0; }
.chat-form .chat-input-wrap { margin-bottom: 0.5rem; }
.voice-input-wrap { display: flex; align-items: center; gap: 0.5rem; }
.voice-input-wrap input { flex: 1; min-width: 0; }
.chat-mic-btn { flex-shrink: 0; padding: 0.5rem 0.6rem; border: 1px solid #cbd5e1; border-radius: 8px; background: #fff; cursor: pointer; font-size: 1.1rem; }
.chat-mic-btn:hover { background: #f1f5f9; }
.chat-mic-btn.recording { background: #fef3c7; border-color: #f59e0b; }
.chat-mic-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.chat-voice-options { font-size: 0.85rem; margin-bottom: 0.5rem; display: block; }
.disclaimer { font-size: 0.85rem; color: #64748b; margin-bottom: 0.5rem; }

/* ═══════════════════════════════════════════════════════════════
   VOICE AI CONCIERGE
   ═══════════════════════════════════════════════════════════════ */
.vc-wrapper {
  position: fixed;
  bottom: calc(4.5rem + 0.75rem);
  right: 1.25rem;
  z-index: 500;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.625rem;
}
@media (min-width: 960px) {
  .vc-wrapper { bottom: 1.5rem; }
}

/* Floating mic button */
.vc-float-btn {
  position: relative;
  width: 56px; height: 56px;
  border-radius: 50%;
  background: #0f766e; color: #fff;
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(15,118,110,0.45);
  transition: background 0.15s, transform 0.15s, box-shadow 0.15s;
  flex-shrink: 0;
}
.vc-float-btn:hover { background: #0d6560; transform: scale(1.06); box-shadow: 0 6px 20px rgba(15,118,110,0.55); }
.vc-float-btn:active { transform: scale(0.96); }
.vc-float-btn.vc-float--listening { background: #dc2626; box-shadow: 0 4px 16px rgba(220,38,38,0.45); }
.vc-float-btn.vc-float--speaking { background: #0284c7; box-shadow: 0 4px 16px rgba(2,132,199,0.45); }
.vc-float-icon { position: relative; z-index: 1; }

/* Pulse ring animation */
.vc-pulse {
  position: absolute; inset: -6px;
  border-radius: 50%;
  border: 2px solid rgba(15,118,110,0.4);
  animation: vc-pulse 2.4s ease-in-out infinite;
  pointer-events: none;
}
.vc-float-btn.vc-float--listening .vc-pulse {
  border-color: rgba(220,38,38,0.5);
  animation: vc-pulse 1.0s ease-in-out infinite;
}
.vc-float-btn.vc-float--speaking .vc-pulse {
  border-color: rgba(2,132,199,0.5);
  animation: vc-pulse 1.6s ease-in-out infinite;
}
@keyframes vc-pulse {
  0%, 100% { transform: scale(1); opacity: 0.5; }
  50% { transform: scale(1.22); opacity: 0; }
}

/* Panel */
.vc-panel {
  width: 280px; max-width: calc(100vw - 2.5rem);
  height: min(680px, calc(100vh - 7rem)); /* ~2x higher panel while fitting viewport */
  background: #fff; border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.14), 0 2px 8px rgba(0,0,0,0.06);
  overflow: hidden;
  transition: opacity 0.2s, transform 0.2s;
  display: flex;
  flex-direction: column;
}
.vc-panel-header,
.vc-sequence,
.vc-waveform,
.vc-auto-toggle,
.vc-barge-hint,
.vc-voice-row,
.vc-controls,
.vc-disclaimer { flex-shrink: 0; }
.vc-panel--hidden { display: none !important; }

.vc-panel-header {
  display: flex; align-items: center; gap: 0.625rem;
  padding: 0.875rem 1rem;
  background: linear-gradient(135deg, #0f766e 0%, #0d9488 100%);
  color: #fff;
}
.vc-avatar {
  width: 36px; height: 36px; flex-shrink: 0;
  background: rgba(255,255,255,0.18); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.vc-avatar svg { stroke: #fff; }
.vc-panel-title-wrap { flex: 1; min-width: 0; }
.vc-panel-title { font-size: 0.875rem; font-weight: 700; }
.vc-status { font-size: 0.7rem; opacity: 0.85; display: block; margin-top: 1px; }
.vc-close-btn {
  width: 28px; height: 28px; flex-shrink: 0;
  background: rgba(255,255,255,0.15); border: none; color: #fff;
  border-radius: 8px; cursor: pointer; padding: 0;
  display: flex; align-items: center; justify-content: center;
}
.vc-close-btn:hover { background: rgba(255,255,255,0.28); }
.vc-reset-btn {
  width: 28px; height: 28px; flex-shrink: 0;
  background: rgba(255,255,255,0.15); border: none; color: #fff;
  border-radius: 8px; cursor: pointer; padding: 0;
  display: flex; align-items: center; justify-content: center;
}
.vc-reset-btn:hover { background: rgba(255,255,255,0.28); }

.vc-transcript {
  padding: 0.75rem 1rem;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable both-edges;
  background: #f8fafc; border-bottom: 1px solid #e2e8f0;
}
.vc-transcript::-webkit-scrollbar { width: 8px; }
.vc-transcript::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 8px; }
.vc-transcript::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
.vc-msg { margin: 0 0 0.375rem; font-size: 0.8125rem; line-height: 1.45; }
.vc-msg:last-child { margin-bottom: 0; }
.vc-msg-user { color: #0f766e; font-weight: 500; }
.vc-msg-assistant { color: #1e293b; }
.vc-msg-system { color: #94a3b8; font-style: italic; }

.vc-sequence {
  border-top: 1px solid #e2e8f0;
  border-bottom: 1px solid #e2e8f0;
  background: #ffffff;
  padding: 0.6rem 0.85rem;
  max-height: 180px;
  overflow-y: auto;
}
.vc-seq-empty {
  margin: 0;
  font-size: 0.78rem;
  color: #64748b;
}
.vc-seq-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
  color: #0f766e;
  font-size: 0.8rem;
}
.vc-seq-status {
  font-size: 0.72rem;
  color: #475569;
  background: #f1f5f9;
  border-radius: 999px;
  padding: 0.1rem 0.45rem;
}
.vc-seq-current,
.vc-seq-target {
  margin: 0.2rem 0;
  font-size: 0.74rem;
  color: #334155;
}
.vc-seq-phases {
  margin: 0.35rem 0 0;
  padding-left: 1rem;
}
.vc-seq-phase {
  margin: 0.2rem 0 0.45rem;
  color: #334155;
}
.vc-seq-phase.is-current .vc-seq-phase-title {
  color: #0f766e;
  font-weight: 700;
}
.vc-seq-phase-title { font-size: 0.76rem; font-weight: 600; }
.vc-seq-phase-goal { font-size: 0.72rem; color: #475569; margin-top: 0.1rem; }
.vc-seq-phase-need { font-size: 0.72rem; color: #64748b; margin-top: 0.12rem; }
.vc-seq-list { margin: 0.15rem 0 0; padding-left: 1rem; }
.vc-seq-list li { font-size: 0.72rem; margin: 0.1rem 0; }

/* Waveform animation */
.vc-waveform {
  display: flex; align-items: center; justify-content: center; gap: 3px;
  padding: 0.5rem 1rem; height: 36px;
  background: #f8fafc;
}
.vc-bar {
  width: 3px; border-radius: 2px; background: #0f766e;
  animation: vc-wave 1.2s ease-in-out infinite;
}
.vc-bar:nth-child(1) { animation-delay: 0s; height: 6px; }
.vc-bar:nth-child(2) { animation-delay: 0.1s; height: 14px; }
.vc-bar:nth-child(3) { animation-delay: 0.2s; height: 20px; }
.vc-bar:nth-child(4) { animation-delay: 0.15s; height: 24px; }
.vc-bar:nth-child(5) { animation-delay: 0.25s; height: 20px; }
.vc-bar:nth-child(6) { animation-delay: 0.1s; height: 16px; }
.vc-bar:nth-child(7) { animation-delay: 0.2s; height: 10px; }
.vc-bar:nth-child(8) { animation-delay: 0.05s; height: 6px; }
@keyframes vc-wave {
  0%, 100% { transform: scaleY(0.45); opacity: 0.6; }
  50% { transform: scaleY(1); opacity: 1; }
}
/* Waveform only animates when speaking */
.vc-waveform:not(.vc-waveform--active) .vc-bar { animation: none; transform: scaleY(0.3); opacity: 0.25; }

.vc-auto-toggle {
  display: block;
  padding: 0.35rem 1rem 0;
  font-size: 0.76rem;
  color: #475569;
  user-select: none;
}
.vc-auto-toggle input {
  margin-right: 0.35rem;
  vertical-align: middle;
}
.vc-barge-hint {
  margin: 0.2rem 1rem 0;
  font-size: 0.72rem;
  color: #64748b;
}

.vc-voice-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 1rem 0.1rem;
}
.vc-voice-row label {
  font-size: 0.76rem;
  color: #475569;
  white-space: nowrap;
}
.vc-voice-select {
  width: 100%;
  min-width: 0;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 0.35rem 0.45rem;
  font-size: 0.76rem;
  color: #1e293b;
  background: #fff;
}
.vc-voice-mode {
  width: 100%;
  min-width: 0;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 0.35rem 0.45rem;
  font-size: 0.76rem;
  color: #1e293b;
  background: #fff;
}

.vc-controls {
  display: flex; align-items: center; justify-content: center; gap: 0.75rem;
  padding: 0.75rem 1rem;
}
.vc-mic-btn {
  width: 46px; height: 46px; border-radius: 50%;
  background: #0f766e; color: #fff; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(15,118,110,0.35);
  transition: background 0.12s, transform 0.1s;
}
.vc-mic-btn:hover { background: #0d6560; transform: scale(1.06); }
.vc-mic-btn--active { background: #dc2626 !important; box-shadow: 0 2px 8px rgba(220,38,38,0.4); }
.vc-send-btn {
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: #0f766e;
  background: #f0fdfa;
  border: 1px solid #0f766e;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.vc-send-btn:hover:not(:disabled) { background: #ccfbf1; color: #0d9488; }
.vc-send-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.vc-stop-btn {
  width: 40px; height: 40px; border-radius: 50%;
  background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background 0.12s;
}
.vc-stop-btn:hover:not(:disabled) { background: #fee2e2; color: #dc2626; border-color: #fca5a5; }
.vc-stop-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.vc-disclaimer {
  margin: 0; padding: 0.5rem 1rem;
  font-size: 0.7rem; color: #94a3b8; text-align: center;
  border-top: 1px solid #f1f5f9;
}

@media (max-width: 768px) {
  .vc-wrapper {
    left: 0.5rem;
    right: 0.5rem;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 0.35rem);
    align-items: center;
  }
  .vc-wrapper.vc-wrapper--open {
    bottom: env(safe-area-inset-bottom, 0px);
  }
  .vc-wrapper.vc-wrapper--open .vc-float-btn {
    display: none;
  }
  .vc-panel {
    width: min(520px, calc(100vw - 1rem));
    max-width: calc(100vw - 1rem);
    height: min(760px, calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 0.7rem));
    max-height: calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 0.7rem);
    border-radius: 14px;
  }
  .vc-panel-header {
    padding-top: calc(0.65rem + env(safe-area-inset-top, 0px));
  }
  .vc-controls {
    padding: 0.65rem 0.8rem;
    padding-bottom: calc(0.65rem + env(safe-area-inset-bottom, 0px));
    gap: 0.55rem;
  }
  .vc-send-btn {
    padding: 0.5rem 0.8rem;
    font-size: 0.85rem;
  }
  .vc-barge-hint {
    margin: 0.15rem 0.8rem 0;
  }
}

/* Отчёт — структурированные блоки с заголовками */
.report-single { margin-top: 0; }
.report-doctor-heading {
  font-size: 1.25rem;
  font-weight: 700;
  color: #0f766e;
  margin: 0 0 1rem;
}
.report-doctor {
  white-space: normal;
  word-break: break-word;
  line-height: 1.5;
  color: #1e293b;
}
.report-risk-warning {
  color: #b91c1c;
  font-weight: 700;
}
.report-line { margin: 0.2rem 0; }
.report-bullet { padding-left: 1.1rem; position: relative; }
.report-bullet::before {
  content: "•";
  position: absolute;
  left: 0.2rem;
  color: #334155;
}
.report-empty-line { height: 0.5rem; }
.report-subheading {
  font-weight: 700;
  color: #0f766e;
  margin: 0.8rem 0 0.35rem;
}
.report-table-wrap {
  overflow-x: auto;
  margin: 0.6rem 0 0.85rem;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
}
.report-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
  table-layout: auto;
}
.report-table th, .report-table td {
  border-bottom: 1px solid #e2e8f0;
  padding: 0.55rem 0.65rem;
  text-align: left;
  vertical-align: top;
  font-size: 0.92rem;
  line-height: 1.35;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.report-table th {
  background: #f8fafc;
  color: #0f172a;
  font-weight: 700;
}
.report-table tr:last-child td { border-bottom: none; }
@media (max-width: 1280px) {
  .report-table th, .report-table td {
    font-size: 0.88rem;
    padding: 0.5rem 0.55rem;
  }
}
.report-actions { margin-bottom: 0.75rem; display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.report-actions .btn-download { font-size: 0.95rem; }
.report-actions .btn-download:disabled { cursor: not-allowed; }
.report-section .report-content { padding: 0.5rem 0; }
.report-user-blocks { font-size: 0.95rem; line-height: 1.6; }
.report-block {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid #e2e8f0;
}
.report-block:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}
.report-block-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #0f766e;
  margin: 0 0 0.5rem;
  line-height: 1.3;
}
.report-block-body {
  margin: 0;
  padding: 0;
}
.report-block-body p { margin: 0.35rem 0 0.5rem; }
.report-block-body p:first-child { margin-top: 0; }
.report-label { font-size: 0.9rem; margin-bottom: 0.25rem !important; }
.report-doc-name { font-size: 0.9rem; margin: 0 0 0.5rem; }
.report-extracted-text {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  line-height: 1.5;
  max-height: 12rem;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
  margin-top: 0.25rem;
}
.report-text-truncated { font-size: 0.85rem; margin-top: 0.35rem; }
.report-list { margin: 0.35rem 0 0; padding-left: 1.25rem; }
.report-list li { margin: 0.35rem 0; }
.report-next { margin-top: 0.5rem; font-weight: 500; }
.report-disclaimer { font-size: 0.85rem; margin-top: 0.5rem; }
