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

html,
body {
    min-height: 100%;
    font-size: 10px;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Arial, sans-serif;
    background: #f5f5f5;
    overflow-y: auto !important;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

body {
    font-size: 1.6rem;
    position: relative;
}

.container {
    width: 100%;
    min-height: 100vh;
    padding: 15px 15px 100px 15px;
    background: #f5f5f5;
}

.group-table {
    display: none;
    width: 100%;
}

.group-table.active {
    display: block;
}

/* Обёртка таблицы */
.table-wrapper {
    width: 100%;
    max-width: 100%;
    background: white;
    border-radius: 12px;
    padding: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    will-change: height;
}

/* Таблица */
.table-wrapper table {
    border-collapse: collapse;
    width: auto;
    font-size: 14px;
    transform-origin: top left;
}

/* Запрет переноса слов во всех ячейках */
.table-wrapper table td,
.table-wrapper table th {
    white-space: nowrap !important;
    word-break: keep-all !important;
    overflow: visible !important;
    padding: 4px 8px;
    vertical-align: middle;
    border: 1px solid #ddd;
}

/* Фиксированные ширины технических колонок */
.table-wrapper table tr>*:nth-child(1),
.table-wrapper table tr>*:nth-child(2) {
    width: 6rem !important;
    max-width: 6rem !important;
    min-width: 6rem !important;
}

.table-wrapper table tr>*:nth-child(4) {
    width: 12rem !important;
    max-width: 12rem !important;
    min-width: 12rem !important;
}

/* ================= iOS Liquid Glass UI ================= */

.glass-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease;
    z-index: 998;
    pointer-events: none;
}

.glass-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Контейнер нижнего меню выбора группы */
.glass-bar-container {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    max-width: calc(100% - 120px);
}

.glass-trigger {
    width: 100%;
    height: 48px;
    padding: 0 20px;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    background: rgba(245, 245, 247, 0.78);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.glass-trigger:active {
    transform: scale(0.97);
}

.trigger-label {
    font-size: 1.5rem;
    font-weight: 600;
    color: #000;
}

.chevron-icon {
    width: 18px;
    height: 18px;
    color: #007aff;
    transition: transform 0.25s ease;
}

.glass-trigger.active .chevron-icon {
    transform: rotate(180deg);
}

.glass-popup {
    width: 100%;
    margin-bottom: 10px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    background: rgba(245, 245, 247, 0.82);
    backdrop-filter: blur(25px) saturate(190%);
    -webkit-backdrop-filter: blur(25px) saturate(190%);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px) scale(0.96);
    transition: all 0.25s cubic-bezier(0.1, 0.9, 0.2, 1);
    pointer-events: none;
}

.glass-popup.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.glass-popup-header {
    padding: 10px 16px 6px;
    font-size: 1.1rem;
    font-weight: 600;
    text-transform: uppercase;
    color: rgba(60, 60, 67, 0.5);
    text-align: center;
    border-bottom: 0.5px solid rgba(60, 60, 67, 0.1);
}

.glass-group-list {
    max-height: 240px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.glass-item {
    width: 100%;
    padding: 12px 16px;
    background: transparent;
    border: none;
    border-bottom: 0.5px solid rgba(60, 60, 67, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 1.5rem;
    color: #000;
    cursor: pointer;
    text-align: left;
    -webkit-tap-highlight-color: transparent;
}

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

.glass-item.active {
    color: #007aff;
    font-weight: 600;
}

.check-icon {
    width: 16px;
    height: 16px;
    opacity: 0;
}

.glass-item.active .check-icon {
    opacity: 1;
}

/* Кнопка настроек (гамбургер) */
.hamburger-trigger {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1001;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.hamburger-trigger:active {
    transform: scale(0.92);
}

.hamburger-icon {
    width: 22px;
    height: 22px;
    color: #1c1c1e;
}

.notification-dot {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background-color: #ff3b30;
    border-radius: 50%;
    border: 2px solid #f5f5f5;
    display: none;
}

.notification-dot.active {
    display: block;
}

/* Попап настроек */
.settings-popup {
    position: fixed;
    bottom: 82px;
    right: 20px;
    width: 280px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    background: rgba(245, 245, 247, 0.85);
    backdrop-filter: blur(25px) saturate(190%);
    -webkit-backdrop-filter: blur(25px) saturate(190%);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
    padding: 12px;
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transform: translateY(15px) scale(0.95);
    transition: all 0.25s cubic-bezier(0.1, 0.9, 0.2, 1);
}

.settings-popup.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.menu-section {
    margin-bottom: 12px;
}

.menu-section:last-child {
    margin-bottom: 0;
}

.menu-section-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: rgba(60, 60, 67, 0.6);
    text-transform: uppercase;
    margin-bottom: 6px;
    padding-left: 4px;
}

.segmented-control {
    display: flex;
    background: rgba(120, 120, 128, 0.12);
    border-radius: 10px;
    padding: 2px;
}

.segmented-btn {
    flex: 1;
    padding: 8px 10px;
    font-size: 1.3rem;
    font-weight: 500;
    border: none;
    background: transparent;
    color: #1c1c1e;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    position: relative;
}

.segmented-btn.active {
    background: #ffffff;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.segmented-btn:disabled,
.segmented-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* Контейнер полноэкранного лоадера */
.loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.loader-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.spinner {
    width: 42px;
    height: 42px;
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-left-color: #007aff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loader-text {
    margin-top: 14px;
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

/* Карточка ожидания (Empty State) */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.empty-state-title {
    font-size: 18px;
    font-weight: 600;
    color: #1c1c1e;
    margin-bottom: 8px;
}

.empty-state-subtitle {
    font-size: 14px;
    color: #8e8e93;
    margin-bottom: 20px;
}

.empty-state-timer {
    font-size: 15px;
    font-weight: 500;
    color: #007aff;
    background: rgba(0, 122, 255, 0.1);
    padding: 10px 18px;
    border-radius: 20px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Индикатор уведомлений */
.offline-toast {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: rgba(30, 30, 30, 0.88);
    color: #ffffff;
    padding: 9px 18px;
    border-radius: 24px;
    font-size: 13px;
    font-weight: 500;
    z-index: 10000;
    transition: transform 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
    opacity: 0;
    pointer-events: none;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    text-align: center;
}

.offline-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* Плашка «Обновление» с бегающим ползунком */
.update-progress-card {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-120px);
    background: rgba(28, 28, 30, 0.94);
    color: #ffffff;
    padding: 12px 20px;
    border-radius: 16px;
    z-index: 10002;
    width: 260px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
    opacity: 0;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.update-progress-card.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.update-title {
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    letter-spacing: 0.2px;
}

/* Бегающий ползунок (Indeterminate Progress Bar) */
.progress-bar-track {
    height: 4px;
    width: 100%;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.progress-bar-runner {
    position: absolute;
    height: 100%;
    width: 45%;
    background: linear-gradient(90deg, #007aff, #58a6ff);
    border-radius: 4px;
    animation: runningSlider 1.2s infinite ease-in-out;
}

@keyframes runningSlider {
    0% {
        left: -45%;
    }

    100% {
        left: 100%;
    }
}

/* Баннер запроса установки обновления */
.update-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(120px);
    background: rgba(28, 28, 30, 0.95);
    color: #ffffff;
    padding: 10px 14px 10px 18px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    z-index: 10001;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
    opacity: 0;
    pointer-events: none;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.update-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.update-toast button {
    background: #007aff;
    color: #ffffff;
    border: none;
    padding: 7px 14px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.update-toast button:active {
    opacity: 0.8;
    transform: scale(0.96);
}

/* Мобильная адаптивность */
@media (max-width: 600px) {
    .container {
        padding: 8px 8px 100px 8px;
    }

    .table-wrapper {
        padding: 6px;
    }

    .table-wrapper table {
        font-size: 10px;
    }
}

@media (max-width: 480px) {
    .glass-bar-container {
        left: 20px;
        transform: none;
        max-width: calc(100% - 90px);
    }
}