* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: Arial, sans-serif;
}

body {
    background: #f3f6fb;
    color: #172033;
}

a {
    text-decoration: none;
}

/* Shared clickable elements */
.btn-primary,
.header-btn,
.toolbar-btn,
.panel-btn,
.table-btn,
.dashboard-dark-btn,
.photo-upload-label,
.print-btn {
    text-decoration: none !important;
    transition: all 0.2s ease;
}

.btn-primary:hover,
.header-btn:hover,
.toolbar-btn:hover,
.panel-btn:hover,
.table-btn:hover,
.dashboard-dark-btn:hover,
.photo-upload-label:hover,
.print-btn:hover {
    transform: translateY(-1px);
}

/* Login */
.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #0f172a, #1d4ed8);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-wrapper {
    width: 100%;
    max-width: 430px;
}

.login-card {
    background: #ffffff;
    border-radius: 20px;
    padding: 36px;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.18);
}

.login-card h1 {
    font-size: 34px;
    margin-bottom: 6px;
    color: #0f172a;
    text-align: center;
    font-weight: 800;
}

.subtitle {
    text-align: center;
    color: #64748b;
    margin-bottom: 24px;
    font-size: 16px;
}

.form-group {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 700;
    color: #334155;
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    border: 1px solid #d8e1ec;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
    outline: none;
    background: #fff;
    color: #172033;
}

.form-group input,
.form-group select {
    height: 40px;
}

.form-group textarea {
    min-height: 70px;
    resize: vertical;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
.toolbar-search:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.10);
}

.btn-primary {
    width: 100%;
    height: 44px;
    border: none;
    border-radius: 10px;
    background: #2563eb;
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.footer-note {
    margin-top: 18px;
    text-align: center;
    font-size: 13px;
    color: #64748b;
}

/* Alerts */
.alert {
    padding: 14px 16px;
    border-radius: 12px;
    margin-bottom: 18px;
    font-size: 14px;
    font-weight: 600;
}

.alert.error {
    background: #fee2e2;
    color: #b91c1c;
}

.alert.success {
    background: #dcfce7;
    color: #166534;
}

.alert.info {
    background: #e0f2fe;
    color: #075985;
}

/* Layout */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 245px;
    background: linear-gradient(180deg, #03112b 0%, #041737 100%);
    color: #fff;
    padding: 18px 16px;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    overflow-y: auto;
    box-shadow: 8px 0 24px rgba(2, 6, 23, 0.18);
    display: flex;
    flex-direction: column;
    gap: 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.18) transparent;
}

.sidebar::-webkit-scrollbar {
    width: 8px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.16);
    border-radius: 999px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-brand-card {
    background: #ffffff;
    border-radius: 18px;
    padding: 14px 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 22px;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
    overflow: hidden;
    flex-shrink: 0;
}

.sidebar-logo-mark {
    width: 58px;
    height: 58px;
    min-width: 58px;
    border-radius: 14px;
    background: linear-gradient(135deg, #b91c1c, #1d4ed8);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 18px;
    flex-shrink: 0;
}

.sidebar-brand-text {
    min-width: 0;
    flex: 1;
}

.sidebar-brand-title {
    font-size: 15px;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.25;
    margin-bottom: 2px;
}

.sidebar-brand-subtitle {
    font-size: 12px;
    color: #1d4ed8;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 4px;
}

.sidebar-brand-small {
    font-size: 10px;
    color: #64748b;
    line-height: 1.35;
}

.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
    flex: 1 1 auto;
    padding-bottom: calc(var(--portal-footer-height, 110px) + 34px);
}

.sidebar-link {
    color: #ffffff;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.08);
    padding: 13px 14px;
    border-radius: 14px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.sidebar-link:hover {
    background: rgba(255,255,255,0.12);
    transform: translateY(-1px);
}

.sidebar-link.active {
    background: #dff4ff;
    color: #0f172a;
    border-color: #7dd3fc;
    box-shadow: 0 8px 18px rgba(14, 165, 233, 0.18);
}

.sidebar-link.disabled {
    opacity: 0.5;
    cursor: default;
}

.sidebar-icon {
    width: 22px;
    text-align: center;
    font-size: 18px;
    flex-shrink: 0;
}

.sidebar-footer {
    margin-top: 22px;
    padding: 14px 12px;
    border-top: 1px solid rgba(255,255,255,0.10);
    color: rgba(255,255,255,0.78);
    font-size: 12px;
}

.sidebar-footer small {
    display: block;
    margin-top: 4px;
    color: rgba(255,255,255,0.58);
}

/* Main Area */
.main-area {
    margin-left: 245px;
    width: calc(100% - 245px);
    min-height: 100vh;
}

.main-header {
    background: #ffffff;
    padding: 18px 24px;
    border-bottom: 1px solid #e5edf7;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 20;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.04);
}

.main-title {
    font-size: 22px;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 4px;
}

.main-subtitle {
    color: #64748b;
    font-size: 14px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.header-btn {
    padding: 10px 16px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 14px;
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.header-btn.primary {
    background: #2563eb;
    color: #fff;
}

.header-btn.danger {
    background: #ef4444;
    color: #fff;
}

.header-btn.light {
    background: #e2e8f0;
    color: #0f172a;
}

.content-area {
    padding: 18px 18px 24px;
    background: #f3f6fb;
}

/* Generic Cards and Headings */
.page-head {
    margin-bottom: 16px;
}

.page-head h2 {
    font-size: 26px;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 4px;
}

.page-head p {
    color: #64748b;
    font-size: 14px;
}

.content-card {
    background: #fff;
    border-radius: 14px;
    padding: 16px;
    border: 1px solid #ebf0f7;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
    margin-bottom: 18px;
}

.card-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.card-title-row h3 {
    font-size: 18px;
    font-weight: 800;
    color: #0f172a;
}

/* Toolbar */
.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.toggle-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    color: #334155;
}

.toolbar-search {
    flex: 1;
    min-width: 260px;
    height: 40px;
    border: 1px solid #d8e1ec;
    border-radius: 8px;
    padding: 0 12px;
    font-size: 14px;
    background: #fff;
    outline: none;
}

.toolbar-btn {
    min-height: 40px;
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 800;
    font-size: 14px;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    line-height: 1;
}

.toolbar-btn.primary {
    background: #2563eb;
    color: #fff;
    cursor: pointer;
}

.toolbar-btn.light {
    background: #e2e8f0;
    color: #0f172a;
}

.toolbar-btn.dark {
    background: #0f172a;
    color: #fff;
}

.toolbar-btn.info {
    background: #e0f2fe;
    color: #075985;
}

.table-count {
    color: #64748b;
    font-size: 13px;
    font-weight: 700;
}

/* Tables */
.table-shell {
    width: 100%;
    overflow-x: auto;
}

.modern-table {
    width: 100%;
    min-width: 1400px;
    border-collapse: collapse;
}

.modern-table thead th {
    background: #f8fafc;
    color: #0f172a;
    font-size: 13px;
    font-weight: 800;
    padding: 10px 8px;
    border-bottom: 1px solid #e2e8f0;
    text-align: left;
    white-space: nowrap;
}

.modern-table tbody td {
    padding: 10px 8px;
    border-bottom: 1px solid #edf2f7;
    font-size: 13px;
    color: #334155;
    vertical-align: middle;
}

.modern-table tbody tr:hover {
    background: #f9fbff;
}

.table-photo {
    width: 52px;
    height: 52px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid #e2e8f0;
    display: block;
}

.table-photo.noimg {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    color: #64748b;
    font-size: 10px;
    font-weight: 700;
}

.badge {
    display: inline-block;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
}

.badge.success {
    background: #dcfce7;
    color: #166534;
}

.badge.danger {
    background: #fee2e2;
    color: #b91c1c;
}

.badge.warn {
    background: #fef3c7;
    color: #92400e;
}

.badge.info {
    background: #e0f2fe;
    color: #075985;
}

.action-group {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.table-btn {
    padding: 6px 9px;
    border-radius: 7px;
    font-size: 11px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    white-space: nowrap;
}

.table-btn.edit {
    background: #dbeafe;
    color: #1d4ed8;
}

.table-btn.delete {
    background: #fee2e2;
    color: #dc2626;
}

.table-btn.warn {
    background: #fef3c7;
    color: #92400e;
}

.table-btn.activate {
    background: #dcfce7;
    color: #166534;
}

.table-btn.info {
    background: #e0f2fe;
    color: #075985;
}

.empty-state {
    text-align: center;
    color: #64748b;
    font-weight: 700;
    padding: 24px !important;
}

/* Student Form */
.student-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 190px;
    gap: 16px;
    align-items: start;
}

.student-main {
    width: 100%;
}

.student-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(180px, 1fr));
    gap: 12px 14px;
}

.student-grid .full-width {
    grid-column: 1 / -1;
}

.student-actions {
    margin-top: 14px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.panel-btn {
    min-width: 110px;
    min-height: 38px;
    border: none;
    border-radius: 7px;
    background: #e5e7eb;
    color: #111827;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 14px;
    white-space: nowrap;
    line-height: 1;
}

.panel-btn.primary {
    background: #2563eb;
    color: #fff;
}

.panel-btn.warn {
    background: #fef3c7;
    color: #92400e;
}

.panel-btn.info {
    background: #e0f2fe;
    color: #075985;
}

.panel-btn.success {
    background: #dcfce7;
    color: #166534;
}

.panel-btn.light {
    background: #e5e7eb;
    color: #111827;
}

.panel-tip {
    margin-top: 10px;
    color: #64748b;
    font-size: 12px;
}

.student-photo-card {
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    border-radius: 14px;
    padding: 12px;
}

.student-photo-card h4 {
    font-size: 15px;
    margin-bottom: 10px;
    color: #0f172a;
}

.photo-preview-box {
    width: 100%;
    height: 210px;
    border: 1px solid #dbe2ea;
    border-radius: 10px;
    background: #fff;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
}

.photo-preview-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-preview-box span {
    color: #64748b;
    font-size: 12px;
    font-weight: 700;
}

.photo-action-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.photo-upload-label {
    min-width: 84px;
    min-height: 34px;
    border-radius: 7px;
    background: #e5e7eb;
    color: #111827;
    font-weight: 700;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 8px 10px;
    white-space: nowrap;
    line-height: 1;
}

.photo-remove-check {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #334155;
    margin-top: 10px;
}

.hidden-file {
    display: none;
}

/* PDF / Print */
.pdf-page {
    background: #fff;
    color: #111827;
    max-width: 900px;
    margin: 20px auto;
    padding: 30px;
}

.pdf-card {
    border: 2px solid #111827;
    border-radius: 12px;
    padding: 20px;
}

.pdf-title {
    text-align: center;
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 8px;
}

.pdf-subtitle {
    text-align: center;
    font-size: 15px;
    margin-bottom: 20px;
    color: #334155;
}

.id-card-box {
    width: 430px;
    border: 2px solid #0f172a;
    border-radius: 14px;
    padding: 18px;
    margin: 20px auto;
}

.id-card-header {
    text-align: center;
    margin-bottom: 14px;
}

.id-card-header h2 {
    font-size: 24px;
    font-weight: 800;
}

.id-card-header p {
    font-size: 13px;
    color: #475569;
}

.id-card-photo {
    width: 120px;
    height: 140px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    overflow: hidden;
    margin: 0 auto 16px auto;
}

.id-card-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.id-card-table {
    width: 100%;
    border-collapse: collapse;
}

.id-card-table td {
    padding: 8px 6px;
    border-bottom: 1px solid #e5e7eb;
    font-size: 14px;
}

.print-btn-wrap {
    text-align: center;
    margin: 15px 0 25px;
}

.print-btn {
    padding: 10px 16px;
    border-radius: 10px;
    background: #2563eb;
    color: #fff;
    font-weight: 700;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.doc-logo-wrap {
    text-align: center;
    margin-bottom: 10px;
}

.doc-logo {
    max-width: 90px;
    max-height: 90px;
    object-fit: contain;
}

.doc-footer {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid #d1d5db;
    display: flex;
    align-items: center;
    gap: 14px;
}

.doc-footer-logo {
    width: 52px;
    height: 52px;
    object-fit: contain;
    flex-shrink: 0;
}

.doc-footer-text {
    font-size: 13px;
    color: #374151;
    line-height: 1.5;
}

.developer-line {
    margin-top: 4px;
    font-size: 12px;
    color: #6b7280;
}

.enhanced-id-card {
    width: 430px;
    margin: 0 auto;
}

.id-photo-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    font-size: 13px;
    font-weight: 700;
    background: #f8fafc;
}

.enhanced-certificate {
    max-width: 900px;
    margin: 0 auto;
}

.certificate-header {
    text-align: center;
    margin-bottom: 24px;
}

.certificate-school-line {
    font-size: 14px;
    color: #475569;
    margin-top: 6px;
}

.certificate-info-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.certificate-info-table td {
    padding: 10px 8px;
    border-bottom: 1px solid #e5e7eb;
    font-size: 15px;
}

.certificate-info-table td:first-child {
    width: 220px;
}

.certificate-paragraph {
    margin-top: 18px;
    margin-bottom: 34px;
    line-height: 1.8;
    font-size: 16px;
    color: #1f2937;
}

.certificate-sign-row {
    display: flex;
    justify-content: space-between;
    margin-top: 28px;
    margin-bottom: 10px;
    font-size: 16px;
    font-weight: 600;
}

.certificate-footer {
    margin-top: 30px;
}

/* Dashboard */
.dashboard-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 18px;
}

.dashboard-page-title {
    font-size: 22px;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 4px;
}

.dashboard-page-subtitle {
    color: #64748b;
    font-size: 14px;
}

.dashboard-date-chip {
    background: #ffffff;
    border: 1px solid #e5edf7;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.05);
    border-radius: 12px;
    padding: 10px 14px;
    font-weight: 700;
    font-size: 13px;
    color: #475569;
    white-space: nowrap;
}

.dashboard-cards-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(220px, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}

.dashboard-stat-card {
    background: #ffffff;
    border: 1px solid #e9eef6;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.06);
    border-radius: 18px;
    padding: 16px 14px;
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 98px;
}

.dashboard-stat-icon {
    width: 58px;
    height: 58px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    font-weight: 700;
    flex-shrink: 0;
    border-bottom: 4px solid rgba(15, 23, 42, 0.12);
}

.dashboard-stat-icon.blue {
    background: #e0f2fe;
    color: #0284c7;
}

.dashboard-stat-icon.green {
    background: #dcfce7;
    color: #16a34a;
}

.dashboard-stat-icon.orange {
    background: #fef3c7;
    color: #d97706;
}

.dashboard-stat-icon.pink {
    background: #fce7f3;
    color: #db2777;
}

.dashboard-stat-icon.purple {
    background: #ede9fe;
    color: #7c3aed;
}

.dashboard-stat-icon.red {
    background: #ffe4e6;
    color: #e11d48;
}

.dashboard-stat-icon.indigo {
    background: #e0e7ff;
    color: #4f46e5;
}

.dashboard-stat-content {
    min-width: 0;
}

.dashboard-stat-title {
    font-size: 13px;
    color: #64748b;
    margin-bottom: 5px;
    font-weight: 700;
}

.dashboard-stat-number {
    font-size: 20px;
    color: #0f172a;
    font-weight: 800;
    margin-bottom: 4px;
}

.dashboard-stat-meta {
    font-size: 12px;
    color: #94a3b8;
    line-height: 1.5;
}

.dashboard-panels-grid {
    display: grid;
    grid-template-columns: 0.95fr 1.2fr;
    gap: 16px;
    align-items: start;
}

.dashboard-panel-card {
    background: #ffffff;
    border: 1px solid #e9eef6;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.06);
    border-radius: 18px;
    padding: 16px;
}

.dashboard-panel-title {
    font-size: 16px;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 6px;
}

.dashboard-panel-subtitle {
    color: #94a3b8;
    font-size: 13px;
    margin-bottom: 12px;
}

.dashboard-panel-text {
    color: #475569;
    line-height: 1.7;
    font-size: 14px;
    margin-bottom: 14px;
}

.dashboard-tip-box {
    background: #f8fafc;
    border: 1px solid #e5edf7;
    border-radius: 12px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #475569;
    font-size: 13px;
}

.dashboard-tip-icon {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #e5e7eb;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
}

.dashboard-inline-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.dashboard-dark-btn {
    background: #111827;
    color: #ffffff !important;
    border: none;
    border-radius: 10px;
    min-height: 38px;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    line-height: 1;
    box-shadow: 0 4px 10px rgba(17, 24, 39, 0.12);
}

.dashboard-dark-btn:hover {
    background: #0b1220;
}

.dashboard-table-compact {
    min-width: 100%;
}

.dashboard-table-compact thead th,
.dashboard-table-compact tbody td {
    text-align: center;
}

/* Attendance submenu */
.sidebar-dropdown {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    flex-shrink: 0;
}

.sidebar-toggle-btn {
    width: 100%;
    border: 1px solid rgba(255,255,255,0.08);
    outline: none;
    cursor: pointer;
    font: inherit;
    text-align: left;
}

.sidebar-submenu {
    display: none;
    flex-direction: column;
    gap: 6px;
    padding-left: 16px;
    margin-top: 2px;
    width: 100%;
    position: relative;
    z-index: 10;
}

.sidebar-dropdown.open .sidebar-submenu {
    display: flex;
}

.sidebar-sublink {
    color: #ffffff;
    background: transparent;
    padding: 11px 14px;
    border-radius: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s ease;
    width: 100%;
    position: relative;
    z-index: 11;
    pointer-events: auto;
    cursor: pointer;
    flex-shrink: 0;
}

.sidebar-sublink:hover {
    background: rgba(255,255,255,0.10);
}

.sidebar-sublink.active {
    background: rgba(223, 244, 255, 0.16);
    color: #ffffff;
    box-shadow: 0 6px 14px rgba(14, 165, 233, 0.12);
}

.sidebar-subicon {
    width: 18px;
    min-width: 18px;
    text-align: center;
    font-size: 14px;
    flex-shrink: 0;
}

.sidebar-caret {
    margin-left: auto;
    font-size: 12px;
    opacity: 0.85;
    transition: transform 0.2s ease;
}

.sidebar-dropdown.open .sidebar-caret {
    transform: rotate(180deg);
}

/* Reports / Letterhead */
.report-letterhead {
    padding: 10px 14px 10px;
    border-bottom: 1px solid #e2e8f0;
}

.report-letterhead-top {
    display: flex;
    gap: 14px;
    align-items: center;
}

.report-letterhead-logo {
    width: 64px;
    height: 64px;
    min-width: 64px;
    background: #ffffff;
    border: 1px solid #dbe4ef;
    border-radius: 12px;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.report-letterhead-logo img {
    max-width: 56px;
    max-height: 56px;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

.report-letterhead-fallback {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: linear-gradient(135deg, #7a1f65 0%, #3450ff 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 18px;
    font-weight: 800;
}

.report-letterhead-text {
    min-width: 0;
    flex: 1;
}

.report-letterhead-text h1 {
    font-size: 20px;
    font-weight: 800;
    margin-bottom: 2px;
    color: #0f172a;
    line-height: 1.2;
}

.report-letterhead-text .portal-name,
.report-letterhead-text .report-name,
.print-contact-line,
.print-address-line {
    color: #475569;
    margin-bottom: 2px;
    line-height: 1.3;
    font-size: 13px;
}

.report-name {
    font-weight: 700;
}

.due-report-body,
.collection-report-body {
    padding: 12px 14px 8px;
}

.due-report-stats-grid {
    grid-template-columns: repeat(3, minmax(220px, 1fr));
}

.report-final-footer {
    border-top: 1px solid #e2e8f0;
    margin-top: 14px;
    padding: 10px 6px 2px;
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    color: #334155;
    font-size: 12px;
    line-height: 1.2;
}

.report-final-footer .brand-strong {
    font-weight: 800;
    color: #0f172a;
}

.report-final-footer .brand-sep {
    color: #94a3b8;
}

.report-final-footer a {
    color: #2563eb;
    text-decoration: none;
    font-weight: 700;
}

.single-report-footer {
    page-break-inside: avoid;
    break-inside: avoid;
}

.print-hide {
    display: block;
}

/* Fees Phase 2 */
.fee-report-landscape .modern-table {
    min-width: 1000px;
}

.print-landscape {
    overflow: visible;
}

.print-landscape code {
    font-family: Consolas, monospace;
}

/* Print */
@media print {
    .print-btn-wrap {
        display: none;
    }

    body {
        background: #fff !important;
    }

    .pdf-page {
        margin: 0;
        padding: 0;
        max-width: 100%;
    }
}

@media (max-width: 1300px) {
    .dashboard-cards-grid {
        grid-template-columns: repeat(2, minmax(220px, 1fr));
    }

    .dashboard-panels-grid {
        grid-template-columns: 1fr;
    }

    .due-report-stats-grid {
        grid-template-columns: repeat(2, minmax(220px, 1fr));
    }
}

@media (max-width: 1200px) {
    .student-panel {
        grid-template-columns: 1fr;
    }

    .student-grid {
        grid-template-columns: repeat(2, minmax(180px, 1fr));
    }
}

@media (max-width: 900px) {
    .sidebar {
        width: 220px;
    }

    .main-area {
        margin-left: 220px;
        width: calc(100% - 220px);
    }

    .content-area {
        padding: 18px;
    }

    .report-letterhead-logo {
        width: 58px;
        height: 58px;
        min-width: 58px;
    }

    .report-letterhead-logo img {
        max-width: 50px;
        max-height: 50px;
    }

    .report-letterhead-text h1 {
        font-size: 18px;
    }
}

@media (max-width: 768px) {
    .report-letterhead-top {
        flex-direction: column;
        text-align: center;
    }

    .report-letterhead-logo {
        width: 56px;
        height: 56px;
        min-width: 56px;
    }

    .report-letterhead-logo img {
        max-width: 48px;
        max-height: 48px;
    }

    .report-letterhead-text h1 {
        font-size: 18px;
    }

    .report-letterhead-text .portal-name,
    .report-letterhead-text .report-name,
    .print-contact-line,
    .print-address-line {
        font-size: 12px;
    }
}

@media (max-width: 700px) {
    .admin-layout {
        display: block;
    }

    .sidebar {
        position: relative;
        width: 100%;
        height: auto;
        min-height: auto;
        max-height: none;
        overflow: visible;
        padding-bottom: 18px;
    }

    .sidebar-menu {
        padding-bottom: 12px;
    }

    .main-area {
        margin-left: 0;
        width: 100%;
    }

    .main-header {
        display: block;
    }

    .header-actions {
        margin-top: 14px;
    }

    .student-grid {
        grid-template-columns: 1fr;
    }

    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .toolbar-search {
        min-width: auto;
        width: 100%;
    }

    .dashboard-topbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .dashboard-cards-grid,
    .due-report-stats-grid {
        grid-template-columns: 1fr;
    }

    .header-btn,
    .toolbar-btn,
    .panel-btn,
    .dashboard-dark-btn {
        width: 100%;
        justify-content: center;
    }
}

@media print {
    body {
        background: #ffffff !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .sidebar,
    aside,
    .main-header,
    .header-actions,
    .dashboard-topbar,
    .content-card:first-of-type,
    .toolbar,
    .dashboard-date-chip,
    .sidebar-footer,
    .sidebar-brand-card,
    .no-print,
    .print-hide,
    .mobile-menu-btn,
    .mobile-actions-btn,
    .mobile-sidebar-overlay {
        display: none !important;
    }

    .admin-layout {
        display: block !important;
    }

    .main-area {
        margin-left: 0 !important;
        width: 100% !important;
        min-height: auto !important;
    }

    .content-area {
        padding: 0 !important;
        background: #ffffff !important;
    }

    .content-card,
    .dashboard-stat-card,
    .dashboard-panel-card {
        box-shadow: none !important;
        border: 1px solid #d1d5db !important;
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .dashboard-cards-grid,
    .due-report-stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }

    .modern-table {
        min-width: 100% !important;
    }

    .table-shell {
        overflow: visible !important;
    }

    .toolbar-btn,
    button,
    .header-btn {
        display: none !important;
    }

    a {
        text-decoration: none !important;
        color: #000 !important;
    }

    .print-landscape {
        width: 100% !important;
        box-shadow: none !important;
        border: none !important;
        border-radius: 0 !important;
    }

    .print-landscape .modern-table {
        min-width: 100% !important;
        font-size: 11px;
    }

    .print-landscape .modern-table thead th,
    .print-landscape .modern-table tbody td {
        padding: 6px 5px !important;
    }

    .report-letterhead {
        margin-bottom: 8px;
        padding: 0 0 8px !important;
    }

    .report-letterhead-logo {
        width: 52px !important;
        height: 52px !important;
        min-width: 52px !important;
        padding: 3px !important;
        border-radius: 10px !important;
    }

    .report-letterhead-logo img {
        max-width: 44px !important;
        max-height: 44px !important;
    }

    .report-letterhead-fallback {
        width: 42px !important;
        height: 42px !important;
        font-size: 16px !important;
    }

    .report-letterhead-text h1 {
        font-size: 17px !important;
        margin-bottom: 1px !important;
    }

    .report-letterhead-text .portal-name,
    .report-letterhead-text .report-name,
    .print-contact-line,
    .print-address-line {
        font-size: 11px !important;
        margin-bottom: 1px !important;
        line-height: 1.2 !important;
    }

    .report-summary-cards {
        display: none !important;
    }

    .single-report-footer,
    .report-final-footer {
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }

    .report-final-footer {
        margin-top: 10px !important;
        padding-top: 8px !important;
        font-size: 10.5px !important;
    }

    @page {
        size: A4 landscape;
        margin: 10mm;
    }
}

/* Exam & Result Module */
.exam-helper-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
}

.exam-helper-strip > div {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 13px;
    color: #334155;
    font-weight: 700;
}

.exam-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(150px, 1fr));
    gap: 12px;
    margin-top: 16px;
    margin-bottom: 10px;
}

.exam-summary-box {
    border: 1px solid #dbe5f1;
    border-radius: 14px;
    background: #f8fbff;
    padding: 14px;
    text-align: center;
}

.exam-summary-title {
    font-size: 13px;
    color: #64748b;
    font-weight: 700;
    margin-bottom: 6px;
}

.exam-summary-number {
    font-size: 22px;
    color: #0f172a;
    font-weight: 800;
}

.exam-result-card-page .modern-table {
    min-width: 100%;
}

@media (max-width: 700px) {
    .exam-summary-grid {
        grid-template-columns: 1fr 1fr;
    }

    .exam-helper-strip > div {
        width: 100%;
    }
}
/* Portal Split Login */
.portal-login-body {
    min-height: 100vh;
    background: #eef3fb;
}
.portal-login-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.12fr 0.88fr;
}
.portal-login-brand {
    background: linear-gradient(135deg, #07142d 0%, #102b66 55%, #2144a3 100%);
    color: #fff;
    padding: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.portal-login-brand-inner { max-width: 620px; }
.portal-login-logo-wrap { width: 108px; height: 108px; background: #fff; border-radius: 22px; display:flex; align-items:center; justify-content:center; overflow:hidden; margin-bottom:24px; box-shadow:0 18px 44px rgba(0,0,0,.22); }
.portal-login-logo-wrap img { max-width:90px; max-height:90px; object-fit:contain; }
.portal-login-logo-fallback { width:84px; height:84px; border-radius:20px; background:linear-gradient(135deg,#7a1f65 0%,#3450ff 100%); color:#fff; display:flex; align-items:center; justify-content:center; font-size:26px; font-weight:800; }
.portal-login-kicker { display:inline-flex; min-height:34px; align-items:center; padding:0 14px; border-radius:999px; background:rgba(255,255,255,.12); border:1px solid rgba(255,255,255,.18); margin-bottom:14px; font-size:13px; font-weight:800; }
.portal-login-brand h1 { font-size:42px; line-height:1.1; margin-bottom:10px; font-weight:800; }
.portal-login-bigline { font-size:30px; font-weight:800; margin-bottom:8px; }
.portal-login-subline { font-size:21px; font-weight:700; color:#dbeafe; margin-bottom:18px; }
.portal-login-brand p { font-size:16px; line-height:1.85; color:rgba(255,255,255,.92); margin-bottom:18px; }
.portal-login-points { list-style:none; display:grid; gap:12px; }
.portal-login-points li { display:flex; gap:10px; align-items:flex-start; line-height:1.6; font-size:15px; }
.portal-login-points li::before { content:"✓"; width:22px; min-width:22px; height:22px; border-radius:999px; display:inline-flex; align-items:center; justify-content:center; background:rgba(255,255,255,.16); font-size:12px; font-weight:800; margin-top:2px; }
.portal-login-footer-note { display:flex; flex-wrap:wrap; gap:10px; margin-top:24px; color:rgba(255,255,255,.82); font-size:13px; line-height:1.7; }
.portal-login-panel { padding:28px; display:flex; align-items:center; justify-content:center; }
.portal-login-card { width:100%; max-width:460px; background:#fff; border:1px solid #e5edf7; border-radius:24px; padding:30px; box-shadow:0 16px 40px rgba(15,23,42,.09); }
.portal-login-card-head { margin-bottom:20px; }
.portal-login-card-head h2 { font-size:30px; font-weight:800; color:#0f172a; margin-bottom:4px; }
.portal-login-card-head p { font-size:14px; color:#64748b; }
.portal-login-switch { margin-top:18px; text-align:center; }
.portal-login-switch a { color:#1d4ed8; font-weight:700; }

/* Teacher Portal */
.teacher-portal-page { background:#f3f6fb; }
.teacher-portal-shell { min-height:100vh; display:flex; }
.teacher-portal-sidebar { width:270px; min-width:270px; background:linear-gradient(180deg,#07142d 0%,#0f2556 100%); color:#fff; padding:18px 16px; display:flex; flex-direction:column; position:fixed; left:0; top:0; bottom:0; overflow-y:auto; }
.teacher-portal-brand { display:flex; align-items:center; gap:12px; background:rgba(255,255,255,.08); border-radius:18px; padding:12px; margin-bottom:16px; }
.teacher-portal-logo { width:58px; height:58px; border-radius:14px; background:#fff; display:flex; align-items:center; justify-content:center; overflow:hidden; }
.teacher-portal-logo img { max-width:46px; max-height:46px; object-fit:contain; }
.teacher-portal-brand-title { font-size:15px; font-weight:800; }
.teacher-portal-brand-subtitle { font-size:12px; color:#c7d2fe; }
.teacher-portal-nav { display:flex; flex-direction:column; gap:8px; flex:1 1 auto; }
.teacher-portal-nav a { display:flex; align-items:center; min-height:46px; padding:0 14px; border-radius:12px; color:#fff; background:rgba(255,255,255,.06); border:1px solid rgba(255,255,255,.08); font-weight:700; }
.teacher-portal-nav a.active { background:#dff4ff; color:#0f172a; }
.teacher-portal-sidefoot { margin-top:16px; border-top:1px solid rgba(255,255,255,.12); padding-top:14px; color:rgba(255,255,255,.88); }
.teacher-portal-sidefoot small { display:block; margin-top:6px; color:rgba(255,255,255,.62); }
.teacher-portal-main { margin-left:270px; width:calc(100% - 270px); min-height:100vh; display:flex; flex-direction:column; }
.teacher-portal-topbar { background:#fff; border-bottom:1px solid #e5edf7; padding:14px 18px; display:flex; gap:16px; align-items:center; justify-content:space-between; position:sticky; top:0; z-index:20; }
.teacher-portal-titlebox { display:flex; align-items:center; gap:12px; }
.teacher-portal-titlebox h1 { font-size:24px; margin-bottom:3px; color:#0f172a; }
.teacher-portal-titlebox p { color:#64748b; font-size:14px; }
.teacher-portal-topactions { display:flex; gap:10px; flex-wrap:wrap; }
.teacher-portal-topactions a { min-height:40px; padding:0 14px; display:inline-flex; align-items:center; justify-content:center; border-radius:10px; background:#0f172a; color:#fff; font-weight:700; }
.teacher-portal-topactions a.danger { background:#ef4444; }
.teacher-portal-content { padding:18px; padding-bottom:100px; }
.teacher-portal-footer { margin-top:auto; border-top:1px solid #dbe5f1; background:#fff; padding:12px 16px; display:flex; flex-wrap:wrap; justify-content:center; gap:10px; color:#334155; font-size:13px; }
.teacher-portal-menu-btn { display:none; min-height:42px; min-width:42px; padding:0 12px; border-radius:12px; border:none; background:#0f172a; color:#fff; font-weight:800; cursor:pointer; }

@media (max-width: 980px) {
    .portal-login-shell { grid-template-columns:1fr; }
    .portal-login-brand { padding:26px 20px; }
    .portal-login-panel { padding:18px; }
    .portal-login-brand h1 { font-size:34px; }
    .portal-login-bigline { font-size:24px; }
}
@media (max-width: 900px) {
    .teacher-portal-menu-btn { display:inline-flex; align-items:center; justify-content:center; }
    .teacher-portal-sidebar { transform:translateX(-100%); transition:transform .25s ease; z-index:1200; }
    .teacher-portal-main { margin-left:0; width:100%; }
    body.teacher-portal-nav-open .teacher-portal-sidebar { transform:translateX(0); }
}
@media (max-width: 640px) {
    .portal-login-brand { padding:22px 16px; }
    .portal-login-panel { padding:14px; }
    .portal-login-card { padding:22px 18px; border-radius:18px; }
    .portal-login-brand h1 { font-size:28px; }
    .portal-login-bigline { font-size:21px; }
    .portal-login-subline { font-size:17px; }
    .teacher-portal-topbar { flex-direction:column; align-items:stretch; }
    .teacher-portal-topactions { width:100%; }
    .teacher-portal-topactions a { flex:1 1 calc(50% - 5px); }
}
