:root {
    --bg-color: #f4f7fe;
    --card-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(255, 255, 255, 0.3);
    --text-primary: #1e293b;
    --text-secondary: #536174;
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --border-color: #e2e8f0;
    --sidebar-width: 400px;
    --grid-cell-height: 60px;
    --time-col-width: 60px;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --success: #10b981;
    --danger: #b91c1c;
    --warning: #f59e0b;
    --info: #3b82f6;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --border-hover: #cbd5e1;
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.5rem;
    --space-6: 2rem;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --transition-fast: 0.15s ease;
    --transition-base: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Custom Premium Scrollbar styling for WebKit browsers */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 20px;
    border: 1px solid transparent;
    background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    overflow: hidden;
}

/* Layout */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
    background: radial-gradient(circle at 10% 20%, rgb(255, 245, 245) 0%, rgb(244, 247, 254) 90%);
}

.app-container.sidebar-hidden .sidebar {
    display: none;
}

.app-container.sidebar-hidden .main-content {
    padding: 1rem 5%; /* Centered and more breathing room */
}

/* Sidebar full mode - Premium Dashboard Grid Layout */
.app-container.sidebar-full .sidebar {
    width: 100%;
    background: #f8fafc; /* lighter background for full management panel */
}

.app-container.sidebar-full .main-content {
    display: none;
}

/* Center the header, tabs and footer for balanced UX */
.app-container.sidebar-full .sidebar-header {
    padding: 2.5rem 3.5rem 1.5rem 3.5rem;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}

.app-container.sidebar-full .tabs {
    margin: 0.5rem 3.5rem 1.75rem 3.5rem;
    max-width: 1400px;
    width: calc(100% - 7rem);
    margin-left: auto;
    margin-right: auto;
}

.app-container.sidebar-full .sidebar-footer {
    padding: 1.5rem 3.5rem;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    background: white !important;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.app-container.sidebar-full .tab-content-container {
    padding: 0 3.5rem 3rem 3.5rem;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    overflow-y: auto;
}

/* Transform active tab content into a Grid of cards */
.app-container.sidebar-full .tab-content {
    display: none;
    width: 100%;
}

.app-container.sidebar-full .tab-content.active {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 1.5rem;
    align-items: start;
}

/* Keep full height on lists since they don't scroll inside cards anymore */
.app-container.sidebar-full .data-list {
    max-height: 400px !important; /* give them a scroll inside cards so they don't grow infinitely long */
    overflow-y: auto;
}

.app-container.sidebar-full .accordion-body.expanded {
    max-height: 99999px !important;
}

.app-container.sidebar-full .checkbox-list-scrollable {
    max-height: 180px;
}

/* Stagger cards and elements nicely in full mode */
.app-container.sidebar-full .accordion {
    margin-bottom: 0;
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

/* Maximized states for accordions in full sidebar mode */
.app-container.sidebar-full .accordion.maximized {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 90vw !important;
    max-width: 800px !important;
    height: 85vh !important;
    max-height: 800px !important;
    z-index: 9999 !important;
    box-shadow: 0 0 0 100vw rgba(0,0,0,0.6), 0 20px 40px rgba(0,0,0,0.5) !important;
    background: var(--card-bg) !important;
    border-radius: 16px !important;
    border: none !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
}

.app-container.sidebar-full .accordion.maximized .accordion-header {
    border-bottom: 1px solid var(--border-color) !important;
    border-radius: 16px 16px 0 0 !important;
    padding: 1.25rem 1.75rem !important;
    background: var(--card-bg) !important;
}

.app-container.sidebar-full .accordion.maximized .accordion-body {
    display: block !important;
    max-height: none !important;
    overflow-y: auto !important;
    flex: 1 !important;
    padding: 1.75rem !important;
}

.app-container.sidebar-full .accordion.maximized .data-list {
    max-height: none !important;
}

.app-container.sidebar-full .accordion.maximized .accordion-body form {
    position: sticky !important;
    top: -1.75rem !important;
    z-index: 10 !important;
    background: var(--card-bg) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    margin: -1.75rem -1.75rem 1rem -1.75rem !important;
    padding: 1.75rem !important;
    border-bottom: 1px solid var(--border-color) !important;
}

/* En Materias, reserva una zona visible para los registros existentes y deja
   que el formulario largo se desplace dentro de su propia zona. */
.app-container.sidebar-full .accordion.maximized #acc-materias {
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    padding: 0 !important;
}

.app-container.sidebar-full .accordion.maximized #form-materia {
    position: static !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    margin: 0 !important;
}

.app-container.sidebar-full .accordion.maximized #list-materias {
    flex: 0 0 clamp(180px, 34%, 260px) !important;
    min-height: 180px !important;
    max-height: 260px !important;
    overflow-y: auto !important;
    background: var(--card-bg) !important;
    border-top: 1px solid var(--border-color) !important;
}


.app-container.sidebar-full .settings-card {
    margin-bottom: 0;
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    min-height: 100%; /* align heights in grid */
}

/* ------------ SIDEBAR ------------ */
.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-right: 1px solid var(--glass-border);
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    z-index: 10;
    height: 100%;
}

.sidebar-header {
    padding: 2rem 2rem 1rem 2rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.logo i {
    font-size: 1.9rem;
    background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo h2 {
    font-size: 1.9rem;
    font-weight: 800;
    letter-spacing: -0.8px;
    background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle { color: var(--text-secondary); font-size: 0.95rem; }

/* Tabs */
/* Tabs - Premium iOS Segmented Control */
.tabs {
    display: flex;
    background: #f1f5f9;
    border-radius: 10px;
    padding: 4px;
    margin: 0.5rem 1.5rem 1.25rem 1.5rem;
    border: 1px solid var(--border-color);
}

.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    padding: 0.6rem 0.5rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    border-radius: 8px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

.tab-btn.active {
    background: white;
    color: var(--primary);
    box-shadow: 0 2px 4px rgba(0,0,0,0.06);
}

.tab-btn:hover:not(.active) {
    color: var(--primary);
    background: rgba(255, 255, 255, 0.4);
}

.tab-content-container {
    flex: 1;
    overflow-y: auto;
    padding: 0 1.5rem 2rem 1.5rem;
    display: flex;
    flex-direction: column;
}

.tab-content {
    display: none;
    flex-direction: column;
    flex: 1;
}

.tab-content.active {
    display: flex;
}

/* Accordions */
.accordion {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 1rem;
    background: white;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.accordion:hover {
    box-shadow: 0 6px 16px rgba(0,0,0,0.04);
    border-color: #cbd5e1;
}

.accordion-header {
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    padding: 1.1rem 1.25rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #ffffff;
    color: var(--text-primary);
    border: 0;
    border-left: 4px solid transparent;
    border-radius: 0;
    font: inherit;
    text-align: left;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    border-bottom: 1px solid transparent;
}

.accordion-header:hover {
    background: #f8fafc;
    color: var(--primary);
}

.accordion-header.active {
    background: #f8fafc;
    color: var(--primary);
    border-left-color: var(--primary);
    border-bottom-color: var(--border-color);
}

.acc-title {
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.95rem;
}

.acc-icon {
    color: var(--text-secondary);
    font-size: 0.85rem;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), color 0.2s;
}

.accordion-header:hover .acc-icon,
.accordion-header.active .acc-icon {
    color: var(--primary);
}

.accordion-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    background: #ffffff;
}

.accordion-body.expanded {
    max-height: 1000px;
}

.accordion-header.active .acc-icon {
    transform: rotate(180deg);
}

/* Forms inside Accordions */
.compact-form {
    display: flex;
    padding: 1rem;
    gap: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.compact-form-col {
    display: flex;
    flex-direction: column;
    padding: 1rem;
    gap: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.form-row {
    display: flex;
    gap: 0.5rem;
}

.w-50 {
    flex: 1;
}

.input-with-label {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.input-with-label label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
}

input[type="text"], input[type="number"], input[type="time"], select {
    width: 100%;
    padding: 0.65rem 0.9rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.9rem;
    outline: none;
    background-color: #ffffff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

input[type="text"]:hover, input[type="number"]:hover, input[type="time"]:hover, select:hover {
    border-color: #cbd5e1;
}

input:focus, select:focus {
    border-color: var(--primary);
    background-color: #ffffff;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12), 0 1px 2px rgba(0, 0, 0, 0.05);
}

.color-picker-mini {
    height: 38px;
    width: 38px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    padding: 2px;
}

input[type="color"] {
    border: none;
    width: 100%;
    height: 100%;
    cursor: pointer;
    background: none;
    border-radius: 6px;
    -webkit-appearance: none;
    appearance: none;
}
input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"]::-webkit-color-swatch { border: none; border-radius: 4px; }

/* Buttons */
button {
    cursor: pointer;
    border: none;
    outline: none;
    transition: all 0.2s ease;
    font-weight: 600;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

button:disabled {
    background: var(--bg-tertiary);
    color: #94a3b8;
    cursor: not-allowed;
    pointer-events: none;
    box-shadow: none;
}

body.dark-mode button:disabled {
    background: #1f2937;
    color: #6b7280;
}

.btn-small {
    padding: 0.6rem;
    background: var(--primary);
    color: white;
    border-radius: 8px;
}

.btn-small:hover { background: var(--primary-hover); }

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, #6366f1 100%);
    color: white;
    padding: 0.85rem 1.5rem;
    font-size: 1rem;
    font-weight: 700;
    border: none;
    border-radius: 10px;
    box-shadow: 0 4px 14px 0 rgba(79, 70, 229, 0.3);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-hover) 0%, #4f46e5 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(79, 70, 229, 0.45);
}

.btn-secondary {
    background: #f1f5f9;
    color: var(--text-primary);
    padding: 0.6rem 1rem;
}

.btn-secondary:hover {
    background: #e2e8f0;
}

.btn-text {
    background: transparent;
    color: var(--danger);
    width: 100%;
    padding: 0.85rem 1.5rem;
}

.btn-text:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* Lists */
.data-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 350px;
    overflow-y: auto;
    overflow-x: hidden;
}

.data-list li {
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
    transition: background-color var(--transition-fast);
}

.data-list li:hover {
    background: var(--bg-secondary);
}

.data-list li:last-child {
    border-bottom: none;
}

.app-container.sidebar-full #generation-readiness-card,
.app-container.sidebar-full #diagnostico-datos-card,
.app-container.sidebar-full .generator-advanced {
    grid-column: 1 / -1;
}

.app-container.sidebar-full .generator-advanced-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1rem;
}

.app-container.sidebar-full .generator-advanced-content .settings-card {
    margin-bottom: 0;
}

.accordion-body[hidden] {
    display: none !important;
}

/* Los grupos generados con <details> deben ocupar toda la fila disponible.
   Sin esta regla, el item flex puede encogerse al ancho de su contenido. */
#list-materias > li,
#list-materias > li > details {
    width: 100%;
    min-width: 0;
}

.item-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.item-title { font-weight: 600; }
.item-subtitle { font-size: 0.75rem; color: var(--text-secondary); }

.btn-delete {
    background: transparent;
    color: var(--text-secondary);
    padding: 0.4rem;
    border-radius: 6px;
}

.btn-delete:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

/* Settings Card */
.settings-card {
    background: white;
    border-radius: 12px;
    padding: 1.25rem;
    border: 1px solid var(--border-color);
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition-base), border-color var(--transition-base);
}

.settings-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--border-hover);
}

.settings-title {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.hint {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.checkbox-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.cb-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    width: 100%;
    user-select: none;
}

/* Premium iOS Slide toggle switches */
.cb-label input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 36px;
    height: 20px;
    background-color: #cbd5e1;
    border-radius: 20px;
    position: relative;
    outline: none;
    cursor: pointer;
    transition: background-color 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
}

.cb-label input[type="checkbox"]:checked {
    background-color: var(--primary);
}

.cb-label input[type="checkbox"]::before {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background-color: white;
    top: 2px;
    left: 2px;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.cb-label input[type="checkbox"]:checked::before {
    transform: translateX(16px);
}

/* Advanced Config & Details */
.advanced-config {
    background: #f8fafc;
    border-radius: 8px;
    padding: 0.5rem;
    border: 1px dashed var(--border-color);
}
.advanced-config details summary {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary);
    cursor: pointer;
    list-style: none; /* remove default arrow in some browsers */
}
.advanced-config details summary::-webkit-details-marker { display: none; }
.advanced-config details summary::before {
    content: "► "; font-size: 0.6rem; display: inline-block; transition: transform 0.2s;
}
.advanced-config details[open] summary::before { transform: rotate(90deg); }

.checkbox-grid-small {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; margin-top: 0.5rem;
}
.checkbox-grid-small label {
    font-size: 0.75rem; display: flex; align-items: center; gap: 0.25rem; cursor: pointer;
}
.checkbox-grid-small input[type="checkbox"] { width: 12px; height: 12px; }

.years-config {
    margin-top: 0.5rem; display: flex; flex-direction: column; gap: 0.5rem;
}
.year-row {
    display: flex; align-items: center; gap: 0.5rem; font-size: 0.8rem; background: white; padding: 0.4rem; border-radius: 6px; border: 1px solid var(--border-color);
}
.year-shifts {
    display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.25rem; flex: 1;
}
.year-shifts select {
    padding: 2px; font-size: 0.65rem; width: 100%; border-radius: 4px;
}
.year-shift-col { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.year-shift-col span { font-size: 0.6rem; font-weight: 600; color: var(--text-secondary); }

.checkbox-list-scrollable {
    max-height: 120px; overflow-y: auto; border: 1px solid var(--border-color); border-radius: 8px; padding: 0.5rem; display: flex; flex-direction: column; gap: 0.4rem; background: #f8fafc;
}
.checkbox-list-scrollable label { font-size: 0.8rem; display: flex; align-items: flex-start; gap: 0.4rem; cursor: pointer; }

.filter-select {
    padding: 0.6rem 1rem; border-radius: 8px; border: 1px solid var(--border-color); font-weight: 600; font-family: inherit; outline: none; background: white;
    width: auto;
    min-width: 220px;
}


/* ------------ MAIN CONTENT ------------ */
.main-content {
    flex: 1;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 2rem;
    position: relative;
}

.main-header {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.header-top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: nowrap;
    gap: 1rem;
    width: 100%;
}

.header-top-tools {
    display: flex;
    min-width: 0;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-2);
}

.main-utility-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}




.header-text {
    flex-shrink: 0;
}

.header-controls {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    flex-wrap: wrap;
    width: 100%;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.header-exports {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.mobile-more-actions { position: relative; }
.more-actions-toggle { display: none; }
.more-actions-menu {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Maximized state (sidebar hidden) */
.app-container.sidebar-hidden .header-controls {
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.app-container.sidebar-hidden .header-actions,
.app-container.sidebar-hidden .header-exports {
    display: contents;
}

.header-text h1 {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: #1e293b;
}

#class-count {
    display: inline-block;
    margin-top: 0.25rem;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.95rem;
    background: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    box-shadow: var(--shadow-sm);
}

.main-header .btn-secondary {
    background: white;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    padding: 0.6rem 1.25rem;
}

.main-header .btn-secondary:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* Grid Empty State */
@keyframes empty-state-appear {
    from {
        opacity: 0;
        transform: translate(-50%, -46%) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.empty-state {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    width: min(720px, calc(100% - 3rem));
    max-width: 720px;
    z-index: 20;
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 2rem;
    border-radius: 24px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.6);
    display: none;
    animation: empty-state-appear 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.empty-state-intro > i {
    display: inline-block;
    margin: 0.25rem 0 0.75rem;
    color: var(--primary);
    font-size: 2.5rem;
    animation: empty-icon-float 3.5s ease-in-out infinite;
}

.empty-state h2 {
    margin-bottom: 0.6rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--text-primary);
}
.empty-state p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
}

.empty-readiness-card {
    margin-top: 1.25rem;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: rgba(248, 250, 252, 0.8);
    text-align: left;
}

.empty-readiness-card .readiness-heading-row > span {
    color: var(--text-secondary);
    font-size: 0.78rem;
}

.empty-state-actions {
    display: flex;
    justify-content: center;
    gap: var(--space-2);
}

.empty-state-actions button {
    min-height: 44px;
    padding: 0.7rem 1rem;
}

/* ------------ SCHEDULE GRID ------------ */
.schedule-container {
    flex: 1 1 auto;
    min-width: 0;
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-lg);
    overflow: auto;
    position: relative;
    display: flex;
    flex-direction: column;
}

.export-area {
    display: flex;
    min-width: 0;
    flex-direction: column;
    flex: 1;
    background: white;
    padding: 2rem;
    border-radius: 24px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.export-area .main-header {
    margin-bottom: 2rem;
}

.export-area .schedule-container {
    box-shadow: none;
    border: 1px solid var(--border-color);
    flex: 1;
}

.schedule-wrapper {
    display: flex;
    min-width: 800px;
    position: relative;
    padding: 1rem 1rem 1rem 0;
}

/* Time/Days Grid */
.time-column {
    width: var(--time-col-width);
    flex-shrink: 0;
    position: relative;
    margin-top: 3rem;
}

.time-slot-label {
    height: var(--grid-cell-height);
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    padding-right: 0.75rem;
    transform: translateY(-0.5rem);
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
}

.days-container {
    display: flex;
    flex: 1;
    border-left: 1px solid var(--border-color);
    border-top: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.days-container.has-maximized-day .day-column:not(.maximized) {
    display: none;
}

.days-container.has-maximized-day .day-column.maximized {
    flex: 1 1 100%;
}

.day-column {
    flex: 1;
    min-width: 120px;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: flex 0.3s ease, min-width 0.3s ease;
}

.day-header {
    width: 100%;
    height: 3rem;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 0;
    font-weight: 700;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
    background: #f8fafc;
    position: sticky;
    top: 0;
    z-index: 5;
    cursor: pointer;
    transition: background 0.2s;
}

.day-header:hover {
    background: #e2e8f0;
}

.day-header:focus-visible {
    outline-offset: -3px;
}

.day-grid {
    position: relative;
}

.grid-line {
    position: absolute;
    width: 100%;
    height: 1px;
    background-color: var(--border-color);
    left: 0;
}

.grid-line.half-hour {
    background-color: transparent;
    border-top: 1px dashed #e2e8f0;
}

/* CLASS CARD */
@keyframes card-appear {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(6px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.class-card {
    position: absolute;
    left: 4px;
    right: 4px;
    border-radius: 10px;
    padding: 0.6rem;
    color: white;
    overflow: hidden;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), 
                box-shadow 0.25s ease, 
                opacity 0.2s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
    z-index: 2;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    animation: card-appear 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.class-card:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.16);
    z-index: 3;
}

.class-title {
    font-weight: 700;
    font-size: 0.85rem;
    line-height: 1.1;
    margin-bottom: 0.25rem;
}

.class-time, .class-location, .class-teacher, .class-context {
    font-size: 0.7rem;
    font-weight: 500;
    opacity: 0.9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-top: 2px;
}

/* Maximized states for cards */
.class-card.maximized {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 90vw !important;
    max-width: 500px !important;
    height: auto !important;
    min-height: 250px !important;
    z-index: 9999 !important;
    box-shadow: 0 0 0 100vw rgba(0,0,0,0.6), 0 20px 40px rgba(0,0,0,0.5) !important;
    justify-content: center;
    padding: 2.5rem !important;
    border-radius: 16px !important;
    border: none !important;
}

.class-card.maximized .class-title {
    font-size: 1.6rem !important;
    margin-bottom: 1rem !important;
    white-space: normal;
}

.class-card.maximized .class-time, 
.class-card.maximized .class-location, 
.class-card.maximized .class-teacher, 
.class-card.maximized .class-context {
    font-size: 1.1rem !important;
    margin-top: 0.6rem !important;
    white-space: normal;
    word-break: break-word;
}

/* ------------ PROGRESS BAR OVERLAY ------------ */
.global-progress-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: white;
    box-shadow: var(--shadow-md);
    z-index: 1000;
    padding: 1rem 20%;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    border-bottom: 3px solid var(--primary);
    transform: translateY(-100%);
    transition: transform 0.3s ease;
}

.global-progress-container.show {
    transform: translateY(0);
}

.global-progress-text {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
    text-align: center;
}

.global-progress-bar-bg {
    width: 100%;
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}

.global-progress-bar-fill {
    height: 100%;
    width: 0%;
    background: var(--primary);
    transition: width 0.1s linear;
}

/* ------------ RESTRICCIONES PANEL ------------ */
.restricciones-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-bottom: 0.75rem;
    background: #f8fafc;
    padding: 0.25rem;
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

.restr-tab-btn {
    flex: 1 1 calc(33.333% - 0.25rem);
    min-width: 4.6rem;
    min-height: 2rem;
    padding: 0.45rem 0.3rem;
    font-size: 0.7rem;
    line-height: 1.1;
    font-weight: 600;
    background: transparent;
    color: var(--text-secondary);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    white-space: normal;
}

.restr-tab-btn:hover {
    background: rgba(245, 158, 11, 0.1);
    color: #d97706;
}

.restr-tab-btn.active {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    box-shadow: 0 2px 6px rgba(245, 158, 11, 0.35);
}

.restr-tab-btn i {
    flex-shrink: 0;
    font-size: 0.65rem;
}

.restr-tab-content {
    display: none;
}

.restr-tab-content.active {
    display: block;
}

.restr-list {
    max-height: 320px;
    overflow-y: auto;
}

.restr-list li {
    padding: 0.6rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.82rem;
    transition: background 0.15s ease;
}

.restr-list li:hover {
    background: rgba(245, 158, 11, 0.04);
}

.restr-list li:last-child {
    border-bottom: none;
}

.restr-entity-name {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.restr-entity-name i {
    font-size: 0.7rem;
    color: #d97706;
}

.restr-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-top: 0.15rem;
}

.restr-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.68rem;
    font-weight: 600;
    padding: 0.2rem 0.5rem;
    border-radius: 20px;
    white-space: nowrap;
    border: 0;
    font-family: inherit;
}

.restr-tag:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.edit-prof-label:hover {
    background: #f1f5f9;
}

.restr-tag i {
    font-size: 0.6rem;
}

.restr-tag.tag-day-off {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
}

.restr-tag.tag-shift {
    background: rgba(59, 130, 246, 0.1);
    color: #2563eb;
}

.restr-tag.tag-exclusive {
    background: rgba(168, 85, 247, 0.1);
    color: #7c3aed;
}

.restr-tag.tag-preferred {
    background: rgba(245, 158, 11, 0.12);
    color: #b45309;
}

.restr-tag.tag-capacity {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
}

.restr-tag.tag-forced-day {
    background: rgba(245, 158, 11, 0.12);
    color: #b45309;
}

.restr-tag.tag-aula-fixed {
    background: rgba(99, 102, 241, 0.1);
    color: #4f46e5;
}

.restr-tag.tag-fusion {
    background: rgba(236, 72, 153, 0.1);
    color: #db2777;
}

.restr-tag.tag-traslape {
    background: rgba(20, 184, 166, 0.1);
    color: #0d9488;
}

.restr-tag.tag-traslape-opcional {
    background: rgba(245, 158, 11, 0.1);
    color: #d97706;
}

.restr-list li.restr-day-group {
    gap: 0.45rem;
}

.restr-day-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.restr-day-title {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
}

.restr-day-title i {
    font-size: 0.7rem;
    color: #d97706;
}

.restr-day-count {
    flex-shrink: 0;
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
    border: 1px solid rgba(245, 158, 11, 0.22);
    background: rgba(245, 158, 11, 0.08);
    color: #b45309;
    font-size: 0.65rem;
    font-weight: 700;
    white-space: nowrap;
}

.restr-day-group .restr-tag {
    max-width: 100%;
    white-space: normal;
    line-height: 1.2;
}

.restr-day-empty {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--text-secondary);
    font-size: 0.74rem;
    font-style: italic;
}

.restr-day-empty i {
    font-size: 0.7rem;
    opacity: 0.55;
}

.restr-empty {
    text-align: center;
    padding: 1.5rem 1rem !important;
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-style: italic;
    background: transparent;
    border: none !important;
    box-shadow: none;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
}

.restr-empty i {
    display: block;
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
    opacity: 0.4;
}

.restr-tag.disabled {
    opacity: 0.45;
    filter: grayscale(0.85);
    background: #f1f5f9 !important;
    color: #64748b !important;
    text-decoration: line-through;
}

#btn-detener {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
    box-shadow: 0 4px 14px 0 rgba(239, 68, 68, 0.3) !important;
}

#btn-detener:hover:not(:disabled) {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%) !important;
    box-shadow: 0 8px 24px rgba(239, 68, 68, 0.45) !important;
    transform: translateY(-2px);
}

/* Custom Interactive Edit Modal Styles (Schedio Premium) */
.sg-modal-overlay {
    position: fixed;
    inset: 0;
    width: auto;
    height: auto;
    padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
    box-sizing: border-box;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sg-modal-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.sg-modal-card {
    background: white;
    width: 90%;
    max-width: 520px;
    max-height: calc(100dvh - 2rem);
    border-radius: 16px;
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.sg-modal-overlay.show .sg-modal-card {
    transform: scale(1);
}

.sg-modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.sg-modal-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.sg-modal-close {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 1;
    padding: 0;
}

.sg-modal-close:hover {
    color: var(--danger);
}

.sg-modal-body {
    padding: 1.5rem;
    font-size: 0.95rem;
    color: var(--text-primary);
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    max-height: none;
    overscroll-behavior: contain;
}

.sg-modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    background: #f8fafc;
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    flex-shrink: 0;
}

@media (max-width: 520px) {
    .sg-modal-overlay {
        padding: max(0.5rem, env(safe-area-inset-top)) max(0.5rem, env(safe-area-inset-right)) max(0.5rem, env(safe-area-inset-bottom)) max(0.5rem, env(safe-area-inset-left));
    }

    .sg-modal-card {
        width: 100%;
        max-height: calc(100dvh - 1rem);
    }

    .sg-modal-header,
    .sg-modal-body,
    .sg-modal-footer {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .edit-subject-fields {
        flex-direction: column;
        gap: 0.75rem !important;
    }

    .edit-room-field,
    .edit-professor-field {
        flex: 1 1 auto !important;
        min-width: 0 !important;
        width: 100%;
    }
}

.sg-modal-btn {
    background: var(--primary);
    color: white;
    padding: 0.6rem 1.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 8px;
    border: none;
    box-shadow: 0 2px 4px rgba(79, 70, 229, 0.2);
    transition: all 0.2s;
}

.sg-modal-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.sg-modal-btn-cancel {
    background: white;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.6rem 1.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 8px;
    transition: background-color 0.2s;
}

.sg-modal-btn-cancel:hover {
    background: #f1f5f9;
}

.zip-export-mode-list {
    display: grid;
    gap: 0.65rem;
    margin: 0;
}

.zip-export-choice {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.85rem;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-secondary, #f8fafc);
    cursor: pointer;
}

.zip-export-choice:has(input:checked) {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.12);
}

.zip-export-choice input {
    margin-top: 0.2rem;
    accent-color: var(--primary);
}

.zip-export-choice-copy {
    display: grid;
    gap: 0.2rem;
}

.zip-export-choice-copy small {
    color: var(--text-secondary);
    line-height: 1.35;
}

.zip-export-category-fieldset {
    margin: 1rem 0 0;
    padding: 0;
    border: 0;
}

.zip-export-category-fieldset legend {
    margin-bottom: 0.55rem;
    font-size: 0.85rem;
    font-weight: 700;
}

.zip-export-category-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
}

.zip-export-category {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    min-height: 42px;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    user-select: none;
}

.zip-export-category input {
    accent-color: var(--primary);
}

.zip-export-category-fieldset:disabled {
    opacity: 0.55;
}

.zip-export-category-fieldset:disabled .zip-export-category {
    cursor: default;
}

.zip-export-category.is-unavailable {
    opacity: 0.5;
    cursor: not-allowed;
}

.zip-export-validation {
    margin: 0.75rem 0 0;
    color: var(--danger, #dc2626);
    font-size: 0.82rem;
    font-weight: 600;
}

@media (max-width: 520px) {
    .zip-export-category-grid {
        grid-template-columns: 1fr;
    }
}

/* Independent actions on schedule cards */
.btn-card-edit,
.btn-card-expand {
    position: absolute;
    top: 6px;
    background: rgba(255, 255, 255, 0.22);
    color: inherit;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex !important; /* Always visible for mobile */
    opacity: 0.45; /* Semi-transparent when not active */
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.2s, opacity 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    z-index: 12;
}

.btn-card-edit { right: 6px; }
.btn-card-expand { right: 34px; }

.btn-card-edit:hover,
.btn-card-edit:focus-visible,
.btn-card-expand:hover,
.btn-card-expand:focus-visible {
    background: rgba(255, 255, 255, 0.45);
    transform: scale(1.15);
    opacity: 1;
}

.class-card:hover .btn-card-edit,
.class-card:hover .btn-card-expand,
.class-card:focus-within .btn-card-edit,
.class-card:focus-within .btn-card-expand {
    opacity: 1;
}

/* Drag over states */
.day-grid.drag-over {
    background-color: rgba(79, 70, 229, 0.08) !important;
    outline: 2px dashed var(--primary);
    outline-offset: -2px;
    transition: background-color 0.2s ease, outline 0.2s ease;
}

.class-card.dragging {
    opacity: 0.3;
    transform: scale(0.98);
    box-shadow: var(--shadow-sm);
}

/* Custom premium hover states for online action buttons */
#btn-assign-en-linea-view:hover {
    background-color: rgba(79, 70, 229, 0.08) !important;
    color: #4f46e5 !important;
}
#btn-unassign-en-linea-view:hover {
    background-color: rgba(239, 68, 68, 0.08) !important;
    color: #ef4444 !important;
}
#btn-online-dropdown-toggle.active {
    border-color: var(--primary) !important;
    color: var(--primary) !important;
    background-color: var(--bg-secondary) !important;
}


/* Premium Dropdown for Export Options */
.dropdown-export {
    position: relative;
    display: inline-block;
}

.dropdown-export-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.04);
    min-width: 210px;
    padding: 6px;
    z-index: 999;
    opacity: 0;
    transform: translateY(-8px);
    pointer-events: none;
    transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1), transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.dropdown-export-menu.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.dropdown-export-item {
    width: 100%;
    background: transparent;
    color: var(--text-primary);
    padding: 0.65rem 0.85rem;
    font-size: 0.85rem;
    font-weight: 500;
    text-align: left;
    border-radius: 8px;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.6rem;
    transition: background 0.15s ease, color 0.15s ease;
}

.dropdown-export-item i {
    font-size: 1.05rem;
    width: 20px;
    text-align: center;
}

/* Premium toggle button hover shadow */
#btn-export-dropdown-toggle {
    background: linear-gradient(135deg, var(--primary) 0%, #6366f1 100%) !important;
    color: white !important;
    border: none !important;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.2) !important;
    transition: all 0.2s ease;
}

#btn-export-dropdown-toggle:hover {
    background: linear-gradient(135deg, var(--primary-hover) 0%, #4f46e5 100%) !important;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.3) !important;
}

#btn-export-dropdown-toggle.active {
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.15) !important;
}

/* Individual premium item hover states */
#export-excel-btn:hover {
    background-color: rgba(16, 185, 129, 0.08) !important;
    color: #10b981 !important;
}

#export-word-btn:hover {
    background-color: rgba(37, 99, 235, 0.08) !important;
    color: #2563eb !important;
}

#export-pdf-btn:hover {
    background-color: rgba(225, 29, 72, 0.08) !important;
    color: #e11d48 !important;
}

#export-btn:hover {
    background-color: rgba(100, 116, 139, 0.08) !important;
    color: #64748b !important;
}

#export-all-images-btn:hover {
    background-color: rgba(59, 130, 246, 0.08) !important;
    color: #3b82f6 !important;
}

/* Clickable details link in class cards */
.nav-filter-link {
    cursor: pointer;
    text-decoration: none;
    transition: opacity 0.15s ease;
    position: relative;
    z-index: 4;
    pointer-events: auto;
}
.nav-filter-link:hover {
    text-decoration: underline !important;
    opacity: 0.85;
}

/* Destacar botón de ampliar (pantalla completa) */
#btn-toggle-focus {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%) !important;
    color: white !important;
    border: none !important;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3) !important;
    padding: 0.6rem 0.85rem !important;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

#btn-toggle-focus:hover {
    background: linear-gradient(135deg, #4338ca 0%, #6d28d9 100%) !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.45) !important;
}

#btn-toggle-focus:active {
    transform: translateY(0) scale(0.98);
}

/* ==========================================================================
   DARK MODE OVERRIDES
   ========================================================================== */

body.dark-mode {
    --bg-color: #090d16;
    --card-bg: rgba(17, 24, 39, 0.85);
    --glass-border: rgba(255, 255, 255, 0.08);
    --text-primary: #f3f4f6;
    --text-secondary: #d1d5db;
    --border-color: #1f2937;
    --bg-secondary: #111827;
    --bg-tertiary: #1f2937;
    --border-hover: #374151;
}

/* Layout and Sidebar overrides */
body.dark-mode .app-container {
    background: radial-gradient(circle at 10% 20%, rgb(17, 24, 39) 0%, rgb(9, 13, 22) 90%) !important;
}

body.dark-mode .sidebar {
    background: rgba(17, 24, 39, 0.9);
    border-right-color: #1f2937;
}

body.dark-mode .app-container.sidebar-full .sidebar {
    background: #0f172a;
}

body.dark-mode .sidebar-footer {
    background: #111827 !important;
    border-top-color: #1f2937;
}

/* Accordions and panels */
body.dark-mode .accordion {
    background: #111827;
    border-color: #1f2937;
}

body.dark-mode .accordion-header {
    background: #111827;
    color: #f3f4f6;
}

body.dark-mode .accordion-header:hover {
    background: #1f2937;
    color: #818cf8;
}

body.dark-mode .accordion-header.active {
    background: #1f2937;
    color: #818cf8;
    border-left-color: #818cf8;
}

body.dark-mode .accordion-body {
    background: #111827;
    border-top: 1px solid #1f2937;
}

body.dark-mode .settings-card {
    background: #111827;
    border-color: #1f2937;
}

.schedule-ready-only[hidden] {
    display: none !important;
}

body.dark-mode .readiness-card {
    background: linear-gradient(145deg, #111827 0%, #15152b 100%);
    border-color: rgba(129, 140, 248, 0.35);
}

body.dark-mode .readiness-eyebrow,
body.dark-mode .readiness-count,
body.dark-mode .readiness-step.is-current .readiness-step-icon {
    color: #c7d2fe;
}

body.dark-mode .generator-advanced,
body.dark-mode .empty-readiness-card,
body.dark-mode .footer-backup-menu-panel,
body.dark-mode .more-actions-menu {
    background: #111827;
    border-color: #1f2937;
}

/* Form elements */
body.dark-mode input[type="text"], 
body.dark-mode input[type="number"], 
body.dark-mode input[type="time"], 
body.dark-mode select {
    background-color: #1f2937;
    border-color: #374151;
    color: #f3f4f6;
}

body.dark-mode input[type="text"]:hover, 
body.dark-mode input[type="number"]:hover, 
body.dark-mode input[type="time"]:hover, 
body.dark-mode select:hover {
    border-color: #4b5563;
}

body.dark-mode input:focus, 
body.dark-mode select:focus {
    border-color: #6366f1;
    background-color: #1f2937;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}

body.dark-mode .checkbox-list-scrollable {
    background: #0f172a;
    border-color: #1f2937;
}

body.dark-mode .advanced-config {
    background: #0f172a;
    border-color: #1f2937;
}

/* Buttons and filters */
body.dark-mode .btn-secondary {
    background: #1f2937;
    color: #f3f4f6;
}

body.dark-mode .btn-secondary:hover {
    background: #374151;
}

body.dark-mode .main-header .btn-secondary {
    background: #111827;
    border-color: #1f2937;
    color: #f3f4f6;
}

body.dark-mode .main-header .btn-secondary:hover {
    border-color: #6366f1;
    color: #818cf8;
}

body.dark-mode .filter-select {
    background: #111827;
    border-color: #1f2937;
    color: #f3f4f6;
}

/* Main Content Area */
body.dark-mode .export-area {
    background: #0f172a;
    box-shadow: var(--shadow-lg);
}

body.dark-mode .header-text h1 {
    color: #f3f4f6;
}

body.dark-mode #class-count {
    background: #1f2937;
    color: #f3f4f6;
}

body.dark-mode #backup-status-container {
    background: #111827 !important;
    border-color: #1f2937 !important;
}

body.dark-mode .backup-status-card.is-loaded .backup-status-name {
    color: #a5b4fc;
}

/* Schedule grid in dark mode */
body.dark-mode .day-header {
    background: #111827;
    border-bottom-color: #1f2937;
    color: #f3f4f6;
}

body.dark-mode .day-header:hover {
    background: #1f2937;
}

body.dark-mode .days-container {
    border-left-color: #1f2937;
    border-top-color: #1f2937;
}

body.dark-mode .day-column {
    border-right-color: #1f2937;
}

body.dark-mode .grid-line {
    background-color: #1f2937;
}

body.dark-mode .grid-line.half-hour {
    border-top-color: #1f2937;
}

body.dark-mode .time-slot-label {
    color: #9ca3af;
}

/* Empty State */
body.dark-mode .empty-state {
    background: rgba(17, 24, 39, 0.85);
    border-color: rgba(255, 255, 255, 0.05);
}

body.dark-mode .empty-state h2 {
    color: #f3f4f6;
}

/* Modal UI */
body.dark-mode .sg-modal-card {
    background: #111827;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
}

body.dark-mode .sg-modal-header {
    border-bottom-color: #1f2937;
}

body.dark-mode .sg-modal-title {
    color: #f3f4f6;
}

body.dark-mode .sg-modal-body {
    color: #f3f4f6;
}

body.dark-mode .sg-modal-footer {
    background: #0f172a;
    border-top-color: #1f2937;
}

body.dark-mode .sg-modal-btn-cancel {
    background: #1f2937;
    border-color: #374151;
    color: #9ca3af;
}

body.dark-mode .sg-modal-btn-cancel:hover {
    background: #374151;
}

/* Export Dropdowns */
body.dark-mode .dropdown-export-menu {
    background: #111827;
    border-color: #1f2937;
}

body.dark-mode .dropdown-export-item {
    color: #f3f4f6;
}

body.dark-mode .dropdown-export-item:hover {
    background: #1f2937;
}

/* Sidebar Tabs Navigation */
body.dark-mode .tabs {
    background: #0f172a;
    border-color: #1f2937;
}

body.dark-mode .tab-btn.active {
    background: #1f2937;
    color: #c7d2fe;
}

body.dark-mode .tab-btn:hover:not(.active) {
    color: #c7d2fe;
    background: rgba(255, 255, 255, 0.05);
}

/* Accordion internal elements */
body.dark-mode .years-config .year-row {
    background: #111827;
    border-color: #1f2937;
}

body.dark-mode .year-shifts select {
    background-color: #1f2937;
    border-color: #374151;
    color: #f3f4f6;
}

body.dark-mode .restricciones-tabs {
    background: #0f172a;
    border-color: #1f2937;
}

body.dark-mode .restr-tab-btn:hover {
    background: rgba(245, 158, 11, 0.15);
}

body.dark-mode .restr-list li:hover {
    background: rgba(245, 158, 11, 0.08);
}

body.dark-mode .restr-entity-name {
    color: #f3f4f6;
}

body.dark-mode .restr-list li {
    border-bottom-color: #1f2937;
}

body.dark-mode .data-list li {
    border-bottom-color: #1f2937;
}

body.dark-mode .btn-delete:hover {
    background: rgba(239, 68, 68, 0.15);
}

/* Scrollbar tweaks for dark mode */
body.dark-mode ::-webkit-scrollbar-thumb {
    background: #374151;
}

body.dark-mode ::-webkit-scrollbar-thumb:hover {
    background: #4b5563;
}






/* ============================================
   Toasts (notificaciones no bloqueantes)
   ============================================ */
.sg-toast-region {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    pointer-events: none;
}

.sg-toast {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--info);
    border-radius: var(--radius-lg);
    padding: 0.8rem 1rem;
    box-shadow: var(--shadow-lg);
    font-size: 0.88rem;
    color: var(--text-primary);
    max-width: 380px;
    transform: translateX(20px);
    transition: transform 0.25s ease;
    pointer-events: auto;
}

.sg-toast.show {
    transform: translateX(0);
}

.sg-toast-icon { font-size: 1rem; }
.sg-toast-success { border-left-color: var(--success); }
.sg-toast-success .sg-toast-icon { color: var(--success); }
.sg-toast-error { border-left-color: var(--danger); }
.sg-toast-error .sg-toast-icon { color: var(--danger); }
.sg-toast-warning { border-left-color: var(--warning); }
.sg-toast-warning .sg-toast-icon { color: var(--warning); }
.sg-toast-info { border-left-color: var(--info); }
.sg-toast-info .sg-toast-icon { color: var(--info); }

.sg-toast-msg { flex: 1; }

.sg-toast-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.1rem;
    line-height: 1;
    padding: 0 0.25rem;
    cursor: pointer;
    box-shadow: none;
}

.sg-toast-close:hover { color: var(--text-primary); }

body.dark-mode .sg-toast {
    background: #1f2937;
    border-color: #374151;
    border-left-width: 4px;
}

/* Botón de confirmación destructiva en modales */
.sg-modal-btn-danger {
    background: var(--danger) !important;
}

.sg-modal-btn-danger:hover {
    background: #dc2626 !important;
}

/* Validación inline de formularios */
.field-error {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--danger);
    font-size: 0.75rem;
    margin: 0.25rem 0 0.5rem;
}

.input-invalid {
    border-color: var(--danger) !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12) !important;
}

/* Transición suave al cambiar tema (clase temporal aplicada por JS) */
body.theme-transition,
body.theme-transition * {
    transition: background-color 0.35s ease, color 0.35s ease,
                border-color 0.35s ease, box-shadow 0.35s ease !important;
}

/* ============================================
   Clases utilitarias (antes estilos inline)
   ============================================ */
.btn-block { width: 100%; }
.flex-1 { flex: 1 1 0; min-width: 0; margin-bottom: 0; }
.flex-2 { flex: 2 1 0; min-width: 0; margin-bottom: 0; }
.btn-row { display: flex; gap: var(--space-2); }
.mb-2 { margin-bottom: var(--space-2); }
.gap-4 { gap: var(--space-4); }

.form-inline-row {
    display: flex;
    gap: var(--space-2);
    align-items: center;
    margin-bottom: var(--space-2);
}
.form-inline-row > input,
.form-inline-row > select { margin-bottom: 0; }

.form-inline-row > .input-with-label {
    min-width: 0;
}

.btn-ghost-icon {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
    transition: color var(--transition-fast);
}
.btn-ghost-icon:hover { color: var(--danger); background: transparent; }
.logo .btn-ghost-icon { margin-left: auto; font-size: 1.1rem; }
.logo .btn-ghost-icon:hover { color: var(--primary); }
#btn-clear-backup-name { display: none; font-size: 0.95rem; }

/* Banner de respaldo activo */
.backup-status-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
}
.backup-status-info {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-size: 0.85rem;
    color: var(--text-primary);
}
.backup-status-info i { color: var(--text-secondary); font-size: 1.2rem; }
.backup-status-text { display: flex; flex-direction: column; text-align: left; }
.backup-status-label {
    font-size: 0.72rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    margin-bottom: 1px;
}
.backup-status-name { font-weight: 600; color: var(--text-primary); word-break: break-all; }
.backup-status-card.is-loaded .backup-status-name { color: var(--primary); }

/* Input de búsqueda con iconos */
.input-icon-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    margin-bottom: var(--space-2);
}
.input-icon-left {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 0.75rem;
    pointer-events: none;
}
.input-search {
    width: 100%;
    margin-bottom: 0;
    padding-left: 30px;
    padding-right: 30px;
    font-size: 0.8rem;
}
.btn-input-clear {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: none;
    padding: 0;
    font-size: 0.85rem;
    box-shadow: none;
}
.btn-input-clear:hover { color: var(--danger); background: none; }

.list-placeholder {
    padding: 0.8rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
    background: transparent;
    border: none;
    box-shadow: none;
}

input.color-swatch-input {
    flex: 0 0 36px;
    min-width: 36px;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
}

.color-field {
    flex: 0 0 44px;
    min-width: 44px;
    align-items: center;
}

.color-field label {
    align-self: stretch;
    text-align: center;
}

.cb-inline {
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    color: var(--text-secondary);
}
.cb-inline-col { display: flex; flex-direction: column; gap: var(--space-1); }

.dias-grid-5 {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
    margin-top: var(--space-2);
}

.field-sublabel {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.2rem;
}
#mat-aula-label { display: none; }

.checkbox-panel {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 0.4rem;
}
.max-h-120 { max-height: 120px; margin-top: 0.2rem; }
.max-h-140 { max-height: 140px; margin-top: 0.2rem; }
.max-h-220 { max-height: 220px; }

/* Header del acordeón de Restricciones */
.accordion-header.acc-header-warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
}
.accordion-header.acc-header-warning:hover {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    filter: brightness(1.06);
}
body.dark-mode .accordion-header.acc-header-warning,
body.dark-mode .accordion-header.acc-header-warning:hover {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
}

/* Tab Opcionales */
.opt-label {
    font-weight: 500;
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
    cursor: pointer;
    text-align: left;
}
.opt-label > input[type="checkbox"] { margin-top: 0.2rem; }
.opt-title { font-weight: 600; color: var(--text-primary); font-size: 0.85rem; }
.opt-desc {
    font-size: 0.72rem;
    color: var(--text-secondary);
    margin-top: 0.1rem;
    line-height: 1.3;
}

.settings-desc {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.4;
    margin-bottom: var(--space-2);
}

.readiness-card {
    border-color: rgba(79, 70, 229, 0.25);
    background: linear-gradient(145deg, #ffffff 0%, #f7f7ff 100%);
}

.readiness-heading-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
}

.readiness-eyebrow {
    display: block;
    margin-bottom: 0.25rem;
    color: var(--primary);
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.readiness-heading-row .settings-title { margin-bottom: 0; }

.readiness-count {
    flex: 0 0 auto;
    min-width: 52px;
    padding: 0.35rem 0.65rem;
    border-radius: 999px;
    color: var(--primary);
    background: rgba(79, 70, 229, 0.1);
    font-size: 0.85rem;
    text-align: center;
}

.readiness-progress {
    height: 8px;
    margin: 1rem 0 0.85rem;
    overflow: hidden;
    border-radius: 999px;
    background: var(--bg-tertiary);
}

.readiness-progress-fill {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--primary), #8b5cf6);
    transition: width var(--transition-base);
}

.readiness-steps {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.45rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.readiness-step { min-width: 0; }

.readiness-step-button {
    width: 100%;
    min-height: 42px;
    justify-content: flex-start;
    padding: 0.55rem 0.65rem;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.78rem;
    text-align: left;
}

.readiness-step-button:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.readiness-step.is-complete .readiness-step-button {
    border-color: rgba(16, 185, 129, 0.35);
    background: rgba(16, 185, 129, 0.08);
}

.readiness-step-icon {
    display: inline-flex;
    flex: 0 0 24px;
    width: 24px;
    height: 24px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
}

.readiness-step.is-complete .readiness-step-icon {
    color: #047857;
    background: rgba(16, 185, 129, 0.16);
}

.readiness-step-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.05rem;
}

.readiness-step-copy strong,
.readiness-step-copy small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.readiness-step-copy small {
    color: var(--text-secondary);
    font-size: 0.68rem;
    font-weight: 500;
}

.readiness-message {
    margin: 0.8rem 0;
    color: var(--text-secondary);
    font-size: 0.82rem;
    line-height: 1.45;
}

.generation-actions { margin-bottom: var(--space-2); }

.generator-advanced {
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--bg-secondary);
    overflow: hidden;
}

.generator-advanced > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: 1rem 1.1rem;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 700;
    list-style: none;
}

.generator-advanced > summary::-webkit-details-marker { display: none; }

.generator-advanced > summary::after {
    content: "\f078";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    color: var(--text-secondary);
    transition: transform var(--transition-fast);
}

.generator-advanced[open] > summary::after { transform: rotate(180deg); }

.generator-advanced > summary span {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.generator-advanced > summary small {
    margin-left: auto;
    color: var(--text-secondary);
    font-size: 0.7rem;
    font-weight: 500;
}

.generator-advanced-content { padding: 0 0.75rem 0.75rem; }
.generator-advanced-content .settings-card:last-child { margin-bottom: 0; }

.settings-title-actions {
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.settings-title-actions .btn-small {
    padding: 0.3rem 0.6rem;
    font-size: 0.75rem;
}

.generator-jornadas { gap: 0.5rem; }

.btn-icon-square { padding: 0.6rem 0.85rem; }

/* Footer de la sidebar */
.sidebar-footer {
    padding: 1.2rem 1.5rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    margin-top: auto;
}
.sidebar-footer-primary {
    display: flex;
    gap: var(--space-2);
}

.sidebar-footer-primary > * {
    flex: 1 1 0;
    min-width: 0;
}

.btn-footer { width: 100%; flex: 1; font-size: 0.8rem; padding: 0.5rem; }
.btn-footer-block {
    width: 100%;
    font-size: 0.8rem;
    padding: 0.5rem;
    text-align: center;
    cursor: pointer;
}

.footer-backup-menu { position: relative; }
.footer-backup-toggle { display: inline-flex; }
.footer-backup-menu-panel {
    display: none;
    position: absolute;
    right: 0;
    bottom: calc(100% + 8px);
    z-index: 1000;
    min-width: 230px;
    padding: 0.5rem;
    flex-direction: column;
    gap: var(--space-2);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--card-bg);
    box-shadow: var(--shadow-lg);
}
.footer-backup-menu-panel.show { display: flex; }
.footer-reset-action {
    flex: 0 0 100%;
    padding: 0.5rem;
    font-size: 0.8rem;
}

/* Generador */
#btn-detener { flex: 0 0 auto; display: none; padding: 0 1.2rem; }
#btn-limpiar-horario {
    width: 100%;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    background: white;
    font-size: 0.9rem;
}
body.dark-mode #btn-limpiar-horario {
    background: #1f2937;
    color: var(--text-secondary);
}

.empty-state > i {
    font-size: 3rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    display: inline-block;
    animation: empty-icon-float 3.5s ease-in-out infinite;
}

@keyframes empty-icon-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

.dropdown-chevron { font-size: 0.72rem; margin-left: 2px; }

/* ============================================
   Accesibilidad: anillo de foco por teclado
   ============================================ */
button:focus-visible,
input:focus-visible,
select:focus-visible,
label:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Reusable accessibility primitives for dynamic controls and file inputs. */
.sg-visually-hidden,
.visually-hidden,
.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    clip-path: inset(50%) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.sg-action-surface {
    appearance: none;
    -webkit-appearance: none;
    font: inherit;
    color: inherit;
    text-align: inherit;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.sg-touch-target {
    min-width: 44px;
    min-height: 44px;
    touch-action: manipulation;
}

.sg-visually-hidden:focus-visible + .sg-file-trigger,
.sg-file-trigger:focus-visible,
.sg-action-surface:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 3px;
}

button.unscheduled-item,
.unscheduled-item.sg-action-surface,
.unscheduled-item[role="button"] {
    width: 100%;
    font: inherit;
    color: inherit;
    text-align: left;
    touch-action: manipulation;
}

.unscheduled-item[role="button"]:focus-visible,
button.unscheduled-item:focus-visible {
    outline: 3px solid rgba(79, 70, 229, 0.35);
    outline-offset: 2px;
    border-color: var(--primary);
}

body.sg-tutorial-open,
body.sg-tour-active {
    overflow: hidden;
}

/* Respetar la preferencia de movimiento reducido del sistema */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ========================================================================== 
   TUTORIAL MODAL & INTERACTIVE TOUR STYLES
   ========================================================================== */

.sg-tutorial-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(9, 13, 22, 0.45);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10010;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.sg-tutorial-overlay[hidden],
#tour-tooltip[hidden],
#tour-highlight-box[hidden],
.sg-tab-pane[hidden],
.tutorial-faq-answer[hidden] {
    display: none !important;
}

.sg-tutorial-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.sg-modal-container {
    width: 90%;
    max-width: 850px;
    height: min(580px, calc(100dvh - 2rem));
    max-height: calc(100dvh - 2rem);
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: var(--shadow-lg), 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    display: flex;
    overflow: hidden;
    transform: scale(0.95);
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
}

.sg-tutorial-overlay.active .sg-modal-container {
    transform: scale(1);
    opacity: 1;
}

.sg-modal-sidebar {
    width: 220px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex-shrink: 0;
}

.sg-modal-sidebar-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 1.5rem;
    padding-left: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sg-modal-tab-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: var(--transition-fast);
}

.sg-modal-tab-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.sg-modal-tab-btn.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.sg-modal-container .sg-modal-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.sg-modal-container .sg-modal-header {
    display: flex;
    justify-content: flex-end;
    padding: 1rem 1.5rem;
}

.sg-modal-close-btn {
    font-size: 1.25rem;
    color: var(--text-secondary);
    background: none;
    border: none;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.sg-modal-close-btn:hover {
    background: var(--bg-tertiary);
    color: var(--danger);
    transform: rotate(90deg);
}

.sg-modal-content-area {
    flex: 1;
    padding: 0 2.5rem 2.5rem 2.5rem;
    overflow-y: auto;
}

.sg-tab-pane {
    display: none;
    animation: sg-fade-in 0.25s ease forwards;
}

.sg-tab-pane.active {
    display: block;
}

/* Tutorial Content Typography */
.tutorial-title {
    font-size: 1.6rem;
    font-weight: 750;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    letter-spacing: -0.5px;
}

.tutorial-subtitle {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 1.75rem;
    line-height: 1.5;
}

.tutorial-section-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.25rem;
}

.tutorial-p {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.55;
    margin-bottom: 1rem;
}

.tutorial-grid-steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin: 1.5rem 0;
}

.tutorial-step-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    transition: var(--transition-fast);
}

.tutorial-step-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.tutorial-step-num {
    width: 28px;
    height: 28px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
}

.tutorial-step-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 0.25rem;
}

.tutorial-step-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.45;
}

.tutorial-btn-start-tour {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0.75rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 1rem;
    transition: var(--transition-fast);
}

.tutorial-btn-start-tour:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

/* FAQ Styles */
.tutorial-faq-item {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 0.75rem;
    overflow: hidden;
}

.tutorial-faq-question {
    background: var(--bg-secondary);
    padding: 0.85rem 1.25rem;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    width: 100%;
    border: 0;
    text-align: left;
    font-family: inherit;
    min-height: 44px;
}

.tutorial-faq-question:hover {
    background: var(--bg-tertiary);
}

.tutorial-faq-question:focus-visible {
    outline: 3px solid rgba(79, 70, 229, 0.35);
    outline-offset: -3px;
}

.tutorial-faq-answer {
    padding: 1rem 1.25rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
    background: var(--card-bg);
    border-top: 1px solid var(--border-color);
    display: none;
}

.tutorial-faq-item.expanded .tutorial-faq-answer {
    display: block;
    animation: sg-fade-in 0.2s ease forwards;
}

.tutorial-faq-icon {
    transition: transform 0.2s ease;
}

.tutorial-faq-item.expanded .tutorial-faq-icon {
    transform: rotate(180deg);
}

/* Concept Cards */
.concept-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 1rem;
}

.concept-card {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1.25rem;
    background: var(--bg-secondary);
    transition: border-color var(--transition-fast);
}

.concept-card:hover {
    border-color: var(--primary);
}

.concept-card-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.concept-card-title i {
    color: var(--primary);
}

.concept-card-desc {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Tour styles */
#tour-blocker {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9997;
    pointer-events: auto;
    background: transparent;
}

#tour-highlight-box {
    position: absolute;
    z-index: 9998;
    box-shadow: 0 0 0 9999px rgba(9, 13, 22, 0.65);
    border: 2.5px solid var(--primary);
    border-radius: 8px;
    pointer-events: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

#tour-tooltip {
    position: absolute;
    z-index: 9999;
    width: 340px;
    max-width: calc(100vw - 20px);
    max-height: calc(100dvh - 20px);
    overflow: hidden;
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    padding: 1.25rem;
    box-shadow: var(--shadow-lg), 0 20px 40px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    opacity: 0;
    transform: translateY(10px);
    pointer-events: auto;
    transition: opacity 0.25s ease, transform 0.25s ease, top 0.25s cubic-bezier(0.4, 0, 0.2, 1), left 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

#tour-tooltip.active {
    opacity: 1;
    transform: translateY(0);
}

.tour-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.tour-title {
    font-size: 1rem;
    font-weight: 750;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0;
}

.tour-step-indicator {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.tour-content {
    font-size: 0.84rem;
    color: var(--text-secondary);
    line-height: 1.5;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.tour-content b {
    color: var(--text-primary);
}

.tour-progress-bar-bg {
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    overflow: hidden;
    margin: 0.25rem 0;
    flex-shrink: 0;
}

.tour-progress-bar-fill {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 0.25s ease;
}

.tour-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.4rem;
    flex-shrink: 0;
}

.tour-btn-skip {
    font-size: 0.78rem;
    color: var(--text-secondary);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-weight: 600;
    transition: var(--transition-fast);
}

.tour-btn-skip:hover {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.08);
}

.tour-buttons-right {
    display: flex;
    gap: 0.4rem;
}

.tour-btn {
    padding: 0.45rem 0.9rem;
    font-size: 0.78rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    border: none;
    transition: var(--transition-fast);
}

.tour-btn-back {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.tour-btn-back:hover:not(:disabled) {
    background: var(--border-hover);
}

.tour-btn-back:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.tour-btn-next {
    background: var(--primary);
    color: white;
}

.tour-btn-next:hover {
    background: var(--primary-hover);
    box-shadow: 0 2px 6px rgba(79, 70, 229, 0.2);
}

/* Tour Arrow tooltip connector */
.tour-arrow {
    position: absolute;
    width: 0;
    height: 0;
    border-style: solid;
    pointer-events: none;
}

.tour-arrow-top {
    border-width: 8px 8px 0 8px;
    border-color: var(--card-bg) transparent transparent transparent;
    bottom: -8px;
}

.tour-arrow-bottom {
    border-width: 0 8px 8px 8px;
    border-color: transparent transparent var(--card-bg) transparent;
    top: -8px;
}

.tour-arrow-left {
    border-width: 8px 0 8px 8px;
    border-color: transparent transparent transparent var(--card-bg);
    right: -8px;
}

.tour-arrow-right {
    border-width: 8px 8px 8px 0;
    border-color: transparent var(--card-bg) transparent transparent;
    left: -8px;
}

@keyframes sg-fade-in {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

.mobile-sidebar-toggle,
.mobile-sidebar-backdrop {
    display: none;
}

.mobile-sidebar-toggle[aria-expanded="true"] {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

@media (max-width: 768px) {
    body {
        overflow: auto;
    }
    body.mobile-sidebar-active {
        overflow: hidden;
        overscroll-behavior: none;
    }
    .app-container {
        width: 100%;
        min-height: 100dvh;
        height: auto;
    }
    .app-container.sidebar-full .sidebar {
        width: min(90vw, 400px);
        background: var(--card-bg);
    }
    .app-container.sidebar-full .main-content {
        display: block;
    }
    .sidebar,
    .app-container.sidebar-hidden .sidebar {
        display: flex;
        position: fixed;
        inset: 0 auto 0 0;
        width: min(90vw, 400px);
        max-width: 400px;
        transform: translateX(-105%);
        transition: transform 0.25s ease;
        z-index: 902;
        box-shadow: 12px 0 32px rgba(15, 23, 42, 0.22);
        overscroll-behavior: contain;
    }
    .app-container.mobile-sidebar-open .sidebar {
        transform: translateX(0);
    }
    .mobile-sidebar-toggle {
        display: inline-flex;
        position: fixed;
        top: max(0.75rem, env(safe-area-inset-top));
        left: max(0.75rem, env(safe-area-inset-left));
        z-index: 904;
        width: 44px;
        height: 44px;
        align-items: center;
        justify-content: center;
        border: 1px solid var(--border-color);
        border-radius: 12px;
        background: var(--card-bg);
        color: var(--text-primary);
        box-shadow: var(--shadow-md);
    }
    .mobile-sidebar-toggle[aria-expanded="true"] {
        left: auto;
        right: max(0.75rem, env(safe-area-inset-right));
    }
    .mobile-sidebar-backdrop:not([hidden]) {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 901;
        background: rgba(15, 23, 42, 0.48);
        backdrop-filter: blur(2px);
    }
    .main-content {
        width: 100%;
        min-width: 0;
        min-height: 100dvh;
        padding: 4.75rem 0.75rem 0.75rem;
    }
    .export-area {
        flex: none;
        overflow: visible;
        padding: 1rem;
    }
    .main-content .schedule-layout-container {
        flex: none;
        min-height: auto;
    }
    .main-header {
        margin-bottom: 0.75rem;
    }
    .header-top-row,
    .header-controls {
        align-items: flex-start;
        flex-direction: column;
    }
    .header-actions,
    .header-exports {
        width: 100%;
        justify-content: flex-start;
    }
    .header-top-tools {
        width: 100%;
        flex-wrap: wrap;
        justify-content: space-between;
    }
    .header-top-tools .filter-select {
        flex: 1 1 100%;
    }
    .main-utility-actions {
        margin-left: auto;
    }
    .header-actions {
        align-items: stretch;
    }
    .header-actions > button,
    .header-exports .dropdown-export,
    .header-exports .dropdown-export > button {
        flex: 1 1 auto;
    }
    .header-exports .dropdown-export,
    .header-exports .dropdown-export > button {
        width: 100%;
    }
    .more-actions-toggle {
        display: inline-flex;
        width: 100%;
    }
    .mobile-more-actions {
        flex: 1 1 100%;
    }
    .more-actions-menu {
        display: none;
        position: absolute;
        right: 0;
        top: calc(100% + 8px);
        z-index: 1000;
        width: min(300px, calc(100vw - 2rem));
        padding: 0.5rem;
        align-items: stretch;
        flex-wrap: wrap;
        border: 1px solid var(--border-color);
        border-radius: var(--radius-lg);
        background: var(--card-bg);
        box-shadow: var(--shadow-lg);
    }
    .more-actions-menu.show { display: flex; }
    .more-actions-menu > .btn-icon-square {
        flex: 1 1 42px;
    }
    .online-actions-dropdown {
        flex: 1 1 100%;
        width: 100%;
    }
    .online-actions-dropdown > button { width: 100%; }
    .filter-select {
        width: 100%;
        min-width: 0;
    }
    .schedule-container {
        flex: none;
        height: min(70dvh, 720px);
        min-height: 60vh;
        overscroll-behavior: contain;
    }
    .main-content .unscheduled-panel {
        width: 100%;
        min-width: 0;
        max-height: none;
    }
    .main-content .unscheduled-list-container {
        max-height: 360px;
    }
    .schedule-wrapper {
        min-width: 800px;
    }
    .empty-state {
        position: relative;
        top: auto;
        left: auto;
        width: 100%;
        max-width: none;
        margin-top: 0.75rem;
        padding: 1.25rem;
        transform: none;
        animation-name: sg-fade-in;
    }
    .empty-state-actions {
        align-items: stretch;
        flex-direction: column;
    }
    .readiness-steps { grid-template-columns: 1fr; }
    .sidebar-footer {
        padding: 0.75rem 1rem max(0.75rem, env(safe-area-inset-bottom));
    }
    .sidebar-footer-primary {
        align-items: stretch;
    }
    .sidebar-footer-primary .btn-footer {
        min-height: 44px;
    }
    .sg-modal-container {
        flex-direction: column;
        width: calc(100% - 1rem);
        height: min(92dvh, 720px);
        max-height: calc(100dvh - 1rem);
        border-radius: 14px;
    }
    .sg-modal-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        flex-direction: row;
        overflow-x: auto;
        padding: 0.75rem 1rem;
        overscroll-behavior-x: contain;
        scrollbar-width: thin;
    }
    .sg-modal-sidebar-title {
        display: none;
    }
    .sg-modal-tab-btn {
        min-height: 44px;
        padding: 0.5rem 0.8rem;
        font-size: 0.8rem;
        white-space: nowrap;
    }
    .sg-modal-content-area {
        padding: 1rem 1.25rem max(1.25rem, env(safe-area-inset-bottom));
        overscroll-behavior: contain;
    }
    #tour-tooltip {
        width: min(380px, calc(100vw - 20px));
        max-height: calc(100dvh - 20px);
    }
    .concept-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 520px) {
    .form-inline-row {
        align-items: stretch;
        flex-wrap: wrap;
    }
    .form-inline-row > .input-with-label:not(.color-field) {
        flex: 1 1 150px;
    }
    .form-fields-row > .input-with-label {
        flex-basis: 100%;
    }
    .generator-advanced > summary small { display: none; }
    .header-text h1 { font-size: 1.55rem; }
    .main-utility-actions .btn-text-label { display: none; }
}

@media (max-width: 420px) {
    .tour-footer {
        align-items: stretch;
        flex-direction: column;
        gap: 0.5rem;
    }
    .tour-buttons-right {
        width: 100%;
    }
    .tour-btn {
        flex: 1;
    }
    .tour-btn-skip {
        align-self: flex-start;
    }
}

@media (pointer: coarse) {
    .unscheduled-item {
        min-height: 44px;
        cursor: pointer;
    }
}

/* Custom CSS variables for unavailable slots */
:root {
    --bg-unavailable-1: rgba(241, 245, 249, 0.45);
    --bg-unavailable-2: rgba(226, 232, 240, 0.45);
    --border-unavailable: rgba(203, 213, 225, 0.7);
    --text-unavailable: #64748b;
    --label-unavailable-bg: rgba(255, 255, 255, 0.9);
}

body.dark-mode {
    --bg-unavailable-1: rgba(30, 41, 59, 0.45);
    --bg-unavailable-2: rgba(15, 23, 42, 0.45);
    --border-unavailable: rgba(51, 65, 85, 0.7);
    --text-unavailable: #94a3b8;
    --label-unavailable-bg: rgba(30, 41, 59, 0.9);
}

.grid-unavailable-slot {
    position: absolute;
    left: 0;
    right: 0;
    pointer-events: none;
    z-index: 1; /* Below cards (z-index 2+) but above lines */
    background-color: var(--bg-unavailable-1);
    background-image: linear-gradient(45deg, var(--bg-unavailable-2) 25%, transparent 25%, transparent 50%, var(--bg-unavailable-2) 50%, var(--bg-unavailable-2) 75%, transparent 75%, transparent 100%);
    background-size: 28px 28px;
    background-repeat: repeat;
    display: flex;
    align-items: center;
    justify-content: center;
    border-top: 1px dashed var(--border-unavailable);
    border-bottom: 1px dashed var(--border-unavailable);
}

.grid-unavailable-slot::after {
    content: 'No disponible';
    font-size: 0.7rem;
    color: var(--text-unavailable);
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    background: var(--label-unavailable-bg);
    padding: 2px 8px;
    border-radius: 4px;
    box-shadow: var(--shadow-sm);
    opacity: 0.85;
}

/* ------------ UNSCHEDULED SUBJECTS PANEL ------------ */
.schedule-layout-container {
    display: flex;
    flex-direction: row;
    gap: 1.25rem;
    flex: 1;
    min-height: 0;
    width: 100%;
}

.schedule-layout-container[hidden] {
    display: none !important;
}

.unscheduled-panel {
    width: 300px;
    min-width: 300px;
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: sg-fade-in 0.4s ease both;
}

.unscheduled-panel.drag-over {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.15);
    background: rgba(79, 70, 229, 0.05);
}

.unscheduled-header {
    padding: 1.25rem;
    border-bottom: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.unscheduled-header-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.unscheduled-header-title i {
    color: var(--primary);
    font-size: 1.1rem;
}

.unscheduled-header-title h3 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    flex: 1;
}

.unscheduled-badge {
    background: var(--primary);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    min-width: 20px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(79, 70, 229, 0.2);
}

.unscheduled-list-container {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.unscheduled-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.unscheduled-item {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.75rem 0.9rem;
    cursor: grab;
    user-select: none;
    transition: all 0.2s ease;
    position: relative;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.unscheduled-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
}

.unscheduled-item:active {
    cursor: grabbing;
}

.unscheduled-item.dragging {
    opacity: 0.4;
    border: 1.5px dashed var(--primary);
}

.unscheduled-item-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.35;
}

.unscheduled-item-meta {
    font-size: 0.72rem;
    color: var(--text-secondary);
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.unscheduled-item-meta-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.unscheduled-reason {
    flex-basis: 100%;
    color: #b45309;
    line-height: 1.35;
}

.unscheduled-item-career {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--primary);
    display: block;
    margin-top: 0.1rem;
}

/* Dark mode overrides */
body.dark-mode .unscheduled-panel {
    background: rgba(17, 24, 39, 0.85);
    border-color: rgba(255, 255, 255, 0.08);
}

body.dark-mode .unscheduled-header {
    border-bottom-color: rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.15);
}

body.dark-mode .unscheduled-item {
    background: #1f2937;
    border-color: rgba(255, 255, 255, 0.05);
}

body.dark-mode .unscheduled-item:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

body.dark-mode .unscheduled-item-title {
    color: #f3f4f6;
}

body.dark-mode .unscheduled-item-meta {
    color: #9ca3af;
}

@media (max-width: 1200px) {
    .schedule-layout-container {
        flex-direction: column;
        align-items: stretch;
    }
    .schedule-layout-container .schedule-container {
        min-height: 520px;
    }
    .unscheduled-panel {
        width: 100%;
        min-width: 100%;
        max-height: 350px;
    }
}

/* En tablet y escritorio estrecho el contenido debe poder reducirse y
   desplazarse: el horario y Pendientes no caben juntos en la altura fija. */
@media (min-width: 769px) and (max-width: 1200px) {
    .main-content {
        overflow-y: auto;
        overscroll-behavior-y: contain;
    }

    .export-area {
        flex: 0 0 auto;
        overflow: visible;
    }

    .main-content .schedule-layout-container {
        flex: 0 0 auto;
    }

    .header-top-row {
        flex-wrap: wrap;
    }

    .filter-select {
        flex: 1 1 220px;
        min-width: 0;
        max-width: 100%;
    }

    .schedule-layout-container .schedule-container {
        flex: 0 0 min(70vh, 720px);
        height: min(70vh, 720px);
    }

    .main-content .unscheduled-panel {
        flex: 0 0 min(35vh, 350px);
        min-height: 220px;
    }
}


