/* =====================================================================
   Заполни стол — Личный кабинет
   Mobile-first дизайн в стиле filltables.ru
   Брейкпоинты: 0–849 (mobile/tablet), 850+ (desktop с sidebar), 1280+ (wide)
   ===================================================================== */

/* === DESIGN TOKENS === */
:root {
    /* Brand */
    --primary-color: #52e2ef;
    --primary-deep: #1da1ad;
    --secondary-color: #f16a3e;
    --accent-color: #f29b3f;

    /* Surfaces (dark) */
    --bg: #080f1f;
    --bg-elevated: #0e1730;
    --surface-1: #1a1d2c;       /* page background card */
    --surface-2: #232633;       /* main card (как на лендинге) */
    --surface-3: #2a2e3d;       /* hover / inset */
    --surface-4: #353a50;       /* pill / chip */
    --surface-mute: rgba(255, 255, 255, 0.04);

    /* Text */
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.66);
    --text-muted: rgba(255, 255, 255, 0.42);
    --text-inverted: #080f1f;

    /* Borders */
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(82, 226, 239, 0.3);
    --border-warm: rgba(241, 106, 62, 0.32);

    /* Status */
    --success-color: #3ddc97;
    --warning-color: #f29b3f;
    --error-color: #f65656;

    /* Brand gradients */
    --gradient-cool: linear-gradient(180deg, #52e2ef -11.18%, #1da1ad 113.8%);
    --gradient-warm: linear-gradient(180deg, #f29b3f 0%, #f2663f 100%);

    /* Shadows */
    --shadow-1: 0 8px 24px rgba(0, 0, 0, 0.28);
    --shadow-2: 0 16px 48px rgba(0, 0, 0, 0.34);
    --shadow-glow-cool: 0 12px 32px rgba(82, 226, 239, 0.25);
    --shadow-glow-warm: 0 12px 32px rgba(242, 102, 63, 0.28);

    /* Radii */
    --radius-pill: 999px;
    --radius-xl: 24px;
    --radius-lg: 18px;
    --radius-md: 14px;
    --radius-sm: 10px;

    /* Layout */
    --sidebar-w: 244px;
    --sidebar-w-compact: 76px;
    --header-h-mobile: 88px;
    --content-max: 1240px;

    /* Transitions */
    --t-fast: 140ms ease;
    --t-base: 220ms ease;
}

[data-theme="light"] {
    /* Акценты темнее: яркий cyan на белом режет глаз */
    --primary-color: #0f7a86;
    --primary-deep: #0a5f69;

    --bg: #e9edf2;
    --bg-elevated: #f3f5f8;
    --surface-1: #f0f2f6;
    --surface-2: #f5f7fa;
    --surface-3: #e8ecf1;
    --surface-4: #dde3ea;
    --surface-mute: rgba(8, 15, 31, 0.045);

    --text-primary: #1c2333;
    --text-secondary: #4b5568;
    --text-muted: rgba(28, 35, 51, 0.52);
    --text-inverted: #ffffff;

    --border: rgba(8, 15, 31, 0.09);
    --border-strong: rgba(15, 122, 134, 0.28);
    --border-warm: rgba(200, 85, 48, 0.28);

    --shadow-1: 0 4px 14px rgba(8, 15, 31, 0.05);
    --shadow-2: 0 10px 28px rgba(8, 15, 31, 0.07);
    --shadow-glow-cool: 0 8px 20px rgba(15, 122, 134, 0.12);
    --shadow-glow-warm: 0 8px 20px rgba(200, 85, 48, 0.14);
}

/* Светлая тема: hardcoded cyan — тот же оттенок, без «неона» на сером фоне */
[data-theme="light"] .tab.active {
    background: rgba(15, 122, 134, 0.11);
}

[data-theme="light"] .brand-mark,
[data-theme="light"] .screen-kicker,
[data-theme="light"] .auth-kicker {
    background: rgba(15, 122, 134, 0.1);
}

[data-theme="light"] .auth-screen::before {
    background:
            radial-gradient(circle at 15% 12%, rgba(15, 122, 134, 0.07), transparent 30rem),
            radial-gradient(circle at 86% 88%, rgba(200, 85, 48, 0.06), transparent 28rem);
}

[data-theme="light"] .profile-card:hover,
[data-theme="light"] .list-item:hover,
[data-theme="light"] .stat-item:hover {
    border-color: rgba(15, 122, 134, 0.2);
}

[data-theme="light"] .pv-edit-btn:hover {
    background: rgba(15, 122, 134, 0.1);
}

[data-theme="light"] .pv-icon {
    background: rgba(15, 122, 134, 0.11);
}

[data-theme="light"] .empty-state {
    background: rgba(15, 122, 134, 0.04);
}

[data-theme="light"] .slot-cell.available {
    background: rgba(15, 122, 134, 0.14);
    border-color: rgba(15, 122, 134, 0.18);
}

[data-theme="light"] .slot-cell.available:hover {
    background: rgba(15, 122, 134, 0.22);
}

[data-theme="light"] .slot-dot.slot-available {
    background: rgba(15, 122, 134, 0.32);
}

[data-theme="light"] .mini-cell.mc-open {
    background: rgba(15, 122, 134, 0.22);
}

[data-theme="light"] .suggestion-item:hover {
    background: rgba(15, 122, 134, 0.08);
}

[data-theme="light"] .wh-tpl-btn.active {
    background: rgba(15, 122, 134, 0.1);
}

[data-theme="light"] .wh-day-toggle.selected {
    background: rgba(15, 122, 134, 0.12);
}

[data-theme="light"] .status-processing-leader,
[data-theme="light"] .status-processing-no-leader,
[data-theme="light"] .status-min-players,
[data-theme="light"] .status-full {
    background: rgba(15, 122, 134, 0.08);
}

[data-theme="light"] .exc-nav-btn:hover:not(:disabled),
[data-theme="light"] .mini-schedule-nav button:hover {
    background: rgba(15, 122, 134, 0.1);
}

[data-theme="light"] .wh-group-inputs input[type="text"]:focus {
    box-shadow: 0 0 0 3px rgba(15, 122, 134, 0.14);
}

[data-theme="light"] .spinner {
    border-color: rgba(15, 122, 134, 0.14);
    border-top-color: var(--primary-color);
}

/* === RESET === */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    color-scheme: dark;
}

html[data-theme="light"] {
    color-scheme: light;
}

html,
body {
    height: 100%;
}

body {
    min-height: 100vh;
    min-height: 100dvh;
    font-family: 'Onest', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-weight: 400;
    line-height: 1.45;
    letter-spacing: -0.005em;
    color: var(--text-primary);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
}

/* мягкое свечение фона */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    background:
            radial-gradient(circle at 12% 4%, rgba(82, 226, 239, 0.12), transparent 38rem),
            radial-gradient(circle at 92% 0%, rgba(241, 106, 62, 0.1), transparent 32rem);
    pointer-events: none;
    z-index: 0;
}

[data-theme="light"] body::before {
    background:
            radial-gradient(circle at 12% 4%, rgba(15, 122, 134, 0.06), transparent 34rem),
            radial-gradient(circle at 92% 0%, rgba(200, 85, 48, 0.05), transparent 28rem);
}

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

input,
textarea,
select {
    outline: none;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color var(--t-fast);
}

a:hover {
    color: var(--primary-deep);
}

::selection {
    background: rgba(82, 226, 239, 0.32);
    color: #fff;
}

[data-theme="light"] ::selection {
    background: rgba(15, 122, 134, 0.22);
    color: var(--text-primary);
}

/* === ШАПКА === */
/* mobile: компактный single-row */
.app-header {
    position: relative;
    z-index: 5;
    margin: 10px 10px 0;
    padding: 10px 14px;
    border-radius: var(--radius-lg);
    background: var(--surface-2);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-1);
    overflow: hidden;
}

.app-header::before,
.app-header::after {
    content: none;
}

.app-header__inner {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.app-header__brand {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    flex: 1;
}

.brand-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.brand-icon {
    display: block;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    flex-shrink: 0;
}

.app-header__actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    padding: 5px 10px;
    border-radius: var(--radius-pill);
    background: rgba(82, 226, 239, 0.14);
    border: 1px solid var(--border-strong);
    color: var(--primary-color);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    line-height: 1;
}

.app-header h1 {
    display: none;
    font-size: clamp(22px, 4vw, 30px);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.05;
    color: var(--text-primary);
    margin: 4px 0 0;
}

.app-header .app-subtitle {
    display: none;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
    max-width: 580px;
}

/* кнопка выхода */
.logout-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 40px;
    width: 40px;
    padding: 0;
    border-radius: var(--radius-pill);
    border: 1px solid rgba(246, 86, 86, 0.32);
    background: rgba(246, 86, 86, 0.1);
    color: var(--error-color);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background var(--t-fast), border-color var(--t-fast);
}

.logout-btn > i {
    line-height: 1;
}

.logout-btn .logout-label {
    display: none;
}

.logout-btn:hover {
    background: rgba(246, 86, 86, 0.18);
    border-color: rgba(246, 86, 86, 0.5);
}

/* переключатель темы */
.theme-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border);
    background: var(--surface-3);
    color: var(--text-primary);
    cursor: pointer;
    transition: background var(--t-fast), border-color var(--t-fast);
    flex-shrink: 0;
}

.theme-toggle:hover {
    background: var(--surface-4);
    border-color: var(--border-strong);
}

.theme-toggle .icon-light,
.theme-toggle .icon-dark {
    position: absolute;
    font-size: 15px;
    transition: opacity var(--t-fast), transform var(--t-fast);
}

.theme-toggle[data-theme="light"] .icon-light {
    opacity: 1;
    transform: scale(1);
    color: #f59e0b;
}

.theme-toggle[data-theme="light"] .icon-dark {
    opacity: 0;
    transform: scale(0.7);
}

.theme-toggle[data-theme="dark"] .icon-dark {
    opacity: 1;
    transform: scale(1);
    color: #fbbf24;
}

.theme-toggle[data-theme="dark"] .icon-light {
    opacity: 0;
    transform: scale(0.7);
}

.theme-toggle .toggle-slider,
.theme-toggle-label {
    display: none;
}

/* === КОНТЕНТ === */
.app-content {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: var(--content-max);
    margin: 0 auto;
    padding: 16px 12px calc(96px + env(safe-area-inset-bottom));
}

.screen {
    display: none;
    animation: fadeUp 220ms ease-out;
}

.screen.active {
    display: block;
}

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

.screen-header {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 14px;
}

.screen-kicker {
    display: inline-flex;
    align-self: flex-start;
    padding: 4px 9px;
    border-radius: var(--radius-pill);
    background: rgba(82, 226, 239, 0.12);
    border: 1px solid var(--border-strong);
    color: var(--primary-color);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    line-height: 1;
    margin-bottom: 6px;
}

.screen-header h2 {
    font-size: clamp(20px, 3.6vw, 28px);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.1;
    color: var(--text-primary);
}

.screen-header p {
    font-size: 13px;
    color: var(--text-secondary);
    max-width: 680px;
    line-height: 1.45;
}

/* === НАВИГАЦИЯ ===
   Mobile (< 850): нижний таб-бар
   Desktop (>= 850): левый sidebar
   ====================================================================== */
.app-tabs {
    position: fixed;
    z-index: 50;
    bottom: max(8px, env(safe-area-inset-bottom));
    left: 50%;
    transform: translateX(-50%);
    width: min(calc(100% - 16px), 520px);
    height: 64px;
    padding: 6px;
    border-radius: 22px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-2);
    display: flex;
    align-items: stretch;
    gap: 4px;
}

.app-tabs__brand {
    display: none;
}

.app-tabs__list {
    display: flex;
    flex: 1;
    gap: 4px;
}

.tab {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 4px 6px;
    border: 0;
    border-radius: 16px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 10px;
    font-weight: 700;
    line-height: 1.2;
    cursor: pointer;
    transition: background var(--t-fast), color var(--t-fast);
}

.tab i {
    font-size: 18px;
    transition: transform var(--t-fast);
}

.tab__label {
    display: block;
    text-align: center;
}

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

.tab.active {
    background: rgba(82, 226, 239, 0.14);
    color: var(--primary-color);
}

.tab.active i {
    transform: scale(1.06);
}

.badge {
    position: absolute;
    top: 4px;
    right: 50%;
    transform: translateX(20px);
    min-width: 16px;
    height: 16px;
    padding: 0 5px;
    border-radius: 8px;
    background: #ff3b30;
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    line-height: 16px;
    text-align: center;
}

/* === КАРТОЧКИ === */
.profile-card,
.list-item,
.card,
.stat-item,
.auth-card {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px;
    transition: border-color var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast);
}

.profile-card:hover,
.list-item:hover,
.stat-item:hover {
    border-color: rgba(82, 226, 239, 0.2);
}

/* === КНОПКИ === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 10px 18px;
    border: 1px solid transparent;
    border-radius: var(--radius-pill);
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    transition: transform var(--t-fast), background var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast), opacity var(--t-fast);
    user-select: none;
    white-space: nowrap;
}

.btn i {
    font-size: 14px;
}

.btn:active {
    transform: translateY(1px);
}

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

/* primary — оранжевый CTA, как на лендинге */
.btn-primary {
    background: var(--gradient-warm);
    color: #fff;
    box-shadow: var(--shadow-glow-warm);
}

.btn-primary:hover {
    box-shadow: 0 14px 40px rgba(242, 102, 63, 0.42);
    filter: brightness(1.04);
}

/* secondary — cyan, для второстепенных действий */
.btn-secondary {
    background: var(--primary-deep);
    color: #fff;
    box-shadow: var(--shadow-glow-cool);
}

.btn-secondary:hover {
    background: #1f8e98;
    box-shadow: 0 14px 36px rgba(29, 161, 173, 0.4);
}

/* outline / cancel */
.btn-cancel,
.btn-edit {
    background: var(--surface-3);
    color: var(--text-primary);
    border-color: var(--border);
}

.btn-cancel:hover,
.btn-edit:hover {
    background: var(--surface-4);
    border-color: var(--border-strong);
}

.btn-danger {
    background: rgba(246, 86, 86, 0.12);
    color: var(--error-color);
    border-color: rgba(246, 86, 86, 0.36);
}

.btn-danger:hover {
    background: rgba(246, 86, 86, 0.22);
}

.btn-full {
    width: 100%;
}

.btn-sm {
    min-height: 34px;
    padding: 6px 14px;
    font-size: 12px;
    gap: 6px;
}

#profile-not-found .centered-button {
    display: inline-flex;
    margin: 18px auto 0;
}

/* === ФОРМЫ === */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
    position: relative;
}

.form-group label,
.profile-card .form-group label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
    letter-spacing: 0.02em;
}

.form-group label i,
.profile-card .form-group label i {
    color: var(--primary-color);
    font-size: 13px;
}

.form-group input,
.form-group select,
.form-group textarea,
.profile-card .form-group input,
.profile-card .form-group select,
.profile-card .form-group textarea {
    width: 100%;
    padding: 12px 14px;
    background: var(--surface-3);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 15px;
    font-family: inherit;
    transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
.profile-card .form-group input:focus,
.profile-card .form-group select:focus,
.profile-card .form-group textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(82, 226, 239, 0.18);
}

[data-theme="light"] .form-group input:focus,
[data-theme="light"] .form-group select:focus,
[data-theme="light"] .form-group textarea:focus,
[data-theme="light"] .profile-card .form-group input:focus,
[data-theme="light"] .profile-card .form-group select:focus,
[data-theme="light"] .profile-card .form-group textarea:focus {
    box-shadow: 0 0 0 3px rgba(15, 122, 134, 0.14);
}

.form-group textarea {
    min-height: 92px;
    resize: vertical;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.edit-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.edit-actions .btn {
    flex: 1;
}

/* === ПРОФИЛЬ-VIEW === */
.pv-card {
    padding: 0;
    overflow: hidden;
    position: relative;
}

.pv-card::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--gradient-cool);
}

.pv-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
}

.pv-header h3 {
    font-size: 17px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.pv-edit-btn {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border);
    background: var(--surface-3);
    color: var(--primary-color);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background var(--t-fast), border-color var(--t-fast);
}

.pv-edit-btn:hover {
    background: rgba(82, 226, 239, 0.14);
    border-color: var(--border-strong);
}

.pv-rows {
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pv-row {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    background: var(--surface-3);
    border: 1px solid transparent;
    transition: border-color var(--t-fast), background var(--t-fast);
}

.pv-row:hover {
    border-color: var(--border);
    background: var(--surface-4);
}

.pv-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    background: rgba(82, 226, 239, 0.16);
    border: 1px solid var(--border-strong);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.pv-icon i {
    color: var(--primary-color);
    font-size: 14px;
}

.pv-content {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    flex: 1;
}

.pv-label {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    text-transform: uppercase;
}

.pv-value {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    word-break: break-word;
    line-height: 1.4;
}

.pv-value.hours-view-list {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.7;
}

/* === БЕЙДЖИ СТАТУСОВ === */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 5px 10px;
    border: 1px solid currentColor;
    border-radius: var(--radius-pill);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    line-height: 1;
    background: transparent;
}

.status-active,
.status-confirmed {
    color: var(--success-color);
    background: rgba(61, 220, 151, 0.1);
}

.status-pending {
    color: var(--warning-color);
    background: rgba(242, 155, 63, 0.1);
}

.status-removed,
.status-rejected {
    color: var(--error-color);
    background: rgba(246, 86, 86, 0.1);
}

.status-processing-leader,
.status-processing-no-leader,
.status-min-players,
.status-full {
    color: var(--primary-color);
    background: rgba(82, 226, 239, 0.1);
}

/* === КАРТОЧКИ В СПИСКАХ (заявки/столы) === */
.list-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.list-item {
    position: relative;
    overflow: hidden;
}

.list-item::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--gradient-cool);
}

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

.card-eyebrow {
    display: block;
    margin-bottom: 4px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.booking-header strong {
    font-size: 17px;
    font-weight: 800;
    letter-spacing: -0.01em;
    color: var(--text-primary);
    line-height: 1.2;
}

.card-actions-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.card-topline {
    margin-bottom: 12px;
}

.management-card,
.booking-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* строки внутри карточки управления */
.table-mgmt-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.table-mgmt-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    background: var(--surface-3);
    border: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-primary);
}

.table-mgmt-row i {
    color: var(--primary-color);
    width: 18px;
    flex-shrink: 0;
}

.table-mgmt-row.row-danger {
    border-color: rgba(246, 86, 86, 0.32);
    background: rgba(246, 86, 86, 0.08);
    color: var(--error-color);
}

.table-mgmt-row.row-danger i {
    color: var(--error-color);
}

/* строки в заявке */
.table-info-flex {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.table-info-flex .info-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    background: var(--surface-3);
    border: 1px solid var(--border);
}

.info-icon {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.info-icon i {
    color: var(--primary-color);
    font-size: 14px;
}

.info-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
    letter-spacing: 0.02em;
}

.info-value {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    text-align: right;
    word-break: break-word;
}

.action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}

.action-buttons .btn {
    flex: 1 1 140px;
}

/* === СТАТЫ === */
.stats-bar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.stat-item {
    text-align: center;
    padding: 14px;
}

.stat-value {
    font-size: 30px;
    font-weight: 900;
    letter-spacing: -0.04em;
    line-height: 1;
    color: var(--primary-color);
    margin-bottom: 6px;
}

.stat-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

/* === ПУСТЫЕ СОСТОЯНИЯ === */
.empty-state {
    text-align: center;
    padding: 36px 20px;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-xl);
    background: rgba(82, 226, 239, 0.05);
}

.empty-state .icon-table,
.empty-state .icon-clipboard {
    font-size: 48px;
    color: var(--primary-color);
    margin-bottom: 14px;
}

.empty-state h3 {
    font-size: 18px;
    font-weight: 800;
    margin-bottom: 6px;
}

.empty-state p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.45;
}

/* === ЗАГРУЗКА === */
.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(8, 15, 31, 0.78);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    color: var(--text-secondary);
    font-size: 13px;
    z-index: 10;
}

[data-theme="light"] .loading-overlay {
    background: rgba(244, 247, 251, 0.86);
}

.spinner {
    width: 42px;
    height: 42px;
    border: 4px solid rgba(82, 226, 239, 0.2);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* === ОШИБКИ === */
.error-message,
.auth-error {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    background: rgba(246, 86, 86, 0.1);
    border: 1px solid rgba(246, 86, 86, 0.36);
    color: var(--error-color);
    font-size: 13px;
    line-height: 1.45;
    margin: 8px 0;
    text-align: center;
}

/* === АВТОРИЗАЦИЯ === */
.auth-screen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 22px;
    padding: 24px;
    background: var(--bg);
    overflow-y: auto;
    animation: fadeUp 220ms ease-out;
}

.auth-screen::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
            radial-gradient(circle at 15% 12%, rgba(82, 226, 239, 0.22), transparent 30rem),
            radial-gradient(circle at 86% 88%, rgba(241, 106, 62, 0.18), transparent 28rem);
    pointer-events: none;
}

.auth-logo {
    position: relative;
    z-index: 1;
    text-align: center;
    max-width: 460px;
}

.auth-logo__icon {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 18px;
    display: block;
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.45);
}

.auth-kicker {
    display: inline-flex;
    padding: 5px 11px;
    margin-bottom: 14px;
    border-radius: var(--radius-pill);
    background: rgba(82, 226, 239, 0.14);
    border: 1px solid var(--border-strong);
    color: var(--primary-color);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.auth-logo h1 {
    font-size: clamp(34px, 6vw, 52px);
    font-weight: 900;
    letter-spacing: -0.045em;
    line-height: 1;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.auth-logo p {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.auth-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
    padding: 22px 20px;
    border-radius: var(--radius-xl);
}

.auth-tabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    margin-bottom: 18px;
    border-radius: var(--radius-pill);
    background: var(--surface-3);
    border: 1px solid var(--border);
}

.auth-tab {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 12px;
    border: 0;
    border-radius: var(--radius-pill);
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background var(--t-fast), color var(--t-fast);
}

.auth-tab.active {
    background: var(--primary-deep);
    color: #fff;
    box-shadow: var(--shadow-glow-cool);
}

/* === SMS / Telegram auth === */
.auth-code-hint {
    margin-bottom: 14px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    background: var(--surface-3);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 13px;
    text-align: center;
}
.auth-code-hint #auth-code-phone {
    color: var(--text-primary);
    font-weight: 700;
}

#code-input {
    text-align: center;
    letter-spacing: 12px;
    font-size: 22px;
    font-weight: 700;
    padding-left: 12px;
}

.auth-code-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 14px;
    align-items: center;
}

.auth-link {
    background: transparent;
    border: 0;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: var(--radius-md);
    transition: color var(--t-fast), background var(--t-fast);
}
.auth-link:not(:disabled):hover {
    color: var(--text-primary);
    background: var(--surface-3);
}
.auth-link:disabled {
    cursor: default;
    opacity: 0.6;
}

.auth-tg-hint {
    text-align: center;
    margin-bottom: 18px;
    color: var(--text-primary);
}
.auth-tg-hint p {
    margin: 0 0 6px 0;
    font-size: 14px;
}
.auth-tg-hint__sub {
    color: var(--text-secondary);
    font-size: 12px !important;
}

/* === ИЗМЕНЕНИЕ ВРЕМЕНИ РАБОТЫ === */
.profile-edit-card {
    padding: 18px;
}

#profile-edit {
    gap: 18px;
    flex-direction: column;
}

.working-hours-section {
    margin-top: 16px;
    padding: 16px;
    border-radius: var(--radius-lg);
    background: var(--surface-3);
    border: 1px solid var(--border);
}

.wh-section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: -0.01em;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.wh-title-bar {
    display: inline-block;
    width: 6px;
    height: 18px;
    border-radius: 3px;
    background: var(--gradient-cool);
}

.wh-templates {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}

.wh-tpl-btn {
    display: flex;
    align-items: center;
    padding: 11px 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}

.wh-tpl-btn:hover {
    background: var(--surface-4);
    color: var(--text-primary);
}

.wh-tpl-btn.active {
    background: rgba(82, 226, 239, 0.14);
    border-color: var(--border-strong);
    color: var(--primary-color);
}

.wh-group {
    padding: 12px;
    border-radius: var(--radius-md);
    background: var(--surface-2);
    border: 1px solid var(--border);
    margin-bottom: 8px;
    transition: opacity var(--t-fast);
}

.wh-group.closed {
    opacity: 0.45;
}

.wh-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.wh-group-label {
    font-size: 13px;
    font-weight: 800;
    color: var(--primary-color);
}

.wh-group-actions {
    display: flex;
    gap: 6px;
}

.wh-closed-btn,
.wh-delete-btn {
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface-3);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}

.wh-closed-btn.active {
    background: rgba(246, 86, 86, 0.15);
    color: var(--error-color);
    border-color: rgba(246, 86, 86, 0.32);
}

.wh-delete-btn:hover {
    background: rgba(246, 86, 86, 0.15);
    color: var(--error-color);
    border-color: rgba(246, 86, 86, 0.32);
}

.wh-group-inputs {
    display: flex;
    align-items: center;
    gap: 10px;
}

.wh-group-inputs input[type="text"] {
    flex: 1;
    min-width: 0;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--surface-3);
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 600;
    text-align: center;
    letter-spacing: 0.06em;
    font-family: inherit;
    transition: border-color var(--t-fast), box-shadow var(--t-fast);
}

.wh-group-inputs input[type="text"]:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(82, 226, 239, 0.18);
}

.wh-group-inputs input[type="text"]:disabled {
    opacity: 0.4;
}

.wh-group-inputs input[type="text"]::placeholder {
    color: var(--text-muted);
    font-weight: 400;
    letter-spacing: 0;
}

.wh-dash {
    color: var(--text-muted);
    font-weight: 700;
}

.wh-day-toggles {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.wh-day-toggle {
    min-width: 44px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 700;
    text-align: center;
    cursor: pointer;
    transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}

.wh-day-toggle.selected {
    background: rgba(82, 226, 239, 0.18);
    color: var(--primary-color);
    border-color: var(--border-strong);
}

.wh-day-toggle.used {
    opacity: 0.3;
    pointer-events: none;
}

.wh-create-group-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 18px;
    border: 0;
    border-radius: var(--radius-pill);
    background: var(--gradient-warm);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: filter var(--t-fast), box-shadow var(--t-fast);
    box-shadow: var(--shadow-glow-warm);
    margin-bottom: 12px;
}

.wh-create-group-btn:hover:not(:disabled) {
    filter: brightness(1.05);
}

.wh-create-group-btn:disabled {
    opacity: 0.4;
    box-shadow: none;
    cursor: not-allowed;
}

.wh-summary {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.wh-summary-title {
    margin-bottom: 8px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.wh-summary-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    text-align: center;
}

.wh-summary-day {
    font-size: 10px;
    font-weight: 800;
    color: var(--text-secondary);
    padding-bottom: 4px;
}

.wh-summary-time {
    font-size: 10px;
    line-height: 1.4;
    padding: 4px 2px;
    border-radius: var(--radius-sm);
}

.wh-summary-time.open {
    color: var(--success-color);
    background: rgba(61, 220, 151, 0.12);
}

.wh-summary-time.closed-day {
    color: var(--text-muted);
    background: var(--surface-3);
}

.hours-view-list {
    font-size: 13px;
    line-height: 1.7;
    color: var(--text-primary);
}

/* === ДОБАВЛЕНИЕ СТОЛА === */
.add-table-card form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.form-step-card {
    padding: 14px;
    border-radius: var(--radius-lg);
    background: var(--surface-3);
    border: 1px solid var(--border);
}

.form-step-card > .wh-section-title:first-child {
    margin-top: 0 !important;
}

.table-venue-hours {
    padding: 12px;
    border-radius: var(--radius-md);
    background: var(--surface-2);
    border: 1px solid var(--border);
    margin-bottom: 12px;
    font-size: 13px;
    line-height: 1.6;
}

.exc-week-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin-bottom: 12px;
}

.exc-nav-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text-primary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background var(--t-fast), border-color var(--t-fast);
}

.exc-nav-btn:hover:not(:disabled) {
    background: rgba(82, 226, 239, 0.14);
    border-color: var(--border-strong);
}

.exc-nav-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.exc-week-label {
    min-width: 180px;
    font-size: 13px;
    font-weight: 700;
    text-align: center;
    color: var(--text-primary);
}

/* === SLOT GRID === */
.slot-grid-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -4px;
    padding: 0 4px;
}

.slot-grid {
    display: grid;
    grid-template-columns: 44px repeat(7, 1fr);
    gap: 2px;
    min-width: 320px;
    user-select: none;
    -webkit-user-select: none;
}

.slot-grid-header {
    font-size: 11px;
    font-weight: 800;
    color: var(--text-secondary);
    text-align: center;
    padding: 6px 2px;
    line-height: 1.2;
}

.slot-grid-header.today {
    color: var(--primary-color);
}

.slot-hour-label {
    font-size: 10px;
    color: var(--text-muted);
    text-align: right;
    padding-right: 4px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    font-weight: 600;
}

.slot-cell {
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background var(--t-fast), opacity var(--t-fast);
}

.slot-cell.available {
    background: rgba(82, 226, 239, 0.22);
    border-color: rgba(82, 226, 239, 0.18);
}

.slot-cell.available:hover {
    background: rgba(82, 226, 239, 0.36);
}

.slot-cell.closed-mgr {
    background: rgba(246, 86, 86, 0.3);
    border-color: rgba(246, 86, 86, 0.22);
}

.slot-cell.closed-mgr:hover {
    background: rgba(246, 86, 86, 0.42);
}

.slot-cell.venue-off {
    background: rgba(255, 255, 255, 0.04);
    cursor: default;
    opacity: 0.5;
}

.slot-cell.booked {
    background: rgba(61, 220, 151, 0.34);
    border-color: rgba(61, 220, 151, 0.24);
    cursor: default;
}

.slot-cell.booked:hover {
    background: rgba(61, 220, 151, 0.34);
}

[data-theme="light"] .slot-cell.venue-off {
    background: var(--surface-3);
}

.slot-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 12px;
}

.slot-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 600;
}

.slot-dot {
    width: 12px;
    height: 12px;
    border-radius: 4px;
}

.slot-dot.slot-available { background: rgba(82, 226, 239, 0.42); }
.slot-dot.slot-closed-mgr { background: rgba(246, 86, 86, 0.42); }
.slot-dot.slot-venue-off { background: rgba(255, 255, 255, 0.16); }
.slot-dot.slot-booked { background: rgba(61, 220, 151, 0.5); }

/* === MINI SCHEDULE === */
.mini-schedule {
    margin-top: 10px;
    padding: 12px;
    border-radius: var(--radius-md);
    background: var(--surface-3);
    border: 1px solid var(--border);
}

.mini-schedule-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 8px;
}

.mini-schedule-nav button {
    width: 26px;
    height: 26px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text-primary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    transition: background var(--t-fast), border-color var(--t-fast);
}

.mini-schedule-nav button:hover {
    background: rgba(82, 226, 239, 0.14);
    border-color: var(--border-strong);
}

.mini-schedule-nav span {
    min-width: 100px;
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
}

.mini-grid {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.mini-grid-row {
    display: flex;
    align-items: center;
    gap: 4px;
}

.mini-grid-day {
    width: 22px;
    flex-shrink: 0;
    font-size: 10px;
    font-weight: 800;
    color: var(--text-secondary);
}

.mini-grid-cells {
    display: flex;
    gap: 1px;
    flex: 1;
    min-width: 0;
}

.mini-cell {
    flex: 1;
    height: 14px;
    border-radius: 3px;
    min-width: 0;
}

.mini-cell.mc-open    { background: rgba(82, 226, 239, 0.32); }
.mini-cell.mc-closed  { background: rgba(246, 86, 86, 0.4); }
.mini-cell.mc-off     { background: rgba(255, 255, 255, 0.06); }
.mini-cell.mc-booked  { background: rgba(61, 220, 151, 0.5); }

[data-theme="light"] .mini-cell.mc-off { background: var(--surface-3); }

.mini-hours-label {
    display: flex;
    gap: 1px;
    margin-left: 26px;
    margin-top: 2px;
}

.mini-hours-label span {
    flex: 1;
    text-align: center;
    font-size: 7px;
    color: var(--text-muted);
    overflow: hidden;
    min-width: 0;
}

/* === АВТОКОМПЛИТ === */
.suggestions-list {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 50;
    margin-top: 6px;
    max-height: 260px;
    overflow-y: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--surface-2);
    box-shadow: var(--shadow-2);
}

.suggestions-list.active {
    display: block;
}

.suggestion-item {
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background var(--t-fast);
}

.suggestion-item:last-child {
    border-bottom: 0;
}

.suggestion-item:hover {
    background: rgba(82, 226, 239, 0.1);
}

.suggestion-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}

.suggestion-address {
    margin-top: 2px;
    font-size: 12px;
    color: var(--text-secondary);
}

/* === КАРТОЧКИ ПОДТВЕРЖДЕНИЯ === */
.confirmation-card {
    padding: 14px;
    border-left: 4px solid var(--border);
    margin-bottom: 8px;
}

.confirmation-card.needs-confirm {
    border-left-color: var(--secondary-color);
}

.confirmation-card.is-confirmed {
    border-left-color: var(--success-color);
}

.confirmation-card-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.confirmation-date {
    font-size: 14px;
    font-weight: 800;
    color: var(--text-primary);
}

.confirmation-meta {
    margin-top: 3px;
    font-size: 12px;
    color: var(--text-secondary);
}

.confirmation-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--success-color);
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

/* === АЛЕРТЫ === */
.custom-alert {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-2);
    font-size: 13px;
    font-weight: 700;
    transition: opacity var(--t-fast), transform var(--t-fast);
    max-width: calc(100% - 32px);
    animation: alertIn 200ms ease-out;
}

@keyframes alertIn {
    from { opacity: 0; transform: translate(-50%, -8px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

.custom-alert.success {
    background: rgba(61, 220, 151, 0.95);
    color: #08231a;
    border-color: rgba(61, 220, 151, 0.6);
}

.custom-alert.error {
    background: rgba(246, 86, 86, 0.96);
    color: #fff;
    border-color: rgba(246, 86, 86, 0.6);
}

.custom-alert.warning {
    background: rgba(242, 155, 63, 0.96);
    color: #2a1606;
    border-color: rgba(242, 155, 63, 0.6);
}

/* === ДИАГНОСТИКА === */
.diagnostic-panel {
    position: fixed;
    top: 12px;
    left: 12px;
    right: 12px;
    z-index: 10001;
    border-radius: var(--radius-lg);
    border: 2px solid var(--warning-color);
    background: var(--surface-2);
    box-shadow: var(--shadow-2);
    animation: alertIn 220ms ease-out;
}

.diagnostic-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--warning-color);
    color: #1d0e02;
    font-weight: 800;
    border-radius: 16px 16px 0 0;
}

.diagnostic-header button {
    background: transparent;
    border: 0;
    color: inherit;
    font-size: 16px;
    cursor: pointer;
}

.diagnostic-content {
    padding: 12px 14px;
    max-height: 280px;
    overflow-y: auto;
    font-size: 13px;
}

.diagnostic-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
}

.diagnostic-item:last-child { border-bottom: 0; }
.diagnostic-item.success { color: var(--success-color); }
.diagnostic-item.error { color: var(--error-color); }
.diagnostic-item.warning { color: var(--warning-color); }

/* === ОШИБКА СЕТИ === */
.network-error-overlay {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10002;
    padding: 22px;
    border-radius: var(--radius-xl);
    border: 2px solid var(--error-color);
    background: var(--surface-2);
    box-shadow: var(--shadow-2);
    animation: alertIn 220ms ease-out;
}

/* === FOOTER === */
.version-footer {
    margin-top: 24px;
    padding: 12px 16px;
    border-radius: var(--radius-pill);
    background: var(--surface-2);
    border: 1px solid var(--border);
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
}

.version-footer .version,
.version-footer .chat-id {
    font-weight: 700;
    letter-spacing: 0.04em;
}

.version-footer .dev-mode {
    padding: 2px 9px;
    border-radius: var(--radius-pill);
    background: rgba(242, 155, 63, 0.16);
    color: var(--warning-color);
    border: 1px solid rgba(242, 155, 63, 0.3);
    font-size: 10px;
    font-weight: 800;
}

/* === TELEGRAM ERROR (для не-TG) === */
.telegram-error {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    text-align: center;
    background: var(--bg);
    animation: fadeUp 220ms ease-out;
}

.telegram-error h2 {
    font-size: 22px;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 14px;
}

.telegram-error p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 22px;
    max-width: 320px;
}

.telegram-error button {
    margin: 4px;
    padding: 11px 20px;
    border-radius: var(--radius-pill);
    border: 0;
    background: var(--gradient-warm);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: var(--shadow-glow-warm);
}

.telegram-error button.secondary {
    background: var(--surface-3);
    color: var(--text-primary);
    border: 1px solid var(--border);
    box-shadow: none;
}

/* =====================================================================
   DESKTOP (>= 850px) — sidebar layout
   ===================================================================== */
@media (min-width: 850px) {
    .app-header {
        margin: 16px 16px 0 calc(var(--sidebar-w) + 16px);
        padding: 22px 26px;
        border-radius: 24px;
    }

    .app-content {
        margin-left: var(--sidebar-w);
    }

    .app-header h1 {
        display: block;
        font-size: clamp(26px, 2.4vw, 36px);
        margin-top: 6px;
    }

    .app-header .app-subtitle {
        display: block;
        font-size: 14px;
        margin-top: 6px;
    }

    .brand-icon {
        width: 40px;
        height: 40px;
    }

    .logout-btn {
        width: auto;
        height: 40px;
        padding: 0 14px;
    }

    .logout-btn .logout-label {
        display: inline;
    }

    .app-content {
        padding: 22px 16px 32px;
    }

    /* Sidebar */
    .app-tabs {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        right: auto;
        transform: none;
        width: var(--sidebar-w);
        height: 100dvh;
        padding: 22px 14px;
        border-radius: 0;
        border: 0;
        border-right: 1px solid var(--border);
        background: var(--surface-2);
        box-shadow: none;
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
        overflow-y: auto;
    }

    .app-tabs__brand {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 10px;
        padding: 8px 12px 14px;
        border-bottom: 1px solid var(--border);
        margin-bottom: 6px;
    }

    .app-tabs__brand-icon {
        width: 36px;
        height: 36px;
        border-radius: 50%;
        object-fit: cover;
        flex-shrink: 0;
        box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
    }

    .app-tabs__brand-text {
        display: flex;
        flex-direction: column;
        gap: 2px;
        min-width: 0;
    }

    .app-tabs__brand-mark {
        font-size: 17px;
        font-weight: 900;
        letter-spacing: -0.02em;
        background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
        -webkit-background-clip: text;
        background-clip: text;
        color: transparent;
    }

    .app-tabs__brand-sub {
        font-size: 11px;
        font-weight: 700;
        letter-spacing: 0.08em;
        text-transform: uppercase;
        color: var(--text-muted);
    }

    .app-tabs__list {
        flex-direction: column;
        gap: 4px;
    }

    .tab {
        flex: 0 0 auto;
        flex-direction: row;
        justify-content: flex-start;
        gap: 12px;
        padding: 11px 14px;
        border-radius: var(--radius-md);
        font-size: 14px;
        font-weight: 700;
        text-align: left;
    }

    .tab i {
        font-size: 17px;
        width: 22px;
        text-align: center;
    }

    .tab__label {
        text-align: left;
        flex: 1;
    }

    .tab.active {
        background: rgba(82, 226, 239, 0.14);
        color: var(--primary-color);
    }

    .badge {
        position: static;
        transform: none;
        margin-left: auto;
    }

    /* Layouts on desktop */
    .form-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 16px;
    }

    .stats-bar {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 16px;
    }

    .list-container {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 16px;
    }

    .list-container > .empty-state {
        grid-column: 1 / -1;
    }

    /* Заявки оставляем в одну колонку — карточки большие */
    #requests-list.list-container {
        grid-template-columns: 1fr;
        max-width: 880px;
    }

    .stat-value {
        font-size: 36px;
    }

    .pv-rows {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .booking-header strong {
        font-size: 19px;
    }

    .stat-item {
        padding: 18px;
    }

    .working-hours-section {
        padding: 20px;
    }

    .form-step-card {
        padding: 18px;
    }

    /* sticky save panel в редакторе профиля */
    .profile-edit-card .edit-actions {
        position: sticky;
        bottom: 12px;
        z-index: 5;
        padding: 10px;
        border-radius: var(--radius-pill);
        background: var(--surface-2);
        border: 1px solid var(--border);
        box-shadow: var(--shadow-2);
        backdrop-filter: blur(8px);
    }

    .auth-card {
        max-width: 460px;
        padding: 28px;
    }

    .empty-state {
        padding: 56px 24px;
    }

    .slot-cell {
        height: 32px;
    }

    .slot-grid {
        grid-template-columns: 56px repeat(7, 1fr);
        min-width: auto;
    }

    .mini-cell {
        height: 16px;
    }

    .table-info-flex {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    /* двухколоночная сетка строк профиля управления столом */
    .table-mgmt-info {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .table-mgmt-row.row-danger,
    .table-mgmt-row:has(> i.fa-comment) {
        grid-column: 1 / -1;
    }

    .version-footer {
        margin-top: 32px;
    }
}

/* =====================================================================
   WIDE DESKTOP (>= 1280px) — больше воздуха
   ===================================================================== */
@media (min-width: 1280px) {
    :root {
        --sidebar-w: 268px;
    }

    .app-header h1 {
        font-size: 38px;
    }

    .app-content {
        padding: 28px 24px 40px;
    }

    .form-grid {
        gap: 20px;
    }

    .list-container {
        gap: 18px;
    }
}

/* =====================================================================
   MOBILE TIGHT (< 380px)
   ===================================================================== */
@media (max-width: 379px) {
    .app-header {
        padding: 8px 12px;
    }

    .brand-icon {
        width: 28px;
        height: 28px;
    }

    .brand-mark {
        font-size: 10px;
        padding: 4px 8px;
    }

    .tab {
        font-size: 9px;
    }

    .tab i {
        font-size: 16px;
    }

    .pv-row {
        padding: 10px 12px;
    }

    .pv-icon {
        width: 32px;
        height: 32px;
    }
}

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

/* === FOCUS VISIBILITY (для клавиатурной навигации) === */
:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
    border-radius: 4px;
}

button:focus-visible,
.btn:focus-visible,
.tab:focus-visible,
.theme-toggle:focus-visible {
    outline-offset: 3px;
}
