:root {
    --primary: #1B3C53;
    --primary-dark: #0F172A;
    --secondary: #234C6A;
    --accent: #EBD373;
    --accent-hover: #D4BD5F;
    --bg-dark: #0A0F1E;
    --bg-card: rgba(30, 41, 59, 0.7);
    --text-light: #F8FAFC;
    --text-muted: #94A3B8;
    --error: #EF4444;
    --success: #10B981;
    --border: rgba(255, 255, 255, 0.1);
    --radius: 8px;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    background: radial-gradient(circle at top left, var(--secondary), var(--bg-dark));
    background-attachment: fixed;
    color: var(--text-light);
    font-family: 'Inter', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
}

body.menu-page {
    background: linear-gradient(rgba(10, 15, 30, 0.8), rgba(10, 15, 30, 0.8)), url('img/bg.png');
    background-size: cover;
    background-position: center;
}

/* Layout Containers */
#dv_contenedor {
    display: flex;
    width: 100vw;
    height: 100vh;
    backdrop-filter: blur(10px);
}

#dv_izquierdo {
    width: 260px;
    background: linear-gradient(180deg, var(--primary-dark) 0%, #0f172a 100%);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 1rem;
    height: 100vh;
    text-align: center;
}

#dv_derecho {
    flex: 1;
    height: 100vh;
    min-height: 0;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
}

#dv_derecho > .calendar-view,
#dv_derecho > .filtro-cal-container {
    flex: 1;
    min-height: 0;
    width: 100%;
}

/* Typography */
.escudo {
    width: 60px;
    height: auto;
    margin: 0 auto 0.75rem;
    display: block;
    filter: drop-shadow(0 0 10px rgba(235, 211, 115, 0.2));
}

.title1 {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--accent);
    margin: 0;
    text-align: center;
    letter-spacing: 0.5px;
}

.title2 {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-align: center;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

/* Buttons */
.btn_meses, .btn_menu, .btn_ver, .btn_ver_reserva, .btn-save, .btn-cancel, .btn_secondary {
    cursor: pointer;
    border: none;
    outline: none;
    transition: var(--transition);
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.btn_meses:active, .btn_ver:active, .btn_ver_reserva:active {
    transform: scale(0.96);
}

.btn_meses i {
    font-size: 0.8rem;
    width: 1.25rem;
    text-align: center;
}

#nav_meses {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    overflow-y: auto;
}

.btn_meses {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    padding: 0.35rem 0.8rem;
    border-radius: var(--radius);
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.15rem;
}

.btn_meses:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-light);
}

.btn_meses.active {
    background: var(--primary);
    color: var(--text-light);
    box-shadow: 0 0 15px rgba(235, 211, 115, 0.2), var(--shadow);
    border-color: rgba(235, 211, 115, 0.3);
}

.calendar-view {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    width: 100%;
    height: 100%;
}

.calendar-header {
    margin-bottom: 0.75rem;
    text-align: center;
    flex-shrink: 0;
}

.calendar-header h3 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--accent);
    margin-top: 0;
}

/* Calendar Styles */
.calendar-grid-container {
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--border);
    border-radius: 15px;
    padding: 0.65rem;
    backdrop-filter: blur(12px);
    box-shadow: var(--shadow);
    max-width: 1000px;
    width: 100%;
    margin: 0 auto;
}

.calendar-view .calendar-grid-container {
    max-width: none;
    margin: 0;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.tbl_calendario {
    width: 100%;
    height: 100%;
    margin: 0 auto;
    border-collapse: separate;
    border-spacing: 6px;
    table-layout: fixed;
}

.calendar-view .tbl_calendario {
    margin: 0;
    flex: 1;
}

.calendar-view .tbl_calendario thead {
    height: 2.4rem;
}

.calendar-view .tbl_calendario tbody {
    height: calc(100% - 2.4rem);
}

.calendar-view .tbl_calendario tbody tr {
    /* Reparto uniforme: todas las filas del mismo alto */
    height: 1%;
}

.tbl_calendario th,
.tbl_calendario td {
    width: 20%;
    box-sizing: border-box;
}

.tbl_calendario th {
    color: var(--accent);
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    padding: 0.6rem 0.2rem;
    letter-spacing: 2px;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 2px solid rgba(235, 211, 115, 0.2);
    border-radius: 8px 8px 0 0;
    height: 2.4rem;
}

.tbl_calendario td {
    background: rgba(30, 41, 59, 0.25);
    border: 1px solid var(--border);
    border-radius: 8px;
    height: 1%;
    min-height: 90px;
    vertical-align: top;
    padding: 0.35rem;
    transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(5px);
}

.calendar-view .tbl_calendario td {
    min-height: 0;
}

.tbl_calendario td:hover {
    background: rgba(30, 41, 59, 0.6);
    transform: none;
    border-color: var(--accent);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 10;
}

.tbl_calendario td.celda-vacia {
    background: rgba(15, 23, 42, 0.2);
    border-style: dashed;
    border-color: rgba(255, 255, 255, 0.05);
    pointer-events: none;
}

.tbl_calendario td.celda-vacia:hover {
    background: rgba(15, 23, 42, 0.2);
    border-color: rgba(255, 255, 255, 0.05);
    box-shadow: none;
}

.p_fecha {
    position: absolute;
    top: 0.4rem;
    right: 0.5rem;
    font-size: 0.75rem;
    font-weight: 900;
    color: var(--text-muted);
    opacity: 0.3;
    margin: 0;
    pointer-events: none;
}

.calendar-view .cell-content {
    min-height: 70%;
}

.cell-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    padding: 0.5rem;
}

.availability-container {
    width: 90%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.availability-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.header-main {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.status-dot.high { background: #10B981; box-shadow: 0 0 8px #10B981; }
.status-dot.medium { background: #F59E0B; box-shadow: 0 0 8px #F59E0B; }
.status-dot.low { background: #EF4444; box-shadow: 0 0 8px #EF4444; }

.avail-label {
    font-size: 0.5rem;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

.availability-visual {
    display: block;
    width: 100%;
}

.progress-bg {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-fill.high { background: linear-gradient(90deg, #10B981, #34D399); }
.progress-fill.medium { background: linear-gradient(90deg, #F59E0B, #FBBF24); }
.progress-fill.low { background: linear-gradient(90deg, #EF4444, #F87171); }

.avail-percentage {
    font-size: 0.8rem;
    font-weight: 900;
    color: var(--text-light);
    text-align: right;
}

.avail-hours {
    font-size: 0.55rem;
    font-weight: 600;
    color: var(--text-muted);
    text-align: right;
    letter-spacing: 0.02em;
    margin-top: -0.1rem;
}

.preview-dot:not(:last-child)::after {
    content: "";
}

.p_feriado {
    background: linear-gradient(160deg, rgba(127, 29, 29, 0.45), rgba(239, 68, 68, 0.18)) !important;
    border-color: rgba(248, 113, 113, 0.55) !important;
    cursor: default !important;
}

.p_feriado:hover {
    transform: none !important;
    border-color: rgba(248, 113, 113, 0.7) !important;
    box-shadow: inset 0 0 12px rgba(239, 68, 68, 0.15) !important;
}

.p_feriado .p_fecha {
    color: #FECACA;
    opacity: 0.95;
}

.p_feriado .btn_calendario,
.p_feriado .availability-container {
    display: none !important;
}

.feriado-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    width: 100%;
    height: 100%;
    padding: 0.35rem 0.25rem;
    text-align: center;
}

.feriado-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.55rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #FECACA;
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(248, 113, 113, 0.35);
    border-radius: 999px;
    padding: 0.15rem 0.45rem;
}

.feriado-nombre {
    font-size: 0.68rem;
    font-weight: 800;
    color: #FEE2E2;
    line-height: 1.25;
    max-width: 100%;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.feriado-aviso {
    font-size: 0.55rem;
    font-weight: 700;
    color: #FCA5A5;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    opacity: 0.85;
}

.label-feriado {
    position: static;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    color: #FECACA;
    font-size: 0.65rem;
    font-weight: 700;
    opacity: 1;
}

.today-cell {
    border: 2px solid var(--accent) !important;
    background: rgba(235, 211, 115, 0.05) !important;
    box-shadow: inset 0 0 15px rgba(235, 211, 115, 0.1) !important;
}

.today-cell::before {
    content: "HOY";
    position: absolute;
    top: 0.3rem;
    left: 0.5rem;
    font-size: 0.5rem;
    font-weight: 900;
    color: var(--accent);
    letter-spacing: 1px;
}

.btn_calendario {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(235, 211, 115, 0.1);
    color: var(--accent);
    border: 1px solid rgba(235, 211, 115, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    position: absolute;
    bottom: 0.5rem;
    right: 0.5rem;
}

.btn_calendario:hover {
    background: var(--accent);
    color: var(--primary-dark);
    transform: scale(1.15);
}

dialog {
    background: var(--bg-dark);
    color: var(--text-light);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 1rem;
    width: 95%;
    max-width: 800px;
    max-height: 95vh;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    margin: auto;
    overflow-y: auto;
}

.periodos-wrapper {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    align-items: flex-start;
    width: 100%;
    margin-top: -0.5rem;
}

.modal-header {
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.header-right {
    margin-right: 2.5rem; /* Space for the absolute close button */
}

.btn-share {
    padding: 0.35rem 0.6rem;
    background: rgba(235, 211, 115, 0.05);
    color: var(--accent);
    border: 1px solid rgba(235, 211, 115, 0.3);
    border-radius: 6px;
    font-size: 0.65rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.btn-share:hover {
    background: var(--accent);
    color: var(--primary-dark);
}

.modal-header h3 {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: var(--accent);
}

.custom-select {
    width: 100%;
    padding: 0.65rem 1rem;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border);
    color: var(--text-light);
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 500;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%23EBD373'%3E%3Cpath fill-rule='evenodd' d='M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z' clip-rule='evenodd' /%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1.25rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
    cursor: pointer;
}

.custom-select:hover {
    border-color: rgba(235, 211, 115, 0.5);
    background-color: rgba(15, 23, 42, 0.8);
}

.custom-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(235, 211, 115, 0.1), 0 8px 16px rgba(0,0,0,0.4);
    background-color: var(--primary-dark);
    transform: translateY(-1px);
}

.custom-select option {
    background-color: var(--bg-dark);
    color: white;
    padding: 10px;
}

.btn_ver, .btn_ver_reserva {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5rem;
    font-size: 0.65rem;
    font-weight: 700;
    border-radius: 6px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 1px solid rgba(255,255,255,0.05);
}

.td_details {
    padding: 0.15rem 0.35rem !important;
    text-align: left !important;
}

.reserva-info {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    justify-content: center;
    width: 100%;
}

.reserva-detalle {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.1rem;
    width: 100%;
    padding: 0.2rem 0.35rem;
    border-radius: 6px;
    background: rgba(35, 76, 106, 0.35);
    border: 1px solid rgba(235, 211, 115, 0.2);
}

.curso-tag {
    font-weight: 700;
    color: var(--accent);
    font-size: 0.85rem;
}

.res-curso {
    display: block;
    font-weight: 800;
    font-size: 0.72rem;
    letter-spacing: 0.02em;
    color: var(--accent);
    line-height: 1.2;
}

.res-profesor {
    display: block;
    font-weight: 500;
    font-size: 0.62rem;
    color: #7DD3FC;
    line-height: 1.2;
}

.res-asignatura {
    display: block;
    font-weight: 600;
    font-size: 0.6rem;
    color: #6EE7B7;
    line-height: 1.2;
    text-transform: capitalize;
}

.prof-tag, .asig-tag {
    cursor: help;
    color: var(--text-muted);
    font-size: 0.7rem;
    transition: var(--transition);
}

.prof-tag:hover, .asig-tag:hover {
    color: var(--accent);
}

.compact-btn {
    padding: 0.2rem 0.5rem !important;
    font-size: 0.65rem !important;
    background: rgba(16, 185, 129, 0.1) !important;
    color: var(--success) !important;
    border: 1px solid var(--success) !important;
}

.compact-btn:hover {
    background: var(--success) !important;
    color: white !important;
}

.btn_ver_datos, .clase_fija {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.1rem;
    padding: 0.35rem 0.55rem;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 6px;
    background: linear-gradient(135deg, rgba(35, 76, 106, 0.85), rgba(27, 60, 83, 0.95));
    color: white;
    border: 1px solid rgba(235, 211, 115, 0.25);
    flex-grow: 1;
    text-align: left;
    cursor: pointer;
    transition: var(--transition);
    min-width: 0;
}

.btn_ver_datos:hover, .clase_fija:hover {
    border-color: var(--accent);
    box-shadow: 0 0 10px rgba(235, 211, 115, 0.2);
    transform: translateY(-1px);
}

.clase_fija {
    background: linear-gradient(135deg, rgba(120, 53, 15, 0.75), rgba(69, 26, 3, 0.9));
    border-color: rgba(251, 191, 36, 0.45);
}

.clase_fija .res-curso {
    color: #FCD34D;
}

.clase_fija .res-profesor {
    color: #FDE68A;
}

.clase_fija .res-asignatura {
    color: #FBBF24;
}

.btn_eliminar {
    width: 20px;
    height: 20px;
    padding: 0;
    font-size: 0.8rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}

.btn_eliminar:hover {
    background: var(--error);
    color: white;
}

dialog::backdrop {
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
}

#btn_cerrar_modal {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-light);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

#btn_cerrar_modal:hover {
    background: var(--error);
    border-color: var(--error);
}

/* Menu Page */
.tbl_menu {
    margin: 5vh auto;
    border-spacing: 2rem;
}

.btn_menu {
    width: 280px;
    height: 180px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    color: var(--text-light);
    font-size: 1.25rem;
    font-weight: 600;
    box-shadow: var(--shadow);
}

.btn_menu:hover {
    transform: translateY(-8px);
    border-color: var(--accent);
    background: var(--secondary);
}

/* Welcome Screen */
.welcome-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
    animation: fadeIn 1s ease-out;
}

.welcome-screen h1 {
    font-size: 2rem;
    font-weight: 800;
    margin: 1rem 0;
    background: linear-gradient(to right, #fff, var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.welcome-screen p {
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.6;
}

.badge {
    padding: 0.5rem 1rem;
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border: 1px solid var(--success);
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.1em;
}

.curso-filtro-box {
    margin: 0.75rem 0 1rem;
    padding: 0.65rem 0.7rem;
    background: rgba(235, 211, 115, 0.06);
    border: 1px solid rgba(235, 211, 115, 0.2);
    border-radius: 10px;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.curso-filtro-box label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--accent);
    margin-bottom: 0;
}

.curso-filtro-box .custom-select {
    padding: 0.45rem 1.8rem 0.45rem 0.6rem;
    font-size: 0.72rem;
    border-radius: 8px;
    background-color: rgba(15, 23, 42, 0.85);
}

.btn_consultar_filtro {
    width: 100%;
    margin-top: 0.15rem;
    padding: 0.45rem 0.6rem;
    border-radius: 8px;
    border: 1px solid rgba(235, 211, 115, 0.35);
    background: linear-gradient(135deg, rgba(35, 76, 106, 0.9), rgba(27, 60, 83, 0.95));
    color: var(--accent);
    font-size: 0.7rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    transition: var(--transition);
}

.btn_consultar_filtro:hover {
    border-color: var(--accent);
    box-shadow: 0 0 10px rgba(235, 211, 115, 0.2);
}

.profesor-filtro-box {
    border-color: rgba(125, 211, 252, 0.25);
    background: rgba(125, 211, 252, 0.05);
}

.profesor-filtro-box label {
    color: #7DD3FC;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.btn_secondary {
    width: 100%;
    padding: 0.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-light);
    border-radius: var(--radius);
    font-size: 0.75rem;
    cursor: pointer;
    transition: var(--transition);
}

.btn_secondary:hover {
    background: var(--secondary);
    border-color: var(--accent);
}

.btn-save {
    background: linear-gradient(135deg, var(--accent), #D4BD5F) !important;
    color: var(--primary-dark) !important;
    font-weight: 700 !important;
    border: none !important;
}

.btn-save:hover {
    box-shadow: 0 0 20px rgba(235, 211, 115, 0.4) !important;
    transform: translateY(-2px);
}

.btn_reservar {
    padding: 0.2rem 0.6rem !important;
    font-size: 0.65rem !important;
    background: linear-gradient(135deg, #3B82F6, #2563EB) !important;
    color: white !important;
    border-radius: 4px !important;
    font-weight: 700 !important;
}

.btn_reservar:hover {
    background: #1D4ED8 !important;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.4) !important;
}

.tbl_periodos {
    border: 1px solid var(--border) !important;
}

.tbl_periodos td, .tbl_periodos th {
    border: 1px solid var(--border) !important;
}

.btn-cancel {
    background: rgba(255,255,255,0.05) !important;
    color: var(--text-muted) !important;
    border: 1px solid var(--border) !important;
}

.btn-cancel:hover {
    background: rgba(239, 68, 68, 0.15) !important;
    color: var(--error) !important;
    border-color: var(--error) !important;
}

@keyframes pageFlip {
    0% {
        transform: rotateX(20deg) rotateY(-90deg) skewY(10deg);
        opacity: 0;
        transform-origin: bottom right;
    }
    100% {
        transform: rotateX(0deg) rotateY(0deg) skewY(0deg);
        opacity: 1;
        transform-origin: bottom right;
    }
}

.page-flip {
    perspective: 2000px;
    animation: pageFlip 0.8s cubic-bezier(0.23, 1, 0.32, 1) forwards;
    backface-visibility: hidden;
}

/* Mobile Toggle */
.btn_mobile_toggle {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1000;
    width: 40px;
    height: 40px;
    background: var(--accent);
    color: var(--primary-dark);
    border: none;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

/* Responsive Media Queries */
@media (max-width: 1024px) {
    #dv_izquierdo {
        width: 220px;
    }
}

@media (max-width: 768px) {
    .btn_mobile_toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    #dv_contenedor {
        flex-direction: column;
    }

    #dv_izquierdo {
        position: fixed;
        left: -260px;
        top: 0;
        z-index: 999;
        transition: var(--transition);
        width: 260px;
        box-shadow: 10px 0 30px rgba(0,0,0,0.5);
    }

    #dv_izquierdo.show {
        left: 0;
    }

    #dv_derecho {
        padding: 4rem 1rem 1rem;
        height: auto;
        min-height: 100vh;
    }

    .calendar-view,
    #dv_derecho > .calendar-view {
        height: auto;
        flex: none;
    }

    .calendar-grid-container {
        flex: none;
        height: auto;
        overflow: visible;
    }

    .calendar-header h3 {
        font-size: 1.2rem;
    }

    /* Stack calendar on mobile if too wide */
    .tbl_calendario {
        height: auto;
    }

    .tbl_calendario thead {
        display: none; /* Hide days on mobile as they'll be inside cells or redundant */
    }

    .tbl_calendario, .tbl_calendario tbody, .tbl_calendario tr, .tbl_calendario td {
        display: block;
        width: 100%;
        height: auto;
    }

    .tbl_calendario tbody tr {
        height: auto;
        margin-bottom: 1rem;
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .tbl_calendario td {
        width: calc(50% - 0.25rem);
        height: auto;
        min-height: 80px;
        margin-bottom: 0;
    }

    .tbl_calendario td:empty {
        display: none;
    }

    /* Show day name inside cell on mobile */
    .tbl_calendario td::after {
        content: attr(data-day);
        position: absolute;
        bottom: 0.3rem;
        left: 0.5rem;
        font-size: 0.55rem;
        color: var(--text-muted);
        text-transform: uppercase;
        font-weight: 700;
    }
}

@media (max-width: 480px) {
    .tbl_calendario td {
        width: 100%;
    }
    
    .report-summary {
        grid-template-columns: 1fr;
    }
}

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