/* Скрываем оверлей ошибок компиляции .NET Hot Reload */
#dotnet-compile-error {
    display: none !important;
}

/* Подключение локального шрифта Monitorica (Основной) */
@font-face {
    font-family: 'Monitorica';
    src: url('fonts/Monitorica-Rg.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Monitorica';
    src: url('fonts/Monitorica-Bd.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Monitorica';
    src: url('fonts/Monitorica-It.ttf') format('truetype');
    font-weight: 400;
    font-style: italic;
    font-display: swap;
}
@font-face {
    font-family: 'Monitorica';
    src: url('fonts/Monitorica-BdIt.ttf') format('truetype');
    font-weight: 700;
    font-style: italic;
    font-display: swap;
}

/* Подключение локального шрифта Palui SP — только demo-версия, единственное
   начертание (Bold). Используется вместо Orbitron для заголовков (.chat-title/
   .landing-title — см. правило ниже), не для всего текста. */
@font-face {
    font-family: 'Palui SP';
    src: url('fonts/PaluiSPDemo-Bold.otf') format('opentype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

/* CSS Tokens */
:root {
    --bg0: #070B14;
    --bg1: #0B1630;
    --text: #EAF2FF;
    --muted: rgba(234, 242, 255, 0.72);
    --cyan: #22D3EE;
    --violet: #7C3AED;
    --emerald: #22C55E;

    --glass: rgba(255, 255, 255, 0.06);
    --glass2: rgba(255, 255, 255, 0.09);
    --border: rgba(34, 211, 238, 0.22);
    --shadow: 0 18px 60px rgba(0, 0, 0, 0.55);
    --radius: 18px;
    
    /* Premium Recipe Form Tokens */
    --recipe-bg: var(--bg1);
    --recipe-panel: rgba(255, 255, 255, 0.02);
    --recipe-panel-2: rgba(255, 255, 255, 0.04);
    
    --recipe-text-primary: rgba(234, 242, 255, 0.95);
    --recipe-text-secondary: rgba(234, 242, 255, 0.75);
    --recipe-text-muted: rgba(234, 242, 255, 0.5);
    
    --recipe-border: rgba(255, 255, 255, 0.08);
    --recipe-border-strong: rgba(255, 255, 255, 0.15);
    --recipe-border-focus: rgba(34, 211, 238, 0.4);
    
    --recipe-accent: rgba(34, 211, 238, 0.9);
    --recipe-accent-soft: rgba(34, 211, 238, 0.15);
    --recipe-danger: rgba(239, 68, 68, 0.8);
    --recipe-success: rgba(34, 197, 94, 0.8);
    
    --recipe-radius-panel: 10px;
    --recipe-radius-input: 8px;
    --recipe-radius-button: 8px;
    
    --recipe-shadow-s: 0 2px 8px rgba(0, 0, 0, 0.2);
    --recipe-shadow-m: 0 4px 16px rgba(0, 0, 0, 0.3);
    --recipe-shadow-l: 0 8px 24px rgba(0, 0, 0, 0.4);
    
    --recipe-transition-fast: 120ms ease-out;
    --recipe-transition-base: 180ms ease-out;
    --recipe-transition-slow: 220ms ease-out;
}

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

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

body {
    font-family: 'Monitorica', sans-serif;
    color: var(--text);
    background:
        radial-gradient(1000px 600px at 15% 10%, rgba(34, 211, 238, 0.12), transparent 55%),
        radial-gradient(900px 520px at 85% 30%, rgba(124, 58, 237, 0.10), transparent 60%),
        linear-gradient(180deg, var(--bg1), var(--bg0));
    height: 100dvh;
    padding: 20px 20px 6px;
    position: relative;
    overflow: hidden;
    box-sizing: border-box;
}

/* Исключаем важные заголовки - они остаются с Orbitron. .landing-title
   (начальный экран входа) сознательно НЕ включён в новый Palui SP — только
   .chat-title (внутри приложения: ФИО пациента, "Пациенты" и т.п.), по
   явной правке пользователя. */
.landing-title {
    font-family: 'Orbitron', monospace !important;
}
.chat-title {
    font-family: 'Palui SP', 'Orbitron', monospace !important;
}

/* Subtle noise overlay - increased opacity */
/* Исключаем главный экран (landing page) - там свои стили фона */
body:not(.landing-page)::before {
    content: "";
    position: fixed;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.025'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 1;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.main-content {
    display: flex;
    align-items: stretch; /* Выравниваем дочерние элементы по высоте */
    gap: 20px;
    flex: 1 1 auto;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    position: relative;
}

/* Panel Base Styles */
.panel {
    background: var(--glass);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    overflow: visible;
}

.panel--hud {
    position: relative;
    border: 1px solid var(--border);
}

.panel--hud::before {
    content: "";
    position: absolute;
    inset: -1px;
    border-radius: var(--radius);
    padding: 1px;
    background: linear-gradient(135deg, rgba(34, 211, 238, 0.55), rgba(124, 58, 237, 0.25), rgba(34, 211, 238, 0.15));
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    mask-composite: exclude;
    pointer-events: none;
    z-index: -1;
}

/* HUD Corner Lines */
.panel--hud::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: var(--radius);
    padding: 1px;
    background: 
        linear-gradient(to right, var(--cyan) 0%, transparent 8px),
        linear-gradient(to bottom, var(--cyan) 0%, transparent 8px),
        linear-gradient(to left, var(--cyan) 0%, transparent 8px),
        linear-gradient(to top, var(--cyan) 0%, transparent 8px);
    background-size: 100% 1px, 1px 100%, 100% 1px, 1px 100%;
    background-position: top, right, bottom, left;
    background-repeat: no-repeat;
    opacity: 0.3;
    pointer-events: none;
    z-index: 1;
}

/* HUD Corner Markers - removed box-shadow approach, using separate elements */

/* HUD Corner Markers */
.hud-corner {
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid var(--cyan);
    opacity: 0.22;
    pointer-events: none;
    z-index: 10;
}

.hud-corner-tl {
    top: 12px;
    left: 12px;
    border-right: none;
    border-bottom: none;
}

.hud-corner-tr {
    top: 12px;
    right: 12px;
    border-left: none;
    border-bottom: none;
}

.hud-corner-bl {
    bottom: 12px;
    left: 12px;
    border-right: none;
    border-top: none;
}

.hud-corner-br {
    bottom: 12px;
    right: 12px;
    border-left: none;
    border-top: none;
}

/* Sidebar: Instrument Panel */
.sidebar {
    width: 280px;
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
    height: 100%;
    min-height: 0;
    max-height: 100%;
    overflow: visible;
    /* Выравниваем высоту с content-area */
    align-self: stretch;
    position: relative;
    transition: width 0.3s ease;
}

/* Кнопка сворачивания sidebar - галочка в верхнем углу с неоновым эффектом */
.sidebar-toggle {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: rgba(34, 211, 238, 0.6);
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
    font-size: 18px;
    padding: 0;
    line-height: 1;
    text-shadow: 
        0 0 8px rgba(34, 211, 238, 0.4),
        0 0 12px rgba(34, 211, 238, 0.2);
}

.sidebar-toggle:hover {
    color: rgba(34, 211, 238, 1);
    transform: scale(1.2);
    text-shadow: 
        0 0 12px rgba(34, 211, 238, 0.8),
        0 0 20px rgba(34, 211, 238, 0.5),
        0 0 30px rgba(34, 211, 238, 0.3);
}

.sidebar-toggle-icon {
    transition: transform 0.3s ease;
    display: inline-block;
    font-weight: bold;
}

/* Компактное состояние sidebar */
.sidebar.collapsed {
    width: 60px;
    padding: 24px 8px;
}

/* Полное скрытие sidebar при просмотре модуля */
.sidebar.hidden {
    width: 0 !important;
    min-width: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    opacity: 0;
    visibility: hidden;
    overflow: hidden;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease, visibility 0.3s ease;
    pointer-events: none;
}

/* Убираем gap когда sidebar скрыт */
.main-content:has(.sidebar.hidden) {
    gap: 0;
}

.sidebar.collapsed .sidebar-nav,
.sidebar.collapsed .sidebar-chats,
.sidebar.collapsed .sidebar-footer {
    opacity: 0;
    pointer-events: none;
    overflow: hidden;
    max-height: 0;
    margin: 0;
    padding: 0;
}

.sidebar.collapsed .sidebar-toggle {
    right: auto;
    left: 50%;
    top: 8px;
    transform: translateX(-50%);
    width: 24px;
    height: 24px;
}

.sidebar.collapsed .sidebar-toggle:hover {
    transform: translateX(-50%) scale(1.2);
}

.sidebar.collapsed .sidebar-toggle-icon {
    transform: rotate(180deg);
}

.sidebar-nav,
.sidebar-chats,
.sidebar-footer {
    transition: opacity 0.3s ease, max-height 0.3s ease, margin 0.3s ease, padding 0.3s ease;
}

.sidebar-nav {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow: visible;
    padding-top: 8px; /* Отступ сверху, чтобы кнопка не перекрывала текст */
}

.sidebar-item {
    position: relative;
    width: 100%;
    padding: 14px 16px 14px 20px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 12px;
    color: var(--muted);
    font-family: 'Orbitron', monospace;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s ease;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    min-width: 0;
    overflow: visible;
}

.sidebar-item-indicator {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: transparent;
    transition: all 0.18s ease;
    flex-shrink: 0;
}

.sidebar-item::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 0;
    background: var(--cyan);
    border-radius: 0 2px 2px 0;
    transition: height 0.18s ease;
    opacity: 0;
}

.sidebar-item:hover {
    color: var(--text);
    background: rgba(34, 211, 238, 0.06);
    border-color: rgba(34, 211, 238, 0.15);
}

.sidebar-item:hover .sidebar-item-indicator {
    background: rgba(34, 211, 238, 0.4);
}

.sidebar-item.active {
    color: var(--text);
    background: rgba(34, 211, 238, 0.12);
    border-color: rgba(34, 211, 238, 0.25);
}

.sidebar-item.active::before {
    height: 70%;
    opacity: 1;
}

.sidebar-item.active .sidebar-item-indicator {
    background: var(--cyan);
    box-shadow: 0 0 8px rgba(34, 211, 238, 0.6);
}

.sidebar-item-label {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    flex: 1 1 auto;
    overflow: visible;
}

.sidebar-translate-icon {
    flex-shrink: 0;
}

.sidebar-item-label > span:first-child {
    min-width: 0;
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-translate-icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 999px;
    background: rgba(34, 211, 238, 0.15);
    border: 1px solid rgba(34, 211, 238, 0.3);
    color: rgba(34, 211, 238, 0.8);
    font-family: 'Monitorica', sans-serif;
    font-size: 0.7em;
    font-weight: 600;
    cursor: help;
    transition: all 0.18s ease;
    flex-shrink: 0;
    line-height: 1;
    opacity: 0.7;
    z-index: 5;
    overflow: visible;
}

.sidebar-item:hover .sidebar-translate-icon {
    opacity: 1;
    background: rgba(34, 211, 238, 0.25);
    border-color: rgba(34, 211, 238, 0.5);
    color: var(--cyan);
}

.sidebar-item.active .sidebar-translate-icon {
    opacity: 0.9;
    background: rgba(34, 211, 238, 0.2);
    border-color: rgba(34, 211, 238, 0.4);
}

.sidebar-translate-tooltip {
    position: absolute;
    right: calc(100% + 14px);
    top: 50%;
    transform: translateY(-50%);
    white-space: nowrap;
    background: rgba(8, 12, 20, 0.98);
    border: none;
    color: #EAF2FF;
    padding: 16px 20px;
    border-radius: 16px;
    box-shadow: 0 18px 60px rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(10px);
    z-index: 999999;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.12s ease, visibility 0.12s ease;
    font-size: 1.1em;
    overflow: visible;
}

/* Неоновая рамка через ::before */
.sidebar-translate-tooltip::before {
    content: "";
    position: absolute;
    inset: -3px;
    border-radius: 19px;
    padding: 3px;
    pointer-events: none;
    z-index: -1;
    
    /* Неоновая рамка */
    background:
        radial-gradient(60px 60px at 0% 0%, rgba(34, 211, 238, 1), transparent 50%),
        radial-gradient(60px 60px at 100% 0%, rgba(34, 211, 238, 1), transparent 50%),
        radial-gradient(60px 60px at 0% 100%, rgba(124, 58, 237, 0.9), transparent 50%),
        radial-gradient(60px 60px at 100% 100%, rgba(34, 211, 238, 1), transparent 50%),
        linear-gradient(0deg, rgba(34, 211, 238, 0.95) 0%, rgba(124, 58, 237, 0.85) 50%, rgba(34, 211, 238, 0.95) 100%);
    
    /* Полый центр - только рамка */
    -webkit-mask: 
        linear-gradient(#000 0 0) content-box, 
        linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask: 
        linear-gradient(#000 0 0) content-box, 
        linear-gradient(#000 0 0);
    mask-composite: exclude;
    
    /* Пульсирующее свечение */
    animation: tooltipNeonPulseFrame 4s ease-in-out infinite;
    filter: drop-shadow(0 0 8px rgba(34, 211, 238, 0.5));
}

@keyframes tooltipNeonPulseFrame {
    0%, 100% {
        opacity: 0.7;
        filter: 
            drop-shadow(0 0 4px rgba(34, 211, 238, 0.4))
            drop-shadow(0 0 8px rgba(34, 211, 238, 0.3))
            drop-shadow(0 0 12px rgba(34, 211, 238, 0.2));
        background:
            radial-gradient(60px 60px at 0% 0%, rgba(34, 211, 238, 0.7), transparent 50%),
            radial-gradient(60px 60px at 100% 0%, rgba(34, 211, 238, 0.7), transparent 50%),
            radial-gradient(60px 60px at 0% 100%, rgba(124, 58, 237, 0.6), transparent 50%),
            radial-gradient(60px 60px at 100% 100%, rgba(34, 211, 238, 0.7), transparent 50%),
            linear-gradient(0deg, rgba(34, 211, 238, 0.7) 0%, rgba(124, 58, 237, 0.6) 50%, rgba(34, 211, 238, 0.7) 100%);
    }
    50% {
        opacity: 1;
        filter: 
            drop-shadow(0 0 8px rgba(34, 211, 238, 1))
            drop-shadow(0 0 16px rgba(34, 211, 238, 0.9))
            drop-shadow(0 0 24px rgba(34, 211, 238, 0.8))
            drop-shadow(0 0 32px rgba(34, 211, 238, 0.6))
            drop-shadow(0 0 48px rgba(34, 211, 238, 0.4));
        background:
            radial-gradient(60px 60px at 0% 0%, rgba(34, 211, 238, 1), transparent 50%),
            radial-gradient(60px 60px at 100% 0%, rgba(34, 211, 238, 1), transparent 50%),
            radial-gradient(60px 60px at 0% 100%, rgba(124, 58, 237, 1), transparent 50%),
            radial-gradient(60px 60px at 100% 100%, rgba(34, 211, 238, 1), transparent 50%),
            linear-gradient(0deg, rgba(34, 211, 238, 1) 0%, rgba(124, 58, 237, 0.95) 50%, rgba(34, 211, 238, 1) 100%);
    }
}

@media (prefers-reduced-motion: reduce) {
    .sidebar-translate-tooltip::before {
        animation: none;
    }
}

/* ========================================================================
   PATIENT WORKSPACE V24 — единый полноэкранный слой
   ======================================================================== */

/* Все три главные вкладки занимают реальную ширину окна. */
body:not(.landing-page) { padding: 0 !important; }
body:not(.landing-page) > .container {
    width: 100%; max-width: none; margin: 0;
}
body:not(.landing-page) .main-content { gap: 0; }
.chat-container, .patients-wrapper, .spectacle-lenses-wrapper {
    width: 100% !important; max-width: none !important; margin: 0 !important;
}
#patientsView .patients-wrapper {
    width: 100%; max-width: none; padding: 16px clamp(18px,2.2vw,42px) 20px;
    background: transparent !important;
}
#patientsView .patients-wrapper::before,
#patientsView .patients-wrapper::after { display: none !important; }
#patientsView .patients-substate,
#patientsView .patients-wizard-body,
#patientsView .patients-wizard-steps,
#patientsView .patient-registry-shell,
#patientsView .patients-overview-body {
    width: 100% !important; max-width: none !important;
}
#patientsWizardState[data-wizard-step="1"] .patients-wizard-body {
    max-width: none !important; padding: 0 !important;
}

/* Палитра меняется у ВСЕЙ рабочей вкладки пациентов. */
#patientsView {
    position: relative;
    background:
        radial-gradient(1100px 680px at 7% 2%, rgba(40,190,219,.11), transparent 58%),
        radial-gradient(980px 620px at 92% 12%, rgba(92,74,193,.09), transparent 62%),
        linear-gradient(150deg, #071a30, #071124 52%, #0c102b);
    transition: background-color .7s ease, filter .7s ease;
}
#patientsView[data-workspace-theme="manual"] {
    background:
        radial-gradient(1250px 760px at 8% 4%, rgba(53,213,234,.18), transparent 58%),
        radial-gradient(900px 640px at 88% 18%, rgba(49,113,185,.12), transparent 64%),
        linear-gradient(145deg, #08243a, #07162c 54%, #0a1430);
}
#patientsView[data-workspace-theme="ai"] {
    background:
        radial-gradient(1250px 780px at 12% 5%, rgba(191,156,255,.25), transparent 59%),
        radial-gradient(1000px 690px at 88% 18%, rgba(117,91,226,.23), transparent 62%),
        radial-gradient(700px 460px at 50% 92%, rgba(179,145,255,.09), transparent 68%),
        linear-gradient(145deg, #241d4c, #161739 50%, #12152e);
}
#patientsView > * { position: relative; z-index: 1; }
#patientsView.workspace-theme-shifting::after {
    content: ''; position: absolute; inset: 0; z-index: 30; pointer-events: none;
    background: linear-gradient(105deg, transparent 30%, rgba(236,229,255,.25) 49%, transparent 68%);
    transform: translateX(-105%);
    animation: workspaceThemeSwitch .88s cubic-bezier(.18,1,.3,1) both;
}
@keyframes workspaceThemeSwitch { to { transform: translateX(105%); } }

/* Футуристичный диагностический селектор: световая каретка действительно
   перемещается между режимами, кнопки поверх неё остаются прозрачными. */
#patientsView .diagnostics-mode-switch {
    position: relative; isolation: isolate; overflow: hidden;
    min-height: 118px; padding: 8px; gap: 12px;
    border: 0; border-radius: 30px;
    background:
        linear-gradient(135deg, rgba(12,35,61,.72), rgba(43,34,88,.5));
    box-shadow: inset 0 1px rgba(255,255,255,.07), 0 22px 54px rgba(2,7,27,.22);
}
#patientsView .diagnostics-mode-switch::before {
    content: ''; position: absolute; z-index: 0;
    top: 8px; bottom: 8px; left: 8px; width: calc(50% - 14px);
    border-radius: 24px;
    background:
        radial-gradient(circle at 16% 50%, rgba(239,231,255,.24), transparent 26%),
        linear-gradient(125deg, rgba(199,169,255,.72), rgba(123,99,226,.58));
    box-shadow: inset 0 1px rgba(255,255,255,.25), 0 0 34px rgba(167,132,255,.3);
    transform: translateX(0);
    transition: transform .72s cubic-bezier(.16,1,.3,1), background .55s ease, box-shadow .55s ease;
    animation: modeSelectorPulse 2.8s ease-in-out infinite;
}
#wizardStep3[data-diagnostics-mode="manual"] .diagnostics-mode-switch::before {
    transform: translateX(calc(100% + 12px));
    background:
        radial-gradient(circle at 16% 50%, rgba(221,252,255,.23), transparent 26%),
        linear-gradient(125deg, rgba(92,223,240,.7), rgba(55,126,193,.58));
    box-shadow: inset 0 1px rgba(255,255,255,.22), 0 0 32px rgba(60,195,225,.25);
}
#patientsView .diagnostics-mode-switch::after {
    content: ''; position: absolute; z-index: 0; top: 0; bottom: 0; width: 120px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.14), transparent);
    transform: skewX(-18deg);
    animation: modeSelectorScan 3.4s linear infinite;
}
#patientsView .diagnostics-mode-switch button {
    position: relative; z-index: 1; min-height: 102px;
    background: transparent !important; box-shadow: none !important;
    transition: color .45s ease, transform .45s cubic-bezier(.16,1,.3,1), opacity .45s ease;
}
#patientsView .diagnostics-mode-switch button.is-active { transform: translateY(-2px) scale(1.018); }
#patientsView .diagnostics-mode-switch button:not(.is-active) { opacity: .62; }
#patientsView .diagnostics-mode-switch button.is-active .diagnostics-mode-symbol {
    background: rgba(255,255,255,.13); box-shadow: 0 0 24px rgba(229,218,255,.16);
}
@keyframes modeSelectorPulse {
    0%,100% { filter: brightness(.92); }
    50% { filter: brightness(1.13); }
}
@keyframes modeSelectorScan {
    from { left: -130px; }
    to { left: calc(100% + 130px); }
}

/* Переключатель анамнеза получает тот же живой световой эффект. */
#patientsView .adaptive-anamnesis-modes {
    overflow: hidden;
    box-shadow: inset 0 1px rgba(255,255,255,.08), 0 0 34px rgba(114,89,219,.16);
}
#patientsView .adaptive-mode-slider {
    animation: modeSelectorPulse 2.6s ease-in-out infinite;
}
#patientsView .adaptive-anamnesis-modes::after {
    content: ''; position: absolute; z-index: 2; top: 5px; bottom: 5px; width: 54px;
    pointer-events: none;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.25), transparent);
    transform: skewX(-17deg);
    animation: compactModeScan 2.9s linear infinite;
}
#patientsView .adaptive-mode-btn { z-index: 3; }
@keyframes compactModeScan {
    from { left: -60px; }
    to { left: calc(100% + 60px); }
}

/* Анамнез — один полноэкранный цветовой слой, без панели в панели. */
#patientsWizardState[data-wizard-step="1"],
#wizardStep1,
#wizardStep1 .patient-dialog-screen,
#wizardStep1 .patient-dialog-header,
#wizardStep1 .patient-dialog-body,
#wizardStep1 .anamnesis-console-state,
#wizardStep1 .anamnesis-question-card,
#wizardStep1 .anamnesis-message-bubble {
    border: 0 !important; border-radius: 0 !important;
    background: transparent !important; box-shadow: none !important;
}
#wizardStep1 .patient-dialog-screen {
    width: 100%; max-width: none; min-height: 0;
    grid-template-rows: auto minmax(0,1fr);
}
#wizardStep1 .patient-dialog-screen::before { display: none !important; }
#wizardStep1 .patient-dialog-neon-line { display: none !important; }
#wizardStep1 .patient-dialog-header { padding-right: 0; padding-left: 0; }
#wizardStep1 .patient-dialog-body .anamnesis-console-state,
#wizardStep1 .patient-dialog-body .anamnesis-question-card {
    padding-right: 0 !important; padding-left: 0 !important;
}
#wizardStep1 .patient-dialog-body .anamnesis-message-current .anamnesis-message-bubble {
    padding-right: 12px; padding-left: 12px;
}

/* Завершённый этап: строго центрированная цифровая галочка из двух линий. */
#patientsView .wizard-step.completed .wizard-step-index {
    position: relative; display: grid; place-items: center;
}
#patientsView .wizard-step.completed .wizard-step-index::after {
    content: '' !important; display: block;
    width: 20px; height: 11px; margin: 0;
    border: 0; border-left: 4px solid #58e8ba; border-bottom: 4px solid #58e8ba;
    border-radius: 1px;
    transform: translateY(-2px) rotate(-45deg);
    filter: drop-shadow(0 0 5px rgba(88,232,186,.72));
}

/* Просмотр сохранённого рецепта и результатов — тот же безрамочный язык,
   что и диагностический ввод: LED-метка, линия параметра, крупное число. */
#patientsView .visit-detail-content,
#patientsView .visit-detail-eyes-row,
#patientsView .visit-detail-eye-col,
#patientsView .visit-detail-grid,
#patientsView .visit-detail-stat {
    background: transparent !important; box-shadow: none !important;
}
#patientsView .visit-detail-eye-col {
    gap: 14px; padding: 12px 0 18px;
    border: 0 !important; border-radius: 0 !important;
}
#patientsView .visit-detail-eye-col:first-child,
#patientsView .visit-detail-eye-col:last-child { border-left: 0 !important; }
#patientsView .visit-detail-eye-label,
#patientsView .visit-detail-eye-col:last-child .visit-detail-eye-label {
    display: inline-flex; align-items: center; gap: 10px;
    padding: 0; color: #63e8fb; background: transparent;
    font-family: 'Orbitron', monospace; font-size: 15px; letter-spacing: .14em;
}
#patientsView .visit-detail-eye-col:last-child .visit-detail-eye-label { color: #a785ff; }
#patientsView .visit-detail-eye-label::before {
    content: ''; width: 19px; height: 11px;
    border: 2px solid currentColor; border-radius: 70% 15%;
    transform: rotate(45deg);
    box-shadow: 0 0 10px currentColor;
}
#patientsView .visit-detail-stat {
    position: relative; min-height: 72px; justify-content: center;
    padding: 8px 12px 10px 20px;
    border: 0 !important; border-bottom: 1px solid rgba(92,223,245,.28) !important;
    border-radius: 0 !important;
}
#patientsView .visit-detail-eye-col:last-child .visit-detail-stat {
    border-bottom-color: rgba(151,119,255,.28) !important;
}
#patientsView .visit-detail-stat::before {
    content: ''; position: absolute; top: 16px; left: 2px;
    width: 7px; height: 7px; border-radius: 50%;
    background: #58e6f8; box-shadow: 0 0 10px rgba(88,230,248,.75);
}
#patientsView .visit-detail-eye-col:last-child .visit-detail-stat::before {
    background: #9f7cff; box-shadow: 0 0 10px rgba(159,124,255,.72);
}
#patientsView .visit-detail-stat-label {
    color: rgba(148,215,228,.7); font-size: 12px; letter-spacing: .11em; opacity: 1;
}
#patientsView .visit-detail-stat-value,
#patientsView .visit-detail-stat-value.visit-detail-stat-value-numeric {
    color: #edfaff; font-family: 'Orbitron', monospace; font-size: 20px;
}
#patientsView .visit-detail-pd-row {
    border-top: 0; padding-top: 0;
}
#patientsView .visit-detail-block-title {
    color: #5fe6f8; letter-spacing: .11em;
}

@media (max-width: 760px) {
    body:not(.landing-page) { padding: 0 !important; }
    #patientsView .patients-wrapper { padding: 8px 12px max(10px,env(safe-area-inset-bottom)); }
    #wizardStep1 .patient-dialog-header { padding: 16px 0 12px; }
    #patientsView .diagnostics-mode-switch { grid-template-columns: 1fr; min-height: 204px; }
    #patientsView .diagnostics-mode-switch::before {
        top: 8px; right: 8px; bottom: auto; left: 8px;
        width: auto; height: calc(50% - 14px);
    }
    #wizardStep3[data-diagnostics-mode="manual"] .diagnostics-mode-switch::before {
        transform: translateY(calc(100% + 12px));
    }
    #patientsView .diagnostics-mode-switch button { min-height: 90px; }
    #patientsView .visit-detail-eyes-row { grid-template-columns: 1fr; gap: 18px; }
}

@media (prefers-reduced-motion: reduce) {
    #patientsView.workspace-theme-shifting::after,
    #patientsView .diagnostics-mode-switch::before,
    #patientsView .diagnostics-mode-switch::after,
    #patientsView .adaptive-mode-slider,
    #patientsView .adaptive-anamnesis-modes::after { animation: none !important; }
}

/* Clinical workflow integrity v19: reset, editable steps and structured results. */
#patientsView .anamnesis-reset-button {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    min-height: 48px;
    padding: 7px 14px 7px 8px;
    border: 0;
    border-radius: 16px;
    color: rgba(221, 232, 242, .7);
    background: linear-gradient(135deg, rgba(108, 133, 162, .09), rgba(93, 62, 140, .07));
    font: 600 13px 'Monitorica', sans-serif;
    letter-spacing: .35px;
    cursor: pointer;
    transition: transform .22s ease, color .22s ease, background-color .22s ease, opacity .22s ease;
}

#patientsView .anamnesis-reset-button:hover {
    transform: translateY(-1px);
    color: #ffd0dc;
    background: linear-gradient(135deg, rgba(197, 86, 120, .14), rgba(110, 73, 168, .1));
}

#patientsView .anamnesis-reset-button:disabled { opacity: .35; cursor: default; transform: none; }

#patientsView .anamnesis-reset-button-icon {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 12px;
    color: #df91ad;
    background: rgba(191, 92, 129, .09);
}

#patientsView .anamnesis-reset-button-icon svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

#patientsView .clinical-workflow-stale {
    margin: 0 0 12px;
    padding: 10px 13px;
    border-radius: 13px;
    color: #ffd58a;
    background: rgba(220, 151, 52, .1);
    font-size: 13px;
}

#patientsView .clinical-workflow-action {
    margin: 8px 0 0;
    color: rgba(222, 241, 246, .86);
    font-size: 13px;
    line-height: 1.48;
}

#patientsView .clinical-workflow-skip-reason { margin: 7px 0 0; color: rgba(239, 181, 195, .76); font-size: 12px; }
#patientsView .clinical-workflow-actions { display: flex; align-items: center; gap: 7px; }
#patientsView .clinical-workflow-skip { padding: 9px 11px; border: 0; border-radius: 12px; color: rgba(222, 169, 185, .68); background: rgba(167, 73, 105, .08); cursor: pointer; }
#patientsView .clinical-workflow-skip:hover { color: #ffb6c9; background: rgba(190, 70, 110, .13); }
#patientsView .clinical-workflow-sources { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
#patientsView .clinical-workflow-sources .exam-strategy-source { padding: 5px 8px; border-radius: 9px; background: rgba(66, 177, 203, .08); }
#patientsView .clinical-workflow-stop { margin-top: 14px; padding: 13px 15px; border-radius: 15px; background: rgba(191, 74, 103, .09); }
#patientsView .clinical-workflow-stop > span { color: #ff9eb5; font: 700 11px 'Monitorica', sans-serif; letter-spacing: .7px; text-transform: uppercase; }
#patientsView .clinical-workflow-stop p { margin: 7px 0 0; color: rgba(238, 210, 218, .78); font-size: 13px; line-height: 1.42; }

.clinical-step-action { margin: 0 0 13px; padding: 11px 13px; border-radius: 13px; background: rgba(47, 187, 213, .08); }
.clinical-step-action span { color: #61e1f2; font-size: 10px; letter-spacing: .8px; text-transform: uppercase; }
.clinical-step-action p { margin: 5px 0 0; color: rgba(228, 243, 247, .84); line-height: 1.45; }
.clinical-structured-fields { margin-bottom: 13px; }
.clinical-structured-fields input { width: 100%; min-height: 43px; padding: 9px 11px; border: 0; border-radius: 12px; outline: 1px solid rgba(63, 195, 221, .18); color: #e7f7fa; background: rgba(4, 18, 40, .55); font: 500 15px 'Monitorica', sans-serif; }
.clinical-structured-fields input:focus { outline-color: rgba(73, 222, 244, .58); box-shadow: 0 0 18px rgba(48, 208, 235, .1); }
.clinical-refraction-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.clinical-refraction-fields fieldset { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; margin: 0; padding: 11px; border: 0; border-radius: 14px; background: rgba(55, 111, 148, .07); }
.clinical-refraction-fields legend { padding: 0 5px; color: #68e5f5; font: 700 12px 'Monitorica', sans-serif; }
.clinical-refraction-fields label span { display: block; margin-bottom: 5px; color: rgba(139, 196, 208, .66); font-size: 10px; }

@media (max-width: 900px) {
    #patientsView .anamnesis-reset-button > span:last-child { display: none; }
    #patientsView .anamnesis-reset-button { width: 48px; padding: 7px; }
    #patientsView .clinical-workflow-actions { grid-column: 2; justify-self: start; flex-wrap: wrap; }
    .clinical-refraction-fields { grid-template-columns: 1fr; }
}

/* Clinical workflow: two diagnostic modes and a persistent AI-guided loop. */
.diagnostics-mode-switch {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 18px 0;
    padding: 5px;
    border-radius: 22px;
    background: rgba(6, 19, 39, .38);
}
.diagnostics-mode-switch button {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 76px;
    padding: 12px 16px;
    border: 0;
    border-radius: 18px;
    color: rgba(170, 197, 211, .62);
    background: transparent;
    text-align: left;
    cursor: pointer;
    transition: color .25s ease, background-color .3s ease, transform .3s cubic-bezier(.22,1,.36,1), box-shadow .3s ease;
}
.diagnostics-mode-switch button:hover { transform: translateY(-2px); color: rgba(221, 243, 250, .86); }
.diagnostics-mode-switch button.is-active {
    color: #e8fbff;
    background: linear-gradient(125deg, rgba(35, 190, 218, .19), rgba(102, 75, 205, .13));
    box-shadow: inset 0 1px rgba(255,255,255,.08), 0 10px 30px rgba(15, 164, 196, .08);
}
.diagnostics-mode-symbol {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 46px;
    height: 46px;
    border-radius: 15px;
    color: #5fe6f7;
    background: rgba(38, 186, 212, .1);
    font: 700 15px 'Monitorica', sans-serif;
}
.diagnostics-mode-switch button > span:last-child { display: flex; min-width: 0; flex-direction: column; gap: 3px; }
.diagnostics-mode-switch strong { font: 700 15px 'Monitorica', sans-serif; letter-spacing: .3px; }
.diagnostics-mode-switch small { color: rgba(163, 190, 204, .55); font-size: 12px; line-height: 1.35; }
#examGuidanceSection[data-diagnostics-mode="manual"] .exam-guidance-readiness,
#examGuidanceSection[data-diagnostics-mode="manual"] .diagnostics-guidance-button,
#examGuidanceSection[data-diagnostics-mode="manual"] > .patients-hint,
#examGuidanceSection[data-diagnostics-mode="manual"] > .recipe-form-error,
#examGuidanceSection[data-diagnostics-mode="manual"] > .patients-exam-guidance-result { display: none !important; }

/* Живая находка 2026-08-25 (прямой фидбэк владельца): баннер готовности и кнопка
   "Начать клинический цикл" — приглашение СФОРМИРОВАТЬ план, оставались видны и
   ПОСЛЕ того, как план уже сформирован и показан в панели выше (см. hasPlan в
   renderClinicalWorkflow, app.js) — выглядело как два противоречащих друг другу
   состояния разом. */
#examGuidanceSection[data-has-plan="true"] .exam-guidance-readiness,
#examGuidanceSection[data-has-plan="true"] .diagnostics-guidance-button,
#examGuidanceSection[data-has-plan="true"] > .patients-hint { display: none !important; }

/* Живая находка 2026-08-26 (прямой фидбэк владельца, "это не переход в новый
   интерфейс как в сборе анамнеза"): пока шёл пошаговый подбор,
   #clinicalWorkflowPanel был просто ещё одной секцией на странице — заголовок
   шага, авторефрактометрия и рецепты/линзы оставались видны рядом, хотя не
   имеют отношения к текущему тесту. В анамнезе на экране в это время нет ничего
   постороннего вообще. section.dataset.fieldSequenceActive (renderClinicalWorkflow,
   app.js) прячет остальные секции шага "Диагностика", оставляя только сам
   переключатель режима и чат-панель — настоящий переход экрана, а не довесок. */
.diagnostics-deck:has(#examGuidanceSection[data-field-sequence-active="true"]) > .diagnostics-deck-header,
.diagnostics-deck:has(#examGuidanceSection[data-field-sequence-active="true"]) > #lensOnlyDiagHint,
#examGuidanceSection[data-field-sequence-active="true"] ~ #diagAutorefractionSection,
#examGuidanceSection[data-field-sequence-active="true"] ~ #prescriptionsSection,
#examGuidanceSection[data-field-sequence-active="true"] ~ #lensOrderHiddenHint,
#examGuidanceSection[data-field-sequence-active="true"] > .diagnostics-section-heading { display: none !important; }

.clinical-workflow-panel { margin: 4px 0 16px; }
.clinical-workflow-step.is-preview { grid-template-columns: 44px minmax(0,1fr); }
.clinical-workflow-start-btn { width: 100%; margin-top: 6px; }

/* Живая находка 2026-08-26 (прямой фидбэк владельца): "Рамки не нужны. Безрамочный
   интерфейс. Ввод данных должен выглядеть как в самостоятельном модуле, в том же
   стиле." — откатили чат-стиль анамнеза (аватар + рамка-пузырь + внешняя
   рамка-консоль, см. историю правок выше) для самого ввода теста. Поле теперь —
   обычный .recipe-form-field/.recipe-form-label, тот же класс, что у "SPH"/"CYL" в
   авторефрактометрии ручного режима, без какой-либо рамки вокруг блока. */
.clinical-field-step { margin: 6px 0 0; }
.clinical-field-step-meta {
    margin-bottom: 10px;
    color: rgba(148, 189, 209, .62);
    font-family: 'Monitorica', sans-serif;
    font-size: 11px;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.clinical-field-step-input { max-width: 100%; }
.clinical-field-step-title { margin-bottom: 8px; }

.clinical-field-messages:not(:empty) { margin-bottom: 14px; }
.clinical-field-message {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 6px;
    color: rgba(210, 228, 238, .82);
    font-size: 13px;
    line-height: 1.45;
}
.clinical-field-message p { margin: 0; }
.clinical-field-message-role {
    flex: 0 0 auto;
    color: rgba(103, 224, 246, .75);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.clinical-field-message-ai .clinical-field-message-role { color: rgba(158, 138, 255, .82); }
.clinical-workflow-empty,
.clinical-workflow-manual {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 18px 20px;
    border-radius: 20px;
    background: linear-gradient(115deg, rgba(43, 164, 190, .08), rgba(77, 63, 139, .055));
}
.clinical-workflow-empty strong,
.clinical-workflow-manual strong { color: rgba(229,247,252,.9); font-size: 15px; }
.clinical-workflow-empty p,
.clinical-workflow-manual p { margin: 4px 0 0; color: rgba(167,195,208,.61); font-size: 13px; line-height: 1.5; }
.clinical-workflow-manual > span { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 16px; color: #c5a4ff; background: rgba(120,79,208,.11); font-size: 25px; }
.clinical-workflow-pulse { flex: 0 0 auto; width: 15px; height: 15px; border-radius: 50%; background: #42e0ed; box-shadow: 0 0 0 0 rgba(66,224,237,.4); animation: clinical-workflow-pulse 2s infinite; }
@keyframes clinical-workflow-pulse { 70% { box-shadow: 0 0 0 15px rgba(66,224,237,0); } 100% { box-shadow: 0 0 0 0 rgba(66,224,237,0); } }
.clinical-workflow-hud { display: flex; flex-direction: column; gap: 12px; }
.clinical-workflow-hud > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 18px 20px; border-radius: 20px; background: radial-gradient(circle at 0 50%, rgba(40,210,228,.12), transparent 30%), rgba(15,34,58,.24); }
.clinical-workflow-hud > header span { color: #57dff2; font: 700 11px 'Monitorica', sans-serif; letter-spacing: 1.2px; text-transform: uppercase; }
.clinical-workflow-hud > header h4 { margin: 6px 0 0; color: rgba(234,248,252,.94); font-size: 17px; line-height: 1.45; }
.clinical-workflow-counter { display: flex; flex-direction: column; align-items: center; color: #61e5f5; font: 700 24px 'Monitorica', sans-serif; }
.clinical-workflow-counter small { color: rgba(142,182,198,.5); font-size: 9px; letter-spacing: 1px; text-transform: uppercase; }
.clinical-workflow-hypotheses { display: flex; flex-wrap: wrap; gap: 7px; }
.clinical-workflow-hypotheses span { padding: 7px 10px; border-radius: 12px; color: rgba(203,220,243,.75); background: rgba(102,74,180,.09); font-size: 12px; }
.clinical-workflow-steps { display: flex; flex-direction: column; gap: 8px; }
.clinical-workflow-step { display: grid; grid-template-columns: 44px minmax(0,1fr) auto; align-items: center; gap: 14px; padding: 15px 16px; border-radius: 19px; background: rgba(37, 83, 109, .06); transition: transform .28s ease, background-color .25s ease, opacity .25s ease; }
.clinical-workflow-step:hover { transform: translateX(3px); background-color: rgba(39, 139, 162, .075); }
.clinical-workflow-step.is-now { background: linear-gradient(110deg, rgba(35,199,219,.13), rgba(51,77,128,.055)); }
.clinical-workflow-step.is-optional { opacity: .68; }
.clinical-workflow-step.is-completed { opacity: .62; }
.clinical-workflow-step-index { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 13px; color: #66e5f6; background: rgba(37,184,210,.1); font: 700 12px 'Monitorica', sans-serif; }
.clinical-workflow-step.is-completed .clinical-workflow-step-index { color: #54e5b5; background: rgba(55,205,157,.1); }
.clinical-workflow-step-meta { display: flex; align-items: center; gap: 8px; }
.clinical-workflow-step-meta span { color: rgba(86,219,239,.68); font: 700 10px 'Monitorica', sans-serif; letter-spacing: .8px; text-transform: uppercase; }
.clinical-workflow-step-meta b { padding: 3px 6px; border-radius: 7px; color: #ccb1ff; background: rgba(123,82,210,.11); font: 700 10px 'Monitorica', sans-serif; }
.clinical-workflow-step h5 { margin: 4px 0 0; color: rgba(232,247,251,.92); font-size: 16px; }
.clinical-workflow-context,
.clinical-workflow-trigger,
.clinical-workflow-result { margin: 5px 0 0; color: rgba(172,202,214,.65); font-size: 12px; line-height: 1.45; }
.clinical-workflow-trigger { color: rgba(205,184,246,.65); }
.clinical-workflow-result { color: rgba(110,225,190,.76); }
.clinical-workflow-step details { margin-top: 8px; color: rgba(181,207,217,.65); font-size: 12px; }
.clinical-workflow-step summary { color: #57dff2; cursor: pointer; }
.clinical-workflow-step details p { margin: 6px 0 0; line-height: 1.45; }
.clinical-workflow-open { min-width: 106px; padding: 11px 14px; border: 0; border-radius: 14px; color: #6fe8f7; background: rgba(41,180,205,.1); font: 700 12px 'Monitorica', sans-serif; cursor: pointer; transition: transform .25s ease, background-color .2s ease; }
.clinical-workflow-open:hover:not(:disabled) { transform: translateY(-2px); background: rgba(41,180,205,.17); }
.clinical-workflow-open:disabled { color: rgba(122,177,187,.42); cursor: default; }
.clinical-workflow-decision { padding: 16px 18px; border-radius: 18px; background: rgba(52,157,126,.08); }
.clinical-workflow-decision span { color: #61dfb6; font: 700 11px 'Monitorica', sans-serif; letter-spacing: 1px; text-transform: uppercase; }
.clinical-workflow-decision p { margin: 6px 0 0; color: rgba(208,235,227,.78); font-size: 14px; line-height: 1.5; }

.clinical-step-overlay { position: fixed; inset: 0; z-index: 10060; display: grid; place-items: center; padding: 20px; opacity: 0; transition: opacity .22s ease; }
.clinical-step-overlay.is-visible { opacity: 1; }
.clinical-step-backdrop { position: absolute; inset: 0; background: rgba(1,7,19,.76); backdrop-filter: blur(14px); }
.clinical-step-modal { position: relative; width: min(760px, 94vw); padding: 24px; border-radius: 28px; background: linear-gradient(145deg, rgba(8,27,52,.96), rgba(17,15,47,.96)); box-shadow: 0 30px 90px rgba(0,0,0,.46), 0 0 50px rgba(37,196,220,.08); transform: translateY(20px) scale(.97); transition: transform .38s cubic-bezier(.22,1,.36,1), opacity .22s ease; }
.clinical-step-overlay.is-visible .clinical-step-modal { transform: none; }
.clinical-step-overlay.is-closing { opacity: 0; }
.clinical-step-modal > header { display: flex; align-items: center; gap: 13px; margin-bottom: 17px; }
.clinical-step-eye { display: grid; place-items: center; width: 58px; height: 58px; border-radius: 18px; color: #5de4f5; background: rgba(38,189,214,.11); font: 700 14px 'Monitorica', sans-serif; }
.clinical-step-modal header small { color: rgba(96,219,238,.67); font: 700 10px 'Monitorica', sans-serif; letter-spacing: 1px; text-transform: uppercase; }
.clinical-step-modal h3 { margin: 3px 0 0; color: rgba(235,249,252,.96); font-size: 21px; }
.clinical-step-modal header button { margin-left: auto; width: 42px; height: 42px; border: 0; border-radius: 14px; color: rgba(190,214,224,.7); background: rgba(104,122,151,.08); font-size: 23px; cursor: pointer; }
.clinical-step-context { margin: 0 0 14px; color: rgba(183,207,218,.66); font-size: 13px; }
.clinical-step-question { padding: 14px 16px; margin-bottom: 15px; border-radius: 17px; background: rgba(36,156,182,.075); }
.clinical-step-question span,
.clinical-step-modal label > span { display: block; margin-bottom: 6px; color: #57dff2; font: 700 11px 'Monitorica', sans-serif; letter-spacing: .8px; text-transform: uppercase; }
.clinical-step-question p { margin: 0; color: rgba(218,237,244,.82); font-size: 14px; line-height: 1.5; }
.clinical-step-modal label { display: block; margin-top: 13px; }
.clinical-step-modal textarea { width: 100%; resize: vertical; box-sizing: border-box; padding: 13px 15px; border: 0; border-radius: 16px; outline: none; color: rgba(235,248,252,.92); background: rgba(1,12,30,.4); box-shadow: inset 0 0 0 1px rgba(62,194,216,.16); font: inherit; line-height: 1.45; }
.clinical-step-modal textarea:focus { box-shadow: inset 0 0 0 1px rgba(76,222,242,.55), 0 0 24px rgba(45,196,218,.08); }
.clinical-step-error { min-height: 18px; margin: 6px 0 0; color: #f18da1; font-size: 12px; }
.clinical-step-modal footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.clinical-step-modal footer button { padding: 12px 16px; border: 0; border-radius: 14px; color: rgba(183,210,221,.7); background: rgba(90,112,145,.09); cursor: pointer; }
.clinical-step-modal footer button:last-child { color: #061827; background: linear-gradient(120deg,#43d7e9,#6688eb); font-weight: 700; }

@media (max-width: 720px) {
    .diagnostics-mode-switch { grid-template-columns: 1fr; }
    .clinical-workflow-step { grid-template-columns: 38px minmax(0,1fr); }
    .clinical-workflow-open { grid-column: 2; justify-self: start; }
    .clinical-step-modal footer { flex-direction: column-reverse; }
}

/* ========================================================================
   ANAMNESIS + DIAGNOSTICS V12
   Структурированные формы прокручиваются целиком; диагностика оформлена как
   интерактивная клиническая палуба. Основной ИИ-чат эти правила не затрагивают.
   ======================================================================== */

/* История теперь выглядит как явное действие, а не как непонятная пиктограмма. */
#patientsWizardState[data-wizard-step="1"] .anamnesis-history-button {
    position: relative;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    width: auto;
    min-width: 46px;
    padding: 0 14px 0 6px;
    border-radius: 23px;
}

.anamnesis-history-button-icon {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 1px solid rgba(93, 229, 252, .38);
    border-radius: 50%;
    box-shadow: inset 0 0 14px rgba(55, 218, 247, .08), 0 0 14px rgba(55, 218, 247, .08);
}

.anamnesis-history-button-label {
    font-family: 'Monitorica', sans-serif;
    font-size: 13px;
    white-space: nowrap;
}

/* RX/VA занимают больше высоты, чем обычное сообщение. Вместо обрезания
   прокручивается внутренняя область диалога, шапка пациента остаётся на месте. */
#patientsWizardState[data-wizard-step="1"]:not(.has-inline-anamnesis-composer) .patient-dialog-body {
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-color: rgba(63, 222, 249, .5) rgba(8, 23, 43, .25);
    scrollbar-width: thin;
}

#patientsWizardState[data-wizard-step="1"]:not(.has-inline-anamnesis-composer) .patient-dialog-body .anamnesis-question-card {
    flex: 0 0 auto;
    min-height: max-content;
    padding-bottom: 92px;
    overflow: visible;
}

#patientsWizardState[data-wizard-step="1"]:not(.has-inline-anamnesis-composer) .patient-dialog-body .anamnesis-conversation-feed,
#patientsWizardState[data-wizard-step="1"]:not(.has-inline-anamnesis-composer) .patient-dialog-body .anamnesis-message-current,
#patientsWizardState[data-wizard-step="1"]:not(.has-inline-anamnesis-composer) .patient-dialog-body .anamnesis-message-bubble {
    height: auto;
    overflow: visible;
}

#patientsWizardState[data-wizard-step="1"]:not(.has-inline-anamnesis-composer) .patient-dialog-body .anamnesis-message-current {
    width: 100%;
}

#patientsWizardState[data-wizard-step="1"]:not(.has-inline-anamnesis-composer) .patient-dialog-body .anamnesis-question[data-question-type="rx"],
#patientsWizardState[data-wizard-step="1"]:not(.has-inline-anamnesis-composer) .patient-dialog-body .anamnesis-question[data-question-type="va"] {
    min-width: 0;
    padding-bottom: 4px;
}

/* Диагностическая палуба */
#wizardStep3.active.diagnostics-deck {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-bottom: 28px;
}

#wizardStep3 .diagnostics-deck-header { order: 0; }
#wizardStep3 #lensOnlyDiagHint { order: 1; }
#wizardStep3 #diagAutorefractionSection { order: 2; }
#wizardStep3 #examGuidanceSection { order: 3; }
#wizardStep3 > .recipe-form-section:not(#diagAutorefractionSection):not(#examGuidanceSection) { order: 4; }

.diagnostics-deck-header {
    position: relative;
    isolation: isolate;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
    align-items: center;
    gap: 28px;
    min-height: 184px;
    padding: 30px 38px 32px;
    /* Декоративный фороптер не должен обрезаться прямоугольником шапки. */
    overflow: visible;
    border: 0;
    border-radius: 0;
    background:
        radial-gradient(ellipse at 88% 6%, rgba(113, 77, 231, .14), transparent 50%),
        radial-gradient(ellipse at 18% 50%, rgba(10, 66, 92, .18), transparent 68%);
    box-shadow: none;
    animation: diagnosticsDeckEnter .55s cubic-bezier(.22, 1, .36, 1) both;
}

.diagnostics-deck-header::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    opacity: .1;
    background-image:
        linear-gradient(rgba(68, 216, 243, .12) 1px, transparent 1px),
        linear-gradient(90deg, rgba(68, 216, 243, .12) 1px, transparent 1px);
    background-size: 35px 35px;
    mask-image: linear-gradient(90deg, #000, transparent 72%);
}

.diagnostics-deck-kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: rgba(100, 228, 249, .76);
    font-family: 'Monitorica', sans-serif;
    font-size: 12px;
    letter-spacing: .14em;
    text-transform: uppercase;
}

.diagnostics-deck-kicker i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #4be4c2;
    box-shadow: 0 0 13px #4be4c2;
    animation: diagnosticsStatusPulse 1.8s ease-in-out infinite;
}

.diagnostics-deck-header h2 {
    margin: 9px 0 7px;
    color: rgba(240, 251, 255, .98);
    font-family: 'Monitorica', sans-serif;
    font-size: clamp(27px, 3vw, 40px);
    font-weight: 500;
    line-height: 1.1;
}

.diagnostics-deck-header p {
    max-width: 760px;
    margin: 0;
    color: rgba(181, 214, 226, .72);
    font-family: 'Monitorica', sans-serif;
    font-size: 15px;
    line-height: 1.55;
}

.diagnostics-readiness {
    display: flex;
    align-items: center;
    gap: 13px;
    min-height: 72px;
    padding: 13px 16px;
    border: 1px solid rgba(112, 91, 225, .3);
    border-radius: 20px;
    background: rgba(7, 14, 34, .42);
    transition: border-color .28s ease, box-shadow .28s ease, transform .28s ease;
}

.diagnostics-readiness-orb {
    position: relative;
    display: grid;
    flex: 0 0 42px;
    place-items: center;
    width: 42px;
    height: 42px;
    border: 1px solid rgba(152, 117, 255, .5);
    border-radius: 50%;
    box-shadow: inset 0 0 18px rgba(119, 81, 244, .11), 0 0 20px rgba(119, 81, 244, .1);
}

.diagnostics-readiness-orb::before,
.diagnostics-readiness-orb::after {
    content: '';
    position: absolute;
    border-radius: 50%;
}

.diagnostics-readiness-orb::before { inset: 7px; border: 1px dashed rgba(158, 124, 255, .52); animation: patientOrbStandby 5s linear infinite; }
.diagnostics-readiness-orb::after { width: 7px; height: 7px; background: #9a73ff; box-shadow: 0 0 13px #9a73ff; }
.diagnostics-readiness small,
.diagnostics-readiness strong { display: block; font-family: 'Monitorica', sans-serif; }
.diagnostics-readiness small { margin-bottom: 3px; color: rgba(165, 190, 208, .55); font-size: 10px; letter-spacing: .09em; text-transform: uppercase; }
.diagnostics-readiness strong { color: rgba(217, 229, 241, .82); font-size: 14px; font-weight: 500; line-height: 1.35; }

.diagnostics-readiness[data-state="ready"] {
    border-color: rgba(65, 226, 192, .47);
    box-shadow: 0 0 28px rgba(54, 214, 181, .09);
    transform: translateY(-1px);
}
.diagnostics-readiness[data-state="ready"] .diagnostics-readiness-orb { border-color: rgba(68, 231, 197, .65); box-shadow: inset 0 0 18px rgba(68, 231, 197, .12), 0 0 23px rgba(68, 231, 197, .16); }
.diagnostics-readiness[data-state="ready"] .diagnostics-readiness-orb::before { border-color: rgba(68, 231, 197, .6); }
.diagnostics-readiness[data-state="ready"] .diagnostics-readiness-orb::after { background: #4be4c2; box-shadow: 0 0 14px #4be4c2; }
.diagnostics-readiness[data-state="ready"] strong { color: rgba(187, 247, 234, .94); }

.diagnostics-deck-scan {
    position: absolute;
    right: 5%;
    bottom: 0;
    left: 5%;
    height: 1px;
    background: linear-gradient(90deg, transparent, #49ddf7 35%, #8168f0 70%, transparent);
    box-shadow: 0 0 12px rgba(71, 221, 247, .32);
    opacity: .48;
    animation: diagnosticsScan 4.2s ease-in-out infinite;
}

#wizardStep3 > .recipe-form-section {
    position: relative;
    margin: 0;
    padding: 22px 24px 24px;
    overflow: hidden;
    border: 1px solid rgba(68, 210, 238, .16);
    border-radius: 22px;
    background: linear-gradient(145deg, rgba(8, 23, 45, .67), rgba(5, 13, 29, .42));
    box-shadow: inset 0 1px 0 rgba(142, 235, 253, .035);
    animation: diagnosticsSectionEnter .45s cubic-bezier(.22, 1, .36, 1) both;
}

#wizardStep3 > .recipe-form-section::before {
    content: '';
    position: absolute;
    top: 18px;
    bottom: 18px;
    left: 0;
    width: 2px;
    border-radius: 2px;
    background: linear-gradient(#43def7, rgba(116, 85, 236, .65));
    box-shadow: 0 0 13px rgba(67, 222, 247, .48);
}

#wizardStep3 > .recipe-form-section:nth-of-type(3n) { animation-delay: .04s; }
#wizardStep3 > .recipe-form-section:nth-of-type(3n + 1) { animation-delay: .08s; }
#wizardStep3 > .recipe-form-section:nth-of-type(3n + 2) { animation-delay: .12s; }

#wizardStep3 .recipe-section-title {
    color: rgba(227, 247, 252, .96);
    font-size: 21px;
    letter-spacing: .025em;
}

.diagnostics-section-heading {
    display: flex;
    align-items: flex-start;
    gap: 13px;
    margin-bottom: 13px;
}

.diagnostics-section-heading .recipe-section-title { margin: 0 0 4px; }
.diagnostics-section-heading p { margin: 0; color: rgba(159, 203, 217, .63); font-family: 'Monitorica', sans-serif; font-size: 13px; line-height: 1.45; }
.diagnostics-section-index {
    display: grid;
    flex: 0 0 40px;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 1px solid rgba(74, 224, 250, .45);
    border-radius: 50%;
    color: #72e9fc;
    box-shadow: inset 0 0 17px rgba(48, 211, 240, .08), 0 0 17px rgba(48, 211, 240, .08);
    font-family: 'Orbitron', sans-serif;
    font-size: 10px;
}

.exam-guidance-readiness {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 9px 0 13px;
    padding: 10px 12px;
    border-left: 2px solid #9271ff;
    background: linear-gradient(90deg, rgba(126, 88, 239, .09), transparent 74%);
    color: rgba(211, 213, 237, .78);
    font-family: 'Monitorica', sans-serif;
    font-size: 14px;
    line-height: 1.45;
}

.exam-guidance-readiness-light {
    flex: 0 0 7px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #9b77ff;
    box-shadow: 0 0 12px #9b77ff;
}

.exam-guidance-readiness[data-state="ready"] { border-left-color: #4be4c2; background: linear-gradient(90deg, rgba(61, 221, 187, .08), transparent 74%); color: rgba(194, 239, 228, .86); }
.exam-guidance-readiness[data-state="ready"] .exam-guidance-readiness-light { background: #4be4c2; box-shadow: 0 0 12px #4be4c2; animation: diagnosticsStatusPulse 1.8s ease-in-out infinite; }

#patientsView #wizardStep3 .diagnostics-guidance-button {
    min-width: 250px;
    margin-top: 8px;
    border-color: rgba(77, 225, 250, .54);
    background: linear-gradient(145deg, rgba(20, 66, 93, .48), rgba(33, 31, 91, .42));
    box-shadow: inset 0 0 18px rgba(45, 214, 242, .05), 0 0 24px rgba(45, 214, 242, .08);
    color: rgba(192, 242, 252, .96);
}

#patientsView #wizardStep3 .diagnostics-guidance-button .patient-command-orb { font-size: 9px; }
#patientsView #wizardStep3 .diagnostics-guidance-button:hover {
    border-color: rgba(89, 234, 255, .82);
    color: #e7fbff;
    box-shadow: inset 0 0 20px rgba(45, 214, 242, .08), 0 0 30px rgba(45, 214, 242, .16);
}

#wizardStep3 #examGuidanceError {
    display: block;
    margin-top: 11px;
    color: rgba(255, 151, 168, .94);
    font-family: 'Monitorica', sans-serif;
    font-size: 14px;
    line-height: 1.45;
}

#wizardStep3 .patients-exam-guidance-result {
    margin-top: 17px;
    padding: 18px 20px;
    border: 1px solid rgba(67, 220, 247, .24);
    border-left: 2px solid #48ddf7;
    border-radius: 4px 18px 18px 4px;
    background: linear-gradient(145deg, rgba(9, 29, 53, .74), rgba(8, 14, 33, .56));
    color: rgba(229, 245, 250, .92);
    font-family: 'Monitorica', sans-serif;
    font-size: 15px;
    line-height: 1.7;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity .35s ease, transform .35s ease;
}

#wizardStep3 .patients-exam-guidance-result.is-revealed { opacity: 1; transform: none; }

@keyframes diagnosticsDeckEnter { from { opacity: 0; transform: translateY(12px) scale(.992); } to { opacity: 1; transform: none; } }
@keyframes diagnosticsSectionEnter { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: none; } }
@keyframes diagnosticsScan { 0%, 100% { opacity: .18; transform: translateX(-38%); } 50% { opacity: 1; transform: translateX(38%); } }
@keyframes diagnosticsStatusPulse { 50% { opacity: .45; transform: scale(.78); } }

@media (max-width: 860px) {
    .diagnostics-deck-header { grid-template-columns: 1fr; gap: 18px; padding: 22px 20px; }
    .diagnostics-readiness { width: 100%; }
}

@media (max-width: 720px) {
    #patientsWizardState[data-wizard-step="1"] .anamnesis-history-button { width: 42px; min-width: 42px; padding: 0; border-radius: 50%; }
    .anamnesis-history-button-icon { width: 100%; height: 100%; border: 0; box-shadow: none; }
    .anamnesis-history-button-label { display: none; }
    #patientsWizardState[data-wizard-step="1"]:not(.has-inline-anamnesis-composer) .patient-dialog-body .anamnesis-question-card { padding-bottom: 76px; }
    .diagnostics-deck-header h2 { font-size: 27px; }
    .diagnostics-deck-header p { font-size: 14px; }
    #wizardStep3 > .recipe-form-section { padding: 18px 15px 20px; border-radius: 18px; }
    #wizardStep3 .diagnostics-guidance-button { width: 100%; min-width: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .diagnostics-deck-header,
    #wizardStep3 > .recipe-form-section,
    .diagnostics-deck-scan,
    .diagnostics-deck-kicker i,
    .diagnostics-readiness-orb::before,
    .exam-guidance-readiness-light { animation: none !important; }
}

.sidebar-translate-icon:hover .sidebar-translate-tooltip {
    opacity: 1;
    visibility: visible;
}

.sidebar-translate-tooltip::after {
    content: "";
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    border: 6px solid transparent;
    border-left-color: rgba(34, 211, 238, 0.25);
}

.sidebar-chats {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
}

.btn-new-chat {
    width: 100%;
    padding: 12px 16px;
    background: rgba(34, 211, 238, 0.1);
    border: 1px solid rgba(34, 211, 238, 0.25);
    border-radius: 12px;
    color: var(--cyan);
    font-family: 'Monitorica', sans-serif;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    text-align: left;
}

.btn-new-chat:hover {
    background: rgba(34, 211, 238, 0.15);
    border-color: rgba(34, 211, 238, 0.4);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(34, 211, 238, 0.15);
}

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

.btn-new-chat-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2em;
    font-weight: 300;
    line-height: 1;
}

.chats-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
}

.chat-item {
    position: relative;
    padding: 12px 16px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 10px;
    color: var(--muted);
    font-family: 'Monitorica', sans-serif;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.18s ease;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    overflow: hidden;
}

/* Animation for new chat item */
.chat-item-enter {
    animation: chatItemEnter 0.3s ease-out;
}

@keyframes chatItemEnter {
    0% {
        opacity: 0;
        transform: translateY(-10px) scale(0.95);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.chat-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: var(--text);
}

/* V39 — одна grid-компоновка без смены position.
   Закрыто: строка 4 занимает остаток высоты и держит composer снизу.
   Открыто: строка 4 плавно складывается, composer подходит к сообщению. */
@media (max-width: 720px) {
    #patientsView #patientsWizardState[data-wizard-step="1"]
        .patient-dialog-screen,
    #patientsView #patientsWizardState[data-wizard-step="1"]
        .patient-dialog-screen.has-open-anamnesis-rationale {
        display: flex !important;
        flex-direction: column;
        height: auto !important;
        min-height: calc(100dvh - 72px) !important;
        max-height: none !important;
        overflow: visible !important;
    }

    #patientsView #patientsWizardState[data-wizard-step="1"]
        .patient-dialog-body,
    #patientsView #patientsWizardState[data-wizard-step="1"]
        .patient-dialog-screen.has-open-anamnesis-rationale .patient-dialog-body {
        display: grid !important;
        grid-template-rows: auto auto auto minmax(0, 1fr) auto;
        flex: 1 1 auto;
        align-content: start;
        height: auto !important;
        min-height: 0 !important;
        overflow: visible !important;
        padding-bottom: calc(14px + env(safe-area-inset-bottom)) !important;
        transition: grid-template-rows .44s cubic-bezier(.22, 1, .36, 1);
    }

    #patientsView #patientsWizardState[data-wizard-step="1"]
        .patient-dialog-screen.has-open-anamnesis-rationale .patient-dialog-body {
        grid-template-rows: auto auto auto minmax(0, 0fr) auto;
    }

    #patientsView #patientsWizardState[data-wizard-step="1"]
        .patient-dialog-body .anamnesis-console-state { grid-row: 1; }

    #patientsView #patientsWizardState[data-wizard-step="1"]
        .patient-dialog-body .adaptive-anamnesis-safety { grid-row: 2; }

    #patientsView #patientsWizardState[data-wizard-step="1"]
        .patient-dialog-body .anamnesis-question-card { grid-row: 3; }

    #patientsView #patientsWizardState[data-wizard-step="1"]
        .patient-dialog-body .anamnesis-chat-dock {
        grid-row: 5;
        align-self: end;
    }

    #patientsView #patientsWizardState[data-wizard-step="1"]
        .patient-dialog-body .anamnesis-writing-indicator {
        grid-row: 5;
    }
}

@media (max-width: 720px) and (prefers-reduced-motion: reduce) {
    #patientsView #patientsWizardState[data-wizard-step="1"]
        .patient-dialog-body {
        transition: none !important;
    }
}

/* V189 FINAL — эти правила должны оставаться последними в каскаде. */
#patientsView #diagVaWithSection > .diagnostics-fogging-toggle {
    display: inline-flex !important;
    width: auto !important;
    max-width: 100% !important;
    align-items: center !important;
    margin: 6px 0 16px !important;
}

#patientsView #diagVaWithSection > .diagnostics-fogging-toggle .checkbox-value {
    box-sizing: border-box !important;
    display: inline-flex !important;
    width: auto !important;
    min-width: 230px !important;
    min-height: 46px !important;
    padding: 0 22px !important;
    align-items: center !important;
    justify-content: center !important;
    white-space: nowrap !important;
}

#patientsView .wizard-step.completed .wizard-step-index {
    position: relative !important;
    display: grid !important;
    place-items: center !important;
    padding: 0 !important;
    line-height: 0 !important;
}

#patientsView .wizard-step.completed .wizard-step-index::after {
    box-sizing: border-box !important;
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    width: 21px !important;
    height: 12px !important;
    margin: 0 !important;
    transform: translate(-50%, -62%) rotate(-45deg) !important;
    transform-origin: center !important;
}

@media (max-width: 620px) {
    #patientsView #diagVaWithSection > .diagnostics-fogging-toggle .checkbox-value {
        min-width: 200px !important;
        min-height: 42px !important;
        padding: 0 18px !important;
    }
}

/* V189 — компактный переключатель затуманивания и геометрически
   центрированные цифровые отметки завершённых этапов. */
#patientsView #diagVaWithSection > .diagnostics-fogging-toggle {
    display: inline-flex !important;
    width: auto !important;
    max-width: 100%;
    align-items: center;
    margin: 6px 0 16px !important;
}

#patientsView #diagVaWithSection > .diagnostics-fogging-toggle .checkbox-value {
    box-sizing: border-box;
    display: inline-flex !important;
    width: auto !important;
    min-width: 230px;
    min-height: 46px;
    padding: 0 22px !important;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

#patientsView .wizard-step.completed .wizard-step-index {
    position: relative !important;
    display: grid !important;
    place-items: center !important;
    padding: 0 !important;
    line-height: 0 !important;
}

#patientsView .wizard-step.completed .wizard-step-index::after {
    box-sizing: border-box !important;
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    width: 21px !important;
    height: 12px !important;
    margin: 0 !important;
    transform: translate(-50%, -62%) rotate(-45deg) !important;
    transform-origin: center !important;
}

@media (max-width: 620px) {
    #patientsView #diagVaWithSection > .diagnostics-fogging-toggle .checkbox-value {
        min-width: 200px;
        min-height: 42px;
        padding: 0 18px !important;
    }
}

.chat-item:hover .chat-item-delete {
    opacity: 1;
}

.chat-item.active {
    background: rgba(34, 211, 238, 0.12);
    border-color: rgba(34, 211, 238, 0.25);
    color: var(--text);
}

.chat-item-title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-item-date {
    font-size: 0.9em;
    color: var(--muted);
    opacity: 0.6;
    flex-shrink: 0;
}

.chat-item-delete {
    opacity: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    cursor: pointer;
    transition: all 0.18s ease;
    flex-shrink: 0;
    font-size: 0.9em;
}

.chat-item-delete:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
    color: #ef4444;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* RAG Status */
.rag-status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    font-size: 0.85em;
    color: var(--muted);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #fbbf24;
    animation: breathe 2s ease-in-out infinite;
    box-shadow: 0 0 8px currentColor;
}

.rag-status.ready .status-dot {
    background: var(--emerald);
    color: var(--emerald);
    animation: breathe 2s ease-in-out infinite;
}

.rag-status.error .status-dot {
    background: #ef4444;
    color: #ef4444;
    animation: none;
}

@keyframes breathe {
    0%, 100% {
        opacity: 0.4;
        transform: scale(1);
}
    50% {
        opacity: 1;
        transform: scale(1.1);
    }
}

/* Content Area */
.content-area {
    flex: 1 1 auto;
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
    min-height: 0;
    height: 100%;
    max-height: 100%;
    overflow: hidden;
    position: relative;
    /* Выравниваем высоту с sidebar - используем одинаковую высоту */
    align-self: stretch;
    /* Предотвращаем изменение размеров при изменении содержимого */
    contain: layout size style;
}

.view {
    grid-column: 1;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 100%;
    max-height: 100%;
    width: 100%;
    overflow: hidden;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    /* Фиксируем размер - обе вкладки занимают одинаковое пространство */
    box-sizing: border-box;
    /* Предотвращаем изменение размеров при изменении содержимого */
    contain: layout size style;
}

.view.active {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    z-index: 1;
}

/* Chat Container */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: 100%;
    min-height: 0;
    padding: 24px;
    padding-bottom: 0;
    gap: 0; /* Убираем gap между элементами */
    overflow: hidden;
    box-sizing: border-box;
    /* Фиксируем размер - контейнер не должен меняться при изменении содержимого */
    position: relative;
    /* Предотвращаем изменение размеров при изменении содержимого */
    contain: layout size style;
}

/* Анимации при переключении с обучающего блока на ИИ-помощника */
.chat-container.view-transitioning {
    opacity: 0;
    transform: translateY(20px) scale(0.98);
    animation: chatContainerViewFadeIn 1s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

@keyframes chatContainerViewFadeIn {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.98);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.chat-header.view-transitioning {
    opacity: 0;
    transform: translateY(-10px);
    animation: chatHeaderViewFadeIn 0.9s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.2s forwards;
}

@keyframes chatHeaderViewFadeIn {
    0% {
        opacity: 0;
        transform: translateY(-10px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-messages.view-transitioning {
    opacity: 0;
    animation: chatMessagesViewFadeIn 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.4s forwards;
}

@keyframes chatMessagesViewFadeIn {
    0% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}

.chat-input-wrapper.view-transitioning {
    opacity: 0;
    transform: translateY(20px);
    animation: chatInputWrapperViewFadeIn 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.5s forwards;
}

@keyframes chatInputWrapperViewFadeIn {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Отключение анимаций для пользователей с prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
    .chat-container.view-transitioning,
    .chat-header.view-transitioning,
    .chat-messages.view-transitioning,
    .chat-input-wrapper.view-transitioning {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }
    /* Бегущая строка заголовков — при reduced-motion просто показываем
       статичный текст (первую копию), остальные (дубликаты для зацикливания
       с несколькими копиями — см. setupTitleMarquee в app.js) прячем */
    .chat-title-marquee {
        animation: none !important;
        transform: none !important;
    }
    .chat-title-marquee-text:not(:first-child) {
        display: none;
    }
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    gap: 16px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.chat-header-main {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.chat-title-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.chat-title {
    font-family: 'Palui SP', 'Orbitron', monospace;
    font-size: 1.3em;
    font-weight: 600;
    color: rgba(34, 211, 238, 0.9);
    margin: 0;
    line-height: 1.2;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    text-shadow:
        0 0 12px rgba(34, 211, 238, 0.4),
        0 0 24px rgba(34, 211, 238, 0.2);
    animation: flicker 3s infinite;
    position: relative;
    /* Табло-эффект (см. .chat-title-marquee* ниже): сам заголовок — просто
       окно с overflow:hidden, бежит внутренний трек, а не он сам. */
    overflow: hidden;
    display: block;
    max-width: 100%;
}

/* "Бегущая строка" как на табло в аэропорту — содержимое .chat-title
   оборачивается в эту структуру через JS (см. setupTitleMarquee/
   setMarqueeTitleText в app.js): N одинаковых копий текста подряд (N считает
   JS — см. MIN_MARQUEE_COPIES/расчёт по ширине контейнера, на широком
   десктопном заголовке с коротким текстом одной-двух копий мало, экран
   пустеет между появлениями; N подбирается так, чтобы в любой момент на
   экране было видно хотя бы одну, а обычно уже началась следующая — "одна
   уходит, вторая идёт, третья начинается"). Трек едет на -100%/N (= ровно
   ширина одной копии с отступом), зацикливаясь бесшовно на 0%. Скорость — от
   длины текста (--marquee-duration, ставится в JS по факту ширины), чтобы
   короткие и длинные заголовки бежали с одной и той же визуальной скоростью,
   а не с одной длительностью на всех. */
.chat-title-marquee {
    display: flex;
    width: max-content;
    animation: chatTitleMarquee var(--marquee-duration, 14s) linear infinite;
}

.chat-title-marquee-text {
    white-space: nowrap;
    padding-right: 64px;
}

@keyframes chatTitleMarquee {
    from { transform: translateX(0); }
    to { transform: translateX(var(--marquee-shift, -50%)); }
}

/* Короткая мобильная версия названия (см. .chat-title-full рядом в разметке
   app.html) — раньше подменяла полное название на телефоне, теперь скрыта
   всегда: и на десктопе, и на мобильном показывается полное название (см.
   комментарий в @media(max-width:768px) в этом файле, у .chat-subtitle рядом
   с местом, где раньше был обратный переключатель). Разметку и класс не
   убираем — вдруг понадобится вернуть короткий вариант отдельно. */
.chat-title-short {
    display: none;
}

@keyframes flicker {
    0%, 100% {
        opacity: 1;
        text-shadow: 
            0 0 12px rgba(34, 211, 238, 0.4),
            0 0 24px rgba(34, 211, 238, 0.2);
    }
    2% {
        opacity: 0.85;
        text-shadow: 
            0 0 8px rgba(34, 211, 238, 0.3),
            0 0 16px rgba(34, 211, 238, 0.15);
    }
    4% {
        opacity: 1;
        text-shadow: 
            0 0 14px rgba(34, 211, 238, 0.5),
            0 0 28px rgba(34, 211, 238, 0.25);
    }
    6% {
        opacity: 0.9;
        text-shadow: 
            0 0 10px rgba(34, 211, 238, 0.35),
            0 0 20px rgba(34, 211, 238, 0.18);
    }
    8% {
        opacity: 1;
        text-shadow: 
            0 0 12px rgba(34, 211, 238, 0.4),
            0 0 24px rgba(34, 211, 238, 0.2);
    }
    45% {
        opacity: 1;
        text-shadow: 
            0 0 12px rgba(34, 211, 238, 0.4),
            0 0 24px rgba(34, 211, 238, 0.2);
    }
    46% {
        opacity: 0.88;
        text-shadow: 
            0 0 6px rgba(34, 211, 238, 0.25),
            0 0 12px rgba(34, 211, 238, 0.12);
    }
    48% {
        opacity: 1;
        text-shadow: 
            0 0 16px rgba(34, 211, 238, 0.6),
            0 0 32px rgba(34, 211, 238, 0.3);
    }
    50% {
        opacity: 0.92;
        text-shadow: 
            0 0 10px rgba(34, 211, 238, 0.4),
            0 0 20px rgba(34, 211, 238, 0.2);
    }
    52% {
        opacity: 1;
        text-shadow: 
            0 0 12px rgba(34, 211, 238, 0.4),
            0 0 24px rgba(34, 211, 238, 0.2);
    }
}

.chat-subtitle {
    font-family: 'Monitorica', sans-serif !important;
    font-size: 1.1em !important;
    font-weight: 500;
    color: rgba(34, 211, 238, 0.75);
    margin: 0;
    margin-top: 4px;
    letter-spacing: 1px;
    text-transform: uppercase;
    text-shadow: 0 0 6px rgba(34, 211, 238, 0.3);
    opacity: 0.9;
}

/* RAG Status Top */
.rag-status-top {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    font-size: 0.85em;
    color: var(--muted);
    cursor: pointer;
    position: relative;
    transition: all 0.18s ease;
}

.rag-status-top:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(34, 211, 238, 0.2);
}

.rag-status-top.ready {
    border-color: rgba(34, 197, 94, 0.3);
}

.rag-status-top.ready:hover {
    border-color: rgba(34, 197, 94, 0.4);
}

.rag-status-top .status-text {
    display: flex;
    align-items: center;
    gap: 6px;
}

.rag-status-top .status-online {
    color: var(--emerald);
    font-weight: 500;
}

.rag-status-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: rgba(7, 11, 20, 0.95);
    border: 1px solid rgba(34, 211, 238, 0.3);
    border-radius: 10px;
    padding: 12px 16px;
    min-width: 200px;
    font-size: 0.8em;
    color: var(--muted);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    display: none;
    z-index: 100;
}

.rag-status-top:hover .rag-status-dropdown {
    display: block;
}

.rag-status-dropdown-item {
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
}

.rag-status-dropdown-item:last-child {
    margin-bottom: 0;
}

.rag-status-dropdown-label {
    color: var(--muted);
}

.rag-status-dropdown-value {
    color: var(--text);
    font-weight: 500;
}

.rag-status-top .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #fbbf24;
    animation: breathe 2s ease-in-out infinite;
    box-shadow: 0 0 8px currentColor;
    flex-shrink: 0;
}

.rag-status-top.ready {
    border-color: rgba(34, 197, 94, 0.3);
}

.rag-status-top.ready .status-dot {
    background: var(--emerald);
    color: var(--emerald);
    animation: breathe 2s ease-in-out infinite;
}

.rag-status-top.error {
    border-color: rgba(239, 68, 68, 0.3);
}

.rag-status-top.error .status-dot {
    background: #ef4444;
    color: #ef4444;
    animation: none;
}

/* Chat Messages - отдельное окно, не привязанное к основному квадрату */
.chat-messages {
    flex: 1 1 0;
    min-height: 0;
    max-height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px;
    padding-bottom: 16px; /* Сохраняем нижний padding для контента */
    margin-bottom: 0; /* Убираем отступ снизу */
    background: 
        repeating-linear-gradient(45deg, transparent, transparent 2px, rgba(34, 211, 238, 0.02) 2px, rgba(34, 211, 238, 0.02) 4px),
        radial-gradient(circle at 20% 30%, rgba(34, 211, 238, 0.03), transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(124, 58, 237, 0.02), transparent 50%),
        rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: relative;
    animation: backgroundShift 25s ease-in-out infinite;
    scroll-behavior: smooth;
}

/* Chat Input Wrapper */
.chat-input-wrapper {
    flex: 0 0 auto;
    display: flex;
    gap: 12px;
    align-items: flex-end;
    padding: 0;
    margin-bottom: 0 !important;
}

/* Watermark Surface - Base */
.chat-surface {
    position: relative;
    overflow: hidden;
}

.chat-surface::before,
.chat-surface::after {
    content: "";
    position: absolute;
    pointer-events: none;
    z-index: 0;
    transition: opacity 0.3s ease;
    display: block;
}

/* Watermark States - Default to empty state if no class */
.chat-surface::before,
.chat-surface::after {
    opacity: 0.2; /* Default to empty state visibility - increased for visibility */
}

.chat-surface.state-empty::before,
.chat-surface.state-empty::after {
    opacity: 0.2;
}

.chat-surface.state-active::before,
.chat-surface.state-active::after {
    opacity: 0.1;
}

/* Main Watermark - Phoropter (right center) */
.chat-surface::before {
    display: none;
}

/* Secondary Watermark - Slit Lamp (left bottom) */
.chat-surface::after {
    display: none;
}

/* Ensure content is above watermarks */
.chat-surface > * {
    position: relative;
    z-index: 1;
}

/* Responsive Watermarks */
@media (max-width: 1024px) {
    .chat-surface::before {
        width: 200px;
        height: 260px;
        top: 5%;
        right: 2%;
    }
    
    .chat-surface::after {
        width: 150px;
        height: 135px;
        bottom: 5%;
        left: 2%;
    }
}

@media (max-width: 768px) {
    .chat-surface::before,
    .chat-surface::after {
        opacity: 0 !important;
    }
}

@keyframes backgroundShift {
    0%, 100% {
        background: 
            repeating-linear-gradient(45deg, transparent, transparent 2px, rgba(34, 211, 238, 0.02) 2px, rgba(34, 211, 238, 0.02) 4px),
            radial-gradient(circle at 20% 30%, rgba(34, 211, 238, 0.03), transparent 50%),
            radial-gradient(circle at 80% 70%, rgba(124, 58, 237, 0.02), transparent 50%),
            rgba(0, 0, 0, 0.2);
    }
    50% {
        background: 
            repeating-linear-gradient(45deg, transparent, transparent 2px, rgba(34, 211, 238, 0.02) 2px, rgba(34, 211, 238, 0.02) 4px),
            radial-gradient(circle at 30% 40%, rgba(34, 211, 238, 0.04), transparent 50%),
            radial-gradient(circle at 70% 60%, rgba(124, 58, 237, 0.03), transparent 50%),
            rgba(0, 0, 0, 0.2);
    }
}

/* Empty State */
.empty-state {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: 40px 20px;
    text-align: center;
    min-height: 300px;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
    z-index: 1 !important;
}

.empty-state.hidden {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

/* CRITICAL: Ensure emptyState is visible when not hidden */
.empty-state:not(.hidden) {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* CRITICAL: Ensure emptyState is visible in chatMessages */
#chatMessages .empty-state:not(.hidden) {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Main title for chat dialog */
.chat-main-title {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    width: 100%;
}

.chat-main-title h2 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.3em;
    font-weight: 600;
    color: var(--text);
    margin: 0;
    opacity: 1;
}

.empty-state-main-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.3em;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 24px;
    text-align: center;
    opacity: 1;
}

.empty-state-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.1em;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
    opacity: 0.9;
}

/* Короткая мобильная версия пустого экрана чата — скрыта по умолчанию,
   показывается вместо .empty-state-title и остального (см. @media в этом
   файле) только на телефоне */
.empty-state-title-mobile {
    display: none;
}

.empty-state-subtitle {
    font-family: 'Monitorica', sans-serif;
    font-size: 0.935em;
    color: var(--muted);
    margin-bottom: 24px;
    opacity: 0.7;
}

.empty-state-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    max-width: 800px;
    margin-bottom: 24px;
}

.empty-state-extended {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    max-width: 800px;
    margin-bottom: 20px;
    animation: fadeIn 0.3s ease;
}

.empty-state-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.empty-state-description {
    font-family: 'Monitorica', sans-serif;
    font-size: 0.935em;
    color: var(--muted);
    text-align: center;
    opacity: 0.8;
}

.show-more-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(34, 211, 238, 0.25);
    border-radius: 999px;
    color: var(--muted);
    font-family: 'Monitorica', sans-serif;
    font-size: 0.935em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.18s ease;
}

.show-more-btn:hover {
    background: rgba(34, 211, 238, 0.1);
    border-color: rgba(34, 211, 238, 0.4);
    color: var(--text);
    transform: translateY(-1px);
}

.show-more-icon {
    font-size: 1.1em;
    font-weight: 600;
    line-height: 1;
}

.show-more-text {
    line-height: 1;
}

.show-more-btn.expanded .show-more-icon {
    transform: rotate(45deg);
}

.suggestion-chip {
    padding: 11px 20px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(34, 211, 238, 0.3);
    border-radius: 999px;
    color: var(--muted);
    font-family: 'Monitorica', sans-serif;
    font-size: 1.05em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.18s ease;
    white-space: nowrap;
}

.suggestion-chip:hover {
    background: rgba(34, 211, 238, 0.1);
    border-color: rgba(34, 211, 238, 0.45);
    color: var(--text);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(34, 211, 238, 0.12), 0 0 10px rgba(34, 211, 238, 0.06);
}

.message {
    padding: 16px 20px;
    border-radius: 14px;
    max-width: 75%;
    animation: fadeIn 0.3s ease;
    word-wrap: break-word;
    line-height: 1.7;
    font-size: 1.2em; /* Крупный размер шрифта для лучшей читаемости в чате */
}

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

.message.user {
    background: rgba(34, 211, 238, 0.15);
    border: 1px solid rgba(34, 211, 238, 0.3);
    color: var(--text);
    margin-left: auto;
    text-align: right;
    box-shadow: 0 4px 12px rgba(34, 211, 238, 0.1);
}

.message.assistant {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text);
    white-space: pre-wrap;
    position: relative;
}

/* Живая находка 2026-08-23 (фидбэк владельца): блок "Источники:" — это подпись/сноска, а не
   продолжение разговорной речи, поэтому нарочно другой, более сдержанный стиль — меньше кегль,
   приглушённый цвет, курсив и лёгкий верхний разделитель, чтобы визуально отделить от основного
   ответа — без номеров-сносок [1]/[2] внутри текста (см. app.js/addMessage и
   CitationDisplayFormatter.FormatSources — маркер "Источники:" общий для обоих).
   ВАЖНО: первая версия использовала 'Orbitron' (как .sidebar-item выше) — но Orbitron не
   содержит кириллицу вообще, поэтому в одной и той же строке типа «Optometrist's Desk Book»
   (раздел «Оптометрия»)» латиница рисовалась настоящим Orbitron, а кириллица тихо проваливалась
   на дефолтный системный шрифт — разнобой шрифтов внутри одной подписи, живая находка при
   визуальной проверке владельцем. 'Monitorica' — тот же шрифт, что и весь остальной текст в
   приложении, с гарантированной кириллицей (у него уже есть отдельный italic-файл,
   Monitorica-It.ttf) — различие с основным текстом теперь только в кегле/цвете/курсиве, не в
   наборе символов. */
.message-sources {
    margin-top: 14px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    gap: 3px;
}

/* Живая находка 2026-08-23 (фидбэк владельца, со скриншотом-образцом): подпись "Источники"
   должна выглядеть как фирменные HUD-надписи сайта (ср. .chat-subtitle и
   .empty-state-title-mobile выше) — Monitorica, капс, разрядка, неоновое голубое свечение — а
   не просто мелкий серый текст. Значения (цвет/text-shadow) намеренно те же, что у
   .chat-subtitle — тот же акцент, что уже используется по всему сайту для таких надписей, не
   новый цвет от себя. */
.message-sources-label {
    font-family: 'Monitorica', sans-serif;
    font-size: 0.72em;
    font-weight: 500;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: rgba(34, 211, 238, 0.75);
    text-shadow: 0 0 6px rgba(34, 211, 238, 0.3);
    opacity: 0.9;
    margin-bottom: 4px;
}

.message-sources-item {
    font-family: 'Monitorica', sans-serif;
    font-size: 0.82em;
    font-style: italic;
    line-height: 1.5;
    color: var(--muted);
    opacity: 0.85;
}

.message-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.message-action-btn {
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(34, 211, 238, 0.2);
    border-radius: 8px;
    color: var(--muted);
    font-family: 'Monitorica', sans-serif;
    font-size: 0.85em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.18s ease;
}

.message-action-btn:hover {
    background: rgba(34, 211, 238, 0.1);
    border-color: rgba(34, 211, 238, 0.3);
    color: var(--text);
}

.message.loading {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(34, 211, 238, 0.15);
}

.message.loading::after {
    content: "●";
    display: inline-block;
    animation: thinking 1.4s ease-in-out infinite;
    margin-left: 8px;
    color: var(--cyan);
}

@keyframes thinking {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

/* Chat Input Wrapper */
.chat-input-wrapper {
    flex: 0 0 auto;
    display: flex;
    gap: 12px;
    align-items: flex-end;
    padding: 0;
    margin-bottom: 0 !important;
}

/* Input Bar - Flex Container */
.input-bar {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 12px;
    border-radius: 14px;
    border: 1px solid rgba(34, 211, 238, 0.25);
    background: rgba(255, 255, 255, 0.08);
    transition: all 0.18s ease;
    box-sizing: border-box;
    height: calc(14px * 2 + 1em * 1.2 + 2px); /* padding-top + padding-bottom + line-height + border - точно такая же высота как у кнопки */
    min-height: calc(14px * 2 + 1em * 1.2 + 2px);
    max-height: calc(14px * 2 + 1em * 1.2 + 2px);
}

.input-bar:focus-within {
    border-color: rgba(34, 211, 238, 0.5);
    background: rgba(255, 255, 255, 0.12);
    box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.15), 0 4px 12px rgba(34, 211, 238, 0.1);
}

/* Mode Segment */
.mode-seg {
    flex: 0 0 auto;
    display: flex;
    gap: 0;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(34, 211, 238, 0.2);
    border-radius: 8px;
    padding: 2px;
    overflow: hidden;
}

.mode-help-wrapper {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 6px;
    position: relative;
}

.mode-hint {
    font-size: 0.85em;
    color: rgba(234, 242, 255, 0.65);
    font-family: 'Monitorica', sans-serif;
    white-space: nowrap;
    line-height: 1;
}

.mode-help-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(34, 211, 238, 0.15);
    border: 1px solid rgba(34, 211, 238, 0.3);
    color: rgba(34, 211, 238, 0.9);
    font-family: 'Monitorica', sans-serif;
    font-size: 0.75em;
    font-weight: 600;
    cursor: help;
    transition: all 0.18s ease;
    flex-shrink: 0;
    line-height: 1;
}

.mode-help-icon:hover {
    background: rgba(34, 211, 238, 0.25);
    border-color: rgba(34, 211, 238, 0.5);
    color: var(--cyan);
    box-shadow: 0 0 8px rgba(34, 211, 238, 0.3);
}

.mode-help-tooltip {
    position: absolute;
    bottom: calc(100% + 12px);
    left: 0;
    background: rgba(7, 11, 20, 0.98);
    border: 1px solid rgba(34, 211, 238, 0.3);
    border-radius: 12px;
    padding: 16px;
    min-width: 280px;
    max-width: 320px;
    font-size: 0.935em;
    color: var(--text);
    font-family: 'Monitorica', sans-serif;
    line-height: 1.6;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    display: none;
    z-index: 1000;
    pointer-events: none;
}

.mode-help-icon:hover + .mode-help-tooltip,
.mode-help-wrapper:hover .mode-help-tooltip {
    display: block;
}

.tooltip-section {
    margin-bottom: 12px;
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.tooltip-section:last-child {
    margin-bottom: 0;
}

.tooltip-icon-wrap {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

.tooltip-icon-wrap .tooltip-icon {
    width: 20px;
    height: 20px;
    color: var(--cyan);
    display: block;
    filter: drop-shadow(0 0 4px rgba(34, 211, 238, 0.5));
}

.tooltip-section strong {
    color: var(--cyan);
    font-weight: 600;
    margin-bottom: 2px;
}

.tooltip-section .tooltip-text {
    flex: 1;
    min-width: 0;
}

.mode-tab {
    padding: 4px 10px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--muted);
    font-family: 'Monitorica', sans-serif;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
}

.mode-tab:hover {
    color: var(--text);
}

.mode-tab.active {
    background: rgba(34, 211, 238, 0.2);
    color: var(--cyan);
    box-shadow: 0 0 8px rgba(34, 211, 238, 0.15);
}

/* Reply Length Segment (Коротко / Развёрнуто) */
.reply-length-seg {
    flex: 0 0 auto;
    display: flex;
    gap: 0;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(34, 211, 238, 0.2);
    border-radius: 8px;
    padding: 2px;
    overflow: hidden;
}

.reply-length-tab {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: rgba(234, 242, 255, 0.5);
    cursor: pointer;
    transition: all 0.22s ease;
}

.reply-length-tab .reply-length-icon {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    display: block;
    filter: drop-shadow(1px 0 0 rgba(0, 0, 0, 0.95))
            drop-shadow(-1px 0 0 rgba(0, 0, 0, 0.95))
            drop-shadow(0 1px 0 rgba(0, 0, 0, 0.95))
            drop-shadow(0 -1px 0 rgba(0, 0, 0, 0.95))
            drop-shadow(0 0 1px rgba(0, 0, 0, 0.8))
            drop-shadow(0 0 4px rgba(34, 211, 238, 0.2));
    transition: all 0.22s ease;
}

.reply-length-tab:hover {
    color: rgba(234, 242, 255, 0.85);
}

.reply-length-tab:hover .reply-length-icon {
    filter: drop-shadow(1px 0 0 rgba(0, 0, 0, 0.95))
            drop-shadow(-1px 0 0 rgba(0, 0, 0, 0.95))
            drop-shadow(0 1px 0 rgba(0, 0, 0, 0.95))
            drop-shadow(0 -1px 0 rgba(0, 0, 0, 0.95))
            drop-shadow(0 0 1px rgba(0, 0, 0, 0.8))
            drop-shadow(0 0 6px rgba(34, 211, 238, 0.4));
}

.reply-length-tab.active {
    background: linear-gradient(135deg, rgba(34, 211, 238, 0.12), rgba(124, 58, 237, 0.08));
    color: var(--cyan);
    box-shadow: 0 0 12px rgba(34, 211, 238, 0.25),
                0 0 4px rgba(124, 58, 237, 0.15),
                inset 0 0 14px rgba(34, 211, 238, 0.06);
}

.reply-length-tab.active .reply-length-icon {
    filter: drop-shadow(1px 0 0 rgba(0, 0, 0, 0.95))
            drop-shadow(-1px 0 0 rgba(0, 0, 0, 0.95))
            drop-shadow(0 1px 0 rgba(0, 0, 0, 0.95))
            drop-shadow(0 -1px 0 rgba(0, 0, 0, 0.95))
            drop-shadow(0 0 1px rgba(0, 0, 0, 0.8))
            drop-shadow(0 0 8px rgba(34, 211, 238, 0.75))
            drop-shadow(0 0 16px rgba(34, 211, 238, 0.4))
            drop-shadow(0 0 4px rgba(124, 58, 237, 0.25));
}

/* Chat Input */
.chat-input {
    flex: 1 1 auto;
    min-width: 0;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text);
    font-family: 'Monitorica', sans-serif;
    font-size: 1.15em;
    padding: 0;
}

.chat-input::placeholder {
    color: var(--muted);
}

/* Input Hint */
.input-hint {
    flex: 0 0 auto;
    font-size: 0.75em;
    color: rgba(234, 242, 255, 0.7);
    font-family: 'Monitorica', sans-serif;
    white-space: nowrap;
    pointer-events: none;
}

/* Buttons */
.btn {
    padding: 14px 24px;
    background: linear-gradient(135deg, rgba(34, 211, 238, 0.15), rgba(124, 58, 237, 0.12));
    border: 1px solid rgba(34, 211, 238, 0.3);
    color: var(--text);
    border-radius: 14px;
    font-family: 'Monitorica', sans-serif;
    font-size: 0.95em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.18s ease;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
    height: calc(14px * 2 + 1em * 1.2 + 2px); /* padding-top + padding-bottom + line-height + border */
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(34, 211, 238, 0.25), rgba(124, 58, 237, 0.18));
    opacity: 0;
    transition: opacity 0.18s ease;
}

.btn:hover:not(:disabled) {
    background: linear-gradient(135deg, rgba(34, 211, 238, 0.25), rgba(124, 58, 237, 0.18));
    border-color: rgba(34, 211, 238, 0.5);
    box-shadow: 
        0 0 0 1px rgba(34, 211, 238, 0.3),
        0 8px 24px rgba(34, 211, 238, 0.2),
        0 0 24px rgba(34, 211, 238, 0.15),
        0 0 32px rgba(124, 58, 237, 0.1);
    transform: translateY(-1px);
}

.btn:hover:not(:disabled)::before {
    opacity: 1;
}

.btn:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 
        0 0 0 1px rgba(34, 211, 238, 0.3),
        0 4px 12px rgba(34, 211, 238, 0.15);
}

.btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    background: rgba(255, 255, 255, 0.02);
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: none;
}

.btn-send {
    align-self: flex-end;
}

/* Тусклая, пока поле ввода пустое (см. disabled в разметке + updateSendButtonState
   в app.js), "загорается" при появлении текста — как у ChatGPT/Claude. Кнопка
   теперь физически внутри .input-bar (та же рамка/подсветка, что у поля ввода,
   не отдельная фигура рядом с ним), это касается и десктопа. */
.btn-send:disabled {
    opacity: 0.35;
    cursor: default;
    pointer-events: none;
}

/* Follow-ups (Pill Chips) */
.follow-ups {
    display: none;
}

.follow-up-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.follow-up-btn {
    border-radius: 999px;
    padding: 10px 18px;
    border: 1px solid rgba(34, 211, 238, 0.35);
    background: rgba(255, 255, 255, 0.08);
    color: var(--muted);
    font-family: 'Monitorica', sans-serif;
    font-size: 0.9em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.18s ease;
    white-space: nowrap;
}

.follow-up-btn:hover,
.follow-up-btn.active {
    color: var(--text);
    border-color: rgba(34, 211, 238, 0.55);
    background: rgba(34, 211, 238, 0.12);
    box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.25), 0 8px 20px rgba(34, 211, 238, 0.12), 0 0 16px rgba(34, 211, 238, 0.08);
    transform: translateY(-1px);
}

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

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

/* Loading & Error States */
.loading {
    text-align: center;
    padding: 60px 20px;
    color: var(--muted);
    font-size: 1.1em;
}

.error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    padding: 16px 20px;
    border-radius: 12px;
    margin: 10px 0;
}

/* Scrollbar Styling */
.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(34, 211, 238, 0.3);
    border-radius: 10px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(34, 211, 238, 0.5);
}

/* Prevent scrollbar from causing layout shift */
.chat-messages {
    scrollbar-gutter: stable;
}

/* Ensure main chat view and container have proper height constraints */
#chatView .chat-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: 100%;
    min-height: 0;
    /* overflow:clip, а не hidden — .chat-container сам никогда не должен
       скроллиться ни по одной оси (внутренний скролл сообщений — отдельно, у
       .chat-messages), но hidden всё равно создаёт скролл-контейнер, который
       можно сдвинуть программно (например, focus() на поле ввода при узкой
       ширине на телефоне). На мобильном это сдвигало всю шапку (заголовок,
       статус базы, "Выйти") на ~50px влево, будто её обрезало краем экрана.
       clip запрещает скролл-контейнеру существовать вообще — тот же визуальный
       эффект (обрезка), но без возможности сдвинуться. */
    overflow: clip;

    /* Anchor the input panel to the frame */
    position: relative;
    padding: 24px !important;
}

/* Input panel sits on the bottom edge INSIDE the main chat frame */
#chatView .chat-input-wrapper {
    position: absolute;
    left: 24px;
    right: 24px;
    bottom: 30px;
    z-index: 50;
    /* margin-top: 12px !important; -- removed, see instructions */
    padding: 0 !important;
    margin: 0 !important;
}

#chatView .chat-messages {
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: 16px; /* keep internal spacing like the main chat window */
    margin-bottom: 64px;  /* reserve space for input panel height + small gap */
}

/* Button styles */
.btn-primary {
    background: linear-gradient(135deg, rgba(34, 211, 238, 0.2), rgba(124, 58, 237, 0.15));
    border: 1px solid rgba(34, 211, 238, 0.4);
    color: var(--cyan);
    font-weight: 600;
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, rgba(34, 211, 238, 0.3), rgba(124, 58, 237, 0.2));
    border-color: rgba(34, 211, 238, 0.6);
    box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.3), 0 8px 24px rgba(34, 211, 238, 0.2);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .main-content {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        flex-direction: row;
        min-height: auto;
    }

    .sidebar-nav {
        flex-direction: row;
        flex: 1;
    }

    /* .sidebar-item{width:100%} был рассчитан на ВЕРТИКАЛЬНЫЙ (десктопный)
       .sidebar-nav, где width — это поперечная ось и она ни на что не влияет.
       В строчном режиме (см. .sidebar-nav выше) width становится главной осью
       flex, и width:100% на каждой из трёх вкладок означает "хочу 100% всей
       строки" — втроём они требуют 300% ширины разом, из-за чего рамки вкладок
       обрезались краем экрана вместо того, чтобы поделить строку поровну.
       flex:1 1 0 заставляет их по-честному делить доступную ширину, а не
       отталкиваться от заявленной через width "желаемой" ширины. */
    .sidebar-item {
        width: auto;
        flex: 1 1 0;
    }

    .sidebar-footer {
        margin-top: 0;
        margin-left: auto;
        padding-top: 0;
        padding-left: 20px;
        border-top: none;
        border-left: 1px solid rgba(255, 255, 255, 0.08);
}

    .message {
        max-width: 85%;
    }
}

/* Мобильная навигация в стиле ChatGPT/Claude/Grok: боковая панель — это
   шторка (drawer), а не колонка, которая делит экран с контентом. По
   умолчанию скрыта за левым краем, открывается по гамбургеру (см.
   .btn-mobile-menu и #sidebarBackdrop в app.html), едет поверх контента и не
   отжимает ему ширину. Кнопка-гамбургер и подложка объявлены в app.html;
   здесь только их мобильное поведение. */
.btn-mobile-menu {
    display: none;
}

/* Пока шторка открыта, гамбургер прячем — иначе фиксированная кнопка в углу
   экрана накладывается на первый пункт меню (см. body.sidebar-drawer-open в
   app.js openMobileDrawer/closeMobileDrawer). Вместо неё — стрелка
   сворачивания на самой шторке, см. .btn-close-drawer ниже. */
body.sidebar-drawer-open .btn-mobile-menu {
    display: none;
}

.sidebar-backdrop {
    display: none;
}

.btn-close-drawer {
    display: none;
}

@media (max-width: 768px) {
    /* Тот же фон/рамка, что у круглой кнопки отправки (.btn) — раньше у
       гамбургера был свой сплошной тёмно-синий фон вместо общего
       бирюзово-фиолетового градиента, из-за чего две одинаковые по форме
       круглые кнопки выглядели по-разному. */
    /* Меньше, в самом углу экрана, без кружка-подложки — тот же голый стиль,
       что у .btn-close-drawer/.sidebar-toggle: просто иконка со свечением,
       не отдельная фигура-кнопка поверх контента. */
    .btn-mobile-menu {
        display: flex;
        align-items: center;
        justify-content: center;
        position: fixed;
        top: 8px;
        left: 8px;
        width: auto;
        height: auto;
        padding: 8px;
        border-radius: 0;
        background: transparent;
        border: none;
        box-shadow: none;
        color: var(--cyan);
        font-size: 16px;
        z-index: 210;
        cursor: pointer;
        text-shadow:
            0 0 8px rgba(34, 211, 238, 0.4),
            0 0 12px rgba(34, 211, 238, 0.2);
    }

    .btn-mobile-menu:hover {
        color: rgba(34, 211, 238, 1);
        text-shadow:
            0 0 12px rgba(34, 211, 238, 0.8),
            0 0 20px rgba(34, 211, 238, 0.5);
    }

    .sidebar-backdrop.active {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.55);
        z-index: 190;
        animation: sidebarBackdropFadeIn 0.2s ease;
    }

    @keyframes sidebarBackdropFadeIn {
        from { opacity: 0; }
        to { opacity: 1; }
    }

    /* Плоские панели контента — как у ChatGPT/Claude, где рабочая область
       не выглядит отдельной "коробкой" на странице, а сливается с фоном.
       Убираем рамку, тень, полупрозрачную заливку .panel и неоновые уголки
       .panel--hud (границу-градиент ::before, линии-уголки ::after, четыре
       span.hud-corner). .sidebar НЕ трогаем — те же классы .panel/.panel--hud
       у неё специально дают непрозрачный фон: шторка едет поверх контента, и
       без заливки/blur сквозь неё было бы видно то, что она должна скрывать. */
    .chat-container,
    .patients-wrapper,
    .spectacle-lenses-wrapper {
        border: none;
        box-shadow: none;
        background: transparent;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }

    /* .chat-messages (она же .chat-surface — тот же элемент) — своя, отдельная
       рамка (border:1px solid rgba(255,255,255,.05); border-radius:12px),
       её .chat-container выше не убирает, потому что это разные элементы.
       Именно она давала тонкую видимую границу вокруг области сообщений,
       даже после того как рамку самого .chat-container убрали. */
    .chat-messages {
        border: none;
        border-radius: 0;
    }

    .chat-container::before,
    .chat-container::after,
    .patients-wrapper::before,
    .patients-wrapper::after {
        display: none;
    }

    .chat-container .hud-corner {
        display: none;
    }

    /* #chatView .chat-container{padding:24px !important} (десктопная база,
       строка ~2031) держит шапку (заголовок + линия-разделитель) заметно
       ниже уровня гамбургера (.btn-mobile-menu — фикс. top:8px, вне этого
       контейнера, свой более компактный отступ). На телефоне нужен именно
       компактный верхний отступ, как у гамбургера — левый/правый/нижний
       трогать нельзя: #chatView .chat-input-wrapper позиционируется
       абсолютно с left/right:24px, рассчитанными на них. !important и та же
       по силе привязка к #chatView — иначе десктопное правило (оно тоже
       !important) выигрывает по порядку в файле. */
    #chatView .chat-container {
        padding-top: 4px !important;
    }

    /* .message.assistant уже без своего фона (см. правило ниже в этом файле) —
       теперь и .chat-messages/.chat-surface под ним не должен подсвечивать
       текстуру-подложку отдельным пятном на фоне уже плоской панели */
    .chat-messages {
        background: transparent;
    }

    /* Та самая "рамка", которую было не убрать — это был не border и не панель,
       а вертикальный скроллбар (.chat-messages::-webkit-scrollbar, 8px, с
       бирюзовым бегунком): scrollbar-gutter:stable резервирует и подсвечивает
       эту полосу, даже когда прокручивать нечего. На телефоне скролл и так
       работает пальцем, отдельная полоса не нужна — прячем её совсем. */
    .chat-messages {
        scrollbar-width: none;
        scrollbar-gutter: auto;
    }

    .chat-messages::-webkit-scrollbar {
        display: none;
        width: 0;
    }

    /* .main-content на @1024px становится column и .sidebar в нём — обычный
       блок в потоке (row внутри себя). На телефоне вместо этого делаем
       .sidebar самостоятельной шторкой поверх всего: position:fixed выводит
       её из потока, поэтому .main-content ужимать/делить с ней ширину уже
       не нужно — контент занимает весь экран, панель просто наезжает сверху. */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: min(300px, 82vw);
        height: 100dvh;
        max-height: 100dvh;
        z-index: 200;
        flex-direction: column;
        transform: translateX(-100%);
        transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 8px 0 40px rgba(0, 0, 0, 0.5);
        /* Левый край панели прижат к краю экрана (left:0) — скруглять там
           нечего, будет не видно. Скругляем только правые углы, по которым
           шторка реально "торчит" в контент. */
        border-radius: 0 var(--radius) var(--radius) 0;
        /* Запас сверху под стрелку сворачивания (.btn-close-drawer) — она
           теперь сидит целиком внутри панели, а не наполовину торчит за её
           край, поэтому первому пункту меню нужно место, чтобы не влезать
           под неё. */
        padding-top: 64px;
        /* Рамку самой панели убираем — .panel--hud даёт border + градиентную
           обводку через ::before + линии-уголки через ::after (см. ниже), а
           непрозрачный background/blur (сам .panel, не трогаем) оставляем:
           шторка едет поверх контента, и без заливки сквозь неё было бы
           видно то, что она должна скрывать. Рамка и заливка — разные вещи. */
        border: none;
    }

    .sidebar.mobile-open {
        transform: translateX(0);
    }

    .sidebar::before,
    .sidebar::after {
        display: none;
    }

    .sidebar .hud-corner {
        display: none;
    }

    /* Внутри шторки вкладки снова список сверху вниз, как на десктопе, а не
       сжатая строка — панели теперь никто не мешает по ширине, весь экран
       отдан под неё, пока она открыта. flex:0 0 auto (а не унаследованный с
       @1024px flex:1) — иначе .sidebar-nav растягивался на всю высоту шторки
       и раздвигал три коротких пункта меню и список чатов огромной пустой
       дырой между ними. */
    .sidebar-nav {
        flex: 0 0 auto;
        flex-direction: column;
        overflow: visible;
    }

    .sidebar-item {
        width: 100%;
        flex: 0 0 auto;
    }

    .sidebar-toggle {
        display: none;
    }

    /* Стрелка сворачивания шторки — в правом верхнем углу панели, простым
       элементом (без кружка-подложки — тот же голый стиль, что у
       .sidebar-toggle на десктопе: прозрачный фон, без рамки, свечение
       текстом, а не фигурой). padding вместо width/height — увеличивает
       область нажатия, не рисуя видимую форму вокруг символа. Место под неё
       освобождено padding-top:64px у .sidebar выше, поэтому она не
       перекрывает первый пункт меню. Видна, только когда шторка реально
       открыта (.sidebar.mobile-open) — иначе она позиционируется от края
       ЗАКРЫТОЙ (translateX(-100%)) панели и торчит из-за левого края экрана
       сама по себе. */
    .btn-close-drawer {
        display: none;
        align-items: center;
        justify-content: center;
        position: absolute;
        top: 4px;
        right: 4px;
        width: auto;
        height: auto;
        padding: 12px;
        background: transparent;
        border: none;
        border-radius: 0;
        box-shadow: none;
        color: var(--cyan);
        font-size: 22px;
        line-height: 1;
        z-index: 5;
        cursor: pointer;
        text-shadow:
            0 0 8px rgba(34, 211, 238, 0.4),
            0 0 12px rgba(34, 211, 238, 0.2);
    }

    .btn-close-drawer:hover {
        color: rgba(34, 211, 238, 1);
        text-shadow:
            0 0 12px rgba(34, 211, 238, 0.8),
            0 0 20px rgba(34, 211, 238, 0.5);
    }

    .sidebar.mobile-open .btn-close-drawer {
        display: flex;
    }

    /* Статус базы знаний + "Выйти" — в одну строку у нижнего края шторки (как
       на десктопе по сути, только там вертикальный список), а не в столбик:
       унаследованные с @1024px margin-left:auto/border-left были рассчитаны
       на строчный .sidebar и в колонке смысла не имеют. */
    .sidebar-footer {
        margin-top: auto;
        margin-left: 0;
        padding-top: 16px;
        padding-left: 0;
        border-top: 1px solid rgba(255, 255, 255, 0.08);
        border-left: none;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
    }

    .rag-status {
        flex: 1 1 auto;
        min-width: 0;
        background: transparent;
        border: none;
    }

    .rag-status span:not(.status-dot) {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    #btnLogoutSidebar {
        width: auto !important;
        margin-top: 0 !important;
        flex: 0 0 auto;
        white-space: nowrap;
        background: transparent !important;
        border: none !important;
    }

    /* Пункты меню и "Новый чат" — тоже без рамки-«коробки», как и остальная
       шторка на телефоне (см. общую заметку про плоские панели выше).
       Активный пункт по-прежнему заметен — левой полоской-акцентом
       (.sidebar-item::before) и цветом текста, а не залитой пилюлей с
       рамкой. */
    .sidebar-item,
    .sidebar-item:hover,
    .sidebar-item.active {
        background: transparent;
        border-color: transparent;
    }

    .btn-new-chat,
    .btn-new-chat:hover {
        background: transparent;
        border: none;
        box-shadow: none;
        transform: none;
    }

    /* Шапка модуля на телефоне — не сжимаем всё до микрошрифта, а убираем то,
       что там не нужно (как в ChatGPT/Claude: в шапке — только название,
       никакой служебной телеметрии). Технический подзаголовок ("База: готова
       • Режим: RAG..."), развёрнутый статус базы знаний и повторная кнопка
       "Выйти" — всё это уже есть или не нужно на маленьком экране: "Выйти"
       остаётся в шторке (.sidebar-footer), статус ошибки базы знаний и так
       покажется прямо в чате, если что-то не готово (см.
       MessagesController.SendMessage). Название модуля — теперь полное, как
       на десктопе (см. .chat-subtitle ниже и .chat-title-short в базовых
       правилах этого файла) — едет бегущей строкой в одну строку слева
       направо от гамбургера. */
    /* padding-right такой же, как padding-left (место под гамбургер) — иначе
       центрирование ниже считалось бы от несимметричной коробки (отступ есть
       только слева) и заголовок визуально уезжал вправо от истинного центра
       панели, а не вставал по центру экрана. */
    .chat-header {
        padding-left: 48px;
        padding-right: 48px;
        justify-content: center;
    }

    .chat-header-main,
    .chat-title-group {
        min-width: 0;
    }

    .chat-header-main {
        justify-content: center;
    }

    /* Заголовок по центру строки (в оставшемся месте справа от гамбургера —
       см. padding-left выше), а не прижат к левому краю */
    .chat-title-group {
        align-items: center;
    }

    .chat-title {
        font-size: 1em;
        text-align: center;
        overflow: hidden;
    }

    /* Раньше на телефоне показывалось короткое "AI Optometrist" вместо
       полного "AI·Optometrist Assistant·By Molchanov M.G" — считалось, что
       полное не влезает без обрезки. Но .chat-title уже безусловно оборачивается
       в бегущую строку (см. setupTitleMarquee в app.js — тот же приём, что и
       для длинных ФИО пациентов), так что обрезка не нужна: полное название
       едет строкой, как на десктопе (по просьбе пользователя 2026-08-16).
       .chat-title-short остаётся скрытым по умолчанию (её базовое правило
       display:none рядом с .chat-title-full выше в этом файле), явно
       переопределять здесь больше нечего.
       .chat-title-credit НЕ добавляем в список скрытых ниже — на десктопе
       подпись автора внутри .chat-title-full видна, значит и на мобильном
       "полное название как на ПК" должно включать её тоже. */
    .chat-subtitle,
    .rag-status-top,
    #btnLogout {
        display: none;
    }

    /* Заголовки с доп.кнопками в шапке (Пациенты). Разметка теперь везде
       одинаковая: "стрелка назад к списку" (#btnBackToPatientsListFromTrash/
       FromOverview/List) — ВСЕГДА прямой потомок .chat-header-main, рядом с
       .chat-title-group (см. app.html); прочие, более специфичные по смыслу
       кнопки ("Удалить карту", "← К карте пациента" в визарде) — в соседнем
       .patients-wizard-header-actions. Раньше все кнопки были в одной строке
       с заголовком, из-за чего .chat-header{justify-content:center}
       центрировал заголовок не по всей ширине шапки, а по остатку места, и
       он наезжал на кнопки. Разносим по строкам: .chat-header-main (только
       заголовок + стрелка-иконка) — всегда первой строкой на всю ширину,
       .patients-wizard-header-actions (если есть) — второй строкой, прижата
       вправо. */
    .chat-header {
        flex-wrap: wrap;
    }

    .chat-header-main {
        flex: 1 1 100%;
        position: relative;
    }

    .chat-title-group {
        flex: 1 1 100%;
    }

    .patients-wizard-header-actions {
        flex: 0 0 auto;
        margin: 4px 0 0 auto;
        display: flex;
        gap: 6px;
    }

    .patients-wizard-header-actions .btn-patients-secondary {
        padding: 6px 10px;
        font-size: 0.7em;
        white-space: nowrap;
    }

    /* "Назад к списку пациентов" на телефоне — реальные текстовые кнопки
       (#btnBackToPatientsListFromTrash/FromOverview/List) прячем совсем.
       Вместо попыток позиционировать ИХ (они внутри #patientsView/
       .content-area, у которых CSS contain:layout — из-за него
       position:fixed внутри них считается не от экрана, а от них самих, и
       любые ручные отступы получались то криво, то не совсем симметрично
       гамбургеру) — есть отдельная #btnPatientsBackArrow ВНЕ этого поддерева
       (объявлена в app.html рядом с гамбургером), уже честно position:fixed
       от экрана, зеркальная ему по-настоящему (см. .btn-patients-back-arrow
       ниже). Она сама показывается/прячется и "нажимает" нужную из этих
       кнопок за кулисами (см. showPatientsSubState в app.js) — так что
       реальные кнопки нужны только для доступности/десктопа, глазами их
       на телефоне видно не будет. */
    #btnBackToPatientsListFromTrash,
    #btnBackToPatientsListFromOverview,
    #btnBackToPatientsList {
        display: none;
    }

    /* Зеркало гамбургера — тот же .btn-mobile-menu (см. его правило выше:
       фикс. позиция, top:8px, padding:8px, голый стиль иконки со
       свечением), эта вторая надпись класса только меняет левый край шапки
       на правый. right:8px — ровно то же число, что и left:8px у
       гамбургера. font-size НЕ переопределяем (был 22px, как у
       .btn-close-drawer) — с ним при одинаковых top/padding высота бокса
       кнопки получалась больше, чем у гамбургера (line-height считается от
       font-size), и стрелка визуально съезжала вниз, хоть top и совпадал.
       Без переопределения оба используют один и тот же font-size:16px из
       .btn-mobile-menu — высота бокса идентична гамбургеру, значит и center,
       и низ совпадают, а не только верх. */
    .btn-patients-back-arrow {
        left: auto;
        right: 8px;
    }

    /* "?" — подсказка-перевод по наведению курсора; на телефоне навести
       нельзя (только тап), так что это просто мёртвый элемент на экране */
    .sidebar-translate-icon {
        display: none;
    }

    /* Поле ввода сообщения — та же история: не сжимать всё в одну тесную
       строку, а убрать, что там реально не нужно. В .input-bar на десктопе
       рядом с самим полем ввода помещаются переключатель длины ответа с
       подписью "Простой ответ" и подсказкой-"?", И ЕЩЁ музыкальный плеер
       (⏮ ▶ ⏭ + волновой индикатор) — он к чату вообще не относится, просто
       так сверстан внутри .chat-input-wrapper. На телефоне вместе с полем
       ввода это физически не помещается. Оставляем: компактные иконки
       длины ответа (без подписи и тултипа) + само поле + кнопку отправки. */
    .music-player {
        display: none !important;
    }

    .mode-help-wrapper {
        display: none;
    }

    /* Переключатель длины ответа (перо/мозг) — на телефоне убран целиком, а
       не просто ужат: в строке с полем ввода ему не место, роль "убрать
       лишнее" тут важнее, чем сохранить функцию под рукой на каждом экране */
    .reply-length-seg {
        display: none;
    }

    .chat-input-wrapper {
        gap: 8px;
    }

    /* min-width:0 — без него .input-bar не сжимался бы меньше своей
       "естественной" ширины и вместе с кнопкой отправки продолжал
       вылезать за край строки, даже когда .chat-input внутри него уже готов
       сжаться (min-width:0 у него самого не помогает родителю) */
    /* Без рамки — вместо чёткой границы лёгкое неоновое свечение (box-shadow
       вместо border), и сплошная однотонная заливка вместо полупрозрачного
       "стекла" на пёстром фоне — как поле ввода у ChatGPT/Claude, только в
       нашей голубой неоновой палитре вместо их серой. */
    /* height/min-height/max-height у базового .input-bar — фиксированная
       десктопная формула "точно под высоту кнопки", а кнопка отправки на
       телефоне теперь круглая 44px (см. .btn-send ниже) и выше того, что
       формула даёт. С align-self:flex-end (базовое правило .btn-send,
       рассчитанное на старую вёрстку) кнопка прижималась низом к низу поля
       и высовывалась ВЕРХ за его рамку — отсюда "кривая"/вылезающая кнопка.
       height:auto + свой min-height вместо десктопной формулы даёт полю
       вырасти и вместить кнопку целиком, align-self:center ниже — выравнивает
       её по центру, а не по низу. */
    .input-bar {
        min-width: 0;
        gap: 8px;
        height: auto;
        min-height: 52px;
        max-height: none;
        padding: 8px 12px;
        border-color: transparent;
        background: #101a30;
        box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.22), 0 0 18px rgba(34, 211, 238, 0.12);
    }

    .input-bar:focus-within {
        border-color: transparent;
        background: #101a30;
        box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.45), 0 0 22px rgba(34, 211, 238, 0.22);
    }

    /* #chatView .chat-messages{margin-bottom:64px} (не в медиа-запросе, общий
       для всех экранов) резервировал место точно под старую высоту
       .input-bar (~49px) — плавающая панель (#chatView .chat-input-wrapper{
       position:absolute; bottom:30px}) в неё помещалась впритык. Теперь
       .input-bar на телефоне выше (~66px из-за круглой 44px-кнопки), и
       старого запаса не хватало — панель заезжала на нижний край области
       сообщений (и на её рамку). Увеличиваем запас под новую высоту. */
    #chatView .chat-messages {
        margin-bottom: 90px;
    }

    /* Кнопка отправки — круглая со стрелкой вместо текста "Отправить"
       (как у большинства чат-приложений). width:auto!important перебивает
       старое ".btn{width:100%}" из отдельного мобильного блока ниже по
       файлу (та же специфичность, но более поздний порядок — без этого
       кнопка расползалась на всю ширину строки). font-size:0 прячет сам
       текст "Отправить" (он остаётся в разметке — доступность/скринридеры
       не страдают), ::after поверх рисует стрелку уже своим размером
       шрифта, независимо от обнулённого родительского. */
    .btn-send {
        width: 36px !important;
        height: 36px;
        padding: 0;
        border-radius: 50%;
        font-size: 0;
        flex-shrink: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        /* Перебивает базовое .btn-send{align-self:flex-end} — та высота была
           рассчитана под старую вёрстку, где кнопка была отдельной фигурой
           рядом с полем; сейчас она внутри .input-bar, и flex-end прижимал
           круг к низу поля, из-за чего он вылезал за верхний край. */
        align-self: center;
    }

    .btn-send::after {
        content: "↑";
        font-size: 16px;
        line-height: 1;
        font-family: 'Monitorica', sans-serif;
    }

    /* Ответ ИИ — без рамки и фона, просто текст на фоне панели (как у
       ChatGPT/Claude: пузырь с фоном там только у сообщения пользователя,
       ответ ассистента — открытый текст). Заметно только своей ролью в
       разговоре, а не отдельной "карточкой". Сообщение пользователя
       (.message.user) не трогаю — оно осознанно остаётся с фоном. */
    .message.assistant {
        background: none;
        border: none;
        box-shadow: none;
        padding: 8px 4px;
        max-width: 100%;
    }

    /* Пустой экран чата — вместо заголовка+подзаголовка+8 карточек-примеров+
       "ещё"+описания поддерживаемых функций показываем один короткий вопрос
       по центру. Всё остальное убрано, а не уменьшено. */
    .empty-state-title {
        display: none;
    }

    /* Шрифт/стиль — как у .chat-subtitle (HUD-надписи по всему сайту):
       Monitorica, разрядка, капс, лёгкое неоновое свечение — а не обычный
       текстовый заголовок. */
    .empty-state-title-mobile {
        display: block;
        font-family: 'Monitorica', sans-serif;
        font-size: 1.3em;
        font-weight: 500;
        color: rgba(34, 211, 238, 0.85);
        letter-spacing: 1px;
        text-transform: uppercase;
        text-shadow: 0 0 6px rgba(34, 211, 238, 0.3);
        text-align: center;
    }

    .empty-state-subtitle,
    .empty-state-suggestions,
    .empty-state-extended,
    .empty-state-footer {
        display: none;
    }

    /* Пустое/ошибочное состояние списка пациентов — тот же стиль, что и у
       главного экрана ИИ-ассистента выше (.empty-state-title-mobile), а не
       обычный серый текст: Monitorica, капс, разрядка. Основная строка —
       с неоновым свечением, подсказка под ней — тише, тем же шрифтом. */
    .patients-empty-state p {
        font-family: 'Monitorica', sans-serif;
        letter-spacing: 1px;
        text-transform: uppercase;
    }

    .patients-empty-state > p:first-child {
        font-size: 1.05em;
        color: rgba(34, 211, 238, 0.85);
        text-shadow: 0 0 6px rgba(34, 211, 238, 0.3);
    }

    .patients-empty-hint {
        font-size: 0.8em;
        color: rgba(234, 242, 255, 0.5);
    }
}

@media (max-width: 768px) {
    body {
        padding: 12px;
    }

    .chat-container {
        padding: 16px;
    }

    .chat-messages {
        min-height: 0;
    }

    .message {
        max-width: 90%;
        padding: 12px 16px;
    }

    .chat-input-container {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }
}

/* Auth Choice Screen */
.auth-choice {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.auth-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.auth-button-primary {
    background: linear-gradient(135deg, rgba(34, 211, 238, 0.2), rgba(124, 58, 237, 0.15));
    border: 1px solid rgba(34, 211, 238, 0.4);
    color: var(--cyan);
    font-weight: 600;
}

.auth-button-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, rgba(34, 211, 238, 0.3), rgba(124, 58, 237, 0.2));
    border-color: rgba(34, 211, 238, 0.6);
    box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.3), 0 8px 24px rgba(34, 211, 238, 0.2);
}

.auth-button-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text);
    font-weight: 500;
}

.auth-button-secondary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.25);
}

.auth-button-link {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 14px;
    padding: 8px;
    margin-top: 8px;
    cursor: pointer;
    text-decoration: none;
}

.auth-button-link:hover {
    color: var(--text);
}

/* =========================
   LUX HUD MICRO-ANIMATIONS
   (Variant A)
   ========================= */

/* Общие переменные под эффект */
:root{
  --lux-cyan: rgba(34,211,238,.9);
  --lux-cyan-soft: rgba(34,211,238,.18);
  --lux-purple-soft: rgba(124,58,237,.14);
  --lux-white-soft: rgba(255,255,255,.08);
}

/* 0) Уточнение: карточки должны быть "контейнером" для псевдоэлементов */
.landing-left,
.auth-card{
  position: relative;
  overflow: hidden; /* важно для scanline + shimmer */
}

/* 1) Мягкий glow-контур карточек при hover (дорого, не шумит) */
.landing-left,
.auth-card{
  border: 1px solid rgba(255,255,255,.08);
  box-shadow: 0 24px 70px rgba(0,0,0,.55);
  transition: box-shadow .18s ease, border-color .18s ease, transform .18s ease;
}

.landing-left:hover,
.auth-card:hover{
  border-color: rgba(34,211,238,.22);
  box-shadow:
    0 30px 90px rgba(0,0,0,.62),
    0 0 0 1px rgba(34,211,238,.10) inset,
    0 0 40px rgba(34,211,238,.10);
  transform: translateY(-1px);
}

/* 2) Scanline (еле заметная) — проход раз в ~9 сек */
.landing-left::after,
.auth-card::after{
  content:"";
  position:absolute;
  left:-10%;
  top:-30%;
  width:120%;
  height:90px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(34,211,238,.06),
    transparent
  );
  filter: blur(0.2px);
  opacity: 0;
  transform: translateY(-120px);
  animation: lux-scanline 9s ease-in-out infinite;
  pointer-events:none;
}

@keyframes lux-scanline{
  0%, 55% { opacity: 0; transform: translateY(-140px); }
  60%     { opacity: .55; }
  75%     { opacity: .55; transform: translateY(520px); }
  85%     { opacity: 0; }
  100%    { opacity: 0; transform: translateY(520px); }
}

/* 3) HUD corners — тонкие угловые скобы (внутри карточек) */
.landing-left::before,
.auth-card::before{
  content:"";
  position:absolute;
  inset: 14px;
  border-radius: 14px;
  background:
    linear-gradient(var(--lux-cyan), var(--lux-cyan)) top left / 22px 2px no-repeat,
    linear-gradient(var(--lux-cyan), var(--lux-cyan)) top left / 2px 22px no-repeat,

    linear-gradient(var(--lux-cyan), var(--lux-cyan)) top right / 22px 2px no-repeat,
    linear-gradient(var(--lux-cyan), var(--lux-cyan)) top right / 2px 22px no-repeat,

    linear-gradient(var(--lux-cyan), var(--lux-cyan)) bottom left / 22px 2px no-repeat,
    linear-gradient(var(--lux-cyan), var(--lux-cyan)) bottom left / 2px 22px no-repeat,

    linear-gradient(var(--lux-cyan), var(--lux-cyan)) bottom right / 22px 2px no-repeat,
    linear-gradient(var(--lux-cyan), var(--lux-cyan)) bottom right / 2px 22px no-repeat;
  opacity: .20;
  pointer-events:none;
  mix-blend-mode: screen;
  animation: lux-corner-breathe 6s ease-in-out infinite;
}

@keyframes lux-corner-breathe{
  0%,100% { opacity: .16; }
  50%     { opacity: .24; }
}

/* =========================
   BUTTONS — shimmer + pulse
   ========================= */

/* 4) Общая база "дорогой" кнопки */
.btn-landing,
.auth-button{
  position: relative;
  overflow: hidden;
  transform: translateZ(0); /* сглаживание */
}

/* 5) Лёгкий idle-пульс (редкий и слабый) только для главных CTA */
.btn-landing-primary,
.auth-button-primary{
  box-shadow:
    0 10px 30px rgba(0,0,0,.35),
    0 0 0 1px rgba(34,211,238,.12) inset;
  animation: lux-pulse 3.8s ease-in-out infinite;
}

@keyframes lux-pulse{
  0%,100%{
    box-shadow:
      0 10px 30px rgba(0,0,0,.35),
      0 0 0 1px rgba(34,211,238,.12) inset,
      0 0 18px rgba(34,211,238,.10);
  }
  50%{
    box-shadow:
      0 12px 36px rgba(0,0,0,.40),
      0 0 0 1px rgba(34,211,238,.18) inset,
      0 0 26px rgba(34,211,238,.16);
  }
}


/* 7) Нажатие — микро */
.btn-landing:active,
.auth-button:active{
  transform: translateY(1px) scale(.99);
}

/* 8) Hover-акцент на secondary кнопках без "кислоты" */
.btn-landing-secondary:hover,
.auth-button-secondary:hover{
  box-shadow:
    0 14px 40px rgba(0,0,0,.35),
    0 0 0 1px rgba(34,211,238,.10) inset;
}

/* 9) Уважение reduce motion */
@media (prefers-reduced-motion: reduce){
  .landing-left::after,
  .auth-card::after,
  .landing-left::before,
  .auth-card::before,
  .btn-landing-primary,
  .auth-button-primary{
    animation: none !important;
  }
  .btn-landing::after,
  .auth-button::after{
    display:none !important;
  }
}

/* =========================================================
   LANDING (AUTH) — LUX A (NO OVERLOAD)
   Adds: divider/layout for auth, subtle premium animations,
   and micro-interactions for buttons.
   ========================================================= */

/* Ensure landing container can host overlays safely */
.landing-container { position: relative; }
.landing-content { position: relative; z-index: 2; }

/* Subtle noise layer (keeps the “premium film grain” even if body::before is repurposed on landing) */
.landing-container::before {
    content: "";
    position: fixed;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.028'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 1;
    mix-blend-mode: soft-light;
}

/* Background overlay drift (very slow, premium) */
body::before {
    animation: lux-bg-drift 18s ease-in-out infinite;
}

@keyframes lux-bg-drift {
    0%, 100% { transform: translate3d(0,0,0); filter: saturate(1) contrast(1); }
    50% { transform: translate3d(0,-6px,0); filter: saturate(1.03) contrast(1.02); }
}

/* Auth layout helpers (missing pieces in inline CSS) */
.auth-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Secondary + link variants for auth buttons */
.auth-button-secondary {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
    border: 1px solid rgba(34, 211, 238, 0.22);
}

.auth-button-secondary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.09);
    box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.12) inset, 0 10px 26px rgba(0,0,0,0.28);
}

.auth-button-link {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.12);
    color: rgba(234, 242, 255, 0.82);
}

.auth-button-link:hover:not(:disabled) {
    background: rgba(255,255,255,0.06);
    border-color: rgba(34, 211, 238, 0.25);
}

/* =========================================================
   LUX HUD MICRO-ANIMATIONS (for .landing-left & .auth-card)
   ========================================================= */

.landing-left,
.auth-card {
    position: relative;
    overflow: hidden;
}

/* Put content above pseudo layers */
.landing-left > *,
.auth-card > * {
    position: relative;
    z-index: 2;
}

/* Soft premium hover lift */
.landing-left,
.auth-card {
    transition: box-shadow .18s ease, border-color .18s ease, transform .18s ease;
}

.landing-left:hover,
.auth-card:hover {
    border-color: rgba(34, 211, 238, 0.20);
    box-shadow:
        0 34px 96px rgba(0,0,0,0.62),
        0 0 0 1px rgba(34, 211, 238, 0.10) inset,
        0 0 44px rgba(34, 211, 238, 0.10);
    transform: translateY(-1px);
}

/* HUD corners (thin brackets inside cards) */
.landing-left::before,
.auth-card::before {
    content: "";
    position: absolute;
    inset: 14px;
    border-radius: 14px;
    background:
        linear-gradient(rgba(34,211,238,0.95), rgba(34,211,238,0.95)) top left / 22px 2px no-repeat,
        linear-gradient(rgba(34,211,238,0.95), rgba(34,211,238,0.95)) top left / 2px 22px no-repeat,

        linear-gradient(rgba(34,211,238,0.95), rgba(34,211,238,0.95)) top right / 22px 2px no-repeat,
        linear-gradient(rgba(34,211,238,0.95), rgba(34,211,238,0.95)) top right / 2px 22px no-repeat,

        linear-gradient(rgba(34,211,238,0.95), rgba(34,211,238,0.95)) bottom left / 22px 2px no-repeat,
        linear-gradient(rgba(34,211,238,0.95), rgba(34,211,238,0.95)) bottom left / 2px 22px no-repeat,

        linear-gradient(rgba(34,211,238,0.95), rgba(34,211,238,0.95)) bottom right / 22px 2px no-repeat,
        linear-gradient(rgba(34,211,238,0.95), rgba(34,211,238,0.95)) bottom right / 2px 22px no-repeat;
    opacity: 0.16;
    pointer-events: none;
    z-index: 1;
    mix-blend-mode: screen;
    animation: lux-corner-breathe 6.2s ease-in-out infinite;
}

@keyframes lux-corner-breathe {
    0%, 100% { opacity: 0.14; }
    50% { opacity: 0.20; }
}

/* Scanline (rare, subtle) */
.landing-left::after,
.auth-card::after {
    content: "";
    position: absolute;
    left: -10%;
    top: -30%;
    width: 120%;
    height: 90px;
    background: linear-gradient(90deg, transparent, rgba(34,211,238,0.06), transparent);
    opacity: 0;
    transform: translateY(-140px);
    pointer-events: none;
    z-index: 1;
    animation: lux-scanline 9s ease-in-out infinite;
}

@keyframes lux-scanline {
    0%, 55% { opacity: 0; transform: translateY(-140px); }
    60% { opacity: 0.55; }
    75% { opacity: 0.55; transform: translateY(520px); }
    85%, 100% { opacity: 0; transform: translateY(520px); }
}

/* =========================================================
   BUTTON MICRO-INTERACTIONS — shimmer + gentle pulse on CTA
   ========================================================= */

.btn-landing,
.auth-button {
    position: relative;
    overflow: visible;
    transform: translateZ(0);
}

/* Gentle CTA pulse (ONLY primary) */
.btn-landing-primary,
.auth-button-primary {
    box-shadow:
        0 10px 30px rgba(0,0,0,0.30),
        0 0 0 1px rgba(34,211,238,0.12) inset,
        0 0 18px rgba(34,211,238,0.08);
    animation: lux-pulse 3.8s ease-in-out infinite;
}

@keyframes lux-pulse {
    0%, 100% {
        box-shadow:
            0 10px 30px rgba(0,0,0,0.30),
            0 0 0 1px rgba(34,211,238,0.12) inset,
            0 0 18px rgba(34,211,238,0.08);
    }
    50% {
        box-shadow:
            0 12px 36px rgba(0,0,0,0.36),
            0 0 0 1px rgba(34,211,238,0.18) inset,
            0 0 26px rgba(34,211,238,0.14);
    }
}

/* Вариант 2: Тонкая неоновая линия, пробегающая по контуру кнопки */
.btn-landing::after,
.auth-button::after {
    content: "";
    position: absolute;
    inset: -2px;
    border-radius: inherit;
    padding: 2px;
    background: linear-gradient(
        90deg,
        transparent 0%,
        transparent 35%,
        rgba(34, 211, 238, 0.5) 45%,
        rgba(34, 211, 238, 0.7) 50%,
        rgba(34, 211, 238, 0.5) 55%,
        transparent 65%,
        transparent 100%
    );
    background-size: 200% 100%;
    -webkit-mask: 
        linear-gradient(#fff 0 0) content-box, 
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask: 
        linear-gradient(#fff 0 0) content-box, 
        linear-gradient(#fff 0 0);
    mask-composite: exclude;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: -1;
}

.btn-landing:hover::after,
.auth-button:hover::after {
    opacity: 1;
    animation: contourLine 1.2s ease-in-out forwards;
}

@keyframes contourLine {
    0% {
        background-position: -100% 0;
        opacity: 0;
    }
    20% {
        opacity: 0.7;
    }
    50% {
        opacity: 1;
    }
    80% {
        opacity: 0.7;
    }
    100% {
        background-position: 200% 0;
        opacity: 0;
    }
}

/* Click micro */
.btn-landing:active,
.auth-button:active {
    transform: translateY(1px) scale(0.99);
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
    body::before,
    .landing-left::before,
    .auth-card::before,
    .landing-left::after,
    .auth-card::after,
    .btn-landing-primary,
    .auth-button-primary {
        animation: none !important;
    }

    .btn-landing::after,
    .auth-button::after {
        display: none !important;
    }
}
/* =========================================================
   LUX LOGIN: neon ring + premium hover (landing/auth cards)
   ========================================================= */

:root {
    --neonA: rgba(34, 211, 238, 0.95);
    --neonB: rgba(124, 58, 237, 0.85);
    --neonC: rgba(34, 211, 238, 0.35);
}

/* Animated neon ring around the two main cards */
.landing-left,
.auth-card {
    position: relative;
    isolation: isolate; /* keeps blend/filters inside */
}

/* DISABLED: вращающаяся неоновая рамка внутри карточек убрана */
.landing-left::before,
.auth-card::before {
    display: none;
}

/* Gentle inner glow (premium, not busy) */
.landing-left::after,
.auth-card::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: var(--radius);
    background:
        radial-gradient(600px 260px at 20% 15%, rgba(34, 211, 238, 0.10), transparent 60%),
        radial-gradient(520px 240px at 85% 35%, rgba(124, 58, 237, 0.08), transparent 62%);
    opacity: 0.9;
    z-index: 0;
    pointer-events: none;
}

/* Ensure content is above effects */
.landing-left > *,
.auth-card > * {
    position: relative;
    z-index: 2;
}

/* =========================
   HERO LOGO RING EFFECTS
   ========================= */

        .hero-logo-ring::before {
            content: "";
            position: absolute;
            inset: 0; /* Тот же размер что и видео - 112px x 112px */
            border-radius: 50%;
            padding: 3px; /* Толщина рамки */
            background: conic-gradient(
                from 210deg,
                rgba(34, 211, 238, 0.95),
                rgba(124, 58, 237, 0.85),
                rgba(34, 211, 238, 0.95)
            );
            -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
            -webkit-mask-composite: xor;
            mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
            mask-composite: exclude;
            filter: 
                drop-shadow(0 0 6px rgba(34, 211, 238, 1))
                drop-shadow(0 0 12px rgba(34, 211, 238, 0.9))
                drop-shadow(0 0 18px rgba(34, 211, 238, 0.7))
                drop-shadow(0 0 24px rgba(34, 211, 238, 0.5));
            animation: hero-ring-pulse 2.6s ease-in-out infinite;
            opacity: 1;
            z-index: 2;
            pointer-events: none;
        }

        @keyframes hero-ring-pulse {
            0%, 100% {
                opacity: 0.55;
            }
            50% {
                opacity: 1;
            }
        }

        @media (prefers-reduced-motion: reduce) {
            .hero-logo-ring::before {
                animation: none !important;
            }
        }
/* =========================================================
   LANDING FEATURES (left card) — FUTURISTIC NEON + LAMP FLICKER
   Targets ONLY: .landing-feature-text (3 lines under the hero)
   ========================================================= */

.landing-features .landing-feature-text {
    font-family: 'Monitorica', sans-serif;
    font-size: 16px; /* keep existing size */
    color: rgba(34, 211, 238, 0.9); /* Неоновый цвет как в заголовке */
    letter-spacing: 0.6px;
    text-transform: uppercase;

    position: relative;

    /* Неоновое свечение и пульсация как в заголовке */
    text-shadow: 
        0 0 12px rgba(34, 211, 238, 0.4),
        0 0 24px rgba(34, 211, 238, 0.2),
        0 0 40px rgba(34, 211, 238, 0.15);
    animation: flickerLanding 3s infinite;
}

/* Keep each appearing word consistent with the new style */
.landing-features .landing-feature-text .word-animate {
    text-shadow: 
        0 0 12px rgba(34, 211, 238, 0.4),
        0 0 24px rgba(34, 211, 238, 0.2),
        0 0 40px rgba(34, 211, 238, 0.15);
}

/* subtle neon tube underline (very light) */
.landing-features .landing-feature-text::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -3px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(34, 211, 238, 0.30), transparent);
    opacity: 0.16;
    pointer-events: none;
    animation: landingTubeJitter 6.8s infinite;
}

@keyframes landingLampFlicker {
    0%   { opacity: 0.96; }
    6%   { opacity: 0.88; }
    8%   { opacity: 0.98; }
    12%  { opacity: 0.74; text-shadow: 0 0 6px rgba(34,211,238,0.12), 0 0 12px rgba(34,211,238,0.08), 0 0 18px rgba(124,58,237,0.06); }
    14%  { opacity: 0.95; }
    23%  { opacity: 0.90; }
    28%  { opacity: 0.70; text-shadow: 0 0 4px rgba(34,211,238,0.10), 0 0 10px rgba(34,211,238,0.06), 0 0 14px rgba(124,58,237,0.05); }
    30%  { opacity: 0.95; }
    47%  { opacity: 0.92; }
    50%  { opacity: 0.99; text-shadow: 0 0 12px rgba(34,211,238,0.24), 0 0 22px rgba(34,211,238,0.12), 0 0 30px rgba(124,58,237,0.10); }
    58%  { opacity: 0.84; }
    62%  { opacity: 0.96; }
    79%  { opacity: 0.88; }
    83%  { opacity: 0.76; }
    86%  { opacity: 0.95; }
    100% { opacity: 0.93; }
}

@keyframes landingTubeJitter {
    0%, 100% { opacity: 0.14; transform: translateX(0); }
    8%  { opacity: 0.08; transform: translateX(-1px); }
    12% { opacity: 0.05; transform: translateX(1px); }
    28% { opacity: 0.05; transform: translateX(-2px); }
    50% { opacity: 0.18; transform: translateX(2px); }
    62% { opacity: 0.07; transform: translateX(-1px); }
    83% { opacity: 0.06; transform: translateX(1px); }
}

@media (prefers-reduced-motion: reduce) {
    .landing-features .landing-feature-text,
    .landing-features .landing-feature-text::after {
        animation: none !important;
    }
    
    .recipe-form-input,
    .checkbox-value,
    .btn-recipe-analyze,
    .recipe-form-section {
        transition: none !important;
    }
}

/* ============================================
   SPECTACLE LENSES MODULE
   ============================================ */

.spectacle-lenses-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: 100%;
    min-height: 0;
    padding: 8px;
    overflow-y: auto;
    /* clip, а не hidden — та же история, что у .chat-container (см. комментарий
       там): hidden всё ещё создаёт скролл-контейнер по X, который можно сдвинуть
       программно, clip запрещает это, оставляя саму обрезку контента как есть */
    overflow-x: clip;
}

.spectacle-lenses-content {
    flex: 1;
    min-height: 0;
}

/* Титульный экран */
.spectacle-lenses-intro {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100%;
    padding: 40px 20px;
}

.spectacle-lenses-intro-content {
    text-align: center;
    max-width: 600px;
    animation: spectacleLensesIntroFadeIn 0.8s ease-out forwards;
}

@keyframes spectacleLensesIntroFadeIn {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.spectacle-lenses-title {
    font-family: 'Orbitron', monospace;
    font-size: 2.5em;
    font-weight: 700;
    color: rgba(34, 211, 238, 0.9);
    margin: 0 0 24px 0;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 
        0 0 12px rgba(34, 211, 238, 0.4),
        0 0 24px rgba(34, 211, 238, 0.2);
}

.spectacle-lenses-description {
    font-size: 1.2em;
    color: var(--text);
    opacity: 0.8;
    margin: 0 0 40px 0;
    line-height: 1.6;
}

.btn-spectacle-lenses-start {
    padding: 16px 48px;
    background: linear-gradient(135deg, rgba(34, 211, 238, 0.2), rgba(124, 58, 237, 0.15));
    border: 2px solid rgba(34, 211, 238, 0.4);
    border-radius: 12px;
    color: var(--cyan);
    font-family: 'Monitorica', sans-serif;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-spectacle-lenses-start:hover {
    background: linear-gradient(135deg, rgba(34, 211, 238, 0.3), rgba(124, 58, 237, 0.2));
    border-color: rgba(34, 211, 238, 0.6);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(34, 211, 238, 0.2);
}

.btn-spectacle-lenses-start:active {
    transform: translateY(0);
}

/* Выбор типа очков */
.spectacle-lenses-type-selection {
    max-width: 900px;
    margin: 0 auto;
    padding: 12px;
}

.type-selection-header {
    text-align: center;
    margin-bottom: 24px;
}

.type-selection-description {
    font-size: 1em;
    color: var(--muted);
    margin-top: 8px;
    opacity: 0.8;
}

.type-selection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.type-selection-btn {
    padding: 16px 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(34, 211, 238, 0.2);
    border-radius: 10px;
    color: var(--text);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
}

.type-selection-btn:hover {
    background: rgba(34, 211, 238, 0.1);
    border-color: rgba(34, 211, 238, 0.5);
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(34, 211, 238, 0.2);
}

.type-selection-btn:active {
    transform: translateY(-2px);
}

.type-btn-icon {
    font-size: 2em;
    line-height: 1;
}

.type-btn-label {
    font-family: 'Monitorica', sans-serif;
    font-size: 0.9em;
    font-weight: 600;
    color: var(--cyan);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ============================================
   PREMIUM RECIPE FORM - Premium UI System
   ============================================ */

/* Интерфейс ввода рецепта */
.spectacle-lenses-recipe {
    max-width: 900px;
    margin: 0 auto;
    padding: 12px;
    overflow-x: hidden;
}

.recipe-header {
    margin-bottom: 14px;
    text-align: center;
}

.recipe-title {
    font-family: 'Monitorica', sans-serif;
    font-size: 19px;
    font-weight: 600;
    background: linear-gradient(135deg, rgba(34, 211, 238, 0.95) 0%, rgba(124, 58, 237, 0.85) 50%, rgba(34, 211, 238, 0.95) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0 0 8px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
    line-height: 1.3;
    text-shadow: 0 0 20px rgba(34, 211, 238, 0.3);
    filter: drop-shadow(0 0 8px rgba(34, 211, 238, 0.2));
}

.recipe-selected-type {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(34, 211, 238, 0.1);
    border: 1px solid rgba(34, 211, 238, 0.3);
    border-radius: 6px;
    margin-top: 10px;
}

.selected-type-label {
    font-family: 'Monitorica', sans-serif;
    font-size: 0.9em;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.selected-type-value {
    font-family: 'Orbitron', monospace;
    font-size: 1em;
    color: var(--cyan);
    font-weight: 600;
}

.btn-change-type {
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    color: var(--text);
    font-family: 'Monitorica', sans-serif;
    font-size: 0.85em;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-left: 8px;
}

.btn-change-type:hover {
    background: rgba(34, 211, 238, 0.15);
    border-color: rgba(34, 211, 238, 0.4);
    color: var(--cyan);
}

/* Форма ввода рецепта */
.recipe-form {
    max-width: 800px;
    margin: 0 auto;
}

.recipe-form-section {
    background: linear-gradient(180deg, 
        rgba(255, 255, 255, 0.04) 0%, 
        rgba(255, 255, 255, 0.02) 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--recipe-radius-panel);
    padding: 14px;
    margin-bottom: 10px;
    box-shadow: 
        inset 0 1px 2px rgba(255, 255, 255, 0.05),
        0 4px 12px rgba(0, 0, 0, 0.3),
        0 1px 0 rgba(255, 255, 255, 0.05);
    transition: all var(--recipe-transition-base);
    position: relative;
}

.recipe-form-section::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--recipe-radius-panel);
    padding: 1px;
    background: linear-gradient(180deg, 
        rgba(255, 255, 255, 0.08) 0%, 
        transparent 50%,
        rgba(255, 255, 255, 0.02) 100%);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    mask-composite: exclude;
    pointer-events: none;
    opacity: 0.6;
}

.recipe-form-section:last-of-type {
    margin-bottom: 0;
}

.recipe-form-section:hover {
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 
        inset 0 1px 2px rgba(255, 255, 255, 0.08),
        0 6px 20px rgba(0, 0, 0, 0.4),
        0 1px 0 rgba(255, 255, 255, 0.08);
    transform: translateY(-1px);
}

.recipe-section-title {
    font-family: 'Monitorica', sans-serif;
    font-size: 14px;
    color: rgba(234, 242, 255, 0.9);
    margin: 0 0 10px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    line-height: 1.4;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    overflow-wrap: break-word;
    word-break: break-word;
}

.recipe-form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(115px, 1fr));
    gap: 10px;
}

.recipe-form-row + .recipe-form-row {
    margin-top: 14px;
}

/* ===== Субъективные тесты (дуохромный / Уорта / Шобера) ===== */
/* Карточки-триггеры в diagSubjectiveTestsSection (см. app.html) — сама карточка
   только показывает краткий итог, тест открывается поверх экрана (см. ниже
   .subj-test-overlay) через openSubjectiveTest() в app.js. */
.subjective-tests-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
}

.subjective-test-card {
    appearance: none;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    text-align: left;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.02) 100%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--recipe-radius-panel);
    padding: 12px 14px;
    cursor: pointer;
    transition: all var(--recipe-transition-base);
    font-family: inherit;
}

.subjective-test-card:hover {
    border-color: rgba(34, 211, 238, 0.4);
    box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.15), 0 6px 16px rgba(0, 0, 0, 0.35);
    transform: translateY(-1px);
}

.subjective-test-card-title {
    font-family: 'Monitorica', sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: rgba(234, 242, 255, 0.92);
    letter-spacing: 0.3px;
}

.subjective-test-card-hint {
    font-size: 11px;
    color: rgba(234, 242, 255, 0.5);
}

.subjective-test-card-result {
    margin-top: 4px;
    font-size: 12px;
    font-weight: 600;
    color: rgba(234, 242, 255, 0.45);
}

/* Карточка уже пройденного теста — акцент цветом, как у остальных "готово"-состояний */
.subjective-test-card.is-done {
    border-color: rgba(74, 222, 128, 0.35);
}

.subjective-test-card.is-done .subjective-test-card-result {
    color: var(--green, #4ade80);
}

/* Полноэкранный оверлей теста — тот же принцип, что recipe-picker-overlay
   (fixed + flex-center + затемнённый фон), но модалка крупнее и с HUD-стилем,
   т.к. внутри реальный интерактивный тест, а не список значений. */
.subj-test-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.subj-test-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    cursor: pointer;
}

/* "Плавный переход как HUD-экран" — карточка появляется чуть увеличиваясь из
   полупрозрачного состояния, а не просто вспыхивает; см. .panel--hud/.hud-corner
   выше — переиспользуем тот же язык (цветной градиентный контур + уголки),
   чтобы тест визуально ощущался частью того же интерфейса, что и остальной сайт. */
@keyframes subjTestModalIn {
    from { opacity: 0; transform: scale(0.94) translateY(6px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.subj-test-modal {
    position: relative;
    width: 100%;
    max-width: 560px;
    max-height: 88vh;
    overflow-y: auto;
    background: linear-gradient(180deg, rgba(17, 30, 50, 0.98) 0%, rgba(11, 22, 48, 0.98) 100%);
    border-radius: 14px;
    padding: 18px;
    animation: subjTestModalIn 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.subj-test-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.subj-test-title {
    font-family: 'Monitorica', sans-serif;
    font-size: 15px;
    font-weight: 700;
    color: rgba(34, 211, 238, 0.95);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.subj-test-subtitle {
    margin-top: 3px;
    font-size: 12px;
    color: rgba(234, 242, 255, 0.55);
}

.subj-test-close {
    appearance: none;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    color: rgba(234, 242, 255, 0.7);
    width: 30px;
    height: 30px;
    flex: 0 0 auto;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
}

.subj-test-close:hover {
    border-color: rgba(255, 255, 255, 0.35);
    color: #fff;
}

.subj-test-header-actions {
    display: flex;
    gap: 8px;
    flex: 0 0 auto;
}

/* Кнопка "?" — короткая справка про тест (определение + нюансы, см.
   showSubjTestInfo/SUBJ_TEST_INFO в app.js). Циан-акцент, чтобы отличаться от
   нейтральной кнопки закрытия рядом. */
.subj-test-info-btn {
    appearance: none;
    background: rgba(34, 211, 238, 0.1);
    border: 1px solid rgba(34, 211, 238, 0.4);
    border-radius: 50%;
    color: rgba(34, 211, 238, 0.95);
    width: 30px;
    height: 30px;
    flex: 0 0 auto;
    font: 700 14px 'Monitorica', sans-serif;
    line-height: 1;
    cursor: pointer;
}

.subj-test-info-btn:hover {
    background: rgba(34, 211, 238, 0.2);
    border-color: rgba(34, 211, 238, 0.7);
    color: #fff;
}

/* Попап справки — отдельный, ПОВЕРХ самого теста (выше z-index), чтобы не
   терять прогресс/введённые ответы при открытии/закрытии — см. .subj-test-overlay
   z-index:10000 выше. */
.subj-test-info-overlay {
    position: fixed;
    inset: 0;
    z-index: 10010;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.subj-test-info-popup {
    position: relative;
    width: 100%;
    max-width: 420px;
    max-height: 80vh;
    overflow-y: auto;
    background: linear-gradient(180deg, rgba(17, 30, 50, 0.98) 0%, rgba(11, 22, 48, 0.98) 100%);
    border: 1px solid rgba(34, 211, 238, 0.3);
    border-radius: 14px;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 24px rgba(34, 211, 238, 0.15);
    padding: 16px;
    animation: subjTestModalIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.subj-test-info-popup-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.subj-test-info-popup-title {
    font-family: 'Monitorica', sans-serif;
    font-size: 14px;
    font-weight: 700;
    color: rgba(34, 211, 238, 0.95);
    line-height: 1.3;
}

.subj-test-info-definition {
    margin: 0 0 12px;
    font-size: 13px;
    line-height: 1.55;
    color: rgba(234, 242, 255, 0.88);
}

.subj-test-info-nuances-title {
    font-family: 'Monitorica', sans-serif;
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: rgba(234, 242, 255, 0.55);
    margin-bottom: 6px;
}

.subj-test-info-nuances {
    margin: 0;
    padding-left: 18px;
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.subj-test-info-nuances li {
    font-size: 12.5px;
    line-height: 1.5;
    color: rgba(234, 242, 255, 0.8);
}

/* Общая кнопка-вариант ответа — переиспользуется во всех трёх тестах
   (дуохром: красный/зелёный/одинаково; Уорт: характер зрения, супрессия,
   цвет нижней точки; Шобер: супрессия). */
.subj-answer-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.subj-answer-btn {
    appearance: none;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    padding: 9px 14px;
    background: rgba(255, 255, 255, 0.04);
    color: rgba(234, 242, 255, 0.85);
    font: 600 12.5px 'Monitorica', sans-serif;
    cursor: pointer;
    transition: all var(--recipe-transition-base);
}

.subj-answer-btn:hover {
    border-color: rgba(34, 211, 238, 0.4);
}

.subj-answer-btn.selected {
    border-color: rgba(34, 211, 238, 0.7);
    background: rgba(34, 211, 238, 0.16);
    color: #fff;
    box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.25);
}

.subj-test-result-line {
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    background: rgba(74, 222, 128, 0.08);
    border: 1px solid rgba(74, 222, 128, 0.25);
    color: rgba(220, 255, 230, 0.9);
    font-size: 12.5px;
    display: none;
}

.subj-test-result-line.visible {
    display: block;
}

/* Живая правка 2026-08-20: по прямой просьбе пользователя — после выбора
   варианта в группе (характер зрения, супрессия и т.п.) остальные варианты
   исчезают, остаётся только сама выбранная строка + кнопка "Изменить" (не
   молча пропадает совсем — иначе непонятно, что вообще выбрано). См.
   buildChoiceGroupHtml/wireChoiceGroups в app.js. */
.subj-choice-collapsed {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    border: 1px solid rgba(34, 211, 238, 0.4);
    background: rgba(34, 211, 238, 0.1);
    border-radius: 8px;
    padding: 9px 12px;
}

.subj-choice-collapsed-label {
    font-size: 12.5px;
    font-weight: 600;
    color: #fff;
}

.subj-choice-change {
    appearance: none;
    border: none;
    background: transparent;
    color: rgba(34, 211, 238, 0.9);
    font: 700 12px 'Monitorica', sans-serif;
    text-decoration: underline;
    cursor: pointer;
    flex: 0 0 auto;
}

/* Футер "Отменить всё"/"Сохранить" — общий для всех 3 тестов (см.
   buildSubjTestFooterHtml в app.js). "Сохранить" появляется только когда тест
   уже дал достаточно данных для сохранения результата (закрывает оверлей —
   данные и так пишутся сразу по каждому клику, это просто явное "готово"). */
.subj-test-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.subj-test-cancel-all {
    appearance: none;
    border: 1px solid rgba(255, 99, 99, 0.35);
    background: rgba(255, 99, 99, 0.08);
    color: rgba(255, 154, 154, 0.95);
    border-radius: 8px;
    padding: 9px 14px;
    font: 700 12.5px 'Monitorica', sans-serif;
    cursor: pointer;
}

.subj-test-cancel-all:hover {
    border-color: rgba(255, 99, 99, 0.6);
    background: rgba(255, 99, 99, 0.14);
}

.subj-test-save {
    margin-left: auto;
}

/* --- Дуохромный тест --- */
.subj-duo-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
}

.subj-duo-tab {
    appearance: none;
    flex: 1 1 0;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 7px;
    padding: 7px 0;
    background: rgba(255, 255, 255, 0.03);
    color: rgba(234, 242, 255, 0.7);
    font: 700 12px 'Monitorica', sans-serif;
    cursor: pointer;
}

.subj-duo-tab.active {
    border-color: rgba(34, 211, 238, 0.6);
    color: #fff;
    background: rgba(34, 211, 238, 0.14);
}

.subj-duo-tab.answered::after {
    content: " ✓";
    color: var(--green, #4ade80);
}

.subj-duo-stage {
    display: grid;
    grid-template-columns: 1fr 1fr;
    height: 180px;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.subj-duo-half {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 6px;
}

.subj-duo-half-red {
    background: #7a1414;
}

.subj-duo-half-green {
    background: #12591f;
}

/* Живая правка 2026-08-20 (пользователь потестировал вживую): выбор ответа
   должен визуально размывать НЕВЫБРАННЫЙ фон (если чётче на красном — зелёный
   уходит в лёгкий блюр, и наоборот) — так карточка сама подтверждает выбор, а
   не просто подсвечивает кнопку где-то ниже. */
.subj-duo-half-blurred {
    filter: blur(2.5px);
    opacity: 0.55;
}

.subj-duo-letters {
    font-family: Georgia, 'Times New Roman', serif;
    font-weight: 700;
    color: #0c0c0c;
    letter-spacing: 4px;
    text-align: center;
    line-height: 1.3;
}

.subj-duo-letters span {
    display: block;
}

.subj-duo-letters .l1 { font-size: 30px; }
.subj-duo-letters .l2 { font-size: 22px; }
.subj-duo-letters .l3 { font-size: 15px; }

/* --- Тест Уорта ---
   Живая правка 2026-08-20 (дважды): реальная мишень — не 4 одинаковых кружка, а
   разные формы: КРАСНЫЙ РОМБ сверху (виден только OD, красный фильтр), 2
   ЗЕЛЁНЫХ КРЕСТА по бокам (видны только OS, зелёный фильтр), кружок снизу
   (виден ОБОИМ глазами одновременно — единственный общий элемент, поэтому его
   цвет в бинокулярном ответе показывает, чей глаз доминирует). Показ/цвет
   каждого элемента переключается по выбранному ответу — см. worthVisualState
   в app.js.

   Вторая правка (та же сессия): позиции элементов раньше считались в
   процентах от ШИРОКОЙ прямоугольной сцены (.subj-worth-stage) — из-за этого
   ромб на широких экранах оказывался ближе к центру по горизонтали, чем по
   вертикали, и вся мишень выглядела "сплюснутой", не симметричной. Теперь
   все 4 элемента лежат внутри отдельного ФИКСИРОВАННОГО квадрата
   .subj-worth-target (170×170px, центрирован во flex-контейнере сцены) и
   позиционируются в пикселях от его краёв — геометрия мишени больше не
   зависит от ширины самой сцены/модалки. */
.subj-worth-stage {
    position: relative;
    height: 200px;
    border-radius: 10px;
    background: #05070d;
    border: 1px solid rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
}

.subj-worth-target {
    position: relative;
    width: 170px;
    height: 170px;
    flex: 0 0 auto;
}

/* Живая правка 2026-08-20: ромб визуально казался крупнее креста/кружка рядом —
   у повёрнутого на 45° квадрата видимый размер (по диагонали) заметно больше
   стороны самого квадрата (диагональ = сторона × √2 ≈ ×1.41). 28px-квадрат
   выглядел как ~40px-ромб. Сторону уменьшили до 19px — диагональ ≈27px,
   вровень с 30px-крестом и 26px-кружком. */
.subj-worth-diamond-top {
    position: absolute;
    top: 12px;
    left: 50%;
    width: 19px;
    height: 19px;
    background: #ff3b3b;
    box-shadow: 0 0 10px rgba(255, 59, 59, 0.75);
    transform: translateX(-50%) rotate(45deg);
    transition: opacity 0.2s;
}

.subj-worth-cross-side {
    position: absolute;
    top: 50%;
    width: 30px;
    height: 30px;
    transform: translateY(-50%);
    transition: opacity 0.2s;
}

.subj-worth-cross-side::before,
.subj-worth-cross-side::after {
    content: "";
    position: absolute;
    background: #2ee06a;
    box-shadow: 0 0 10px rgba(46, 224, 106, 0.6);
}

.subj-worth-cross-side::before { left: 50%; top: 0; width: 6px; height: 100%; transform: translateX(-50%); }
.subj-worth-cross-side::after { top: 50%; left: 0; height: 6px; width: 100%; transform: translateY(-50%); }

.subj-worth-cross-left { left: 4px; }
.subj-worth-cross-right { right: 4px; }

.subj-worth-circle {
    position: absolute;
    bottom: 8px;
    left: 50%;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #f0a3bc;
    box-shadow: 0 0 10px rgba(240, 163, 188, 0.6);
    transform: translateX(-50%);
    transition: background 0.2s, box-shadow 0.2s, left 0.2s, bottom 0.2s;
}

/* Живая правка 2026-08-20 (дважды, второй раз по кропу реального пособия от
   пользователя, с его же словесным разбором "что где") — "одновременное
   зрение" (диплопия) это НЕ раздвоение одного только нижнего кружка, а
   расхождение ВСЕЙ мишени на два целых кластера: "красный" (ромб + красный
   кружок, держатся рядом друг с другом) и "зелёный" (оба креста + зелёный
   кружок, тоже рядом друг с другом) — кластеры разъезжаются в разные стороны
   (сходящийся/расходящийся — по горизонтали, зеркально; вертикальный — красный
   кластер остаётся на обычном месте ромба/нижней точки, зелёный кластер
   стягивается к центру и приподнимается). Точные координаты — SUBJ_WORTH_
   DIPLOPIA_LAYOUT в app.js, здесь только "форма" самого элемента (эту же
   позицию любой из 5 элементов получает через инлайновые left/top). */
.subj-worth-diplopia-el {
    position: absolute;
    transform: translate(-50%, -50%);
    transition: opacity 0.2s, left 0.25s, top 0.25s;
}

.subj-worth-diplopia-el.is-diamond {
    width: 19px;
    height: 19px;
    background: #ff3b3b;
    box-shadow: 0 0 10px rgba(255, 59, 59, 0.75);
    transform: translate(-50%, -50%) rotate(45deg);
}

.subj-worth-diplopia-el.is-cross {
    width: 30px;
    height: 30px;
}

.subj-worth-diplopia-el.is-cross::before,
.subj-worth-diplopia-el.is-cross::after {
    content: "";
    position: absolute;
    background: #2ee06a;
    box-shadow: 0 0 10px rgba(46, 224, 106, 0.6);
}

.subj-worth-diplopia-el.is-cross::before { left: 50%; top: 0; width: 6px; height: 100%; transform: translateX(-50%); }
.subj-worth-diplopia-el.is-cross::after { top: 50%; left: 0; height: 6px; width: 100%; transform: translateY(-50%); }

.subj-worth-diplopia-el.is-circle {
    width: 26px;
    height: 26px;
    border-radius: 50%;
}


/* --- Тест Шобера ---
   Живая правка 2026-08-20 (реальный вид инструмента + прямая правка
   пользователя): крест крупнее, круг — только КОНТУР (не заливка) на чёрном
   фоне, а перетаскивать крест можно и ЗА пределы круга — это и есть типичный
   признак выраженной фории/декомпенсации, тогда как положение В пределах круга
   может быть нормой (поэтому область перетаскивания .subj-schober-stage
   заметно больше самого кольца .subj-schober-center-ring). */
.subj-schober-wrap {
    display: flex;
    justify-content: center;
    padding: 6px 0 4px;
}

.subj-schober-stage {
    position: relative;
    width: 260px;
    height: 260px;
    border-radius: 50%;
    background: #000;
    border: 1px solid rgba(255, 255, 255, 0.12);
    touch-action: none;
    cursor: grab;
}

.subj-schober-stage:active {
    cursor: grabbing;
}

/* Кольцо — сам зелёный круг мишени: только контур, внутри чёрный фон сцены
   (не заливка) — так выглядит настоящий инструмент. */
.subj-schober-center-ring {
    position: absolute;
    inset: 0;
    margin: auto;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    border: 3px solid #1f9e3b;
    box-shadow: 0 0 10px rgba(31, 158, 59, 0.45), inset 0 0 10px rgba(31, 158, 59, 0.25);
    pointer-events: none;
}

.subj-schober-cross {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 52px;
    height: 52px;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.subj-schober-cross::before,
.subj-schober-cross::after {
    content: "";
    position: absolute;
    background: #e5231b;
    box-shadow: 0 0 10px rgba(229, 35, 27, 0.85);
}

.subj-schober-cross::before {
    left: 50%;
    top: 0;
    width: 8px;
    height: 100%;
    transform: translateX(-50%);
}

.subj-schober-cross::after {
    top: 50%;
    left: 0;
    height: 8px;
    width: 100%;
    transform: translateY(-50%);
}

.subj-schober-label {
    text-align: center;
    margin-top: 10px;
    font-family: 'Monitorica', sans-serif;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.4px;
}

@media (max-width: 620px) {
    .subj-test-modal { max-width: 100%; padding: 14px; }
    .subj-duo-stage { height: 150px; }
    .subj-worth-stage { height: 170px; }
    .subj-worth-target { width: 150px; height: 150px; }
    .subj-schober-stage { width: 220px; height: 220px; }
    .subj-schober-center-ring { width: 118px; height: 118px; }
    .subj-schober-cross { width: 44px; height: 44px; }
}

/* Явные подписанные боксы OD/OS в форме рецепта (buildPrescriptionCardHtml) —
   до этого SPH/CYL/AXIS/ADD обоих глаз были просто двумя рядами подряд,
   различимыми только по префиксу "OD"/"OS" в подписи КАЖДОГО поля. На
   мобильном .recipe-form-row укладывается в один столбец (см. media query
   ниже) — 8 полей подряд визуально сливались в одну колонку, специалист мог
   промахнуться глазом при вводе. Жалоба 2026-08-15. Тот же приём, что и в
   read-only виде визита (.visit-detail-eye-col/-label) — цветная рамка +
   плашка-подпись, а не только текст в лейбле поля. */
.recipe-eye-group {
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--recipe-radius-panel);
    padding: 10px 10px 12px;
    margin-bottom: 14px;
}

.recipe-eye-group-od {
    border-left: 3px solid var(--cyan);
}

.recipe-eye-group-os {
    border-left: 3px solid var(--violet);
}

.recipe-eye-group-label {
    font-family: 'Monitorica', sans-serif;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: var(--bg0);
    background: var(--cyan);
    display: inline-block;
    width: fit-content;
    padding: 3px 10px;
    border-radius: 6px;
    margin-bottom: 8px;
}

.recipe-eye-group-os .recipe-eye-group-label {
    background: var(--violet);
}

.recipe-form-row-monocular {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.recipe-form-row-first-glasses .recipe-form-field {
    min-width: 0;
}

.recipe-form-input-wrap,
.recipe-form-pd-sum-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.recipe-form-input-wrap .recipe-form-input {
    flex: 1;
    min-width: 0;
}

.recipe-form-reset-btn {
    flex-shrink: 0;
    padding: 8px 12px;
    font-family: 'Monitorica', sans-serif;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(234, 242, 255, 0.7);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--recipe-radius-input);
    cursor: pointer;
    transition: all var(--recipe-transition-base);
}

.recipe-form-reset-btn:hover {
    color: rgba(234, 242, 255, 0.95);
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.18);
}

.recipe-form-pd-sum-wrap {
    align-items: stretch;
}

.recipe-form-pd-sum-wrap .recipe-form-pd-sum {
    flex: 1;
    min-width: 0;
}

.recipe-form-field-pd-sum .recipe-form-pd-sum {
    padding: 10px 12px;
    font-family: 'Orbitron', monospace;
    font-size: 15px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    color: rgba(234, 242, 255, 0.95);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--recipe-radius-input);
    min-height: 42px;
}

.recipe-form-radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.recipe-form-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.recipe-form-label {
    font-family: 'Monitorica', sans-serif;
    font-size: 12px;
    color: var(--recipe-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
    line-height: 1.3;
    overflow-wrap: break-word;
    word-break: break-word;
}

.recipe-form-input {
    width: 100%;
    min-width: 0;
    padding: 10px 12px;
    background: linear-gradient(180deg, 
        rgba(255, 255, 255, 0.08) 0%, 
        rgba(255, 255, 255, 0.04) 100%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--recipe-radius-input);
    color: rgba(234, 242, 255, 0.95);
    font-family: 'Orbitron', monospace;
    font-size: 15px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    transition: all var(--recipe-transition-base);
    box-sizing: border-box;
    line-height: 1.4;
    box-shadow: 
        inset 0 1px 2px rgba(0, 0, 0, 0.2),
        0 1px 0 rgba(255, 255, 255, 0.05);
}

.recipe-form-input:hover:not(:disabled):not(:focus) {
    border-color: rgba(255, 255, 255, 0.2);
    background: linear-gradient(180deg, 
        rgba(255, 255, 255, 0.1) 0%, 
        rgba(255, 255, 255, 0.06) 100%);
    box-shadow: 
        inset 0 1px 2px rgba(0, 0, 0, 0.15),
        0 2px 4px rgba(0, 0, 0, 0.2),
        0 1px 0 rgba(255, 255, 255, 0.08);
    transform: translateY(-1px);
}

.recipe-form-input:focus {
    outline: none;
    border-color: rgba(34, 211, 238, 0.6);
    background: linear-gradient(180deg, 
        rgba(255, 255, 255, 0.12) 0%, 
        rgba(255, 255, 255, 0.08) 100%);
    box-shadow: 
        0 0 0 2px rgba(34, 211, 238, 0.15),
        0 0 10px rgba(34, 211, 238, 0.2),
        inset 0 1px 2px rgba(255, 255, 255, 0.1);
    color: rgba(234, 242, 255, 1);
}

.recipe-form-input:focus + .recipe-form-label,
.recipe-form-field:has(.recipe-form-input:focus) .recipe-form-label {
    color: rgba(34, 211, 238, 0.9);
    text-shadow: 0 0 8px rgba(34, 211, 238, 0.3);
}

.recipe-form-input:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: rgba(255, 255, 255, 0.02);
    border-color: rgba(255, 255, 255, 0.05);
}

.recipe-form-input::placeholder {
    color: rgba(234, 242, 255, 0.4);
    opacity: 1;
}

.recipe-form-input.error {
    border-color: var(--recipe-danger);
    background: rgba(239, 68, 68, 0.05);
}

.recipe-form-input.error:focus {
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.15);
}

.recipe-form-error {
    font-family: 'Monitorica', sans-serif;
    font-size: 11px;
    color: var(--recipe-danger);
    margin-top: 2px;
    line-height: 1.3;
    min-height: 14px;
    display: block;
}

.recipe-form-error:empty {
    display: none;
}

/* Поля с селектором — кликабельные */
.recipe-form-input-picker {
    cursor: pointer;
}

/* AXIS — единственное поле-пикер, где по прямому фидбэку тестировщика (Штрикунова
   П., 2026-08-23: "каждый второй с астигматикой... большую часть времени листаю
   туда-сюда") дан выбор — вводить значение вручную ИЛИ открыть прокрутку кнопкой
   рядом, а не только скроллить. Инпут здесь — обычное редактируемое поле (не
   readonly, без onclick), кнопка — единственный вход в прежний колёсный пикер
   (см. showPatientsPicker/clampAxisManualInput* в app.js). */
.axis-input-row {
    display: flex;
    flex-direction: row;
    gap: 6px;
    align-items: stretch;
}

.axis-input-row .recipe-form-input {
    flex: 1 1 auto;
    min-width: 0;
    cursor: text;
}

.axis-picker-btn {
    flex: 0 0 auto;
    width: 38px;
    padding: 0;
    background: linear-gradient(180deg,
        rgba(255, 255, 255, 0.08) 0%,
        rgba(255, 255, 255, 0.04) 100%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--recipe-radius-input);
    color: rgba(234, 242, 255, 0.8);
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
    transition: all var(--recipe-transition-base);
}

.axis-picker-btn:hover:not(:disabled) {
    border-color: rgba(255, 255, 255, 0.25);
    color: rgba(234, 242, 255, 1);
}

.axis-picker-btn:disabled {
    opacity: 0.4;
    cursor: default;
}

/* Picker overlay — окно выбора диоптрий */
.recipe-picker-overlay {
    position: fixed;
    inset: 0;
    /* Живая находка 2026-08-26: пикер (см. showPatientsPicker/showClinicalAxisPicker)
       может открываться и из полей внутри .clinical-step-overlay (z-index 10060) —
       при z-index 10000 колесо рендерилось НИЖЕ модалки и было невидимым, хотя и
       кликабельным по факту (клик проходил в фон). Пикер должен быть выше любой
       модалки, из которой его можно открыть. */
    z-index: 10070;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.recipe-picker-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    cursor: pointer;
}

.recipe-picker-modal {
    position: relative;
    width: 100%;
    max-width: 320px;
    max-height: 70vh;
    background: linear-gradient(180deg, 
        rgba(17, 30, 50, 0.98) 0%, 
        rgba(11, 22, 48, 0.98) 100%);
    border: 1px solid rgba(34, 211, 238, 0.3);
    border-radius: 12px;
    box-shadow: 
        0 0 0 1px rgba(255, 255, 255, 0.08),
        0 20px 60px rgba(0, 0, 0, 0.5),
        0 0 24px rgba(34, 211, 238, 0.15);
    overflow: hidden;
}

.recipe-picker-title {
    padding: 14px 16px;
    font-family: 'Monitorica', sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: rgba(34, 211, 238, 0.95);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.recipe-picker-viewport {
    position: relative;
    height: 220px;
    overflow: hidden;
}

.recipe-picker-frame {
    position: absolute;
    left: 8px;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    height: 44px;
    border: 2px solid rgba(34, 211, 238, 0.6);
    border-radius: 8px;
    box-shadow: 0 0 12px rgba(34, 211, 238, 0.25);
    pointer-events: none;
    z-index: 2;
}

.recipe-picker-list {
    height: 100%;
    overflow-y: auto;
    padding: 88px 8px 88px;
    scroll-snap-type: y mandatory;
    -webkit-mask-image: linear-gradient(to bottom, 
        transparent 0%, 
        black 15%, 
        black 85%, 
        transparent 100%);
    mask-image: linear-gradient(to bottom, 
        transparent 0%, 
        black 15%, 
        black 85%, 
        transparent 100%);
}

.recipe-picker-item {
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Orbitron', monospace;
    font-size: 15px;
    color: rgba(234, 242, 255, 0.35);
    cursor: pointer;
    transition: color 0.15s ease;
    scroll-snap-align: center;
}

/* Пикер значений на вкладке "Пациенты" помечен .patients-picker-overlay при
   создании (showPatientsPicker). Числовые пикеры (диоптрии, PD, углы) остаются
   на базовом Orbitron — как в рецепте на вкладке "Очковые линзы"; только
   текстовые пикеры (дизайн/модификация/технология) получают .patients-picker-text
   и переключаются на Monitorica, как остальная карта пациента. */
.patients-picker-overlay.patients-picker-text .recipe-picker-item {
    font-family: 'Monitorica', sans-serif;
}

.recipe-picker-item.selected {
    color: rgba(34, 211, 238, 1);
    font-weight: 600;
    text-shadow: 0 0 20px rgba(34, 211, 238, 0.5);
}

/* Чекбоксы типов очков - в стиле полей ввода */
.lens-types-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 8px;
}

.lens-type-checkbox {
    display: flex;
    flex-direction: column;
    gap: 4px;
    cursor: pointer;
    user-select: none;
}

/* Отделяем переключатель посадки от поля дегрессии на узких экранах. */
.office-individual-toggle {
    margin-top: 14px;
}

/* "Для постоянного ношения" в карточке рецепта (buildPrescriptionCardHtml) —
   без явного margin-bottom плашка вплотную примыкала к следующему блоку
   (боксу OD), на мобильном это выглядело как наложение — жалоба 2026-08-15. */
.permanent-wear-toggle {
    margin-top: 10px;
    margin-bottom: 16px;
}

/* Заблокированный чекбокс (например, "Эксцентрично" при недоступной
   субъективной рефракции — см. updateSubjectiveRefractionLock) — та же
   приглушённая трактовка, что и у .recipe-form-input:disabled */
.lens-type-checkbox:has(input:disabled) {
    cursor: not-allowed;
    opacity: 0.4;
}

.lens-type-checkbox input[type="checkbox"],
.lens-type-checkbox input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.checkbox-value {
    display: block;
    width: 100%;
    min-width: 0;
    padding: 10px 12px;
    background: linear-gradient(180deg, 
        rgba(255, 255, 255, 0.06) 0%, 
        rgba(255, 255, 255, 0.03) 100%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--recipe-radius-input);
    font-family: 'Monitorica', sans-serif;
    font-size: 13px;
    color: rgba(234, 242, 255, 0.7);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
    transition: all var(--recipe-transition-base);
    box-sizing: border-box;
    min-height: 40px;
    overflow-wrap: break-word;
    word-break: break-word;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1.4;
    box-shadow: 
        inset 0 1px 2px rgba(0, 0, 0, 0.15),
        0 1px 0 rgba(255, 255, 255, 0.05);
    position: relative;
}

.lens-type-checkbox:hover .checkbox-value:not(:has(+ input:checked)) {
    background: linear-gradient(180deg, 
        rgba(255, 255, 255, 0.1) 0%, 
        rgba(255, 255, 255, 0.06) 100%);
    border-color: rgba(255, 255, 255, 0.2);
    color: rgba(234, 242, 255, 0.9);
    box-shadow: 
        inset 0 1px 2px rgba(0, 0, 0, 0.1),
        0 3px 8px rgba(0, 0, 0, 0.25),
        0 1px 0 rgba(255, 255, 255, 0.08);
    transform: translateY(-2px);
}

.lens-type-checkbox input[type="checkbox"]:checked ~ .checkbox-value,
.lens-type-checkbox input[type="radio"]:checked ~ .checkbox-value {
    background: linear-gradient(135deg,
        rgba(34, 211, 238, 0.2) 0%, 
        rgba(124, 58, 237, 0.15) 100%);
    border-color: rgba(34, 211, 238, 0.5);
    color: rgba(34, 211, 238, 1);
    font-weight: 600;
    box-shadow: 
        0 0 0 1px rgba(34, 211, 238, 0.3),
        0 4px 12px rgba(34, 211, 238, 0.2),
        inset 0 1px 2px rgba(255, 255, 255, 0.1);
    text-shadow: 0 0 8px rgba(34, 211, 238, 0.4);
    transform: translateY(-1px);
}

.lens-type-checkbox input[type="checkbox"]:checked ~ .checkbox-value::before,
.lens-type-checkbox input[type="radio"]:checked ~ .checkbox-value::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--recipe-radius-input);
    background: linear-gradient(135deg, 
        rgba(34, 211, 238, 0.1) 0%, 
        transparent 50%,
        rgba(124, 58, 237, 0.1) 100%);
    pointer-events: none;
}

.recipe-form-actions {
    margin-top: 14px;
    display: flex;
    justify-content: center;
    padding-top: 14px;
    border-top: 1px solid var(--recipe-border);
}

.btn-recipe-analyze {
    padding: 10px 28px;
    background: linear-gradient(135deg, 
        rgba(34, 211, 238, 0.3) 0%, 
        rgba(124, 58, 237, 0.25) 50%,
        rgba(34, 211, 238, 0.3) 100%);
    border: 1px solid rgba(34, 211, 238, 0.5);
    border-radius: var(--recipe-radius-button);
    color: rgba(34, 211, 238, 1);
    font-family: 'Monitorica', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--recipe-transition-base);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    box-shadow: 
        0 4px 16px rgba(34, 211, 238, 0.3),
        0 2px 8px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
    min-width: 160px;
    text-shadow: 0 0 12px rgba(34, 211, 238, 0.5);
}

.btn-recipe-analyze::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, 
        rgba(34, 211, 238, 0.2) 0%, 
        rgba(124, 58, 237, 0.15) 50%,
        rgba(34, 211, 238, 0.2) 100%);
    opacity: 0;
    transition: opacity var(--recipe-transition-base);
}

.btn-recipe-analyze::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, 
        rgba(255, 255, 255, 0.2) 0%, 
        transparent 50%);
    pointer-events: none;
    border-radius: var(--recipe-radius-button);
}

.btn-recipe-analyze:hover:not(:disabled) {
    background: linear-gradient(135deg, 
        rgba(34, 211, 238, 0.4) 0%, 
        rgba(124, 58, 237, 0.35) 50%,
        rgba(34, 211, 238, 0.4) 100%);
    border-color: rgba(34, 211, 238, 0.7);
    box-shadow: 
        0 6px 24px rgba(34, 211, 238, 0.4),
        0 3px 12px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.3),
        0 0 20px rgba(34, 211, 238, 0.3);
    transform: translateY(-2px);
    text-shadow: 0 0 16px rgba(34, 211, 238, 0.7);
}

.btn-recipe-analyze:hover:not(:disabled)::before {
    opacity: 1;
}

.btn-recipe-analyze:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 
        0 2px 8px rgba(34, 211, 238, 0.3),
        0 1px 4px rgba(0, 0, 0, 0.3),
        inset 0 1px 2px rgba(0, 0, 0, 0.2);
}

.btn-recipe-analyze:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    text-shadow: none;
}

.btn-recipe-analyze:disabled::before,
.btn-recipe-analyze:disabled::after {
    display: none;
}

.thinking-dots {
    display: inline-block;
}

.thinking-dots::after {
    content: '...';
    animation: thinkingDots 1.5s steps(4, end) infinite;
}

@keyframes thinkingDots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

/* Страница ожидания анализа */
.spectacle-lenses-analyzing {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 280px;
    padding: 40px;
    gap: 32px;
}

.analyzing-spinner {
    width: 56px;
    height: 56px;
    border: 3px solid rgba(34, 211, 238, 0.2);
    border-top-color: var(--cyan);
    border-radius: 50%;
    animation: analyzing-spin 0.9s linear infinite;
    box-shadow: 0 0 20px rgba(34, 211, 238, 0.4), inset 0 0 12px rgba(34, 211, 238, 0.15);
}

@keyframes analyzing-spin {
    to { transform: rotate(360deg); }
}

.analyzing-text {
    font-family: 'Orbitron', monospace;
    font-size: 1.1em;
    font-weight: 500;
    letter-spacing: 2px;
    color: var(--cyan);
    margin: 0;
    animation: analyzing-glow 2s ease-in-out infinite;
    text-shadow: 0 0 12px rgba(34, 211, 238, 0.8), 0 0 24px rgba(34, 211, 238, 0.4);
}

@keyframes analyzing-glow {
    0%, 100% { opacity: 0.85; text-shadow: 0 0 12px rgba(34, 211, 238, 0.8), 0 0 24px rgba(34, 211, 238, 0.4); }
    50% { opacity: 1; text-shadow: 0 0 16px rgba(34, 211, 238, 1), 0 0 32px rgba(34, 211, 238, 0.6); }
}

/* Рекомендации */
.spectacle-lenses-recommendations {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

.recommendations-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    flex-wrap: wrap;
    gap: 16px;
}

.recommendations-title {
    font-family: 'Orbitron', monospace;
    font-size: 2em;
    font-weight: 600;
    color: rgba(34, 211, 238, 0.9);
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-recipe-back {
    padding: 12px 24px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    color: var(--text);
    font-family: 'Monitorica', sans-serif;
    font-size: 0.9em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-recipe-back:hover {
    background: rgba(34, 211, 238, 0.15);
    border-color: rgba(34, 211, 238, 0.4);
    color: var(--cyan);
}

.recommendations-content {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(34, 211, 238, 0.2);
    border-radius: 16px;
    padding: 32px;
    backdrop-filter: blur(12px);
}

.recommendations-text {
    font-size: 1.1em;
    line-height: 1.8;
    color: var(--text);
    white-space: pre-wrap;
}

@media (max-width: 768px) {
    .spectacle-lenses-recipe {
        padding: 10px;
    }
    
    .recipe-title {
        font-size: 17px;
    }
    
    .recipe-section-title {
        font-size: 13px;
    }
    
    .recipe-form-section {
        padding: 12px;
    }
    
    .lens-types-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .recipe-form-row {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .recipe-form-row-monocular {
        margin-top: 12px;
        padding-top: 12px;
    }
    
    .recipe-form-input {
        font-size: 14px;
        padding: 9px 10px;
    }
    
    .recipe-form-label {
        font-size: 11px;
    }
    
    .checkbox-value {
        font-size: 12px;
        padding: 9px 10px;
        min-height: 38px;
    }
    
    .recommendations-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .btn-recipe-analyze {
        width: 100%;
        padding: 10px 20px;
        font-size: 12px;
    }
}

/* ============================================
   PATIENTS TAB — медицинская карта пациента
   ============================================ */

.recipe-form-field-full {
    grid-column: 1 / -1;
}

.patients-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: 100%;
    min-height: 0;
    padding: 24px;
    /* clip, а не hidden — см. комментарий у #chatView .chat-container: то же
       самое иначе создаёт скролл-контейнер, который может сдвинуться программно */
    overflow: clip;
}

.patients-substate {
    display: none;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: clip;
}

.patients-substate.active {
    display: flex;
}

/* --- Гость/demo-режим: картотека закрыта, см. showPatientsAuthGate в app.js --- */
.patients-auth-gate {
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 14px;
    padding: 40px 24px;
}

.patients-auth-gate-text {
    max-width: 440px;
    color: var(--muted);
    line-height: 1.5;
}

.patients-auth-gate-link {
    display: inline-block;
    text-decoration: none;
    margin-top: 6px;
}

/* --- List sub-state --- */

.patients-demo-badge {
    margin: 12px 0 0;
    padding: 10px 14px;
    border-radius: 10px;
    background: rgba(251, 191, 36, 0.08);
    border: 1px solid rgba(251, 191, 36, 0.25);
    color: #fbbf24;
    font-size: 0.88em;
    line-height: 1.4;
}

.patients-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 0;
    flex-shrink: 0;
}

.patients-search-wrapper {
    flex: 1;
    min-width: 0;
}

.patients-search {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    color: var(--text);
    font-family: 'Monitorica', sans-serif;
    font-size: 1em;
    transition: all 0.2s ease;
    outline: none;
}

.patients-search::placeholder {
    color: var(--muted);
    opacity: 0.7;
}

.patients-search:focus {
    border-color: rgba(34, 211, 238, 0.5);
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.1), 0 4px 16px rgba(34, 211, 238, 0.08);
}

.btn-new-patient {
    flex-shrink: 0;
    padding: 12px 20px;
    background: rgba(34, 211, 238, 0.1);
    border: 1px solid rgba(34, 211, 238, 0.25);
    border-radius: 12px;
    color: var(--cyan);
    font-family: 'Monitorica', sans-serif;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-new-patient:hover {
    background: rgba(34, 211, 238, 0.15);
    border-color: rgba(34, 211, 238, 0.4);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(34, 211, 238, 0.15);
}

.btn-new-patient-icon {
    font-size: 1.2em;
    font-weight: 300;
    line-height: 1;
}

.new-patient-form {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.02) 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--recipe-radius-panel);
    padding: 16px;
    margin-bottom: 16px;
    flex-shrink: 0;
}

.new-patient-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 14px;
}

.patients-list-wrapper {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.patients-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.patient-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.18s ease;
    text-align: left;
}

.patient-row:hover {
    background: rgba(34, 211, 238, 0.08);
    border-color: rgba(34, 211, 238, 0.25);
    transform: translateY(-1px);
}

.patient-row-name {
    flex: 1;
    min-width: 0;
    font-family: 'Monitorica', sans-serif;
    font-weight: 600;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.patient-row-meta {
    display: flex;
    gap: 18px;
    flex-shrink: 0;
    font-size: 0.9em;
    color: var(--muted);
}

/* Раздел "Удалённые" — когда карту снесёт безвозвратно (см. patientsTrashPurgeLabel) */
.patient-row-purge {
    color: var(--muted);
    opacity: 0.8;
}

.patient-row-purge-urgent {
    color: #f87171;
    opacity: 1;
}

/* Разделитель дней в списке пациентов — список уже отсортирован по дате/времени
   приёма (см. renderPatientsList), поэтому пациенты за один день просто идут
   подряд; перед первым пациентом каждого нового дня вставляется эта неоновая
   шкала с датой, чтобы дни визуально не сливались в один сплошной список. */
.patients-date-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 6px 2px 0;
    user-select: none;
}

.patients-date-divider:first-child {
    margin-top: 0;
}

.patients-date-divider-line {
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(34, 211, 238, 0.55), transparent);
    box-shadow: 0 0 8px rgba(34, 211, 238, 0.35);
}

.patients-date-divider-label {
    flex-shrink: 0;
    font-family: 'Orbitron', monospace;
    font-size: 0.78em;
    font-weight: 600;
    letter-spacing: 1.5px;
    color: var(--cyan);
    text-shadow: 0 0 8px rgba(34, 211, 238, 0.5), 0 0 18px rgba(34, 211, 238, 0.25);
    padding: 4px 14px;
    border: 1px solid rgba(34, 211, 238, 0.35);
    border-radius: 999px;
    background: rgba(34, 211, 238, 0.07);
    white-space: nowrap;
}

.patients-empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--muted);
}

.patients-empty-hint {
    opacity: 0.6;
    margin-top: 6px;
    font-size: 0.9em;
}

/* --- Shared buttons --- */

.btn-patients-primary {
    padding: 10px 28px;
    background: linear-gradient(135deg, rgba(34, 211, 238, 0.3) 0%, rgba(124, 58, 237, 0.25) 50%, rgba(34, 211, 238, 0.3) 100%);
    border: 1px solid rgba(34, 211, 238, 0.5);
    border-radius: var(--recipe-radius-button);
    color: rgba(234, 242, 255, 1);
    font-family: 'Monitorica', sans-serif;
    font-size: 0.95em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all var(--recipe-transition-base);
}

.btn-patients-primary:hover {
    border-color: rgba(34, 211, 238, 0.8);
    box-shadow: 0 4px 16px rgba(34, 211, 238, 0.25);
    transform: translateY(-1px);
}

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

.btn-patients-secondary {
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--recipe-radius-button);
    color: rgba(234, 242, 255, 0.8);
    font-family: 'Monitorica', sans-serif;
    font-size: 0.9em;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--recipe-transition-base);
}

.btn-patients-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: rgba(234, 242, 255, 1);
}

.patients-confirm-modal {
    position: relative;
    width: 100%;
    max-width: 380px;
    background: linear-gradient(180deg,
        rgba(17, 30, 50, 0.98) 0%,
        rgba(11, 22, 48, 0.98) 100%);
    border: 1px solid rgba(34, 211, 238, 0.3);
    border-radius: var(--radius);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    padding: 24px;
}

.patients-confirm-message {
    color: rgba(234, 242, 255, 0.9);
    font-size: 0.95em;
    line-height: 1.5;
    margin-bottom: 20px;
}

.patients-confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.patients-print-modal {
    position: relative;
    width: min(100%, 620px);
    max-height: min(760px, calc(100vh - 40px));
    overflow-y: auto;
    background: linear-gradient(180deg, rgba(17, 30, 50, 0.99) 0%, rgba(11, 22, 48, 0.99) 100%);
    border: 1px solid rgba(34, 211, 238, 0.35);
    border-radius: var(--radius);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
    padding: 24px;
}

.patients-print-title { margin: 0; color: rgba(234, 242, 255, 1); font-family: 'Monitorica', sans-serif; font-size: 1.2em; font-weight: 700; }
.patients-print-description { margin: 8px 0 22px; color: rgba(234, 242, 255, 0.65); font-size: 0.9em; line-height: 1.45; }
.patients-print-group { margin: 0 0 20px; padding: 0; border: 0; }
.patients-print-group legend { margin-bottom: 10px; color: rgba(34, 211, 238, 0.95); font-family: 'Monitorica', sans-serif; font-size: 0.86em; font-weight: 700; letter-spacing: 0.45px; text-transform: uppercase; }
.patients-print-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.patients-print-option { display: block; min-width: 0; cursor: pointer; }
.patients-print-option input { position: absolute; opacity: 0; pointer-events: none; }
.patients-print-option-card { display: flex; flex-direction: column; gap: 5px; height: 100%; padding: 14px 15px; background: rgba(255, 255, 255, 0.045); border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 10px; color: rgba(234, 242, 255, 0.78); transition: border-color var(--recipe-transition-base), background var(--recipe-transition-base), box-shadow var(--recipe-transition-base); }
.patients-print-option-card strong { color: rgba(234, 242, 255, 0.95); font-size: 0.94em; }
.patients-print-option-card span { font-size: 0.8em; line-height: 1.4; }
.patients-print-option input:checked + .patients-print-option-card { background: rgba(34, 211, 238, 0.12); border-color: rgba(34, 211, 238, 0.7); box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.18), 0 8px 24px rgba(34, 211, 238, 0.08); }
.patients-print-option input:focus-visible + .patients-print-option-card { outline: 2px solid rgba(34, 211, 238, 0.9); outline-offset: 2px; }
.patients-print-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 4px; }

@media (max-width: 600px) {
    .recipe-picker-overlay:has(.patients-print-modal) {
        align-items: flex-end;
        padding: 0;
    }
    .patients-print-modal {
        width: 100%;
        max-height: min(88dvh, 760px);
        padding: 18px 16px max(16px, env(safe-area-inset-bottom));
        border-radius: 16px 16px 0 0;
        border-left: 0;
        border-right: 0;
        border-bottom: 0;
    }
    .patients-print-title { font-size: 1.1em; }
    .patients-print-description { margin: 6px 0 16px; font-size: 0.84em; }
    .patients-print-group { margin-bottom: 14px; }
    .patients-print-options { grid-template-columns: 1fr; gap: 8px; }
    .patients-print-option-card { min-height: 66px; padding: 11px 13px; }
    .patients-print-actions { position: sticky; bottom: 0; flex-direction: column-reverse; padding-top: 8px; background: rgba(11, 22, 48, 0.98); }
    .patients-print-actions button { width: 100%; }
}

.patients-wizard-header-actions {
    margin-left: auto;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-delete-patient {
    color: #fca5a5;
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.25);
}

.btn-delete-patient:hover {
    background: rgba(239, 68, 68, 0.18);
    border-color: rgba(239, 68, 68, 0.4);
    color: #ef4444;
}

/* .visit-row-delete — тот же "✕" на строке приёма (не карты пациента); раньше
   переиспользовал класс .patient-row-delete, из-за чего правило появления по
   ховеру ниже (".patient-row:hover .patient-row-delete") не подходило под его
   реального родителя ".visit-row" — кнопка была в DOM, но никогда не становилась
   видимой (opacity всегда 0). Теперь у каждого свой явный триггер ховера. */
.patient-row-delete,
.visit-row-delete {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    cursor: pointer;
    font-size: 0.85em;
    line-height: 1;
    transition: all 0.18s ease;
    opacity: 0;
}

.patient-row:hover .patient-row-delete,
.visit-row:hover .visit-row-delete {
    opacity: 1;
}

.patient-row-delete:hover,
.visit-row-delete:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
    color: #ef4444;
}

/* --- Wizard sub-state --- */

.patients-wizard-steps {
    flex-shrink: 0;
    margin: 12px 0 16px;
}

.patients-wizard-step-indicator {
    display: flex;
    gap: 10px;
}

.wizard-step {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    color: var(--muted);
    font-family: 'Monitorica', sans-serif;
    font-size: 0.85em;
    font-weight: 500;
    letter-spacing: 0.3px;
    cursor: pointer;
    transition: all 0.18s ease;
}

.wizard-step:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    color: rgba(234, 242, 255, 0.9);
    transform: translateY(-1px);
}

.wizard-step.active {
    background: rgba(34, 211, 238, 0.15);
    border-color: rgba(34, 211, 238, 0.4);
    color: var(--cyan);
    font-weight: 600;
}

.wizard-step.active:hover {
    background: rgba(34, 211, 238, 0.22);
    border-color: rgba(34, 211, 238, 0.55);
}

.wizard-step.completed {
    border-color: rgba(34, 197, 94, 0.35);
    color: rgba(234, 242, 255, 0.85);
}

.patients-wizard-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

.wizard-step-panel {
    display: none;
}

.wizard-step-panel.active {
    display: block;
}

/* --- Новая консоль приёма: пациент + диалоговый анамнез --- */

.patient-intake-console {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    margin-bottom: 16px;
    padding: 19px 22px 17px;
    border: 1px solid rgba(82, 223, 255, 0.22);
    border-radius: 18px;
    background:
        radial-gradient(circle at 92% 8%, rgba(121, 76, 255, 0.2), transparent 34%),
        linear-gradient(145deg, rgba(14, 33, 63, 0.96), rgba(9, 19, 42, 0.98));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.045), 0 18px 55px rgba(1, 8, 24, 0.28);
}

.patient-intake-console::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    opacity: 0.2;
    background-image:
        linear-gradient(rgba(77, 221, 255, 0.12) 1px, transparent 1px),
        linear-gradient(90deg, rgba(77, 221, 255, 0.12) 1px, transparent 1px);
    background-size: 28px 28px;
    mask-image: linear-gradient(90deg, transparent 0, #000 68%, #000 100%);
}

.patient-intake-orbit {
    position: absolute;
    top: -74px;
    right: -44px;
    z-index: -1;
    width: 210px;
    height: 210px;
    border: 1px solid rgba(65, 219, 255, 0.16);
    border-radius: 50%;
    animation: patientOrbitRotate 18s linear infinite;
}

.patient-intake-orbit::before,
.patient-intake-orbit::after {
    content: '';
    position: absolute;
    border: 1px solid rgba(144, 94, 255, 0.15);
    border-radius: 50%;
}

.patient-intake-orbit::before { inset: 27px; }
.patient-intake-orbit::after { inset: 58px; }

.patient-intake-orbit span {
    position: absolute;
    top: 48%;
    left: -4px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #47dcff;
    box-shadow: 0 0 18px rgba(71, 220, 255, 0.9);
}

.patient-intake-kicker {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    color: rgba(154, 226, 241, 0.66);
    font-family: 'Monitorica', sans-serif;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1.7px;
    text-transform: uppercase;
}

.patient-intake-live-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #35e5c2;
    box-shadow: 0 0 0 0 rgba(53, 229, 194, 0.4);
    animation: patientLivePulse 2s ease-out infinite;
}

.patient-intake-name {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 7px 12px;
    font-family: 'Monitorica', sans-serif;
    line-height: 1.02;
}

.patient-intake-name strong {
    color: #effbff;
    font-size: clamp(24px, 3vw, 37px);
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-shadow: 0 0 24px rgba(64, 218, 255, 0.2);
}

.patient-intake-name span {
    color: rgba(224, 239, 250, 0.68);
    font-size: clamp(16px, 2vw, 22px);
    font-weight: 400;
}

.patient-intake-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
    margin-top: 10px;
    color: rgba(201, 224, 236, 0.68);
    font-family: 'Monitorica', sans-serif;
    font-size: 11px;
}

.patient-intake-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.patient-intake-meta-item i {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #43d9f7;
    box-shadow: 0 0 10px rgba(67, 217, 247, 0.7);
}

.patient-intake-phone::before {
    content: '';
    width: 1px;
    height: 12px;
    margin-right: 10px;
    background: rgba(255, 255, 255, 0.13);
}

.patient-intake-visit {
    display: grid;
    grid-template-columns: minmax(150px, 0.34fr) minmax(260px, 1fr);
    gap: 10px;
    margin-top: 17px;
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.075);
}

.patient-intake-visit-field {
    min-width: 0;
}

.patient-intake-visit-field > span {
    display: block;
    margin: 0 0 5px 2px;
    color: rgba(160, 196, 214, 0.56);
    font-family: 'Monitorica', sans-serif;
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
}

#patientsView .patient-intake-visit .recipe-form-input {
    min-height: 40px;
    padding-top: 9px;
    padding-bottom: 9px;
    border-color: rgba(135, 208, 232, 0.12);
    background: rgba(5, 13, 31, 0.42);
}

#patientsView .patient-intake-visit textarea.recipe-form-input {
    height: 40px;
    min-height: 40px;
    resize: none;
}

.anamnesis-ai-console {
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(70, 220, 249, 0.2);
    border-radius: 20px;
    background: linear-gradient(160deg, rgba(8, 21, 45, 0.98), rgba(5, 13, 31, 0.98));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 20px 65px rgba(0, 4, 16, 0.35);
}

.anamnesis-ai-console::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 44%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(55, 222, 255, 0.8), transparent);
    animation: consoleScan 4.5s ease-in-out infinite;
}

.adaptive-anamnesis-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin: 0;
    padding: 15px 17px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.065);
    background: rgba(255, 255, 255, 0.018);
}

.adaptive-anamnesis-heading {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
}

.adaptive-anamnesis-signal {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    width: 28px;
    height: 28px;
    padding: 7px;
    border: 1px solid rgba(62, 221, 255, 0.24);
    border-radius: 9px;
    background: rgba(32, 204, 244, 0.08);
}

.adaptive-anamnesis-signal i {
    width: 3px;
    border-radius: 3px;
    background: #40daf7;
    box-shadow: 0 0 7px rgba(64, 218, 247, 0.5);
    animation: clinicalSignal 1.2s ease-in-out infinite;
}

.adaptive-anamnesis-signal i:nth-child(1) { height: 7px; animation-delay: -0.2s; }
.adaptive-anamnesis-signal i:nth-child(2) { height: 13px; animation-delay: -0.55s; }
.adaptive-anamnesis-signal i:nth-child(3) { height: 9px; animation-delay: -0.85s; }

.adaptive-anamnesis-title {
    color: rgba(238, 250, 255, 0.96);
    font-family: 'Monitorica', sans-serif;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.75px;
    text-transform: uppercase;
}

.adaptive-anamnesis-caption {
    overflow: hidden;
    margin-top: 3px;
    color: rgba(175, 208, 222, 0.52);
    font-family: 'Monitorica', sans-serif;
    font-size: 9px;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.adaptive-anamnesis-modes {
    position: relative;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 256px;
    min-width: 256px;
    height: 38px;
    padding: 3px;
    border: 1px solid rgba(148, 192, 211, 0.14);
    border-radius: 12px;
    background: rgba(3, 10, 27, 0.72);
    box-shadow: inset 0 2px 12px rgba(0, 0, 0, 0.24);
}

.adaptive-mode-slider {
    position: absolute;
    top: 3px;
    bottom: 3px;
    left: 3px;
    width: calc(50% - 3px);
    border: 1px solid rgba(84, 229, 255, 0.42);
    border-radius: 9px;
    background: linear-gradient(135deg, rgba(34, 211, 238, 0.92), rgba(83, 100, 246, 0.8));
    box-shadow: 0 0 20px rgba(34, 211, 238, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.24);
    transition: transform 0.42s cubic-bezier(0.22, 1, 0.36, 1), background 0.3s ease;
}

.adaptive-anamnesis-modes.is-manual .adaptive-mode-slider {
    transform: translateX(100%);
    border-color: rgba(161, 144, 255, 0.34);
    background: linear-gradient(135deg, rgba(89, 79, 170, 0.82), rgba(111, 76, 164, 0.72));
}

.adaptive-mode-btn {
    position: relative;
    z-index: 1;
    min-width: 0;
    padding: 0 8px;
    border: 0;
    border-radius: 9px;
    outline: 0;
    color: rgba(181, 208, 220, 0.55);
    background: transparent;
    font-family: 'Monitorica', sans-serif;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.3px;
    white-space: nowrap;
    cursor: pointer;
    transition: color 0.32s ease, text-shadow 0.32s ease;
}

.adaptive-mode-btn.active {
    color: #04131c;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.15);
}

.adaptive-mode-btn:focus-visible {
    outline: 2px solid rgba(82, 224, 255, 0.8);
    outline-offset: 3px;
}

.anamnesis-console-state {
    display: flex;
    align-items: center;
    gap: 18px;
    min-height: 39px;
    padding: 9px 17px 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.045);
}

.adaptive-anamnesis-status {
    flex: 1;
    min-width: 0;
    margin: 0;
    color: rgba(91, 219, 242, 0.7);
    font-family: 'Monitorica', sans-serif;
    font-size: 9px;
    line-height: 1.45;
}

.adaptive-anamnesis-status.is-loading {
    animation: adaptiveStatusPulse 1.2s ease-in-out infinite;
}

.adaptive-anamnesis-status.is-error {
    color: #ff9b9b;
}

.adaptive-anamnesis-safety {
    margin: 0 0 12px;
    padding: 11px 13px;
    border: 1px solid rgba(255, 107, 107, 0.55);
    border-radius: 10px;
    background: rgba(255, 107, 107, 0.1);
    color: #ffb0b0;
    font-size: 12px;
    line-height: 1.45;
    font-weight: 600;
}

@keyframes adaptiveStatusPulse {
    0%, 100% { opacity: 0.55; }
    50% { opacity: 1; }
}

.anamnesis-progress {
    display: flex;
    align-items: center;
    gap: 10px;
    width: min(42%, 260px);
    margin: 0;
}

.anamnesis-progress-text {
    flex-shrink: 0;
    font-family: 'Monitorica', sans-serif;
    font-size: 9px;
    color: var(--muted);
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.anamnesis-progress-bar {
    flex: 1;
    height: 3px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

.anamnesis-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--cyan), rgba(124, 58, 237, 0.85));
    border-radius: 2px;
    box-shadow: 0 0 8px rgba(34, 211, 238, 0.4);
    transition: width 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.anamnesis-question-card {
    min-height: 252px;
    padding: 18px 18px 16px;
    transition: opacity 0.25s ease, filter 0.25s ease;
}

.anamnesis-question-card.is-writing {
    opacity: 0.58;
    filter: saturate(0.75);
}

.anamnesis-conversation-feed {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.anamnesis-message-row {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    max-width: 92%;
}

.anamnesis-message-ai { align-self: flex-start; }
.anamnesis-message-user { align-self: flex-end; }

.anamnesis-message-avatar {
    position: relative;
    flex: 0 0 31px;
    display: grid;
    place-items: center;
    width: 31px;
    height: 31px;
    border: 1px solid rgba(64, 218, 247, 0.28);
    border-radius: 10px;
    background: linear-gradient(145deg, rgba(20, 101, 127, 0.42), rgba(48, 44, 111, 0.42));
    color: #83ecff;
    box-shadow: 0 0 20px rgba(45, 211, 240, 0.08);
    font-family: 'Orbitron', sans-serif;
    font-size: 8px;
    font-weight: 700;
}

.anamnesis-message-avatar::after {
    content: '';
    position: absolute;
    right: -2px;
    bottom: -2px;
    width: 7px;
    height: 7px;
    border: 2px solid #07152c;
    border-radius: 50%;
    background: #38ddb9;
}

.anamnesis-message-bubble {
    min-width: 0;
    padding: 12px 14px;
    border: 1px solid rgba(121, 185, 211, 0.13);
    border-radius: 4px 16px 16px 16px;
    background: linear-gradient(145deg, rgba(25, 43, 73, 0.88), rgba(14, 27, 54, 0.9));
    color: rgba(233, 246, 252, 0.92);
    box-shadow: 0 10px 30px rgba(0, 5, 20, 0.16);
    font-family: 'Monitorica', sans-serif;
    font-size: 12px;
    line-height: 1.5;
}

.anamnesis-message-current {
    width: min(100%, 690px);
    max-width: 100%;
}

.anamnesis-message-current .anamnesis-message-bubble {
    flex: 1;
    padding: 14px 15px 15px;
    border-color: rgba(59, 218, 247, 0.22);
    background:
        radial-gradient(circle at 96% 0, rgba(85, 70, 200, 0.12), transparent 34%),
        linear-gradient(145deg, rgba(21, 41, 72, 0.95), rgba(12, 25, 51, 0.96));
}

.anamnesis-message-user .anamnesis-message-bubble {
    border-color: rgba(124, 103, 255, 0.24);
    border-radius: 16px 4px 16px 16px;
    background: linear-gradient(135deg, rgba(51, 100, 160, 0.8), rgba(76, 61, 143, 0.82));
    color: #f2f7ff;
}

.anamnesis-message-row.is-compact {
    opacity: 0.67;
    max-width: 78%;
}

.anamnesis-message-row.is-compact .anamnesis-message-avatar {
    flex-basis: 25px;
    width: 25px;
    height: 25px;
    border-radius: 8px;
    font-size: 7px;
}

.anamnesis-message-row.is-compact .anamnesis-message-bubble {
    padding: 8px 11px;
    font-size: 10px;
}

.anamnesis-message-row.is-pending {
    animation: pendingAnswerEnter 0.42s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.anamnesis-message-current.is-submitted {
    max-height: 68px;
    overflow: hidden;
    opacity: 0.3;
    transition: max-height 0.35s ease, opacity 0.25s ease;
}

.anamnesis-message-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 9px;
    color: rgba(94, 220, 242, 0.66);
    font-size: 8px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.anamnesis-message-bubble .anamnesis-question {
    margin: 0;
}

.anamnesis-message-bubble .anamnesis-question-label {
    margin-bottom: 11px;
    color: rgba(241, 250, 255, 0.97);
    font-size: 15px;
    line-height: 1.45;
}

#patientsView .anamnesis-message-bubble textarea.recipe-form-input,
#patientsView .anamnesis-message-bubble input.recipe-form-input {
    border-color: rgba(119, 206, 232, 0.16);
    background: rgba(2, 10, 25, 0.58);
    box-shadow: inset 0 1px 6px rgba(0, 0, 0, 0.15);
}

#patientsView .anamnesis-message-bubble textarea.recipe-form-input:focus,
#patientsView .anamnesis-message-bubble input.recipe-form-input:focus {
    border-color: rgba(67, 220, 248, 0.55);
    box-shadow: 0 0 0 3px rgba(45, 211, 240, 0.08), 0 0 22px rgba(45, 211, 240, 0.06);
}

.anamnesis-writing-indicator {
    position: relative;
    display: flex;
    align-items: center;
    gap: 13px;
    margin: 0 18px 17px 58px;
    padding: 11px 14px;
    border: 1px solid rgba(62, 219, 246, 0.16);
    border-radius: 14px;
    background: rgba(16, 34, 63, 0.72);
    animation: writingIndicatorEnter 0.35s ease both;
}

.anamnesis-writing-indicator[hidden] { display: none; }

.anamnesis-writing-hand {
    position: relative;
    flex: 0 0 38px;
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
}

.anamnesis-writing-hand svg {
    position: relative;
    z-index: 1;
    width: 37px;
    height: 37px;
    overflow: visible;
    fill: none;
    stroke: #69e5fb;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2.2;
    filter: drop-shadow(0 0 8px rgba(72, 221, 249, 0.25));
    animation: writingHand 1.35s ease-in-out infinite;
}

.anamnesis-writing-hand .hand-pen { stroke: #a897ff; }
.anamnesis-writing-hand .hand-cuff { fill: rgba(69, 210, 239, 0.1); }

.anamnesis-writing-ring {
    position: absolute;
    inset: 2px;
    border: 1px solid rgba(71, 219, 247, 0.18);
    border-radius: 50%;
    animation: writingRing 1.7s ease-out infinite;
}

.anamnesis-writing-indicator strong,
.anamnesis-writing-indicator > div:nth-child(2) span {
    display: block;
    font-family: 'Monitorica', sans-serif;
}

.anamnesis-writing-indicator strong {
    color: rgba(229, 249, 255, 0.93);
    font-size: 11px;
    letter-spacing: 0.35px;
}

.anamnesis-writing-indicator > div:nth-child(2) span {
    margin-top: 3px;
    color: rgba(161, 201, 216, 0.52);
    font-size: 9px;
}

.anamnesis-writing-dots {
    display: flex;
    gap: 3px;
    margin-left: auto;
}

.anamnesis-writing-dots i {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #54dff7;
    animation: writingDot 1.1s ease-in-out infinite;
}

.anamnesis-writing-dots i:nth-child(2) { animation-delay: 0.16s; }
.anamnesis-writing-dots i:nth-child(3) { animation-delay: 0.32s; }

@keyframes patientOrbitRotate { to { transform: rotate(360deg); } }
@keyframes patientLivePulse { 70%, 100% { box-shadow: 0 0 0 8px rgba(53, 229, 194, 0); } }
@keyframes consoleScan { 0%, 100% { transform: translateX(35%); opacity: 0.25; } 50% { transform: translateX(-130%); opacity: 0.9; } }
@keyframes clinicalSignal { 0%, 100% { transform: scaleY(0.55); opacity: 0.55; } 50% { transform: scaleY(1); opacity: 1; } }
@keyframes pendingAnswerEnter { from { opacity: 0; transform: translate(12px, 8px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes writingIndicatorEnter { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }
@keyframes writingHand { 0%, 100% { transform: translate(-1px, 1px) rotate(-2deg); } 50% { transform: translate(3px, -2px) rotate(3deg); } }
@keyframes writingRing { 0% { transform: scale(0.75); opacity: 0.65; } 100% { transform: scale(1.25); opacity: 0; } }
@keyframes writingDot { 0%, 70%, 100% { transform: translateY(0); opacity: 0.3; } 35% { transform: translateY(-4px); opacity: 1; } }

@media (max-width: 720px) {
    .patient-intake-console { padding: 16px 15px 14px; border-radius: 16px; }
    .patient-intake-name { display: block; }
    .patient-intake-name strong,
    .patient-intake-name span { display: block; }
    .patient-intake-name strong { font-size: 25px; }
    .patient-intake-name span { margin-top: 5px; font-size: 15px; line-height: 1.2; }
    .patient-intake-meta { display: grid; gap: 6px; }
    .patient-intake-phone::before { display: none; }
    .patient-intake-visit { grid-template-columns: 1fr; }

    .adaptive-anamnesis-toolbar { align-items: stretch; flex-direction: column; padding: 14px; }
    .adaptive-anamnesis-caption { max-width: 260px; }
    .adaptive-anamnesis-modes { width: 100%; min-width: 0; }
    .anamnesis-console-state { align-items: stretch; flex-direction: column; gap: 7px; padding: 9px 14px; }
    .anamnesis-progress { width: 100%; }
    .anamnesis-question-card { min-height: 236px; padding: 15px 13px; }
    .anamnesis-message-row,
    .anamnesis-message-current { max-width: 100%; }
    .anamnesis-message-row.is-compact { max-width: 90%; }
    .anamnesis-message-current .anamnesis-message-bubble { padding: 12px; }
    .anamnesis-message-bubble .anamnesis-question-label { font-size: 14px; }
    .anamnesis-writing-indicator { margin: 0 13px 14px; }
}

.lens-order-subsection {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

/* Группа типов линз (Монофокальные / Офисные / Мультифокальные и специальные) —
   у каждой группы фиксированное число колонок, чтобы строка всегда заполнялась
   целиком и не оставляла "оборванный" короткий хвост, как при auto-fit */
.lens-type-group {
    margin-bottom: 12px;
}

.lens-type-group:last-of-type {
    margin-bottom: 0;
}

.lens-type-group-label {
    font-family: 'Monitorica', sans-serif;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(234, 242, 255, 0.5);
    margin-bottom: 6px;
}

.lens-types-grid-fixed-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

/* Гейтинг по аддидации (updateLensAdditionGating) может спрятать одну из двух
   плиток группы "Офисные" — вторая тогда растягивается на всю строку вместо
   пустой половины рядом с собой (см. adjustLensTypeGridLayouts) */
.lens-types-grid-single {
    grid-template-columns: 1fr;
}

/* Монофокальные (buildPrescriptionTypeButtonsHtml) — 4-я плитка "ДЛЯ ПОСТОЯННОГО
   НОШЕНИЯ" длиннее остальных подписей и переносится на 2 строки, из-за чего её
   строка сетки становится выше соседней — плитки выглядели разного размера,
   хотя разметка одна и та же (.lens-type-checkbox/.checkbox-value). Жалоба
   2026-08-15. Явные repeat(2, 1fr)-строки в grid-контейнере без фиксированной
   высоты выравнивают ОБЕ строки по самой высокой ячейке — все 4 плитки
   становятся одного роста. Не трогает .lens-types-grid-fixed-2 по умолчанию —
   у остальных вызовов typeGrid (Офисные/Мультифокальные) такой проблемы нет. */
.lens-types-grid-equal-rows {
    grid-template-rows: repeat(2, 1fr);
}

/* .lens-type-checkbox (label) сам растягивается по высоте строки за счёт
   грид-дефолта align-self:stretch — но видимая рамка/заливка плитки рисуется
   на вложенном .checkbox-value (flex-column ужимает его до высоты текста
   по умолчанию), поэтому без явного height оно не дотягивается до полной
   высоты растянутого label — тут это явно указано. */
.lens-types-grid-equal-rows .checkbox-value {
    height: 100%;
}

.lens-order-subsection:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.lens-order-subtitle {
    font-family: 'Monitorica', sans-serif;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(234, 242, 255, 0.75);
    margin: 0 0 10px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

/* Кнопка очистки блока "Заказано по итогу" — врач мог уже внести данные, а
   пациент в итоге ничего не заказал; без неё эти поля пришлось бы стирать
   вручную по одному. Только у "Заказано", не у "Рекомендовано" — рекомендация
   специалиста остаётся частью карты в любом случае. */
.lens-order-clear-btn {
    font-family: 'Monitorica', sans-serif;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: none;
    color: rgba(234, 242, 255, 0.55);
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    padding: 3px 10px;
    cursor: pointer;
    flex-shrink: 0;
    transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.lens-order-clear-btn:hover {
    color: #ff8080;
    border-color: rgba(255, 128, 128, 0.4);
    background: rgba(255, 128, 128, 0.08);
}

/* Заголовок первой подсекции ("Рекомендовано специалистом") идёт сразу после
   textarea "Примечания к рецепту" без своего отступа сверху — без этого правила
   его текст упирается прямо в скруглённую рамку textarea (см. репорт "рамка
   накладывается"). У второй подсекции ("Заказано по итогу") сверху уже есть
   граница+отступ предыдущей секции (.lens-order-subsection), поэтому доп.
   отступ нужен только самому первому блоку внутри .prescription-lens-design. */
.prescription-lens-design {
    margin-top: 18px;
}

/* Ветка полей, раскрывающаяся под выбранным типом линзы — левая линия
   визуально показывает, что это следствие выбора выше, а не отдельный блок */
.lens-order-branch {
    margin-top: 14px;
    padding-left: 16px;
    border-left: 2px solid rgba(34, 211, 238, 0.25);
}

.lens-order-block {
    margin-bottom: 12px;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--recipe-radius-input);
}

.lens-order-block:last-child {
    margin-bottom: 0;
}

.lens-order-block > .patients-hint:first-child {
    font-size: 0.78em;
    color: rgba(34, 211, 238, 0.85);
    opacity: 1;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 10px;
}

.lens-order-branch .visit-detail-empty {
    padding: 4px 0;
}

.anamnesis-section-label {
    font-family: 'Monitorica', sans-serif;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: var(--cyan);
    opacity: 0.85;
    margin-bottom: 4px;
    text-shadow: 0 0 8px rgba(34, 211, 238, 0.25);
}

.anamnesis-question-number {
    font-family: 'Monitorica', sans-serif;
    font-size: 11px;
    color: var(--muted);
    opacity: 0.55;
    margin-bottom: 18px;
    letter-spacing: 0.5px;
}

.anamnesis-question-card .anamnesis-question-label {
    font-size: 16px;
    color: rgba(234, 242, 255, 0.95);
    margin-bottom: 14px;
}

/* Анимация появления вопроса и вариантов ответа. Задержки для каждого
   элемента задаются инлайн через style="animation-delay: ...", чтобы
   не плодить nth-child-правила под разное число вариантов ответа.
   Класс снимается через JS после проигрывания (см. renderAnamnesisQuestionCard),
   чтобы анимация не "держала" transform и не конфликтовала с hover/active. */
.anamnesis-enter {
    animation: anamnesisEnterFade 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
}

@keyframes anamnesisEnterFade {
    0% {
        opacity: 0;
        transform: translateY(14px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .anamnesis-enter {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }
    .anamnesis-progress-fill {
        transition: none;
    }
    .patient-intake-orbit,
    .patient-intake-live-dot,
    .anamnesis-ai-console::after,
    .adaptive-anamnesis-signal i,
    .anamnesis-writing-hand svg,
    .anamnesis-writing-ring,
    .anamnesis-writing-dots i {
        animation: none !important;
    }
    .adaptive-mode-slider {
        transition: none;
    }
}

.anamnesis-question {
    margin-bottom: 14px;
}

.anamnesis-question:last-child {
    margin-bottom: 0;
}

.anamnesis-question-label {
    display: block;
    margin-bottom: 8px;
}

/* Карта переопределений шрифта на вкладке "Пациенты" (3 уровня специфичности,
   снизу вверх — каждый следующий побеждает предыдущий именно на Пациентах,
   не трогая Очковые линзы):
     1. .recipe-form-input (styles.css, форма рецепта) — база: 'Orbitron' для
        всех полей ввода на обеих вкладках, т.к. Пациенты переиспользуют разметку
        рецепта.
     2. #patientsView input/textarea/select ниже — почти всё на Пациентах (ФИО,
        даты, комментарии, дизайн/модификация линз) переключается на 'Monitorica',
        как в чате ИИ-ассистента.
     3. #patientsView input.patients-numeric-input — числа (диоптрии, PD,
        коэффициент, углы посадки) возвращаются на 'Orbitron', как в самом
        рецепте. Класс проставляется в JS (pickerField() в app.js) по kind поля.
   Параллельно то же деление применяется к всплывающему пикеру значений:
   .patients-picker-overlay.patients-picker-text ниже переключает список пикера
   на 'Monitorica' только для текстовых kind (дизайн/модификация/технология);
   числовые пикеры (SPH/CYL/AXIS/PD/...) остаются на базовом Orbitron нетронутыми. */
#patientsView input,
#patientsView textarea,
#patientsView select {
    font-family: 'Monitorica', sans-serif;
}

#patientsView input.patients-numeric-input {
    font-family: 'Orbitron', monospace;
}

.patients-hint {
    font-size: 0.85em;
    color: var(--muted);
    opacity: 0.75;
    margin-bottom: 10px;
    line-height: 1.4;
}

/* Живая подсказка "Определена ветка: ..." под полем "Тип визита" — идёт после
   textarea, а не перед блоком, поэтому нужен отступ сверху, а не снизу */
.anamnesis-branch-hint {
    margin-top: 6px;
    margin-bottom: 0;
}

.patients-hint-warning {
    color: #fbbf24;
    opacity: 0.9;
}

/* Дата рождения: обычное текстовое поле с автоформатированием "на лету" —
   вводятся только цифры, точки (ДД.ММ.ГГГГ) подставляются сами по мере ввода
   (см. formatBirthDateMaskValue/wireBirthDateMask в app.js). Возраст под полем
   пересчитывается вживую */
.patients-birthdate-age {
    display: block;
    margin-top: 4px;
    margin-bottom: 0;
}

.patients-summary-textarea {
    font-family: 'Monitorica', sans-serif;
    line-height: 1.6;
    resize: vertical;
}

.patients-summary-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 10px;
}

/* Действия с самой картой находятся рядом с данными пациента: редактирование
   слева, удаление карты справа. При переходе в режим редактирования кнопки
   "Сохранить" и "Отмена" остаются в левой группе. */
.patients-identity-actions {
    justify-content: flex-start;
    align-items: center;
    flex-wrap: wrap;
}

.patients-identity-actions .btn-delete-patient {
    margin-left: auto;
}

/* --- Overview sub-state: полная карта пациента + история приёмов --- */

.patients-overview-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding-top: 16px;
}

.patients-identity-view {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
}

.patients-identity-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.patients-identity-label {
    font-family: 'Monitorica', sans-serif;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted);
    opacity: 0.7;
}

.patients-identity-value {
    font-family: 'Monitorica', sans-serif;
    font-size: 15px;
    color: rgba(234, 242, 255, 0.95);
}

.patients-overview-visits-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 12px;
}

.patients-overview-visits-header .recipe-section-title {
    margin: 0;
}

.btn-new-visit {
    flex-shrink: 0;
    padding: 8px 18px;
    font-size: 0.85em;
}

.visits-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.visit-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.18s ease;
}

.visit-row:hover {
    background: rgba(34, 211, 238, 0.06);
    border-color: rgba(34, 211, 238, 0.2);
}

.visit-row:focus-visible {
    outline: 2px solid rgba(34, 211, 238, 0.8);
    outline-offset: 2px;
}

/* Компактная строка истории: вся рамка является кнопкой открытия приёма. */
.visit-row-summary {
    position: relative;
    justify-content: center;
    min-height: 72px;
    padding: 16px 20px;
    overflow: hidden;
    border-color: rgba(34, 211, 238, 0.24);
    animation: visitRowGlowPulse 2.8s ease-in-out infinite;
}

.visit-row-title {
    font-family: 'Monitorica', sans-serif;
    font-size: 1.05em;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-align: center;
    color: var(--cyan);
    text-shadow: 0 0 8px rgba(34, 211, 238, 0.35);
}

@keyframes visitRowGlowPulse {
    0%, 100% {
        border-color: rgba(34, 211, 238, 0.24);
        box-shadow: 0 0 0 rgba(34, 211, 238, 0), inset 0 0 0 rgba(34, 211, 238, 0);
    }
    50% {
        border-color: rgba(34, 211, 238, 0.5);
        box-shadow: 0 0 16px rgba(34, 211, 238, 0.15), inset 0 0 12px rgba(34, 211, 238, 0.05);
    }
}

/* Приём, чья карточка сейчас развёрнута ниже (visitDetailView) — там уже есть
   свои "Редактировать"/"Удалить", поэтому кнопки строки скрыты (см. renderVisitsList) */
.visit-row-expanded {
    border-color: rgba(34, 211, 238, 0.35);
    background: rgba(34, 211, 238, 0.05);
}

.visit-row-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
    cursor: inherit;
}

.visit-row-date {
    font-family: 'Monitorica', sans-serif;
    font-size: 0.95em;
    font-weight: 600;
    color: var(--cyan);
}

.visit-row-preview {
    font-size: 0.85em;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.visit-row-comment {
    font-size: 0.8em;
    color: rgba(234, 242, 255, 0.6);
    font-style: italic;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.visit-row-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.visit-row-actions .btn-patients-secondary {
    padding: 6px 14px;
    font-size: 0.8em;
}

/* Раскрытая карточка приёма появляется и закрывается симметрично. display:none
   ставится JavaScript только после visitDetailExit, поэтому закрытие больше не
   выглядит мгновенным исчезновением. */
#visitDetailView.visit-detail-enter {
    animation: visitDetailEnter 0.36s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
}

#visitDetailView.visit-detail-exit {
    pointer-events: none;
    animation: visitDetailExit 0.3s cubic-bezier(0.55, 0.055, 0.675, 0.19) both;
}

@keyframes visitDetailEnter {
    from {
        opacity: 0;
        transform: translateY(14px) scale(0.985);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes visitDetailExit {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(14px) scale(0.985);
    }
}

@media (prefers-reduced-motion: reduce) {
    .visit-row-summary {
        animation: none !important;
    }

    #visitDetailView.visit-detail-enter,
    #visitDetailView.visit-detail-exit {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }
}

/* V33 — свободное место раскрытой сцены не растягивает мобильную шапку. */
@media (max-width: 720px) {
    #patientsView #patientsWizardState[data-wizard-step="1"]
        .patient-dialog-screen.has-open-anamnesis-rationale {
        align-content: start !important;
    }

    #patientsView #patientsWizardState[data-wizard-step="1"]
        .patient-dialog-screen.has-open-anamnesis-rationale .patient-dialog-header {
        align-self: start;
        justify-content: flex-start !important;
        width: 100%;
        height: auto !important;
        min-height: 0 !important;
    }
}

/* V34 — раскрытый анамнез прокручивается внутри рабочей области приложения.
   Глобальный body намеренно остаётся фиксированным. */
@media (max-width: 720px) {
    #patientsView .patients-wrapper:has(.patient-dialog-screen.has-open-anamnesis-rationale) {
        overflow-x: hidden !important;
        overflow-y: auto !important;
        overscroll-behavior-y: contain;
        -webkit-overflow-scrolling: touch;
    }

    #patientsView #patientsWizardState:has(.patient-dialog-screen.has-open-anamnesis-rationale) {
        flex: 0 0 auto;
        width: 100%;
        height: auto !important;
        min-height: 100% !important;
        max-height: none !important;
        overflow: visible !important;
    }
}

/* V35 — высота раскрытия равна фактическому тексту: без пустого хвоста между
   сообщением и composer, с равномерной анимацией открытия и закрытия. */
@media (max-width: 720px) {
    #patientsView #patientsWizardState[data-wizard-step="1"]
        .anamnesis-question-card.has-open-rationale {
        min-height: 0 !important;
    }

    #patientsView #patientsWizardState[data-wizard-step="1"]
        .anamnesis-rationale-content {
        transition:
            max-height .56s cubic-bezier(.22, 1, .36, 1),
            margin-top .4s ease,
            padding .4s ease,
            opacity .34s ease,
            transform .5s cubic-bezier(.22, 1, .36, 1),
            border-color .4s ease,
            visibility 0s linear .56s;
    }

    #patientsView #patientsWizardState[data-wizard-step="1"]
        .anamnesis-rationale-content.is-open {
        max-height: var(--anamnesis-rationale-height, 360px);
        transition-delay: 0s;
    }
}

/* --- Читаемая карточка приёма (только чтение) --- */

.visit-detail-content {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.visit-detail-block-title {
    font-family: 'Monitorica', sans-serif;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--cyan);
    opacity: 0.85;
    margin-bottom: 8px;
}

.visit-detail-summary-text {
    font-size: 0.95em;
    line-height: 1.6;
    color: rgba(234, 242, 255, 0.9);
    white-space: pre-wrap;
}

.visit-detail-comment {
    font-size: 0.9em;
    line-height: 1.5;
    color: rgba(234, 242, 255, 0.75);
    font-style: italic;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.03);
    border-left: 2px solid rgba(34, 211, 238, 0.4);
    border-radius: 4px;
}

/* Учебная подсказка ИИ на шаге "Диагностика" (что проверить / какие линзы) —
   не форма ввода, просто текст-ответ, поэтому карточка, а не textarea */
.patients-exam-guidance-result {
    margin-top: 12px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.03);
    border-left: 2px solid rgba(34, 211, 238, 0.4);
    border-radius: 4px;
    font-size: 0.9em;
    line-height: 1.6;
    color: rgba(234, 242, 255, 0.9);
    white-space: pre-wrap;
}

/* Строка из двух колонок OD/OS — чтобы значения по каждому глазу были чётко
   разделены, а не смешивались в одну общую сетку */
.visit-detail-eyes-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.visit-detail-eye-col {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

/* OD/OS раньше отличались только цветом подписи 12px (у обоих одинаковый
   --cyan) — на мобильном, где .visit-detail-eyes-row складывается в один
   столбец (см. @media ниже), эта разница практически не читалась, и глаза
   визуально сливались. Теперь у каждого глаза свой акцентный цвет левой рамки
   ПЛЮС подпись оформлена как плашка с заливкой (не просто цветной текст) —
   разница видна с одного взгляда даже при беглом скролле на телефоне.
   :first-child/:last-child работают надёжно, т.к. eyeColumn() в app.js всегда
   вызывается в порядке OD, затем OS (см. eyesRow(odColumn, osColumn)). */
.visit-detail-eye-col:first-child {
    border-left: 3px solid var(--cyan);
}
.visit-detail-eye-col:last-child {
    border-left: 3px solid var(--violet);
}

.visit-detail-eye-label {
    font-family: 'Monitorica', sans-serif;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: var(--bg0);
    background: var(--cyan);
    display: inline-block;
    width: fit-content;
    padding: 3px 10px;
    border-radius: 6px;
}

.visit-detail-eye-col:last-child .visit-detail-eye-label {
    background: var(--violet);
}

/* Плашка "для постоянного ношения" — рядом с заголовком рецепта в режиме
   просмотра визита, тот же приём плашки-заливки, что и у .visit-detail-eye-label,
   но своим акцентом (--emerald), чтобы не путать с OD/OS. */
.visit-detail-permanent-badge {
    font-family: 'Monitorica', sans-serif;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--bg0);
    background: var(--emerald);
    display: inline-block;
    padding: 2px 8px;
    border-radius: 6px;
    margin-left: 8px;
    vertical-align: middle;
}

.visit-detail-pd-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 10px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.visit-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(64px, 1fr));
    gap: 8px;
}

.visit-detail-stat {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
}

.visit-detail-stat-label {
    font-family: 'Monitorica', sans-serif;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted);
    opacity: 0.7;
}

.visit-detail-stat-value {
    font-family: 'Monitorica', sans-serif;
    font-size: 14px;
    color: rgba(234, 242, 255, 0.95);
}

/* Тот же Orbitron/Monitorica разлом, что и в полях ввода этой же карты (см.
   карту переопределений шрифта на вкладке "Пациенты" выше, #patientsView
   input.patients-numeric-input) — числа (диоптрии, острота зрения, PD, BC/DIA,
   коэффициент, углы посадки) в режиме ПРОСМОТРА приёма должны выглядеть тем же
   шрифтом, что и в режиме РЕДАКТИРОВАНИЯ, иначе одно и то же число визуально
   "меняет шрифт" при переключении между карточкой и формой. Класс проставляется
   в stat(label, value, numeric) в app.js. */
.visit-detail-stat-value.visit-detail-stat-value-numeric {
    font-family: 'Orbitron', monospace;
}

.visit-detail-empty {
    font-size: 0.9em;
    color: var(--muted);
    opacity: 0.6;
    font-style: italic;
}

.patients-wizard-nav {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 14px;
    padding-top: 16px;
    margin-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
}

.wizard-save-status {
    flex: 1;
    text-align: center;
    font-size: 0.85em;
    color: var(--emerald);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.wizard-save-status.visible {
    opacity: 1;
}

@media (max-width: 768px) {
    .patients-wrapper {
        padding: 14px;
        /* Тот же приём, что и у #chatView .chat-container (см. styles.css) —
           заголовок должен быть на уровне гамбургера (.btn-mobile-menu,
           фикс. top:8px вне этого контейнера), а не заметно ниже него. */
        padding-top: 4px;
    }

    .patients-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    /* На телефоне ФИО занимает всю верхнюю строку карточки, а дата рождения
       и телефон собираются отдельной строкой ниже. Кнопка удаления вынесена
       в собственную колонку, поэтому больше не отнимает место у имени. */
    #patientsList .patient-row {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 34px;
        grid-template-areas:
            "name delete"
            "meta delete";
        align-items: center;
        column-gap: 12px;
        row-gap: 8px;
        min-height: 82px;
        padding: 14px 16px;
    }

    #patientsList .patient-row-name {
        grid-area: name;
        align-self: end;
        overflow: visible;
        text-overflow: clip;
        white-space: normal;
        overflow-wrap: anywhere;
        font-size: 1em;
        line-height: 1.25;
    }

    #patientsList .patient-row-meta {
        grid-area: meta;
        align-self: start;
        min-width: 0;
        display: flex;
        flex-wrap: wrap;
        gap: 4px 12px;
        font-size: 0.86em;
        line-height: 1.35;
    }

    #patientsList .patient-row-meta span {
        white-space: nowrap;
    }

    #patientsList .patient-row-delete {
        grid-area: delete;
        justify-self: end;
        width: 32px;
        height: 32px;
    }

    .patient-row-delete,
    .visit-row-delete {
        opacity: 1;
    }

    /* Корзина ("Удалённые") использует те же классы .patient-row/-name/-meta, что
       и основной список (см. #patientsList выше), но раньше мобильную раскладку
       получал только #patientsList — карточки корзины оставались на десктопной
       flex-строке без переноса, из-за чего ФИО схлопывалось до нуля ширины (flex:1
       против несжимаемых meta-текста и кнопки), а кнопка "Восстановить" обрезалась
       по краю экрана. У кнопки восстановления, в отличие от иконки "✕" в основном
       списке, есть текст — под неё выделена отдельная полноширинная строка снизу,
       а не узкая колонка сбоку. Жалоба 2026-08-15. */
    #patientsTrashList .patient-row {
        display: grid;
        grid-template-columns: 1fr;
        grid-template-areas:
            "name"
            "meta"
            "restore";
        align-items: start;
        row-gap: 8px;
        padding: 14px 16px;
    }

    #patientsTrashList .patient-row-name {
        grid-area: name;
        overflow: visible;
        text-overflow: clip;
        white-space: normal;
        overflow-wrap: anywhere;
        font-size: 1em;
        line-height: 1.25;
    }

    #patientsTrashList .patient-row-meta {
        grid-area: meta;
        min-width: 0;
        display: flex;
        flex-wrap: wrap;
        gap: 4px 12px;
        font-size: 0.86em;
        line-height: 1.35;
    }

    #patientsTrashList .patient-row-meta span {
        white-space: nowrap;
    }

    #patientsTrashList .patient-row-restore {
        grid-area: restore;
        justify-self: start;
        width: 100%;
    }

    .patients-wizard-header-actions {
        flex-wrap: wrap;
        width: 100%;
    }

    #visitDetailView .patients-wizard-header-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        margin-left: 0;
    }

    #visitDetailView .patients-wizard-header-actions button {
        width: 100%;
        min-height: 42px;
        padding-left: 10px;
        padding-right: 10px;
    }

    #visitDetailView #btnPrintVisit {
        grid-column: 1 / -1;
        min-height: 46px;
        font-weight: 700;
    }

    .patients-overview-visits-header {
        flex-direction: column;
        align-items: stretch;
    }

    .visit-row {
        flex-wrap: wrap;
    }

    .visit-row-actions {
        flex-wrap: wrap;
        width: 100%;
    }

    .visit-detail-eyes-row {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   ДЕСКТОП/ПЛАНШЕТ: тот же визуальный язык, что и на телефоне
   ============================================
   По просьбе переносим на широкий экран (без @media — эти правила действуют
   на ЛЮБОЙ ширине) весь набор изменений, сделанный для телефона за эту
   сессию: гамбургер + выезжающая шторка вместо постоянного сайдбара,
   безрамочные панели/сообщения, поле ввода со свечением вместо рамки и
   круглой кнопкой отправки. Блок стоит в САМОМ КОНЦЕ файла намеренно — при
   равной специфичности каскад решает по порядку в файле, а не по тому,
   "внутри ли правило @media" — этот приём уже не раз использовался в этом
   файле (см. многочисленные комментарии выше про порядок каскада), здесь он
   же гарантирует, что этот блок выигрывает у ВСЕХ более ранних десктопных и
   табletных (@media max-width:1024px) правил для тех же селекторов, не
   заставляя выискивать и переписывать их по отдельности.

   Два явных исключения — специально НЕ переносим (пользователь попросил
   оставить как на десктопе, там есть место): музыкальный плеер и
   переключатель длины ответа в строке ввода остаются видимыми. Их
   .music-player/.mode-help-wrapper/.reply-length-seg{display:none} мобильные
   правила (см. выше в файле) сюда не продублированы. */

/* --- Гамбургер + шторка вместо постоянного сайдбара --- */
.btn-mobile-menu {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 8px;
    left: 8px;
    width: auto;
    height: auto;
    padding: 8px;
    border-radius: 0;
    background: transparent;
    border: none;
    box-shadow: none;
    color: var(--cyan);
    font-size: 16px;
    z-index: 210;
    cursor: pointer;
    text-shadow:
        0 0 8px rgba(34, 211, 238, 0.4),
        0 0 12px rgba(34, 211, 238, 0.2);
}

.btn-mobile-menu:hover {
    color: rgba(34, 211, 238, 1);
    text-shadow:
        0 0 12px rgba(34, 211, 238, 0.8),
        0 0 20px rgba(34, 211, 238, 0.5);
}

.sidebar-backdrop.active {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 190;
    animation: sidebarBackdropFadeIn 0.2s ease;
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: min(300px, 82vw);
    height: 100dvh;
    max-height: 100dvh;
    z-index: 200;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 8px 0 40px rgba(0, 0, 0, 0.5);
    border-radius: 0 var(--radius) var(--radius) 0;
    padding-top: 64px;
    border: none;
}

.sidebar.mobile-open {
    transform: translateX(0);
}

.sidebar::before,
.sidebar::after {
    display: none;
}

.sidebar .hud-corner {
    display: none;
}

.sidebar-nav {
    flex: 0 0 auto;
    flex-direction: column;
    overflow: visible;
}

.sidebar-item {
    width: 100%;
    flex: 0 0 auto;
}

.sidebar-toggle {
    display: none;
}

.btn-close-drawer {
    display: none;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 4px;
    right: 4px;
    width: auto;
    height: auto;
    padding: 12px;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    color: var(--cyan);
    font-size: 22px;
    line-height: 1;
    z-index: 5;
    cursor: pointer;
    text-shadow:
        0 0 8px rgba(34, 211, 238, 0.4),
        0 0 12px rgba(34, 211, 238, 0.2);
}

.btn-close-drawer:hover {
    color: rgba(34, 211, 238, 1);
    text-shadow:
        0 0 12px rgba(34, 211, 238, 0.8),
        0 0 20px rgba(34, 211, 238, 0.5);
}

.sidebar.mobile-open .btn-close-drawer {
    display: flex;
}

.sidebar-footer {
    margin-top: auto;
    margin-left: 0;
    padding-top: 16px;
    padding-left: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    border-left: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.rag-status {
    flex: 1 1 auto;
    min-width: 0;
    background: transparent;
    border: none;
}

.rag-status span:not(.status-dot) {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#btnLogoutSidebar {
    width: auto !important;
    margin-top: 0 !important;
    flex: 0 0 auto;
    white-space: nowrap;
    background: transparent !important;
    border: none !important;
}

.sidebar-item,
.sidebar-item:hover,
.sidebar-item.active {
    background: transparent;
    border-color: transparent;
}

.btn-new-chat,
.btn-new-chat:hover {
    background: transparent;
    border: none;
    box-shadow: none;
    transform: none;
}

.sidebar-translate-icon {
    display: none;
}

/* --- Безрамочные панели, как у ChatGPT/Claude --- */
.chat-container,
.patients-wrapper,
.spectacle-lenses-wrapper {
    border: none;
    box-shadow: none;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.chat-container::before,
.chat-container::after,
.patients-wrapper::before,
.patients-wrapper::after {
    display: none;
}

.chat-container .hud-corner {
    display: none;
}

#chatView .chat-container {
    padding-top: 4px !important;
}

.patients-wrapper {
    padding-top: 4px;
}

.chat-messages {
    border: none;
    border-radius: 0;
    background: transparent;
    scrollbar-width: none;
    scrollbar-gutter: auto;
}

.chat-messages::-webkit-scrollbar {
    display: none;
    width: 0;
}

.message.assistant {
    background: none;
    border: none;
    box-shadow: none;
    padding: 8px 4px;
    max-width: 100%;
}

/* --- Шапка модуля: компактная, по центру, место под гамбургер --- */
.chat-header {
    padding-left: 48px;
    padding-right: 48px;
    justify-content: center;
    flex-wrap: wrap;
}

.chat-header-main,
.chat-title-group {
    min-width: 0;
}

.chat-header-main {
    justify-content: center;
    flex: 1 1 100%;
    position: relative;
}

.chat-title-group {
    align-items: center;
    flex: 1 1 100%;
}

.chat-title {
    font-size: 1em;
    text-align: center;
    overflow: hidden;
}

/* Заголовок — оставляем ПОЛНЫЙ десктопный текст (не короткий "AI
   Optometrist", как на телефоне, где он не помещался), просто тем же
   меньшим размером, что и в мобильной версии (см. .chat-title выше в этом
   блоке) — .chat-title-full/-short тут НЕ трогаем, работает их базовое
   правило (см. начало файла): full виден, short скрыт. */
.chat-subtitle,
.rag-status-top,
#btnLogout {
    display: none;
}

.patients-wizard-header-actions {
    flex: 0 0 auto;
    margin: 4px 0 0 auto;
    display: flex;
    gap: 6px;
}

.patients-wizard-header-actions .btn-patients-secondary {
    padding: 6px 10px;
    font-size: 0.7em;
    white-space: nowrap;
}

#btnBackToPatientsListFromTrash,
#btnBackToPatientsListFromOverview,
#btnBackToPatientsList {
    display: none;
}

.btn-patients-back-arrow {
    left: auto;
    right: 8px;
}

/* --- Поле ввода: свечение вместо рамки, круглая кнопка отправки ---
   Плеер и переключатель длины ответа НЕ прячем (см. заметку в начале блока) —
   .chat-input-wrapper просто получает чуть меньший gap, чтобы им всем было
   удобнее в одну строку. */
.chat-input-wrapper {
    gap: 8px;
}

.input-bar {
    min-width: 0;
    gap: 8px;
    height: auto;
    min-height: 52px;
    max-height: none;
    padding: 8px 12px;
    border-color: transparent;
    background: #101a30;
    box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.22), 0 0 18px rgba(34, 211, 238, 0.12);
}

.input-bar:focus-within {
    border-color: transparent;
    background: #101a30;
    box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.45), 0 0 22px rgba(34, 211, 238, 0.22);
}

#chatView .chat-messages {
    margin-bottom: 90px;
}

.btn-send {
    width: 36px !important;
    height: 36px;
    padding: 0;
    border-radius: 50%;
    font-size: 0;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: center;
}

.btn-send::after {
    content: "↑";
    font-size: 16px;
    line-height: 1;
    font-family: 'Monitorica', sans-serif;
}

/* --- Пустой экран чата: тот же короткий вопрос по центру, тем же
   Monitorica/капс/свечением шрифтом, что и на телефоне — вместо
   заголовка+подзаголовка+карточек-примеров+"ещё"+описания поддерживаемых
   функций. Всё лишнее убрано, а не уменьшено (см. .empty-state-title-mobile
   ниже — та же самая мобильная версия текста, просто теперь видна везде). */
.empty-state-title {
    display: none;
}

.empty-state-title-mobile {
    display: block;
    font-family: 'Monitorica', sans-serif;
    font-size: 1.3em;
    font-weight: 500;
    color: rgba(34, 211, 238, 0.85);
    letter-spacing: 1px;
    text-transform: uppercase;
    text-shadow: 0 0 6px rgba(34, 211, 238, 0.3);
    text-align: center;
}

.empty-state-subtitle,
.empty-state-suggestions,
.empty-state-extended,
.empty-state-footer {
    display: none;
}

/* --- То же самое для пустого/ошибочного состояния списка пациентов --- */
.patients-empty-state p {
    font-family: 'Monitorica', sans-serif;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.patients-empty-state > p:first-child {
    font-size: 1.05em;
    color: rgba(34, 211, 238, 0.85);
    text-shadow: 0 0 6px rgba(34, 211, 238, 0.3);
}

.patients-empty-hint {
    font-size: 0.8em;
    color: rgba(234, 242, 255, 0.5);
}

/* ========================================================================== */
/* Patients dialogue screen v4 — обычная геометрия чата, без вложенного поля */
/* ========================================================================== */

#patientsWizardState[data-wizard-step="1"] .patient-dialog-body .anamnesis-question-card {
    position: relative;
    padding: 18px 34px 24px;
}

#patientsWizardState[data-wizard-step="1"] .patient-dialog-body .anamnesis-conversation-feed {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: 100%;
    height: 100%;
    min-height: 0;
    padding-bottom: 74px;
}

#patientsWizardState[data-wizard-step="1"] .patient-dialog-body .anamnesis-message-current {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    align-items: start;
    gap: 11px;
    width: min(100%, 820px);
    height: auto;
    min-height: 0;
    max-width: 100%;
}

#patientsWizardState[data-wizard-step="1"] .patient-dialog-body .anamnesis-message-avatar {
    width: 42px;
    height: 42px;
    margin-top: 0;
    border: 1px solid rgba(69, 225, 251, 0.55);
    border-radius: 13px;
    background: transparent;
    box-shadow: 0 0 18px rgba(44, 213, 242, 0.13), inset 0 0 16px rgba(44, 213, 242, 0.05);
}

#patientsWizardState[data-wizard-step="1"] .patient-dialog-body .anamnesis-message-bubble,
#patientsWizardState[data-wizard-step="1"] .patient-dialog-body .anamnesis-message-current .anamnesis-message-bubble {
    display: block;
    width: auto;
    min-width: 0;
    min-height: 0;
    height: auto;
    padding: 12px 15px 13px;
    border: 1px solid rgba(65, 224, 251, 0.58);
    border-radius: 5px 16px 16px 16px;
    background: transparent !important;
    box-shadow: 0 0 18px rgba(39, 207, 237, 0.08), inset 0 0 18px rgba(39, 207, 237, 0.025);
}

#patientsWizardState[data-wizard-step="1"] .patient-dialog-body .anamnesis-message-meta {
    margin: 0 0 7px;
    font-size: 9px;
}

#patientsWizardState[data-wizard-step="1"] .patient-dialog-body .anamnesis-question[data-question-type="text"] {
    display: block;
    min-height: 0;
    height: auto;
    margin: 0;
}

#patientsWizardState[data-wizard-step="1"] .patient-dialog-body .anamnesis-chat-question-text {
    color: rgba(239, 249, 253, 0.96);
    font-family: 'Monitorica', sans-serif;
    font-size: 16px;
    font-weight: 400;
    line-height: 1.5;
    letter-spacing: 0.01em;
    text-transform: none;
    text-shadow: none;
}

#patientsWizardState[data-wizard-step="1"] .patient-dialog-body .anamnesis-branch-hint {
    margin: 7px 0 0;
    font-size: 11px;
}

#patientsWizardState[data-wizard-step="1"] .patient-dialog-body .anamnesis-chat-composer {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    order: initial;
    display: flex;
    align-items: flex-end;
    gap: 7px;
    width: auto;
    min-height: 58px;
    height: auto;
    margin: 0;
    padding: 6px;
    border: 1px solid rgba(67, 222, 249, 0.62);
    border-radius: 17px;
    background: transparent !important;
    box-shadow: 0 0 20px rgba(38, 207, 238, 0.09), inset 0 0 18px rgba(38, 207, 238, 0.025);
}

#patientsWizardState[data-wizard-step="1"] .patient-dialog-body .anamnesis-chat-composer[hidden] {
    display: none !important;
}

#patientsWizardState[data-wizard-step="1"] #patientsView .anamnesis-chat-composer .anamnesis-text-input,
#patientsWizardState[data-wizard-step="1"] .patient-dialog-body .anamnesis-chat-composer .anamnesis-text-input {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
    min-height: 44px;
    max-height: 118px;
    height: 44px;
    margin: 0;
    padding: 10px 11px 8px;
    overflow-y: auto;
    resize: none;
    border: 0 !important;
    border-radius: 0;
    outline: 0;
    background: transparent !important;
    box-shadow: none !important;
    color: rgba(238, 249, 253, 0.96);
    font-size: 15px;
    line-height: 1.45;
}

#patientsWizardState[data-wizard-step="1"] .patient-dialog-body .anamnesis-chat-send,
#patientsWizardState[data-wizard-step="1"] .patient-dialog-body .anamnesis-chat-back {
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    border-radius: 13px;
}

#patientsWizardState[data-wizard-step="1"] .patient-dialog-body .anamnesis-message-user.is-pending {
    position: relative;
    right: auto;
    bottom: auto;
    left: auto;
    z-index: 1;
    align-self: flex-end;
    width: auto;
    max-width: min(72%, 680px);
    margin: 0;
}

#patientsWizardState[data-wizard-step="1"] .patient-dialog-body .anamnesis-message-user .anamnesis-message-bubble {
    padding: 10px 14px;
    border: 1px solid rgba(145, 111, 255, 0.72);
    border-radius: 16px 5px 16px 16px;
    background: transparent !important;
    box-shadow: 0 0 18px rgba(119, 81, 244, 0.11), inset 0 0 18px rgba(119, 81, 244, 0.025);
    color: rgba(242, 247, 255, 0.97);
    font-size: 15px;
    line-height: 1.45;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

#patientsWizardState[data-wizard-step="1"] .anamnesis-question-card.is-writing {
    opacity: 1;
    filter: none;
}

#patientsWizardState[data-wizard-step="1"] .anamnesis-message-current.is-submitted {
    max-height: none;
    overflow: visible;
    opacity: 0.52;
}

@media (max-width: 720px) {
    #patientsWizardState[data-wizard-step="1"] .patient-dialog-body .anamnesis-question-card {
        padding: 12px 18px 18px;
    }

    #patientsWizardState[data-wizard-step="1"] .patient-dialog-body .anamnesis-message-current {
        grid-template-columns: 36px minmax(0, 1fr);
        gap: 8px;
    }

    #patientsWizardState[data-wizard-step="1"] .patient-dialog-body .anamnesis-message-avatar {
        width: 36px;
        height: 36px;
        border-radius: 11px;
    }

    #patientsWizardState[data-wizard-step="1"] .patient-dialog-body .anamnesis-chat-question-text {
        font-size: 15px;
    }

    #patientsWizardState[data-wizard-step="1"] .patient-dialog-body .anamnesis-message-user.is-pending {
        max-width: 86%;
    }
}

/* ========================================================================== */
/* Patients intake workspace v2 — крупный одноэкранный сценарий               */
/* ========================================================================== */

#patientsWizardState .patients-wizard-body {
    max-width: 1180px;
}

.patients-wizard-steps {
    width: min(100%, 1180px);
    margin: 7px auto 12px;
}

.patients-wizard-step-indicator {
    position: relative;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.patients-wizard-step-indicator::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 8%;
    right: 8%;
    z-index: 0;
    height: 1px;
    background: linear-gradient(90deg, rgba(42, 211, 240, 0.45), rgba(116, 93, 238, 0.25));
    box-shadow: 0 0 12px rgba(48, 209, 238, 0.12);
}

.wizard-step {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 10px;
    align-items: center;
    gap: 11px;
    min-height: 66px;
    padding: 10px 14px;
    overflow: hidden;
    border: 1px solid rgba(137, 181, 205, 0.15);
    border-radius: 14px;
    background: linear-gradient(145deg, rgba(15, 31, 59, 0.96), rgba(9, 19, 40, 0.97));
    color: rgba(190, 217, 230, 0.58);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035), 0 8px 25px rgba(1, 7, 22, 0.15);
    font-family: 'Monitorica', sans-serif;
    cursor: pointer;
    transition: transform 0.25s ease, border-color 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
}

.wizard-step::after {
    content: '';
    position: absolute;
    inset: auto 12% 0;
    height: 1px;
    opacity: 0;
    background: linear-gradient(90deg, transparent, #45dcf7, transparent);
    box-shadow: 0 0 12px rgba(69, 220, 247, 0.8);
    transition: opacity 0.25s ease;
}

.wizard-step:hover {
    transform: translateY(-2px);
    border-color: rgba(110, 210, 235, 0.28);
    background: linear-gradient(145deg, rgba(19, 40, 70, 0.98), rgba(11, 23, 47, 0.98));
    color: rgba(223, 241, 249, 0.84);
}

.wizard-step-index {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border: 1px solid rgba(130, 183, 208, 0.17);
    border-radius: 12px;
    background: rgba(3, 12, 29, 0.5);
    color: rgba(151, 195, 215, 0.52);
    font-family: 'Orbitron', sans-serif;
    font-size: 11px;
    font-weight: 600;
}

.wizard-step-copy {
    min-width: 0;
}

.wizard-step-copy strong,
.wizard-step-copy small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wizard-step-copy strong {
    color: inherit;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.45px;
}

.wizard-step-copy small {
    margin-top: 4px;
    color: rgba(151, 190, 209, 0.43);
    font-size: 10px;
    letter-spacing: 0.3px;
}

.wizard-step-node {
    width: 8px;
    height: 8px;
    border: 1px solid rgba(144, 188, 208, 0.32);
    border-radius: 50%;
    background: #0b1730;
    box-shadow: 0 0 0 4px rgba(6, 17, 38, 0.88);
}

.wizard-step.active {
    transform: none;
    border-color: rgba(54, 219, 248, 0.48);
    background:
        radial-gradient(circle at 12% 50%, rgba(31, 202, 235, 0.14), transparent 36%),
        linear-gradient(145deg, rgba(14, 48, 77, 0.98), rgba(12, 28, 58, 0.98));
    color: #c8f6ff;
    box-shadow: inset 0 1px 0 rgba(128, 234, 255, 0.12), 0 0 26px rgba(32, 199, 230, 0.1);
}

.wizard-step.active::after { opacity: 1; }

.wizard-step.active .wizard-step-index {
    border-color: rgba(61, 222, 250, 0.56);
    color: #57e4fc;
    background: rgba(24, 165, 195, 0.11);
    box-shadow: 0 0 18px rgba(52, 215, 244, 0.1);
}

.wizard-step.active .wizard-step-copy small { color: rgba(105, 222, 242, 0.7); }
.wizard-step.active .wizard-step-node { border-color: #51e2fa; background: #51e2fa; box-shadow: 0 0 0 4px rgba(6, 17, 38, 0.9), 0 0 14px rgba(81, 226, 250, 0.8); }

.wizard-step.completed {
    border-color: rgba(57, 211, 172, 0.28);
    color: rgba(219, 246, 239, 0.82);
}

.wizard-step.completed .wizard-step-node { border-color: #3bd5ae; background: #3bd5ae; }

#wizardStep1.active {
    animation: intakeWorkspaceEnter 0.42s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.patient-intake-console {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) minmax(270px, 0.78fr);
    grid-template-areas:
        "kicker visit"
        "identity visit";
    align-items: center;
    gap: 3px 24px;
    min-height: 112px;
    margin-bottom: 11px;
    padding: 15px 20px;
}

.patient-intake-kicker { grid-area: kicker; margin-bottom: 3px; font-size: 11px; }
.patient-intake-identity-view { grid-area: identity; min-width: 0; }
.patient-intake-name strong { font-size: clamp(27px, 3.1vw, 39px); }
.patient-intake-name span { font-size: clamp(17px, 1.85vw, 22px); }
.patient-intake-meta { margin-top: 8px; font-size: 12px; }

.patient-intake-visit {
    grid-area: visit;
    grid-template-columns: 1fr;
    gap: 8px;
    margin: 0;
    padding: 0 0 0 20px;
    border-top: 0;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
}

.patient-intake-visit-field > span { font-size: 10px; }
#patientsView .patient-intake-visit .recipe-form-input { min-height: 42px; font-size: 13px; }
#patientsView .patient-intake-visit textarea.recipe-form-input { height: 42px; min-height: 42px; }

.anamnesis-ai-console {
    min-height: 344px;
    border-radius: 18px;
}

.adaptive-anamnesis-toolbar {
    min-height: 68px;
    padding: 13px 18px;
}

.adaptive-anamnesis-signal { width: 36px; height: 36px; padding: 9px; }
.adaptive-anamnesis-title { font-size: 15px; letter-spacing: 0.8px; }
.adaptive-anamnesis-caption { margin-top: 4px; font-size: 11px; }

.adaptive-anamnesis-modes {
    width: 300px;
    min-width: 300px;
    height: 44px;
    padding: 4px;
    border-radius: 14px;
}

.adaptive-mode-slider { top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px); border-radius: 10px; }
.adaptive-mode-btn { font-size: 13px; }

.anamnesis-console-state {
    min-height: 45px;
    padding: 9px 18px;
}

.adaptive-anamnesis-status { font-size: 12px; }
.anamnesis-progress { width: min(41%, 330px); }
.anamnesis-progress-text { font-size: 11px; }
.anamnesis-progress-bar { height: 4px; }

.anamnesis-question-card {
    min-height: 220px;
    padding: 17px 18px 18px;
}

.anamnesis-conversation-feed {
    height: 100%;
    gap: 0;
}

.anamnesis-message-current {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 12px;
    width: 100%;
    max-width: none;
}

.anamnesis-message-avatar {
    flex-basis: 44px;
    width: 44px;
    height: 44px;
    border-radius: 13px;
    font-size: 10px;
}

.anamnesis-message-current .anamnesis-message-bubble {
    display: block;
    width: 100%;
    min-height: 180px;
    padding: 15px 17px;
    border-radius: 5px 18px 18px 18px;
}

.anamnesis-message-meta {
    margin-bottom: 12px;
    font-size: 10px;
}

.anamnesis-message-current .anamnesis-question[data-question-type="text"] {
    display: grid;
    grid-template-columns: minmax(230px, 0.82fr) minmax(280px, 1.18fr);
    grid-template-areas:
        "question answer"
        "hint answer";
    align-items: center;
    gap: 8px 24px;
    min-height: 120px;
}

.anamnesis-message-current .anamnesis-question[data-question-type="text"] .anamnesis-question-label {
    grid-area: question;
    align-self: end;
    margin: 0;
    color: #f0faff;
    font-size: clamp(20px, 2.25vw, 29px);
    font-weight: 500;
    line-height: 1.28;
    letter-spacing: 0.01em;
}

.anamnesis-message-current .anamnesis-question[data-question-type="text"] .anamnesis-text-input {
    grid-area: answer;
    align-self: stretch;
    min-height: 112px;
    height: 100%;
    padding: 15px 17px;
    font-size: 16px;
    line-height: 1.45;
}

.anamnesis-message-current .anamnesis-question[data-question-type="text"] .anamnesis-branch-hint {
    grid-area: hint;
    align-self: start;
    margin: 0;
    font-size: 11px;
}

.anamnesis-message-current .anamnesis-question:not([data-question-type="text"]) .anamnesis-question-label {
    font-size: 20px;
}

.anamnesis-message-row.is-pending {
    position: absolute;
    right: 18px;
    bottom: 17px;
    z-index: 4;
    width: min(48%, 520px);
    max-width: none;
}

.anamnesis-message-current.is-submitted {
    max-height: 82px;
}

.anamnesis-writing-indicator {
    position: absolute;
    right: 18px;
    bottom: 17px;
    left: 76px;
    z-index: 5;
    min-height: 66px;
    margin: 0;
    padding: 12px 16px;
    border-color: rgba(70, 221, 249, 0.28);
    background: rgba(11, 29, 57, 0.96);
    box-shadow: 0 14px 40px rgba(0, 5, 20, 0.32), 0 0 28px rgba(49, 210, 239, 0.08);
}

.anamnesis-writing-indicator strong { font-size: 14px; }
.anamnesis-writing-indicator > div:nth-child(2) span { font-size: 11px; }

@keyframes intakeWorkspaceEnter {
    from { opacity: 0; transform: translateY(8px) scale(0.995); }
    to { opacity: 1; transform: none; }
}

@media (min-width: 1000px) {
    .patient-intake-console { grid-template-columns: minmax(360px, 1fr) minmax(470px, 0.95fr); }
    .patient-intake-visit { grid-template-columns: 170px minmax(260px, 1fr); }
}

@media (max-width: 760px) {
    .patients-wizard-steps { margin-top: 5px; }
    .patients-wizard-step-indicator { gap: 6px; }
    .wizard-step { grid-template-columns: 34px minmax(0, 1fr); min-height: 58px; gap: 8px; padding: 8px; border-radius: 12px; }
    .wizard-step-index { width: 34px; height: 34px; border-radius: 10px; font-size: 9px; }
    .wizard-step-copy strong { font-size: 13px; }
    .wizard-step-copy small { font-size: 8px; }
    .wizard-step-node { display: none; }
}

@media (max-width: 599px) {
    .patients-wizard-step-indicator::before { display: none; }
    .wizard-step { display: flex; justify-content: center; min-height: 48px; padding: 7px; }
    .wizard-step-index { width: 28px; height: 28px; font-size: 8px; }
    .wizard-step-copy small { display: none; }
    .wizard-step-copy strong { font-size: 12px; }

    .patient-intake-console {
        display: block;
        min-height: 0;
        padding: 14px;
    }
    .patient-intake-name strong { font-size: 25px; }
    .patient-intake-name span { font-size: 15px; }
    .patient-intake-meta { font-size: 11px; }
    .patient-intake-visit { grid-template-columns: 1fr 1fr; margin-top: 12px; padding: 11px 0 0; border-top: 1px solid rgba(255, 255, 255, 0.08); border-left: 0; }

    .adaptive-anamnesis-toolbar { align-items: stretch; flex-direction: column; min-height: 0; gap: 11px; padding: 13px; }
    .adaptive-anamnesis-modes { width: 100%; min-width: 0; }
    .anamnesis-console-state { align-items: stretch; flex-direction: column; gap: 7px; }
    .anamnesis-progress { width: 100%; }

    .anamnesis-question-card { padding: 14px 12px; }
    .anamnesis-message-current { grid-template-columns: 36px minmax(0, 1fr); gap: 8px; }
    .anamnesis-message-avatar { width: 36px; height: 36px; }
    .anamnesis-message-current .anamnesis-message-bubble { min-height: 0; padding: 13px; }
    .anamnesis-message-current .anamnesis-question[data-question-type="text"] { display: block; min-height: 0; }
    .anamnesis-message-current .anamnesis-question[data-question-type="text"] .anamnesis-question-label { margin-bottom: 12px; font-size: 19px; }
    .anamnesis-message-current .anamnesis-question[data-question-type="text"] .anamnesis-text-input { min-height: 100px; height: 100px; font-size: 15px; }
    .anamnesis-writing-indicator { right: 12px; bottom: 12px; left: 12px; }
}

@media (prefers-reduced-motion: reduce) {
    #wizardStep1.active { animation: none; }
    .wizard-step { transition: none; }
}

/* ========================================================================== */
/* Patients dialogue screen v3 — один экран без вложенных визуальных карточек */
/* ========================================================================== */

#patientsWizardState[data-wizard-step="1"] > .chat-header,
#patientsWizardState[data-wizard-step="1"] > .patients-wizard-steps {
    display: none;
}

#patientsWizardState[data-wizard-step="1"] .patients-wizard-body {
    width: 100%;
    max-width: 1240px;
    height: 100%;
    padding: 4px 0 8px;
    overflow: hidden;
}

#wizardStep1.active {
    height: 100%;
    min-height: 0;
}

.patient-dialog-screen {
    position: relative;
    isolation: isolate;
    display: grid;
    grid-template-rows: auto 1px minmax(0, 1fr);
    width: 100%;
    height: 100%;
    min-height: 520px;
    overflow: hidden;
    border: 1px solid rgba(51, 218, 247, 0.32);
    border-radius: 22px;
    background:
        radial-gradient(circle at 88% 0, rgba(89, 60, 190, 0.14), transparent 31%),
        linear-gradient(158deg, rgba(8, 24, 49, 0.985), rgba(4, 13, 30, 0.99));
    box-shadow: inset 0 1px 0 rgba(129, 235, 255, 0.07), 0 22px 65px rgba(0, 5, 18, 0.35);
}

.patient-dialog-screen::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -2;
    opacity: 0.12;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(66, 213, 240, 0.11) 1px, transparent 1px),
        linear-gradient(90deg, rgba(66, 213, 240, 0.11) 1px, transparent 1px);
    background-size: 36px 36px;
    mask-image: linear-gradient(180deg, #000, transparent 62%);
}

.patient-dialog-screen .patient-intake-orbit {
    top: -115px;
    right: -50px;
    width: 300px;
    height: 300px;
    opacity: 0.72;
}

.patient-dialog-header {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
    min-height: 150px;
    padding: 24px 34px 22px;
}

.patient-dialog-header .patient-intake-kicker {
    margin-bottom: 9px;
    color: rgba(101, 225, 245, 0.64);
    font-size: 11px;
    letter-spacing: 2px;
}

.patient-dialog-header .patient-intake-name {
    gap: 9px 15px;
}

.patient-dialog-header .patient-intake-name strong {
    color: #eafcff;
    font-family: 'Orbitron', 'Monitorica', sans-serif;
    font-size: clamp(34px, 4vw, 55px);
    font-weight: 600;
    letter-spacing: 0.075em;
    text-shadow:
        0 0 8px rgba(55, 220, 248, 0.52),
        0 0 28px rgba(55, 220, 248, 0.25);
}

.patient-dialog-header .patient-intake-name span {
    color: rgba(218, 242, 250, 0.76);
    font-size: clamp(20px, 2.05vw, 28px);
    letter-spacing: 0.025em;
}

.patient-dialog-header .patient-intake-meta {
    margin-top: 12px;
    color: rgba(174, 216, 231, 0.75);
    font-size: 14px;
    letter-spacing: 0.04em;
}

.patient-dialog-header .patient-intake-meta-item i {
    width: 7px;
    height: 7px;
}

.patient-dialog-header .adaptive-anamnesis-modes {
    flex: 0 0 290px;
    width: 290px;
    min-width: 290px;
    height: 46px;
    margin-right: 18px;
}

.patient-dialog-hidden-field {
    display: none !important;
}

.patient-dialog-neon-line {
    position: relative;
    z-index: 2;
    height: 1px;
    margin: 0 32px;
    background: linear-gradient(90deg, rgba(40, 218, 249, 0.08), rgba(54, 223, 251, 0.85) 18%, rgba(111, 86, 232, 0.65) 82%, rgba(111, 86, 232, 0.06));
    box-shadow: 0 0 14px rgba(48, 218, 248, 0.3);
}

.patient-dialog-neon-line span {
    position: absolute;
    top: -3px;
    left: 16%;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #5ce7ff;
    box-shadow: 0 0 15px rgba(92, 231, 255, 0.95);
    animation: patientDialogueLine 5s ease-in-out infinite;
}

.patient-dialog-body {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.patient-dialog-body .anamnesis-console-state {
    flex: 0 0 auto;
    min-height: 44px;
    padding: 9px 34px 7px;
    border: 0;
    background: transparent;
}

.patient-dialog-body .adaptive-anamnesis-status {
    color: rgba(86, 217, 241, 0.67);
    font-size: 12px;
}

.patient-dialog-body .anamnesis-progress {
    width: min(34%, 300px);
}

.patient-dialog-body .adaptive-anamnesis-safety {
    margin: 5px 34px 0;
}

.patient-dialog-body .anamnesis-question-card {
    flex: 1 1 auto;
    min-height: 0;
    padding: 12px 34px 26px;
}

.patient-dialog-body .anamnesis-conversation-feed,
.patient-dialog-body .anamnesis-message-current {
    height: 100%;
    min-height: 0;
}

.patient-dialog-body .anamnesis-message-current {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
    align-items: stretch;
    gap: 14px;
}

.patient-dialog-body .anamnesis-message-avatar {
    align-self: start;
    width: 48px;
    height: 48px;
    margin-top: 8px;
    border-radius: 15px;
    font-size: 11px;
}

.patient-dialog-body .anamnesis-message-current .anamnesis-message-bubble {
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 100%;
    padding: 8px 0 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.patient-dialog-body .anamnesis-message-meta {
    flex: 0 0 auto;
    justify-content: flex-start;
    gap: 18px;
    margin: 0 0 14px;
    color: rgba(79, 221, 247, 0.7);
    font-size: 10px;
}

.patient-dialog-body .anamnesis-message-meta span:last-child {
    color: rgba(161, 190, 207, 0.45);
}

.patient-dialog-body .anamnesis-question[data-question-type="text"] {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
}

.patient-dialog-body .anamnesis-question[data-question-type="text"] .anamnesis-question-label {
    max-width: 820px;
    margin: 0;
    color: #eefaff;
    font-family: 'Monitorica', sans-serif;
    font-size: clamp(25px, 3vw, 39px);
    font-weight: 400;
    line-height: 1.3;
    letter-spacing: 0.015em;
    text-shadow: 0 0 18px rgba(85, 217, 243, 0.08);
}

.patient-dialog-body .anamnesis-branch-hint {
    order: 2;
    margin: 12px 0 0;
    color: rgba(139, 195, 214, 0.58);
    font-size: 12px;
}

.anamnesis-chat-composer {
    position: relative;
    order: 3;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: end;
    gap: 10px;
    width: 100%;
    margin-top: auto;
    padding: 8px;
    border: 1px solid rgba(71, 218, 246, 0.27);
    border-radius: 22px;
    background: rgba(5, 15, 34, 0.9);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035), 0 0 0 1px rgba(28, 113, 144, 0.05), 0 0 30px rgba(32, 190, 221, 0.07);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.anamnesis-chat-composer:focus-within {
    border-color: rgba(81, 224, 251, 0.62);
    box-shadow: 0 0 0 3px rgba(47, 210, 239, 0.07), 0 0 35px rgba(35, 204, 236, 0.1);
}

#patientsView .anamnesis-chat-composer .anamnesis-text-input {
    width: 100%;
    min-height: 48px;
    max-height: 118px;
    height: 48px;
    padding: 12px 8px 10px;
    overflow-y: auto;
    resize: none;
    border: 0;
    border-radius: 0;
    outline: 0;
    background: transparent;
    box-shadow: none;
    color: rgba(237, 249, 254, 0.96);
    font-family: 'Monitorica', sans-serif;
    font-size: 16px;
    line-height: 1.45;
}

#patientsView .anamnesis-chat-composer .anamnesis-text-input:focus {
    border: 0;
    box-shadow: none;
}

#patientsView .anamnesis-chat-composer .anamnesis-text-input::placeholder {
    color: rgba(145, 173, 191, 0.46);
}

.anamnesis-chat-send,
.anamnesis-chat-back {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    padding: 0;
    border-radius: 16px;
    font-family: 'Monitorica', sans-serif;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.anamnesis-chat-send {
    border: 1px solid rgba(95, 232, 255, 0.72);
    background: linear-gradient(145deg, #28cde9, #5066e8);
    color: #06121e;
    box-shadow: 0 0 22px rgba(45, 210, 240, 0.22);
}

.anamnesis-chat-send:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 30px rgba(45, 210, 240, 0.38);
}

.anamnesis-chat-back {
    border: 1px solid rgba(151, 186, 207, 0.15);
    background: rgba(255, 255, 255, 0.035);
    color: rgba(181, 215, 229, 0.62);
    font-size: 17px;
}

.anamnesis-chat-back[hidden] { display: none; }
.anamnesis-chat-back:hover { border-color: rgba(71, 218, 246, 0.36); color: #75e8fc; }

#patientsWizardState[data-wizard-step="1"].has-inline-anamnesis-composer .patients-wizard-nav {
    display: none;
}

.patient-dialog-body .anamnesis-writing-indicator {
    right: 34px;
    bottom: 26px;
    left: 96px;
    min-height: 66px;
}

@keyframes patientDialogueLine {
    0%, 100% { left: 10%; opacity: 0.25; }
    50% { left: 88%; opacity: 1; }
}

@media (max-width: 720px) {
    #patientsWizardState[data-wizard-step="1"] .patients-wizard-body { padding: 0; }
    .patient-dialog-screen { min-height: 500px; border-radius: 18px; }
    .patient-dialog-header { align-items: flex-start; flex-direction: column; gap: 15px; min-height: 0; padding: 20px 20px 17px; }
    .patient-dialog-header .patient-intake-name strong { font-size: 32px; }
    .patient-dialog-header .patient-intake-name span { margin-top: 4px; font-size: 18px; }
    .patient-dialog-header .patient-intake-meta { font-size: 13px; }
    .patient-dialog-header .adaptive-anamnesis-modes { width: 100%; min-width: 0; height: 42px; margin: 0; }
    .patient-dialog-neon-line { margin: 0 19px; }
    .patient-dialog-body .anamnesis-console-state { align-items: stretch; flex-direction: column; gap: 6px; padding: 9px 20px 5px; }
    .patient-dialog-body .anamnesis-progress { width: 100%; }
    .patient-dialog-body .anamnesis-question-card { padding: 10px 18px 18px; }
    .patient-dialog-body .anamnesis-message-current { grid-template-columns: 38px minmax(0, 1fr); gap: 9px; }
    .patient-dialog-body .anamnesis-message-avatar { width: 38px; height: 38px; border-radius: 12px; }
    .patient-dialog-body .anamnesis-question[data-question-type="text"] .anamnesis-question-label { font-size: 23px; }
    .anamnesis-chat-composer { gap: 6px; padding: 6px; border-radius: 18px; }
    .anamnesis-chat-send,
    .anamnesis-chat-back { width: 43px; height: 43px; border-radius: 14px; }
    #patientsView .anamnesis-chat-composer .anamnesis-text-input { min-height: 43px; height: 43px; padding: 10px 5px; font-size: 15px; }
    .patient-dialog-body .anamnesis-writing-indicator { right: 18px; bottom: 18px; left: 18px; }
}

@media (prefers-reduced-motion: reduce) {
    .patient-dialog-neon-line span { animation: none; left: 16%; }
}

/* ========================================================================== */
/* Patients dialogue screen v5 — свободный холст без внешней карточки */
/* ========================================================================== */

#patientsWizardState[data-wizard-step="1"] .patients-wizard-body {
    max-width: none;
    padding: 4px 24px 8px;
}

#patientsWizardState[data-wizard-step="1"] .patient-dialog-screen {
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

#patientsWizardState[data-wizard-step="1"] .patient-dialog-screen::before {
    opacity: 0.07;
}

@media (max-width: 720px) {
    #patientsWizardState[data-wizard-step="1"] .patients-wizard-body {
        padding: 0 8px 6px;
    }

    #patientsWizardState[data-wizard-step="1"] .patient-dialog-screen {
        border-radius: 0;
    }
}

/* ========================================================================
   ADAPTIVE ANAMNESIS + DIAGNOSTICS V18
   Разворачиваемые модули, контурная анимация composer и единые контролы.
   ======================================================================== */

/* История — без контурной рамки: спокойный световой модуль. */
#patientsView #patientsWizardState[data-wizard-step="1"] .anamnesis-history-button {
    border: 0 !important;
    border-radius: 16px !important;
    background: radial-gradient(circle at 18% 50%, rgba(67, 225, 250, .15), rgba(71, 114, 169, .075) 42%, rgba(99, 75, 190, .055)) !important;
    box-shadow: 0 10px 28px rgba(5, 14, 36, .2), 0 0 24px rgba(61, 218, 246, .08) !important;
    transition: transform .26s cubic-bezier(.22, 1, .36, 1), background .26s ease, box-shadow .26s ease;
}

#patientsView #patientsWizardState[data-wizard-step="1"] .anamnesis-history-button:hover,
#patientsView #patientsWizardState[data-wizard-step="1"] .anamnesis-history-button.is-expanded {
    transform: translateY(-1px) scale(1.015);
    background: radial-gradient(circle at 20% 50%, rgba(71, 230, 252, .21), rgba(70, 135, 181, .105) 46%, rgba(104, 77, 204, .08)) !important;
    box-shadow: 0 12px 32px rgba(5, 14, 36, .24), 0 0 28px rgba(61, 218, 246, .15) !important;
}

#patientsView .anamnesis-history-button-icon {
    border: 0 !important;
    background: rgba(83, 208, 232, .075) !important;
    box-shadow: none !important;
    transition: transform .38s cubic-bezier(.22, 1, .36, 1), color .25s ease;
}

#patientsView .anamnesis-history-button.is-expanded .anamnesis-history-button-icon {
    transform: rotate(-22deg) scale(1.08);
    color: #a5f5ff;
}

/* Панель истории раскрывается из правого верхнего светового модуля. */
#patientsView .anamnesis-history-drawer {
    border-left: 0;
    border-radius: 22px 0 0 22px;
    background: linear-gradient(145deg, rgba(7, 27, 50, .965), rgba(7, 15, 38, .95));
    box-shadow: -24px 0 64px rgba(0, 4, 16, .38), 0 0 34px rgba(54, 215, 241, .07);
    transform-origin: 100% 0;
    animation: anamnesisHistoryUnfold .42s cubic-bezier(.16, 1, .3, 1) both;
}

#patientsView .anamnesis-history-overlay.is-closing .anamnesis-history-drawer {
    animation: anamnesisHistoryFold .3s cubic-bezier(.55, 0, 1, .45) both;
}

#patientsView .anamnesis-history-overlay.is-closing .anamnesis-history-backdrop {
    animation: anamnesisHistoryFadeOut .28s ease both;
}

@keyframes anamnesisHistoryUnfold {
    0% { opacity: .1; transform: translate(18px, -10px) scale(.34, .1); clip-path: inset(0 0 86% 66% round 20px); filter: blur(7px) brightness(1.45); }
    58% { opacity: 1; transform: translate(0, 0) scale(1.01, .76); clip-path: inset(0 0 18% 0 round 22px 0 0 22px); filter: blur(1px) brightness(1.12); }
    100% { opacity: 1; transform: none; clip-path: inset(0 round 22px 0 0 22px); filter: none; }
}

@keyframes anamnesisHistoryFold {
    0% { opacity: 1; transform: none; clip-path: inset(0 round 22px 0 0 22px); }
    100% { opacity: 0; transform: translate(18px, -8px) scale(.34, .08); clip-path: inset(0 0 88% 68% round 20px); filter: blur(6px); }
}

@keyframes anamnesisHistoryFadeOut { to { opacity: 0; } }

/* Анимируется только внешний контур поля ввода, внутренность остаётся спокойной. */
@property --anamnesis-composer-angle {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
}

#patientsView #patientsWizardState[data-wizard-step="1"] .patient-dialog-body .anamnesis-chat-dock {
    isolation: isolate;
    border-color: transparent !important;
    box-shadow: inset 0 0 0 1px rgba(64, 209, 236, .2), 0 0 24px rgba(38, 207, 238, .07);
}

#patientsView #patientsWizardState[data-wizard-step="1"] .patient-dialog-body .anamnesis-chat-dock::before {
    content: "";
    position: absolute;
    z-index: 0;
    inset: 0;
    padding: 1.5px;
    border-radius: inherit;
    background: conic-gradient(from var(--anamnesis-composer-angle), transparent 0 72%, rgba(85, 229, 251, .18) 80%, #62e7fb 88%, rgba(142, 107, 248, .86) 94%, transparent 100%);
    opacity: 0;
    pointer-events: none;
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    transition: opacity .22s ease;
}

#patientsView #patientsWizardState[data-wizard-step="1"] .patient-dialog-body .anamnesis-chat-dock:hover::before,
#patientsView #patientsWizardState[data-wizard-step="1"] .patient-dialog-body .anamnesis-chat-dock:focus-within::before {
    opacity: 1;
    animation: anamnesisComposerPerimeter 1.75s linear infinite;
}

#patientsView #patientsWizardState[data-wizard-step="1"] .patient-dialog-body .anamnesis-chat-dock > * {
    position: relative;
    z-index: 1;
}

@keyframes anamnesisComposerPerimeter { to { --anamnesis-composer-angle: 360deg; } }

/* «Почему спрашиваю?» раскрывается без скачка высоты. */
#patientsView .anamnesis-rationale-content {
    display: block !important;
    max-height: 0;
    margin-top: 0;
    padding-top: 0;
    padding-bottom: 0;
    overflow: hidden;
    border-left-color: transparent;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px) scaleY(.94);
    transform-origin: top left;
    transition: max-height .42s cubic-bezier(.22, 1, .36, 1), margin-top .3s ease, padding .3s ease, opacity .24s ease, transform .36s cubic-bezier(.22, 1, .36, 1), border-color .3s ease, visibility 0s linear .42s;
}

#patientsView .anamnesis-rationale-content.is-open {
    max-height: 340px;
    margin-top: 9px;
    padding-top: 4px;
    padding-bottom: 4px;
    border-left-color: rgba(64, 220, 248, .35);
    opacity: 1;
    visibility: visible;
    transform: none;
    transition-delay: 0s;
}

/* Диагностические переключатели — без рамок, как командные кнопки карты. */
#patientsView .lens-type-checkbox .checkbox-value {
    border: 0 !important;
    border-radius: 14px !important;
    background: rgba(126, 174, 198, .075) !important;
    box-shadow: none !important;
    transition: transform .18s ease, color .18s ease, background-color .18s ease, opacity .18s ease;
}

#patientsView .lens-type-checkbox:hover .checkbox-value {
    border: 0 !important;
    background: rgba(126, 206, 224, .12) !important;
    box-shadow: none !important;
    transform: translateY(-1px);
}

#patientsView .lens-type-checkbox input[type="checkbox"]:checked ~ .checkbox-value,
#patientsView .lens-type-checkbox input[type="radio"]:checked ~ .checkbox-value {
    border: 0 !important;
    background: linear-gradient(135deg, rgba(45, 209, 235, .17), rgba(120, 84, 232, .12)) !important;
    color: #78eafa;
    box-shadow: none !important;
}

#patientsView .lens-type-checkbox input:focus-visible ~ .checkbox-value {
    outline: 2px solid rgba(97, 218, 239, .58);
    outline-offset: 2px;
}

/* AXIS после JS-нормализации использует буквально тот же контрол, что SPH/CYL. */
#patientsView .axis-input-row .axis-picker-btn.clinical-picker-scroll-btn {
    width: 42px;
    height: 42px;
    min-width: 42px;
    border-radius: 14px;
}

@media (prefers-reduced-motion: reduce) {
    #patientsView .anamnesis-history-drawer,
    #patientsView .anamnesis-history-overlay.is-closing .anamnesis-history-drawer,
    #patientsView .anamnesis-history-overlay.is-closing .anamnesis-history-backdrop,
    #patientsView .anamnesis-chat-dock::before,
    #patientsView .anamnesis-rationale-content { animation: none !important; transition: none !important; }
}

/* ========================================================================== */
/* Patients dialogue screen v6 — клинические состояния и история */
/* ========================================================================== */

.patient-dialog-header-tools {
    position: relative;
    z-index: 2;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 10px;
}

.patient-dialog-header .patient-dialog-header-tools .adaptive-anamnesis-modes {
    margin-right: 0;
}

.anamnesis-history-button {
    flex: 0 0 46px;
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    padding: 0;
    border: 1px solid rgba(61, 220, 248, 0.34);
    border-radius: 14px;
    background: transparent;
    color: rgba(113, 230, 250, 0.8);
    box-shadow: 0 0 18px rgba(38, 207, 238, 0.06);
    font-family: 'Monitorica', sans-serif;
    font-size: 22px;
    cursor: pointer;
    transition: color .2s ease, border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

.anamnesis-history-button:hover {
    color: #8cecff;
    border-color: rgba(73, 226, 252, 0.68);
    box-shadow: 0 0 24px rgba(38, 207, 238, 0.13);
    transform: translateY(-1px);
}

.anamnesis-history-button:disabled {
    opacity: .32;
    cursor: default;
    transform: none;
}

.anamnesis-save-state {
    display: flex;
    align-items: center;
    gap: 7px;
    width: max-content;
    margin-top: 8px;
    color: rgba(158, 205, 220, 0.55);
    font-family: 'Monitorica', sans-serif;
    font-size: 10px;
    letter-spacing: .05em;
    transition: color .2s ease;
}

.anamnesis-save-state i {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 9px currentColor;
}

.anamnesis-save-state[data-state="dirty"] { color: rgba(242, 191, 94, 0.78); }
.anamnesis-save-state[data-state="saving"] { color: rgba(88, 220, 246, 0.82); }
.anamnesis-save-state[data-state="saved"] { color: rgba(77, 221, 184, 0.72); }
.anamnesis-save-state[data-state="error"] { color: rgba(255, 116, 133, 0.88); }
.anamnesis-save-state[data-state="saving"] i { animation: anamnesisSavePulse 1s ease-in-out infinite; }

@keyframes anamnesisSavePulse {
    50% { opacity: .35; transform: scale(.72); }
}

.anamnesis-rationale {
    margin-top: 9px;
}

.anamnesis-rationale-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0;
    border: 0;
    background: transparent;
    color: rgba(102, 218, 240, 0.6);
    font-family: 'Monitorica', sans-serif;
    font-size: 10px;
    letter-spacing: .035em;
    cursor: pointer;
}

.anamnesis-rationale-toggle:hover { color: rgba(116, 232, 252, 0.92); }
.anamnesis-rationale-toggle i { font-style: normal; transition: transform .2s ease; }
.anamnesis-rationale-toggle[aria-expanded="true"] i { transform: rotate(180deg); }

.anamnesis-rationale-content {
    max-width: 680px;
    margin-top: 8px;
    padding: 3px 0 2px 11px;
    border-left: 1px solid rgba(64, 220, 248, 0.35);
    color: rgba(185, 216, 228, 0.72);
    font-family: 'Monitorica', sans-serif;
    font-size: 11px;
    line-height: 1.5;
}

.anamnesis-rationale-content[hidden] { display: none; }
.anamnesis-rationale-kicker {
    color: rgba(99, 224, 246, 0.68);
    font-size: 8px;
    letter-spacing: .12em;
    text-transform: uppercase;
}
.anamnesis-rationale-content p { margin: 3px 0 0; }
.anamnesis-rationale-source { display: block; margin-top: 5px; color: rgba(164, 183, 207, 0.5); font-size: 9px; }

#patientsWizardState[data-wizard-step="1"] .patient-dialog-body .anamnesis-previous-answer {
    position: relative;
    align-self: flex-end;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
    width: auto;
    max-width: min(64%, 620px);
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    text-align: left;
    cursor: pointer;
}

.anamnesis-previous-answer-label {
    color: rgba(170, 187, 211, 0.42);
    font-family: 'Monitorica', sans-serif;
    font-size: 8px;
    letter-spacing: .04em;
}

#patientsWizardState[data-wizard-step="1"] .patient-dialog-body .anamnesis-previous-answer .anamnesis-message-bubble {
    transition: border-color .2s ease, color .2s ease, box-shadow .2s ease;
}

#patientsWizardState[data-wizard-step="1"] .patient-dialog-body .anamnesis-previous-answer:hover .anamnesis-message-bubble {
    border-color: rgba(164, 128, 255, 0.95);
    color: #fff;
    box-shadow: 0 0 24px rgba(119, 81, 244, 0.18);
}

#patientsWizardState[data-wizard-step="1"] .adaptive-anamnesis-safety {
    margin: 4px 34px 2px;
    padding: 7px 11px;
    border: 0;
    border-left: 2px solid rgba(245, 190, 72, 0.72);
    border-radius: 0;
    background: linear-gradient(90deg, rgba(245, 190, 72, 0.08), transparent 68%);
    color: rgba(247, 210, 132, 0.86);
    box-shadow: none;
    font-size: 11px;
}

#patientsWizardState[data-wizard-step="1"] .adaptive-anamnesis-safety.is-danger {
    border-left-color: rgba(255, 91, 116, 0.86);
    background: linear-gradient(90deg, rgba(255, 75, 105, 0.1), transparent 68%);
    color: rgba(255, 152, 168, 0.92);
}

.anamnesis-writing-indicator strong,
.anamnesis-writing-indicator span {
    transition: opacity .18s ease, color .18s ease;
}

.anamnesis-history-overlay {
    position: absolute;
    inset: 0;
    z-index: 40;
    display: flex;
    justify-content: flex-end;
    overflow: hidden;
}

.anamnesis-history-backdrop {
    position: absolute;
    inset: 0;
    padding: 0;
    border: 0;
    background: rgba(0, 7, 20, 0.46);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    cursor: default;
    animation: anamnesisHistoryFade .2s ease both;
}

.anamnesis-history-drawer {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    width: min(420px, 92vw);
    height: 100%;
    border-left: 1px solid rgba(62, 220, 248, 0.28);
    background: rgba(4, 15, 34, 0.94);
    box-shadow: -24px 0 60px rgba(0, 4, 16, 0.34);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    animation: anamnesisHistorySlide .28s cubic-bezier(.22,1,.36,1) both;
}

.anamnesis-history-drawer header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 24px 22px 17px;
    border-bottom: 1px solid rgba(90, 211, 235, 0.1);
}

.anamnesis-history-drawer header div { display: flex; flex-direction: column; gap: 3px; }
.anamnesis-history-drawer header span { color: rgba(79, 221, 247, 0.55); font-size: 8px; letter-spacing: .14em; text-transform: uppercase; }
.anamnesis-history-drawer header strong { color: rgba(235, 248, 252, 0.94); font-family: 'Monitorica', sans-serif; font-size: 18px; font-weight: 500; }
.anamnesis-history-drawer header button { width: 34px; height: 34px; padding: 0; border: 0; background: transparent; color: rgba(156, 207, 222, 0.65); font-size: 25px; cursor: pointer; }

.anamnesis-history-list { min-height: 0; padding: 6px 0 20px; overflow-y: auto; }
.anamnesis-history-item {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr);
    gap: 10px;
    width: 100%;
    padding: 13px 22px;
    border: 0;
    border-bottom: 1px solid rgba(104, 183, 207, 0.07);
    background: transparent;
    color: inherit;
    text-align: left;
    cursor: pointer;
}
.anamnesis-history-item:hover { background: linear-gradient(90deg, rgba(37, 205, 236, 0.07), transparent); }
.anamnesis-history-index { color: rgba(83, 222, 247, 0.48); font-family: 'Orbitron', sans-serif; font-size: 9px; }
.anamnesis-history-item > span:last-child { display: flex; min-width: 0; flex-direction: column; gap: 5px; }
.anamnesis-history-item strong { color: rgba(224, 243, 249, 0.82); font-family: 'Monitorica', sans-serif; font-size: 11px; font-weight: 500; line-height: 1.35; }
.anamnesis-history-item small { display: -webkit-box; overflow: hidden; color: rgba(176, 202, 214, 0.55); font-family: 'Monitorica', sans-serif; font-size: 10px; line-height: 1.45; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.anamnesis-history-empty { padding: 30px 22px; color: rgba(173, 201, 213, 0.48); font-family: 'Monitorica', sans-serif; font-size: 11px; }

@keyframes anamnesisHistoryFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes anamnesisHistorySlide { from { opacity: 0; transform: translateX(35px); } to { opacity: 1; transform: none; } }

@media (max-width: 720px) {
    .patient-dialog-header-tools { width: 100%; }
    .patient-dialog-header .patient-dialog-header-tools .adaptive-anamnesis-modes { flex: 1 1 auto; width: auto; }
    .anamnesis-history-button { flex-basis: 42px; width: 42px; height: 42px; border-radius: 13px; }
    #patientsWizardState[data-wizard-step="1"] .patient-dialog-body .anamnesis-previous-answer { max-width: 86%; }
    #patientsWizardState[data-wizard-step="1"] .adaptive-anamnesis-safety { margin-right: 20px; margin-left: 20px; }
}

@media (prefers-reduced-motion: reduce) {
    .anamnesis-save-state[data-state="saving"] i,
    .anamnesis-history-backdrop,
    .anamnesis-history-drawer { animation: none; }
}

/* ========================================================================
   PATIENTS / CLINICAL DECK V7
   Единый безрамочный интерфейс картотеки и карты пациента. Все правила
   ограничены #patientsView и не затрагивают основной ИИ-чат.
   ======================================================================== */

#patientsView .patients-wrapper {
    position: relative;
    padding: 18px clamp(18px, 3vw, 48px) 22px;
    background:
        radial-gradient(circle at 9% 5%, rgba(24, 193, 230, .07), transparent 25%),
        radial-gradient(circle at 91% 16%, rgba(107, 74, 234, .08), transparent 28%),
        linear-gradient(180deg, rgba(3, 18, 37, .16), rgba(2, 10, 24, .02));
}

#patientsView .patients-wrapper::after {
    content: "";
    position: absolute;
    inset: 0;
    display: block;
    pointer-events: none;
    opacity: .16;
    background-image:
        linear-gradient(rgba(69, 210, 237, .05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(69, 210, 237, .05) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: linear-gradient(to bottom, #000, transparent 62%);
    -webkit-mask-image: linear-gradient(to bottom, #000, transparent 62%);
}

#patientsView .patients-substate {
    position: relative;
    z-index: 1;
}

/* Registry header */
#patientsView .patient-registry-header {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    min-height: 148px;
    padding: 16px 0 25px;
    border-bottom: 1px solid rgba(66, 217, 245, .22);
    overflow: hidden;
    flex: 0 0 auto;
}

#patientsView .patient-registry-header::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -1px;
    width: 28%;
    height: 2px;
    background: linear-gradient(90deg, transparent, #40def8 22%, #8568ff 78%, transparent);
    box-shadow: 0 0 14px rgba(64, 222, 248, .82);
    animation: patientRegistrySignal 6s ease-in-out infinite alternate;
}

#patientsView .patient-registry-heading { position: relative; z-index: 2; min-width: 0; }

#patientsView .patient-registry-kicker,
#patientsView .patient-overview-status {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    color: rgba(93, 224, 247, .65);
    font-family: 'Orbitron', sans-serif;
    font-size: 9px;
    letter-spacing: .18em;
    text-transform: uppercase;
}

#patientsView .patient-registry-kicker i,
#patientsView .patient-overview-status i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #4be7c7;
    box-shadow: 0 0 12px rgba(75, 231, 199, .9);
    animation: patientStatusPulse 2.2s ease-in-out infinite;
}

#patientsView .patient-registry-heading h2 {
    margin: 11px 0 3px;
    color: rgba(232, 251, 255, .98);
    font-family: 'Monitorica', 'Space Grotesk', sans-serif;
    font-size: clamp(34px, 4vw, 58px);
    font-weight: 500;
    line-height: .92;
    letter-spacing: .08em;
    text-shadow: 0 0 10px rgba(69, 220, 247, .46), 0 0 32px rgba(69, 220, 247, .18);
}

#patientsView .patient-registry-heading p {
    max-width: 620px;
    margin: 10px 0 0;
    color: rgba(163, 196, 211, .58);
    font-family: 'Monitorica', sans-serif;
    font-size: 12px;
    letter-spacing: .025em;
}

#patientsView .patient-registry-telemetry {
    position: relative;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    min-width: 130px;
    padding: 0 8px 4px 0;
    color: rgba(129, 186, 204, .48);
    font-family: 'Orbitron', sans-serif;
    font-size: 8px;
    letter-spacing: .13em;
    text-transform: uppercase;
}

#patientsView .patient-registry-count {
    color: rgba(90, 229, 251, .9);
    font-size: 25px;
    font-weight: 500;
    line-height: 1;
    text-shadow: 0 0 14px rgba(52, 216, 245, .35);
}

#patientsView .patient-registry-radar {
    position: absolute;
    top: -108px;
    right: -44px;
    width: 270px;
    height: 270px;
    border: 1px solid rgba(78, 212, 241, .11);
    border-radius: 50%;
    opacity: .7;
}

#patientsView .patient-registry-radar::before,
#patientsView .patient-registry-radar::after,
#patientsView .patient-registry-radar i {
    content: "";
    position: absolute;
    border: 1px solid rgba(101, 83, 239, .16);
    border-radius: 50%;
}
#patientsView .patient-registry-radar::before { inset: 32px; }
#patientsView .patient-registry-radar::after { inset: 68px; }
#patientsView .patient-registry-radar i { inset: 108px; }
#patientsView .patient-registry-radar b {
    position: absolute;
    inset: 50% 50% 0 50%;
    width: 1px;
    transform-origin: top center;
    background: linear-gradient(to bottom, rgba(69, 226, 250, .55), transparent);
    animation: patientRadarSweep 8s linear infinite;
}
#patientsView .patient-registry-radar em {
    position: absolute;
    top: 58%;
    left: 28%;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #4be7c7;
    box-shadow: 0 0 12px #4be7c7;
}

/* Registry command rail */
#patientsView .patients-toolbar {
    position: relative;
    display: grid;
    grid-template-columns: minmax(260px, 1fr) auto auto;
    gap: 14px;
    margin: 18px 0 10px;
}

#patientsView .patients-search-wrapper {
    position: relative;
    display: grid;
    grid-template-columns: 16px minmax(0, 1fr);
    grid-template-rows: auto auto;
    column-gap: 11px;
    padding: 4px 0 8px;
    border-bottom: 1px solid rgba(77, 210, 237, .2);
}

#patientsView .patients-search-wrapper::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: -1px;
    left: 0;
    height: 1px;
    transform: scaleX(0);
    transform-origin: left;
    background: linear-gradient(90deg, #42ddf7, #7666fb);
    box-shadow: 0 0 11px rgba(66, 221, 247, .7);
    transition: transform .3s ease;
}
#patientsView .patients-search-wrapper:focus-within::after { transform: scaleX(1); }

#patientsView .patients-search-signal {
    grid-row: 1 / 3;
    align-self: center;
    width: 10px;
    height: 10px;
    border: 1px solid rgba(64, 222, 248, .62);
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(64, 222, 248, .32);
}
#patientsView .patients-search-signal::after {
    content: "";
    display: block;
    width: 5px;
    height: 1px;
    margin: 8px 0 0 7px;
    transform: rotate(45deg);
    background: rgba(64, 222, 248, .62);
}

#patientsView .patients-search-wrapper label {
    color: rgba(79, 219, 244, .55);
    font-family: 'Orbitron', sans-serif;
    font-size: 7px;
    letter-spacing: .14em;
    text-transform: uppercase;
}

#patientsView .patients-search {
    width: 100%;
    padding: 3px 0 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    color: rgba(226, 245, 250, .92);
    font-size: 14px;
}
#patientsView .patients-search:focus { border: 0; background: transparent; box-shadow: none; }
#patientsView .patients-search::placeholder { color: rgba(141, 174, 190, .38); }

#patientsView .btn-new-patient,
#patientsView .btn-patients-primary,
#patientsView .btn-patients-secondary {
    min-height: 42px;
    border-radius: 2px;
    background: transparent;
    font-family: 'Monitorica', sans-serif;
    letter-spacing: .04em;
    box-shadow: none;
}

#patientsView .btn-new-patient,
#patientsView .btn-patients-primary {
    border: 1px solid rgba(57, 220, 248, .43);
    color: rgba(104, 232, 253, .92);
}
#patientsView .btn-new-patient:hover,
#patientsView .btn-patients-primary:hover {
    border-color: rgba(75, 228, 252, .85);
    background: linear-gradient(90deg, rgba(41, 199, 228, .08), rgba(110, 77, 235, .08));
    box-shadow: 0 0 22px rgba(43, 209, 238, .1), inset 0 0 14px rgba(43, 209, 238, .04);
}
#patientsView .btn-patients-secondary {
    border: 1px solid rgba(115, 159, 180, .18);
    color: rgba(158, 191, 205, .64);
}
#patientsView .btn-patients-secondary:hover {
    border-color: rgba(78, 214, 240, .42);
    background: rgba(43, 196, 225, .045);
    color: rgba(167, 225, 237, .88);
}

#patientsView .new-patient-form {
    position: relative;
    margin: 8px 0 14px;
    padding: 17px 19px 16px;
    border: 0;
    border-left: 2px solid rgba(57, 220, 248, .62);
    border-radius: 0;
    background: linear-gradient(90deg, rgba(30, 177, 207, .075), rgba(90, 68, 218, .035) 58%, transparent);
    box-shadow: none;
    animation: patientConsoleOpen .3s cubic-bezier(.22, 1, .36, 1) both;
}

/* Registry list: lines, not cards */
#patientsView .patients-list-wrapper {
    padding: 2px 7px 14px 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(63, 210, 238, .22) transparent;
}

#patientsView .patients-list { gap: 0; }

#patientsView .patients-date-divider {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 13px;
    margin: 13px 0 2px;
}
#patientsView .patients-date-divider .patients-date-divider-line:first-child { display: none; }
#patientsView .patients-date-divider-line {
    height: 1px;
    background: linear-gradient(90deg, rgba(69, 213, 239, .22), transparent);
}
#patientsView .patients-date-divider-label {
    grid-column: 1;
    grid-row: 1;
    color: rgba(81, 213, 238, .43);
    font-family: 'Orbitron', sans-serif;
    font-size: 7px;
    letter-spacing: .13em;
}

#patientsView .patient-row {
    position: relative;
    display: grid;
    grid-template-columns: 42px minmax(250px, 1.45fr) minmax(250px, 1fr) 132px 34px;
    align-items: center;
    gap: 14px;
    min-height: 74px;
    padding: 10px 4px;
    overflow: hidden;
    border: 0;
    border-bottom: 1px solid rgba(91, 169, 192, .12);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    opacity: 0;
    animation: patientRowMaterialize .44s cubic-bezier(.22,1,.36,1) both;
    animation-delay: min(calc(var(--patient-row-index) * 36ms), 360ms);
    transition: border-color .22s ease, padding .22s ease, opacity .2s ease, transform .22s ease;
}

#patientsView .patient-row::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0;
    transform: translateX(-55%);
    background: linear-gradient(90deg, transparent, rgba(55, 214, 242, .075), rgba(108, 75, 232, .045), transparent);
    transition: opacity .22s ease, transform .5s cubic-bezier(.22,1,.36,1);
}

#patientsView .patient-row:hover,
#patientsView .patient-row:focus-visible,
#patientsView .patient-row.is-selected {
    padding-left: 11px;
    border-color: rgba(55, 218, 246, .42);
    background: transparent;
    box-shadow: inset 2px 0 rgba(59, 223, 250, .72), 0 8px 24px rgba(0, 8, 22, .12);
    transform: none;
    outline: none;
}
#patientsView .patient-row:hover::before,
#patientsView .patient-row:focus-visible::before,
#patientsView .patient-row.is-selected::before { opacity: 1; transform: translateX(0); }

#patientsView .patient-row-index {
    color: rgba(78, 218, 243, .34);
    font-family: 'Orbitron', sans-serif;
    font-size: 9px;
    letter-spacing: .08em;
}

#patientsView .patient-row-name {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 2px;
    font-weight: 400;
}
#patientsView .patient-row-name strong {
    overflow: hidden;
    color: rgba(230, 247, 252, .94);
    font-family: 'Monitorica', sans-serif;
    font-size: 20px;
    font-weight: 500;
    letter-spacing: .065em;
    text-overflow: ellipsis;
    text-shadow: 0 0 12px rgba(60, 218, 245, .12);
    white-space: nowrap;
    transition: color .2s ease, text-shadow .2s ease, letter-spacing .22s ease;
}
#patientsView .patient-row-name span {
    overflow: hidden;
    color: rgba(165, 197, 210, .57);
    font-size: 11px;
    letter-spacing: .045em;
    text-overflow: ellipsis;
    white-space: nowrap;
}
#patientsView .patient-row:hover .patient-row-name strong,
#patientsView .patient-row.is-selected .patient-row-name strong {
    color: #ddfaff;
    letter-spacing: .085em;
    text-shadow: 0 0 15px rgba(59, 220, 248, .52);
}

#patientsView .patient-row-meta {
    display: flex;
    min-width: 0;
    flex-wrap: wrap;
    gap: 6px 18px;
    color: rgba(150, 187, 201, .52);
    font-family: 'Monitorica', sans-serif;
    font-size: 10px;
}
#patientsView .patient-row-meta span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#patientsView .patient-row-meta span::before {
    content: "";
    display: inline-block;
    width: 4px;
    height: 4px;
    margin: 0 7px 2px 0;
    border-radius: 50%;
    background: rgba(67, 218, 243, .55);
    box-shadow: 0 0 7px rgba(67, 218, 243, .45);
}

#patientsView .patient-row-open,
#patientsView .visit-row-open {
    color: rgba(85, 218, 242, .43);
    font-family: 'Orbitron', sans-serif;
    font-size: 7px;
    letter-spacing: .09em;
    text-transform: uppercase;
    transition: color .2s ease, transform .2s ease;
}
#patientsView .patient-row-open i,
#patientsView .visit-row-open i { margin-left: 6px; color: rgba(100, 102, 241, .7); font-size: 13px; font-style: normal; }
#patientsView .patient-row:hover .patient-row-open { color: rgba(104, 232, 252, .9); transform: translateX(3px); }

#patientsView .patient-row-delete {
    position: relative;
    z-index: 3;
    width: 31px;
    height: 31px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: rgba(143, 173, 186, .28);
    opacity: 0;
    transition: opacity .18s ease, color .18s ease, background .18s ease;
}
#patientsView .patient-row:hover .patient-row-delete,
#patientsView .patient-row:focus-within .patient-row-delete { opacity: 1; }
#patientsView .patient-row-delete:hover { background: rgba(255, 85, 112, .08); color: rgba(255, 120, 142, .86); }

#patientsView #patientsListState.is-launching-card .patient-row:not(.is-selected) { opacity: .18; }
#patientsView #patientsListState.is-launching-card .patient-row.is-selected {
    z-index: 4;
    transform: scale(1.012);
    border-color: rgba(70, 227, 251, .85);
    box-shadow: inset 2px 0 #52e4fb, 0 0 28px rgba(47, 211, 240, .13);
}

/* Open patient: borderless identity deck */
#patientsView .patient-overview-navigation {
    min-height: 44px;
    padding: 0;
    border: 0;
    flex: 0 0 auto;
}
#patientsView .patient-overview-navigation .chat-title-group { display: none; }
#patientsView .patient-overview-navigation .chat-header-main { justify-content: flex-end; }
#patientsView .patient-overview-navigation #btnBackToPatientsListFromOverview { min-height: 36px; padding: 6px 14px; }

#patientsView .patients-overview-body {
    padding: 0 6px 30px 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(60, 210, 239, .2) transparent;
}

#patientsView .patients-overview-body > .recipe-form-section {
    margin: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    transform: none;
}
#patientsView .patients-overview-body > .recipe-form-section::before { display: none; }
#patientsView .patients-overview-body > .recipe-form-section:hover { border-color: transparent; box-shadow: none; transform: none; }

#patientsView .patient-overview-identity-deck {
    position: relative;
    min-height: 230px;
    padding: clamp(20px, 3vw, 42px) 0 27px;
    overflow: hidden;
    border-bottom: 1px solid rgba(61, 215, 243, .2) !important;
}
#patientsView .patient-overview-identity-deck > .recipe-section-title { display: none; }

#patientsView .patient-overview-person { position: relative; min-height: 135px; }

#patientsView .patient-overview-name {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: baseline;
    min-width: 0;
    gap: clamp(12px, 2vw, 28px);
    margin: 15px 0 13px;
    line-height: 1;
}
#patientsView .patient-overview-name strong {
    overflow: hidden;
    color: rgba(232, 252, 255, .98);
    font-family: 'Monitorica', sans-serif;
    font-size: clamp(38px, 5.5vw, 72px);
    font-weight: 500;
    letter-spacing: .075em;
    text-overflow: ellipsis;
    text-shadow: 0 0 11px rgba(68, 222, 248, .58), 0 0 34px rgba(68, 222, 248, .18);
    white-space: nowrap;
}
#patientsView .patient-overview-name span {
    overflow: hidden;
    color: rgba(194, 218, 228, .78);
    font-family: 'Monitorica', sans-serif;
    font-size: clamp(22px, 3vw, 38px);
    font-weight: 400;
    letter-spacing: .02em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#patientsView .patient-overview-meta {
    position: relative;
    z-index: 2;
    display: flex;
    flex-wrap: wrap;
    gap: 9px 28px;
    color: rgba(153, 194, 209, .62);
    font-family: 'Monitorica', sans-serif;
    font-size: 11px;
}
#patientsView .patient-overview-meta span { display: inline-flex; align-items: center; gap: 8px; }
#patientsView .patient-overview-meta i {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: rgba(67, 222, 246, .85);
    box-shadow: 0 0 8px rgba(67, 222, 246, .7);
}

#patientsView .patient-overview-orbit {
    position: absolute;
    z-index: 0;
    top: -128px;
    right: -30px;
    width: 340px;
    height: 340px;
    border: 1px solid rgba(70, 219, 246, .13);
    border-radius: 50%;
    background: radial-gradient(circle, rgba(98, 65, 222, .04), transparent 62%);
    pointer-events: none;
}
#patientsView .patient-overview-orbit::before,
#patientsView .patient-overview-orbit::after,
#patientsView .patient-overview-orbit i {
    content: "";
    position: absolute;
    border: 1px solid rgba(105, 75, 230, .14);
    border-radius: 50%;
}
#patientsView .patient-overview-orbit::before { inset: 42px; }
#patientsView .patient-overview-orbit::after { inset: 84px; }
#patientsView .patient-overview-orbit i { inset: 128px; }
#patientsView .patient-overview-orbit b,
#patientsView .patient-overview-orbit em {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #48dcf7;
    box-shadow: 0 0 13px rgba(72, 220, 247, .9);
}
#patientsView .patient-overview-orbit b { top: 50%; left: -3px; }
#patientsView .patient-overview-orbit em { right: 43px; bottom: 78px; background: #7567f5; }

#patientsView .patients-identity-actions {
    position: relative;
    z-index: 3;
    gap: 9px;
    margin-top: 18px;
}
#patientsView .patients-identity-actions .btn-delete-patient { color: rgba(224, 110, 130, .52); }

#patientsView #overviewIdentityEditForm {
    position: relative;
    z-index: 3;
    padding: 18px;
    border-left: 2px solid rgba(62, 220, 247, .55);
    background: linear-gradient(90deg, rgba(37, 194, 223, .07), transparent 72%);
}

/* Visit timeline */
#patientsView .patient-visits-deck { padding: 27px 0 18px; }
#patientsView .patient-visits-heading { display: flex; flex-direction: column; gap: 3px; }
#patientsView .patient-visits-heading > span {
    color: rgba(74, 218, 243, .47);
    font-family: 'Orbitron', sans-serif;
    font-size: 7px;
    letter-spacing: .15em;
    text-transform: uppercase;
}
#patientsView .patient-visits-heading .recipe-section-title {
    color: rgba(226, 245, 250, .92);
    font-family: 'Monitorica', sans-serif;
    font-size: clamp(21px, 2vw, 29px);
    font-weight: 500;
    letter-spacing: .04em;
}

#patientsView .visits-list {
    position: relative;
    gap: 0;
    padding-left: 4px;
}
#patientsView .visits-list::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 55px;
    width: 1px;
    background: linear-gradient(to bottom, rgba(60, 220, 248, .55), rgba(91, 76, 227, .14), transparent);
}

#patientsView .visit-row-summary {
    position: relative;
    display: grid;
    grid-template-columns: 34px 28px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    min-height: 76px;
    padding: 9px 5px 9px 0;
    overflow: visible;
    border: 0;
    border-bottom: 1px solid rgba(105, 170, 191, .1);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    animation: none;
}
#patientsView .visit-row-summary::before {
    content: "";
    position: absolute;
    inset: 0;
    opacity: 0;
    background: linear-gradient(90deg, rgba(43, 205, 235, .055), transparent 70%);
    transition: opacity .2s ease;
}
#patientsView .visit-row-summary:hover,
#patientsView .visit-row-summary:focus-visible {
    border-color: rgba(63, 220, 248, .28);
    background: transparent;
    outline: none;
}
#patientsView .visit-row-summary:hover::before,
#patientsView .visit-row-summary:focus-visible::before { opacity: 1; }

#patientsView .visit-row-index {
    color: rgba(74, 216, 241, .38);
    font-family: 'Orbitron', sans-serif;
    font-size: 8px;
    text-align: right;
}
#patientsView .visit-row-node {
    position: relative;
    z-index: 2;
    display: grid;
    place-items: center;
    width: 13px;
    height: 13px;
    margin-left: 6px;
    border: 1px solid rgba(66, 221, 248, .68);
    border-radius: 50%;
    background: rgba(4, 18, 37, .92);
    box-shadow: 0 0 12px rgba(66, 221, 248, .18);
}
#patientsView .visit-row-node i { width: 3px; height: 3px; border-radius: 50%; background: #4ce0f8; }

#patientsView .visit-row-summary .visit-row-main {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}
#patientsView .visit-row-summary .visit-row-title {
    color: rgba(213, 240, 247, .87);
    font-family: 'Monitorica', sans-serif;
    font-size: 15px;
    font-weight: 500;
    letter-spacing: .035em;
    text-align: left;
    text-shadow: none;
    text-transform: none;
}
#patientsView .visit-row-summary .visit-row-preview {
    max-width: min(760px, 66vw);
    color: rgba(145, 181, 195, .48);
    font-family: 'Monitorica', sans-serif;
    font-size: 10px;
}
#patientsView .visit-row-open { position: relative; z-index: 2; padding-right: 8px; }
#patientsView .visit-row-summary:hover .visit-row-open { color: rgba(97, 228, 250, .87); transform: translateX(3px); }

#patientsView #visitDetailView {
    margin-top: 18px;
    padding: 23px 0 28px;
    border: 0;
    border-top: 1px solid rgba(63, 218, 246, .25);
    border-radius: 0;
    background: linear-gradient(180deg, rgba(42, 194, 221, .035), transparent 150px);
    box-shadow: none;
}

/* Trash uses the same registry language. */
#patientsView #patientsTrashState > .chat-header {
    padding: 16px 0 20px;
    border-bottom: 1px solid rgba(68, 214, 241, .18);
}
#patientsView #patientsTrashState .chat-title { color: rgba(222, 243, 249, .9); font-size: clamp(28px, 3vw, 42px); }
#patientsView #patientsTrashState .patients-list-wrapper { padding-top: 18px; }
#patientsView #patientsTrashState .patient-row { grid-template-columns: 42px minmax(220px, 1fr) minmax(260px, 1.4fr) auto; }
#patientsView #patientsTrashState .patient-row-restore { position: relative; z-index: 2; min-width: 126px; }

#patientsView .patients-empty-state {
    margin: 40px auto;
    padding: 28px;
    border: 0;
    border-top: 1px solid rgba(61, 214, 242, .17);
    border-bottom: 1px solid rgba(99, 73, 225, .12);
    border-radius: 0;
    background: transparent;
    color: rgba(169, 201, 214, .55);
}

/* Docking animation: surname migrates from registry row to patient hero. */
#patientsView #patientsOverviewState.patient-card-docking .patient-overview-status { animation: patientDockKicker .42s ease both; }
#patientsView #patientsOverviewState.patient-card-docking .patient-overview-name strong { animation: patientDockSurname .62s cubic-bezier(.16,1,.3,1) both; }
#patientsView #patientsOverviewState.patient-card-docking .patient-overview-name span { animation: patientDockRest .58s cubic-bezier(.22,1,.36,1) .08s both; }
#patientsView #patientsOverviewState.patient-card-docking .patient-overview-meta { animation: patientDockMeta .45s ease .18s both; }
#patientsView #patientsOverviewState.patient-card-docking .patient-overview-orbit { animation: patientDockOrbit .72s cubic-bezier(.22,1,.36,1) both; }

@keyframes patientRegistrySignal { from { transform: translateX(-10%); } to { transform: translateX(250%); } }
@keyframes patientStatusPulse { 50% { opacity: .42; transform: scale(.78); } }
@keyframes patientRadarSweep { to { transform: rotate(360deg); } }
@keyframes patientConsoleOpen { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@keyframes patientRowMaterialize { from { opacity: 0; transform: translateX(-13px); } to { opacity: 1; transform: none; } }
@keyframes patientDockKicker { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@keyframes patientDockSurname { from { opacity: .1; transform: translate(-22px, 27px) scale(.62); filter: blur(5px); letter-spacing: .02em; } to { opacity: 1; transform: none; filter: none; } }
@keyframes patientDockRest { from { opacity: 0; transform: translateX(-18px); } to { opacity: 1; transform: none; } }
@keyframes patientDockMeta { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes patientDockOrbit { from { opacity: 0; transform: rotate(-18deg) scale(.7); } to { opacity: 1; transform: none; } }

@media (max-width: 1050px) {
    #patientsView .patient-row { grid-template-columns: 34px minmax(210px, 1.2fr) minmax(180px, 1fr) 34px; }
    #patientsView .patient-row-open { display: none; }
    #patientsView .patient-overview-name { flex-direction: column; align-items: flex-start; gap: 6px; }
    #patientsView .patient-overview-name strong { font-size: clamp(38px, 7vw, 62px); }
    #patientsView .patient-overview-name span { font-size: clamp(20px, 4vw, 31px); }
}

@media (max-width: 760px) {
    #patientsView .patients-wrapper { padding: 52px 16px 14px; }
    #patientsView .patient-registry-header { min-height: 126px; padding-top: 4px; }
    #patientsView .patient-registry-heading h2 { font-size: 34px; }
    #patientsView .patient-registry-heading p { max-width: 75%; font-size: 10px; line-height: 1.45; }
    #patientsView .patient-registry-radar { right: -100px; opacity: .45; }
    #patientsView .patient-registry-telemetry { min-width: 82px; padding-right: 0; }
    #patientsView .patient-registry-telemetry > span:last-child { display: none; }

    #patientsView .patients-toolbar {
        width: 100%;
        min-width: 0;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 9px;
    }
    #patientsView .patients-search-wrapper { grid-column: 1 / -1; }
    #patientsView .btn-new-patient,
    #patientsView #btnShowTrash { min-height: 38px; padding: 7px 11px; font-size: 10px; }
    #patientsView #btnShowTrash { grid-column: 1; grid-row: 2; justify-self: start; }
    #patientsView .btn-new-patient { grid-column: 2; grid-row: 2; }
    #patientsView #btnShowTrash,
    #patientsView .btn-new-patient { width: 100%; min-width: 0; justify-content: center; overflow: hidden; white-space: nowrap; }

    #patientsView #patientsList .patient-row {
        grid-template-columns: 25px minmax(0, 1fr) 28px;
        grid-template-areas: none;
        gap: 8px;
        min-height: 70px;
    }
    #patientsView #patientsList .patient-row-name { grid-area: auto; grid-column: 2; grid-row: 1; }
    #patientsView #patientsList .patient-row-meta { grid-area: auto; grid-column: 2; grid-row: 2; margin-top: -7px; font-size: 9px; }
    #patientsView #patientsList .patient-row-delete { grid-area: auto; grid-column: 3; grid-row: 1 / 3; opacity: .55; }
    #patientsView .patient-row-name strong { font-size: 17px; }
    #patientsView .patient-row-name span { font-size: 10px; }
    #patientsView #patientsTrashState #patientsTrashList .patient-row {
        grid-template-columns: 25px minmax(0, 1fr) auto;
        grid-template-areas: none;
        row-gap: 6px;
    }
    #patientsView #patientsTrashState #patientsTrashList .patient-row-name { grid-area: auto; grid-column: 2; grid-row: 1; }
    #patientsView #patientsTrashState #patientsTrashList .patient-row-meta { grid-area: auto; grid-column: 2 / 4; grid-row: 2; margin: -4px 0 3px; }
    #patientsView #patientsTrashState #patientsTrashList .patient-row-restore { grid-area: auto; grid-column: 3; grid-row: 1; min-width: 0; width: auto; padding: 6px 8px; font-size: 9px; }

    #patientsView .patient-overview-navigation { position: absolute; z-index: 10; top: 0; right: 0; }
    #patientsView .patient-overview-navigation #btnBackToPatientsListFromOverview { font-size: 9px; }
    #patientsView .patient-overview-identity-deck { min-height: 260px; padding-top: 28px; }
    #patientsView .patient-overview-status { padding-right: 120px; font-size: 7px; }
    #patientsView .patient-overview-name { margin-top: 20px; }
    #patientsView .patient-overview-name strong { max-width: 100%; font-size: clamp(32px, 11vw, 49px); }
    #patientsView .patient-overview-name span { max-width: 100%; font-size: clamp(18px, 6.5vw, 28px); }
    #patientsView .patient-overview-orbit { right: -205px; opacity: .55; }
    #patientsView .patients-identity-actions { flex-wrap: wrap; }
    #patientsView .patients-identity-actions .btn-delete-patient { margin-left: 0; }

    #patientsView .patients-overview-visits-header { width: 100%; min-width: 0; flex-direction: row; align-items: flex-end; }
    #patientsView .patient-visits-heading { min-width: 0; }
    #patientsView .patient-visits-heading .recipe-section-title { white-space: normal; }
    #patientsView .btn-new-visit { min-height: 36px; padding: 7px 10px; }
    #patientsView .visit-row-summary { grid-template-columns: 26px 24px minmax(0, 1fr); min-height: 72px; }
    #patientsView .visit-row-open { display: none; }
    #patientsView .visits-list::before { left: 43px; }
    #patientsView .visit-row-summary .visit-row-preview { max-width: 100%; }
}

@media (max-width: 480px) {
    #patientsView .patient-registry-heading p { display: none; }
    #patientsView .patient-registry-header { min-height: 100px; }
    #patientsView .patient-registry-kicker { font-size: 7px; }
    #patientsView .patient-registry-heading h2 { font-size: 30px; }
    #patientsView .patient-registry-count { font-size: 20px; }
    #patientsView .patient-row-meta span:nth-child(2) { display: none; }
    #patientsView .patients-overview-body { padding-right: 0; }
    #patientsView .patient-overview-meta { flex-direction: column; }
    #patientsView .patient-overview-orbit { right: -225px; opacity: .45; }
    #patientsView .patient-visits-heading .recipe-section-title { font-size: 20px; }
}

@media (prefers-reduced-motion: reduce) {
    #patientsView .patient-registry-header::after,
    #patientsView .patient-registry-radar b,
    #patientsView .patient-registry-kicker i,
    #patientsView .patient-overview-status i,
    #patientsView .patient-row,
    #patientsView #patientsOverviewState.patient-card-docking * {
        animation: none !important;
    }
    #patientsView .patient-overview-orbit { animation: none !important; }
    #patientsView .patient-row { opacity: 1; }
}

/* ========================================================================
   PATIENTS / READABILITY V8
   Крупнее рабочая типографика и выше контраст без изменения композиции.
   ======================================================================== */

#patientsView .patient-registry-kicker,
#patientsView .patient-overview-status {
    color: rgba(111, 232, 251, .82);
    font-size: 11px;
    font-weight: 500;
}

#patientsView .patient-registry-heading p {
    max-width: 720px;
    color: rgba(188, 216, 226, .78);
    font-family: 'Space Grotesk', 'Inter', sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

#patientsView .patient-registry-telemetry {
    color: rgba(157, 205, 220, .7);
    font-size: 10px;
}

#patientsView .patient-registry-count { font-size: 30px; }

#patientsView .patients-search-wrapper label,
#patientsView .patient-visits-heading > span {
    color: rgba(99, 226, 248, .74);
    font-size: 9px;
    font-weight: 500;
}

#patientsView .patients-search {
    color: rgba(238, 250, 253, .96);
    font-family: 'Space Grotesk', 'Inter', sans-serif;
    font-size: 16px;
    font-weight: 400;
}

#patientsView .patients-search::placeholder { color: rgba(172, 199, 211, .62); }

#patientsView .btn-new-patient,
#patientsView .btn-patients-primary,
#patientsView .btn-patients-secondary {
    min-height: 46px;
    font-family: 'Space Grotesk', 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 500;
}

#patientsView .patients-date-divider-label {
    color: rgba(102, 225, 247, .7);
    font-size: 9px;
    font-weight: 500;
}

#patientsView .patient-row {
    min-height: 88px;
    padding-top: 13px;
    padding-bottom: 13px;
}

#patientsView .patient-row-index,
#patientsView .visit-row-index {
    color: rgba(98, 225, 247, .62);
    font-size: 11px;
    font-weight: 500;
}

#patientsView .patient-row-name strong {
    color: rgba(241, 252, 255, .98);
    font-family: 'Space Grotesk', 'Inter', sans-serif;
    font-size: 24px;
    font-weight: 500;
    letter-spacing: .045em;
    line-height: 1.12;
}

#patientsView .patient-row-name span {
    color: rgba(198, 220, 229, .8);
    font-family: 'Space Grotesk', 'Inter', sans-serif;
    font-size: 14px;
    line-height: 1.35;
}

#patientsView .patient-row-meta {
    gap: 7px 20px;
    color: rgba(192, 216, 225, .75);
    font-family: 'Space Grotesk', 'Inter', sans-serif;
    font-size: 13px;
    line-height: 1.4;
}

#patientsView .patient-row-open,
#patientsView .visit-row-open {
    color: rgba(105, 224, 246, .68);
    font-size: 9px;
    font-weight: 500;
}

#patientsView .patient-overview-meta {
    color: rgba(198, 222, 231, .82);
    font-family: 'Space Grotesk', 'Inter', sans-serif;
    font-size: 14px;
    line-height: 1.45;
}

#patientsView .patient-visits-heading .recipe-section-title {
    color: rgba(239, 251, 254, .98);
    font-family: 'Space Grotesk', 'Inter', sans-serif;
    font-size: clamp(25px, 2.25vw, 33px);
    font-weight: 500;
}

#patientsView .visit-row-summary { min-height: 92px; }

#patientsView .visit-row-summary .visit-row-title {
    color: rgba(232, 248, 252, .96);
    font-family: 'Space Grotesk', 'Inter', sans-serif;
    font-size: 18px;
    font-weight: 500;
}

#patientsView .visit-row-summary .visit-row-preview {
    color: rgba(184, 209, 219, .72);
    font-family: 'Space Grotesk', 'Inter', sans-serif;
    font-size: 13px;
    line-height: 1.45;
}

#patientsView .patients-empty-state {
    color: rgba(194, 219, 228, .76);
    font-family: 'Space Grotesk', 'Inter', sans-serif;
    font-size: 15px;
}

@media (max-width: 760px) {
    #patientsView .patient-registry-kicker,
    #patientsView .patient-overview-status { font-size: 9px; }
    #patientsView .patient-registry-heading p { font-size: 12px; }
    #patientsView .patient-registry-count { font-size: 25px; }
    #patientsView .patients-search { font-size: 15px; }
    #patientsView .btn-new-patient,
    #patientsView .btn-patients-primary,
    #patientsView .btn-patients-secondary,
    #patientsView #btnShowTrash { min-height: 42px; font-size: 12px; }
    #patientsView #patientsList .patient-row { min-height: 84px; }
    #patientsView .patient-row-index,
    #patientsView .visit-row-index { font-size: 10px; }
    #patientsView .patient-row-name strong { font-size: 20px; }
    #patientsView .patient-row-name span { font-size: 12px; }
    #patientsView #patientsList .patient-row-meta { font-size: 11px; line-height: 1.35; }
    #patientsView .patient-overview-navigation #btnBackToPatientsListFromOverview { font-size: 11px; }
    #patientsView .patient-overview-meta { font-size: 12px; }
    #patientsView .patient-visits-heading .recipe-section-title { font-size: 23px; }
    #patientsView .visit-row-summary { min-height: 86px; }
    #patientsView .visit-row-summary .visit-row-title { font-size: 16px; }
    #patientsView .visit-row-summary .visit-row-preview { font-size: 11.5px; }
}

@media (max-width: 480px) {
    #patientsView .patient-registry-heading h2 { font-size: 32px; }
    #patientsView .patient-row-name strong { font-size: 19px; }
    #patientsView .patient-row-name span { font-size: 11.5px; }
    #patientsView .patient-visits-heading .recipe-section-title { font-size: 21px; }
}

/* V9 — сохраняем исходную гарнитуру интерфейса; V8 меняет только размер и контраст. */
#patientsView .patient-registry-heading p,
#patientsView .patients-search,
#patientsView .btn-new-patient,
#patientsView .btn-patients-primary,
#patientsView .btn-patients-secondary,
#patientsView .patient-row-name strong,
#patientsView .patient-row-name span,
#patientsView .patient-row-meta,
#patientsView .patient-overview-meta,
#patientsView .patient-visits-heading .recipe-section-title,
#patientsView .visit-row-summary .visit-row-title,
#patientsView .visit-row-summary .visit-row-preview,
#patientsView .patients-empty-state {
    font-family: 'Monitorica', sans-serif;
}

/* ========================================================================
   ANAMNESIS / READABILITY V10
   Только размеры и контраст. Гарнитура и визуальный стиль не изменяются.
   ======================================================================== */

#patientsWizardState[data-wizard-step="1"] .patient-dialog-header .patient-intake-kicker {
    color: rgba(115, 231, 250, .84);
    font-size: 13px;
}

#patientsWizardState[data-wizard-step="1"] .patient-dialog-header .patient-intake-meta {
    color: rgba(197, 225, 235, .86);
    font-size: 16px;
}

#patientsWizardState[data-wizard-step="1"] .adaptive-mode-btn {
    font-size: 15px;
    font-weight: 500;
}

#patientsWizardState[data-wizard-step="1"] .anamnesis-save-state {
    color: rgba(183, 219, 231, .76);
    font-size: 13px;
}

#patientsWizardState[data-wizard-step="1"] .patient-dialog-body .adaptive-anamnesis-status {
    color: rgba(112, 228, 248, .84);
    font-size: 14px;
    line-height: 1.45;
}

#patientsWizardState[data-wizard-step="1"] .anamnesis-progress-text {
    color: rgba(196, 220, 230, .78);
    font-size: 13px;
}

#patientsWizardState[data-wizard-step="1"] .patient-dialog-body .anamnesis-message-avatar {
    font-size: 12px;
}

#patientsWizardState[data-wizard-step="1"] .patient-dialog-body .anamnesis-message-meta {
    color: rgba(100, 228, 250, .84);
    font-size: 11.5px;
}

#patientsWizardState[data-wizard-step="1"] .patient-dialog-body .anamnesis-message-meta span:last-child {
    color: rgba(185, 210, 221, .68);
}

#patientsWizardState[data-wizard-step="1"] .patient-dialog-body .anamnesis-chat-question-text {
    color: rgba(245, 252, 255, .99);
    font-size: 20px;
    line-height: 1.48;
}

#patientsWizardState[data-wizard-step="1"] .patient-dialog-body .anamnesis-branch-hint {
    color: rgba(180, 215, 227, .78);
    font-size: 13.5px;
    line-height: 1.45;
}

#patientsWizardState[data-wizard-step="1"] .patient-dialog-body .anamnesis-chat-composer .anamnesis-text-input {
    color: rgba(246, 252, 255, .99);
    font-size: 18px;
}

#patientsWizardState[data-wizard-step="1"] .patient-dialog-body .anamnesis-chat-composer .anamnesis-text-input::placeholder {
    color: rgba(177, 203, 215, .68);
}

#patientsWizardState[data-wizard-step="1"] .patient-dialog-body .anamnesis-message-user .anamnesis-message-bubble,
#patientsWizardState[data-wizard-step="1"] .patient-dialog-body .anamnesis-previous-answer .anamnesis-message-bubble {
    color: rgba(247, 250, 255, .99);
    font-size: 17px;
    line-height: 1.5;
}

#patientsWizardState[data-wizard-step="1"] .anamnesis-previous-answer-label {
    color: rgba(198, 212, 231, .7);
    font-size: 11px;
}

#patientsWizardState[data-wizard-step="1"] .anamnesis-rationale-toggle {
    color: rgba(113, 225, 246, .82);
    font-size: 13px;
}

#patientsWizardState[data-wizard-step="1"] .anamnesis-rationale-content {
    color: rgba(206, 228, 236, .84);
    font-size: 14px;
    line-height: 1.6;
}

#patientsWizardState[data-wizard-step="1"] .anamnesis-rationale-kicker { font-size: 10px; }
#patientsWizardState[data-wizard-step="1"] .anamnesis-rationale-source {
    color: rgba(184, 205, 220, .7);
    font-size: 11px;
}

#patientsWizardState[data-wizard-step="1"] .adaptive-anamnesis-safety {
    font-size: 13px;
    line-height: 1.5;
}

#patientsWizardState[data-wizard-step="1"] .anamnesis-writing-indicator strong { font-size: 17px; }
#patientsWizardState[data-wizard-step="1"] .anamnesis-writing-indicator > div:nth-child(2) span { font-size: 13px; }

#patientsWizardState[data-wizard-step="1"] .anamnesis-history-drawer header span { font-size: 10px; }
#patientsWizardState[data-wizard-step="1"] .anamnesis-history-drawer header strong { font-size: 20px; }
#patientsWizardState[data-wizard-step="1"] .anamnesis-history-index { font-size: 10px; }
#patientsWizardState[data-wizard-step="1"] .anamnesis-history-item strong { font-size: 14px; line-height: 1.45; }
#patientsWizardState[data-wizard-step="1"] .anamnesis-history-item small { font-size: 12px; line-height: 1.55; }
#patientsWizardState[data-wizard-step="1"] .anamnesis-history-empty { font-size: 13px; }

@media (max-width: 720px) {
    #patientsWizardState[data-wizard-step="1"] .patient-dialog-header .patient-intake-kicker { font-size: 11px; }
    #patientsWizardState[data-wizard-step="1"] .patient-dialog-header .patient-intake-meta { font-size: 14px; }
    #patientsWizardState[data-wizard-step="1"] .adaptive-mode-btn { font-size: 14px; }
    #patientsWizardState[data-wizard-step="1"] .anamnesis-save-state { font-size: 12px; }
    #patientsWizardState[data-wizard-step="1"] .patient-dialog-body .adaptive-anamnesis-status { font-size: 13px; }
    #patientsWizardState[data-wizard-step="1"] .anamnesis-progress-text { font-size: 12px; }
    #patientsWizardState[data-wizard-step="1"] .patient-dialog-body .anamnesis-message-meta { font-size: 10.5px; }
    #patientsWizardState[data-wizard-step="1"] .patient-dialog-body .anamnesis-chat-question-text { font-size: 18px; }
    #patientsWizardState[data-wizard-step="1"] .patient-dialog-body .anamnesis-branch-hint { font-size: 12.5px; }
    #patientsWizardState[data-wizard-step="1"] .patient-dialog-body .anamnesis-chat-composer .anamnesis-text-input { font-size: 17px; }
    #patientsWizardState[data-wizard-step="1"] .patient-dialog-body .anamnesis-message-user .anamnesis-message-bubble,
    #patientsWizardState[data-wizard-step="1"] .patient-dialog-body .anamnesis-previous-answer .anamnesis-message-bubble { font-size: 16px; }
    #patientsWizardState[data-wizard-step="1"] .anamnesis-rationale-toggle { font-size: 12px; }
    #patientsWizardState[data-wizard-step="1"] .anamnesis-rationale-content { font-size: 13px; }
    #patientsWizardState[data-wizard-step="1"] .adaptive-anamnesis-safety { font-size: 12px; }
}

/* ========================================================================
   PATIENT COMMAND CONTROLS V11
   Округлые командные кнопки с индикацией и коротким «включением».
   ======================================================================== */

#patientsView .patient-power-command {
    position: relative;
    isolation: isolate;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 50px;
    padding: 6px 26px 6px 8px;
    overflow: hidden;
    border-radius: 25px !important;
    animation: patientPowerBoot .72s cubic-bezier(.22, 1, .36, 1) both;
}

#patientsView .patient-power-command::before {
    content: "";
    position: absolute;
    z-index: -1;
    top: -45%;
    bottom: -45%;
    left: -30%;
    width: 28%;
    opacity: 0;
    transform: skewX(-18deg);
    background: linear-gradient(90deg, transparent, rgba(111, 235, 255, .16), transparent);
    animation: patientPowerScan 3.8s ease-in-out 1.1s infinite;
    pointer-events: none;
}

#patientsView .patient-power-command::after {
    content: "";
    position: absolute;
    top: 8px;
    right: 11px;
    width: 6px;
    height: 6px;
    border: 1px solid rgba(98, 234, 255, .68);
    border-radius: 50%;
    background: #52e4fa;
    box-shadow: 0 0 5px #52e4fa, 0 0 12px rgba(82, 228, 250, .72);
    animation: patientLedWarmup 1.4s ease-out both, patientLedIdle 2.6s ease-in-out 1.4s infinite;
}

#patientsView .patient-power-command-muted::after {
    border-color: rgba(164, 132, 255, .68);
    background: #8f74f7;
    box-shadow: 0 0 5px #8f74f7, 0 0 12px rgba(143, 116, 247, .62);
}

#patientsView .patient-command-orb {
    position: relative;
    display: grid;
    place-items: center;
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid rgba(87, 228, 252, .58);
    border-radius: 50%;
    background: radial-gradient(circle at 38% 32%, rgba(75, 225, 250, .18), rgba(10, 34, 61, .28) 64%);
    color: rgba(118, 236, 255, .96);
    font-size: 22px;
    font-weight: 400;
    line-height: 1;
    box-shadow: inset 0 0 12px rgba(54, 218, 247, .08), 0 0 12px rgba(54, 218, 247, .09);
}

#patientsView .patient-command-orb::before {
    content: "";
    position: absolute;
    inset: 3px;
    border: 1px solid transparent;
    border-top-color: rgba(107, 233, 255, .72);
    border-right-color: rgba(120, 97, 246, .55);
    border-radius: 50%;
    animation: patientOrbStandby 5.5s linear infinite;
}

#patientsView .patient-command-orb::after {
    content: "";
    position: absolute;
    top: 1px;
    right: 2px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #58e5fb;
    box-shadow: 0 0 7px #58e5fb;
}

#patientsView .patient-power-command-muted .patient-command-orb {
    border-color: rgba(142, 122, 234, .5);
    color: rgba(180, 169, 232, .85);
    background: radial-gradient(circle at 38% 32%, rgba(137, 103, 238, .14), rgba(10, 27, 53, .22) 66%);
}

#patientsView .patient-command-orb svg {
    position: relative;
    z-index: 1;
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.55;
    stroke-linecap: round;
    stroke-linejoin: round;
}

#patientsView .patient-power-command:hover .patient-command-orb {
    border-color: rgba(104, 235, 255, .92);
    color: #a2f2ff;
    box-shadow: inset 0 0 15px rgba(54, 218, 247, .12), 0 0 18px rgba(54, 218, 247, .25);
}

#patientsView .patient-power-command.is-powering {
    animation: patientPowerPress .55s cubic-bezier(.16, 1, .3, 1) both;
}

#patientsView .patient-power-command.is-powering .patient-command-orb {
    animation: patientOrbIgnite .72s cubic-bezier(.22, 1, .36, 1) both;
}

#patientsView .patient-power-command.is-powering::after {
    animation: patientLedConfirm .68s ease-out both;
}

/* Уже существующие иконки управления тоже становятся круглыми. */
#patientsView .anamnesis-history-button,
#patientsView .anamnesis-chat-send,
#patientsView .anamnesis-chat-back,
#patientsView .patient-row-delete {
    border-radius: 50% !important;
}

#patientsView .anamnesis-history-button,
#patientsView .anamnesis-chat-send,
#patientsView .anamnesis-chat-back {
    transition: transform .2s ease, border-color .2s ease, color .2s ease, box-shadow .2s ease;
}

#patientsView .anamnesis-history-button:hover,
#patientsView .anamnesis-chat-send:hover,
#patientsView .anamnesis-chat-back:hover {
    box-shadow: 0 0 0 3px rgba(67, 219, 246, .07), 0 0 20px rgba(67, 219, 246, .22);
}

#patientsView .anamnesis-history-button.is-powering,
#patientsView .anamnesis-chat-send.is-powering,
#patientsView .anamnesis-chat-back.is-powering,
#patientsView .patient-row-delete.is-powering {
    animation: patientIconPowerPress .5s cubic-bezier(.16, 1, .3, 1) both;
}

@keyframes patientPowerBoot {
    0% { opacity: .45; filter: saturate(.45); box-shadow: none; }
    45% { opacity: 1; filter: saturate(1.45); box-shadow: 0 0 24px rgba(50, 214, 243, .2); }
    100% { opacity: 1; filter: none; }
}

@keyframes patientPowerScan {
    0%, 62% { left: -30%; opacity: 0; }
    72% { opacity: .85; }
    92%, 100% { left: 112%; opacity: 0; }
}

@keyframes patientLedWarmup {
    0%, 24% { opacity: .15; transform: scale(.55); }
    38% { opacity: 1; transform: scale(1.5); }
    52% { opacity: .28; transform: scale(.75); }
    72%, 100% { opacity: 1; transform: scale(1); }
}

@keyframes patientLedIdle { 50% { opacity: .5; box-shadow: 0 0 3px currentColor, 0 0 7px currentColor; } }
@keyframes patientOrbStandby { to { transform: rotate(360deg); } }

@keyframes patientPowerPress {
    0% { transform: scale(1); }
    32% { transform: scale(.965); filter: brightness(.88); }
    68% { transform: scale(1.018); filter: brightness(1.22); }
    100% { transform: scale(1); filter: none; }
}

@keyframes patientOrbIgnite {
    0% { transform: scale(.86) rotate(-18deg); opacity: .55; }
    48% { transform: scale(1.16) rotate(8deg); opacity: 1; box-shadow: 0 0 28px rgba(73, 226, 251, .55); }
    100% { transform: none; opacity: 1; }
}

@keyframes patientLedConfirm {
    0% { transform: scale(.5); opacity: .25; }
    35% { transform: scale(2); opacity: 1; box-shadow: 0 0 14px currentColor, 0 0 26px currentColor; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes patientIconPowerPress {
    0% { transform: scale(1); }
    38% { transform: scale(.82); filter: brightness(.8); }
    72% { transform: scale(1.12); filter: brightness(1.35); box-shadow: 0 0 24px rgba(76, 225, 250, .42); }
    100% { transform: scale(1); filter: none; }
}

@media (max-width: 760px) {
    #patientsView .patient-power-command {
        min-height: 46px;
        padding: 5px 20px 5px 6px;
        border-radius: 23px !important;
    }
    #patientsView .patient-command-orb { flex-basis: 32px; width: 32px; height: 32px; font-size: 20px; }
    #patientsView .patient-power-command::after { top: 7px; right: 9px; width: 5px; height: 5px; }
}

@media (prefers-reduced-motion: reduce) {
    #patientsView .patient-power-command,
    #patientsView .patient-power-command::before,
    #patientsView .patient-power-command::after,
    #patientsView .patient-command-orb::before,
    #patientsView .patient-power-command.is-powering,
    #patientsView .patient-power-command.is-powering .patient-command-orb,
    #patientsView .patient-power-command.is-powering::after,
    #patientsView .anamnesis-history-button.is-powering,
    #patientsView .anamnesis-chat-send.is-powering,
    #patientsView .anamnesis-chat-back.is-powering,
    #patientsView .patient-row-delete.is-powering { animation: none !important; }
}

/* ========================================================================
   PATIENT CARD ACTIONS V13
   Единая «приборная» панель команд карты и выбранного приёма.
   ======================================================================== */

#patientsView .patient-action-command {
    min-height: 52px;
    padding: 7px 27px 7px 8px;
    border-radius: 27px !important;
    font-size: 15px !important;
    font-weight: 500;
    line-height: 1.15;
    letter-spacing: .018em;
    white-space: nowrap;
    transition: transform .22s ease, color .22s ease, border-color .22s ease, box-shadow .22s ease, background-color .22s ease;
}

#patientsView .patient-action-command:hover {
    transform: translateY(-2px);
    border-color: rgba(91, 228, 250, .82);
    color: #dffbff;
    box-shadow: inset 0 0 18px rgba(43, 213, 241, .07), 0 0 0 3px rgba(43, 213, 241, .05), 0 8px 24px rgba(17, 202, 236, .13);
}

#patientsView .patient-action-command:focus-visible {
    outline: 2px solid rgba(114, 236, 255, .86);
    outline-offset: 3px;
}

#patientsView .patient-power-command-danger {
    border-color: rgba(236, 89, 123, .42) !important;
    color: rgba(250, 151, 170, .88) !important;
    background: rgba(45, 11, 31, .08) !important;
}

#patientsView .patient-power-command-danger::after {
    border-color: rgba(255, 119, 148, .78);
    background: #f36a8d;
    box-shadow: 0 0 5px #f36a8d, 0 0 13px rgba(243, 106, 141, .72);
}

#patientsView .patient-power-command-danger .patient-command-orb {
    border-color: rgba(239, 99, 131, .58);
    color: rgba(255, 151, 175, .95);
    background: radial-gradient(circle at 38% 32%, rgba(239, 82, 119, .17), rgba(48, 9, 30, .24) 66%);
    box-shadow: inset 0 0 12px rgba(238, 79, 116, .09), 0 0 12px rgba(238, 79, 116, .1);
}

#patientsView .patient-power-command-danger .patient-command-orb::before {
    border-top-color: rgba(255, 131, 158, .78);
    border-right-color: rgba(194, 82, 177, .6);
}

#patientsView .patient-power-command-danger .patient-command-orb::after {
    background: #f36a8d;
    box-shadow: 0 0 7px #f36a8d;
}

#patientsView .patient-power-command-danger:hover {
    border-color: rgba(246, 105, 137, .78) !important;
    color: #ffc0cd !important;
    box-shadow: inset 0 0 18px rgba(240, 76, 114, .08), 0 0 0 3px rgba(240, 76, 114, .045), 0 8px 24px rgba(185, 35, 80, .14);
}

#patientsView .patient-power-command-danger:hover .patient-command-orb {
    border-color: rgba(255, 130, 157, .9);
    color: #ffd0da;
    box-shadow: inset 0 0 15px rgba(238, 79, 116, .13), 0 0 18px rgba(238, 79, 116, .24);
}

#patientsView #visitDetailView .patients-wizard-header-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
}

#patientsView #visitDetailView .patient-action-command {
    flex: 0 0 auto;
}

#patientsView .patients-identity-actions .patient-action-command {
    margin-left: 0;
}

#patientsView .patients-identity-actions .patient-power-command-danger {
    margin-left: auto;
}

@media (max-width: 920px) {
    #patientsView #visitDetailView .patients-wizard-header-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%;
        margin-left: 0;
    }

    #patientsView #visitDetailView .patient-action-command {
        width: 100%;
        justify-content: flex-start;
    }
}

@media (max-width: 560px) {
    #patientsView .patient-action-command {
        min-height: 48px;
        padding: 6px 22px 6px 7px;
        border-radius: 24px !important;
        font-size: 14px !important;
    }

    #patientsView #visitDetailView .patients-wizard-header-actions {
        grid-template-columns: 1fr;
    }

    #patientsView .patients-identity-actions .patient-action-command,
    #patientsView .patients-identity-actions .patient-power-command-danger {
        width: 100%;
        margin-left: 0;
        justify-content: flex-start;
    }
}

/* ========================================================================
   BORDERLESS OPTICAL CONSOLE V14
   Рецепт и диагностика: свободная сетка, светодиодные параметры и маркеры глаз.
   ======================================================================== */

/* Убираем карточки-контейнеры только внутри модуля пациента. Заголовки и
   смысловые интервалы остаются, поэтому длинная форма не превращается в стену. */
#patientsView #wizardStep3 > .recipe-form-section,
#patientsView #prescriptionsSection,
#patientsView #prescriptionsList > .prescription-card {
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    transform: none !important;
}

#patientsView #wizardStep3 > .recipe-form-section,
#patientsView #prescriptionsSection {
    padding: 22px 2px 26px;
    margin-bottom: 0;
}

#patientsView #wizardStep3 > .recipe-form-section::before,
#patientsView #prescriptionsSection::before,
#patientsView #prescriptionsList > .prescription-card::before {
    display: none !important;
}

#patientsView #wizardStep3 > .recipe-form-section + .recipe-form-section,
#patientsView #prescriptionsSection {
    border-top: 1px solid rgba(74, 221, 247, .1) !important;
}

#patientsView #prescriptionsList > .prescription-card {
    position: relative;
    padding: 22px 0 28px;
    margin-bottom: 0 !important;
}

#patientsView #prescriptionsList > .prescription-card + .prescription-card {
    border-top: 1px solid rgba(112, 91, 239, .16) !important;
}

/* OD/OS — не плашки, а световые обозначения приборной панели. */
#patientsView .recipe-eye-group {
    position: relative;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    padding: 13px 3px 20px;
    margin: 7px 0 16px;
    overflow: visible;
}

#patientsView .recipe-eye-group::after {
    content: "";
    position: absolute;
    left: 3px;
    right: 3px;
    bottom: 0;
    height: 1px;
    opacity: .8;
    pointer-events: none;
}

#patientsView .recipe-eye-group-od::after {
    background: linear-gradient(90deg, rgba(53, 224, 251, .8), rgba(53, 224, 251, .15) 54%, transparent 100%);
    box-shadow: 0 0 11px rgba(53, 224, 251, .18);
}

#patientsView .recipe-eye-group-os::after {
    background: linear-gradient(90deg, rgba(132, 102, 255, .85), rgba(132, 102, 255, .15) 54%, transparent 100%);
    box-shadow: 0 0 11px rgba(132, 102, 255, .2);
}

#patientsView .recipe-eye-group-label {
    position: relative;
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    width: auto;
    margin: 0 0 13px;
    padding: 4px 14px 4px 48px;
    border: 0;
    border-radius: 0;
    background: transparent !important;
    color: #71ecff;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: .18em;
    line-height: 1;
    text-shadow: 0 0 7px rgba(74, 226, 252, .84), 0 0 17px rgba(74, 226, 252, .34);
}

#patientsView .recipe-eye-group-os .recipe-eye-group-label {
    color: #a995ff;
    text-shadow: 0 0 7px rgba(143, 111, 255, .86), 0 0 17px rgba(143, 111, 255, .36);
}

/* Неоновый глаз целиком рисуется одним элементом: контур + зрачок. */
#patientsView .recipe-eye-group-label::before,
.subj-duo-tab[data-eye="od"]::before,
.subj-duo-tab[data-eye="os"]::before {
    content: "";
    position: absolute;
    left: 9px;
    top: 50%;
    width: 24px;
    height: 14px;
    border: 1.5px solid currentColor;
    border-radius: 72% 0 72% 0;
    background: radial-gradient(circle at 50% 50%, currentColor 0 2.4px, rgba(6, 17, 39, .95) 2.8px 5px, transparent 5.4px);
    box-shadow: inset 0 0 7px currentColor, 0 0 7px currentColor;
    transform: translateY(-50%) rotate(45deg);
    transform-origin: center;
    animation: opticalEyeBlink 5.8s ease-in-out infinite, opticalEyePulse 2.8s ease-in-out infinite;
}

#patientsView .recipe-eye-group-os .recipe-eye-group-label::before,
.subj-duo-tab[data-eye="os"]::before {
    animation-delay: .9s, .55s;
}

/* Названия параметров работают как LED-индикаторы, а не как мелкий серый текст. */
#patientsView .recipe-form-label {
    position: relative;
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    gap: 8px;
    min-height: 20px;
    color: rgba(132, 225, 241, .82);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .095em;
    line-height: 1.3;
    text-shadow: 0 0 9px rgba(49, 214, 241, .2);
}

#patientsView .recipe-form-label::before {
    content: "";
    flex: 0 0 6px;
    width: 6px;
    height: 6px;
    border: 1px solid rgba(95, 231, 253, .6);
    border-radius: 50%;
    background: #4bdff8;
    box-shadow: 0 0 5px #4bdff8, 0 0 11px rgba(75, 223, 248, .62);
    animation: opticalParameterLed 2.9s ease-in-out infinite;
}

#patientsView .recipe-eye-group-os .recipe-form-label {
    color: rgba(178, 159, 255, .84);
    text-shadow: 0 0 9px rgba(136, 105, 255, .22);
}

#patientsView .recipe-eye-group-os .recipe-form-label::before {
    border-color: rgba(168, 143, 255, .62);
    background: #9a7df8;
    box-shadow: 0 0 5px #9a7df8, 0 0 11px rgba(154, 125, 248, .58);
    animation-delay: .65s;
}

/* Поле не обводится рамкой: значение стоит на световой базовой линии. */
#patientsView .recipe-form-input,
#patientsView .recipe-form-pd-sum {
    min-height: 48px;
    padding: 10px 12px 9px;
    border: 0 !important;
    border-bottom: 1px solid rgba(75, 219, 244, .3) !important;
    border-radius: 0 !important;
    background: linear-gradient(180deg, transparent 8%, rgba(27, 132, 160, .035) 100%) !important;
    box-shadow: inset 0 -1px 0 rgba(75, 219, 244, .05) !important;
    color: rgba(229, 249, 253, .96);
    font-size: 17px;
    transition: color .2s ease, border-color .2s ease, background .2s ease, box-shadow .2s ease, transform .2s ease;
}

#patientsView .recipe-eye-group-os .recipe-form-input,
#patientsView .recipe-eye-group-os .recipe-form-pd-sum {
    border-bottom-color: rgba(139, 109, 250, .32) !important;
    background: linear-gradient(180deg, transparent 8%, rgba(107, 74, 220, .038) 100%) !important;
    box-shadow: inset 0 -1px 0 rgba(139, 109, 250, .055) !important;
}

#patientsView .recipe-form-input:hover:not(:disabled):not(:focus) {
    transform: none;
    border-bottom-color: rgba(78, 226, 250, .66) !important;
    background: linear-gradient(180deg, transparent 5%, rgba(31, 176, 207, .075) 100%) !important;
    box-shadow: 0 6px 14px -12px rgba(66, 225, 251, .7), inset 0 -1px 0 rgba(78, 226, 250, .13) !important;
}

#patientsView .recipe-eye-group-os .recipe-form-input:hover:not(:disabled):not(:focus) {
    border-bottom-color: rgba(158, 132, 255, .68) !important;
    background: linear-gradient(180deg, transparent 5%, rgba(116, 81, 232, .08) 100%) !important;
    box-shadow: 0 6px 14px -12px rgba(145, 115, 255, .72), inset 0 -1px 0 rgba(154, 125, 248, .14) !important;
}

#patientsView .recipe-form-input:focus,
#patientsView .recipe-form-field:focus-within .recipe-form-input {
    outline: none;
    border-bottom-color: #58e5fb !important;
    background: linear-gradient(180deg, transparent, rgba(32, 184, 214, .09)) !important;
    box-shadow: 0 9px 18px -15px #58e5fb, inset 0 -1px 0 rgba(88, 229, 251, .5) !important;
    color: #f2fdff;
}

#patientsView .recipe-eye-group-os .recipe-form-input:focus,
#patientsView .recipe-eye-group-os .recipe-form-field:focus-within .recipe-form-input {
    border-bottom-color: #a68aff !important;
    background: linear-gradient(180deg, transparent, rgba(128, 91, 241, .095)) !important;
    box-shadow: 0 9px 18px -15px #a68aff, inset 0 -1px 0 rgba(166, 138, 255, .48) !important;
}

#patientsView .recipe-form-field:focus-within .recipe-form-label {
    color: #a9f4ff;
    text-shadow: 0 0 8px rgba(75, 223, 248, .52);
}

#patientsView .recipe-eye-group-os .recipe-form-field:focus-within .recipe-form-label {
    color: #c8baff;
    text-shadow: 0 0 8px rgba(154, 125, 248, .55);
}

#patientsView .recipe-form-input:disabled {
    opacity: .34;
    border-bottom-style: dashed !important;
    background: transparent !important;
    box-shadow: none !important;
}

#patientsView .recipe-form-input.error {
    border-bottom-color: #f06d91 !important;
    background: linear-gradient(180deg, transparent, rgba(218, 58, 103, .07)) !important;
}

#patientsView .axis-input-row {
    gap: 8px;
}

#patientsView .axis-picker-btn {
    align-self: center;
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 1px solid rgba(74, 222, 248, .32);
    border-radius: 50%;
    background: radial-gradient(circle, rgba(49, 190, 221, .09), transparent 70%);
    color: rgba(111, 231, 251, .86);
    box-shadow: inset 0 0 10px rgba(49, 190, 221, .06), 0 0 12px rgba(49, 190, 221, .07);
}

#patientsView .recipe-eye-group-os .axis-picker-btn {
    border-color: rgba(152, 123, 255, .34);
    color: rgba(183, 164, 255, .88);
    background: radial-gradient(circle, rgba(126, 87, 235, .1), transparent 70%);
}

/* OU используется в диагностических тестах: тот же светодиодный язык. */
.subj-duo-tabs {
    gap: 12px;
    border-bottom: 1px solid rgba(92, 220, 242, .1);
}

.subj-duo-tab {
    position: relative;
    min-height: 46px;
    padding: 9px 12px 9px 42px;
    border: 0;
    border-bottom: 1px solid transparent;
    border-radius: 0;
    background: transparent;
    color: rgba(174, 216, 229, .72);
    font-size: 13px;
    letter-spacing: .055em;
}

.subj-duo-tab[data-eye="od"]::before,
.subj-duo-tab[data-eye="os"]::before {
    left: 10px;
    width: 21px;
    height: 12px;
}

.subj-duo-tab[data-eye="od"] { color: rgba(111, 235, 255, .8); }
.subj-duo-tab[data-eye="os"] { color: rgba(177, 157, 255, .82); }

.subj-duo-tab[data-eye="ou"]::before {
    content: "";
    position: absolute;
    left: 17px;
    top: 50%;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #72e9fb;
    box-shadow: -5px 0 8px rgba(82, 226, 249, .82), 5px 0 8px rgba(159, 126, 255, .82), 0 0 13px rgba(118, 199, 255, .64);
    transform: translateY(-50%);
    animation: opticalParameterLed 2.6s ease-in-out infinite;
}

.subj-duo-tab.active {
    border-bottom-color: currentColor;
    background: linear-gradient(180deg, transparent, rgba(60, 202, 228, .065));
    color: #e9fbff;
    box-shadow: 0 9px 16px -15px currentColor;
}

@keyframes opticalEyeBlink {
    0%, 43%, 49%, 100% { transform: translateY(-50%) rotate(45deg) scaleY(1); }
    46% { transform: translateY(-50%) rotate(45deg) scaleY(.12); }
}

@keyframes opticalEyePulse {
    0%, 100% { opacity: .76; filter: brightness(.9); }
    50% { opacity: 1; filter: brightness(1.25); }
}

@keyframes opticalParameterLed {
    0%, 100% { opacity: .62; transform: scale(.88); }
    50% { opacity: 1; transform: scale(1.08); }
}

@media (max-width: 760px) {
    #patientsView #wizardStep3 > .recipe-form-section,
    #patientsView #prescriptionsSection { padding-left: 0; padding-right: 0; }

    #patientsView .recipe-eye-group { padding-left: 0; padding-right: 0; }
    #patientsView .recipe-eye-group-label { font-size: 15px; }
    #patientsView .recipe-form-label { font-size: 12px; }
    #patientsView .recipe-form-input,
    #patientsView .recipe-form-pd-sum { min-height: 46px; font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
    #patientsView .recipe-eye-group-label::before,
    #patientsView .recipe-form-label::before,
    .subj-duo-tab::before { animation: none !important; }
}

/* ========================================================================
   PATIENT DIALOG + CLINICAL CONTROLS V15
   Постоянный composer, лучевой переход, статусы этапов и цельная оптика.
   ======================================================================== */

/* Кнопка истории: настоящий pill. Прежний border-radius:50% при автоширине
   превращал её в вытянутый «глаз» и накладывал круг и внешний контур. */
#patientsView #patientsWizardState[data-wizard-step="1"] .anamnesis-history-button {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 9px;
    width: auto !important;
    min-width: 178px;
    height: 48px;
    padding: 5px 17px 5px 6px;
    overflow: hidden;
    border: 1px solid rgba(63, 221, 249, .42);
    border-radius: 999px !important;
    background: transparent;
    box-shadow: inset 0 0 18px rgba(45, 210, 240, .025), 0 0 18px rgba(45, 210, 240, .06);
}

#patientsView .anamnesis-history-button-icon {
    display: grid;
    place-items: center;
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    border: 1px solid rgba(74, 224, 250, .32);
    border-radius: 50%;
    background: transparent;
    box-shadow: inset 0 0 12px rgba(63, 218, 246, .06);
}

#patientsView .anamnesis-history-button-icon svg {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

#patientsView .anamnesis-history-button-label {
    display: inline !important;
    font-size: 14px;
    letter-spacing: .025em;
}

/* Нижний ввод — постоянный dock, геометрия не участвует в смене вопроса. */
#patientsView #patientsWizardState[data-wizard-step="1"] .patient-dialog-body .anamnesis-chat-dock {
    position: absolute;
    right: 34px;
    bottom: 26px;
    left: 34px;
    z-index: 10;
    margin: 0;
    animation: none !important;
    transform: none !important;
    contain: layout paint;
}

#patientsView .anamnesis-chat-dock.is-processing {
    border-color: rgba(137, 116, 239, .3);
    box-shadow: inset 0 0 17px rgba(116, 89, 237, .035), 0 0 25px rgba(83, 60, 201, .08);
}

#patientsView .anamnesis-chat-dock .anamnesis-text-input.is-placeholder-refreshing::placeholder {
    animation: anamnesisPlaceholderRefresh .48s cubic-bezier(.22, 1, .36, 1) both;
}

@keyframes anamnesisPlaceholderRefresh {
    0% { opacity: 0; filter: blur(4px); transform: translateX(12px); }
    100% { opacity: 1; filter: none; transform: none; }
}

/* Во время ответа индикатор находится над dock и не заменяет его. */
#patientsView #patientsWizardState[data-wizard-step="1"] .patient-dialog-body .anamnesis-writing-indicator {
    right: 42px;
    bottom: 100px;
    left: 96px;
    min-height: 76px;
    padding: 8px 10px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

/* Отработанная пара сначала сжимается в световую строку, потом уходит вправо. */
#patientsView .anamnesis-message-row.anamnesis-beam-out {
    pointer-events: none;
    transform-origin: 0 50%;
    animation: anamnesisMessageBeamOut .44s cubic-bezier(.55, 0, .25, 1) var(--beam-delay, 0ms) both !important;
}

#patientsView #patientsWizardState[data-wizard-step="1"] .patient-dialog-body .anamnesis-message-row.is-pending {
    position: relative;
    right: auto;
    bottom: auto;
    align-self: flex-end;
    margin: 24px 18px 0 auto;
}

#patientsView #patientsWizardState[data-wizard-step="1"] .patient-dialog-body .anamnesis-message-current.is-submitted {
    max-height: none;
}

@keyframes anamnesisMessageBeamOut {
    0% { opacity: 1; transform: translateX(0) scaleX(1) scaleY(1); filter: none; }
    47% { opacity: 1; transform: translateX(0) scaleX(1.02) scaleY(.055); filter: brightness(2.3) drop-shadow(0 0 11px #55e4fb); }
    62% { opacity: .94; transform: translateX(9%) scaleX(.82) scaleY(.025); filter: brightness(2.8) drop-shadow(0 0 16px #55e4fb); }
    100% { opacity: 0; transform: translateX(118vw) scaleX(.08) scaleY(.01); filter: brightness(3.2) drop-shadow(0 0 20px #836cf4); }
}

/* Утверждённая полупрозрачная пишущая рука — без круга и подложки. */
#patientsView .anamnesis-writing-hand {
    position: relative;
    flex: 0 0 124px;
    width: 124px;
    height: 82px;
    overflow: visible;
}

#patientsView .anamnesis-writing-source { display: none; }

#patientsView .anamnesis-writing-canvas {
    position: relative;
    z-index: 1;
    display: block;
    width: 124px;
    height: 82px;
    background: transparent;
    opacity: .94;
    transform-origin: 76% 84%;
    filter: saturate(1.08) contrast(1.04) drop-shadow(0 0 8px rgba(78, 231, 255, .2));
    animation: naturalHandWriting 1.65s cubic-bezier(.45, .04, .55, .96) infinite;
}

#patientsView .anamnesis-writing-trace {
    position: absolute;
    z-index: 2;
    top: 69px;
    left: 96px;
    width: 25px;
    height: 1.5px;
    border-radius: 2px;
    background: linear-gradient(90deg, #5ce7fb, rgba(92, 231, 251, 0));
    box-shadow: 0 0 6px rgba(78, 231, 255, .78);
    transform: rotate(1deg) scaleX(0);
    transform-origin: left center;
    animation: naturalWritingTrace 1.65s ease-in-out infinite;
}

@keyframes naturalHandWriting {
    0%, 100% { transform: translate(-2px, 1px) rotate(-.65deg); }
    18% { transform: translate(-.5px, 0) rotate(-.18deg); }
    42% { transform: translate(2px, .5px) rotate(.42deg); }
    64% { transform: translate(4px, -.25px) rotate(.1deg); }
    80% { transform: translate(1px, .5px) rotate(-.35deg); }
}

@keyframes naturalWritingTrace {
    0% { opacity: 0; transform: rotate(1deg) scaleX(0); }
    14% { opacity: .35; }
    66% { opacity: 1; transform: rotate(1deg) scaleX(.82); }
    82% { opacity: .95; transform: rotate(1deg) scaleX(1); }
    100% { opacity: 0; transform: translateX(9px) rotate(1deg) scaleX(0); }
}

/* Этапы: завершённый — зелёная галочка, будущий — недоступен и размыт. */
#patientsView .wizard-step.completed .wizard-step-index {
    border-color: rgba(57, 221, 170, .54);
    color: transparent;
    background: rgba(32, 181, 137, .095);
    box-shadow: inset 0 0 12px rgba(54, 221, 171, .07), 0 0 15px rgba(54, 221, 171, .12);
    font-size: 0;
}

#patientsView .wizard-step.completed .wizard-step-index::after {
    content: "✓";
    color: #55e2b7;
    font-family: 'Inter', sans-serif;
    font-size: 22px;
    font-weight: 600;
    text-shadow: 0 0 8px rgba(85, 226, 183, .7);
}

#patientsView .wizard-step.locked {
    pointer-events: none;
    opacity: .38;
    filter: blur(.65px) saturate(.45);
    transform: none;
}

#patientsView .wizard-step.locked .wizard-step-node {
    background: transparent;
    box-shadow: 0 0 0 4px rgba(6, 17, 38, .88), 0 0 9px rgba(98, 137, 157, .12);
}

/* Резюме — свободное текстовое поле без панели. Клик включает редактирование. */
#patientsView #wizardStep2 > .recipe-form-section {
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    padding: 28px 8px 24px;
    transform: none !important;
}

#patientsView #wizardStep2 > .recipe-form-section::before { display: none; }

#patientsView #wizardStep2 .recipe-section-title {
    color: #7cecff;
    font-size: 18px;
    letter-spacing: .12em;
    text-shadow: 0 0 9px rgba(78, 223, 249, .48), 0 0 23px rgba(78, 223, 249, .18);
}

#patientsView .anamnesis-summary-preview {
    position: relative;
    display: grid;
    align-content: start;
    gap: 12px;
    min-height: 310px;
    padding: 25px 20px 34px;
    border: 0;
    outline: 0;
    background: transparent;
    cursor: text;
}

#patientsView .anamnesis-summary-preview::after {
    content: "Нажмите на текст, чтобы редактировать";
    position: absolute;
    right: 20px;
    bottom: 8px;
    color: rgba(129, 198, 214, .38);
    font-family: 'Monitorica', sans-serif;
    font-size: 11px;
    letter-spacing: .04em;
}

#patientsView .anamnesis-summary-line {
    display: block;
    margin: 0;
    color: rgba(218, 249, 253, .9);
    font-family: 'Monitorica', sans-serif;
    font-size: 19px;
    line-height: 1.65;
    white-space: pre-wrap;
    text-shadow: 0 0 8px rgba(80, 221, 245, .12);
}

#patientsView .anamnesis-summary-line::before {
    content: none;
    display: none;
}

#patientsView .anamnesis-summary-line.is-heading {
    margin-top: 10px;
    color: #8beeff;
    font-size: 20px;
    font-weight: 600;
    letter-spacing: .025em;
    text-shadow: 0 0 9px rgba(76, 225, 250, .32);
}

#patientsView .anamnesis-summary-line.is-revealing {
    animation: summaryLineReveal .58s cubic-bezier(.22, 1, .36, 1) calc(var(--summary-line) * 95ms) both;
}

@keyframes summaryLineReveal {
    from { opacity: 0; transform: translateX(-18px); filter: blur(5px); }
    to { opacity: 1; transform: none; filter: none; }
}

#patientsView .anamnesis-summary-placeholder {
    color: rgba(151, 195, 210, .45);
    font-family: 'Monitorica', sans-serif;
    font-size: 17px;
}

#patientsView #anamnesisSummaryText {
    display: none;
    min-height: 310px;
    padding: 24px 20px;
    border: 0 !important;
    border-bottom: 1px solid rgba(69, 222, 248, .38) !important;
    border-radius: 0 !important;
    background: transparent !important;
    color: rgba(226, 250, 253, .94);
    font-size: 19px;
    line-height: 1.58;
    box-shadow: 0 10px 25px -24px rgba(64, 221, 247, .8) !important;
}

#patientsView #wizardStep2 .is-summary-editing .anamnesis-summary-preview { display: none; }
#patientsView #wizardStep2 .is-summary-editing #anamnesisSummaryText { display: block; }

#patientsView #wizardStep2 .patients-summary-actions {
    border: 0;
    padding-top: 10px;
}

#patientsView #btnRegenerateSummary {
    border-radius: 999px;
    background: transparent;
}

/* Единый ручной ввод + скроллинг для SPH/CYL/ADD и уже существующего AXIS. */
#patientsView .clinical-picker-input-row,
#patientsView .axis-input-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 44px;
    align-items: end;
    gap: 10px;
}

#patientsView .vis-input-row .recipe-form-input,
.clinical-step-modal .vis-input-row input {
    min-width: 0;
    cursor: text;
}

#patientsView .vis-manual-input.is-invalid,
.clinical-step-modal .vis-manual-input.is-invalid {
    border-color: rgba(255, 103, 133, .82) !important;
    box-shadow: inset 0 -1px rgba(255, 103, 133, .8), 0 8px 20px -18px rgba(255, 70, 110, .85) !important;
}

/* HUD ИИ расположен поверх patientsView, поэтому VIS-контролю нужен тот же
   ручной ввод + неоновая прокрутка без привязки к родительской вкладке. */
.clinical-step-modal .clinical-picker-input-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 42px;
    align-items: center;
    gap: 9px;
}

.clinical-step-modal .clinical-picker-scroll-btn {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    min-width: 40px;
    padding: 0;
    border: 1px solid rgba(71, 224, 249, .42);
    border-radius: 14px;
    background: transparent;
    color: rgba(104, 232, 252, .9);
    box-shadow: inset 0 0 12px rgba(53, 211, 239, .04), 0 0 12px rgba(53, 211, 239, .07);
    cursor: pointer;
    transition: color .2s ease, border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

.clinical-step-modal .clinical-picker-scroll-btn svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.65;
    stroke-linecap: round;
    stroke-linejoin: round;
    filter: drop-shadow(0 0 5px currentColor);
}

.clinical-step-modal .clinical-picker-scroll-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    border-color: rgba(91, 234, 255, .8);
    color: #a9f5ff;
    box-shadow: inset 0 0 15px rgba(54, 218, 247, .07), 0 0 18px rgba(54, 218, 247, .17);
}

#patientsView .clinical-picker-scroll-btn,
#patientsView .axis-picker-btn.clinical-picker-scroll-btn {
    display: grid;
    place-items: center;
    align-self: center;
    width: 42px;
    height: 42px;
    min-width: 42px;
    padding: 0;
    border: 1px solid rgba(71, 224, 249, .38);
    border-radius: 14px;
    background: transparent !important;
    color: rgba(104, 232, 252, .86);
    box-shadow: inset 0 0 12px rgba(53, 211, 239, .035), 0 0 12px rgba(53, 211, 239, .055);
    cursor: pointer;
    transition: color .2s ease, border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

#patientsView .recipe-eye-group-os .clinical-picker-scroll-btn,
#patientsView .recipe-eye-group-os .axis-picker-btn.clinical-picker-scroll-btn {
    border-color: rgba(155, 128, 255, .4);
    color: rgba(184, 164, 255, .9);
}

#patientsView .clinical-picker-scroll-btn svg {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.65;
    stroke-linecap: round;
    stroke-linejoin: round;
    filter: drop-shadow(0 0 5px currentColor);
}

#patientsView .clinical-picker-scroll-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    border-color: rgba(91, 234, 255, .8);
    color: #a9f5ff;
    box-shadow: inset 0 0 15px rgba(54, 218, 247, .07), 0 0 18px rgba(54, 218, 247, .17);
}

#patientsView .clinical-picker-input-row:has(input:disabled) .clinical-picker-scroll-btn,
#patientsView .clinical-picker-scroll-btn:disabled {
    pointer-events: none;
    opacity: .28;
}

/* Симметричный SVG-глаз заменяет прежний повёрнутый скруглённый квадрат. */
#patientsView .recipe-eye-group-label::before { display: none !important; }

#patientsView .recipe-eye-group-label {
    gap: 12px;
    padding-left: 9px;
}

#patientsView .neon-eye-symbol {
    display: inline-grid;
    place-items: center;
    width: 32px;
    height: 23px;
    color: inherit;
    animation: symmetricEyeGlow 2.8s ease-in-out infinite;
}

#patientsView .recipe-eye-group-os .neon-eye-symbol { animation-delay: .6s; }

#patientsView .neon-eye-symbol svg {
    width: 32px;
    height: 22px;
    overflow: visible;
    fill: rgba(53, 219, 247, .08);
    stroke: currentColor;
    stroke-width: 1.45;
    vector-effect: non-scaling-stroke;
    filter: drop-shadow(0 0 5px currentColor);
}

#patientsView .neon-eye-symbol circle {
    fill: currentColor;
    stroke: none;
    transform-box: fill-box;
    transform-origin: center;
    animation: symmetricEyePupil 4.8s ease-in-out infinite;
}

@keyframes symmetricEyeGlow {
    0%, 100% { opacity: .7; filter: brightness(.88); }
    50% { opacity: 1; filter: brightness(1.25); }
}

@keyframes symmetricEyePupil {
    0%, 38%, 62%, 100% { transform: translateX(0); }
    46% { transform: translateX(1.8px); }
    54% { transform: translateX(-1.8px); }
}

@media (max-width: 760px) {
    #patientsView #patientsWizardState[data-wizard-step="1"] .anamnesis-history-button {
        min-width: 158px;
        height: 44px;
        padding-right: 14px;
    }
    #patientsView .anamnesis-history-button-icon { flex-basis: 32px; width: 32px; height: 32px; }
    #patientsView .anamnesis-history-button-label { font-size: 12px; }
    #patientsView #patientsWizardState[data-wizard-step="1"] .patient-dialog-body .anamnesis-chat-dock { right: 18px; bottom: 18px; left: 18px; }
    #patientsView #patientsWizardState[data-wizard-step="1"] .patient-dialog-body .anamnesis-writing-indicator { right: 20px; bottom: 88px; left: 20px; }
    #patientsView .anamnesis-writing-hand { flex-basis: 104px; width: 104px; height: 70px; }
    #patientsView .anamnesis-writing-canvas { width: 104px; height: 70px; }
    #patientsView .anamnesis-writing-trace { top: 59px; left: 81px; width: 21px; }
    #patientsView .anamnesis-summary-preview { padding-right: 7px; padding-left: 7px; }
    #patientsView .anamnesis-summary-line { font-size: 16px; }
    #patientsView .clinical-picker-input-row,
    #patientsView .axis-input-row { grid-template-columns: minmax(0, 1fr) 42px; gap: 7px; }
}

@media (prefers-reduced-motion: reduce) {
    #patientsView .anamnesis-message-row.anamnesis-beam-out,
    #patientsView .anamnesis-chat-dock .is-placeholder-refreshing::placeholder,
    #patientsView .anamnesis-summary-line,
    #patientsView .anamnesis-writing-canvas,
    #patientsView .anamnesis-writing-trace,
    #patientsView .neon-eye-symbol,
    #patientsView .neon-eye-symbol circle { animation: none !important; }
}

/* ========================================================================
   PATIENT COMMAND CONTROLS V15
   Спокойные безрамочные команды: без светодиодов, орбит и неонового свечения.
   ======================================================================== */

#patientsView .patient-power-command,
#patientsView .patient-action-command {
    min-height: 48px;
    padding: 7px 16px 7px 9px;
    overflow: visible;
    border: 0 !important;
    border-radius: 16px !important;
    background: rgba(126, 174, 198, .075) !important;
    box-shadow: none !important;
    animation: none;
    transition: transform .18s ease, color .18s ease, background-color .18s ease, opacity .18s ease;
}

#patientsView .patient-power-command::before,
#patientsView .patient-power-command::after,
#patientsView .patient-command-orb::before,
#patientsView .patient-command-orb::after {
    content: none !important;
    display: none !important;
}

#patientsView .patient-power-command:hover,
#patientsView .patient-action-command:hover {
    transform: translateY(-1px);
    border: 0 !important;
    background: rgba(126, 206, 224, .12) !important;
    color: rgba(218, 246, 251, .96);
    box-shadow: none !important;
}

#patientsView .patient-power-command:active,
#patientsView .patient-action-command:active,
#patientsView .patient-power-command.is-powering {
    transform: scale(.985);
    filter: none;
    animation: none !important;
}

#patientsView .patient-power-command:focus-visible,
#patientsView .patient-action-command:focus-visible {
    outline: 2px solid rgba(97, 218, 239, .64);
    outline-offset: 2px;
}

#patientsView .patient-command-orb,
#patientsView .patient-power-command-muted .patient-command-orb,
#patientsView .patient-power-command-danger .patient-command-orb,
#patientsView .patient-power-command:hover .patient-command-orb,
#patientsView .patient-power-command-danger:hover .patient-command-orb {
    flex-basis: 34px;
    width: 34px;
    height: 34px;
    border: 0 !important;
    background: rgba(100, 190, 211, .085) !important;
    box-shadow: none !important;
    animation: none !important;
}

#patientsView .patient-power-command-muted {
    background: rgba(132, 137, 171, .065) !important;
}

#patientsView .patient-power-command-muted:hover {
    background: rgba(142, 151, 190, .105) !important;
}

#patientsView .patient-power-command-danger,
#patientsView .patient-power-command-danger:hover {
    border: 0 !important;
    color: rgba(255, 151, 174, .9) !important;
    box-shadow: none !important;
}

#patientsView .patient-power-command-danger {
    background: rgba(218, 69, 105, .07) !important;
}

#patientsView .patient-power-command-danger:hover {
    background: rgba(218, 69, 105, .12) !important;
    color: rgba(255, 188, 202, .98) !important;
}

#patientsView .patient-power-command-danger .patient-command-orb,
#patientsView .patient-power-command-danger:hover .patient-command-orb {
    color: rgba(255, 152, 175, .94);
    background: rgba(218, 69, 105, .085) !important;
}

#patientsView .patient-power-command:disabled,
#patientsView .patient-action-command:disabled {
    opacity: .42;
    transform: none;
    background: rgba(126, 174, 198, .04) !important;
}

@media (max-width: 760px) {
    #patientsView .patient-power-command,
    #patientsView .patient-action-command {
        min-height: 46px;
        padding: 6px 13px 6px 7px;
        border-radius: 15px !important;
    }
}

/* V18 cascade — правила намеренно стоят последними после всех прежних тем. */
#patientsView #patientsWizardState[data-wizard-step="1"] .anamnesis-history-button {
    border: 0 !important;
    border-radius: 16px !important;
    background: radial-gradient(circle at 18% 50%, rgba(67, 225, 250, .15), rgba(71, 114, 169, .075) 42%, rgba(99, 75, 190, .055)) !important;
    box-shadow: 0 10px 28px rgba(5, 14, 36, .2), 0 0 24px rgba(61, 218, 246, .08) !important;
    transition: transform .26s cubic-bezier(.22, 1, .36, 1), background .26s ease, box-shadow .26s ease;
}
#patientsView #patientsWizardState[data-wizard-step="1"] .anamnesis-history-button:hover,
#patientsView #patientsWizardState[data-wizard-step="1"] .anamnesis-history-button.is-expanded {
    transform: translateY(-1px) scale(1.015);
    background: radial-gradient(circle at 20% 50%, rgba(71, 230, 252, .21), rgba(70, 135, 181, .105) 46%, rgba(104, 77, 204, .08)) !important;
    box-shadow: 0 12px 32px rgba(5, 14, 36, .24), 0 0 28px rgba(61, 218, 246, .15) !important;
}
#patientsView .anamnesis-history-button-icon {
    border: 0 !important;
    background: rgba(83, 208, 232, .075) !important;
    box-shadow: none !important;
    transition: transform .38s cubic-bezier(.22, 1, .36, 1), color .25s ease;
}
#patientsView .anamnesis-history-button.is-expanded .anamnesis-history-button-icon { transform: rotate(-22deg) scale(1.08); color: #a5f5ff; }
#patientsView .anamnesis-history-drawer {
    border-left: 0;
    border-radius: 22px 0 0 22px;
    background: linear-gradient(145deg, rgba(7, 27, 50, .965), rgba(7, 15, 38, .95));
    box-shadow: -24px 0 64px rgba(0, 4, 16, .38), 0 0 34px rgba(54, 215, 241, .07);
    transform-origin: 100% 0;
    animation: anamnesisHistoryUnfold .42s cubic-bezier(.16, 1, .3, 1) both;
}
#patientsView .anamnesis-history-overlay.is-closing .anamnesis-history-drawer { animation: anamnesisHistoryFold .3s cubic-bezier(.55, 0, 1, .45) both; }
#patientsView .anamnesis-history-overlay.is-closing .anamnesis-history-backdrop { animation: anamnesisHistoryFadeOut .28s ease both; }

#patientsView #patientsWizardState[data-wizard-step="1"] .patient-dialog-body .anamnesis-chat-dock {
    isolation: isolate;
    border-color: transparent !important;
    box-shadow: inset 0 0 0 1px rgba(64, 209, 236, .2), 0 0 24px rgba(38, 207, 238, .07);
}
#patientsView #patientsWizardState[data-wizard-step="1"] .patient-dialog-body .anamnesis-chat-dock::before {
    content: "";
    position: absolute;
    z-index: 0;
    inset: 0;
    display: block;
    padding: 1.5px;
    border-radius: inherit;
    background: conic-gradient(from var(--anamnesis-composer-angle), transparent 0 72%, rgba(85, 229, 251, .18) 80%, #62e7fb 88%, rgba(142, 107, 248, .86) 94%, transparent 100%);
    opacity: 0;
    pointer-events: none;
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    transition: opacity .22s ease;
}
#patientsView #patientsWizardState[data-wizard-step="1"] .patient-dialog-body .anamnesis-chat-dock:hover::before,
#patientsView #patientsWizardState[data-wizard-step="1"] .patient-dialog-body .anamnesis-chat-dock:focus-within::before { opacity: 1; animation: anamnesisComposerPerimeter 1.75s linear infinite; }
#patientsView #patientsWizardState[data-wizard-step="1"] .patient-dialog-body .anamnesis-chat-dock > * { position: relative; z-index: 1; }

#patientsView .anamnesis-rationale-content {
    display: block !important;
    max-height: 0;
    margin-top: 0;
    padding-top: 0;
    padding-bottom: 0;
    overflow: hidden;
    border-left-color: transparent;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px) scaleY(.94);
    transform-origin: top left;
    transition: max-height .42s cubic-bezier(.22, 1, .36, 1), margin-top .3s ease, padding .3s ease, opacity .24s ease, transform .36s cubic-bezier(.22, 1, .36, 1), border-color .3s ease, visibility 0s linear .42s;
}
#patientsView .anamnesis-rationale-content.is-open {
    max-height: 340px;
    margin-top: 9px;
    padding-top: 4px;
    padding-bottom: 4px;
    border-left-color: rgba(64, 220, 248, .35);
    opacity: 1;
    visibility: visible;
    transform: none;
    transition-delay: 0s;
}

#patientsView .lens-type-checkbox .checkbox-value {
    border: 0 !important;
    border-radius: 14px !important;
    background: rgba(126, 174, 198, .075) !important;
    box-shadow: none !important;
    transition: transform .18s ease, color .18s ease, background-color .18s ease, opacity .18s ease;
}
#patientsView .lens-type-checkbox:hover .checkbox-value { border: 0 !important; background: rgba(126, 206, 224, .12) !important; box-shadow: none !important; transform: translateY(-1px); }
#patientsView .lens-type-checkbox input[type="checkbox"]:checked ~ .checkbox-value,
#patientsView .lens-type-checkbox input[type="radio"]:checked ~ .checkbox-value {
    border: 0 !important;
    background: linear-gradient(135deg, rgba(45, 209, 235, .17), rgba(120, 84, 232, .12)) !important;
    color: #78eafa;
    box-shadow: none !important;
}
#patientsView .lens-type-checkbox input:focus-visible ~ .checkbox-value { outline: 2px solid rgba(97, 218, 239, .58); outline-offset: 2px; }
#patientsView .axis-input-row .axis-picker-btn.clinical-picker-scroll-btn { width: 42px; height: 42px; min-width: 42px; border-radius: 14px; }

/* ===== HUD субъективных тестов и компактная стратегия ИИ ===== */
#patientsView .subjective-tests-grid {
    grid-template-columns: repeat(3, minmax(220px, 1fr));
    gap: 14px;
}
#patientsView .subjective-test-card {
    position: relative;
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr) 28px;
    align-items: center;
    gap: 14px;
    min-height: 112px;
    padding: 18px;
    border: 0;
    border-radius: 22px;
    overflow: hidden;
    background:
        radial-gradient(circle at 10% 50%, rgba(36, 210, 236, .11), transparent 32%),
        linear-gradient(120deg, rgba(111, 164, 191, .085), rgba(78, 68, 151, .075));
    box-shadow: inset 0 1px rgba(255, 255, 255, .045), 0 14px 34px rgba(1, 8, 22, .15);
    transition: transform .34s cubic-bezier(.22, 1, .36, 1), background-color .25s ease, box-shadow .3s ease;
}
#patientsView .subjective-test-card::before {
    content: "";
    position: absolute;
    left: 18px;
    right: 18px;
    bottom: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(65, 222, 246, .75), rgba(127, 89, 240, .45), transparent);
    transform: scaleX(.24);
    opacity: .45;
    transition: transform .42s cubic-bezier(.22, 1, .36, 1), opacity .3s ease;
}
#patientsView .subjective-test-card::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(104deg, transparent 26%, rgba(117, 229, 247, .08) 48%, transparent 66%);
    transform: translateX(-115%);
}
#patientsView .subjective-test-card:hover,
#patientsView .subjective-test-card:focus-visible {
    border: 0;
    transform: translateY(-3px);
    background-color: rgba(35, 113, 151, .08);
    box-shadow: inset 0 1px rgba(255,255,255,.06), 0 18px 44px rgba(0, 8, 24, .28), 0 0 32px rgba(41, 206, 234, .08);
    outline: none;
}
#patientsView .subjective-test-card:hover::before,
#patientsView .subjective-test-card:focus-visible::before { transform: scaleX(1); opacity: 1; }
#patientsView .subjective-test-card:hover::after { animation: subjectiveCardSweep .9s cubic-bezier(.22, 1, .36, 1); }
@keyframes subjectiveCardSweep { to { transform: translateX(115%); } }

.subjective-test-card-icon,
.subj-test-modal-icon {
    display: grid;
    place-items: center;
    width: 58px;
    height: 58px;
    border-radius: 18px;
    background: rgba(6, 24, 43, .3);
    box-shadow: inset 0 0 22px rgba(45, 202, 232, .07);
}
.subjective-test-card-icon svg,
.subj-test-modal-icon svg { width: 42px; height: 42px; overflow: visible; }
.subjective-test-card-icon.is-duochrome svg > circle:last-child,
.subj-test-modal-icon.is-duochrome svg > circle:last-child { fill: none; stroke: rgba(116, 224, 244, .7); stroke-width: 1.5; }
.duo-red { fill: rgba(255, 77, 91, .88); filter: drop-shadow(0 0 6px rgba(255, 54, 83, .5)); }
.duo-green { fill: rgba(42, 224, 137, .85); filter: drop-shadow(0 0 6px rgba(42, 224, 137, .45)); }
.worth-red { fill: #ff566a; filter: drop-shadow(0 0 5px rgba(255, 73, 97, .75)); }
.worth-green { fill: #35e28a; filter: drop-shadow(0 0 5px rgba(53, 226, 138, .7)); }
.worth-mix { fill: #e7a6c2; filter: drop-shadow(0 0 5px rgba(231, 166, 194, .6)); }
.schober-ring { fill: none !important; stroke: #31dc7f !important; stroke-width: 3 !important; filter: drop-shadow(0 0 5px rgba(49, 220, 127, .65)); }
.schober-cross { fill: none; stroke: #ff5069; stroke-width: 4; stroke-linecap: round; filter: drop-shadow(0 0 5px rgba(255, 80, 105, .7)); }

#patientsView .subjective-test-card-copy { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
#patientsView .subjective-test-card-title { font-size: 17px; letter-spacing: .35px; color: rgba(229, 248, 255, .96); }
#patientsView .subjective-test-card-hint { font-size: 13px; line-height: 1.35; color: rgba(199, 224, 237, .58); }
#patientsView .subjective-test-card-result { margin-top: 3px; font-size: 13px; line-height: 1.35; color: rgba(174, 203, 219, .55); }
#patientsView .subjective-test-card-enter { font-size: 34px; font-weight: 300; color: rgba(74, 219, 244, .58); transform: translateX(0); transition: transform .3s cubic-bezier(.22,1,.36,1), color .25s ease; }
#patientsView .subjective-test-card:hover .subjective-test-card-enter { transform: translateX(5px); color: #83edff; }
#patientsView .subjective-test-card.is-done { border: 0; background: radial-gradient(circle at 12% 50%, rgba(46, 220, 162, .13), transparent 35%), linear-gradient(120deg, rgba(64, 165, 157, .09), rgba(80, 68, 151, .06)); }
#patientsView .subjective-test-card.is-done .subjective-test-card-result { color: #6ee9c1; }
#patientsView .subjective-test-card.is-done .subjective-test-card-result::before { content: "✓ "; color: #4de4ae; }

.subj-test-overlay { opacity: 0; transition: opacity .2s ease; }
.subj-test-overlay.is-visible { opacity: 1; }
.subj-test-overlay.is-closing { opacity: 0; }
.subj-test-backdrop { background: rgba(0, 7, 19, .78); backdrop-filter: blur(10px); }
.subj-test-modal {
    max-width: 720px;
    padding: 22px 24px 24px;
    border: 0;
    border-radius: 28px;
    overflow-x: hidden;
    background:
        radial-gradient(circle at 8% 0%, rgba(32, 198, 225, .14), transparent 34%),
        radial-gradient(circle at 92% 0%, rgba(117, 79, 232, .12), transparent 38%),
        linear-gradient(165deg, rgba(10, 27, 48, .985), rgba(7, 16, 36, .99));
    box-shadow: 0 34px 90px rgba(0,0,0,.52), inset 0 1px rgba(255,255,255,.055), 0 0 54px rgba(39, 201, 232, .08);
    animation: none;
    opacity: 0;
    transform: translateY(18px) scale(.965);
    clip-path: inset(10% 10% 10% 10% round 28px);
    transition: opacity .3s ease, transform .45s cubic-bezier(.22,1,.36,1), clip-path .5s cubic-bezier(.22,1,.36,1);
}
.subj-test-overlay.is-visible .subj-test-modal { opacity: 1; transform: none; clip-path: inset(0 round 28px); }
.subj-test-overlay.is-closing .subj-test-modal { opacity: 0; transform: translateY(8px) scale(.98); transition-duration: .2s; }
.subj-test-header { align-items: center; margin-bottom: 18px; }
.subj-test-heading-copy { min-width: 0; margin-right: auto; }
.subj-test-title { font-size: 19px; letter-spacing: .8px; text-shadow: 0 0 18px rgba(48, 212, 240, .2); }
.subj-test-subtitle { font-size: 13px; line-height: 1.4; }
.subj-test-info-btn,
.subj-test-close {
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 14px;
    background: rgba(112, 163, 190, .09);
    box-shadow: none;
    transition: transform .2s ease, background-color .2s ease, color .2s ease;
}
.subj-test-info-btn:hover,
.subj-test-close:hover { border: 0; transform: translateY(-2px); background: rgba(60, 205, 231, .14); }
.subj-test-scanline {
    position: absolute;
    z-index: 4;
    left: 24px;
    right: 24px;
    top: 84px;
    height: 1px;
    pointer-events: none;
    opacity: 0;
    background: linear-gradient(90deg, transparent, rgba(78, 224, 247, .55), transparent);
}
.subj-test-overlay.is-visible .subj-test-scanline { animation: subjHudScan 1.25s .2s ease-out 1; }
@keyframes subjHudScan { 0% { opacity: 0; transform: translateY(0); } 20% { opacity: .8; } 100% { opacity: 0; transform: translateY(430px); } }

.subj-answer-group { gap: 10px; }
.subj-answer-btn,
.subj-test-cancel-all,
.subj-choice-collapsed {
    border: 0;
    border-radius: 16px;
    background: rgba(112, 163, 190, .085);
    box-shadow: inset 0 1px rgba(255,255,255,.035);
}
.subj-answer-btn { min-height: 44px; padding: 11px 16px; font-size: 13px; }
.subj-answer-btn:hover { border: 0; background: rgba(49, 205, 233, .14); transform: translateY(-2px); }
.subj-choice-collapsed { padding: 12px 14px; background: linear-gradient(135deg, rgba(43, 204, 230, .13), rgba(111, 76, 222, .09)); }
.subj-test-result-line { border: 0; border-radius: 16px; background: rgba(65, 215, 164, .09); }
.subj-test-footer { border-top-color: rgba(117, 215, 235, .1); }
.subj-test-cancel-all { padding: 11px 16px; color: rgba(255, 151, 166, .9); background: rgba(255, 80, 108, .08); }

/* Структурированная рекомендация: на экране только действие; подробность — по «?». */
#wizardStep3 .patients-exam-guidance-result {
    padding: 0;
    border: 0;
    border-radius: 24px;
    background: transparent;
    white-space: normal;
}
.exam-strategy-hud { display: flex; flex-direction: column; gap: 18px; }
.exam-strategy-focus {
    padding: 20px 22px;
    border-radius: 22px;
    background: radial-gradient(circle at 4% 0%, rgba(39, 208, 236, .13), transparent 35%), linear-gradient(120deg, rgba(87, 145, 174, .09), rgba(87, 66, 153, .07));
    box-shadow: inset 0 1px rgba(255,255,255,.04);
}
.exam-strategy-kicker,
.exam-strategy-decision > span,
.exam-strategy-stop > span {
    display: block;
    margin-bottom: 7px;
    color: #58dff5;
    font: 700 12px 'Monitorica', sans-serif;
    letter-spacing: 1.4px;
    text-transform: uppercase;
}
.exam-strategy-focus > p { margin: 0; color: rgba(229,245,251,.92); font-size: 17px; line-height: 1.55; }
.exam-strategy-hypotheses { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.exam-strategy-hypotheses > span { padding: 8px 11px; border-radius: 13px; background: rgba(111, 92, 196, .1); color: rgba(211, 221, 249, .78); font-size: 13px; line-height: 1.35; }
.exam-strategy-sequence { display: flex; flex-direction: column; gap: 10px; }
.exam-strategy-test {
    display: grid;
    grid-template-columns: 54px minmax(0,1fr);
    gap: 14px;
    padding: 16px 18px 16px 12px;
    border-radius: 20px;
    background: linear-gradient(115deg, rgba(91, 148, 177, .075), rgba(68, 55, 125, .055));
    box-shadow: inset 0 1px rgba(255,255,255,.035);
    transition: background-color .25s ease, transform .3s cubic-bezier(.22,1,.36,1);
}
.exam-strategy-test:hover { transform: translateX(3px); background-color: rgba(29, 147, 174, .035); }
.exam-strategy-test.is-first { background: radial-gradient(circle at 0 50%, rgba(32, 213, 232, .14), transparent 28%), linear-gradient(115deg, rgba(80, 164, 184, .1), rgba(68, 55, 125, .06)); }
.exam-strategy-rail { display: flex; flex-direction: column; align-items: center; gap: 7px; }
.exam-strategy-rail span { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 14px; color: #72eafa; background: rgba(33, 190, 219, .105); font: 700 13px 'Monitorica', sans-serif; }
.exam-strategy-rail i { width: 1px; min-height: 30px; flex: 1; background: linear-gradient(rgba(60,219,241,.5), transparent); }
.exam-strategy-test-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.exam-strategy-priority { display: block; margin-bottom: 4px; color: rgba(103, 224, 244, .72); font: 700 11px 'Monitorica', sans-serif; letter-spacing: 1.1px; text-transform: uppercase; }
.exam-strategy-test h4 { margin: 0; color: rgba(235,248,252,.96); font-size: 18px; line-height: 1.3; }
.exam-strategy-action { margin: 8px 0 0; color: rgba(205,227,237,.79); font-size: 15px; line-height: 1.55; }
.exam-strategy-why { flex: 0 0 auto; display: grid; place-items: center; width: 42px; height: 42px; border: 0; border-radius: 14px; background: rgba(46, 195, 222, .1); color: #64e5fa; cursor: pointer; transition: transform .3s cubic-bezier(.22,1,.36,1), background-color .2s ease; }
.exam-strategy-why span { font: 700 18px 'Monitorica', sans-serif; }
.exam-strategy-why:hover { transform: translateY(-2px) rotate(5deg); background: rgba(46, 195, 222, .17); }
.exam-strategy-why[aria-expanded="true"] { transform: rotate(45deg); background: rgba(113, 82, 211, .16); color: #bc9cff; }
.exam-strategy-details-shell { display: grid; grid-template-rows: 0fr; opacity: 0; transition: grid-template-rows .48s cubic-bezier(.22,1,.36,1), opacity .28s ease, margin-top .4s ease; }
.exam-strategy-test.is-expanded .exam-strategy-details-shell { grid-template-rows: 1fr; opacity: 1; margin-top: 14px; }
.exam-strategy-details { min-height: 0; overflow: hidden; }
.exam-strategy-details dl { display: grid; gap: 10px; margin: 0; padding: 14px 16px; border-radius: 17px; background: rgba(4, 17, 35, .28); }
.exam-strategy-details dl > div { display: grid; grid-template-columns: minmax(150px, .34fr) 1fr; gap: 14px; }
.exam-strategy-details dt { color: rgba(83, 220, 242, .72); font: 700 12px 'Monitorica', sans-serif; letter-spacing: .5px; }
.exam-strategy-details dd { margin: 0; color: rgba(210,231,240,.78); font-size: 14px; line-height: 1.5; }
.exam-strategy-sources { display: flex; flex-wrap: wrap; align-items: stretch; gap: 8px; margin-top: 10px; }
.exam-strategy-sources > span:first-child { align-self: center; color: rgba(145,183,200,.55); font: 700 11px 'Monitorica', sans-serif; text-transform: uppercase; letter-spacing: .7px; }
.exam-strategy-source { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border-radius: 12px; background: rgba(85, 113, 155, .085); color: rgba(158, 218, 235, .82); font-size: 12px; text-decoration: none; }
.exam-strategy-source small { color: rgba(162,184,196,.52); font-size: 10px; }
a.exam-strategy-source:hover { background: rgba(42, 185, 213, .13); color: #8aebfa; }
.exam-strategy-decision,
.exam-strategy-stop { padding: 17px 20px; border-radius: 19px; background: rgba(85, 133, 162, .07); }
.exam-strategy-decision p,
.exam-strategy-stop p { margin: 0; color: rgba(211,232,240,.8); font-size: 14px; line-height: 1.5; }
.exam-strategy-stop p + p { margin-top: 7px; }
.exam-strategy-stop p::before { content: "— "; color: #f29aab; }
.exam-strategy-disclaimer { margin: 0; color: rgba(153,181,194,.45); font-size: 12px; line-height: 1.45; }

@media (max-width: 900px) {
    #patientsView .subjective-tests-grid { grid-template-columns: 1fr; }
    .exam-strategy-details dl > div { grid-template-columns: 1fr; gap: 5px; }
}
@media (max-width: 620px) {
    .subj-test-modal { padding: 18px; border-radius: 22px; }
    .subj-test-modal-icon { width: 46px; height: 46px; border-radius: 15px; }
    .subj-test-modal-icon svg { width: 34px; height: 34px; }
    .subj-test-title { font-size: 16px; }
    .exam-strategy-test { grid-template-columns: 44px minmax(0,1fr); padding: 14px 12px 14px 8px; gap: 10px; }
    .exam-strategy-rail span { width: 36px; height: 36px; border-radius: 12px; }
    .exam-strategy-test h4 { font-size: 16px; }
    .exam-strategy-action { font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) {
    .subjective-test-card::after,
    .subj-test-scanline { animation: none !important; }
    .subj-test-overlay,
    .subj-test-modal,
    .exam-strategy-details-shell { transition-duration: .01ms !important; }
}

/* ========================================================================
   PATIENTS / CLINICAL POLISH V20
   Крупнее картотека, прямой переход к резюме и стабильная тёмная тема
   полей после выбора значения из колёсного пикера.
   ======================================================================== */

#patientsView .patient-row {
    min-height: 102px;
    padding-top: 16px;
    padding-bottom: 16px;
}

#patientsView .patient-row-name strong {
    font-size: 28px;
    line-height: 1.08;
}

#patientsView .patient-row-name span {
    font-size: 17px;
    line-height: 1.35;
}

#patientsView .patient-row-meta {
    font-size: 15px;
    line-height: 1.45;
}

#patientsView .patient-row-open {
    font-size: 11px;
    letter-spacing: .075em;
}

#patientsView .anamnesis-summary-button {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    min-height: 48px;
    padding: 7px 14px 7px 8px;
    border: 0;
    border-radius: 16px;
    color: rgba(190, 239, 247, .82);
    background: linear-gradient(135deg, rgba(47, 195, 222, .105), rgba(92, 76, 190, .085));
    font: 600 13px 'Monitorica', sans-serif;
    letter-spacing: .35px;
    cursor: pointer;
    box-shadow: 0 10px 28px rgba(5, 14, 36, .16), 0 0 20px rgba(61, 218, 246, .055);
    transition: transform .25s cubic-bezier(.22, 1, .36, 1), color .22s ease, background .22s ease, box-shadow .22s ease, opacity .22s ease;
}

#patientsView .anamnesis-summary-button:hover {
    transform: translateY(-1px) scale(1.015);
    color: #dffcff;
    background: linear-gradient(135deg, rgba(51, 211, 237, .16), rgba(108, 84, 218, .12));
    box-shadow: 0 12px 30px rgba(5, 14, 36, .2), 0 0 26px rgba(61, 218, 246, .12);
}

#patientsView .anamnesis-summary-button:active { transform: scale(.965); }
#patientsView .anamnesis-summary-button:disabled { opacity: .35; cursor: default; transform: none; }

#patientsView .anamnesis-summary-button-icon {
    display: grid;
    place-items: center;
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    border-radius: 12px;
    color: #70e8f8;
    background: rgba(67, 211, 234, .085);
}

#patientsView .anamnesis-summary-button-icon svg {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* WebKit может вернуть белую системную заливку выбранному input. Фиксируем
   клинические поля в тёмной теме и после picker-commit, и при autofill. */
#patientsView input.recipe-form-input {
    -webkit-appearance: none;
    appearance: none;
    color-scheme: dark;
    caret-color: #8cf0ff;
}

#patientsView input.recipe-form-input.is-picker-value {
    background-color: transparent !important;
    background-image: linear-gradient(180deg, transparent 8%, rgba(27, 132, 160, .035) 100%) !important;
    color: rgba(229, 249, 253, .96) !important;
    -webkit-text-fill-color: rgba(229, 249, 253, .96) !important;
}

#patientsView .recipe-eye-group-os input.recipe-form-input.is-picker-value {
    background-image: linear-gradient(180deg, transparent 8%, rgba(107, 74, 220, .038) 100%) !important;
}

#patientsView input.recipe-form-input:-webkit-autofill,
#patientsView input.recipe-form-input:-webkit-autofill:hover,
#patientsView input.recipe-form-input:-webkit-autofill:focus,
#patientsView input.recipe-form-input:-webkit-autofill:active {
    border: 0 !important;
    border-bottom: 1px solid rgba(75, 219, 244, .48) !important;
    -webkit-text-fill-color: rgba(229, 249, 253, .96) !important;
    caret-color: #8cf0ff;
    box-shadow: inset 0 0 0 1000px #071a31, inset 0 -1px 0 rgba(75, 219, 244, .35) !important;
    transition: background-color 99999s ease-out 0s;
}

#patientsView .recipe-eye-group-os input.recipe-form-input:-webkit-autofill,
#patientsView .recipe-eye-group-os input.recipe-form-input:-webkit-autofill:hover,
#patientsView .recipe-eye-group-os input.recipe-form-input:-webkit-autofill:focus,
#patientsView .recipe-eye-group-os input.recipe-form-input:-webkit-autofill:active {
    border-bottom-color: rgba(139, 109, 250, .48) !important;
    box-shadow: inset 0 0 0 1000px #0b1734, inset 0 -1px 0 rgba(139, 109, 250, .35) !important;
}

@media (max-width: 1200px) {
    #patientsView .patient-dialog-header-tools { flex-wrap: wrap; justify-content: flex-end; }
    #patientsView .anamnesis-summary-button > span:last-child { display: none; }
    #patientsView .anamnesis-summary-button { width: 48px; padding: 7px; }
}

@media (max-width: 760px) {
    #patientsView #patientsList .patient-row { min-height: 94px; }
    #patientsView .patient-row-name strong { font-size: 23px; }
    #patientsView .patient-row-name span { font-size: 14px; }
    #patientsView #patientsList .patient-row-meta { font-size: 13px; line-height: 1.4; }
    #patientsView .anamnesis-summary-button { min-height: 44px; width: 44px; }
    #patientsView .anamnesis-summary-button-icon { flex-basis: 30px; width: 30px; height: 30px; }
}

@media (max-width: 480px) {
    #patientsView .patient-row-name strong { font-size: 22px; }
    #patientsView .patient-row-name span { font-size: 13px; }
    #patientsView #patientsList .patient-row-meta { font-size: 12px; }
}

/* Фороптер — приборный силуэт только на диагностической палубе. */
#patientsView .diagnostics-deck-header > div:first-child,
#patientsView .diagnostics-deck-header .diagnostics-readiness {
    position: relative;
    z-index: 2;
}

#patientsView .diagnostics-deck-header {
    display: block;
    background: transparent;
}

#patientsView .diagnostics-deck-header::before {
    display: none;
}

#patientsView .diagnostics-deck-header .diagnostics-readiness {
    width: min(520px, 100%);
    margin-top: 24px;
}

#patientsView .diagnostics-deck-header .diagnostics-deck-scan {
    display: none;
}

#patientsView #wizardStep3 > #diagAutorefractionSection {
    border-top: 0 !important;
}

#patientsWizardState[data-wizard-step="3"] .patients-wizard-body {
    max-width: none;
    box-sizing: border-box;
    padding-right: 0;
    padding-left: 0;
}

#patientsView .patients-wrapper:has(#patientsWizardState[data-wizard-step="3"]) {
    box-sizing: border-box;
    padding-right: clamp(18px, 2.2vw, 42px);
    padding-left: clamp(18px, 2.2vw, 42px);
}

@media (max-width: 720px) {
    #patientsWizardState[data-wizard-step="3"] .patients-wizard-body {
        padding-right: 8px;
        padding-left: 8px;
    }
}

#patientsView .diagnostics-phoropter {
    position: absolute;
    z-index: 1;
    top: -218px;
    right: -330px;
    width: clamp(650px, 50vw, 860px);
    aspect-ratio: 850 / 751;
    background: url('/assets/phoropter-neon.webp') center / contain no-repeat;
    opacity: .28;
    mix-blend-mode: screen;
    pointer-events: none;
    transform: scaleX(-1);
    transform-origin: center;
    filter: brightness(.92) contrast(1.16) drop-shadow(0 0 8px rgba(68, 224, 249, .22));
    -webkit-mask-image: linear-gradient(90deg, transparent 0, rgba(0, 0, 0, .72) 18%, #000 44%, #000 100%);
    mask-image: linear-gradient(90deg, transparent 0, rgba(0, 0, 0, .72) 18%, #000 44%, #000 100%);
    animation: diagnosticsPhoropterFlicker 5.6s steps(1, end) infinite;
}

#patientsView .diagnostics-readiness {
    background: rgba(7, 14, 34, .74);
    backdrop-filter: blur(7px);
    -webkit-backdrop-filter: blur(7px);
}

@keyframes diagnosticsPhoropterFlicker {
    0%, 7%, 12%, 31%, 36%, 58%, 63%, 81%, 100% {
        opacity: .28;
        filter: brightness(.88) contrast(1.24) drop-shadow(0 0 6px rgba(68, 224, 249, .3));
    }
    8%, 32%, 59% {
        opacity: .17;
        filter: brightness(.58) contrast(1.13) drop-shadow(0 0 2px rgba(68, 224, 249, .12));
    }
    9%, 34%, 61%, 82% {
        opacity: .36;
        filter: brightness(1.13) contrast(1.3) drop-shadow(0 0 11px rgba(88, 232, 255, .48));
    }
    10%, 35%, 62% {
        opacity: .22;
        filter: brightness(.72) contrast(1.18) drop-shadow(0 0 4px rgba(68, 224, 249, .2));
    }
}

@media (max-width: 900px) {
    #patientsView .diagnostics-phoropter {
        top: -132px;
        right: -205px;
        width: 500px;
        opacity: .2;
    }
}

@media (max-width: 620px) {
    #patientsView .diagnostics-phoropter { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    #patientsView .diagnostics-phoropter { animation: none !important; }
}

/* Мобильная шапка анамнеза: не допускаем наложения переключателя и команд. */
@media (max-width: 480px) {
    .patient-dialog-header-tools {
        flex-wrap: wrap;
        row-gap: 8px;
    }
    .patient-dialog-header .patient-dialog-header-tools .adaptive-anamnesis-modes {
        flex: 1 1 auto;
        width: auto;
        min-width: 150px;
    }
    #patientsView #patientsWizardState[data-wizard-step="1"] .anamnesis-history-button {
        flex: 0 0 40px;
        min-width: 40px !important;
        width: 40px !important;
        height: 40px;
        padding: 0;
        justify-content: center;
    }
    #patientsView .anamnesis-history-button-label {
        display: none !important;
    }
    #patientsView .anamnesis-history-button-icon {
        flex-basis: 22px;
        width: 22px;
        height: 22px;
        border: 0;
    }
}

/* Мобильный протокол приёма: заголовок и команды складываются в колонку. */
@media (max-width: 768px) {
    #patientsView #visitDetailView .patients-overview-visits-header {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        min-width: 0;
    }
    #patientsView #visitDetailView .patients-overview-visits-header .recipe-section-title {
        white-space: normal;
        width: 100%;
    }
    #patientsView #visitDetailView .patients-wizard-header-actions {
        width: 100%;
        max-width: 100%;
        margin-left: 0;
        box-sizing: border-box;
    }
}

/* ========================================================================
   MOBILE STABILITY V22
   Узкие экраны, экранная клавиатура, safe-area и длинные клинические формы.
   Десктопная композиция не затрагивается.
   ======================================================================== */

@media (max-width: 720px) {
    #patientsWizardState[data-wizard-step="1"] .patient-dialog-screen {
        height: calc(100dvh - 72px);
        min-height: 0;
        max-height: calc(100dvh - 72px);
    }

    #patientsView #patientsWizardState[data-wizard-step="1"] .patient-dialog-body .anamnesis-chat-dock {
        bottom: max(12px, env(safe-area-inset-bottom));
    }

    #patientsView #patientsWizardState[data-wizard-step="1"] .patient-dialog-body .anamnesis-writing-indicator {
        bottom: calc(78px + env(safe-area-inset-bottom));
    }

    #patientsWizardState[data-wizard-step="1"] .patient-dialog-body .anamnesis-question-card {
        padding-bottom: calc(82px + env(safe-area-inset-bottom));
    }

    #patientsView .anamnesis-rationale-content.is-open {
        max-height: min(68dvh, 720px);
        padding-right: 8px;
        overflow-y: auto;
        overscroll-behavior: contain;
        scrollbar-gutter: stable;
    }

    #patientsView .anamnesis-history-drawer header {
        padding-top: max(18px, env(safe-area-inset-top));
    }

    #patientsView .anamnesis-history-list {
        padding-bottom: calc(20px + env(safe-area-inset-bottom));
    }

    .clinical-step-overlay {
        align-items: start;
        padding:
            max(10px, env(safe-area-inset-top))
            max(8px, env(safe-area-inset-right))
            max(10px, env(safe-area-inset-bottom))
            max(8px, env(safe-area-inset-left));
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    .clinical-step-modal {
        width: 100%;
        max-height: calc(100dvh - 20px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
        padding: 18px;
        overflow-y: auto;
        box-sizing: border-box;
        overscroll-behavior: contain;
    }

    .clinical-refraction-fields fieldset {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 9px;
    }

    .subj-test-overlay,
    .subj-test-info-overlay {
        padding:
            max(10px, env(safe-area-inset-top))
            max(10px, env(safe-area-inset-right))
            max(10px, env(safe-area-inset-bottom))
            max(10px, env(safe-area-inset-left));
    }

    .subj-test-modal,
    .subj-test-info-popup {
        max-height: calc(100dvh - 20px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
        overscroll-behavior: contain;
    }

    #patientsView #patientsList .patient-row {
        grid-template-rows: auto auto auto;
        min-height: 116px;
    }

    #patientsView #patientsList .patient-row-open {
        display: inline-flex;
        grid-column: 2;
        grid-row: 3;
        align-items: center;
        justify-self: start;
        margin-top: 1px;
        color: rgba(104, 227, 248, .72);
        font-size: 11px;
        line-height: 1.2;
        white-space: nowrap;
    }

    #patientsView #patientsList .patient-row-delete {
        grid-row: 1 / 4;
    }
}

@media (max-width: 720px) and (max-height: 600px) {
    #patientsView .patients-wrapper {
        padding-top: 4px;
        padding-bottom: 4px;
    }

    #patientsWizardState[data-wizard-step="1"] .patient-dialog-screen {
        height: calc(100dvh - 8px);
        max-height: calc(100dvh - 8px);
        grid-template-rows: 0 0 minmax(0, 1fr);
    }

    #patientsWizardState[data-wizard-step="1"] .patient-dialog-header,
    #patientsWizardState[data-wizard-step="1"] .patient-dialog-neon-line {
        display: none;
    }
}

@media (max-width: 599px) {
    .patients-wizard-step-indicator { gap: 4px; }

    .wizard-step {
        min-width: 0;
        min-height: 58px;
        flex-direction: column;
        gap: 4px;
        padding: 6px 2px;
    }

    .wizard-step-index {
        width: 26px;
        height: 26px;
    }

    .wizard-step-copy { width: 100%; min-width: 0; }

    .wizard-step-copy strong {
        overflow: visible;
        text-overflow: clip;
        white-space: normal;
        text-align: center;
        font-size: 10.5px;
        line-height: 1.12;
    }

    #patientsView .diagnostics-phoropter {
        display: block;
        top: -84px;
        right: -175px;
        width: 360px;
        opacity: .13;
        animation: none;
    }
}

@media (max-width: 480px) {
    .patient-dialog-header-tools { justify-content: flex-start; }

    .patient-dialog-header .patient-dialog-header-tools .adaptive-anamnesis-modes {
        order: 0;
        flex: 1 0 100%;
        width: 100%;
        min-width: 0;
    }

    #patientsView #patientsList .patient-row-meta > span:nth-child(2) {
        display: inline;
    }

    #patientsView .diagnostics-phoropter {
        top: -72px;
        right: -165px;
        width: 330px;
        opacity: .11;
    }
}

@media (hover: none) and (pointer: coarse) {
    .wizard-step:hover,
    .diagnostics-mode-switch button:hover,
    #patientsView .subjective-test-card:hover,
    #patientsView .patient-action-command:hover,
    #patientsView .patient-power-command:hover,
    .exam-strategy-test:hover,
    .exam-strategy-why:hover {
        transform: none;
    }

    #patientsView .subjective-test-card:hover::after {
        animation: none;
    }
}

/* ========================================================================
   PATIENT WORKSPACE V23 — смена режимов, крупный HUD, мягкие команды
   ======================================================================== */

/* Анамнез: ручной режим — базовый cyan, ИИ — светлый lavender. */
#patientsView .adaptive-anamnesis-modes {
    width: 380px; min-width: 380px; height: 58px; padding: 5px;
    border: 0; border-radius: 19px;
    background: rgba(9, 22, 43, .56);
    box-shadow: inset 0 1px rgba(255,255,255,.055), 0 12px 32px rgba(1,7,24,.18);
    transition: background .55s ease, box-shadow .55s ease;
}
#patientsView .adaptive-anamnesis-modes.is-ai {
    background: rgba(65, 49, 112, .25);
    box-shadow: inset 0 1px rgba(230,220,255,.09), 0 12px 34px rgba(111,82,207,.11);
}
#patientsView .adaptive-mode-slider {
    top: 5px; bottom: 5px; left: 5px; width: calc(50% - 5px);
    border: 0; border-radius: 15px;
    background: linear-gradient(135deg, #cdbbff, #8d7bea);
    box-shadow: inset 0 1px rgba(255,255,255,.36), 0 8px 24px rgba(132,103,226,.22);
    transition: transform .58s cubic-bezier(.16,1,.3,1), background .5s ease, box-shadow .5s ease;
}
#patientsView .adaptive-anamnesis-modes.is-manual .adaptive-mode-slider {
    transform: translateX(100%);
    background: linear-gradient(135deg, #79deec, #548ad0);
    box-shadow: inset 0 1px rgba(255,255,255,.3), 0 8px 22px rgba(72,173,212,.16);
}
#patientsView .adaptive-mode-btn {
    padding: 0 15px; border-radius: 15px;
    color: rgba(190,213,227,.68);
    font-size: 17px; font-weight: 700; letter-spacing: .025em;
}
#patientsView .adaptive-mode-btn.active { color: #11152b; text-shadow: 0 1px rgba(255,255,255,.2); }

#wizardStep1 .patient-dialog-screen {
    transition: background .65s ease, box-shadow .65s ease, filter .65s ease;
}
#wizardStep1[data-interview-mode="manual"] .patient-dialog-screen {
    background:
        radial-gradient(circle at 10% 12%, rgba(33,183,212,.09), transparent 34%),
        linear-gradient(145deg, rgba(8,24,45,.98), rgba(6,15,33,.99));
    box-shadow: inset 0 1px rgba(119,224,242,.04), 0 24px 64px rgba(1,7,22,.2);
}
#wizardStep1[data-interview-mode="ai"] .patient-dialog-screen {
    background:
        radial-gradient(circle at 78% 8%, rgba(184,154,255,.2), transparent 38%),
        radial-gradient(circle at 12% 48%, rgba(122,98,225,.1), transparent 42%),
        linear-gradient(145deg, rgba(27,24,60,.98), rgba(11,16,39,.99));
    box-shadow: inset 0 1px rgba(222,207,255,.075), 0 28px 72px rgba(37,23,84,.22);
}
#wizardStep1[data-interview-mode="ai"] .patient-intake-kicker,
#wizardStep1[data-interview-mode="ai"] .adaptive-anamnesis-status,
#wizardStep1[data-interview-mode="ai"] .anamnesis-message-meta,
#wizardStep1[data-interview-mode="ai"] .anamnesis-rationale-toggle { color: rgba(207,188,255,.84); }
#wizardStep1[data-interview-mode="ai"] .patient-intake-live-dot,
#wizardStep1[data-interview-mode="ai"] .anamnesis-progress-fill {
    background: #c6a9ff; box-shadow: 0 0 15px rgba(198,169,255,.58);
}

/* Световой проход при реальной смене режима. */
#wizardStep1, #wizardStep3 { position: relative; isolation: isolate; }
#wizardStep1.mode-shifting::after, #wizardStep3.mode-shifting::after {
    content: ''; position: absolute; inset: 0; z-index: 20; pointer-events: none;
    background: linear-gradient(105deg, transparent 34%, rgba(224,215,255,.14) 49%, transparent 64%);
    transform: translateX(-100%);
    animation: patientModeSweep .72s cubic-bezier(.22,1,.36,1) both;
}
@keyframes patientModeSweep { to { transform: translateX(100%); } }

/* Вопрос — крупнее, но остаётся свободным чат-интерфейсом. */
#patientsView #patientsWizardState[data-wizard-step="1"] .patient-dialog-body .anamnesis-question-card {
    min-height: 286px; padding: 26px 30px 118px;
}
#patientsView #patientsWizardState[data-wizard-step="1"] .patient-dialog-body .anamnesis-message-current {
    grid-template-columns: 54px minmax(0,1fr); gap: 17px;
}
#patientsView #patientsWizardState[data-wizard-step="1"] .patient-dialog-body .anamnesis-message-avatar {
    width: 54px; height: 54px; border-radius: 18px; font-size: 13px;
}
#patientsView #patientsWizardState[data-wizard-step="1"] .patient-dialog-body .anamnesis-message-current .anamnesis-message-bubble {
    min-height: 224px; padding: 22px 26px; border-radius: 22px;
}
#patientsView #patientsWizardState[data-wizard-step="1"] .patient-dialog-body .anamnesis-chat-question-text {
    max-width: 1180px; font-size: clamp(22px,1.55vw,28px); line-height: 1.42;
}
#patientsView #patientsWizardState[data-wizard-step="1"] .patient-dialog-body .anamnesis-branch-hint {
    margin-top: 17px; font-size: 16px; line-height: 1.55;
}
#patientsView #patientsWizardState[data-wizard-step="1"] .adaptive-anamnesis-status { font-size: 16px; line-height: 1.45; }
#patientsView #patientsWizardState[data-wizard-step="1"] .anamnesis-progress-text,
#patientsView #patientsWizardState[data-wizard-step="1"] .anamnesis-message-meta { font-size: 13px; }

/* Диагностика использует тот же язык переключения. */
#patientsView .diagnostics-mode-switch {
    gap: 12px; margin: 24px 0; padding: 7px;
    border-radius: 24px; background: rgba(8,21,42,.42);
}
#patientsView .diagnostics-mode-switch button {
    min-height: 98px; padding: 18px 22px; border: 0; border-radius: 20px;
}
#patientsView .diagnostics-mode-switch strong { font-size: 20px; }
#patientsView .diagnostics-mode-switch small { margin-top: 4px; font-size: 14px; line-height: 1.45; }
#patientsView .diagnostics-mode-symbol { width: 58px; height: 58px; border-radius: 18px; font-size: 18px; }
#wizardStep3[data-diagnostics-mode="ai"] [data-diagnostics-mode="ai"].is-active {
    color: #f3efff;
    background: linear-gradient(125deg, rgba(178,149,255,.28), rgba(115,92,223,.2));
    box-shadow: inset 0 1px rgba(239,231,255,.13), 0 12px 34px rgba(100,72,196,.13);
}
#wizardStep3[data-diagnostics-mode="ai"] [data-diagnostics-mode="ai"].is-active .diagnostics-mode-symbol {
    color: #efe8ff; background: rgba(192,165,255,.19);
}
#wizardStep3[data-diagnostics-mode="manual"] [data-diagnostics-mode="manual"].is-active {
    color: #e9fbff;
    background: linear-gradient(125deg, rgba(38,190,216,.2), rgba(51,104,170,.14));
    box-shadow: inset 0 1px rgba(225,251,255,.09), 0 12px 30px rgba(28,151,187,.08);
}

/* Этапы — крупные мягкие HUD-экраны. Вибрирует содержимое, не геометрия. */
#patientsView .patients-wizard-step-indicator::before { display: none; }
#patientsView .wizard-step {
    min-height: 88px; padding: 13px 18px;
    border: 0; border-radius: 22px;
    background: rgba(14,29,55,.7);
    box-shadow: inset 0 1px rgba(255,255,255,.045), 0 12px 30px rgba(1,7,23,.14);
}
#patientsView .wizard-step-index {
    width: 50px; height: 50px; border: 0; border-radius: 17px;
    background: rgba(4,13,31,.5); font-size: 13px;
}
#patientsView .wizard-step-copy strong { font-size: 20px; }
#patientsView .wizard-step-copy small { margin-top: 5px; font-size: 13px; }
#patientsView .wizard-step::before {
    content: ''; position: absolute; inset: 0; pointer-events: none; border-radius: inherit;
    opacity: .16;
    background: repeating-linear-gradient(180deg, transparent 0 5px, rgba(140,225,246,.12) 6px, transparent 7px);
    background-size: 100% 42px;
    animation: hudScreenDrift 5.4s linear infinite;
}
#patientsView .wizard-step.active .wizard-step-copy,
#patientsView .wizard-step.completed .wizard-step-copy { animation: hudTextInstability 6.2s steps(1,end) infinite; }
@keyframes hudScreenDrift { to { background-position: 0 42px; } }
@keyframes hudTextInstability {
    0%,9%,11%,52%,54%,82%,84%,100% { transform: none; filter: none; }
    10% { transform: translateX(.7px); filter: brightness(1.13); }
    53% { transform: translate(-.55px,.2px); filter: brightness(.9); }
    83% { transform: translateX(.45px); text-shadow: 1px 0 rgba(116,227,249,.34), -1px 0 rgba(173,143,255,.22); }
}

/* Угловатые рамочные команды заменены общей мягкой подложкой. */
#patientsView .btn-patients-primary, #patientsView .btn-patients-secondary,
#patientsView .patient-action-command, #patientsView .patient-power-command,
#patientsView .anamnesis-history-button, #patientsView .anamnesis-summary-button,
#patientsView .anamnesis-reset-button, #patientsView .diagnostics-guidance-button,
.subj-answer-btn, .clinical-step-modal footer button {
    border: 0 !important; border-radius: 17px !important;
    background: rgba(112,145,172,.105);
    box-shadow: inset 0 1px rgba(255,255,255,.055), 0 9px 24px rgba(1,7,23,.11);
}
#patientsView .btn-patients-primary, #patientsView .btn-patients-secondary {
    min-height: 54px; padding: 0 25px; font-size: 17px;
}
#patientsView .btn-patients-primary, #patientsView .diagnostics-guidance-button {
    color: #7feaff;
    background: linear-gradient(135deg, rgba(47,190,217,.18), rgba(76,111,190,.11));
}
#patientsView .btn-patients-primary:hover, #patientsView .btn-patients-secondary:hover,
#patientsView .patient-action-command:hover, #patientsView .patient-power-command:hover {
    background: rgba(116,178,202,.17);
    box-shadow: inset 0 1px rgba(255,255,255,.08), 0 12px 28px rgba(19,128,158,.1);
}

@media (max-width: 760px) {
    #patientsView .adaptive-anamnesis-modes { width: 100%; min-width: 0; height: 54px; }
    #patientsView .adaptive-mode-btn { padding: 0 7px; font-size: 15px; }
    #patientsView #patientsWizardState[data-wizard-step="1"] .patient-dialog-body .anamnesis-question-card {
        min-height: 0; padding: 18px 14px calc(94px + env(safe-area-inset-bottom));
    }
    #patientsView #patientsWizardState[data-wizard-step="1"] .patient-dialog-body .anamnesis-message-current {
        grid-template-columns: 44px minmax(0,1fr); gap: 10px;
    }
    #patientsView #patientsWizardState[data-wizard-step="1"] .patient-dialog-body .anamnesis-message-avatar {
        width: 44px; height: 44px; border-radius: 14px;
    }
    #patientsView #patientsWizardState[data-wizard-step="1"] .patient-dialog-body .anamnesis-message-current .anamnesis-message-bubble {
        min-height: 0; padding: 16px; border-radius: 18px;
    }
    #patientsView #patientsWizardState[data-wizard-step="1"] .patient-dialog-body .anamnesis-chat-question-text { font-size: 20px; }
    #patientsView #patientsWizardState[data-wizard-step="1"] .patient-dialog-body .anamnesis-branch-hint,
    #patientsView #patientsWizardState[data-wizard-step="1"] .adaptive-anamnesis-status { font-size: 14px; }
    #patientsView .diagnostics-mode-switch { grid-template-columns: 1fr; padding: 5px; }
    #patientsView .diagnostics-mode-switch button { min-height: 82px; padding: 13px 15px; }
    #patientsView .diagnostics-mode-switch strong { font-size: 18px; }
    #patientsView .diagnostics-mode-switch small { font-size: 13px; }
    #patientsView .wizard-step { min-height: 70px; padding: 8px 6px; border-radius: 17px; }
    #patientsView .wizard-step-index { width: 34px; height: 34px; border-radius: 12px; font-size: 10px; }
    #patientsView .wizard-step-copy strong { font-size: 13px; line-height: 1.15; }
    #patientsView .wizard-step-copy small { display: none; }
    #patientsView .btn-patients-primary, #patientsView .btn-patients-secondary {
        min-height: 50px; padding: 0 18px; font-size: 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    #patientsView .wizard-step::before, #patientsView .wizard-step-copy,
    #wizardStep1.mode-shifting::after, #wizardStep3.mode-shifting::after { animation: none !important; }
}

/* V24 cascade seal: эти правила намеренно последние — старые поколения
   интерфейса выше не должны возвращать вложенные панели и карточки. */
body:not(.landing-page) { padding: 0 !important; }
body:not(.landing-page) > .container { width: 100% !important; max-width: none !important; margin: 0 !important; }
body:not(.landing-page) .main-content { gap: 0 !important; }
.chat-container, .patients-wrapper, .spectacle-lenses-wrapper {
    width: 100% !important; max-width: none !important; margin: 0 !important;
}
#patientsView .patients-wrapper {
    max-width: none !important;
    background: transparent !important;
}
#patientsView .patients-wrapper::before,
#patientsView .patients-wrapper::after { display: none !important; }
#patientsView .patients-substate,
#patientsView .patients-wizard-body,
#patientsView .patients-wizard-steps,
#patientsView .patient-registry-shell,
#patientsView .patients-overview-body { width: 100% !important; max-width: none !important; }

#wizardStep1 .patient-dialog-screen,
#wizardStep1 .patient-dialog-header,
#wizardStep1 .patient-dialog-body,
#wizardStep1 .anamnesis-console-state,
#wizardStep1 .anamnesis-question-card,
#wizardStep1 .anamnesis-message-bubble {
    border: 0 !important; border-radius: 0 !important;
    background: transparent !important; box-shadow: none !important;
}
#wizardStep1 .patient-dialog-screen::before,
#wizardStep1 .patient-dialog-neon-line { display: none !important; }
#wizardStep1 .patient-dialog-screen { width: 100% !important; max-width: none !important; }

#patientsView .diagnostics-mode-switch button,
#patientsView .diagnostics-mode-switch button.is-active {
    background: transparent !important; box-shadow: none !important;
}

#patientsView .wizard-step.completed .wizard-step-index::after {
    content: '' !important; display: block !important;
    width: 20px !important; height: 11px !important; margin: 0 !important;
    border: 0 !important; border-left: 4px solid #58e8ba !important;
    border-bottom: 4px solid #58e8ba !important; border-radius: 1px !important;
    transform: translateY(-2px) rotate(-45deg) !important;
    filter: drop-shadow(0 0 5px rgba(88,232,186,.72));
}

#patientsView .visit-detail-eye-col {
    padding: 12px 0 18px !important;
    border: 0 !important; border-radius: 0 !important;
    background: transparent !important; box-shadow: none !important;
}
#patientsView .visit-detail-eye-label,
#patientsView .visit-detail-eye-col:last-child .visit-detail-eye-label {
    display: inline-flex !important; align-items: center; gap: 10px;
    width: fit-content; padding: 0 !important;
    color: #63e8fb !important; background: transparent !important;
    font-family: 'Orbitron', monospace !important; font-size: 15px !important;
}
#patientsView .visit-detail-eye-col:last-child .visit-detail-eye-label { color: #a785ff !important; }
#patientsView .visit-detail-stat {
    min-height: 72px; padding: 8px 12px 10px 20px !important;
    border: 0 !important; border-bottom: 1px solid rgba(92,223,245,.28) !important;
    border-radius: 0 !important; background: transparent !important; box-shadow: none !important;
}
#patientsView .visit-detail-eye-col:last-child .visit-detail-stat {
    border-bottom-color: rgba(151,119,255,.28) !important;
}
#patientsView .visit-detail-stat-label {
    color: rgba(148,215,228,.7) !important; font-size: 12px !important; opacity: 1 !important;
}
#patientsView .visit-detail-stat-value,
#patientsView .visit-detail-stat-value.visit-detail-stat-value-numeric {
    color: #edfaff !important; font-family: 'Orbitron', monospace !important; font-size: 20px !important;
}

/* V25 — подтверждения в новом безрамочном языке интерфейса. */
.recipe-picker-overlay:has(.patients-confirm-modal) {
    padding: clamp(16px, 4vw, 48px);
    perspective: 1200px;
}
.recipe-picker-overlay:has(.patients-confirm-modal) .recipe-picker-backdrop {
    background:
        radial-gradient(760px 420px at 50% 48%, rgba(116, 91, 221, .18), transparent 68%),
        rgba(2, 7, 20, .72);
    -webkit-backdrop-filter: blur(14px) saturate(115%);
    backdrop-filter: blur(14px) saturate(115%);
    animation: patientsConfirmBackdropIn .28s ease-out both;
}
.recipe-picker-overlay .patients-confirm-modal {
    isolation: isolate;
    width: min(100%, 650px);
    max-width: 650px;
    padding: clamp(28px, 4vw, 46px);
    border: 0 !important;
    border-radius: 30px;
    overflow: hidden;
    background:
        radial-gradient(500px 210px at 100% 0%, rgba(154, 119, 255, .16), transparent 72%),
        linear-gradient(145deg, rgba(23, 44, 69, .94), rgba(19, 23, 57, .95));
    box-shadow:
        inset 0 1px rgba(255, 255, 255, .075),
        0 30px 90px rgba(0, 0, 0, .43),
        0 0 70px rgba(103, 82, 202, .09);
    animation: patientsConfirmPanelIn .48s cubic-bezier(.16, 1, .3, 1) both;
}
.recipe-picker-overlay .patients-confirm-modal::before {
    content: '';
    position: absolute;
    z-index: -1;
    inset: -40% -20%;
    pointer-events: none;
    background: linear-gradient(108deg, transparent 42%, rgba(213, 201, 255, .075) 50%, transparent 58%);
    transform: translateX(-55%);
    animation: patientsConfirmAmbientScan 5.8s ease-in-out infinite;
}
.recipe-picker-overlay .patients-confirm-message {
    max-width: 56ch;
    margin: 0 0 30px;
    color: rgba(239, 246, 255, .92);
    font-family: 'Monitorica', 'Inter', sans-serif;
    font-size: clamp(19px, 1.5vw, 23px);
    font-weight: 400;
    line-height: 1.55;
    letter-spacing: .012em;
}
.recipe-picker-overlay .patients-confirm-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}
.recipe-picker-overlay .patients-confirm-actions .btn-patients-primary,
.recipe-picker-overlay .patients-confirm-actions .btn-patients-secondary {
    min-height: 58px;
    padding: 0 25px;
    border: 0 !important;
    border-radius: 18px !important;
    font-size: 17px;
    transition: transform .28s cubic-bezier(.16, 1, .3, 1), background .28s ease, box-shadow .28s ease, color .28s ease;
}
.recipe-picker-overlay .patients-confirm-actions .btn-patients-secondary {
    color: rgba(222, 232, 244, .78);
    background: rgba(139, 160, 184, .12) !important;
    box-shadow: inset 0 1px rgba(255, 255, 255, .055);
}
.recipe-picker-overlay .patients-confirm-actions .btn-patients-primary {
    color: #f7f5ff;
    background: linear-gradient(125deg, rgba(50, 180, 214, .68), rgba(111, 82, 218, .78)) !important;
    box-shadow: inset 0 1px rgba(255, 255, 255, .18), 0 14px 32px rgba(73, 74, 192, .2);
}
.recipe-picker-overlay .patients-confirm-actions button:hover {
    transform: translateY(-2px);
}
.recipe-picker-overlay .patients-confirm-actions .btn-patients-secondary:hover {
    color: #f1f7ff;
    background: rgba(153, 177, 205, .18) !important;
}
.recipe-picker-overlay .patients-confirm-actions .btn-patients-primary:hover {
    background: linear-gradient(125deg, rgba(60, 203, 230, .78), rgba(131, 100, 235, .88)) !important;
    box-shadow: inset 0 1px rgba(255, 255, 255, .23), 0 18px 38px rgba(81, 81, 205, .27);
}
.recipe-picker-overlay .patients-confirm-actions button:active { transform: translateY(0) scale(.985); }

@keyframes patientsConfirmBackdropIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes patientsConfirmPanelIn {
    from { opacity: 0; transform: translateY(22px) scale(.955) rotateX(3deg); }
    to { opacity: 1; transform: none; }
}
@keyframes patientsConfirmAmbientScan {
    0%, 28% { transform: translateX(-55%); opacity: 0; }
    42%, 58% { opacity: 1; }
    72%, 100% { transform: translateX(55%); opacity: 0; }
}

@media (max-width: 620px) {
    .recipe-picker-overlay .patients-confirm-modal { padding: 25px 20px; border-radius: 24px; }
    .recipe-picker-overlay .patients-confirm-message { margin-bottom: 24px; font-size: 18px; }
    .recipe-picker-overlay .patients-confirm-actions { display: grid; grid-template-columns: 1fr; }
    .recipe-picker-overlay .patients-confirm-actions .btn-patients-primary,
    .recipe-picker-overlay .patients-confirm-actions .btn-patients-secondary { width: 100%; min-height: 54px; }
    .recipe-picker-overlay .patients-confirm-actions .btn-patients-primary { order: -1; }
}

@media (prefers-reduced-motion: reduce) {
    .recipe-picker-overlay:has(.patients-confirm-modal) .recipe-picker-backdrop,
    .recipe-picker-overlay .patients-confirm-modal,
    .recipe-picker-overlay .patients-confirm-modal::before { animation: none !important; }
}

/* V26 — общая смена палитры относится только к диагностике. В анамнезе
   сохраняется его базовый цвет, а рамка текущего сообщения ИИ остаётся частью
   анимации ухода сообщения в световой луч. */
#wizardStep1.mode-shifting::after { display: none !important; }
#patientsView #patientsWizardState[data-wizard-step="1"] .patient-dialog-body
    .anamnesis-message-current .anamnesis-message-bubble {
    border: 1px solid rgba(65, 224, 251, .58) !important;
    border-radius: 6px 22px 22px 22px !important;
    background: transparent !important;
    box-shadow:
        0 0 20px rgba(39, 207, 237, .09),
        inset 0 0 20px rgba(39, 207, 237, .028) !important;
}

@media (max-width: 760px) {
    #patientsView #patientsWizardState[data-wizard-step="1"] .patient-dialog-body
        .anamnesis-message-current .anamnesis-message-bubble {
        border-radius: 5px 18px 18px 18px !important;
    }
}

/* V27 — история приёмов использует тот же глаз и язык полей, что диагностика. */
#patientsView #visitDetailView {
    margin: 18px 0 0;
    padding: clamp(22px, 2.5vw, 38px);
    border: 0 !important;
    border-radius: 28px;
    background:
        radial-gradient(720px 330px at 8% 0%, rgba(49, 200, 228, .07), transparent 72%),
        radial-gradient(680px 320px at 94% 8%, rgba(126, 91, 226, .075), transparent 72%),
        rgba(14, 28, 51, .44);
    box-shadow: inset 0 1px rgba(255, 255, 255, .04), 0 20px 55px rgba(1, 7, 22, .08);
}
#patientsView .visit-detail-eye-label::before { display: none !important; }
#patientsView .visit-detail-eye-label .neon-eye-symbol {
    flex: 0 0 32px;
    width: 32px;
    height: 23px;
}
#patientsView .visit-detail-eye-col:last-child .neon-eye-symbol { animation-delay: .6s; }

#patientsView .visit-detail-grid { gap: 12px; }
#patientsView .visit-detail-stat,
#patientsView .visit-detail-eye-col:last-child .visit-detail-stat {
    min-height: 82px;
    padding: 13px 16px 13px 22px !important;
    border: 0 !important;
    border-radius: 17px !important;
    background: rgba(127, 166, 192, .075) !important;
    box-shadow: inset 0 1px rgba(255, 255, 255, .045) !important;
}
#patientsView .visit-detail-eye-col:first-child .visit-detail-stat {
    background: linear-gradient(135deg, rgba(45, 187, 216, .09), rgba(85, 125, 168, .055)) !important;
}
#patientsView .visit-detail-eye-col:last-child .visit-detail-stat {
    background: linear-gradient(135deg, rgba(130, 94, 224, .09), rgba(92, 90, 166, .055)) !important;
}

@media (max-width: 760px) {
    #patientsView #visitDetailView { padding: 18px 14px; border-radius: 22px; }
    #patientsView .visit-detail-grid { gap: 9px; }
    #patientsView .visit-detail-stat,
    #patientsView .visit-detail-eye-col:last-child .visit-detail-stat {
        min-height: 72px;
        padding: 11px 13px 11px 20px !important;
        border-radius: 15px !important;
    }
}

/* V28 — фамилия в открытой карте повторяет гарнитуру активной карты анамнеза. */
#patientsView .patient-overview-name strong {
    font-family: 'Orbitron', 'Monitorica', sans-serif !important;
    font-weight: 600 !important;
    text-transform: uppercase;
}

/* V29 — стабильная мобильная сцена обработки ответа в анамнезе. */
@media (max-width: 720px) {
    #patientsView #patientsWizardState[data-wizard-step="1"] .patients-wizard-body,
    #patientsView #patientsWizardState[data-wizard-step="1"] #wizardStep1,
    #patientsView #patientsWizardState[data-wizard-step="1"] .patient-dialog-screen {
        width: 100% !important;
        max-width: none !important;
        min-width: 0 !important;
    }

    #patientsView #patientsWizardState[data-wizard-step="1"] .patient-dialog-body
        .anamnesis-question-card.is-writing {
        padding-bottom: calc(190px + env(safe-area-inset-bottom)) !important;
    }

    #patientsView #patientsWizardState[data-wizard-step="1"] .patient-dialog-body
        .anamnesis-writing-indicator {
        right: 12px !important;
        bottom: calc(84px + env(safe-area-inset-bottom)) !important;
        left: 12px !important;
        z-index: 24;
        display: grid;
        grid-template-columns: 82px minmax(0, 1fr) 20px;
        align-items: center;
        gap: 9px;
        min-height: 92px;
        padding: 9px 11px;
        overflow: hidden;
        border: 0 !important;
        border-radius: 20px;
        background: rgba(8, 20, 43, .9) !important;
        box-shadow: inset 0 1px rgba(255, 255, 255, .055), 0 16px 38px rgba(0, 5, 20, .28) !important;
        -webkit-backdrop-filter: blur(12px);
        backdrop-filter: blur(12px);
    }
    #patientsView #patientsWizardState[data-wizard-step="1"] .patient-dialog-body
        .anamnesis-writing-indicator[hidden] { display: none !important; }

    #patientsView .anamnesis-writing-hand {
        flex-basis: 82px;
        width: 82px;
        height: 58px;
    }
    #patientsView .anamnesis-writing-canvas {
        width: 82px;
        height: 58px;
    }
    #patientsView .anamnesis-writing-trace {
        top: 49px;
        left: 63px;
        width: 17px;
    }
    #patientsView .anamnesis-writing-indicator > div:nth-child(2) { min-width: 0; }
    #patientsView .anamnesis-writing-indicator strong {
        font-size: 15px;
        line-height: 1.2;
        white-space: normal;
    }
    #patientsView .anamnesis-writing-indicator > div:nth-child(2) span {
        margin-top: 5px;
        font-size: 11px;
        line-height: 1.32;
    }
    #patientsView .anamnesis-writing-dots {
        align-self: center;
        margin-left: 0;
    }

    #patientsView #patientsWizardState[data-wizard-step="1"] .patient-dialog-body
        .anamnesis-chat-dock {
        right: 10px !important;
        bottom: max(10px, env(safe-area-inset-bottom)) !important;
        left: 10px !important;
        min-width: 0;
    }
}

@media (max-width: 420px) {
    #patientsView #patientsWizardState[data-wizard-step="1"] .patient-dialog-body
        .anamnesis-writing-indicator {
        grid-template-columns: 70px minmax(0, 1fr) 16px;
        gap: 7px;
        padding-right: 9px;
        padding-left: 9px;
    }
    #patientsView .anamnesis-writing-hand,
    #patientsView .anamnesis-writing-canvas { width: 70px; height: 52px; }
    #patientsView .anamnesis-writing-trace { top: 44px; left: 54px; width: 15px; }
    #patientsView .anamnesis-writing-indicator strong { font-size: 14px; }
    #patientsView .anamnesis-writing-indicator > div:nth-child(2) span { font-size: 10px; }
}

/* V30 — компактный и контрастный переключатель диагностики, более плотная
   композиция с фороптером. Рефракционные поля и их иконки не затрагиваются. */
#patientsView #wizardStep3 .diagnostics-mode-switch {
    width: min(100%, 1180px);
    margin: 24px auto !important;
    background: linear-gradient(135deg, rgba(7, 20, 42, .82), rgba(28, 26, 65, .72)) !important;
    box-shadow: inset 0 1px rgba(255, 255, 255, .045), 0 18px 42px rgba(2, 7, 27, .18) !important;
}

#patientsView #wizardStep3 .diagnostics-mode-switch::before {
    background:
        radial-gradient(circle at 16% 50%, rgba(218, 205, 255, .09), transparent 27%),
        linear-gradient(125deg, rgba(125, 102, 194, .58), rgba(82, 67, 157, .5)) !important;
    box-shadow: inset 0 1px rgba(255, 255, 255, .12), 0 0 22px rgba(129, 102, 214, .16) !important;
}

#patientsView #wizardStep3[data-diagnostics-mode="manual"] .diagnostics-mode-switch::before {
    background:
        radial-gradient(circle at 16% 50%, rgba(200, 244, 249, .08), transparent 27%),
        linear-gradient(125deg, rgba(42, 135, 158, .55), rgba(37, 81, 137, .5)) !important;
    box-shadow: inset 0 1px rgba(255, 255, 255, .1), 0 0 20px rgba(48, 164, 192, .14) !important;
}

#patientsView #wizardStep3 .diagnostics-mode-switch button,
#patientsView #wizardStep3 .diagnostics-mode-switch button:focus,
#patientsView #wizardStep3 .diagnostics-mode-switch button:focus-visible {
    outline: 0 !important;
}

#patientsView #wizardStep3 .diagnostics-mode-switch button.is-active strong {
    color: #f4f9ff !important;
    text-shadow: 0 1px 8px rgba(0, 8, 28, .7);
}

#patientsView #wizardStep3 .diagnostics-mode-switch button.is-active small {
    color: rgba(225, 237, 248, .88) !important;
    text-shadow: 0 1px 6px rgba(0, 8, 28, .72);
}

#patientsView #wizardStep3 .diagnostics-mode-switch button:not(.is-active) strong {
    color: rgba(222, 235, 247, .78) !important;
}

#patientsView #wizardStep3 .diagnostics-mode-switch button:not(.is-active) small {
    color: rgba(188, 205, 220, .68) !important;
}

#patientsView .diagnostics-phoropter {
    position: fixed;
    top: clamp(190px, 18vh, 270px);
    right: -340px;
    width: clamp(820px, 62vw, 1120px);
}

@media (max-width: 1100px) {
    #patientsView .diagnostics-phoropter {
        top: 170px;
        right: -220px;
        width: 720px;
    }
}

@media (max-width: 760px) {
    #patientsView #wizardStep3 .diagnostics-mode-switch {
        width: 100%;
        margin: 18px 0 !important;
    }
}

@media (max-width: 620px) {
    #patientsView .diagnostics-phoropter { display: none !important; }
}

/* V31 — мобильная карточка вопроса растёт вместе со шторкой
   «Почему спрашиваю?» и возвращается к исходной высоте после закрытия. */
@media (max-width: 720px) {
    #patientsView #patientsWizardState[data-wizard-step="1"]
        .patients-wizard-body:has(.patient-dialog-screen.has-open-anamnesis-rationale),
    #patientsView #patientsWizardState[data-wizard-step="1"]
        #wizardStep1.active:has(.patient-dialog-screen.has-open-anamnesis-rationale) {
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
    }

    #patientsView #patientsWizardState[data-wizard-step="1"]
        .patient-dialog-screen.has-open-anamnesis-rationale {
        height: auto !important;
        min-height: calc(100dvh - 72px) !important;
        max-height: none !important;
        grid-template-rows: auto 0 auto !important;
        overflow: visible !important;
    }

    #patientsView #patientsWizardState[data-wizard-step="1"]
        .patient-dialog-screen.has-open-anamnesis-rationale .patient-dialog-body {
        min-height: 0 !important;
        overflow: visible !important;
    }

    #patientsView #patientsWizardState[data-wizard-step="1"]
        .anamnesis-question-card.has-open-rationale {
        flex: 0 0 auto !important;
        width: 100%;
        height: auto !important;
        min-height: var(--anamnesis-expanded-card-height, 520px) !important;
        padding-bottom: calc(104px + env(safe-area-inset-bottom)) !important;
        overflow: visible !important;
        transition: min-height .42s cubic-bezier(.22, 1, .36, 1), padding .3s ease;
    }

    #patientsView #patientsWizardState[data-wizard-step="1"]
        .anamnesis-question-card.has-open-rationale .anamnesis-conversation-feed,
    #patientsView #patientsWizardState[data-wizard-step="1"]
        .anamnesis-question-card.has-open-rationale .anamnesis-message-current,
    #patientsView #patientsWizardState[data-wizard-step="1"]
        .anamnesis-question-card.has-open-rationale .anamnesis-message-bubble,
    #patientsView #patientsWizardState[data-wizard-step="1"]
        .anamnesis-question-card.has-open-rationale .anamnesis-question {
        height: auto !important;
        min-height: 0 !important;
        overflow: visible !important;
    }

}

/* V32 — раскрытая шторка переводит composer под сообщение. Пока пояснение
   закрыто, сохраняется прежнее закреплённое положение у нижнего края. */
@media (max-width: 720px) {
    #patientsView #patientsWizardState[data-wizard-step="1"]
        .patient-dialog-screen.has-open-anamnesis-rationale
        .anamnesis-question-card.has-open-rationale {
        padding-bottom: 18px !important;
    }

    #patientsView #patientsWizardState[data-wizard-step="1"]
        .patient-dialog-screen.has-open-anamnesis-rationale
        .patient-dialog-body .anamnesis-chat-dock {
        position: relative !important;
        top: auto !important;
        right: auto !important;
        bottom: auto !important;
        left: auto !important;
        order: 10;
        flex: 0 0 auto;
        width: calc(100% - 28px);
        max-width: none;
        margin: 14px 14px calc(14px + env(safe-area-inset-bottom));
        scroll-margin-bottom: calc(14px + env(safe-area-inset-bottom));
        transform: none !important;
    }
}

/* V35-final — финальный каскад для мобильной шторки. Размещён после прежних
   адаптивных правил, чтобы карточка не наследовала искусственные 520px. */
@media (max-width: 720px) {
    #patientsView #patientsWizardState[data-wizard-step="1"]
        .patient-dialog-screen.has-open-anamnesis-rationale
        .anamnesis-question-card.has-open-rationale {
        min-height: 0 !important;
        padding-bottom: 12px !important;
        transition: padding .38s cubic-bezier(.22, 1, .36, 1) !important;
    }

    #patientsView #patientsWizardState[data-wizard-step="1"]
        .anamnesis-rationale-content {
        overflow: hidden !important;
        transition:
            max-height .56s cubic-bezier(.22, 1, .36, 1),
            margin-top .42s cubic-bezier(.22, 1, .36, 1),
            padding .42s cubic-bezier(.22, 1, .36, 1),
            opacity .34s ease,
            transform .5s cubic-bezier(.22, 1, .36, 1),
            border-color .4s ease,
            visibility 0s linear .56s !important;
        will-change: max-height, opacity, transform;
    }

    #patientsView #patientsWizardState[data-wizard-step="1"]
        .anamnesis-rationale-content.is-open {
        max-height: var(--anamnesis-rationale-height, 360px) !important;
        overflow: hidden !important;
        transition-delay: 0s !important;
    }

    #patientsView #patientsWizardState[data-wizard-step="1"]
        .patient-dialog-screen.has-open-anamnesis-rationale
        .patient-dialog-body .anamnesis-chat-dock {
        margin-top: 10px !important;
    }
}

/* V36 — мобильная шторка как обычный вертикальный поток.
   Никаких min-height, flex-растяжения, измерения текста и автопрокрутки. */
@media (max-width: 720px) {
    #patientsView .patients-wrapper:has(.patient-dialog-screen.has-open-anamnesis-rationale) {
        padding-bottom: calc(24px + env(safe-area-inset-bottom)) !important;
    }

    #patientsView #patientsWizardState[data-wizard-step="1"]
        .patients-wizard-body:has(.patient-dialog-screen.has-open-anamnesis-rationale),
    #patientsView #patientsWizardState[data-wizard-step="1"]
        #wizardStep1.active:has(.patient-dialog-screen.has-open-anamnesis-rationale),
    #patientsView #patientsWizardState[data-wizard-step="1"]
        .patient-dialog-screen.has-open-anamnesis-rationale {
        display: block !important;
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        overflow: visible !important;
    }

    #patientsView #patientsWizardState[data-wizard-step="1"]
        .patient-dialog-screen.has-open-anamnesis-rationale .patient-dialog-body {
        display: block !important;
        height: auto !important;
        min-height: 0 !important;
        overflow: visible !important;
        padding-bottom: calc(18px + env(safe-area-inset-bottom)) !important;
    }

    #patientsView #patientsWizardState[data-wizard-step="1"]
        .patient-dialog-screen.has-open-anamnesis-rationale
        .anamnesis-question-card.has-open-rationale {
        display: block !important;
        flex: none !important;
        height: auto !important;
        min-height: 0 !important;
        margin: 0 !important;
        padding-bottom: 0 !important;
        overflow: visible !important;
        transition: none !important;
    }

    #patientsView #patientsWizardState[data-wizard-step="1"]
        .anamnesis-question-card.has-open-rationale .anamnesis-conversation-feed {
        display: flex !important;
        height: auto !important;
        min-height: 0 !important;
        padding-bottom: 0 !important;
        overflow: visible !important;
    }

    #patientsView #patientsWizardState[data-wizard-step="1"]
        .patient-dialog-screen.has-open-anamnesis-rationale
        .patient-dialog-body .anamnesis-chat-dock {
        position: relative !important;
        inset: auto !important;
        display: flex;
        width: calc(100% - 28px) !important;
        max-width: none !important;
        margin: 12px 14px 0 !important;
        transform: none !important;
        contain: none !important;
    }

    #patientsView #patientsWizardState[data-wizard-step="1"]
        .anamnesis-rationale-content {
        display: grid !important;
        grid-template-rows: 0fr;
        max-height: none !important;
        margin-top: 0;
        padding: 0 !important;
        overflow: hidden !important;
        border-left-color: transparent;
        opacity: 0;
        visibility: hidden;
        transform: translateY(-5px);
        will-change: auto;
        transition:
            grid-template-rows .42s cubic-bezier(.22, 1, .36, 1),
            margin-top .38s cubic-bezier(.22, 1, .36, 1),
            opacity .28s ease,
            transform .4s cubic-bezier(.22, 1, .36, 1),
            border-color .32s ease,
            visibility 0s linear .42s !important;
    }

    #patientsView #patientsWizardState[data-wizard-step="1"]
        .anamnesis-rationale-content .anamnesis-rationale-inner {
        min-height: 0;
        padding: 4px 8px 4px 11px;
        overflow: hidden;
    }

    #patientsView #patientsWizardState[data-wizard-step="1"]
        .anamnesis-rationale-content.is-open {
        grid-template-rows: 1fr;
        max-height: none !important;
        margin-top: 8px;
        padding: 0 !important;
        overflow: hidden !important;
        border-left-color: rgba(64, 220, 248, .35);
        opacity: 1;
        visibility: visible;
        transform: none;
        transition-delay: 0s !important;
    }
}

@media (max-width: 720px) and (prefers-reduced-motion: reduce) {
    #patientsView #patientsWizardState[data-wizard-step="1"]
        .anamnesis-rationale-content {
        transition: none !important;
    }
}

/* V188 — фороптер относится только к верхней диагностической сцене.
   Он прокручивается вместе со сценой и больше не перекрывает поля OD/OS. */
#patientsView .patients-wrapper:has(#patientsWizardState[data-wizard-step="3"]) {
    padding-right: 0 !important;
    padding-left: clamp(18px, 2.2vw, 42px) !important;
}

#patientsWizardState[data-wizard-step="3"] .patients-wizard-body {
    box-sizing: border-box !important;
    padding-right: clamp(18px, 2.2vw, 42px) !important;
    padding-left: 0 !important;
}

#patientsView #wizardStep3 .diagnostics-deck-header {
    position: relative !important;
    isolation: isolate;
}

#patientsView #wizardStep3 .diagnostics-phoropter {
    position: absolute !important;
    z-index: 0 !important;
    top: -205px !important;
    right: -365px !important;
    width: clamp(900px, 57vw, 1120px) !important;
    max-width: none !important;
}

#patientsView #wizardStep3 .diagnostics-deck-header > div,
#patientsView #wizardStep3 .diagnostics-deck-header > .diagnostics-deck-scan {
    position: relative;
    z-index: 2;
}

@media (max-width: 1100px) {
    #patientsView #wizardStep3 .diagnostics-phoropter {
        top: -145px !important;
        right: -260px !important;
        width: 760px !important;
    }
}

@media (max-width: 720px) {
    #patientsView .patients-wrapper:has(#patientsWizardState[data-wizard-step="3"]) {
        padding-right: 0 !important;
        padding-left: 8px !important;
    }

    #patientsWizardState[data-wizard-step="3"] .patients-wizard-body {
        padding-right: 8px !important;
        padding-left: 0 !important;
    }
}

@media (max-width: 620px) {
    #patientsView #wizardStep3 .diagnostics-phoropter {
        display: none !important;
    }
}

/* V38 — composer всегда находится в одном flow-положении на мобильном.
   Его position больше не меняется при открытии/закрытии пояснения. */
@media (max-width: 720px) {
    #patientsView .patients-wrapper {
        overflow-x: hidden !important;
        overflow-y: auto !important;
        padding-bottom: calc(24px + env(safe-area-inset-bottom)) !important;
        overscroll-behavior-y: contain;
        -webkit-overflow-scrolling: touch;
    }

    #patientsView #patientsWizardState[data-wizard-step="1"] .patients-wizard-body,
    #patientsView #patientsWizardState[data-wizard-step="1"] #wizardStep1.active,
    #patientsView #patientsWizardState[data-wizard-step="1"] .patient-dialog-screen {
        display: block !important;
        width: 100% !important;
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        overflow: visible !important;
    }

    #patientsView #patientsWizardState[data-wizard-step="1"] .patient-dialog-body {
        display: block !important;
        height: auto !important;
        min-height: 0 !important;
        overflow: visible !important;
        padding-bottom: calc(18px + env(safe-area-inset-bottom)) !important;
    }

    #patientsView #patientsWizardState[data-wizard-step="1"]
        .patient-dialog-body .anamnesis-question-card {
        display: block !important;
        flex: none !important;
        height: auto !important;
        min-height: 0 !important;
        margin: 0 !important;
        padding-bottom: 0 !important;
        overflow: visible !important;
    }

    #patientsView #patientsWizardState[data-wizard-step="1"]
        .patient-dialog-body .anamnesis-conversation-feed {
        height: auto !important;
        min-height: 0 !important;
        padding-bottom: 0 !important;
        overflow: visible !important;
    }

    #patientsView #patientsWizardState[data-wizard-step="1"]
        .patient-dialog-body .anamnesis-chat-dock,
    #patientsView #patientsWizardState[data-wizard-step="1"]
        .patient-dialog-screen.has-open-anamnesis-rationale
        .patient-dialog-body .anamnesis-chat-dock {
        position: relative !important;
        inset: auto !important;
        display: flex;
        width: calc(100% - 28px) !important;
        max-width: none !important;
        margin: 12px 14px 0 !important;
        transform: none !important;
        transition: none !important;
        contain: none !important;
    }
}

/* V40 — финальная мобильная раскладка анамнеза.
   Один и тот же composer остаётся в пятой строке grid:
   в закрытом виде свободная строка удерживает его снизу,
   при раскрытии пояснения эта строка плавно складывается. */
@media (max-width: 720px) {
    #patientsView #patientsWizardState[data-wizard-step="1"]
        .patient-dialog-screen,
    #patientsView #patientsWizardState[data-wizard-step="1"]
        .patient-dialog-screen.has-open-anamnesis-rationale {
        display: flex !important;
        flex-direction: column !important;
        height: auto !important;
        min-height: calc(100dvh - 72px) !important;
        max-height: none !important;
        overflow: visible !important;
    }

    #patientsView #patientsWizardState[data-wizard-step="1"]
        .patient-dialog-body,
    #patientsView #patientsWizardState[data-wizard-step="1"]
        .patient-dialog-screen.has-open-anamnesis-rationale .patient-dialog-body {
        display: grid !important;
        grid-template-rows: auto auto auto minmax(0, 1fr) auto !important;
        flex: 1 1 auto !important;
        align-content: start !important;
        gap: 0 !important;
        row-gap: 0 !important;
        height: auto !important;
        min-height: 0 !important;
        overflow: visible !important;
        padding-bottom: calc(14px + env(safe-area-inset-bottom)) !important;
        transition: grid-template-rows .44s cubic-bezier(.22, 1, .36, 1) !important;
    }

    #patientsView #patientsWizardState[data-wizard-step="1"]
        .patient-dialog-screen.has-open-anamnesis-rationale .patient-dialog-body {
        grid-template-rows: auto auto auto minmax(0, 0fr) auto !important;
    }

    #patientsView #patientsWizardState[data-wizard-step="1"]
        .patient-dialog-body .anamnesis-console-state { grid-row: 1 !important; }

    #patientsView #patientsWizardState[data-wizard-step="1"]
        .patient-dialog-body .adaptive-anamnesis-safety { grid-row: 2 !important; }

    #patientsView #patientsWizardState[data-wizard-step="1"]
        .patient-dialog-body .anamnesis-question-card { grid-row: 3 !important; }

    #patientsView #patientsWizardState[data-wizard-step="1"]
        .patient-dialog-body .anamnesis-chat-dock {
        grid-row: 5 !important;
        align-self: end !important;
    }

    #patientsView #patientsWizardState[data-wizard-step="1"]
        .patient-dialog-body .anamnesis-writing-indicator {
        grid-row: 5 !important;
    }
}

@media (max-width: 720px) and (prefers-reduced-motion: reduce) {
    #patientsView #patientsWizardState[data-wizard-step="1"]
        .patient-dialog-body {
        transition: none !important;
    }
}
