:root {
    --bg-app: #f3f4f8;
    --bg-surface: #ffffff;
    --bg-muted: #eef2ff;
    --bg-soft: #f8fafc;
    --text-main: #0f172a;
    --text-soft: #475569;
    --text-muted: #64748b;
    --border: #d7deea;
    --border-soft: #e7ecf4;
    --primary: #253b90;
    --primary-dark: #1d2f75;
    --primary-soft: rgba(37, 59, 144, 0.12);
    --success: #15803d;
    --success-soft: #dcfce7;
    --danger: #dc2626;
    --danger-soft: #fee2e2;
    --warning: #d97706;
    --warning-soft: #fef3c7;
    --shadow-card: 0 12px 28px rgba(15, 23, 42, 0.08);
    --shadow-soft: 0 6px 18px rgba(15, 23, 42, 0.05);
    --radius-lg: 18px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --sidebar-expanded: 236px;
    --sidebar-collapsed: 70px;
    --sidebar-mobile-rail: 54px;
    --sidebar-overlay-width: min(86vw, 320px);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-app);
    color: var(--text-main);
    overflow-x: hidden;
}

body.sidebar-open {
    overflow: hidden;
}

a {
    color: inherit;
}

img {
    max-width: 100%;
    display: block;
}

button,
input,
select,
textarea {
    font: inherit;
}

/* App Shell */
.layout {
    min-height: 100vh;
    display: flex;
    background: linear-gradient(180deg, #f5f7fb 0%, #eef2f8 100%);
}

.sidebar {
    width: var(--sidebar-expanded);
    min-width: var(--sidebar-collapsed);
    max-width: 340px;
    position: relative;
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, #223b95 0%, #2e2e88 100%);
    color: #fff;
    transition: width 0.24s ease, transform 0.24s ease;
    overflow: hidden;
    z-index: 1100;
    box-shadow: 10px 0 30px rgba(15, 23, 42, 0.12);
}

.sidebar-brand {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    padding-right: 52px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    min-height: 62px;
}

.brand-mark {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.14);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.4px;
    flex: 0 0 auto;
}

.brand-copy {
    min-width: 0;
}

.brand-copy strong {
    display: block;
    font-size: 15px;
    line-height: 1.1;
}

.brand-copy span {
    display: block;
    margin-top: 3px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.74);
}

.sidebar-toggle {
    position: absolute;
    top: 14px;
    right: 12px;
    width: 28px;
    min-height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    user-select: none;
    z-index: 2;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 8px 10px;
}

.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 999px;
}

.sidebar a {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 6px;
    padding: 10px 12px;
    border-left: 4px solid transparent;
    border-radius: 12px;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.92);
    font-size: 14px;
    line-height: 1.25;
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.sidebar a:hover {
    background: rgba(255, 255, 255, 0.12);
    border-left-color: #8ab0ff;
    color: #fff;
}

.sidebar a.active {
    background: rgba(255, 255, 255, 0.16);
    border-left-color: #7fb0ff;
    color: #fff;
}

.nav-badge {
    width: 24px;
    height: 24px;
    border-radius: 7px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.4px;
    flex: 0 0 auto;
}

.nav-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar .logout {
    margin: 10px 10px 14px;
    padding: 11px 14px;
    border-radius: 10px;
    background: #f24848;
    color: #fff;
    flex-shrink: 0;
}

.sidebar .logout:hover {
    background: #de3030;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed) !important;
}

.sidebar.collapsed .sidebar-brand {
    display: none;
}

.sidebar.collapsed .nav-text,
.sidebar.collapsed .logout .nav-text {
    display: none;
}

.sidebar.collapsed .sidebar-toggle {
    position: static;
    margin: 12px auto 10px;
}

.sidebar.collapsed a,
.sidebar.collapsed .logout {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
}

.resizer {
    width: 5px;
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    cursor: ew-resize;
    background: rgba(255, 255, 255, 0.12);
}

.main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    padding: 12px 22px;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(12px);
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.05);
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.topbar-left { display: flex; align-items: center; gap: 10px; }
.topbar-title { font-size: 16px; font-weight: 700; color: var(--text-main); }

.topbar-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.topbar-chip {
    background: var(--bg-muted);
    border: 1px solid var(--border-soft);
    border-radius: 20px;
    padding: 3px 12px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-soft);
    white-space: nowrap;
}

.content {
    flex: 1;
    min-width: 0;
    padding: 24px;
    overflow-y: auto;
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.44);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 1050;
}

body.sidebar-open .sidebar-overlay {
    opacity: 1;
    pointer-events: auto;
}

/* Layout Helpers */
.grid,
.filter-grid,
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
    align-items: end;
}

.section-spacer {
    margin-top: 18px;
}

.stack-lg {
    display: grid;
    gap: 24px;
}

.stack-md {
    display: grid;
    gap: 18px;
}

.page-intro {
    margin-bottom: 4px;
}

.page-intro p {
    margin: 6px 0 0;
    color: var(--text-muted);
    font-size: 14px;
}

.card-header,
.card-header-flex {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.card-header h2,
.card-header h3,
.card-header h4,
.card-header-flex h2,
.card-header-flex h3 {
    margin: 0;
    color: var(--text-main);
}

.card-header p,
.card-header-flex p {
    margin: 6px 0 0;
    color: var(--text-muted);
    font-size: 14px;
}

.header-stat {
    flex-shrink: 0;
    padding: 10px 14px;
    border-radius: 12px;
    background: var(--bg-muted);
    color: var(--primary);
    font-size: 13px;
    font-weight: 700;
}

.card-empty {
    padding: 18px;
    border-radius: 14px;
    background: #f8fafc;
    border: 1px dashed #cfd7e5;
    color: var(--text-muted);
    text-align: center;
    font-weight: 500;
}

.inline-note {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.45;
}

.filter-panel {
    display: grid;
    gap: 18px;
}

.filter-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.summary-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: #eef2ff;
    color: var(--primary);
    font-size: 13px;
    font-weight: 700;
}

.meta-chip-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.meta-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 30px;
    padding: 6px 10px;
    border-radius: 999px;
    background: #f1f5f9;
    color: var(--text-soft);
    font-size: 13px;
    font-weight: 600;
}

.toolbar-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.table-note {
    margin-top: 10px;
    font-size: 13px;
    color: var(--text-muted);
}

.field-stack {
    display: grid;
    gap: 8px;
}

.compact-card {
    padding: 18px;
}

.highlight-panel {
    padding: 20px;
    border-radius: 16px;
    background: linear-gradient(135deg, #223b95, #2f2f86);
    color: #fff;
    box-shadow: 0 12px 28px rgba(37, 59, 144, 0.2);
}

.highlight-panel h3,
.highlight-panel h1,
.highlight-panel p {
    margin: 0;
}

.highlight-panel h1 {
    margin-top: 10px;
    font-size: 36px;
}

.contact-grid {
    display: grid;
    gap: 18px;
}

.contact-card {
    background: #fff;
    border: 1px solid var(--border-soft);
    border-radius: 16px;
    padding: 20px;
    box-shadow: var(--shadow-soft);
}

.contact-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding-bottom: 16px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border-soft);
}

.contact-header.compact {
    gap: 12px;
    padding-bottom: 12px;
    margin-bottom: 12px;
}

.contact-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    overflow: hidden;
}

.contact-avatar.small {
    width: 48px;
    height: 48px;
}

.avatar-initial {
    color: #fff;
    font-size: 22px;
    font-weight: 700;
}

.avatar-initial.small {
    font-size: 16px;
}

.contact-title h3 {
    margin: 0;
    font-size: 18px;
}

.role-badge {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 4px 10px;
    border-radius: 999px;
    background: #dbeafe;
    color: #1d4ed8;
    font-size: 12px;
    font-weight: 700;
    margin-top: 6px;
}

.branch-info {
    margin-top: 6px;
    font-size: 13px;
    color: var(--text-muted);
}

.contact-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.detail-grid {
    display: grid;
    gap: 12px;
}

.detail-grid.compact {
    gap: 10px;
}

.detail-row {
    display: grid;
    gap: 6px;
}

.detail-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-soft);
}

.detail-value {
    font-size: 14px;
    color: var(--text-main);
    word-break: break-word;
}

.mini-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
}

.mini-contact-card {
    background: #f8fafc;
    border: 1px solid var(--border-soft);
    border-radius: 14px;
    padding: 16px;
}

.contact-card-primary,
.faculty-profile-card {
    box-shadow: var(--shadow-soft);
}

.contact-action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

.contact-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 8px 12px;
    border-radius: 10px;
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 700;
    text-decoration: none;
}

.dashboard-hero {
    display: grid;
    gap: 18px;
    padding: 22px;
    border-radius: 20px;
    background: linear-gradient(135deg, #223b95, #34308a);
    color: #fff;
    box-shadow: 0 18px 36px rgba(37, 59, 144, 0.22);
}

.dashboard-hero h2,
.dashboard-hero p {
    margin: 0;
}

.hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.hero-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 30px;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    font-size: 13px;
    font-weight: 600;
}

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

.quick-link-card {
    display: grid;
    gap: 10px;
    padding: 18px;
    border-radius: 16px;
    background: #fff;
    border: 1px solid rgba(37, 59, 144, 0.08);
    box-shadow: var(--shadow-soft);
    text-decoration: none;
}

.quick-link-card strong {
    color: var(--text-main);
}

.quick-link-card span {
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.45;
}

.directory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 18px;
}

.directory-card {
    background: #fff;
    border: 1px solid var(--border-soft);
    border-radius: 16px;
    padding: 18px;
    box-shadow: var(--shadow-soft);
}

.directory-card h4 {
    margin: 0 0 6px;
}

.info-pair {
    display: grid;
    gap: 6px;
}

.info-pair strong {
    color: var(--text-soft);
    font-size: 13px;
}

.info-pair span {
    color: var(--text-main);
    font-size: 14px;
}

/* Cards */
.card,
.attendance-card,
.attendance-mark-card {
    width: 100%;
    max-width: 100%;
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(37, 59, 144, 0.06);
    box-shadow: var(--shadow-card);
    padding: 24px;
    overflow: hidden;
}

.attendance-mark-card {
    padding: 20px;
}

.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 18px;
    margin-bottom: 22px;
}

.card-summary {
    background: #fff;
    border-radius: 16px;
    padding: 22px 18px;
    border: 1px solid rgba(37, 59, 144, 0.06);
    box-shadow: var(--shadow-soft);
    text-align: center;
}

.card-icon {
    font-size: 28px;
    line-height: 1;
    margin-bottom: 12px;
}

.card-title {
    font-size: 14px;
    color: var(--text-soft);
    margin-bottom: 8px;
}

.card-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-main);
}

/* Forms */
.form-group {
    min-width: 0;
}

.form-group label,
label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-soft);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="month"],
input[type="tel"],
select,
textarea {
    width: 100%;
    min-height: 44px;
    border: 1px solid #cfd7e5;
    border-radius: 10px;
    background: #fff;
    padding: 10px 12px;
    color: var(--text-main);
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

textarea {
    min-height: 110px;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #4562d6;
    box-shadow: 0 0 0 3px rgba(69, 98, 214, 0.14);
}

small {
    display: inline-block;
    margin-top: 6px;
    color: var(--text-muted);
}

/* Buttons */
.btn-primary,
.btn-secondary,
.btn-success,
.btn-danger,
.btn-gradient,
.btn-light,
.btn-export,
.btn-remark,
.btn-submit,
button[type="submit"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    padding: 10px 16px;
    border: 0;
    border-radius: 10px;
    cursor: pointer;
    text-decoration: none;
    font-weight: 600;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn-primary,
.btn-gradient,
.btn-submit,
button[type="submit"] {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 8px 20px rgba(37, 59, 144, 0.18);
}

.btn-primary:hover,
.btn-gradient:hover,
.btn-submit:hover,
button[type="submit"]:hover {
    background: var(--primary-dark);
}

.btn-success {
    background: #16a34a;
    color: #fff;
}

.btn-success:hover {
    background: #15803d;
}

.btn-danger {
    background: #ef4444;
    color: #fff;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-secondary,
.btn-light,
.btn-export,
.btn-remark {
    background: #eef2ff;
    color: var(--primary);
}

.btn-secondary:hover,
.btn-light:hover,
.btn-export:hover,
.btn-remark:hover {
    background: #dfe6ff;
}

.small-btn {
    min-height: 32px;
    padding: 6px 10px;
    font-size: 12px;
}

.action-area,
.action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.filter-panel > .filter-actions,
.filter-panel > .action-area,
form > .filter-actions,
form > .action-area {
    margin-top: 10px;
}

/* Alerts */
.alert-success,
.error-message,
.alert-warning {
    width: 100%;
    margin-bottom: 16px;
    padding: 14px 16px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
}

.alert-success {
    background: var(--success-soft);
    color: #166534;
    border: 1px solid #86efac;
}

.error-message {
    background: var(--danger-soft);
    color: #b91c1c;
    border: 1px solid #fca5a5;
}

.alert-warning {
    background: var(--warning-soft);
    color: #92400e;
    border: 1px solid #fcd34d;
}

/* Tables */
.table-container,
.desktop-only {
    min-width: 0;
}

.table-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.modern-table,
.mentor-table,
.faculty-load-table,
.timetable-table {
    width: 100%;
    min-width: 720px;
    border-collapse: separate;
    border-spacing: 0;
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-soft);
}

.modern-table thead th,
.mentor-table thead th,
.faculty-load-table thead th,
.timetable-table thead th {
    background: linear-gradient(180deg, #2e3f9d 0%, #2b327d 100%);
    color: #fff;
    padding: 14px 12px;
    text-align: center;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

.modern-table tbody td,
.mentor-table tbody td,
.faculty-load-table tbody td,
.timetable-table tbody td {
    padding: 14px 12px;
    text-align: center;
    border-bottom: 1px solid var(--border-soft);
    font-size: 14px;
    color: var(--text-main);
    vertical-align: top;
}

.modern-table tbody tr:last-child td,
.mentor-table tbody tr:last-child td,
.faculty-load-table tbody tr:last-child td,
.timetable-table tbody tr:last-child td {
    border-bottom: 0;
}

.modern-table tbody tr:hover td,
.mentor-table tbody tr:hover td,
.faculty-load-table tbody tr:hover td {
    background: #fafbff;
}

.status-select {
    min-width: 150px;
}

.badge-success,
.badge-danger,
.attendance-badge,
.load-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 28px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.badge-success {
    background: var(--success-soft);
    color: #166534;
}

.badge-danger {
    background: var(--danger-soft);
    color: #b91c1c;
}

.load-zero {
    background: #e2e8f0;
    color: #334155;
}

.load-light {
    background: #dbeafe;
    color: #1d4ed8;
}

.load-normal {
    background: #dcfce7;
    color: #166534;
}

.load-heavy {
    background: #fee2e2;
    color: #b91c1c;
}

/* Progress */
.progress-bar {
    width: 100%;
    height: 10px;
    background: #e8edf5;
    border-radius: 999px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3254d5, #577af2);
    border-radius: inherit;
}

.progress-fill.is-danger {
    background: linear-gradient(90deg, #ef4444, #f97316);
}

/* Mobile data views */
.mobile-only {
    display: none !important;
}

.desktop-only {
    display: block !important;
}

.mobile-card-list,
.day-stack {
    display: grid;
    gap: 14px;
}

.mobile-data-card,
.day-stack-card {
    background: #fff;
    border-radius: 16px;
    padding: 16px;
    border: 1px solid rgba(37, 59, 144, 0.08);
    box-shadow: var(--shadow-soft);
}

.mobile-data-card h4,
.day-stack-card h4 {
    margin: 0 0 12px;
    font-size: 16px;
    color: var(--text-main);
}

.mobile-data-card .action-area,
.mobile-data-card .filter-actions {
    margin-top: 12px;
}

.mobile-data-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-soft);
    font-size: 14px;
}

.mobile-data-row:last-child {
    border-bottom: 0;
}

.mobile-data-row span:first-child {
    color: var(--text-muted);
    font-weight: 600;
}

.mobile-data-row span:last-child {
    text-align: right;
    color: var(--text-main);
}

.day-slot-list {
    display: grid;
    gap: 10px;
}

.day-slot-item {
    padding: 12px;
    border-radius: 12px;
    background: #f8faff;
    border: 1px solid #e1e8f8;
}

.day-slot-item.empty {
    color: var(--text-muted);
    background: #fafafa;
}

.day-slot-meta {
    margin-top: 6px;
    color: var(--text-muted);
    font-size: 13px;
}

/* Timetable */
.timetable-grid {
    min-width: 0;
}

.day-cell {
    font-weight: 700;
    background: #f8faff;
}

.slot-cell,
.timetable-cell {
    min-width: 130px;
    min-height: 108px;
}

.student-timetable-grid {
    min-width: 760px;
}

.student-timetable-grid .day-name-cell {
    min-width: 120px;
    background: #f8fafc;
}

.student-timetable-grid .slot-cell {
    min-width: 150px;
}

.student-timetable-grid .timetable-cell {
    display: grid;
    gap: 6px;
    min-height: 118px;
    padding: 12px;
    border-radius: 14px;
    border: 1px solid #e2e8f7;
    background: #f8faff;
    text-align: left;
    align-content: start;
}

.student-timetable-grid .timetable-cell.empty {
    background: #fbfbfc;
}

.slot-top {
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.slot-card {
    min-height: 94px;
    padding: 10px;
    border-radius: 12px;
    background: #f8faff;
    border: 1px solid #dce6fb;
}

.slot-subject {
    color: var(--primary);
    font-weight: 700;
    margin-bottom: 6px;
}

.slot-name,
.slot-code,
.slot-faculty,
.empty-slot {
    font-size: 13px;
    color: var(--text-soft);
}

.slot-name {
    font-size: 14px;
    font-weight: 700;
    line-height: 1.35;
    color: var(--text-main);
}

.slot-code {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 24px;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(37, 59, 144, 0.1);
    color: var(--primary);
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 0.3px;
    width: fit-content;
}

.slot-faculty {
    font-size: 12px;
    line-height: 1.4;
    color: var(--text-muted);
}

.empty-slot {
    display: inline-block;
    padding: 12px 0;
}

/* Misc shared */
.attendance-badge {
    background: var(--bg-muted);
    color: var(--primary);
}

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.48);
    padding: 20px;
}

.modal-box {
    width: min(560px, 100%);
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 30px 60px rgba(15, 23, 42, 0.2);
    overflow: hidden;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border-soft);
}

.close-btn {
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 10px;
    background: #eef2ff;
    color: var(--primary);
    cursor: pointer;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 18px 20px 20px;
}

.toast-msg {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 1250;
    padding: 14px 16px;
    border-radius: 12px;
    background: #111827;
    color: #fff;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.2);
}

/* Login basics */
body.login-body {
    background: #0f172a;
    color: #fff;
}

.login-container {
    min-height: 100vh;
}

.login-card {
    width: 100%;
}

/* ─── Responsive ──────────────────────────────────────── */

/* Laptop / large tablet landscape (≤1024px) */
@media (max-width: 1024px) {
    .content {
        padding: 20px;
    }

    .card,
    .attendance-card,
    .attendance-mark-card {
        padding: 20px;
    }

    .dashboard-cards {
        grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    }
}

/* Tablet portrait / narrow laptop (≤860px) */
@media (max-width: 860px) {
    .content {
        padding: 16px;
    }

    .card,
    .attendance-card,
    .attendance-mark-card {
        padding: 18px;
    }

    /* Stack card headers on narrow tablets */
    .card-header,
    .card-header-flex {
        flex-direction: column;
        align-items: stretch;
    }

    .card-header .meta-chip-grid,
    .card-header-flex .meta-chip-grid,
    .card-header .summary-chip,
    .card-header-flex .summary-chip {
        align-self: flex-start;
    }

    /* Collapse form grids to 2 columns maximum */
    .grid,
    .filter-grid,
    .form-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
        gap: 14px;
    }

    .dashboard-cards {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 14px;
    }

    /* Notice / study material meta grids stack earlier */
    .notice-meta-grid {
        grid-template-columns: 1fr;
    }

    .sm-form-grid {
        grid-template-columns: 1fr;
    }

    /* Two-column widget rows go single-column */
    .home-two-col {
        grid-template-columns: 1fr !important;
    }

    /* Directory grids — 1 column on narrow tablets */
    .directory-grid {
        grid-template-columns: 1fr;
    }

    .mini-card-grid {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: var(--sidebar-mobile-rail) !important;
        min-width: var(--sidebar-mobile-rail);
        max-width: var(--sidebar-mobile-rail);
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        box-shadow: 8px 0 24px rgba(15, 23, 42, 0.18);
    }

    .sidebar.mobile-open {
        width: var(--sidebar-overlay-width) !important;
        min-width: var(--sidebar-overlay-width);
        max-width: var(--sidebar-overlay-width);
    }

    .sidebar:not(.mobile-open) .sidebar-brand {
        display: none !important;
    }

    .sidebar:not(.mobile-open) .nav-text,
    .sidebar:not(.mobile-open) .logout .nav-text {
        display: none !important;
    }

    .sidebar:not(.mobile-open) a,
    .sidebar:not(.mobile-open) .logout {
        justify-content: center;
        padding-left: 0;
        padding-right: 0;
    }

    .sidebar-toggle {
        position: static;
        top: auto;
        right: auto;
        width: 28px;
        min-height: 28px;
        margin: 10px auto 16px;
        font-size: 16px;
    }

    .sidebar.mobile-open .sidebar-brand {
        display: flex !important;
    }

    .sidebar.mobile-open .sidebar-toggle {
        position: absolute;
        top: 14px;
        right: 12px;
        margin: 0;
        width: 30px;
        min-height: 30px;
        font-size: 20px;
    }

    .sidebar.mobile-open .sidebar-nav {
        padding-top: 12px;
    }

    .resizer {
        display: none;
    }

    .main {
        margin-left: calc(var(--sidebar-mobile-rail) + 6px);
    }

    .topbar {
        padding: 10px 14px;
        font-size: 14px;
        flex-wrap: nowrap;
    }

    /* Hide student info chips on mobile — they already know who they are */
    .topbar-right {
        display: none;
    }

    .topbar-title {
        font-size: 15px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .content {
        padding: 14px 14px 16px 10px;
    }

    .card,
    .attendance-card,
    .attendance-mark-card {
        padding: 18px;
        border-radius: 16px;
    }

    .card-header,
    .card-header-flex {
        flex-direction: column;
        align-items: stretch;
    }

    .card-header .summary-chip,
    .card-header-flex .summary-chip,
    .card-header .meta-chip-grid,
    .card-header-flex .meta-chip-grid {
        align-self: flex-start;
    }

    .grid,
    .filter-grid,
    .form-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .dashboard-cards {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .card-summary {
        padding: 18px 16px;
    }

    .table-container {
        margin: 0 -2px;
    }

    .desktop-only {
        display: none !important;
    }

    .mobile-only {
        display: block !important;
    }

    .action-area,
    .action-buttons {
        flex-direction: column;
        align-items: stretch;
    }

    .contact-action-row {
        flex-wrap: wrap;
        gap: 8px;
    }

    .contact-action {
        flex: 1;
        min-width: 80px;
        text-align: center;
    }

    .btn-primary,
    .btn-secondary,
    .btn-success,
    .btn-danger,
    .btn-gradient,
    .btn-light,
    .btn-export,
    .btn-remark,
    .btn-submit,
    button[type="submit"] {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .sidebar {
        width: 50px !important;
        min-width: 50px;
        max-width: 50px;
    }

    .sidebar.mobile-open {
        width: min(88vw, 300px) !important;
        min-width: min(88vw, 300px);
        max-width: min(88vw, 300px);
    }

    .nav-badge {
        width: 22px;
        height: 22px;
        font-size: 8px;
    }

    .sidebar-toggle {
        width: 26px;
        min-height: 26px;
        margin: 8px auto 14px;
        font-size: 15px;
    }

    .main {
        margin-left: 54px;
    }

    .topbar {
        padding: 10px 12px 10px 12px;
    }

    .content {
        padding: 12px 12px 14px 8px;
    }

    .card,
    .attendance-card,
    .attendance-mark-card {
        padding: 16px;
    }

    .card-header,
    .card-header-flex {
        margin-bottom: 14px;
    }

    .meta-chip-grid {
        gap: 8px;
    }

    .meta-chip {
        font-size: 12px;
        min-height: 28px;
        padding: 5px 9px;
    }
}
