/* =============================================
   e-Prof — Основные стили
   Индивидуальный дизайн для медицинской ИС
   ============================================= */

/* ---- Сброс и переменные ---- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --c-brand-blue: #1976B9;
    --c-brand-cyan: #70C7F5;
    --c-brand-gradient: linear-gradient(135deg, #1677B8 0%, #2D94D0 42%, #72C9F4 100%);
    --c-navy:       #153B5A;
    --c-navy-deep:  #102E47;
    --c-blue:       #1976B9;
    --c-blue-mid:   #429ED4;
    --c-steel:      #91B7D2;
    --c-steel-lt:   #DCECF7;
    --c-ice:        #E9F6FF;
    --c-bg:         #FFFFFF;
    --c-bg-alt:     #F3F9FD;
    --c-white:      #FFFFFF;
    --c-card:       rgba(255,255,255,.96);
    --c-border:     rgba(86, 143, 181, .22);
    --c-text:       #153B5A;
    --c-text-sec:   #51718A;
    --c-text-muted: #7895AA;
    --c-green:      #1D7A52;
    --c-green-bg:   #DDF6E8;
    --c-green-hover:#239464;
    --c-red:        #B6464B;
    --c-red-bg:     #FCE6E8;
    --c-orange:     #D97745;
    --c-orange-bg:  #FDEBDD;
    --c-yellow:     #C6922A;
    --c-yellow-bg:  #FBF1D8;
    --c-accent:     #1976B9;
    --surface-strong: rgba(255,255,255,.97);
    --surface-soft: rgba(246,251,255,.92);
    --surface-dark: rgba(16, 46, 71, .96);
    --ring:         0 0 0 4px rgba(25,118,185,.14);

    --sidebar-w:    260px;
    --sidebar-collapsed-w: 76px;
    --topbar-h:     64px;
    --radius:       20px;
    --radius-sm:    14px;
    --shadow:       0 10px 30px rgba(48,110,151,.08), 0 2px 10px rgba(48,110,151,.04);
    --shadow-lg:    0 24px 60px rgba(24,72,106,.18), 0 10px 24px rgba(24,72,106,.08);
    --shadow-up:    0 -6px 18px rgba(48,110,151,.04);
    --shadow-btn:   0 10px 24px rgba(25,118,185,.20);
    --transition:   .22s cubic-bezier(0.23, 1, 0.32, 1);
    --ease-out:     cubic-bezier(0.23, 1, 0.32, 1);
    --ease-in-out:  cubic-bezier(0.77, 0, 0.175, 1);
    --font:         'Manrope', 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
}

html {
    font-size: 15px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    color: var(--c-text);
    background:
        radial-gradient(circle at top left, rgba(113,200,245,.14) 0, transparent 30%),
        radial-gradient(circle at top right, rgba(25,118,185,.10) 0, transparent 25%),
        linear-gradient(180deg, #ffffff 0%, #f8fcff 52%, #f1f9fe 100%);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    min-height: 100vh;
    position: relative;
}

body::before,
body::after {
    content: '';
    position: fixed;
    inset: auto;
    pointer-events: none;
    z-index: -1;
}

body::before {
    top: -120px;
    right: -120px;
    width: 360px;
    height: 360px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(66,158,212,.15) 0%, rgba(66,158,212,0) 70%);
}

body::after {
    left: -120px;
    bottom: -140px;
    width: 420px;
    height: 420px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(113,200,245,.14) 0%, rgba(113,200,245,0) 72%);
}

body.sidebar-open {
    overflow: hidden;
}

a { color: var(--c-blue); text-decoration: none; }
a:hover { text-decoration: underline; }

img, svg { display: block; max-width: 100%; }

input, button, textarea, select {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--c-steel); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--c-blue-mid); }

.hidden { display: none !important; }
.page { display: none; }
.page.active { display: flex; }

/* ---- Загрузка ---- */
.loader-screen {
    position: fixed;
    inset: 0;
    background:
        radial-gradient(circle at top, rgba(34, 211, 153, .18) 0%, transparent 35%),
        linear-gradient(160deg, #071923 0%, #0f2e3d 55%, #0b4c55 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
    z-index: 9999;
    transition: opacity .4s ease;
}
.loader-screen.fade-out {
    opacity: 0;
    pointer-events: none;
}
.loader-pulse {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #d7fff5 0%, #7dd3c7 100%);
    animation: pulse-ring 1.4s ease-out infinite;
}
@keyframes pulse-ring {
    0% { transform: scale(.6); opacity: 1; }
    100% { transform: scale(1.8); opacity: 0; }
}
.loader-text {
    color: var(--c-steel-lt);
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
}

/* ========== СТРАНИЦА ВХОДА ========== */

.page-login {
    min-height: 100vh;
    background: transparent;
}
.page-login.active { display: flex; }

.login-container {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

.login-side {
    flex: 0 0 44%;
    background:
        radial-gradient(circle at 18% 14%, rgba(52, 211, 153, .18) 0, transparent 32%),
        linear-gradient(145deg, #09202c 0%, #0f3443 52%, #176b87 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 40px;
    position: relative;
    overflow: hidden;
}
.login-side::after {
    content: '';
    position: absolute;
    right: -40px;
    top: 16%;
    width: 220px;
    height: 220px;
    background: radial-gradient(circle, rgba(212,231,235,.16) 0%, transparent 70%);
    border-radius: 50%;
}

.login-brand {
    text-align: left;
    position: relative;
    z-index: 1;
    width: min(420px, 100%);
    padding: 28px;
    border-radius: 28px;
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.14);
    backdrop-filter: blur(12px);
    box-shadow: 0 18px 40px rgba(4, 15, 22, .2);
}

.login-eyebrow {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 0 12px;
    margin-bottom: 22px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,.16);
    background: rgba(255,255,255,.08);
    color: rgba(255,255,255,.82);
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .16em;
    text-transform: uppercase;
}
.login-logo {
    display: block;
    width: min(270px, 78vw);
    height: auto;
    margin: 0 0 20px;
}
.brand-sub {
    color: rgba(255,255,255,.72);
    font-size: 1rem;
    margin-top: 12px;
    max-width: 320px;
}

.login-highlights {
    width: min(420px, 100%);
    display: grid;
    gap: 12px;
    margin-top: 22px;
    position: relative;
    z-index: 1;
}

.login-highlight-card {
    padding: 16px 18px;
    border-radius: 20px;
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.12);
    color: rgba(255,255,255,.88);
    backdrop-filter: blur(10px);
}

.login-highlight-card strong {
    display: block;
    font-size: .96rem;
    font-weight: 700;
    line-height: 1.45;
}

.login-highlight-label {
    display: inline-block;
    margin-bottom: 6px;
    color: rgba(255,255,255,.62);
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
}

.login-decor {
    position: absolute;
    inset: auto 0 0 auto;
    width: 280px;
    height: 240px;
    pointer-events: none;
}

.decor-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(2px);
}

.decor-orb-lg {
    right: 18px;
    bottom: 28px;
    width: 160px;
    height: 160px;
    background: radial-gradient(circle, rgba(255,255,255,.18) 0%, rgba(255,255,255,0) 72%);
}

.decor-orb-sm {
    right: 140px;
    bottom: 150px;
    width: 72px;
    height: 72px;
    background: radial-gradient(circle, rgba(113,200,245,.42) 0%, rgba(113,200,245,0) 74%);
}

.decor-grid {
    position: absolute;
    right: 20px;
    bottom: 26px;
    width: 124px;
    height: 124px;
    border-radius: 28px;
    border: 1px solid rgba(255,255,255,.12);
    background-image:
        linear-gradient(rgba(255,255,255,.08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.08) 1px, transparent 1px);
    background-size: 18px 18px;
    backdrop-filter: blur(6px);
}

.login-form-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 40px;
    position: relative;
    background:
        radial-gradient(circle at top right, rgba(23,107,135,.08) 0%, transparent 26%),
        linear-gradient(180deg, rgba(255,255,255,.56) 0%, rgba(255,255,255,.22) 100%);
}

.lang-switch {
    position: absolute;
    top: 24px;
    right: 32px;
    display: flex;
    gap: 4px;
    background: rgba(255,255,255,.78);
    border-radius: 999px;
    padding: 4px;
    border: 1px solid rgba(18,48,65,.08);
    box-shadow: 0 10px 24px rgba(18,48,65,.08);
}
.lang-btn {
    border: none;
    background: transparent;
    color: var(--c-text-sec);
    padding: 6px 14px;
    border-radius: 999px;
    cursor: pointer;
    font-size: .8rem;
    font-weight: 600;
    letter-spacing: 1px;
    transition: var(--transition);
}
.lang-btn.active {
    background: var(--c-white);
    color: var(--c-navy);
    box-shadow: 0 8px 18px rgba(18,48,65,.1);
}

#form-login {
    width: 100%;
    max-width: 380px;
    padding: 32px;
    border-radius: 28px;
    background: var(--surface-strong);
    border: 1px solid rgba(255,255,255,.72);
    box-shadow: 0 24px 60px rgba(18,48,65,.12), 0 8px 20px rgba(18,48,65,.06);
    backdrop-filter: blur(12px);
}

.form-kicker {
    display: inline-block;
    margin-bottom: 10px;
    color: var(--c-accent);
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .14em;
    text-transform: uppercase;
}
#form-login h2 {
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: 24px;
    color: var(--c-navy);
    letter-spacing: -.02em;
}

.form-error {
    background: var(--c-red-bg);
    color: var(--c-red);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: .87rem;
    margin-bottom: 16px;
    border-left: 3px solid var(--c-red);
    box-shadow: 0 10px 20px rgba(182,70,75,.08);
}

.field {
    display: block;
    margin-bottom: 20px;
}
.field span {
    display: block;
    font-size: .82rem;
    font-weight: 600;
    color: var(--c-text-sec);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--c-border);
    border-radius: 16px;
    background: rgba(255,255,255,.86);
    font-size: .95rem;
    transition: border-color .18s var(--ease-out), box-shadow .18s var(--ease-out), background-color .18s var(--ease-out), transform .18s var(--ease-out);
    outline: none;
}
.field input:hover,
.field select:hover,
.field textarea:hover {
    border-color: var(--c-steel);
}
.field input:focus,
.field select:focus,
.field textarea:focus {
    border-color: var(--c-accent);
    box-shadow: var(--ring);
    background: var(--c-white);
}
.field input.error,
.field select.error {
    border-color: var(--c-red);
    box-shadow: 0 0 0 3px rgba(193,41,46,.08);
}
.field textarea {
    min-height: 80px;
}

.password-wrap {
    position: relative;
}
.password-wrap input { padding-right: 44px; }
.pw-toggle {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--c-text-muted);
    padding: 6px;
}
.pw-toggle svg { width: 20px; height: 20px; }

/* ---- Кнопки ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 22px;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: .9rem;
    cursor: pointer;
    transition: transform 160ms var(--ease-out), box-shadow 180ms var(--ease-out), border-color 180ms var(--ease-out), background-color 180ms var(--ease-out), color 180ms var(--ease-out);
    text-decoration: none;
    line-height: 1.3;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
    letter-spacing: .2px;
}
.btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0);
    transition: background .18s ease;
}
.btn:hover::before { background: rgba(255,255,255,.08); }
.btn:active { transform: scale(.97); }
.btn svg { width: 18px; height: 18px; flex-shrink: 0; }

.btn-primary {
    background: var(--c-brand-gradient);
    color: var(--c-white);
    box-shadow: var(--shadow-btn);
}
.btn-primary:hover {
    box-shadow: 0 16px 32px rgba(25,118,185,.24);
    transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0) scale(.98); }

.btn-success {
    background: linear-gradient(135deg, var(--c-green) 0%, var(--c-green-hover) 100%);
    color: var(--c-white);
    box-shadow: 0 2px 8px rgba(45,106,79,.2), 0 1px 2px rgba(45,106,79,.15);
}
.btn-success:hover {
    box-shadow: 0 4px 16px rgba(45,106,79,.3), 0 2px 4px rgba(45,106,79,.2);
    transform: translateY(-1px);
}
.btn-success:active { transform: translateY(0) scale(.98); }

.btn-danger {
    background: linear-gradient(135deg, var(--c-red) 0%, #D94B50 100%);
    color: var(--c-white);
    box-shadow: 0 2px 8px rgba(193,41,46,.2), 0 1px 2px rgba(193,41,46,.15);
}
.btn-danger:hover {
    box-shadow: 0 4px 16px rgba(193,41,46,.3), 0 2px 4px rgba(193,41,46,.2);
    transform: translateY(-1px);
}
.btn-danger:active { transform: translateY(0) scale(.98); }

.btn-outline {
    background: rgba(255,255,255,.9);
    color: var(--c-text-sec);
    border: 1px solid var(--c-border);
    box-shadow: 0 6px 16px rgba(18,48,65,.05);
}
.btn-outline:hover {
    border-color: rgba(25,118,185,.28);
    color: var(--c-accent);
    background: #f5fbff;
    box-shadow: 0 12px 24px rgba(18,48,65,.08);
}

.btn-sm { padding: 7px 14px; font-size: .82rem; border-radius: 6px; }

.btn-login {
    width: 100%;
    padding: 14px;
    font-size: 1rem;
    margin-top: 12px;
    border-radius: var(--radius-sm);
    letter-spacing: .3px;
}

.btn:disabled, .btn[disabled] {
    opacity: .5;
    pointer-events: none;
    filter: grayscale(.3);
}

.btn-loading::after {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .6s linear infinite;
    margin-left: 8px;
}

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

.btn-icon {
    padding: 8px;
    background: transparent;
    color: var(--c-text-muted);
    border-radius: 6px;
}
.btn-icon:hover {
    background: var(--c-bg-alt);
    color: var(--c-text);
}

/* ========== ОСНОВНОЙ ИНТЕРФЕЙС ========== */

.page-app {
    min-height: 100vh;
}
.page-app.active { display: flex; }

/* ---- Sidebar ---- */
.sidebar {
    width: var(--sidebar-w);
    height: 100vh;
    height: 100dvh;
    background: linear-gradient(180deg, rgba(16,46,71,.98) 0%, rgba(20,66,99,.96) 100%);
    border-right: 1px solid rgba(255,255,255,.10);
    box-shadow: 16px 0 40px rgba(24,72,106,.13);
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 100;
    transition: width .22s var(--ease-out), transform .24s var(--ease-out);
    overflow: hidden;
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(6, 21, 41, .48);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity var(--transition), visibility var(--transition);
    z-index: 90;
}

.sidebar-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    min-width: 0;
}
.sidebar-logo {
    display: block;
    width: 132px;
    height: auto;
    transition: width .22s var(--ease-out), opacity .16s var(--ease-out);
}
.sidebar-logo-compact {
    display: none;
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.sidebar-collapse {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255,255,255,.14);
    border-radius: 11px;
    background: rgba(255,255,255,.08);
    color: rgba(255,255,255,.88);
    cursor: pointer;
    flex-shrink: 0;
    transition: background-color 160ms var(--ease-out), color 160ms var(--ease-out), transform 160ms var(--ease-out);
}
.sidebar-collapse:hover { background: rgba(255,255,255,.16); color: var(--c-white); }
.sidebar-collapse:active { transform: scale(.96); }
.sidebar-collapse svg { width: 18px; height: 18px; transition: transform .22s var(--ease-out); }

.sidebar-close {
    display: none;
    background: none;
    border: none;
    color: var(--c-steel);
    cursor: pointer;
    padding: 4px;
}
.sidebar-close svg { width: 22px; height: 22px; }

.sidebar-nav {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 18px 14px;
}

.nav-section {
    margin-bottom: 8px;
}
.nav-label {
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(212,231,235,.52);
    padding: 0 12px;
    margin-bottom: 8px;
    font-weight: 600;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: 16px;
    color: rgba(255,255,255,.74);
    font-size: .88rem;
    font-weight: 500;
    cursor: pointer;
    transition: transform 160ms var(--ease-out), background-color 180ms var(--ease-out), color 180ms var(--ease-out), box-shadow 180ms var(--ease-out);
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    position: relative;
}
.nav-item:hover {
    background: rgba(255,255,255,.07);
    color: var(--c-white);
    transform: translateX(2px);
}
.nav-item.active {
    background: linear-gradient(135deg, rgba(25,118,185,.98) 0%, rgba(113,200,245,.88) 100%);
    color: var(--c-white);
    box-shadow: 0 14px 26px rgba(11,79,132,.28);
}
.nav-item svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    opacity: .8;
}
.nav-item.active svg { opacity: 1; }

.sidebar-bottom {
    padding: 16px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid rgba(255,255,255,.08);
    flex-shrink: 0;
    background: inherit;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}
.btn-sidebar-secondary {
    width: 100%;
    margin-bottom: 10px;
    padding: 10px 14px;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,.12);
    background: rgba(255,255,255,.06);
    color: var(--c-white);
    font-size: .85rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}
.btn-sidebar-secondary:hover {
    background: rgba(255,255,255,.12);
}
.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 14px;
    background: linear-gradient(135deg, #1976b9 0%, #70c7f5 100%);
    color: var(--c-white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .85rem;
    flex-shrink: 0;
}
.user-name {
    color: var(--c-white);
    font-weight: 600;
    font-size: .85rem;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 150px;
}
.user-role {
    color: var(--c-text-muted);
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.btn-logout {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 14px;
    border: none;
    border-radius: 14px;
    background: rgba(182,70,75,.12);
    color: #f0a5aa;
    cursor: pointer;
    font-size: .85rem;
    font-weight: 500;
    transition: var(--transition);
}
.btn-logout:hover {
    background: rgba(182,70,75,.2);
}
.btn-logout svg { width: 18px; height: 18px; flex-shrink: 0; }

/* ---- Topbar ---- */
.main-content {
    margin-left: var(--sidebar-w);
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    isolation: isolate;
    transition: margin-left .22s var(--ease-out);
}

body.sidebar-collapsed .sidebar { width: var(--sidebar-collapsed-w); }
body.sidebar-collapsed .main-content { margin-left: var(--sidebar-collapsed-w); }
body.sidebar-collapsed .sidebar-top { justify-content: center; gap: 4px; padding-left: 4px; padding-right: 4px; }
body.sidebar-collapsed .sidebar-brand { width: 32px; opacity: 1; overflow: hidden; }
body.sidebar-collapsed .sidebar-logo { width: 0; }
body.sidebar-collapsed .sidebar-logo-compact { display: block; }
body.sidebar-collapsed .sidebar-collapse svg { transform: rotate(180deg); }
body.sidebar-collapsed .sidebar-nav { padding-left: 10px; padding-right: 10px; }
body.sidebar-collapsed .nav-label,
body.sidebar-collapsed .nav-item span,
body.sidebar-collapsed .user-info,
body.sidebar-collapsed .btn-sidebar-secondary,
body.sidebar-collapsed .btn-logout { display: none; }
body.sidebar-collapsed .nav-item { justify-content: center; padding-left: 10px; padding-right: 10px; }
body.sidebar-collapsed .nav-item:hover { transform: none; }
body.sidebar-collapsed .sidebar-bottom { padding-left: 20px; padding-right: 20px; }
body.sidebar-collapsed .sidebar-user { justify-content: center; margin-bottom: 0; }

.topbar {
    height: var(--topbar-h);
    background: rgba(255,255,255,.92);
    border-bottom: 1px solid rgba(86,143,181,.16);
    display: flex;
    align-items: center;
    padding: 0 28px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 80;
    box-shadow: var(--shadow-up);
    backdrop-filter: blur(14px);
}
.topbar-menu {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--c-text-sec);
    padding: 8px;
    min-width: 44px;
    min-height: 44px;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
    touch-action: manipulation;
}
.topbar-menu svg { width: 24px; height: 24px; }

.topbar-title {
    flex: 1;
    min-width: 0;
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--c-navy);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topbar-right {
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

.lang-switch-sm {
    display: flex;
    gap: 2px;
    background: rgba(255,255,255,.84);
    border-radius: 999px;
    padding: 3px;
    border: 1px solid rgba(18,48,65,.08);
}
.lang-btn-sm {
    border: none;
    background: transparent;
    color: var(--c-text-muted);
    padding: 4px 10px;
    border-radius: 999px;
    cursor: pointer;
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .5px;
    transition: var(--transition);
}
.lang-btn-sm.active {
    background: var(--c-white);
    color: var(--c-navy);
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
}

/* ---- Content Area ---- */
.content-area {
    padding: 28px 32px;
    flex: 1;
    max-width: 1400px;
    position: relative;
    z-index: 0;
    width: 100%;
}

.content-area::before {
    content: '';
    position: absolute;
    inset: 12px 18px auto;
    height: 180px;
    border-radius: 32px;
    background: linear-gradient(135deg, rgba(255,255,255,.4) 0%, rgba(221,242,241,.38) 100%);
    border: 1px solid rgba(255,255,255,.45);
    z-index: -1;
}

/* ---- Cards ---- */
.card {
    background: var(--c-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 28px;
    margin-bottom: 20px;
    border: 1px solid rgba(255,255,255,.66);
    backdrop-filter: blur(10px);
    transition: transform .18s var(--ease-out), box-shadow .22s var(--ease-out), border-color .22s var(--ease-out);
}
.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 40px rgba(18,48,65,.1), 0 6px 18px rgba(18,48,65,.05);
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 12px;
}
.card-title {
    font-size: 1.08rem;
    font-weight: 800;
    color: var(--c-navy);
    letter-spacing: -.01em;
}
.card-subtitle {
    font-size: .82rem;
    color: var(--c-text-muted);
    margin-top: 4px;
}

/* ---- Stats ---- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
    margin-bottom: 28px;
}
.stat-card {
    background: linear-gradient(180deg, rgba(255,255,255,.92) 0%, rgba(255,255,255,.82) 100%);
    border-radius: var(--radius);
    padding: 22px 24px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(255,255,255,.72);
    border-left: 4px solid var(--c-blue);
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: transform .18s var(--ease-out), box-shadow .2s var(--ease-out), border-color .2s var(--ease-out);
    position: relative;
    overflow: hidden;
}
.stat-card::after {
    content: '';
    position: absolute;
    right: -20px;
    bottom: -20px;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(19,64,116,.03);
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}
.stat-card.green { border-left-color: var(--c-green); }
.stat-card.orange { border-left-color: var(--c-orange); }
.stat-card.red { border-left-color: var(--c-red); }

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--c-navy);
    line-height: 1;
    letter-spacing: -.02em;
}
.stat-label {
    font-size: .78rem;
    color: var(--c-text-muted);
    text-transform: uppercase;
    letter-spacing: .6px;
    font-weight: 600;
}

/* ---- Tables ---- */
.table-wrap {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    border-radius: var(--radius);
    border: 1px solid rgba(105,138,152,.18);
    box-shadow: 0 10px 24px rgba(18,48,65,.05);
    background: rgba(255,255,255,.7);
    backdrop-filter: blur(8px);
}
.table-wrap table {
    width: max-content;
    min-width: 100%;
}
.school-section-card-header {
    padding-bottom: 8px;
}
.school-section-filters-wrap {
    padding: 10px 20px 18px;
}
.school-section-filters {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
    padding: 14px;
    border: 1px solid rgba(203, 213, 225, .9);
    border-radius: 16px;
    background: linear-gradient(180deg, #f8fbff 0%, #f4f7fb 100%);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.85);
}
.school-section-filter-control {
    min-height: 42px;
    padding: 9px 14px;
    border: 1px solid #d7e1ee;
    border-radius: 12px;
    background: rgba(255,255,255,.95);
    font-size: 13px;
    color: var(--c-navy);
    transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}
.school-section-filter-control:focus {
    outline: none;
    border-color: #9bb6d6;
    box-shadow: 0 0 0 4px rgba(141, 169, 196, .18);
    background: #fff;
}
.school-section-filter-search {
    width: min(360px, 100%);
    flex: 1 1 260px;
}
.school-section-class,
.school-section-disp {
    min-width: 180px;
}
.school-section-reset {
    min-height: 42px;
    padding: 0 16px;
    border-radius: 12px;
}
table {
    width: 100%;
    border-collapse: collapse;
    font-size: .88rem;
}
thead {
    background: rgba(233,240,236,.86);
}
th {
    text-align: left;
    padding: 13px 16px;
    font-weight: 700;
    font-size: .76rem;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: var(--c-text-sec);
    border-bottom: 1px solid rgba(105,138,152,.18);
    white-space: nowrap;
}
td {
    padding: 13px 16px;
    border-bottom: 1px solid rgba(209,218,230,.6);
    vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr {
    transition: background-color .15s ease, transform .15s ease;
}
tbody tr:hover {
    background: rgba(23,107,135,.045);
}

/* ---- Badges ---- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .3px;
    gap: 4px;
}
.badge-green {
    background: var(--c-green-bg);
    color: var(--c-green);
    border: 1px solid rgba(45,106,79,.12);
}
.badge-red {
    background: var(--c-red-bg);
    color: var(--c-red);
    border: 1px solid rgba(193,41,46,.12);
}
.badge-orange {
    background: var(--c-orange-bg);
    color: var(--c-orange);
    border: 1px solid rgba(231,111,81,.12);
}
.badge-blue {
    background: var(--c-ice);
    color: var(--c-blue);
    border: 1px solid rgba(19,64,116,.1);
}

/* ---- Form layout ---- */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
}
.form-grid .field { margin-bottom: 0; }
.form-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}
.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--c-border);
}
.form-actions .btn {
    min-width: 180px;
}

/* ---- Search ---- */
.search-bar {
    display: flex;
    gap: 12px;
    align-items: stretch;
    margin-bottom: 24px;
}
.search-bar input {
    flex: 1;
    padding: 12px 18px;
    border: 1.5px solid var(--c-border);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    outline: none;
    transition: all .2s ease;
    background: var(--c-white);
    box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.search-bar input:hover {
    border-color: var(--c-steel);
}
.search-bar input:focus {
    border-color: var(--c-accent);
    box-shadow: 0 0 0 3px rgba(59,130,246,.12);
}
.search-bar .btn {
    flex-shrink: 0;
    min-width: 120px;
}

/* ---- Patient Info Card ---- */
.patient-card {
    background: linear-gradient(145deg, #0a1e2b 0%, #123041 48%, #176b87 100%);
    border-radius: var(--radius);
    padding: 32px;
    color: var(--c-white);
    margin-bottom: 24px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 22px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(10,30,43,.24);
}
.patient-card::before {
    content: '';
    position: absolute;
    right: -60px;
    top: -60px;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(141,169,196,.08) 0%, transparent 70%);
    border-radius: 50%;
}
.patient-card::after {
    content: '';
    position: absolute;
    right: -40px;
    bottom: -40px;
    width: 180px;
    height: 180px;
    border: 2px solid rgba(141,169,196,.08);
    border-radius: 50%;
}

.patient-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.patient-field-label {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--c-steel);
    font-weight: 600;
}
.patient-field-value {
    font-size: 1rem;
    font-weight: 600;
}
.patient-name {
    grid-column: 1 / -1;
}
.patient-name .patient-field-value {
    font-size: 1.4rem;
    font-weight: 700;
}

.patient-status {
    grid-column: 1 / -1;
    display: flex;
    gap: 12px;
    align-items: center;
    padding-top: 12px;
    border-top: 1px solid rgba(141,169,196,.15);
}

/* ---- Checkbox toggle ---- */
.toggle-wrap {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 8px 0;
}
.toggle-label {
    font-size: .9rem;
    font-weight: 600;
    color: var(--c-text-sec);
    user-select: none;
    transition: color .2s ease;
}
.toggle-wrap:has(.toggle input:checked) .toggle-label {
    color: var(--c-green);
}
.toggle {
    position: relative;
    width: 52px;
    height: 28px;
    flex-shrink: 0;
}
.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}
.toggle-slider {
    position: absolute;
    inset: 0;
    background: #C5CDD8;
    border-radius: 28px;
    cursor: pointer;
    transition: all .3s cubic-bezier(.4,0,.2,1);
    box-shadow: inset 0 1px 3px rgba(0,0,0,.1);
}
.toggle-slider::before {
    content: '';
    position: absolute;
    left: 3px;
    top: 3px;
    width: 22px;
    height: 22px;
    background: var(--c-white);
    border-radius: 50%;
    transition: all .3s cubic-bezier(.4,0,.2,1);
    box-shadow: 0 1px 4px rgba(0,0,0,.18), 0 0 1px rgba(0,0,0,.1);
}
.toggle-slider:hover {
    background: #B0B9C6;
}
.toggle input:checked + .toggle-slider {
    background: var(--c-green);
    box-shadow: inset 0 1px 3px rgba(0,0,0,.05), 0 0 8px rgba(45,106,79,.2);
}
.toggle input:checked + .toggle-slider:hover {
    background: var(--c-green-hover);
}
.toggle input:checked + .toggle-slider::before {
    transform: translateX(24px);
}
.toggle input:focus-visible + .toggle-slider {
    outline: 2px solid var(--c-accent);
    outline-offset: 2px;
}

/* ---- Empty state ---- */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--c-text-muted);
}
.empty-state svg {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    opacity: .4;
}
.empty-state h3 {
    font-size: 1.1rem;
    margin-bottom: 8px;
    color: var(--c-text-sec);
}
.empty-state p {
    font-size: .88rem;
}

/* ---- Modal ---- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10,30,43,.42);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    backdrop-filter: blur(4px);
    animation: fade-in .18s ease;
}
.modal-overlay.hidden { display: none; }

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal {
    background: rgba(255,255,255,.94);
    border-radius: var(--radius);
    box-shadow: 0 28px 70px rgba(10,30,43,.22), 0 6px 16px rgba(10,30,43,.08);
    width: 90%;
    max-width: 520px;
    max-height: 85vh;
    overflow-y: auto;
    animation: modal-up .22s var(--ease-out);
    border: 1px solid rgba(255,255,255,.75);
    backdrop-filter: blur(16px);
}

.modal:has(.checklist-modal) {
    width: min(1500px, calc(100vw - 32px));
    max-width: min(1500px, calc(100vw - 32px));
}
.modal:has(.higo-exam-modal) {
    max-width: 1120px;
}
@keyframes modal-up {
    from { transform: translateY(20px) scale(.98); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 0;
}
.modal-header h3 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--c-navy);
}
.modal-close-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--c-text-muted);
    padding: 4px;
    border-radius: 4px;
    transition: var(--transition);
}
.modal-close-btn:hover { background: var(--c-bg-alt); }
.modal-close-btn svg { width: 22px; height: 22px; }

.modal-body { padding: 20px 24px; }
.modal-footer {
    padding: 0 24px 20px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.checklist-modal {
    width: 100%;
    max-width: none;
}

.checklist-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 20px;
    border: 1px solid rgba(11,37,69,.08);
    border-radius: 18px;
    background:
        radial-gradient(circle at top right, rgba(79, 209, 197, .18), transparent 36%),
        linear-gradient(135deg, #f8fbff 0%, #eef6ff 100%);
}

.checklist-hero-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 800;
    color: var(--c-navy);
}

.checklist-hero-text {
    margin: 6px 0 0;
    color: var(--c-text-muted);
    font-size: .9rem;
    line-height: 1.5;
}

.checklist-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    margin-top: 18px;
}

.checklist-section {
    border: 1px solid rgba(11,37,69,.08);
    border-radius: 18px;
    overflow: hidden;
    background: var(--c-white);
    box-shadow: 0 8px 24px rgba(15, 23, 42, .05);
}

.checklist-section-header {
    padding: 14px 16px;
    background: linear-gradient(135deg, #0b2545 0%, #134074 100%);
    color: #fff;
}

.checklist-section-title {
    margin: 0;
    font-size: .95rem;
    font-weight: 800;
    letter-spacing: .02em;
}

.checklist-table {
    width: 100%;
    border-collapse: collapse;
}

.checklist-table th,
.checklist-table td {
    padding: 12px 14px;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: top;
}

.checklist-table th {
    font-size: .76rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--c-text-muted);
    background: #f8fafc;
}

.checklist-table tr:last-child td {
    border-bottom: none;
}

.checklist-question {
    color: #1e293b;
    font-size: .89rem;
    line-height: 1.45;
}

.checklist-answer-cell {
    width: 110px;
    white-space: nowrap;
}

.checklist-choice {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-right: 10px;
    color: #334155;
    font-size: .84rem;
    cursor: pointer;
}

.checklist-choice input[type="radio"] {
    accent-color: #0ea5a6;
}

.checklist-meta {
    margin-top: 14px;
    font-size: .82rem;
    color: var(--c-text-muted);
}

.higo-empty-state {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 20px;
    border: 1px dashed #cbd5e1;
    border-radius: 18px;
    background: linear-gradient(135deg, #f8fbff 0%, #ffffff 100%);
    color: #64748b;
}

.higo-empty-icon {
    width: 54px;
    height: 54px;
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(19,64,116,.08);
    color: var(--c-blue);
    flex-shrink: 0;
}

.higo-empty-icon svg {
    width: 26px;
    height: 26px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.7;
}

.higo-empty-title {
    font-weight: 800;
    color: var(--c-navy);
    margin-bottom: 4px;
}

.higo-empty-text {
    font-size: .88rem;
    line-height: 1.55;
}

.higo-results-table-wrap {
    border-radius: 18px;
    overflow: hidden;
}

.higo-results-table tbody tr {
    cursor: pointer;
}

.higo-result-main {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.higo-result-icon {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, rgba(19,64,116,.1) 0%, rgba(141,169,196,.18) 100%);
    color: var(--c-blue);
    flex-shrink: 0;
}

.higo-result-icon svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.higo-result-title {
    font-size: .75rem;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: #64748b;
    margin-bottom: 4px;
}

.higo-result-summary {
    color: var(--c-navy);
    font-weight: 700;
    line-height: 1.45;
}

.higo-result-date,
.higo-result-device {
    font-weight: 600;
    color: #1e293b;
}

.higo-result-meta {
    margin-top: 4px;
    font-size: .75rem;
    color: #64748b;
}

.higo-result-muted {
    color: #94a3b8;
    font-size: .82rem;
}

.higo-kpi-list {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.higo-kpi-chip {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    background: #eef6ff;
    color: var(--c-blue);
    font-size: .76rem;
    font-weight: 700;
    line-height: 1.2;
}

.higo-result-actions {
    text-align: right;
}

.higo-exam-modal {
    display: grid;
    gap: 18px;
}

.higo-exam-hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 22px;
    border: 1px solid rgba(11,37,69,.08);
    border-radius: 20px;
    background:
        radial-gradient(circle at top right, rgba(79,209,197,.18), transparent 34%),
        linear-gradient(135deg, #f8fbff 0%, #edf5ff 100%);
}

.higo-exam-hero-main {
    display: flex;
    align-items: center;
    gap: 14px;
}

.higo-exam-hero-icon {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, #0b2545 0%, #134074 100%);
    color: #fff;
    box-shadow: 0 12px 24px rgba(19,64,116,.18);
    flex-shrink: 0;
}

.higo-exam-hero-icon svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.higo-exam-hero-title {
    font-size: .78rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #64748b;
    margin-bottom: 4px;
}

.higo-exam-hero-subtitle {
    font-size: 1rem;
    font-weight: 800;
    color: var(--c-navy);
    line-height: 1.45;
}

.higo-detail-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
}

.higo-detail-stat {
    border: 1px solid rgba(11,37,69,.08);
    border-radius: 16px;
    padding: 14px 16px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(15,23,42,.04);
}

.higo-detail-stat-label {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #64748b;
    font-weight: 700;
    margin-bottom: 6px;
}

.higo-detail-stat-value {
    color: var(--c-navy);
    font-weight: 700;
    line-height: 1.45;
    word-break: break-word;
}

.higo-detail-section {
    border: 1px solid rgba(11,37,69,.08);
    border-radius: 18px;
    padding: 18px;
    background: #fff;
}

.higo-detail-section-title {
    margin-bottom: 14px;
    font-size: .95rem;
    font-weight: 800;
    color: var(--c-navy);
}

.higo-detail-text {
    color: #334155;
    line-height: 1.7;
    white-space: pre-wrap;
}

.higo-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.higo-detail-tile {
    border-radius: 14px;
    padding: 14px 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.higo-detail-tile span {
    font-size: .74rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #64748b;
    font-weight: 700;
}

.higo-detail-tile strong {
    color: var(--c-navy);
    line-height: 1.45;
}

.higo-detail-checklist {
    display: grid;
    gap: 10px;
}

.higo-detail-check-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 14px;
    background: #f8fbff;
    border: 1px solid #dbeafe;
    color: #1e293b;
    line-height: 1.55;
}

.higo-detail-check-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #dbeafe;
    color: #1d4ed8;
    font-size: .82rem;
    font-weight: 900;
    flex-shrink: 0;
}

.higo-subexam-list {
    display: grid;
    gap: 12px;
}

.higo-subexam {
    border: 1px solid #dbe7f4;
    border-radius: 16px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    overflow: hidden;
}

.higo-subexam-summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 16px 18px;
}

.higo-subexam-summary::-webkit-details-marker {
    display: none;
}

.higo-subexam-title-wrap {
    display: grid;
    gap: 4px;
}

.higo-subexam-title {
    color: var(--c-navy);
    font-weight: 800;
    font-size: .95rem;
    line-height: 1.3;
}

.higo-subexam-meta {
    color: #64748b;
    font-size: .8rem;
    line-height: 1.45;
}

.higo-subexam-chevron {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #eaf2ff;
    color: var(--c-blue);
    font-size: 1rem;
    font-weight: 900;
    flex-shrink: 0;
    transition: transform .2s ease, background .2s ease;
}

.higo-subexam[open] .higo-subexam-chevron {
    transform: rotate(45deg);
    background: #dbeafe;
}

.higo-subexam-body {
    padding: 0 18px 18px;
    display: grid;
    gap: 14px;
}

.higo-subexam-media-title {
    color: var(--c-navy);
    font-size: .86rem;
    font-weight: 800;
    margin-top: 4px;
}

.higo-photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}

.higo-photo-card {
    margin: 0;
    overflow: hidden;
    border-radius: 16px;
    border: 1px solid #dbe5f0;
    background: #fff;
    box-shadow: 0 10px 24px rgba(15,23,42,.05);
}

.higo-photo-card-image {
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.higo-photo-card-image:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 34px rgba(15,23,42,.12);
    border-color: #bfd3ea;
}

.higo-photo-card img {
    display: block;
    width: 100%;
    height: 210px;
    object-fit: cover;
    background: #eff6ff;
    transition: transform .22s ease;
}

.higo-photo-card-image:hover img {
    transform: scale(1.14);
}

.higo-photo-card figcaption {
    padding: 12px 14px;
    color: #475569;
    font-size: .82rem;
    line-height: 1.45;
}
.higo-photo-card > a {
    display: block;
    padding: 0 14px 14px;
    color: #1d4e89;
    font-weight: 600;
    text-decoration: none;
}
.higo-photo-card > a:hover {
    text-decoration: underline;
}
.higo-media-card {
    display: grid;
    gap: 10px;
    padding: 14px;
}
.higo-media-card .higo-subexam-media-title {
    margin: 0;
}
.higo-media-card audio,
.higo-media-card video {
    width: 100%;
    display: block;
    border-radius: 14px;
    background: #f8fafc;
}
.higo-media-card figcaption {
    padding: 0;
    color: #64748b;
}
.higo-media-card > a {
    padding: 0;
}
.higo-media-card-video video {
    min-height: 180px;
    object-fit: contain;
    background: #e2e8f0;
}

/* ---- Modal confirm (для Д-учёта) ---- */
.confirm-modal {
    text-align: center;
}
.confirm-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--c-orange-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}
.confirm-icon svg {
    width: 32px;
    height: 32px;
    color: var(--c-orange);
}
.confirm-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--c-navy);
    margin-bottom: 8px;
}
.confirm-text {
    color: var(--c-text-sec);
    font-size: .92rem;
    margin-bottom: 24px;
    line-height: 1.6;
}

/* ---- Toast ---- */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}
.toast {
    background: rgba(10,30,43,.9);
    color: var(--c-white);
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    box-shadow: 0 8px 32px rgba(6,21,41,.3), 0 2px 8px rgba(6,21,41,.2);
    font-size: .88rem;
    font-weight: 500;
    min-width: 300px;
    max-width: 440px;
    display: flex;
    align-items: center;
    gap: 10px;
    pointer-events: auto;
    animation: toast-in .35s cubic-bezier(.34,1.56,.64,1);
    border-left: 4px solid rgba(212,231,235,.8);
    backdrop-filter: blur(8px);
}
.toast.success { border-left-color: var(--c-green); }
.toast.error { border-left-color: var(--c-red); }
.toast.warning { border-left-color: var(--c-orange); }

@keyframes toast-in {
    from { transform: translateX(40px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
.toast.fade-out {
    animation: toast-out .3s ease forwards;
}
@keyframes toast-out {
    to { transform: translateX(40px); opacity: 0; }
}

/* ---- Exam History Timeline ---- */
.exam-timeline {
    position: relative;
    padding-left: 28px;
}
.exam-timeline::before {
    content: '';
    position: absolute;
    left: 9px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(180deg, var(--c-border) 0%, rgba(209,218,230,.3) 100%);
}
.exam-item {
    position: relative;
    padding: 18px 0 18px 18px;
    border-bottom: 1px solid rgba(227,234,242,.6);
    transition: background .15s ease;
}
.exam-item:hover {
    background: rgba(19,64,116,.015);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.exam-item:last-child { border-bottom: none; }
.exam-item::before {
    content: '';
    position: absolute;
    left: -23px;
    top: 24px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--c-blue);
    border: 2.5px solid var(--c-white);
    box-shadow: 0 0 0 2px var(--c-border);
    transition: transform .2s ease;
}
.exam-item:hover::before {
    transform: scale(1.15);
}
.exam-item.dispensary::before {
    background: var(--c-orange);
    box-shadow: 0 0 0 2px var(--c-orange-bg);
}

.exam-doctor {
    font-weight: 700;
    font-size: .88rem;
    color: var(--c-navy);
    margin-bottom: 4px;
}
.exam-role {
    font-size: .75rem;
    color: var(--c-text-muted);
    text-transform: uppercase;
    letter-spacing: .5px;
}
.exam-diagnosis {
    margin-top: 10px;
    padding: 12px 16px;
    background: var(--c-bg);
    border-radius: var(--radius-sm);
    font-size: .88rem;
    line-height: 1.55;
    border-left: 3px solid var(--c-ice);
}
.exam-date {
    margin-top: 8px;
    font-size: .78rem;
    color: var(--c-text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ---- RESPONSIVE ---- */

@media (max-width: 1024px) {
    :root {
        --sidebar-w: 300px;
    }
    .sidebar {
        transform: translateX(-100%);
        z-index: 160;
    }
    .sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-lg);
    }
    .sidebar-backdrop {
        display: block;
        z-index: 150;
    }
    .sidebar-backdrop.active {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }
    .sidebar-close {
        display: block;
    }
    .sidebar-collapse {
        display: none;
    }
    .topbar-menu {
        display: inline-flex;
    }
    .topbar {
        z-index: 140;
    }
    .main-content {
        margin-left: 0;
    }
    .content-area {
        padding: 24px;
        max-width: none;
    }
    .card {
        padding: 22px;
    }
    .card-header {
        align-items: flex-start;
        flex-wrap: wrap;
    }
    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 16px;
    }
    .form-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .search-bar {
        flex-wrap: wrap;
    }
    .search-bar .btn {
        min-width: 0;
    }
    .table-wrap {
        margin-inline: -2px;
    }
    .table-wrap table {
        min-width: 720px;
    }
    th, td {
        padding: 12px 14px;
    }
    .modal {
        width: min(96vw, 960px);
    }
}

@media (max-width: 768px) {
    .login-container {
        flex-direction: column;
    }
    .login-side {
        flex: 0 0 auto;
        padding: 40px 24px;
        min-height: 200px;
    }
    .login-highlights,
    .login-decor { display: none; }
    .login-form-wrap { padding: 32px 24px; }
    .login-logo { width: min(240px, 78vw); }
    .login-brand,
    #form-login { border-radius: 24px; }

    .sidebar {
        width: min(86vw, 320px);
    }
    .topbar {
        padding: 0 18px;
        gap: 12px;
    }
    .topbar-title {
        font-size: 1rem;
    }
    .content-area {
        padding: 16px;
    }
    .card {
        padding: 18px;
        margin-bottom: 16px;
    }
    .card-header {
        margin-bottom: 16px;
    }
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }
    .patient-card {
        grid-template-columns: 1fr;
        padding: 22px 18px;
        gap: 16px;
    }
    .form-grid,
    .checklist-grid {
        grid-template-columns: 1fr;
    }
    .form-row,
    .search-bar,
    .form-actions,
    .modal-footer,
    .patient-status {
        flex-direction: column;
        align-items: stretch;
    }
    .form-actions,
    .modal-footer {
        gap: 10px;
    }
    .form-actions .btn,
    .modal-footer .btn,
    .search-bar .btn {
        width: 100%;
        min-width: 0;
    }
    .field {
        margin-bottom: 16px;
    }
    .school-section-filters-wrap {
        padding: 8px 0 16px;
    }
    .school-section-filters {
        padding: 12px;
        border-radius: 14px;
    }
    .table-wrap {
        border-radius: 14px;
    }
    .table-wrap table {
        min-width: 640px;
    }
    th, td {
        padding: 11px 12px;
        font-size: .84rem;
    }
    .higo-exam-hero { flex-direction: column; }
    .higo-result-actions { text-align: left; }
    .school-section-filter-search,
    .school-section-class,
    .school-section-disp,
    .school-section-reset { width: 100%; }

    .modal {
        width: 95%;
        max-height: 90vh;
    }
    .modal-header,
    .modal-body,
    .modal-footer {
        padding-left: 18px;
        padding-right: 18px;
    }
}

@media (max-width: 480px) {
    html { font-size: 14px; }
    .stat-card { padding: 16px; }
    .stat-value { font-size: 1.4rem; }
    .card { padding: 16px; }
    .topbar { padding: 0 16px; }
    .lang-switch-sm {
        display: none;
    }
    .sidebar-top,
    .sidebar-bottom {
        padding-left: 14px;
        padding-right: 14px;
    }
    .nav-item {
        padding: 10px 12px;
    }
    .table-wrap table {
        min-width: 560px;
    }
    th, td {
        padding: 10px 11px;
    }
    .higo-empty-state { align-items: flex-start; }
    .higo-exam-hero-main { align-items: flex-start; }
    .higo-photo-card img { height: 180px; }
    #form-login {
        padding: 24px 20px;
    }
}

@media (hover: hover) and (pointer: fine) {
    .btn:hover,
    .btn-sidebar-secondary:hover,
    .nav-item:hover,
    .card:hover,
    .stat-card:hover,
    .higo-photo-card-image:hover {
        will-change: transform;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }

    .btn:hover,
    .nav-item:hover,
    .card:hover,
    .stat-card:hover,
    .higo-photo-card-image:hover {
        transform: none !important;
    }
}

/* ---- Print ---- */
@media print {
    .sidebar, .topbar, .btn-logout, .lang-switch-sm,
    .modal-overlay, .toast-container { display: none !important; }
    .main-content { margin-left: 0; }
    .content-area { padding: 0; }
    .card { box-shadow: none; border: 1px solid #ccc; }
    .checklist-grid { grid-template-columns: 1fr; }
    .checklist-answer-cell { width: auto; }
    .checklist-choice { display: flex; margin: 0 0 8px; }
}

/* =============================================
   ДОКУМЕНТАЦИЯ / ПОМОЩЬ
   ============================================= */

.doc-section { }

.doc-section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--c-ice);
}

.doc-icon {
    font-size: 28px;
    flex-shrink: 0;
}

.doc-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--c-navy);
    margin: 0;
}

.doc-steps {
    list-style: none;
    counter-reset: doc-step;
    padding: 0;
    margin: 0;
}

.doc-steps li {
    counter-increment: doc-step;
    position: relative;
    padding: 10px 0 10px 44px;
    font-size: .92rem;
    line-height: 1.6;
    border-bottom: 1px solid var(--c-bg);
}

.doc-steps li:last-child {
    border-bottom: none;
}

.doc-steps li::before {
    content: counter(doc-step);
    position: absolute;
    left: 0;
    top: 10px;
    width: 28px;
    height: 28px;
    background: var(--c-blue);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .78rem;
    font-weight: 700;
}

.doc-tip {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin-top: 16px;
    padding: 12px 16px;
    background: var(--c-bg);
    border-radius: 10px;
    font-size: .87rem;
    line-height: 1.6;
    border-left: 3px solid var(--c-steel);
}

.doc-tip-icon {
    font-size: 20px;
    flex-shrink: 0;
}

/* Блок порядка работы */
.doc-flow {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    padding: 16px 0;
}

.doc-flow-step {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--c-bg);
    padding: 10px 16px;
    border-radius: 10px;
    font-size: .88rem;
    font-weight: 500;
}

.doc-flow-num {
    width: 26px;
    height: 26px;
    background: var(--c-blue);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .78rem;
    font-weight: 700;
    flex-shrink: 0;
}

.doc-flow-arrow {
    color: var(--c-steel);
    font-size: 1.2rem;
    font-weight: 700;
}

@media (max-width: 600px) {
    .doc-flow {
        flex-direction: column;
    }
    .doc-flow-arrow {
        transform: rotate(90deg);
    }
}
