/* ========================================
   AKME.Rent WebUI — Основные стили
   ========================================
   Поддерживает:
   - Обычный браузер / iframe
   - Telegram Mini App (с CSS-переменными темы)
   - Адаптивность (мобильные + десктоп)
   ======================================== */

/* === CSS-переменные (дефолтные значения, переопределяются Telegram темой) === */
:root {
    --color-primary: #2481cc;
    --color-primary-hover: #1a6bb0;
    --color-danger: #e53935;
    --color-danger-hover: #c62828;
    --color-success: #43a047;
    --color-warning: #ff9800;

    --color-bg: #f5f6fa;
    --color-surface: #ffffff;
    --color-text: #1a1a2e;
    --color-text-secondary: #6b7280;
    --color-border: #e5e7eb;
    --color-shadow: rgba(0, 0, 0, 0.08);

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;

    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;

    /* Переменные Telegram (перезаписываются JS при запуске в Mini App) */
    --tg-theme-bg-color: #ffffff;
    --tg-theme-text-color: #000000;
    --tg-theme-hint-color: #999999;
    --tg-theme-link-color: #2481cc;
    --tg-theme-button-color: #2481cc;
    --tg-theme-button-text-color: #ffffff;
    --tg-theme-secondary-bg-color: #f0f0f0;
}

/* === Сброс и базовые стили === */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    font-family: var(--font-family);
    font-size: 15px;
    line-height: 1.5;
    color: var(--color-text);
    background: var(--color-bg);
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--color-primary);
    text-decoration: none;

    &:hover {
        text-decoration: underline;
    }
}

/* === Telegram Mini App адаптация === */
.tg-mini-app {
    background: var(--tg-theme-bg-color);
    color: var(--tg-theme-text-color);

    & a {
        color: var(--tg-theme-link-color);
    }

    & .btn-primary {
        background: var(--tg-theme-button-color);
        color: var(--tg-theme-button-text-color);
    }
}

/* === Макет === */
.main-layout {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
}

.main-content {
    flex: 1;
    padding: 16px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.telegram-content {
    padding: 8px;
}

/* === Шапка === */
.top-header {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: 0 16px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Колокольчик уведомлений */
.notification-bell-wrapper {
    position: relative;
}

.notification-bell-container {
    display: flex;
    align-items: center;
    gap: 6px;
}

.bell-btn {
    position: relative;
    background: none;
    border: none;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 1.25rem;
    border-radius: var(--radius-sm);
    transition: background 0.15s;
}

.bell-btn:hover {
    background: var(--color-bg);
}

.bell-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    font-size: 0.65rem;
    font-weight: 700;
    color: white;
    background: var(--color-danger, #dc3545);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.debt-badge {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-danger, #dc3545);
}

.notification-overlay {
    position: fixed;
    inset: 0;
    z-index: 99;
}

.notification-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 280px;
    max-width: 360px;
    max-height: 400px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    z-index: 100;
    overflow: hidden;
}

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

.notification-dropdown-header h4 {
    margin: 0;
    font-size: 0.95rem;
}

.debt-in-dropdown {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-danger, #dc3545);
}

.notification-list {
    padding: 12px;
    max-height: 250px;
    overflow-y: auto;
}

.no-notifications {
    margin: 0;
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    text-align: center;
    padding: 16px 0;
}

.notification-dropdown-footer {
    padding: 8px 16px;
    border-top: 1px solid var(--color-border);
}

.dropdown-link {
    display: block;
    padding: 8px 0;
    color: var(--color-primary);
    text-decoration: none;
    font-size: 0.9rem;
}

.dropdown-link:hover {
    text-decoration: underline;
}

.logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-primary);
    text-decoration: none;
}

/* === Подвал === */
.main-footer {
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    padding: 16px;
    text-align: center;
    color: var(--color-text-secondary);
    font-size: 0.85rem;
}

/* === Навигационное меню === */
.nav-menu {
    display: flex;
    align-items: center;
}

.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
}

.hamburger-line {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--color-text);
    border-radius: 1px;
    transition: transform 0.2s;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-link {
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    color: var(--color-text);
    font-size: 0.9rem;
    text-decoration: none;
    transition: background 0.15s;
    border: none;
    background: none;
    cursor: pointer;
    font-family: inherit;

    &:hover {
        background: var(--color-bg);
        text-decoration: none;
    }

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

.nav-logout {
    color: var(--color-danger);
}

.nav-separator {
    width: 1px;
    height: 24px;
    background: var(--color-border);
    margin: 0 4px;
}

/* Мобильное меню */
@media (max-width: 768px) {
    .menu-toggle {
        display: flex;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: 56px;
        left: 0;
        right: 0;
        flex-direction: column;
        background: var(--color-surface);
        border-bottom: 1px solid var(--color-border);
        padding: 8px;
        box-shadow: 0 4px 12px var(--color-shadow);
        gap: 2px;
    }

    .nav-menu.open .nav-links {
        display: flex;
    }

    .nav-separator {
        width: 100%;
        height: 1px;
        margin: 4px 0;
    }

    .nav-link {
        width: 100%;
        text-align: left;
    }
}

/* === Кнопки === */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, opacity 0.15s;
    font-family: inherit;
    /* width: 100%; */

    &:hover:not(:disabled) {
        background: var(--color-primary-hover);
    }

    &:disabled {
        opacity: 0.6;
        cursor: not-allowed;
    }
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    background: var(--color-surface);
    color: var(--color-text);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.15s;
    font-family: inherit;

    &:hover {
        background: var(--color-bg);
    }
}

.btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    background: var(--color-danger);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    cursor: pointer;
    font-family: inherit;

    &:hover {
        background: var(--color-danger-hover);
    }
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.85rem;
    width: auto;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 1.2rem;
    cursor: pointer;

    &:hover:not(:disabled) {
        background: var(--color-bg);
    }

    &:disabled {
        opacity: 0.4;
        cursor: not-allowed;
    }
}

.btn-link {
    background: none;
    border: none;
    color: var(--color-primary);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.95rem;
    padding: 4px 0;

    &:hover {
        text-decoration: underline;
    }
}

/* === Спиннер загрузки === */
.loading-spinner-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 16px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px 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); }
}

.loading-text {
    margin-top: 12px;
    color: var(--color-text-secondary);
    font-size: 0.9rem;
}

/* === Сообщения об ошибке / успехе === */
.error-message, .success-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 32px 16px;
    text-align: center;
}

.error-icon {
    font-size: 2.5rem;
    color: var(--color-danger);
    margin-bottom: 12px;
}

.success-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--color-success);
    color: white;
    /* font-size: 2rem; */
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

.error-text, .success-text {
    color: var(--color-text-secondary);
    margin-bottom: 16px;
}

.btn-retry {
    padding: 8px 20px;
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: inherit;
}

/* === Модальное окно === */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    z-index: 1000;
    padding: max(16px, env(safe-area-inset-top)) 16px 24px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.modal-dialog {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 24px;
    max-width: 400px;
    width: 100%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    margin: 24px 0;
    max-height: min(90dvh, calc(100dvh - 48px));
    overflow-y: auto;
    min-height: 0;
}

.modal-title {
    font-size: 1.15rem;
    margin-bottom: 8px;
}

.modal-message {
    color: var(--color-text-secondary);
    margin-bottom: 20px;
}

.modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.modal-wide {
    max-width: 520px;
}

.modal-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.modal-header-row h3 {
    margin: 0;
    font-size: 1.15rem;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    color: var(--color-text-secondary);
    padding: 4px;
}

.close-btn:hover {
    color: var(--color-text);
}

/* Выпадающее меню действий.
   Важно: обёртка таблицы (.data-table-wrapper) использует overflow-x: auto; тогда по правилам CSS
   вертикальный overflow фактически тоже ограничен, и меню с position:absolute «вверх» от кнопки
   обрезается границей блока. Панель открываем вниз; у ячейки с открытым меню поднимаем z-index
   (см. .actions-cell:has), чтобы список перекрывал соседние строки таблицы. */
.actions-dropdown {
    position: relative;
    display: inline-block;
}

.actions-trigger {
    padding: 6px 10px;
    font-size: 1.2rem;
    line-height: 1;
}

.actions-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    min-width: 180px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    box-shadow: 0 4px 12px var(--color-shadow);
    z-index: 300;
    padding: 4px 0;
}

.actions-menu-item {
    display: block;
    width: 100%;
    padding: 10px 14px;
    text-align: left;
    border: none;
    background: none;
    font-size: 0.9rem;
    cursor: pointer;
    font-family: inherit;
    color: var(--color-text);
    transition: background 0.15s;
}

.actions-menu-item:hover {
    background: var(--color-bg);
}

.actions-menu-item.success:hover {
    background: #e8f5e9;
}

.actions-menu-item.danger:hover {
    background: #ffebee;
    color: var(--color-danger);
}

/* Детали бронирования */
.booking-details-body {
    margin-bottom: 16px;
}

.details-grid {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 8px 16px;
    font-size: 0.95rem;
}

.details-grid dt {
    color: var(--color-text-secondary);
    font-weight: 500;
}

.details-grid dd {
    margin: 0;
}

.cancel-reason-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.95rem;
    margin-bottom: 16px;
    resize: vertical;
}

/* Заголовки страниц модератора */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.page-subtitle {
    color: var(--color-text-secondary);
    font-size: 0.9rem;
    margin-top: 4px;
}

.moderator-bookings-header .page-subtitle {
    margin-bottom: 0;
}

/* Сетка статистики */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: 0 2px 8px var(--color-shadow);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    margin-bottom: 8px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text);
}

.stats-section {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px var(--color-shadow);
}

.stats-section h3 {
    font-size: 1rem;
    margin-bottom: 12px;
}

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

.load-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--color-border);
}

.load-item:last-child {
    border-bottom: none;
}

/* Настройки */
.settings-sections {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.settings-card {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: 0 2px 8px var(--color-shadow);
}

.settings-card h3 {
    font-size: 1.1rem;
    margin-bottom: 16px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

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

.form-group label {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
}

.form-hint {
    font-size: 0.8rem;
    color: var(--color-text-secondary);
    margin: 4px 0 8px;
}

/* Секция фотографий кабинета в форме модератора */
.cabinet-photos-section {
    margin-top: 16px;
}

.cabinet-photos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
    margin-bottom: 12px;
}

.cabinet-photo-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 2px solid var(--color-border);
}

.cabinet-photo-item.is-main {
    border-color: var(--color-primary);
}

.cabinet-photo-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cabinet-photo-actions {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    gap: 4px;
    padding: 6px;
    background: rgba(0, 0, 0, 0.6);
    opacity: 0;
    transition: opacity 0.2s;
}

.cabinet-photo-item:hover .cabinet-photo-actions {
    opacity: 1;
}

.cabinet-photo-actions .btn-icon {
    flex: 1;
    color: #fff;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px;
    font-size: 1rem;
}

.cabinet-photo-actions .btn-danger {
    color: var(--color-danger);
}

.photo-main-badge {
    position: absolute;
    top: 6px;
    left: 6px;
    font-size: 0.7rem;
    background: var(--color-primary);
    color: #fff;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
}

.cabinet-photo-upload {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.file-input-hidden {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    overflow: hidden;
}

/* Секция дополнительных услуг в форме кабинета */
.cabinet-services-section {
    margin-top: 16px;
}

.cabinet-services-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.cabinet-service-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--color-bg);
    border-radius: var(--radius-sm);
}

.cabinet-service-add {
    display: flex;
    gap: 8px;
    align-items: center;
}

.cabinet-service-add .service-select {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.9rem;
}

.form-input {
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
}

.export-sections {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.export-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.export-status {
    color: var(--color-text-secondary);
    margin-top: 16px;
}

.coming-soon-card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 48px;
    text-align: center;
    box-shadow: 0 2px 8px var(--color-shadow);
}

.coming-soon-icon {
    font-size: 3rem;
    margin-bottom: 16px;
}

.coming-soon-card h3 {
    margin-bottom: 12px;
}

.coming-soon-card p {
    color: var(--color-text-secondary);
    max-width: 400px;
    margin: 0 auto;
}

/* Страница деталей пользователя */
.back-link {
    display: inline-block;
    color: var(--color-text-secondary);
    font-size: 0.9rem;
    margin-bottom: 8px;
    text-decoration: none;
}

.back-link:hover {
    color: var(--color-primary);
}

.user-detail-header {
    flex-wrap: wrap;
}

.user-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.detail-card {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: 0 2px 8px var(--color-shadow);
}

.detail-card.full-width {
    grid-column: 1 / -1;
}

.detail-card h3 {
    font-size: 1rem;
    margin-bottom: 16px;
}

.notes-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.95rem;
    margin-bottom: 12px;
    resize: vertical;
}

.load-more-hint {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    margin-top: 8px;
}

.no-data-inline {
    color: var(--color-text-secondary);
    font-style: italic;
}

.form-field {
    margin-bottom: 16px;
}

.form-field label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 6px;
}

.custom-select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
}

.field-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--color-text-secondary);
}

/* Диалог блокировки пользователя (BlockUserDialog) */
.block-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    z-index: 1000;
    padding: max(16px, env(safe-area-inset-top)) 16px 24px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.block-modal-content {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 500px;
    padding: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    margin: 24px 0;
    max-height: min(90dvh, calc(100dvh - 48px));
    overflow-y: auto;
    min-height: 0;
}

.block-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.block-modal-header h3 {
    margin: 0;
    font-size: 1.15rem;
}

.block-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    color: var(--color-text-secondary);
    padding: 4px;
}

.block-modal-close:hover {
    color: var(--color-text);
}

.block-modal-body {
    margin-bottom: 20px;
}

.block-modal-textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.95rem;
    resize: vertical;
}

.block-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* === Галерея фотографий (PhotoGallery) === */
.photo-gallery-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    outline: none;
}

.photo-gallery-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 1.75rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: background 0.2s;
}

.photo-gallery-close:hover {
    background: rgba(255, 255, 255, 0.25);
}

.photo-gallery-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 80px;
    max-width: 100%;
}

.photo-gallery-img {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
    border-radius: var(--radius-md);
}

.photo-gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: background 0.2s;
}

.photo-gallery-nav:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.3);
}

.photo-gallery-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.photo-gallery-prev {
    left: 16px;
}

.photo-gallery-next {
    right: 16px;
}

.photo-gallery-counter {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
}

@media (max-width: 600px) {
    .photo-gallery-content {
        padding: 50px 16px;
    }

    .photo-gallery-nav {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }

    .photo-gallery-prev {
        left: 8px;
    }

    .photo-gallery-next {
        right: 8px;
    }
}

/* === Главная страница === */
.hero-section {
    text-align: center;
    padding: 32px 16px;
}

.hero-section h1 {
    font-size: 1.75rem;
    margin-bottom: 8px;
}

.hero-subtitle {
    color: var(--color-text-secondary);
}

/* Страница /cabinets — кабинеты по линиям (слева фото+инфо, справа описание) */
.cabinets-rows {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.cabinet-row {
    display: flex;
    flex-direction: row;
    gap: 24px;
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 2px 8px var(--color-shadow);
    cursor: pointer;
    transition: box-shadow 0.15s;
    align-items: stretch;
}

.cabinet-row:hover {
    box-shadow: 0 4px 16px var(--color-shadow);
}

.cabinet-row-left {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    width: 280px;
}

.cabinet-row-left .cabinet-photo {
    aspect-ratio: 16 / 10;
}

.cabinet-row-info {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cabinet-row-info .cabinet-name {
    font-size: 1.1rem;
    margin: 0;
}

.cabinet-row-info .cabinet-price {
    margin: 0;
}

.cabinet-row-info .btn-book {
    margin: 8px 0 0;
}

.cabinet-row-description {
    flex: 1;
    padding: 20px 24px;
    border-left: 1px solid var(--color-border);
    overflow-y: auto;
}

.cabinet-row-description p {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--color-text);
    white-space: pre-wrap;
}

@media (max-width: 768px) {
    .cabinet-row {
        flex-direction: column;
    }

    .cabinet-row-left {
        width: 100%;
    }

    .cabinet-row-description {
        border-left: none;
        border-top: 1px solid var(--color-border);
    }
}

.cabinets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.cabinet-card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 2px 8px var(--color-shadow);
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    display: flex;
    flex-direction: column;

    &:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 16px var(--color-shadow);
    }
}

.cabinet-photo {
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: var(--color-bg);
}

.cabinet-photo-clickable {
    cursor: pointer;
}

.cabinet-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cabinet-photo-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-secondary);
}

.cabinet-info {
    padding: 16px;
    flex: 1;
}

.cabinet-name {
    font-size: 1.1rem;
    margin-bottom: 4px;
}

.cabinet-price {
    color: var(--color-text-secondary);
    font-size: 0.9rem;
}

.btn-book {
    margin: 0 16px 16px;
}

/* === Страница бронирования === */
.booking-layout {
    display: grid;
    grid-template-columns: 1fr minmax(0, 340px);
    gap: 24px;
    align-items: start;
}

@media (max-width: 900px) {
    .booking-layout {
        grid-template-columns: 1fr;
    }
}

/* Панель расписания */
.schedule-panel {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: 0 2px 8px var(--color-shadow);
}

.schedule-header h2 {
    font-size: 1.3rem;
}

.schedule-price-hint {
    color: var(--color-text-secondary);
    font-size: 0.9rem;
    margin-bottom: 16px;
}

.week-navigation {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 16px;
}

.week-label {
    font-weight: 600;
    min-width: 200px;
    text-align: center;
}

/* Сетка расписания */
.schedule-grid {
    display: grid;
    grid-template-columns: 50px repeat(7, 1fr);
    gap: 1px;
    background: var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.grid-corner {
    background: var(--color-surface);
    padding: 8px;
}

.grid-day-header {
    background: var(--color-surface);
    padding: 8px 4px;
    text-align: center;
    font-size: 0.8rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;

    &.today {
        background: var(--color-primary);
        color: white;
        border-radius: 0;
    }
}

.day-name {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.7rem;
}

.day-date {
    font-size: 0.95rem;
    font-weight: 700;
}

.grid-time-label {
    background: var(--color-surface);
    padding: 6px 4px;
    font-size: 0.75rem;
    color: var(--color-text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.grid-cell {
    background: var(--color-surface);
    padding: 4px;
    min-height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    cursor: pointer;
    transition: background 0.1s;
    position: relative;
    user-select: none;
}

.cell-available {
    color: var(--color-text-secondary);

    &:hover {
        background: #e3f2fd;
    }
}

.cell-selected {
    background: var(--color-primary) !important;
    color: white;
    font-weight: 600;
}

.cell-occupied {
    color: #999;
    cursor: not-allowed;
}

/* Чередование оттенков для разных бронирований */
.cell-occupied-0 {
    background: #e8e8e8;
}
.cell-occupied-1 {
    background: #d0d0d0;
}

.cell-service {
    color: #999;
    cursor: not-allowed;
}
.cell-service-0 {
    background: #fff0e0;
}
.cell-service-1 {
    background: #ffe0c0;
}

/* Занятая ячейка с подсказкой (модератор/админ) */
.grid-cell.cell-has-tooltip {
    cursor: pointer;
}

/* Всплывающее окно с информацией о занятой ячейке */
.occupied-cell-popover {
    position: relative;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 16px;
    min-width: 220px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.occupied-cell-popover h4 {
    margin: 0 0 8px 0;
    font-size: 0.85rem;
    color: var(--color-text-secondary);
}

.occupied-cell-popover .occupied-client {
    font-weight: 600;
    margin: 0 0 4px 0;
}

.occupied-cell-popover .occupied-datetime {
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    margin: 0 0 12px 0;
}

.occupied-cell-popover .close-btn {
    position: absolute;
    top: 8px;
    right: 8px;
}

.cell-past {
    background: #fafafa;
    color: #ddd;
    cursor: not-allowed;
}

.cell-empty {
    cursor: default;
}

.slot-price {
    font-size: 0.7rem;
}

.slot-selected-mark {
    position: absolute;
    top: 2px;
    right: 3px;
    font-size: 0.6rem;
}

/* Легенда */
.schedule-legend {
    display: flex;
    gap: 16px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--color-text-secondary);
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    border: 1px solid var(--color-border);
}

.legend-color.available {
    background: var(--color-surface);
}

.legend-color.selected {
    background: var(--color-primary);
    border-color: var(--color-primary);
}

.legend-color.occupied {
    background: #f5f5f5;
}

/* Панель бронирования (правая часть) */
.booking-panel {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: 0 2px 8px var(--color-shadow);
    position: sticky;
    top: 72px;
    min-width: 0;
    overflow-wrap: break-word;
}

.booking-panel-photo-wrapper {
    cursor: pointer;
    margin-bottom: 12px;
}

.booking-panel-photo {
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    border-radius: var(--radius-md);
}

.booking-panel-title {
    font-size: 1.1rem;
    margin-bottom: 2px;
}

.booking-panel-subtitle {
    color: var(--color-text-secondary);
    font-size: 0.85rem;
    margin-bottom: 16px;
}

.booking-details h4 {
    font-size: 1rem;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--color-border);
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 0.9rem;
}

/* Многострочный блок в панели брони (поиск пользователя, контакты гостя) — не в одну строку с меткой */
.detail-row-stack {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
}

.detail-label-block {
    align-self: flex-start;
    font-weight: 600;
}

.on-behalf-block {
    width: 100%;
    min-width: 0;
}

.on-behalf-search {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
    align-items: stretch;
}

.on-behalf-input {
    flex: 1 1 100%;
    min-width: 0;
}

@media (min-width: 360px) {
    .on-behalf-input {
        flex: 1 1 auto;
        min-width: 0;
    }

    .on-behalf-find-btn {
        flex: 0 0 auto;
    }
}

.on-behalf-results {
    list-style: none;
    margin: 0;
    padding: 0;
    width: 100%;
    max-width: 100%;
}

.on-behalf-results li {
    margin: 6px 0;
}

.on-behalf-result-btn {
    display: block;
    width: 100%;
    text-align: left;
    white-space: normal;
    word-break: break-word;
    padding: 6px 0;
    line-height: 1.35;
}

.guest-contact-fields {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    min-width: 0;
}

.guest-contact-fields .form-input {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.detail-label {
    color: var(--color-text-secondary);
}

.detail-value {
    font-weight: 500;
}

.detail-value.price {
    color: var(--color-primary);
    font-weight: 700;
}

.detail-value.discount {
    color: var(--color-success);
}

.select-purpose {
    padding: 4px 8px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.85rem;
    background: var(--color-surface);
}

/* Промокод */
.promo-section {
    margin: 12px 0;
}

/* Выбор дополнительных услуг при бронировании */
.services-selection .detail-label {
    align-self: flex-start;
}

.services-checkboxes {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.service-checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.9rem;
}

.service-checkbox-item input {
    width: 18px;
    height: 18px;
}

/* Блок одной услуги с опциональным интервалом внутри брони */
.service-option-block {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid var(--color-border);
}

.service-option-block:last-child {
    border-bottom: none;
}

.service-period-controls {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-left: 26px;
    font-size: 0.85rem;
    color: var(--color-text-secondary);
}

.service-period-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.service-period-toggle input {
    width: 16px;
    height: 16px;
}

.service-period-times {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
    align-items: center;
}

/* Степпер времени: [−] HH:mm [+] — шаг совпадает со слотом расписания */
.service-time-stepper {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.service-time-caption {
    min-width: 1.25rem;
    font-weight: 600;
    color: var(--color-text-secondary);
}

.service-time-value {
    min-width: 3.25rem;
    text-align: center;
    font-variant-numeric: tabular-nums;
    font-size: 0.95rem;
    padding: 4px 8px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: color-mix(in srgb, var(--color-surface) 92%, var(--color-border));
}

.btn-time-step {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    font-family: inherit;
    color: var(--color-text);
}

.btn-time-step:hover:not(:disabled) {
    background: color-mix(in srgb, var(--color-primary) 12%, var(--color-surface));
    border-color: var(--color-primary);
}

.btn-time-step:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.service-interval-hint {
    width: 100%;
    font-size: 0.75rem;
    color: var(--color-text-secondary);
    margin-top: 4px;
}

.promo-input-row {
    display: flex;
    gap: 8px;
}

.promo-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.9rem;
}

.btn-apply-promo {
    padding: 8px 12px;
    font-size: 0.8rem;
    white-space: nowrap;
}

.promo-success {
    color: var(--color-success);
    font-size: 0.85rem;
    margin-top: 6px;
}

.promo-error {
    color: var(--color-danger);
    font-size: 0.85rem;
    margin-top: 6px;
}

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

.price-summary h5 {
    margin: 0 0 8px 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-text);
}

.price-breakdown-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    font-size: 0.85rem;
    color: var(--color-text-secondary);
}

.price-breakdown-item.discount {
    color: var(--color-success);
}

.price-description {
    flex: 1;
}

.price-amount {
    font-weight: 500;
    text-align: right;
    min-width: 60px;
}

.price-divider {
    margin: 8px 0;
    border: none;
    border-top: 1px solid var(--color-border-light);
}

.price-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    font-weight: 600;
    color: var(--color-text);
    border-top: 2px solid var(--color-border);
    margin-top: 4px;
}

.price-total-label {
    font-size: 0.95rem;
}

.price-total-amount {
    font-size: 1.1rem;
    color: var(--color-primary);
}

.service-comment-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.9rem;
    resize: vertical;
    min-height: 60px;
}

.service-comment-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(var(--color-primary-rgb), 0.2);
}

.service-booking-notice {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    background-color: var(--color-info-light);
    border: 1px solid var(--color-info);
    border-radius: 6px;
    margin: 8px 0;
}

.notice-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.notice-text {
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    line-height: 1.4;
}

.notice-text strong {
    color: var(--color-text);
}

.btn-create-booking {
    margin-top: 12px;
}

.auth-hint {
    text-align: center;
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    margin-top: 8px;
}

.booking-error {
    color: var(--color-danger);
    text-align: center;
    font-size: 0.85rem;
    margin-top: 14px;
    margin-bottom: 6px;
    padding: 0 4px;
    line-height: 1.45;
}

.booking-hint {
    text-align: center;
    color: var(--color-text-secondary);
    padding: 24px 0;
}

/* === Страница подтверждения === */
.confirmation-page {
    max-width: 500px;
    margin: 0 auto;
}

.confirmation-card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 32px 24px;
    text-align: center;
    box-shadow: 0 2px 8px var(--color-shadow);
}

.confirmation-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--color-success);
    color: white;
    font-size: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.confirmation-details {
    text-align: left;
    margin: 24px 0;
}

.confirmation-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

/* === Мои бронирования === */
.my-bookings-page h2 {
    margin-bottom: 16px;
}

.status-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.tab {
    padding: 8px 16px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9rem;
    transition: background 0.15s;

    &.active {
        background: var(--color-primary);
        color: white;
        border-color: var(--color-primary);
    }

    &:hover:not(.active) {
        background: var(--color-bg);
    }
}

.bookings-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.booking-card {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    padding: 16px;
    box-shadow: 0 1px 4px var(--color-shadow);
}

.booking-card.card-cancelled {
    opacity: 0.7;
}

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

.booking-card-header h4 {
    font-size: 1rem;
}

.booking-status {
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-active { background: #e8f5e9; color: #2e7d32; }
.status-completed { background: #e3f2fd; color: #1565c0; }
.status-cancelled { background: #fce4ec; color: #c62828; }

.booking-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--color-border);
}

/* === Профиль === */
.profile-page {
    max-width: 600px;
    margin: 0 auto;
}

.profile-card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: 0 2px 8px var(--color-shadow);
}

.profile-card h2 {
    margin-bottom: 20px;
}

.profile-info {
    margin-bottom: 20px;
}

.profile-stats {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.profile-penalties {
    margin-bottom: 20px;
}

.profile-penalties h3 {
    font-size: 1rem;
    margin-bottom: 12px;
}

.penalties-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.penalty-item {
    padding: 12px;
    background: var(--color-bg);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--color-warning, #f59e0b);
}

.penalty-amount {
    font-weight: 600;
    margin-bottom: 4px;
}

.penalty-desc {
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    margin-bottom: 4px;
}

.penalty-meta {
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

/* Кнопка «Я оплатил» под карточкой штрафа */
.penalty-actions {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.penalty-actions .btn-compact {
    padding: 6px 12px;
    font-size: 0.85rem;
}

.penalty-status.status-paid { color: var(--color-success); }
.penalty-status.status-pending { color: var(--color-warning); }
.penalty-status.status-unpaid { color: var(--color-danger); }
.penalty-status.status-rejected { color: var(--color-danger); font-weight: 500; }

.stat-item {
    flex: 1;
    min-width: 120px;
    background: var(--color-bg);
    border-radius: var(--radius-md);
    padding: 16px;
    text-align: center;
}

.stat-item.stat-warning {
    background: #fff3e0;
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-primary);
}

.stat-item.stat-warning .stat-value {
    color: var(--color-danger);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--color-text-secondary);
}

.profile-edit-form {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--color-border);
}

.profile-edit-form h3 {
    margin-bottom: 12px;
}

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

.form-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    margin-bottom: 4px;
}

.form-group input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.95rem;

    &:focus {
        outline: none;
        border-color: var(--color-primary);
        box-shadow: 0 0 0 2px rgba(36, 129, 204, 0.2);
    }
}

.form-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.form-error {
    color: var(--color-danger);
    font-size: 0.85rem;
}

/* Ошибка рядом с полем ввода */
.field-error {
    color: var(--color-danger);
    font-size: 0.8rem;
    margin-top: 4px;
}

.profile-links {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--color-border);
}

/* === 404 === */
.not-found-page {
    text-align: center;
    padding: 64px 16px;
}

.not-found-page h1 {
    font-size: 4rem;
    color: var(--color-text-secondary);
}

/* === Общие утилиты === */
.no-data {
    text-align: center;
    color: var(--color-text-secondary);
    padding: 48px 16px;
}

/* === Индикатор загрузки Blazor (начальная) === */
.loading-progress {
    position: relative;
    display: block;
    width: 8rem;
    height: 8rem;
    margin: 20vh auto 1rem auto;
}

.loading-progress circle {
    fill: none;
    stroke: #e0e0e0;
    stroke-width: 0.6rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}

.loading-progress circle:last-child {
    stroke: var(--color-primary);
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray 0.05s ease-in-out;
}

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

.loading-progress-text:after {
    content: var(--blazor-load-percentage-text, "Загрузка");
}

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.blazor-error-boundary {
    background: #b32121;
    padding: 1rem;
    color: white;
    border-radius: var(--radius-md);
}

.blazor-error-boundary::after {
    content: "Произошла ошибка";
}

/* === Страницы авторизации === */
.auth-page {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 32px 16px;
}

.confirmation-section {
    text-align: center;
    padding: 20px 0;
}

.loading-section {
    text-align: center;
    padding: 20px 0;
}

.auth-card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 32px 24px;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 2px 8px var(--color-shadow);
}

.auth-card h2 {
    text-align: center;
    margin-bottom: 8px;
}

.auth-hint {
    text-align: center;
    color: var(--color-text-secondary);
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.auth-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
}

.auth-tabs .tab {
    flex: 1;
}

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

/* Форма внутри auth-form — flex-контейнер, кнопка по центру */
.auth-form form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.auth-form form button[type="submit"] {
    align-self: center;
}

.checkbox-group {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 0.9rem;
}

.checkbox-group input[type="checkbox"] {
    margin-top: 2px;
    width: 16px;
    height: 16px;
    accent-color: var(--color-primary);
}

.checkbox-group label {
    line-height: 1.4;
    margin: 0;
    cursor: pointer;
}

.auth-error {
    color: var(--color-danger);
    font-size: 0.85rem;
    text-align: center;
    margin-top: 8px;
}

.auth-links {
    text-align: center;
}

.auth-links a {
    font-size: 0.85rem;
}

.auth-footer {
    text-align: center;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--color-border);
    font-size: 0.9rem;
    color: var(--color-text-secondary);
}

.auth-footer a {
    margin-left: 4px;
    font-weight: 600;
}

.code-sent-hint {
    color: var(--color-text-secondary);
    font-size: 0.9rem;
    margin-bottom: 4px;
}

/* === Модераторские страницы === */
.moderator-page {
    max-width: 1100px;
    margin: 0 auto;
}

.moderator-page h2 {
    margin-bottom: 16px;
}

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

.filters-bar {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: flex-end;
    background: var(--color-surface);
    padding: 16px;
    border-radius: var(--radius-md);
    box-shadow: 0 1px 3px var(--color-shadow);
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.filter-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-text-secondary);
}

.date-filter-group {
    min-width: 280px;
}

.filter-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.filter-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.filter-checkbox label {
    margin-bottom: 0;
    cursor: pointer;
}

.date-inputs {
    display: flex;
    align-items: center;
    gap: 8px;
}

.date-separator {
    color: var(--color-text-secondary);
}

.filter-select, .filter-input {
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.9rem;
    background: var(--color-surface);
}

.search-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.search-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.95rem;
}

.search-input:focus {
    outline: none;
    border-color: var(--color-primary);
}

/* Таблица данных */
.data-table-wrapper {
    overflow-x: auto;
    background: var(--color-surface);
    border-radius: var(--radius-md);
    box-shadow: 0 1px 4px var(--color-shadow);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.data-table th {
    text-align: left;
    padding: 12px 14px;
    background: var(--color-bg);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--color-text-secondary);
    white-space: nowrap;
}

.data-table td {
    padding: 10px 14px;
    border-top: 1px solid var(--color-border);
}

.data-table tr:hover {
    background: #f8f9fa;
}

.price-cell {
    font-weight: 600;
    white-space: nowrap;
}

.actions-cell {
    position: relative;
    white-space: nowrap;
    display: flex;
    gap: 4px;
}

/* Ячейка с открытым меню — выше соседних строк (для border-collapse: collapse надёжнее, чем z-index на tr) */
.data-table tbody td.actions-cell:has(.actions-menu) {
    z-index: 50;
}

.row-inactive {
    opacity: 0.6;
}

/* Бейджики */
.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-active { background: #e8f5e9; color: #2e7d32; }
.badge-inactive { background: #f5f5f5; color: #999; }
.badge-danger { background: #fce4ec; color: #c62828; }

.payment-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.payment-not-paid { background: #fff3e0; color: #e65100; }
.payment-pending { background: #e3f2fd; color: #1565c0; }
.payment-paid { background: #e8f5e9; color: #2e7d32; }

/* Пагинация */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 16px;
    font-size: 0.9rem;
}

/* Карточки управления */
.cabinets-manage-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* === Страница "Доступ запрещен" === */
.access-denied-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    padding: 20px;
}

.access-denied-content {
    text-align: center;
    max-width: 400px;
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 40px 30px;
    box-shadow: 0 4px 12px var(--color-shadow);
}

.access-denied-icon {
    margin-bottom: 24px;
    opacity: 0.7;
}

.access-denied-content h1 {
    color: var(--color-text);
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 16px;
}

.access-denied-message {
    color: var(--color-text-secondary);
    font-size: 16px;
    line-height: 1.5;
    margin-bottom: 32px;
}

.access-denied-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.access-denied-actions .btn {
    padding: 12px 24px;
    border-radius: var(--radius-md);
    text-decoration: none;
    font-weight: 500;
    text-align: center;
    transition: all 0.2s ease;
}

.access-denied-actions .btn-primary {
    background: var(--color-primary);
    color: white;
    border: none;
}

.access-denied-actions .btn-primary:hover {
    background: var(--color-primary-hover);
}

.access-denied-actions .btn-secondary {
    background: var(--color-surface);
    color: var(--color-primary);
    border: 1px solid var(--color-border);
}

.access-denied-actions .btn-secondary:hover {
    background: var(--color-bg);
}

@media (min-width: 480px) {
    .access-denied-actions {
        flex-direction: row;
        justify-content: center;
    }

    .access-denied-actions .btn {
        flex: 1;
        max-width: 160px;
    }
}

.manage-card {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    padding: 16px;
    box-shadow: 0 1px 4px var(--color-shadow);
}

.manage-card.card-inactive {
    opacity: 0.7;
}

.manage-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.manage-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--color-border);
}

.service-description {
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    margin: 0 0 8px 0;
}

.service-price {
    font-weight: 600;
}

.modal-wide {
    max-width: 520px;
}

textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.95rem;
    resize: vertical;
}

textarea:focus {
    outline: none;
    border-color: var(--color-primary);
}

select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.95rem;
    background: var(--color-surface);
}

/* === Toast / Snackbar уведомления === */
.toast-container {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: min(400px, calc(100vw - 32px));
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 18px;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    font-size: 0.95rem;
    line-height: 1.4;
    animation: toast-enter 0.3s ease-out;
    pointer-events: auto;
}

.toast-exit {
    animation: toast-exit 0.3s ease-in forwards;
}

@keyframes toast-enter {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toast-exit {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

.toast-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
}

.toast-message {
    flex: 1;
    color: inherit;
}

/* Success — зелёный */
.toast-success {
    background: var(--color-success);
    color: white;
}

.toast-success .toast-icon {
    background: rgba(255, 255, 255, 0.25);
    border-radius: 50%;
}

/* Error — красный */
.toast-error {
    background: var(--color-danger);
    color: white;
}

.toast-error .toast-icon {
    background: rgba(255, 255, 255, 0.25);
    border-radius: 50%;
}

/* Warning — оранжевый */
.toast-warning {
    background: var(--color-warning);
    color: white;
}

.toast-warning .toast-icon {
    background: rgba(255, 255, 255, 0.25);
    border-radius: 50%;
}

/* Info — синий */
.toast-info {
    background: var(--color-primary);
    color: white;
}

.toast-info .toast-icon {
    background: rgba(255, 255, 255, 0.25);
    border-radius: 50%;
}

/* Адаптив: на мобильных тосты на всю ширину снизу */
@media (max-width: 480px) {
    .toast-container {
        top: auto;
        bottom: 16px;
        left: 16px;
        right: 16px;
        max-width: none;
    }

    .toast {
        animation-name: toast-enter-mobile;
    }

    .toast-exit {
        animation-name: toast-exit-mobile;
    }

    @keyframes toast-enter-mobile {
        from {
            opacity: 0;
            transform: translateY(100%);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    @keyframes toast-exit-mobile {
        from {
            opacity: 1;
            transform: translateY(0);
        }
        to {
            opacity: 0;
            transform: translateY(100%);
        }
    }
}

/* --- Админ: формы на странице пользователя (UserDetail) --- */
.admin-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px 16px;
    margin-bottom: 16px;
}

.hint-text {
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    margin: 0 0 12px;
}

.form-actions-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.text-muted {
    color: var(--color-text-secondary);
    font-weight: normal;
}

/* --- Бронирование: режимы модератора/админа (BookingPage) --- */
.staff-modes {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
}

.staff-mode-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.staff-mode-buttons .mode-btn {
    flex: 1 1 auto;
    min-width: 140px;
    padding: 8px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-text);
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.staff-mode-buttons .mode-btn:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.staff-mode-buttons .mode-btn.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
}