:root {
            --primary-color: #2c3e50;
            --rehearsal-color: #3498db;
            --performance-color: #2ecc71;
            --morning-color: #f39c12;
            --tour-color: #e74c3c;
            --meeting-color: #9b59b6;
            --tech-color: #7f8c8d;
        }

        body {
            background-color: #f8f9fa;
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            padding-bottom: 2rem;
        }

        /* ✅ Шапка: одна строка, ниже по высоте */
        .theatre-header {
            background: linear-gradient(135deg, var(--primary-color) 0%, #34495e 100%);
            color: white;
            padding: 0.75rem 0;
            margin-bottom: 0;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
        }

        .header-inner {
            width: 100%;
            margin: 0 auto;
            padding: 0 16px;
            display: block;
        }

        .theatre-title {
            font-size: 1.05rem;
            font-weight: 400;
            display: flex;
            align-items: center;
            gap: .5rem;
        }

        .theatre-subtitle-inline {
            font-size: .95rem;
            font-weight: 400;
            opacity: 0.9;
        }

        .header-legend {
            display: flex;
            gap: 12px;
            align-items: center;
            flex-wrap: wrap;
            font-size: 0.9rem;
            color: #ffffff;
            font-weight: 500;
        }

        .legend-item {
            display: inline-flex;
            align-items: center;
            gap: 6px;
        }

        .legend-dot {
            width: 10px;
            height: 10px;
            border-radius: 50%;
            display: inline-block;
        }

        .period-inline {
            display: flex;
            align-items: center;
            gap: 8px;
            flex-wrap: wrap;
            color: #ffffff;
        }

        .period-inline input {
            max-width: 150px;
            font-size: 0.85rem;
            padding: 4px 8px;
        }

        .period-inline label,
        .period-inline span {
            white-space: nowrap;
        }

        @media (min-width: 992px) {
            .period-inline {
                flex-wrap: nowrap;
            }
        }

        @media (max-width: 991.98px) {
            .period-inline {
                display: grid;
                grid-template-columns: 1fr auto 1fr auto;
                align-items: center;
                gap: 6px;
                width: 100%;
            }

            .period-inline label {
                grid-column: 1 / -1;
                margin-bottom: 2px;
            }

            .period-inline input {
                max-width: none;
                width: 100%;
            }
        }

        .header-controls {
            gap: 12px;
            align-items: center;
            display: flex;
            flex-wrap: wrap;
            margin-top: 8px;
        }

        @media (min-width: 992px) {
            .header-inner {
                display: flex;
                align-items: center;
                gap: 12px;
            }

            #headerControls {
                display: flex !important;
                height: auto !important;
                visibility: visible !important;
            }

            .header-controls {
                flex-wrap: nowrap;
                margin-left: auto;
                margin-top: 0 !important;
                justify-content: flex-end;
            }
        }

        .legend-dot.rehearsal {
            background: var(--rehearsal-color);
        }

        .legend-dot.performance {
            background: var(--performance-color);
        }

        .legend-dot.tour {
            background: var(--tour-color);
        }

        #calendarZoomViewport {
            overflow: visible;
            width: 100%;
        }

        #calendarZoomWrapper {
            transform-origin: top left;
            transition: transform 0.15s ease;
            /* ВАЖНО: ширину будем выставлять из JS как 100% / scale */
        }

        .table-container {
            background: white;
            border-radius: 0.5rem;
            box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.1);
            overflow: visible;
            margin-bottom: 2rem;
        }

        .custom-calendar {
            width: 100%;
            border-collapse: collapse;
            font-size: 0.9rem;
        }

        .custom-calendar th {
            background-color: var(--primary-color);
            color: white;
            border: 1px solid #ddd;
            padding: 6px 6px;
            text-align: center;
            font-weight: 600;
            font-size: 0.75rem;
            line-height: 1.1;
            vertical-align: middle;
        }

        .custom-calendar thead th {
            position: sticky;
            top: 0;
            z-index: 3;
        }

        .custom-calendar thead tr:nth-child(1) th {
            top: 0;
            z-index: 4;
        }

        .custom-calendar thead tr:nth-child(2) th {
            top: var(--thead-row-1-height, 28px);
            z-index: 3;
        }

        .custom-calendar thead tr:nth-child(3) th {
            top: calc(var(--thead-row-1-height, 28px) + var(--thead-row-2-height, 28px));
            z-index: 2;
        }

        .custom-calendar td {
            border: 1px solid #e3e6f0;
            padding: 8px;
            vertical-align: top;
            min-height: 80px;
        }

        .day-header {
            background-color: #f8f9fa;
            font-weight: 600;
            color: var(--primary-color);
            text-align: center;
            width: 80px;
        }

        .hours-cell {
            background-color: #f8f9fa;
            font-weight: 500;
            color: #6c757d;
            text-align: center;
            width: 100px;
        }

        .event-assistant {
            font-size: 0.75rem;
            color: #6c757d;
            margin-top: 2px;
        }

        .event-block {
            padding: 6px 8px;
            margin-bottom: 4px;
            border-radius: 4px;
            font-size: 0.85rem;
            cursor: pointer;
            transition: all 0.2s;
        }

        .event-actors {
            font-size: 0.75rem;
            color: #6c757d;
            margin-top: 2px;
        }

        .event-block:hover {
            transform: translateY(-2px);
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        }

        .rehearsal-event {
            background-color: rgba(52, 152, 219, 0.1);
            border-left: 4px solid var(--rehearsal-color);
            color: #2c3e50;
        }

        .performance-event {
            background-color: rgba(46, 204, 113, 0.1);
            border-left: 4px solid var(--performance-color);
            color: #2c3e50;
        }

        .morning-event {
            background-color: rgba(243, 156, 18, 0.1);
            border-left: 4px solid var(--morning-color);
            color: #2c3e50;
        }

        .tour-event {
            background-color: rgba(231, 76, 60, 0.1);
            border-left: 4px solid var(--tour-color);
            color: #2c3e50;
        }

        .event-time {
            font-size: 0.8rem;
            color: #6c757d;
            font-weight: 500;
        }

        .event-title {
            font-weight: 600;
            margin-bottom: 2px;
        }

        .event-place {
            font-size: 0.8rem;
            color: #6c757d;
            font-style: italic;
        }

        .time-group {
            margin-bottom: 6px;
            padding-bottom: 6px;
            border-bottom: 1px dashed #e3e6f0;
        }

        .time-group:last-child {
            margin-bottom: 0;
            padding-bottom: 0;
            border-bottom: 0;
        }

        .mobile-calendar {
            display: none;
        }

        .mobile-day {
            background: #ffffff;
            border-radius: 10px;
            box-shadow: 0 0.15rem 1rem rgba(58, 59, 69, 0.08);
            padding: 12px;
            margin-bottom: 12px;
        }

        .mobile-day-header {
            display: flex;
            justify-content: space-between;
            align-items: baseline;
            margin-bottom: 8px;
            font-weight: 600;
            color: #2c3e50;
        }

        .mobile-section {
            margin-top: 10px;
        }

        .mobile-section-title {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            font-size: 0.85rem;
            font-weight: 600;
            color: #2c3e50;
            margin-bottom: 6px;
        }

        .mobile-event {
            border: 1px solid #e3e6f0;
            border-radius: 8px;
            padding: 8px 10px;
            margin-bottom: 6px;
            background: #f9fbfd;
        }

        .mobile-event-title {
            font-weight: 600;
            font-size: 0.9rem;
            margin-bottom: 2px;
        }

        .mobile-event-meta {
            font-size: 0.78rem;
            color: #6c757d;
            display: flex;
            flex-wrap: wrap;
            gap: 6px;
        }

        .mobile-badge {
            font-size: 0.7rem;
            padding: 2px 6px;
            border-radius: 999px;
            color: #2c3e50;
            background: #eef2f6;
        }

        @media (max-width: 991.98px) {
            .mobile-calendar {
                padding-left: 12px;
                padding-right: 12px;
            }

            #calendarZoomViewport {
                display: none;
            }

            .mobile-calendar {
                display: block;
            }
        }

        @media (min-width: 992px) {
            .header-inner {
                padding: 0;
            }
        }

        .time-label {
            font-size: 0.75rem;
            font-weight: 600;
            color: #2c3e50;
            margin-bottom: 4px;
        }

        .time-list {
            display: flex;
            flex-direction: column;
            gap: 6px;
            align-items: center;
        }

        .time-pill {
            background: #eef2f6;
            border-radius: 999px;
            padding: 2px 6px;
            font-size: 0.72rem;
            color: #2c3e50;
            white-space: nowrap;
        }

        .time-row {
            display: flex;
            align-items: center;
            gap: 6px;
            flex-wrap: wrap;
            justify-content: center;
        }

        .time-legend {
            display: inline-flex;
            align-items: center;
            gap: 4px;
        }

        .empty-cell {
            color: #adb5bd;
            font-style: italic;
            text-align: center;
            padding: 20px !important;
        }

        .table-header-row {
            background-color: #e9ecef;
        }

        .controls-panel {
            background: white;
            border-radius: 0.5rem;
            padding: 1.5rem;
            box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.1);
            margin-bottom: 1.5rem;
        }

        @media print {
            .no-print {
                display: none !important;
            }

            .table-container {
                box-shadow: none !important;
                border: 1px solid #ddd !important;
            }

            .custom-calendar th,
            .custom-calendar td {
                border: 1px solid #000 !important;
            }
        }
