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

:root {
    /* Brand (do not change without approval) */
    --primary-color: #62C062;
    --primary-dark: #55a855;
    --primary-rgb: 98, 192, 98;
    --text-color: #333;
    --text-light: #5A5A5A;
    --background: #F9F9F9;
    --white: #FFFFFF;
    --border: #C2C2C2;
    --error: #e74c3c;
    --success: #27ae60;

    /* Surfaces & neutrals */
    --surface: #FFFFFF;
    --surface-muted: #F3F6F3;
    --surface-tint: #F5FAF5;
    --border-subtle: #E6E8E6;
    --border-strong: #C2C2C2;
    --text-muted: #7A7A7A;
    --primary-soft: rgba(98, 192, 98, 0.12);
    --primary-soft-strong: rgba(98, 192, 98, 0.22);
    --error-soft: rgba(231, 76, 60, 0.1);
    --success-soft: rgba(39, 174, 96, 0.12);
    --info: #2f80ed;
    --info-soft: rgba(47, 128, 237, 0.12);

    /* Atmosphere (within palette) */
    --bg-atmosphere:
        radial-gradient(1200px 480px at 8% -10%, rgba(98, 192, 98, 0.09), transparent 55%),
        radial-gradient(900px 420px at 100% 0%, rgba(98, 192, 98, 0.05), transparent 50%),
        var(--background);

    /* Spacing */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;
    --space-7: 48px;

    /* Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-pill: 999px;

    /* Shadow */
    --shadow-sm: 0 1px 2px rgba(51, 51, 51, 0.04), 0 1px 3px rgba(51, 51, 51, 0.03);
    --shadow-md: 0 4px 12px rgba(51, 51, 51, 0.06), 0 2px 4px rgba(51, 51, 51, 0.04);
    --shadow-lg: 0 12px 28px rgba(51, 51, 51, 0.08), 0 4px 10px rgba(51, 51, 51, 0.04);
    --shadow-card: 0 2px 4px rgba(51, 51, 51, 0.04), 0 8px 24px rgba(51, 51, 51, 0.07);
    --shadow-card-hover: 0 4px 8px rgba(51, 51, 51, 0.05), 0 14px 32px rgba(51, 51, 51, 0.1);

    /* Type. Active: IBM Plex Sans. Rollback: restore the matching link in base.html
       and set --font to var(--font-inter) or var(--font-jost). */
    --font-jost: 'Jost', sans-serif;
    --font-inter: 'Inter', sans-serif;
    --font-ibm-plex: 'IBM Plex Sans', sans-serif;
    --font: var(--font-ibm-plex);
    --fs-xs: 0.75rem;
    --fs-sm: 0.875rem;
    --fs-md: 1rem;
    --fs-lg: 1.125rem;
    --fs-xl: 1.375rem;
    --fs-2xl: 1.75rem;
    --fs-3xl: 2rem;
    --lh-tight: 1.25;
    --lh-normal: 1.45;
    --fw-regular: 400;
    --fw-medium: 500;
    --fw-semibold: 600;
    --fw-bold: 700;

    /* Motion */
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --dur-fast: 150ms;
    --dur: 220ms;

    /* Layout / a11y */
    --container-padding-x: 20px;
    --lk-sidebar-width: 244px;
    --lk-content-max: 920px;
    --lk-bottom-nav-h: 68px;
    --touch-min: 44px;
    --focus-ring: 0 0 0 3px rgba(98, 192, 98, 0.35);
}

html,
body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

body {
    font-family: var(--font);
    background-color: var(--background);
    line-height: var(--lh-normal);
    color: var(--text-color);
    -webkit-font-smoothing: antialiased;
}

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

/* LK shell: quieter site chrome so patient UI owns attention */
body.lk-patient {
    background: var(--bg-atmosphere);
}

body.lk-patient .header {
    padding: 10px 0;
    box-shadow: var(--shadow-sm);
}

body.lk-patient .stats-section,
body.lk-patient .header-bottom,
body.lk-patient .header-bottom-spacer {
    display: none !important;
}

body.lk-patient .header-top {
    gap: 12px;
}

body.lk-patient .phone-btn--icon,
body.lk-patient .logout-form--icon {
    display: none;
}

body.lk-patient .logout-form--text {
    display: inline;
}

body.lk-patient .logout-btn-text {
    background: transparent;
    border: 1.5px solid var(--primary-color);
    color: var(--primary-color);
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    padding: 10px 20px;
    border-radius: 25px;
}

body.lk-patient .back-to-top {
    bottom: calc(var(--lk-bottom-nav-h) + 16px + env(safe-area-inset-bottom, 0px));
}

@media (min-width: 992px) {
    body.lk-patient .back-to-top {
        bottom: 16px;
    }

    body.lk-patient .header .container {
        max-width: none;
        width: 100%;
        padding-left: var(--space-4);
        padding-right: var(--space-5);
    }

    body.lk-patient .header-top {
        justify-content: space-between;
        align-items: center;
    }

    body.lk-patient .header .logo {
        --lk-logo-width: 112px;
        width: var(--lk-logo-width);
        margin: 0 0 0 calc((var(--lk-sidebar-width) - var(--lk-logo-width)) / 2 - var(--space-4));
        justify-content: flex-start;
    }

    body.lk-patient .header .logo img {
        width: 100%;
        height: auto;
    }
}

/* Mobile LK header: logo left, call + logout icons right */
@media (max-width: 991.98px) {
    body.lk-patient .header {
        padding: 8px 0;
    }

    body.lk-patient .header .container {
        --container-padding-x: 12px;
        padding-left: 12px;
        padding-right: 12px;
    }

    body.lk-patient .header-top {
        flex-wrap: nowrap;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 12px;
        text-align: left;
    }

    body.lk-patient .header .logo {
        width: 148px;
        height: auto;
        flex-shrink: 0;
        justify-content: flex-start;
        margin: 0;
        margin-right: auto;
    }

    body.lk-patient .header .logo img {
        object-position: left center;
        padding: 0;
        height: auto;
    }

    body.lk-patient .header-actions {
        gap: 8px;
        margin-top: 0;
        width: auto;
        flex-direction: row;
        justify-content: flex-end;
    }

    body.lk-patient .phone-btn--text,
    body.lk-patient .logout-form--text {
        display: none !important;
    }

    body.lk-patient .phone-btn--icon,
    body.lk-patient .logout-form--icon {
        display: inline-flex !important;
    }

    body.lk-patient .phone-btn--icon,
    body.lk-patient .logout-btn-icon {
        width: 44px;
        height: 44px;
        min-width: 44px;
        padding: 0;
        border-radius: 12px;
        border: 1px solid rgba(var(--primary-rgb), 0.28);
        background: #fff;
        color: var(--primary-dark);
        display: inline-flex;
        align-items: center;
        justify-content: center;
        text-decoration: none;
        box-shadow: var(--shadow-sm);
        cursor: pointer;
        font-size: 1.1rem;
        line-height: 1;
        font-family: inherit;
    }

    body.lk-patient .logout-btn-icon {
        width: 36px;
        height: 36px;
        min-width: 36px;
        border-radius: 10px;
        border-color: var(--border-subtle, #e5e5e5);
        box-shadow: none;
        color: var(--text-muted, #5A5A5A);
        font-size: 1rem;
    }

    body.lk-patient .phone-btn--icon:hover,
    body.lk-patient .logout-btn-icon:hover {
        background: var(--surface-tint, #F5FAF5);
        border-color: var(--primary-color);
        color: var(--primary-dark);
    }

    body.lk-patient .logout-form--icon {
        margin: 0;
    }
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--container-padding-x);
}

img,
svg,
video,
canvas {
    max-width: 100%;
    height: auto;
}

table {
    max-width: 100%;
}

.back-to-top {
    position: fixed;
    right: 16px;
    bottom: 16px;
    width: 44px;
    height: 44px;
    border-radius: 999px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: var(--primary-color);
    color: var(--white);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
    transition: opacity 0.2s ease, transform 0.2s ease, background 0.2s ease;
    z-index: 1200;
}

.back-to-top:hover {
    background: var(--primary-dark);
}

.back-to-top--visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.back-to-top i {
    font-size: 18px;
    line-height: 1;
}

/* Header Styles */
.header {
    background: var(--white);
    box-shadow: 0px 4px 20px rgba(0, 0, 0, 0.08);
    padding: 15px 0;
    position: relative;
    z-index: 1000;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.header-bottom {
    background: var(--white);
}

.logo {
    width: 210px;
    height: auto;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-shrink: 0;
}

.logo-link {
    display: flex;
    align-items: center;
    width: 100%;
    min-width: 0;
    color: inherit;
    text-decoration: none;
    cursor: pointer;
}

.logo-link:hover,
.logo-link:focus,
.logo-link:focus-visible {
    text-decoration: none;
    color: inherit;
}

.logo img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
}

.auth-header .logo {
    width: 180px;
    height: auto;
    margin: 0 auto 20px;
}

/* Если нужно убрать рамку и в основном хедере */
.header .logo {
    border: none;
}

/* Альтернативный вариант - если хотим просто текст без фона и рамки */
.logo.text-only {
    background: transparent;
    border: none;
    color: var(--primary-color);
    font-size: 20px;
    font-weight: 700;
}

.stats-section {
    display: flex;
    align-items: center;
    gap: 25px;
    flex-wrap: wrap;
}

.help-text {
    font-weight: 600;
    font-size: 14px;
    line-height: 1.3;
    color: #000000;
    text-align: center;
}

.stats {
    display: flex;
    gap: 25px;
    align-items: center;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-value {
    font-weight: 700;
    font-size: 18px;
    line-height: 1.2;
    color: var(--primary-color);
}

.stat-label {
    font-weight: 400;
    font-size: 12px;
    line-height: 1.2;
    color: #000000;
    white-space: nowrap;
}

.divider {
    width: 1px;
    height: 30px;
    background: #D9D9D9;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.phone-btn {
    padding: 10px 18px;
    border: 1.5px solid var(--primary-color);
    border-radius: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: all 0.3s;
}

.phone-btn--icon,
.logout-form--icon {
    display: none;
}

.logout-form--text {
    display: inline;
}

.phone-btn:hover {
    background: #f8fff8;
}

.phone-number {
    font-weight: 700;
    font-size: 14px;
    line-height: 1;
    color: var(--primary-color);
    white-space: nowrap;
}

.appointment-btn {
    padding: 10px 20px;
    background: var(--primary-color);
    border-radius: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-weight: 700;
    font-size: 13px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
}

.appointment-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.appointment-btn.secondary {
    background: transparent;
    border: 1.5px solid var(--primary-color);
    color: var(--primary-color);
}

.appointment-btn.secondary:hover {
    background: var(--primary-color);
    color: var(--white);
}

.header-bottom {
    margin-top: 15px;
    border-top: 1px solid #f0f0f0;
    padding-top: 15px;
}

.header-bottom-spacer {
    display: none;
    height: var(--header-bottom-height, 0px);
}

body.has-fixed-nav .header-bottom {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 1000;
    margin-top: 0;
    border-top: 0;
    padding-top: 0;
    box-shadow: 0px 4px 20px rgba(0, 0, 0, 0.08);
}

body.has-fixed-nav .header-bottom .main-nav {
    max-width: 1200px;
    margin: 0 auto;
    padding: 10px var(--container-padding-x);
}

body.has-fixed-nav .header-bottom-spacer {
    display: block;
}

.main-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
}

.nav-item {
    font-weight: 600;
    font-size: 14px;
    line-height: 1;
    color: var(--text-light);
    text-decoration: none;
    padding: 8px 12px;
    transition: all 0.3s;
    border-radius: 6px;
    white-space: nowrap;
}

.nav-item.active {
    color: var(--primary-color);
    background: #f8fff8;
}

.nav-item:hover {
    color: var(--primary-color);
    background: #f8fff8;
}

/* Button Styles */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 25px;
    font-family: var(--font);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: var(--primary-color);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-secondary {
    background: transparent;
    border: 1.5px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-secondary:hover {
    background: var(--primary-color);
    color: var(--white);
}

.btn-block {
    width: 100%;
}

/* Hero Section */
.hero-section {
    background: linear-gradient(135deg, var(--primary-color) 0%, #8DE68D 100%);
    color: var(--white);
    padding: 80px 0;
    text-align: center;
}

.hero-section h1 {
    font-size: 2.5rem;
    margin-bottom: 20px;
    font-weight: 600;
}

.hero-section p {
    font-size: 1.2rem;
    margin-bottom: 30px;
    opacity: 0.9;
}

.hero-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .header-top {
        flex-wrap: wrap;
    }
    
    .stats-section {
        order: 3;
        width: 100%;
        justify-content: center;
        margin-top: 15px;
    }
}

@media (max-width: 768px) {
    .container {
        --container-padding-x: 15px;
    }
    
    .header-top {
        gap: 15px;
    }
    
    .logo {
        width: 168px;
        height: auto;
    }
    
    .stats-section {
        gap: 15px;
    }
    
    .stats {
        gap: 15px;
    }
    
    .help-text {
        font-size: 13px;
    }
    
    .stat-value {
        font-size: 16px;
    }
    
    .stat-label {
        font-size: 11px;
    }
    
    .header-actions {
        gap: 8px;
    }
    
    .phone-btn {
        padding: 8px 15px;
    }
    
    .phone-number {
        font-size: 13px;
    }
    
    .appointment-btn {
        padding: 8px 16px;
        font-size: 12px;
    }
    
    .main-nav {
        justify-content: center;
        gap: 3px;
    }
    
    .nav-item {
        font-size: 13px;
        padding: 6px 10px;
    }
    
    .hero-section {
        padding: 60px 0;
    }
    
    .hero-section h1 {
        font-size: 2rem;
    }
    
    .hero-section p {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .header-top {
        flex-direction: column;
        text-align: center;
    }

    .header-top .logo {
        width: 168px;
        margin: 0 auto;
    }
    
    .stats-section {
        order: 2;
        margin-top: 10px;
    }
    
    .header-actions {
        order: 3;
        margin-top: 10px;
        width: 100%;
        justify-content: center;
        flex-direction: column;
    }
    
    .phone-btn,
    .appointment-btn {
        width: 100%;
        max-width: 340px;
    }

    .main-nav {
        overflow-x: auto;
        justify-content: flex-start;
        padding-bottom: 5px;
        -webkit-overflow-scrolling: touch;
    }
    
    .nav-item {
        font-size: 12px;
        padding: 5px 8px;
        flex-shrink: 0;
    }
    
    .hero-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .btn {
        width: 100%;
        max-width: 280px;
    }

    .back-to-top {
        right: 12px;
        bottom: 12px;
        width: 42px;
        height: 42px;
    }
}

/* Desktop: smaller logo, sitting on the menu row at the left of the content area */
@media (min-width: 992px) {
    body:not(.lk-patient) .header .container {
        --logo-box: 210px;
        --logo-gap: 24px;
        display: grid;
        grid-template-columns: auto minmax(0, 1fr) auto;
        column-gap: 12px;
        row-gap: 14px;
        align-items: center;
    }

    body:not(.lk-patient) .header-top {
        display: contents;
    }

    body:not(.lk-patient) .stats-section {
        grid-column: 1 / -1;
        grid-row: 1;
        justify-self: center;
        order: 0;
        width: auto;
        margin-top: 0;
    }

    body:not(.lk-patient) .header-actions {
        grid-column: 3;
        grid-row: 1;
        justify-self: end;
    }

    body:not(.lk-patient) .header .logo {
        grid-column: 1;
        grid-row: 2;
        width: var(--logo-box);
        margin: 0 0 0 4px;
        justify-self: start;
        align-self: center;
        z-index: 2;
        pointer-events: none;
    }

    body:not(.lk-patient):not(.lk-simple-header) .header .logo-link {
        width: 65%;
        pointer-events: auto;
    }

    body:not(.lk-patient) .header .logo img {
        width: 65%;
        pointer-events: auto;
    }

    body:not(.lk-patient):not(.lk-simple-header) .header .logo img {
        width: 100%;
    }

    body:not(.lk-patient) .header-bottom {
        grid-column: 2 / 4;
        grid-row: 2;
        margin-top: 0;
        margin-left: calc(var(--logo-box) * -0.35 + (var(--logo-gap) - 12px));
        padding-top: 0;
        border-top: 0;
        align-self: center;
        display: flex;
        align-items: center;
        min-height: 64px;
    }

    body:not(.lk-patient) .header-bottom .main-nav {
        flex: 1;
        width: 100%;
        max-width: none;
        min-width: 0;
    }

    body:not(.lk-patient) .header .container::after {
        content: "";
        grid-column: 1 / -1;
        grid-row: 2;
        align-self: start;
        height: 0;
        border-top: 1px solid #f0f0f0;
        pointer-events: none;
    }

    body:not(.lk-patient) .header-bottom-spacer {
        grid-column: 1 / -1;
    }

    body:not(.lk-patient).has-fixed-nav .header .logo {
        position: fixed;
        top: 0;
        left: max(var(--container-padding-x), calc((100vw - 1200px) / 2 + var(--container-padding-x)));
        margin-left: 4px;
        height: 64px;
        display: flex;
        align-items: center;
        z-index: 1001;
        background: transparent;
    }

    body:not(.lk-patient).has-fixed-nav .header-bottom {
        display: block;
        margin-left: 0;
        min-height: 64px;
    }

    body:not(.lk-patient).has-fixed-nav .header-bottom .main-nav {
        display: flex;
        align-items: center;
        width: 100%;
        max-width: 1200px;
        min-height: 64px;
        margin: 0 auto;
        box-sizing: border-box;
        padding-left: calc(var(--container-padding-x) + 4px + var(--logo-box) * 0.65 + var(--logo-gap));
    }
}

/* Auth Styles */
.auth-container {
    min-height: calc(100vh - 200px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

.auth-card {
    background: white;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-header h1 {
    font-size: 2rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
}

.auth-header p {
    color: #7f8c8d;
    margin: 0;
}

.auth-messages {
    margin-bottom: 20px;
}

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 10px;
    font-size: 0.9rem;
}

.alert-success {
    background: rgba(39, 174, 96, 0.1);
    color: #27ae60;
    border: 1px solid rgba(39, 174, 96, 0.2);
}

.alert-error {
    background: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
    border: 1px solid rgba(231, 76, 60, 0.2);
}

.auth-form {
    margin-bottom: 25px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.95rem;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #e1e8ed;
    border-radius: 8px;
    font-size: 1rem;
    font-family: var(--font);
    transition: all 0.2s ease;
}

.password-field {
    position: relative;
}

.password-field .form-control {
    padding-right: 42px;
}

.password-toggle {
    position: absolute;
    right: 10px;
    top: 0;
    bottom: 0;
    width: 28px;
    height: auto;
    margin: 0;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    outline: none;
    box-shadow: none;
    background: transparent;
    background-color: transparent;
    color: #8DE68D;
    cursor: pointer;
    border-radius: 0;
    line-height: 1;
    -webkit-appearance: none;
    appearance: none;
    z-index: 2;
}

.password-toggle:hover,
.password-toggle:focus,
.password-toggle:focus-visible,
.password-toggle:active {
    color: #62C062;
    border: none;
    outline: none;
    box-shadow: none;
    background: transparent;
}

.password-toggle i {
    font-size: 1.15rem;
    line-height: 1;
    pointer-events: none;
}

.form-control:focus {
    outline: none;
    border-color: #62C062;
    box-shadow: 0 0 0 3px rgba(98, 192, 98, 0.1);
}

.form-help {
    display: block;
    margin-top: 6px;
    color: #7f8c8d;
    font-size: 0.85rem;
}

.error-text {
    color: #e74c3c;
    font-size: 0.85rem;
    margin-top: 5px;
}

.auth-links {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid #eaeaea;
}

.auth-links p {
    margin: 0;
    color: #7f8c8d;
}

.auth-links a {
    color: #62C062;
    text-decoration: none;
    font-weight: 600;
}

.auth-links a:hover {
    text-decoration: underline;
}

/* Responsive auth */
@media (max-width: 480px) {
    .auth-card {
        padding: 30px 20px;
    }
    
    .auth-header h1 {
        font-size: 1.7rem;
    }
}