        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        
        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            padding: 20px;
            color: #333;
        }
        
        .container {
            max-width: 1400px;
            margin: 0 auto;
            background: white;
            border-radius: 15px;
            box-shadow: 0 10px 40px rgba(0,0,0,0.2);
            overflow: hidden;
        }
        
        header {
            background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
            color: #ffffff;
            padding: 30px;
            text-align: center;
        }
        
        header h1 {
            font-size: 2.2em;
            margin-bottom: 10px;
            color: #ffffff;
            text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
        }

        header p {
            color: #ffffff;
        }
        
        .stats-bar {
            background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
            color: white;
            padding: 15px 30px;
            display: flex;
            justify-content: space-around;
            align-items: center;
            flex-wrap: nowrap;
            white-space: nowrap;
            gap: 20px;
        }
        
        .stat-item {
            text-align: center;
        }
        
        .stat-number {
            font-size: 2em;
            font-weight: bold;
        }
        
        .stat-label {
            font-size: 0.9em;
            opacity: 0.9;
        }
        
        /* ── ÁREA DE CONTROLES REESTRUTURADA ── */
        .controls {
            background: #f0f2f8;
            border-bottom: 2px solid #d0d5e8;
            padding: 0;
        }

        /* Linha superior: navegação de mês (centralizada e destacada) */
        .controls-nav {
            display: flex;
            justify-content: center;
            align-items: center;
            gap: 0;
            padding: 14px 30px 10px;
            background: #ffffff;
            border-bottom: 1px solid #d0d5e8;
        }

        .controls-nav button {
            padding: 9px 22px;
            border: 2px solid #1e3c72;
            background: #1e3c72;
            color: white;
            cursor: pointer;
            font-weight: 700;
            font-size: 1em;
            transition: all 0.2s ease;
        }

        .controls-nav button:first-child {
            border-radius: 8px 0 0 8px;
        }

        .controls-nav button:last-child {
            border-radius: 0 8px 8px 0;
        }

        .controls-nav button:hover {
            background: #2a5298;
            border-color: #2a5298;
        }

        .controls-nav .current-month {
            font-weight: 700;
            font-size: 1.1em;
            color: #1e3c72;
            background: #e8edf8;
            border-top: 2px solid #1e3c72;
            border-bottom: 2px solid #1e3c72;
            padding: 9px 28px;
            min-width: 200px;
            text-align: center;
        }

        /* Linha inferior: 3 grupos separados por divisores */
        .controls-bottom {
            display: flex;
            align-items: stretch;
            flex-wrap: wrap;
            gap: 0;
            padding: 10px 20px;
            background: #f0f2f8;
        }

        .control-group {
            display: flex;
            flex-direction: column;
            gap: 4px;
            padding: 6px 20px;
            border-right: 2px solid #d0d5e8;
        }

        .control-group:last-child {
            border-right: none;
        }

        .control-group-label {
            font-size: 0.7em;
            font-weight: 700;
            color: #667eea;
            text-transform: uppercase;
            letter-spacing: 0.08em;
            margin-bottom: 2px;
        }

        .control-group-buttons {
            display: flex;
            gap: 8px;
            align-items: center;
        }

        /* Botões de semestre */
        .semester-toggle {
            display: flex;
            gap: 8px;
        }

        .semester-toggle button {
            padding: 8px 18px;
            border: 2px solid #667eea;
            border-radius: 20px;
            font-size: 0.9em;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.25s ease;
            background: white;
            color: #667eea;
        }

        .semester-toggle button.active {
            background: #667eea;
            color: white;
            box-shadow: 0 3px 8px rgba(102, 126, 234, 0.4);
        }

        .semester-toggle button:not(.active):hover {
            background: #eef0fd;
        }

        /* Botões de visualização */
        .view-toggle {
            display: flex;
            gap: 8px;
        }

        .view-toggle button {
            padding: 8px 16px;
            border: 2px solid #2a5298;
            border-radius: 8px;
            background: white;
            color: #2a5298;
            cursor: pointer;
            font-weight: 600;
            font-size: 0.9em;
            transition: all 0.25s ease;
        }

        .view-toggle button.active {
            background: #2a5298;
            color: white;
            box-shadow: 0 3px 8px rgba(42, 82, 152, 0.35);
        }

        .view-toggle button:not(.active):hover {
            background: #e8edf8;
        }

        /* Botões de exportação */
        .export-buttons {
            display: flex;
            gap: 8px;
        }

        .export-btn {
            padding: 8px 16px;
            border: none;
            border-radius: 8px;
            color: white;
            cursor: pointer;
            font-weight: 600;
            font-size: 0.9em;
            transition: all 0.25s ease;
            display: flex;
            align-items: center;
            gap: 6px;
        }

        .export-pdf {
            background: #e74c3c;
        }

        .export-excel {
            background: #27ae60;
        }

        .export-btn:hover {
            opacity: 0.88;
            transform: translateY(-1px);
            box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
        }

        /* Nav-buttons mantida para compatibilidade mas oculta (substituída por controls-nav) */
        .nav-buttons {
            display: none;
        }
        
        @media print {
            @page {
                size: A4 landscape;
                margin: 1cm;
            }
            
            body {
                background: white;
                padding: 0;
                margin: 0;
            }
            
            .controls, .controls-nav, .controls-bottom, .view-toggle, .export-buttons, .nav-buttons, .stats-bar {
                display: none !important;
            }
            
            .container {
                box-shadow: none;
                border-radius: 0;
                max-width: 100%;
            }
            
            header {
                background: #1e3c72 !important;
                -webkit-print-color-adjust: exact;
                print-color-adjust: exact;
                page-break-after: avoid;
            }
            
            .content {
                padding: 10px;
            }
            
            .calendar-grid {
                page-break-inside: avoid;
                margin-bottom: 20px;
                -webkit-print-color-adjust: exact;
                print-color-adjust: exact;
            }
            
            .calendar-header {
                background: #667eea !important;
                -webkit-print-color-adjust: exact;
                print-color-adjust: exact;
            }
            
            .calendar-day {
                min-height: 70px;
                break-inside: avoid;
                border: 1px solid #ddd;
            }
            
            .event-badge {
                -webkit-print-color-adjust: exact;
                print-color-adjust: exact;
            }
            
            .month-title {
                page-break-before: avoid;
                page-break-after: avoid;
            }
            
            .legend {
                page-break-inside: avoid;
                -webkit-print-color-adjust: exact;
                print-color-adjust: exact;
            }
            
            .legend-color {
                -webkit-print-color-adjust: exact;
                print-color-adjust: exact;
            }
            
            footer {
                page-break-before: avoid;
                background: #1e3c72 !important;
                -webkit-print-color-adjust: exact;
                print-color-adjust: exact;
            }
            
            .list-view table {
                page-break-inside: auto;
            }
            
            .list-view table tr {
                page-break-inside: avoid;
                page-break-after: auto;
            }
            
            .list-view table thead {
                display: table-header-group;
                background: #667eea !important;
                -webkit-print-color-adjust: exact;
                print-color-adjust: exact;
            }
        }
        
        .content {
            padding: 30px;
        }
        
        .calendar-view, .list-view {
            display: none;
        }
        
        .calendar-view.active, .list-view.active {
            display: block;
            animation: fadeIn 0.5s ease;
        }
        
        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(10px); }
            to { opacity: 1; transform: translateY(0); }
        }
        
        .calendar-grid {
            display: grid;
            grid-template-columns: repeat(7, 1fr);
            gap: 2px;
            background: #e0e0e0;
            border: 2px solid #e0e0e0;
            border-radius: 10px;
            overflow: hidden;
            margin-bottom: 30px;
        }
        
        .calendar-header {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            padding: 15px;
            text-align: center;
            font-weight: 700;
            font-size: 0.9em;
        }
        
        .calendar-day {
            background: white;
            min-height: 100px;
            padding: 8px;
            position: relative;
            transition: all 0.3s ease;
            cursor: pointer;
        }
        
        .calendar-day:hover {
            background: #f8f9fa;
            transform: scale(1.02);
            z-index: 10;
            box-shadow: 0 4px 12px rgba(0,0,0,0.15);
        }
        
        .calendar-day.other-month {
            background: #f5f5f5;
            opacity: 0.5;
        }
        
        .calendar-day.today {
            background: #fff9e6;
            border: 2px solid #ffd93d;
        }
        
        .day-number {
            font-weight: 700;
            font-size: 1.1em;
            color: #333;
            margin-bottom: 5px;
        }
        
        .day-events {
            display: flex;
            flex-direction: column;
            gap: 3px;
        }
        
        .event-badge {
            font-size: 0.7em;
            padding: 3px 6px;
            border-radius: 4px;
            font-weight: 600;
            text-align: center;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }
        
        .event-feriado {
            background: #ff6b6b;
            color: white;
        }
        
        .event-pedagogica {
            background: #95e1d3;
            color: #333;
        }
        
        .event-inicio {
            background: #6bcf7f;
            color: white;
        }
        
        .event-sabado {
            background: #a29bfe;
            color: white;
        }
        
        .event-provas {
            background: #fd79a8;
            color: white;
        }
        
        .event-conclusao {
            background: #fab1a0;
            color: white;
        }
        
        .event-exames {
            background: #fdcb6e;
            color: #333;
        }
        
        .event-recesso,
        .event-ferias {
            background: #8e44ad;
            color: white;
        }

        .event-letivo {
            background: #6bcf7f;
            color: white;
            font-weight: 700;
        }

        /* ========================================
           EVENTO INSTITUCIONAL UNIMT - NOVO
           ======================================== */
        .event-institucional {
            background: linear-gradient(135deg, #e67e22 0%, #f39c12 100%);
            color: white;
            font-weight: 700;
            border-left: 3px solid #d35400;
            box-shadow: 0 1px 3px rgba(211, 84, 0, 0.3);
        }

        .legend {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
            gap: 15px;
            margin: 30px 0;
            padding: 20px;
            background: #f8f9fa;
            border-radius: 10px;
        }
        
        .legend-item {
            display: flex;
            align-items: center;
            gap: 10px;
        }
        
        .legend-color {
            width: 24px;
            height: 24px;
            border-radius: 6px;
            flex-shrink: 0;
        }
        
        .list-view table {
            width: 100%;
            border-collapse: collapse;
            margin: 20px 0;
            box-shadow: 0 2px 8px rgba(0,0,0,0.1);
            border-radius: 10px;
            overflow: hidden;
        }
        
        .list-view table thead {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
        }
        
        .list-view table th {
            padding: 15px;
            text-align: left;
            font-weight: 600;
        }
        
        .list-view table td {
            padding: 12px 15px;
            border-bottom: 1px solid #e0e0e0;
        }
        
        .list-view table tbody tr:hover {
            background: #f8f9fa;
        }
        
        .month-title {
            text-align: center;
            font-size: 1.5em;
            color: #1e3c72;
            margin-bottom: 10px;
            font-weight: 700;
        }
        
        .month-days-info {
            text-align: center;
            font-size: 0.95em;
            color: #667eea;
            font-weight: 600;
            margin-bottom: 15px;
        }
        
        /* RESPONSIVIDADE GERAL */
        @media (max-width: 768px) {
            body { padding: 10px; }
            header h1 { font-size: 1.6em; }
            .month-title { font-size: 1.2em; }
            .month-days-info { font-size: 0.85em; }
        }

        /* CALENDÁRIO RESPONSIVO */
        @media (max-width: 768px) {
            .calendar-grid { gap: 1px; }
            .calendar-day { min-height: 70px; padding: 4px; font-size: 12px; }
            .day-number { font-size: 0.85em; margin-bottom: 3px; }
            .event-badge {
                font-size: 0.55em !important;
                padding: 2px 3px !important;
                line-height: 1.1em;
                overflow: hidden;
                text-overflow: ellipsis;
                white-space: nowrap;
            }
        }

        /* CONTROLES RESPONSIVOS */
        @media (max-width: 768px) {
            .controls-nav { padding: 10px 15px 8px; gap: 0; }
            .controls-nav .current-month { min-width: 130px; font-size: 0.95em; padding: 8px 12px; }
            .controls-nav button { padding: 8px 14px; font-size: 0.9em; }
            .controls-bottom { flex-direction: column; padding: 8px 15px; gap: 0; }
            .control-group { border-right: none; border-bottom: 1px solid #d0d5e8; padding: 8px 0; width: 100%; }
            .control-group:last-child { border-bottom: none; }
            .semester-toggle button,
            .view-toggle button { font-size: 0.85em; padding: 7px 12px; }
            .export-btn { font-size: 0.85em; padding: 7px 12px; }
        }

        /* STATS BAR RESPONSIVA */
        @media (max-width: 768px) {
            .stats-bar { flex-wrap: wrap; text-align: center; gap: 10px; }
            .stat-item { width: 45%; min-width: 120px; }
            .stat-number { font-size: 1.6em; }
        }

        /* LEGENDA RESPONSIVA */
        @media (max-width: 768px) {
            .legend { grid-template-columns: repeat(2, 1fr); gap: 8px; padding: 15px; }
            .legend-item span { font-size: 0.75em; }
            .legend-color { width: 18px; height: 18px; }
        }

        /* CORES ROXAS PARA FÉRIAS E RECESSO */
        .event-recesso,
        .event-ferias {
            background: #8e44ad !important;
            color: white !important;
        }

        /* CORREÇÃO DEFINITIVA DO GRID NO IPHONE */
        @media (max-width: 430px) {
            .calendar-grid {
                display: grid;
                grid-template-columns: repeat(7, minmax(0, 1fr)) !important;
            }
            .calendar-header {
                font-size: 10px !important;
                padding: 3px 0 !important;
                white-space: nowrap;
                text-align: center;
            }
        }
        
        footer {
            background: #1e3c72;
            color: #ffffff;
            text-align: center;
            padding: 20px;
        }

        footer p {
            color: #ffffff;
        }
