/* ===== CSS RESET & BASE ===== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    /* Фирменные цвета */
    --color-brand-orange: #E8812A;
    --color-brand-red: #E94A2C;
    --color-brand-red-hover: #D43D20;
    --color-brand-red-light: #FDF0EE;
    --color-brand-red-lighter: #FEFAF9;
    --color-brand-blue: #3864AD;
    --color-brand-blue-hover: #2D5496;
    --color-brand-blue-light: #EBF0F8;
    --color-brand-blue-lighter: #F5F7FB;

    /* Основные цвета интерфейса */
    --color-primary: var(--color-brand-blue);
    --color-primary-hover: var(--color-brand-blue-hover);
    --color-primary-light: var(--color-brand-blue-light);
    --color-accent: var(--color-brand-red);
    --color-accent-hover: var(--color-brand-red-hover);
    --color-accent-light: var(--color-brand-red-light);

    --color-success: #16A34A;
    --color-success-light: #DCFCE7;
    --color-error: #DC2626;
    --color-error-light: #FEE2E2;
    --color-warning: #D97706;
    --color-warning-light: #FEF3C7;
    --color-info: var(--color-brand-blue);
    --color-info-light: var(--color-brand-blue-light);
    --color-danger: #DC2626;
    --color-danger-hover: #B91C1C;

    --color-bg: #FFFFFF;
    --color-bg-secondary: #F8F9FA;
    --color-surface: #FFFFFF;
    --color-border: #E5E7EB;
    --color-border-light: #F0F1F3;
    --color-text: #1A1A2E;
    --color-text-secondary: #5A6070;
    --color-text-muted: #9CA3AF;

    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-xl: 24px;

    --shadow-sm: 0 1px 3px rgba(26,26,46,0.06);
    --shadow-md: 0 4px 12px rgba(26,26,46,0.08);
    --shadow-lg: 0 8px 24px rgba(26,26,46,0.12);
    --shadow-card: 0 1px 3px rgba(26,26,46,0.04), 0 1px 2px rgba(26,26,46,0.06);

    /* --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace; */

    --font-sans: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'Roboto', 'Fira Code', 'Consolas', monospace;

    --header-height: 60px;
    --max-width: 960px;
}

html {
    font-size: 14px;
    line-height: 1.5;
}

body {
    font-family: var(--font-sans);
    color: var(--color-text);
    background: var(--color-bg);
    min-height: 100vh;
}

a {
    color: var(--color-primary);
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

h1 { font-size: 24px; font-weight: 700; color: var(--color-text); }
h2 { font-size: 20px; font-weight: 600; color: var(--color-text); }
h3 { font-size: 16px; font-weight: 600; color: var(--color-text); }

.hidden { display: none !important; }

/* ===== HEADER ===== */
.header {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--header-height);
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
    z-index: 100;
    display: flex;
    align-items: center;
    padding: 0 20px;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.header-logo {
    display: flex;
    align-items: center;
    cursor: pointer;
    text-decoration: none;
}
.header-logo:hover { text-decoration: none; }

.header-logo svg {
    height: 30px;
    width: auto;
    display: block;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 20px;
}

.header-nav-link {
    color: var(--color-text-secondary);
    font-size: 14px;
    font-weight: 500;
    transition: color 0.2s;
}
.header-nav-link:hover {
    color: var(--color-brand-blue);
    text-decoration: none;
}

.header-user {
    position: relative;
}

.header-user-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: none;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 14px;
    color: var(--color-text);
    transition: all 0.2s;
}
.header-user-btn:hover {
    border-color: var(--color-brand-blue);
    background: var(--color-brand-blue-light);
}

.header-user-avatar {
    width: 28px;
    height: 28px;
    background: var(--color-brand-blue);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 12px;
}

.header-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 180px;
    z-index: 200;
    overflow: hidden;
}

.header-dropdown-item {
    display: block;
    width: 100%;
    padding: 10px 16px;
    text-align: left;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    color: var(--color-text);
    transition: background 0.15s;
}
.header-dropdown-item:hover {
    background: var(--color-brand-blue-light);
    text-decoration: none;
}
.header-dropdown-item.danger {
    color: var(--color-brand-red);
}
.header-dropdown-item.danger:hover {
    background: var(--color-brand-red-light);
}

.header-hamburger {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    font-size: 22px;
    color: var(--color-text);
}

/* ===== MAIN ===== */
.main {
    padding-top: var(--header-height);
    flex: 1;
    background: var(--color-bg);
}

.main.no-header {
    padding-top: 0;
}

/* ===== PAGE LAYOUTS ===== */
.page-center {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100%;
    padding: 20px;
    background: var(--color-bg);
}

.page-content {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 24px 20px;
}

/* ===== AUTH CARD ===== */
.auth-card {
    background: var(--color-surface);
    border-radius: var(--radius-xl);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-lg);
    padding: 40px;
    width: 100%;
    max-width: 420px;
}

.auth-logo {
    text-align: center;
    margin-bottom: 32px;
}

.auth-logo-svg {
    width: 90px;
    height: auto;
    margin: 0 auto 16px;
    display: block;
    animation: float 4s ease-in-out infinite;
}

.auth-logo-svg polyline {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    animation: draw 2s ease forwards;
}

.auth-logo-svg g[fill="#3864AD"] path {
    opacity: 0;
    animation: fadeIn 1s ease forwards;
    animation-delay: 1s;
}

@keyframes float {
    0%,100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

@keyframes draw {
    to { stroke-dashoffset: 0; }
}

@keyframes fadeIn {
    to { opacity: 1; }
}

.auth-logo-text {
    font-size: 14px;
    font-weight: 400;
    color: var(--color-text-secondary);
    margin-top: 8px;
}

.auth-page--spaced {
    margin: 24px 0;
}

.auth-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 13px;
    color: var(--color-text-secondary);
}

.auth-footer a {
    font-weight: 500;
    color: var(--color-brand-blue);
}

/* ===== FORMS ===== */
.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text);
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: var(--font-sans);
    color: var(--color-text);
    background: var(--color-surface);
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

.form-input:focus {
    border-color: var(--color-brand-blue);
    box-shadow: 0 0 0 3px var(--color-brand-blue-light);
}

.form-input.error {
    border-color: var(--color-error);
}

.form-input.readonly {
    background: var(--color-bg-secondary);
    color: var(--color-text-secondary);
    cursor: not-allowed;
}

.form-input-wrapper {
    position: relative;
}

.form-input-wrapper .form-input {
    padding-right: 40px;
}

.form-input-icon {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-text-muted);
    font-size: 18px;
    padding: 4px;
    line-height: 1;
}
.form-input-icon:hover {
    color: var(--color-text-secondary);
}

.form-error {
    font-size: 12px;
    color: var(--color-error);
    margin-top: 4px;
}

.form-hint {
    font-size: 12px;
    color: var(--color-text-muted);
    margin-top: 4px;
}

/* Password strength */
.password-strength {
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.password-strength-bar {
    flex: 1;
    height: 4px;
    background: var(--color-border);
    border-radius: 2px;
    overflow: hidden;
}

.password-strength-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s, background 0.3s;
    width: 0%;
}

.password-strength-fill.weak { width: 25%; background: var(--color-brand-red); }
.password-strength-fill.fair { width: 50%; background: var(--color-warning); }
.password-strength-fill.good { width: 75%; background: #22C55E; }
.password-strength-fill.strong { width: 100%; background: var(--color-success); }

.password-strength-text {
    font-size: 11px;
    font-weight: 500;
    min-width: 60px;
}

/* Code input */
.code-input-group {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
}

.code-input-group .separator {
    font-size: 20px;
    color: var(--color-text-muted);
    font-weight: 300;
}

.code-input {
    width: 80px;
    padding: 12px;
    text-align: center;
    font-size: 18px;
    font-family: var(--font-mono);
    font-weight: 600;
    letter-spacing: 2px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.code-input:focus {
    border-color: var(--color-brand-blue);
    box-shadow: 0 0 0 3px var(--color-brand-blue-light);
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    line-height: 1.4;
}

.btn:hover { text-decoration: none; }

.btn:disabled, .btn.loading {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--color-brand-blue);
    color: white;
    border: 2px solid var(--color-brand-blue);
    transition: all 0.2s ease;
}
.btn-primary:hover:not(:disabled) {
    background: white;
    color: var(--color-brand-blue);
}
.btn-primary:active:not(:disabled) {
    background: var(--color-brand-blue);
    color: white;
}

.btn-accent {
    background: var(--color-brand-red);
    color: white;
    border: 2px solid var(--color-brand-red);
    transition: all 0.2s ease;
}
.btn-accent:hover:not(:disabled) {
    background: white;
    color: var(--color-brand-red);
}
.btn-accent:active:not(:disabled) {
    background: var(--color-brand-red);
    color: white;
}

.btn-outline-red {
    background: transparent;
    color: var(--color-brand-red);
    border: 2px solid var(--color-brand-red);
    transition: all 0.2s ease;
}
.btn-outline-red:hover:not(:disabled) {
    background: var(--color-brand-red);
    color: white;
}

.btn-danger {
    background: var(--color-error);
    color: white;
    border: 2px solid var(--color-error);
    transition: all 0.2s ease;
}
.btn-danger:hover:not(:disabled) {
    background: white;
    color: var(--color-error);
}
.btn-danger:active:not(:disabled) {
    background: var(--color-error);
    color: white;
}

.btn-outline {
    background: transparent;
    color: var(--color-brand-blue);
    border: 2px solid var(--color-brand-blue);
    transition: all 0.2s ease;
}
.btn-outline:hover:not(:disabled) {
    background: var(--color-brand-blue);
    color: white;
}

.btn-outline-red {
    background: transparent;
    color: var(--color-brand-red);
    border: 2px solid var(--color-brand-red);
    transition: all 0.2s ease;
}
.btn-outline-red:hover:not(:disabled) {
    background: var(--color-brand-red);
    color: white;
}

.btn-ghost {
    background: transparent;
    color: var(--color-text-secondary);
}
.btn-ghost:hover:not(:disabled) {
    background: var(--color-bg-secondary);
    color: var(--color-text);
}

.btn-block {
    display: flex;
    width: 100%;
}

.btn-sm {
    padding: 10px 40px;
    font-size: 13px;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
}

.btn .spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.btn-secondary .spinner {
    border-color: rgba(0,0,0,0.15);
    border-top-color: var(--color-text);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== CARDS ===== */
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    padding: 20px;
    transition: box-shadow 0.2s;
}

.card-clickable {
    cursor: pointer;
}
.card-clickable:hover {
    box-shadow: var(--shadow-md);
}

.card + .card {
    margin-top: 12px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-body {
    font-size: 14px;
    color: var(--color-text-secondary);
}

.card-body p + p {
    margin-top: 4px;
}

.card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
    flex-wrap: wrap;
}

/* Controller card */
.controller-card {
    border-left: 4px solid var(--color-border);
}

.controller-card.online {
    border-left-color: var(--color-success);
}

.controller-card.offline {
    border-left-color: var(--color-brand-red);
}

/* ===== STATUS ===== */
.status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-dot.online {
    background: var(--color-success);
    box-shadow: 0 0 0 3px var(--color-success-light);
}

.status-dot.offline {
    background: var(--color-brand-red);
    box-shadow: 0 0 0 3px var(--color-brand-red-light);
}

/* ===== PROGRESS BAR ===== */
.progress-section {
    margin-bottom: 24px;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 13px;
    color: var(--color-text-secondary);
}

.progress-bar {
    height: 8px;
    background: var(--color-border);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--color-brand-blue);
    border-radius: 4px;
    transition: width 0.4s ease;
}

.progress-fill.warning { background: var(--color-warning); }
.progress-fill.danger { background: var(--color-brand-red); }

/* ===== NAV GRID ===== */
.nav-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center; /* центрирует все элементы, включая "одинокий" */
    gap: 12px;
    margin-top: 24px;
    width: 100%;
    box-sizing: border-box;
}

.nav-grid-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 24px;
    width: calc(50% - 6px); /* две колонки с учётом gap */
    max-width: 200px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    color: var(--color-text);
    min-width: 0;
    word-break: break-word;
    overflow-wrap: break-word;
    box-sizing: border-box;
}

@media (max-width: 480px) {
    .nav-grid-item {
        padding: 16px 12px;
    }

    .nav-grid-item .label {
        font-size: 12px;
    }
}

@media (max-width: 360px) {
    .nav-grid-item {
        width: 100%; /* одна колонка */
        max-width: 100%;
        flex-direction: row;
        justify-content: flex-start;
        padding: 12px 16px;
    }
}

.nav-grid-item:hover {
    border-color: var(--color-brand-blue);
    background: var(--color-brand-blue-lighter);
    box-shadow: var(--shadow-md);
    text-decoration: none;
}

.nav-grid-item .icon {
    font-size: 28px;
}

.nav-grid-item .label {
    font-size: 13px;
    font-weight: 400;
    text-align: center;
    line-height: 1.3; /* Для переноса текста */
}

/* ===== ADD CARD ===== */
.add-card {
    border: 2px dashed var(--color-border);
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--color-text-muted);
    font-weight: 500;
    font-size: 15px;
    gap: 8px;
    text-decoration: none;
    border-radius: var(--radius-md);
}

.add-card:hover {
    border-color: var(--color-brand-red);
    color: var(--color-brand-red);
    background: var(--color-brand-red-light);
    text-decoration: none;
}

/* ===== SECRET DISPLAY ===== */
.secret-box {
    background: var(--color-bg-secondary);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 20px;
    text-align: center;
    margin: 16px 0;
}

.secret-value {
    font-family: var(--font-mono);
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 3px;
    color: var(--color-brand-blue);
    user-select: all;
}

.secret-warning {
    background: var(--color-warning-light);
    border: 1px solid var(--color-warning);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 16px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.secret-warning .icon {
    font-size: 24px;
    flex-shrink: 0;
}

.secret-warning .text {
    font-size: 13px;
    color: var(--color-text);
}

.secret-warning .text strong {
    display: block;
    margin-bottom: 4px;
    font-size: 14px;
}

/* ===== SECTION ===== */
.section {
    margin-bottom: 32px;
}

.section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--color-border);
}

.section-description {
    font-size: 13px;
    color: var(--color-text-secondary);
    margin-bottom: 16px;
    line-height: 1.6;
}

/* ===== DANGER ZONE ===== */
.danger-zone {
    border: 1px solid var(--color-brand-red);
    border-radius: var(--radius-md);
    padding: 20px;
    background: var(--color-brand-red-lighter);
}

.danger-zone .section-title {
    color: var(--color-brand-red);
    border-bottom-color: rgba(233,74,44,0.2);
}

/* ===== EVENT LOG ===== */
.event-day {
    margin-bottom: 24px;
}

.event-day-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-muted);
    margin-bottom: 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--color-border);
}

.event-item {
    display: flex;
    gap: 12px;
    padding: 10px 0;
    align-items: flex-start;
}

.event-item + .event-item {
    border-top: 1px solid var(--color-border-light);
}

.event-time {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--color-text-muted);
    min-width: 65px;
    padding-top: 2px;
}

.event-icon {
    font-size: 18px;
    min-width: 24px;
    text-align: center;
}

.event-content {
    flex: 1;
}

.event-title {
    font-size: 14px;
    font-weight: 500;
}

.event-detail {
    font-size: 12px;
    color: var(--color-text-secondary);
    margin-top: 2px;
}

.event-result {
    font-size: 12px;
    margin-top: 2px;
}

/* ===== FILTER BAR ===== */
.filter-bar {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-bar select {
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: var(--font-sans);
    color: var(--color-text);
    background: var(--color-surface);
    outline: none;
    cursor: pointer;
}
.filter-bar select:focus {
    border-color: var(--color-brand-blue);
}

/* ===== CHECKBOX ===== */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--color-brand-blue);
    cursor: pointer;
}

/* ===== MODAL ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(26, 26, 46, 0);
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 500;
    padding: 20px;
    transition: background 0.4s ease, backdrop-filter 0.4s ease, -webkit-backdrop-filter 0.4s ease;
    pointer-events: none;
}

.modal-overlay.visible {
    display: flex;
    pointer-events: auto;
}

.modal-overlay.active {
    background: rgba(26, 26, 46, 0.45);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.modal {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(26, 26, 46, 0.3);
    width: 100%;
    max-width: 460px;
    max-height: 90vh;
    overflow-y: auto;
    opacity: 0;
    transform: scale(0.92) translateY(12px);
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.modal-overlay.active .modal {
    opacity: 1;
    transform: scale(1) translateY(0);
}

.modal-header {
    padding: 20px 24px 0;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
}

.modal-body {
    padding: 16px 24px;
}

.modal-body p {
    font-size: 14px;
    color: var(--color-text-secondary);
    margin-bottom: 8px;
    line-height: 1.6;
}

.modal-footer {
    padding: 0 24px 20px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

@media (max-width: 768px) {
    .modal {
        max-width: 100%;
        margin: 10px;
    }
}
/* .modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(26,26,46,0.5);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

.modal-overlay.closing {
    animation: fadeOut 0.2s ease forwards;
}

.modal {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 460px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.2s ease;
}

.modal-overlay.closing .modal {
    animation: slideDown 0.2s ease forwards;
}

.modal-header {
    padding: 20px 24px 0;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
}

.modal-body {
    padding: 16px 24px;
}

.modal-body p {
    font-size: 14px;
    color: var(--color-text-secondary);
    margin-bottom: 8px;
    line-height: 1.6;
}

.modal-footer {
    padding: 0 24px 20px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideDown {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(20px); }
} */

/* ===== TOAST ===== */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 380px;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.3s ease;
    font-size: 13px;
    line-height: 1.4;
    background: var(--color-surface);
}

.toast.removing {
    animation: toastOut 0.3s ease forwards;
}

.toast-success {
    background: var(--color-success-light);
    border: 1px solid var(--color-success);
    color: #166534;
}

.toast-error {
    background: var(--color-error-light);
    border: 1px solid var(--color-error);
    color: #991B1B;
}

.toast-warning {
    background: var(--color-warning-light);
    border: 1px solid var(--color-warning);
    color: #92400E;
}

.toast-info {
    background: var(--color-brand-blue-light);
    border: 1px solid var(--color-brand-blue);
    color: var(--color-brand-blue-hover);
}

.toast-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.toast-message {
    flex: 1;
}

.toast-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    opacity: 0.5;
    padding: 0 4px;
    line-height: 1;
}
.toast-close:hover { opacity: 1; }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(40px); }
}

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--color-text-muted);
}

.empty-state .icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.empty-state .title {
    font-size: 18px;
    font-weight: 600;
    color: var(--color-text-secondary);
    margin-bottom: 8px;
}

.empty-state .description {
    font-size: 14px;
    margin-bottom: 24px;
    max-width: 360px;
    margin-left: auto;
    margin-right: auto;
}

/* ===== ERROR STATE ===== */
.error-state {
    text-align: center;
    padding: 60px 20px;
}

.error-state .icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.error-state .title {
    font-size: 20px;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 8px;
}

.error-state .description {
    font-size: 14px;
    color: var(--color-text-secondary);
    margin-bottom: 24px;
}

.error-state .actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* ===== SKELETON ===== */
.skeleton {
    background: linear-gradient(90deg, var(--color-border-light) 25%, var(--color-bg-secondary) 50%, var(--color-border-light) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

.skeleton-text {
    height: 14px;
    margin-bottom: 8px;
}

.skeleton-text.short { width: 60%; }
.skeleton-text.medium { width: 80%; }

.skeleton-card {
    height: 120px;
    margin-bottom: 12px;
    border-radius: var(--radius-md);
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ===== PAGE HEADER ===== */
.page-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.page-header .back-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--color-text-secondary);
    font-size: 13px;
    text-decoration: none;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.page-header .back-btn:hover {
    background: var(--color-brand-blue-light);
    color: var(--color-brand-blue);
    text-decoration: none;
}

.page-header h1 {
    flex: 1;
}

/* ===== SUMMARY ===== */
.summary-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 24px;
    justify-content: center;
}

.summary-item {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 16px;
    min-width: 200px;
    flex: 0 1 200px;
}

.summary-item {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 16px;
}

.summary-label {
    font-size: 12px;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.summary-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--color-text);
}

.summary-value.mono {
    font-family: var(--font-mono);
}

/* ===== STEPS ===== */
.steps {
    padding: 0;
    list-style: none;
    counter-reset: step;
}

.steps li {
    counter-increment: step;
    position: relative;
    padding-left: 32px;
    margin-bottom: 12px;
    font-size: 14px;
    color: var(--color-text-secondary);
    line-height: 1.6;
}

.steps li::before {
    content: counter(step);
    position: absolute;
    left: 0;
    top: 1px;
    width: 22px;
    height: 22px;
    background: var(--color-brand-blue-light);
    color: var(--color-brand-blue);
    border-radius: 50%;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===== ACCENT DIVIDER ===== */
.accent-line {
    width: 180px;
    height: 3px;
    background: var(--color-brand-red);
    border-radius: 2px;
    margin: 0 auto 20px;
}
.accent-line-lp {
    width: 100%;
    height: 3px;
    background: var(--color-brand-red);
    border-radius: 2px;
    margin: 0 auto 20px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .header-nav {
        display: none;
    }

    .header-hamburger {
        display: block;
    }

    .header-nav.open {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: var(--header-height);
        left: 0;
        right: 0;
        background: var(--color-surface);
        border-bottom: 1px solid var(--color-border);
        padding: 16px 20px;
        box-shadow: var(--shadow-md);
    }

    .auth-card {
        padding: 24px;
    }

    .auth-logo-svg {
        width: 70px;
    }

    .code-input-group {
        gap: 4px;
    }

    .code-input {
        width: 60px;
        font-size: 16px;
        padding: 10px 6px;
    }

    .secret-value {
        font-size: 20px;
        letter-spacing: 1px;
    }

    .nav-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .summary-grid {
        grid-template-columns: 1fr;
    }

    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .modal {
        max-width: 100%;
        margin: 10px;
    }

    .toast-container {
        left: 12px;
        right: 12px;
        max-width: 100%;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    html { font-size: 13px; }

    .nav-grid {
        grid-template-columns: 1fr 1fr;
    }

    .card-actions {
        flex-direction: column;
    }

    .card-actions .btn {
        width: 100%;
    }
}

/* ===== FOCUS VISIBLE ===== */
:focus-visible {
    outline: 2px solid var(--color-brand-blue);
    outline-offset: 2px;
}

button:focus:not(:focus-visible),
a:focus:not(:focus-visible),
input:focus:not(:focus-visible),
select:focus:not(:focus-visible) {
    outline: none;
}

/* ===== MISC ===== */
.text-center { text-align: center; }
.text-mono { font-family: var(--font-mono); }
.text-muted { color: var(--color-text-muted); }
.text-error { color: var(--color-error); }
.text-success { color: var(--color-success); }
.text-brand-blue { color: var(--color-brand-blue); }
.text-brand-red { color: var(--color-brand-red); }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.gap-8 { gap: 8px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1; }

/* ===== EMAIL VERIFICATION BANNER ===== */
.email-banner {
    background: var(--color-warning-light);
    border: 1px solid var(--color-warning);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    margin-bottom: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.email-banner-text {
    font-size: 14px;
    color: #92400E;
    line-height: 1.5;
}

.email-banner-text strong {
    display: block;
    font-size: 15px;
    margin-bottom: 4px;
}

.email-banner .btn {
    align-self: flex-start;
}

/* Disabled button style */
.btn.btn-disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-disabled-hint {
    font-size: 12px;
    color: var(--color-text-muted);
    margin-left: 4px;
}

/* ===== FOOTER ===== */
.footer {
    padding: 24px 20px;
    text-align: center;
    font-size: 12px;
    color: var(--color-text-muted);
    border-top: 1px solid var(--color-border);
    margin-top: 0;
    flex-shrink: 0;
}

.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
}

/* ===== FOCUS VISIBLE ===== */
:focus-visible {
    outline: 2px solid var(--color-brand-blue);
    outline-offset: 2px;
}

button:focus:not(:focus-visible),
a:focus:not(:focus-visible),
input:focus:not(:focus-visible),
select:focus:not(:focus-visible) {
    outline: none;
}

/* Убираем outline для элементов, у которых уже есть свой стиль фокуса */
.form-input:focus-visible,
.code-input:focus-visible,
.filter-bar select:focus-visible {
    outline: none;
}

/* ===== LEGAL PAGES ===== */
.legal-content {
    font-size: 14px;
    line-height: 1.8;
    color: var(--color-text);
    text-align: justify;
}

.legal-content h2 {
    font-size: 17px;
    font-weight: 600;
    margin-top: 32px;
    margin-bottom: 12px;
    color: var(--color-text);
}

.legal-content p {
    margin-bottom: 12px;
}

.legal-content ul {
    margin-bottom: 12px;
    padding-left: 24px;
}

.legal-content ul li {
    margin-bottom: 6px;
}

.legal-content a {
    color: var(--color-brand-blue);
}

.legal-table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    font-size: 13px;
}

.legal-table td {
    border: 1px solid var(--color-border);
    padding: 10px 14px;
    vertical-align: top;
}

.legal-table td:first-child {
    width: 180px;
    background: var(--color-bg-secondary);
    font-weight: 500;
}

.legal-note {
    background: var(--color-brand-blue-light);
    border: 1px solid var(--color-brand-blue);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    margin-top: 24px;
}

.legal-note p {
    margin: 0;
    font-size: 14px;
    color: var(--color-text);
}

.back-link {
    font-size: 13px;
    color: var(--color-text-secondary);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.back-link:hover {
    color: var(--color-brand-red);
    transform: translateX(-2px);
}

/* Убираем стили автозаполнения браузера */
.form-input:-webkit-autofill,
.form-input:-webkit-autofill:hover,
.form-input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px var(--color-surface) inset;
    -webkit-text-fill-color: var(--color-text);
    transition: background-color 5000s ease-in-out 0s;
}

/* Срабатывает когда браузер применяет автозаполнение */
@keyframes onAutofill {
    from {}
    to {}
}

input:-webkit-autofill {
    animation-name: onAutofill;
    animation-duration: 1ms;
    animation: fadeOut 0.1s;
}

/* небольшая анимация, чтобы браузер не смог «запомнить» визуально */
@keyframes fadeOut {
    to { opacity: 0; }
}

.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Корневой контейнер на всю высоту */
#app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Основной контент растягивается и заполняет свободное место */
#app-main {
    flex: 1;
}

/* Футер всегда прижат к низу */
#app-footer {
    flex-shrink: 0;
}
