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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f0f4f8;
    color: #1e293b;
}

.app { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
    width: 260px;
    background: #1e2a3a;
    color: #fff;
    padding: 24px 16px;
    flex-shrink: 0;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 24px;
    padding: 0 8px;
}

.sidebar-brand i { color: #3b82f6; font-size: 1.5rem; }

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #2a3a4e;
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 24px;
}

.avatar {
    width: 40px; height: 40px;
    background: #3b82f6;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700;
}

.user-name { font-weight: 600; font-size: 0.9rem; }
.user-role { font-size: 0.75rem; color: #94a3b8; }

.sidebar-nav { display: flex; flex-direction: column; gap: 4px; }

.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px;
    border-radius: 10px;
    color: #cbd5e1;
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.nav-item:hover { background: #2a3a4e; color: #fff; }
.nav-item.active { background: #3b82f6; color: #fff; font-weight: 600; }
.nav-item i { width: 20px; text-align: center; }

/* Main */
.main-content {
    margin-left: 260px;
    flex: 1;
    padding: 32px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 28px;
}

.page-header h1 { font-size: 1.75rem; font-weight: 700; }
.subtitle { color: #64748b; margin-top: 4px; font-size: 0.9rem; }

.header-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 10px 18px;
    border-radius: 10px;
    border: none;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
}

.btn-primary { background: #3b82f6; color: #fff; }
.btn-primary:hover { background: #2563eb; }
.btn-secondary { background: #fff; color: #475569; border: 1px solid #e2e8f0; }
.btn-secondary:hover { background: #f8fafc; }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-icon { background: none; border: none; color: #64748b; cursor: pointer; padding: 6px; border-radius: 6px; text-decoration: none; }
.btn-icon:hover { background: #f1f5f9; color: #3b82f6; }
.btn-icon.danger:hover { color: #ef4444; }

/* Cards */
.card {
    background: #fff;
    border-radius: 14px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.card h2 { font-size: 1.1rem; margin-bottom: 16px; }
.card-header { display: flex; justify-content: space-between; align-items: center; }
.card-actions { display: flex; gap: 4px; }

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

.stat-card {
    background: #fff;
    border-radius: 14px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.stat-label { font-size: 0.8rem; color: #64748b; margin-bottom: 8px; }
.stat-value { font-size: 2rem; font-weight: 700; color: #1e293b; }

/* Forms */
.form { max-width: 700px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 0.875rem; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 0.9rem;
}
.form-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.form-row select, .form-row input { flex: 1; min-width: 120px; padding: 8px 12px; border: 1px solid #e2e8f0; border-radius: 8px; }
.form-actions { display: flex; gap: 10px; margin-top: 20px; }
.inline-form .form-row { margin-top: 12px; }

.availability-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.availability-row select, .availability-row input { padding: 8px; border: 1px solid #e2e8f0; border-radius: 8px; }

.checkbox-group { display: flex; flex-wrap: wrap; gap: 12px; }
.checkbox-label { display: flex; align-items: center; gap: 6px; font-size: 0.9rem; cursor: pointer; }

/* Tables */
.data-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.data-table th, .data-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #f1f5f9; }
.data-table th { font-weight: 600; color: #64748b; font-size: 0.8rem; }

/* Schedule table */
.schedule-wrapper { overflow-x: auto; }
.schedule-title { text-align: center; margin-bottom: 16px; font-size: 1.2rem; }

.schedule-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
    background: #fff;
}

.schedule-table th, .schedule-table td {
    border: 1px solid #cbd5e1;
    padding: 8px 10px;
    vertical-align: top;
}

.schedule-table th { background: #f1f5f9; font-weight: 700; text-align: center; }
.day-cell { text-align: center; font-weight: 700; width: 48px; vertical-align: middle !important; }
.day-cell .day-num { display: block; font-size: 1rem; line-height: 1.2; }
.day-cell .day-name { display: block; font-size: 0.7rem; color: #64748b; font-weight: 600; }
.day-block { border-top: 3px solid #475569; }
.day-block:first-of-type { border-top: none; }
.day-block .day-cell { background: #f1f5f9; border-left: 4px solid #3b82f6; }
.day-block[data-day="2"] .day-cell { border-left-color: #8b5cf6; }
.day-block[data-day="3"] .day-cell { border-left-color: #06b6d4; }
.day-block[data-day="4"] .day-cell { border-left-color: #10b981; }
.day-block[data-day="5"] .day-cell { border-left-color: #f59e0b; }
.day-block[data-day="6"] .day-cell { border-left-color: #ef4444; }
.day-block .day-end td { border-bottom: 2px solid #94a3b8; }
.lesson-cell.merged,
.lesson-cell.is-merged { border-left-width: 3px; border-left-style: solid; }
.lesson-cell.is-merged .lesson-item { font-weight: 500; }
.merged-badge { font-weight: 700; margin-right: 2px; opacity: 0.85; }

.merge-legend { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0; }
.legend-title { font-size: 0.85rem; color: #64748b; font-weight: 600; }
.legend-item { font-size: 0.75rem; padding: 4px 10px; border-radius: 6px; }

.keep-existing-label { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; cursor: pointer; }

.free-slots-panel { margin: 16px 0; padding: 16px 18px; }
.free-slots-panel summary { font-weight: 600; cursor: pointer; color: #1e293b; list-style: none; }
.free-slots-panel summary::-webkit-details-marker { display: none; }
.free-slots-panel summary::before { content: '▸ '; color: #64748b; }
.free-slots-panel[open] summary::before { content: '▾ '; }
.free-slots-intro { margin: 10px 0 14px; font-size: 0.85rem; }
.free-slots-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
}
.free-teacher-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px 14px;
}
.free-teacher-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e2e8f0;
}
.free-teacher-card h4 { margin: 0; font-size: 0.95rem; color: #0f172a; }

.schedule-viewer { position: fixed; inset: 0; z-index: 2000; display: flex; align-items: center; justify-content: center; }
.schedule-viewer[hidden] { display: none !important; }
.schedule-viewer-backdrop { position: absolute; inset: 0; background: rgba(15,23,42,0.6); }
.schedule-viewer-box { position: relative; z-index: 1; width: min(96vw, 1200px); max-height: 92vh; background: #fff; border-radius: 14px; box-shadow: 0 20px 50px rgba(0,0,0,0.25); display: flex; flex-direction: column; overflow: hidden; }
.schedule-viewer-header { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid #e2e8f0; background: #f8fafc; }
#viewer-label { flex: 1; text-align: center; font-weight: 600; }
.schedule-viewer-body { overflow: auto; padding: 16px; }
.schedule-viewer-body .schedule-page { margin: 0; box-shadow: none; max-width: none; }
.schedule-page-item.viewer-hidden { display: none; }
.lesson-item { margin-bottom: 4px; cursor: grab; padding: 2px 0; user-select: none; }
.lesson-item.is-dragging { opacity: 0.45; }
.lesson-cell.drag-over { background: #dbeafe !important; outline: 2px dashed #3b82f6; outline-offset: -2px; }
.lesson-cell.drag-source { opacity: 0.6; }
.lesson-item .lesson-time { display: block; font-size: 0.75rem; color: #64748b; margin-top: 1px; }
.lesson-item:active { cursor: grabbing; }
.time-cell { font-size: 0.75rem; white-space: nowrap; }

/* Badges */
.badge {
    display: inline-block;
    background: #eff6ff;
    color: #3b82f6;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    margin: 2px;
}

.availability-list { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }

.teacher-meta { margin-top: 10px; }
.meta-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #94a3b8;
    margin-bottom: 4px;
}

.teacher-slots {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid #e2e8f0;
}
.teacher-slots-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}
.teacher-slots-head .meta-label { margin-bottom: 0; }

.slots-summary { display: flex; gap: 6px; flex-shrink: 0; }
.sum {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 999px;
    white-space: nowrap;
}
.sum.free { background: #ecfdf5; color: #047857; }
.sum.busy { background: #fef2f2; color: #b91c1c; }

.slots-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}
.slots-table th {
    width: 36px;
    text-align: left;
    vertical-align: top;
    padding: 4px 8px 4px 0;
    color: #64748b;
    font-weight: 700;
    white-space: nowrap;
}
.slots-table td {
    padding: 3px 0;
    vertical-align: middle;
}

.slot-chip {
    display: inline-block;
    min-width: 42px;
    text-align: center;
    padding: 3px 6px;
    margin: 1px 2px 1px 0;
    border-radius: 6px;
    font-size: 0.72rem;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    line-height: 1.3;
}
.slot-chip.is-free {
    background: #ecfdf5;
    color: #047857;
    box-shadow: inset 0 0 0 1px #a7f3d0;
}
.slot-chip.is-busy {
    background: #f8fafc;
    color: #94a3b8;
    text-decoration: line-through;
    box-shadow: inset 0 0 0 1px #e2e8f0;
}

/* Alerts */
.alert { padding: 14px 18px; border-radius: 10px; margin-bottom: 16px; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.alert ul { margin-top: 8px; padding-left: 20px; }

/* Misc */
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 20px; }
.text-muted { color: #94a3b8; font-size: 0.85rem; }
.empty-state { color: #94a3b8; padding: 40px; text-align: center; }
.steps-list { padding-left: 24px; line-height: 2; }
.steps-list a { color: #3b82f6; }

.teacher-card h3 { font-size: 1rem; }
.subject-tags { margin: 8px 0; }
.badge-subject { background: #f0fdf4; color: #16a34a; }

/* ——— Cədvəl quraşdırma UI ——— */
.schedule-page-header {
    margin-bottom: 20px;
    padding: 18px 20px;
    border-radius: 18px;
    background:
        radial-gradient(120% 140% at 0% 0%, rgba(59, 130, 246, 0.18), transparent 55%),
        linear-gradient(135deg, #1e2a3a 0%, #243447 55%, #1e3a5f 100%);
    color: #fff;
    box-shadow: 0 10px 28px rgba(30, 42, 58, 0.22);
}
.schedule-hero {
    display: flex;
    align-items: center;
    gap: 14px;
}
.schedule-hero-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.16);
    color: #93c5fd;
    font-size: 1.25rem;
    flex-shrink: 0;
}
.schedule-page-header h1 {
    margin: 0;
    font-size: 1.55rem;
    letter-spacing: -0.02em;
    color: #fff;
}
.schedule-page-header .subtitle {
    margin-top: 4px;
    color: #94a3b8;
}

.schedule-setup {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-bottom: 96px;
}

.setup-grid-top {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.setup-panel {
    position: relative;
    padding: 18px 18px 16px;
    margin: 0;
    overflow: hidden;
    border-radius: 16px;
    border: 1px solid transparent;
    background:
        linear-gradient(#fff, #fff) padding-box,
        linear-gradient(145deg, rgba(59, 130, 246, 0.35), rgba(148, 163, 184, 0.18)) border-box;
    background-origin: border-box;
    background-clip: padding-box, border-box;
    box-shadow:
        0 1px 2px rgba(15, 23, 42, 0.04),
        0 10px 28px rgba(15, 23, 42, 0.04);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.setup-panel::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(180deg, #3b82f6, #60a5fa 55%, #93c5fd);
    border-radius: 16px 0 0 16px;
}
.setup-panel:hover {
    box-shadow:
        0 2px 4px rgba(15, 23, 42, 0.05),
        0 14px 32px rgba(59, 130, 246, 0.08);
}

.setup-panel-head {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 14px;
}
.setup-panel-head h2 {
    margin: 0;
    font-size: 1.02rem;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.01em;
}
.setup-panel-head p {
    margin: 3px 0 0;
    font-size: 0.8rem;
    color: #94a3b8;
    line-height: 1.35;
}
.setup-panel-head em {
    font-style: normal;
    font-weight: 600;
    color: #94a3b8;
    font-size: 0.75rem;
    background: #f1f5f9;
    padding: 2px 7px;
    border-radius: 999px;
    margin-left: 4px;
    vertical-align: middle;
}
.setup-panel-head.collapsible {
    list-style: none;
    cursor: pointer;
    margin-bottom: 0;
    user-select: none;
    position: relative;
    padding-right: 28px;
}
.setup-panel-head.collapsible::-webkit-details-marker { display: none; }
.setup-panel-head.collapsible::after {
    content: '';
    position: absolute;
    right: 2px;
    top: 8px;
    width: 8px;
    height: 8px;
    border-right: 2px solid #94a3b8;
    border-bottom: 2px solid #94a3b8;
    transform: rotate(-45deg);
    transition: transform 0.2s ease, border-color 0.2s ease;
}
.setup-collapsible[open] > .setup-panel-head.collapsible::after {
    top: 10px;
    transform: rotate(45deg);
    border-color: #3b82f6;
}
.setup-collapsible[open] > .setup-panel-head { margin-bottom: 14px; }
.setup-panel-body { padding-top: 2px; }
.mt-2 { margin-top: 8px; }

.step-num {
    background: linear-gradient(145deg, #3b82f6, #2563eb);
    color: #fff;
    width: 30px;
    height: 30px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.28);
}
.step-num.soft {
    background: #e2e8f0;
    color: #475569;
    box-shadow: none;
}

.setup-textarea {
    width: 100%;
    padding: 11px 13px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    font-family: inherit;
    font-size: 0.9rem;
    line-height: 1.45;
    resize: vertical;
    background: #f8fafc;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.setup-textarea:hover { background: #fff; }
.setup-textarea:focus {
    outline: none;
    background: #fff;
    border-color: #93c5fd;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.14);
}

.setup-hint {
    font-size: 0.8rem;
    color: #94a3b8;
    margin: 8px 0 0;
}
.setup-hint a { color: #2563eb; text-decoration: none; font-weight: 600; }
.setup-hint a:hover { text-decoration: underline; }
.setup-empty {
    padding: 28px 20px;
    text-align: center;
    color: #64748b;
    background:
        linear-gradient(180deg, #f8fafc, #f1f5f9);
    border: 1px dashed #cbd5e1;
    border-radius: 14px;
    font-size: 0.9rem;
}

.setup-details {
    margin-top: 14px;
    border-top: 1px dashed #e2e8f0;
    padding-top: 10px;
}
.setup-details summary {
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    color: #475569;
    width: fit-content;
}
.setup-details summary:hover { color: #2563eb; }

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.btn-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    padding: 6px 10px;
    border: 1px dashed #bfdbfe;
    border-radius: 999px;
    background: #eff6ff;
    color: #2563eb;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn-link:hover {
    background: #dbeafe;
    border-color: #93c5fd;
    color: #1d4ed8;
    text-decoration: none;
}

.section-card { margin-bottom: 20px; }
.section-header { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.section-header h2 { margin: 0; font-size: 1.1rem; }

.group-req-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 16px;
}
.req-section .setup-panel-head { margin-bottom: 16px; }

.group-req-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 100%;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.group-req-card:hover {
    transform: translateY(-3px);
    border-color: #bfdbfe;
    box-shadow: 0 16px 36px rgba(37, 99, 235, 0.12);
}

.group-req-identity {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}
.group-req-avatar {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-weight: 800;
    font-size: 0.95rem;
    color: #1d4ed8;
    background: linear-gradient(145deg, #dbeafe, #eff6ff);
    border: 1px solid #bfdbfe;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}
.group-req-title {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}
.group-req-count {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    width: fit-content;
    font-size: 0.72rem;
    font-weight: 700;
    color: #1d4ed8;
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid #bfdbfe;
    padding: 2px 8px;
    border-radius: 999px;
}
.group-req-count i { font-size: 0.65rem; }
.group-req-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0;
    padding: 14px 14px 12px;
    background:
        radial-gradient(120% 160% at 0% 0%, rgba(59, 130, 246, 0.18), transparent 55%),
        linear-gradient(180deg, #eff6ff 0%, #f8fafc 100%);
    border-bottom: 1px solid #e2e8f0;
}
.group-req-head h3 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.group-req-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    background: linear-gradient(180deg, #fff, #fbfdff);
}
.group-req-card .btn-link {
    margin: 0;
    align-self: stretch;
    justify-content: center;
    border-style: dashed;
}
.group-req-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: flex-end;
}
.meta-field {
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-size: 0.65rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.meta-field span i { margin-right: 3px; color: #94a3b8; }
.meta-field select,
.meta-field input {
    font-weight: 500;
    text-transform: none;
    min-width: 92px;
    font-size: 0.8rem;
    padding: 7px 9px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.92);
}
.meta-field select:focus,
.meta-field input:focus {
    outline: none;
    border-color: #93c5fd;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.req-list-head {
    display: none;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1.4fr) 64px 64px 36px;
    gap: 8px;
    padding: 0 10px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #94a3b8;
}
.req-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.group-req-card .req-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 10px;
    border-radius: 14px;
    border: 1px solid #e2e8f0;
    background: #fff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.group-req-card .req-row:hover {
    border-color: #bfdbfe;
    background: #f8fbff;
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.08);
}
.req-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}
.req-field-label {
    font-size: 0.68rem;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.req-field select,
.req-field input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #f8fafc;
    font-size: 0.85rem;
    color: #0f172a;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.req-field select:hover,
.req-field input:hover { background: #fff; }
.req-field select:focus,
.req-field input:focus {
    outline: none;
    background: #fff;
    border-color: #93c5fd;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.14);
}
.req-row .remove-req-row {
    justify-self: end;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    color: #94a3b8;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}
.req-row .remove-req-row:hover {
    color: #ef4444;
    background: #fef2f2;
    border-color: #fecaca;
}
.dist-input { max-width: none !important; }

@media (min-width: 640px) {
    .req-list-head {
        display: grid;
    }
    .group-req-card .req-row {
        grid-template-columns: minmax(0, 1.4fr) minmax(0, 1.4fr) 64px 64px 36px;
        align-items: end;
        gap: 8px;
        padding: 10px;
    }
    .group-req-card .req-field-label { display: none; }
    .group-req-card .req-row .remove-req-row {
        justify-self: center;
        align-self: center;
    }
    .req-field-sm input {
        text-align: center;
        padding-left: 4px;
        padding-right: 4px;
    }
}

/* legacy table styles kept for other pages */
.group-subj-table.table,
table.group-subj-table { margin: 0; }
table.group-subj-table th {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #94a3b8;
    font-weight: 700;
    padding: 8px 6px 4px;
}
table.group-subj-table td { padding: 4px 6px 8px; }
table.group-subj-table select {
    max-width: none;
    min-width: 0;
    font-size: 0.8rem;
    padding: 6px 8px;
    border-radius: 8px;
    background: #fff;
}
table.group-subj-table .req-row:hover td { background: rgba(239, 246, 255, 0.55); }

.setup-optional-stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.setup-collapsible {
    background: #fff;
}
.setup-collapsible:not([open]) {
    background: linear-gradient(180deg, #fff, #f8fafc);
}

.course-hours-table { max-width: 420px; margin-top: 8px; }
.course-hours-table .day-off td { opacity: 0.55; }
.course-hours-table input[type="time"] { padding: 6px 8px; }
.optional { font-weight: 400; color: #94a3b8; font-size: 0.85rem; }
.full-width { width: 100%; padding: 12px; border: 1px solid #e2e8f0; border-radius: 10px; font-family: inherit; resize: vertical; }
.setup-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.setup-table th, .setup-table td { padding: 8px; border-bottom: 1px solid #f1f5f9; }
.setup-table select, .setup-table input {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.85rem;
    background: #fff;
}
.setup-table select:focus,
.setup-table input:focus {
    outline: none;
    border-color: #93c5fd;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}
.small-input { max-width: 80px; }
.merge-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 10px;
    margin-bottom: 10px;
    padding: 14px;
    background: linear-gradient(180deg, #f8fafc, #f1f5f9);
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}
.merge-field { flex: 1; min-width: 180px; }
.merge-field label { display: block; font-size: 0.8rem; color: #64748b; margin-bottom: 4px; font-weight: 600; }
.merge-multi-select {
    width: 100%;
    min-height: 72px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    padding: 6px;
    font-size: 0.85rem;
    background: #fff;
}

.setup-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 12px 16px;
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: 16px;
    box-shadow:
        0 8px 28px rgba(15, 23, 42, 0.12),
        0 0 0 1px rgba(255, 255, 255, 0.6) inset;
}
.sticky-actions {
    position: sticky;
    bottom: 14px;
    z-index: 30;
}
.setup-actions .btn-primary {
    padding: 11px 22px;
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.28);
}
.setup-actions .btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(37, 99, 235, 0.34);
}
.keep-existing-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: #64748b;
    cursor: pointer;
    margin: 0;
    padding: 8px 12px;
    border-radius: 999px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

.schedule-setup .name-tags { margin-top: 12px; gap: 8px; }
.schedule-setup .name-tag {
    background: linear-gradient(180deg, #eff6ff, #dbeafe);
    color: #1e40af;
    border: 1px solid #bfdbfe;
    border-radius: 999px;
    padding: 6px 11px;
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(37, 99, 235, 0.08);
}

.schedule-results {
    margin-top: 32px;
    padding-top: 18px;
    border-top: 1px solid #e2e8f0;
}
.results-header h2 { font-size: 1.15rem; }

@media (max-width: 900px) {
    .setup-grid-top { grid-template-columns: 1fr; }
    .group-req-cards { grid-template-columns: 1fr; }
    .sticky-actions { position: static; }
    .schedule-page-header { padding: 16px; }
}

.generate-card { text-align: center; padding: 32px; }
.btn-lg { padding: 14px 32px; font-size: 1rem; }
.actions-card { text-align: center; padding: 24px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.actions-card .btn-lg { margin-top: 4px; }
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; padding: 14px 18px; border-radius: 10px; margin-bottom: 16px; }
.schedule-page { margin-bottom: 32px; padding: 20px; background: #fff; border-radius: 14px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.page-label { font-size: 0.8rem; color: #64748b; margin-bottom: 8px; font-weight: 600; }
.results-header { display: flex; justify-content: space-between; align-items: center; margin: 24px 0 16px; }
.schedule-toolbar { margin-bottom: 10px; font-size: 0.85rem; }
.slot-aligned-table .col-day { width: 40px; }
.slot-aligned-table .col-times { width: 100px; white-space: nowrap; }
.slot-row.selected { background: #eff6ff; }
.editable-cell { cursor: pointer; min-height: 28px; position: relative; }
.editable-cell:hover { background: #f8fafc; }
.empty-cell-hint { color: #94a3b8; font-size: 1.1rem; }
.cell-delete {
    position: absolute; top: 2px; right: 4px;
    background: none; border: none; color: #ef4444; font-size: 1rem;
    cursor: pointer; line-height: 1; padding: 0 4px;
}
.cell-delete:hover { color: #dc2626; }
.lesson-item { position: relative; padding-right: 18px; }
.group-start-panel summary { cursor: pointer; font-weight: 600; color: #3b82f6; }
.compact-table .small-input { max-width: 72px; font-size: 0.8rem; }

.modal {
    position: fixed; inset: 0; z-index: 1000;
    background: rgba(15, 23, 42, 0.45);
    display: flex; align-items: center; justify-content: center;
}
.modal[hidden] { display: none !important; }
.modal-box { width: 100%; max-width: 400px; margin: 16px; }
.modal-box h3 { margin-top: 0; }
.form-actions { display: flex; gap: 10px; margin-top: 16px; }

.name-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.name-tag {
    display: inline-flex; align-items: center; gap: 6px;
    background: #eff6ff; color: #1e40af; padding: 6px 10px;
    border-radius: 20px; font-size: 0.85rem;
}
.tag-remove {
    background: none; border: none; color: #ef4444; font-size: 1.1rem;
    cursor: pointer; padding: 0 2px; line-height: 1;
}
.tag-remove:hover { color: #dc2626; }

.student-avail-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 10px;
}
.student-avail-card {
    padding: 10px 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
}
.student-avail-card strong {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
}
.student-avail-rows { display: flex; flex-direction: column; gap: 6px; }
.merge-subtitle {
    margin: 0 0 8px;
    font-size: 0.9rem;
    color: #475569;
}
.ind-editable-cell { vertical-align: top; min-width: 120px; }

/* Auth */
.auth-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(120% 120% at 10% 10%, rgba(59, 130, 246, 0.2), transparent 50%),
        linear-gradient(160deg, #0f172a, #1e2a3a 45%, #1e3a5f);
}
.auth-shell { width: 100%; max-width: 420px; padding: 20px; }
.auth-card {
    background: #fff;
    border-radius: 18px;
    padding: 28px 24px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.28);
}
.auth-brand { text-align: center; margin-bottom: 20px; }
.auth-brand i { font-size: 1.8rem; color: #3b82f6; }
.auth-brand h1 { margin: 8px 0 4px; font-size: 1.45rem; }
.auth-brand p { color: #64748b; font-size: 0.9rem; }
.auth-form .btn-block { width: 100%; justify-content: center; margin-top: 8px; }

.logout-form { margin: 0; }
.logout-btn {
    width: 100%;
    background: none;
    border: none;
    cursor: pointer;
    font: inherit;
    text-align: left;
}
.logout-btn:hover { background: #2a3a4e; color: #fff; }

.users-layout {
    display: grid;
    grid-template-columns: minmax(260px, 340px) 1fr;
    gap: 16px;
}
.user-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: flex-end;
}
.reset-pass summary { list-style: none; cursor: pointer; }
.reset-pass summary::-webkit-details-marker { display: none; }
.reset-pass-form {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    align-items: center;
}
.reset-pass-form input {
    padding: 6px 8px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.85rem;
}
@media (max-width: 900px) {
    .users-layout { grid-template-columns: 1fr; }
}
