/* Shared Faculty and Student dark-mode contrast fixes. */
body.dark-theme {
    background: #020817 !important;
    color: #e2e8f0;
}

body.dark-theme .content,
body.dark-theme main,
body.dark-theme .page,
body.dark-theme .container,
body.dark-theme .topbar,
body.dark-theme .user-pill,
body.dark-theme .panel,
body.dark-theme .card,
body.dark-theme .section,
body.dark-theme .report-card,
body.dark-theme .report-section,
body.dark-theme .form-card,
body.dark-theme .form-container,
body.dark-theme .modal-content,
body.dark-theme .modal-dialog,
body.dark-theme .book-card,
body.dark-theme .book-detail,
body.dark-theme .category-section,
body.dark-theme .empty,
body.dark-theme .empty-state,
body.dark-theme .summary-card,
body.dark-theme .borrow-panel,
body.dark-theme .profile-grid > *,
body.dark-theme .settings-layout > *,
body.dark-theme .settings-stack > *,
body.dark-theme .login-box,
body.dark-theme .form-box,
body.dark-theme .register-box,
body.dark-theme .policy-box {
    background-color: #0f172a;
    color: #e2e8f0;
    border-color: rgba(148, 163, 184, 0.28);
}

body.dark-theme .brand h1,
body.dark-theme .brand p,
body.dark-theme .helper,
body.dark-theme .role-links,
body.dark-theme .policy-check,
body.dark-theme .message,
body.dark-theme .form-box a,
body.dark-theme .login-box a,
body.dark-theme .register-box a {
    color: #cbd5e1;
}

body.dark-theme .role-badge {
    background-color: #1e293b;
    color: #bfdbfe;
    border-color: #475569;
}

body.dark-theme .policy-box,
body.dark-theme .message,
body.dark-theme .alert {
    background-image: none;
}

body.dark-theme h1,
body.dark-theme h2,
body.dark-theme h3,
body.dark-theme h4,
body.dark-theme h5,
body.dark-theme h6,
body.dark-theme label,
body.dark-theme strong,
body.dark-theme th,
body.dark-theme td,
body.dark-theme .title,
body.dark-theme .book-title,
body.dark-theme .book-card h3,
body.dark-theme .section-title,
body.dark-theme .report-section h2 {
    color: #e2e8f0;
}

body.dark-theme p,
body.dark-theme small,
body.dark-theme .muted,
body.dark-theme .subtitle,
body.dark-theme .description,
body.dark-theme .book-author,
body.dark-theme .book-detail span,
body.dark-theme .panel-subtitle,
body.dark-theme .empty-state,
body.dark-theme .help-text {
    color: #a7b4c5;
}

body.dark-theme table {
    background-color: #0f172a;
    color: #e2e8f0;
    border-color: rgba(148, 163, 184, 0.28);
}

body.dark-theme th {
    background-color: #1e293b;
    color: #cbd5e1;
}

body.dark-theme td,
body.dark-theme tr,
body.dark-theme .table-wrap {
    border-color: rgba(148, 163, 184, 0.24);
}

body.dark-theme tbody tr:nth-child(even) {
    background-color: rgba(30, 41, 59, 0.5);
}

body.dark-theme input,
body.dark-theme select,
body.dark-theme textarea,
body.dark-theme input[type="date"],
body.dark-theme input[type="month"],
body.dark-theme input[type="search"] {
    background-color: #111827;
    color: #f8fafc;
    border-color: #475569;
}

body.dark-theme input::placeholder,
body.dark-theme textarea::placeholder {
    color: #94a3b8;
    opacity: 1;
}

body.dark-theme option {
    background-color: #111827;
    color: #f8fafc;
}

body.dark-theme a:not(.sidebar a):not(.primary-btn):not(.secondary-btn):not(.action-btn):not(.report-tab-btn) {
    color: #93c5fd;
}

body.dark-theme .alert,
body.dark-theme .alert-success,
body.dark-theme .alert-error,
body.dark-theme .alert-warning,
body.dark-theme .alert-info,
body.dark-theme .notice,
body.dark-theme .flash-message {
    background-color: #334155;
    color: #f8fafc;
    border-color: rgba(148, 163, 184, 0.3);
}

body.dark-theme .alert-success {
    background-color: #14532d;
    color: #dcfce7;
}

body.dark-theme .alert-error {
    background-color: #7f1d1d;
    color: #fee2e2;
}

body.dark-theme .alert-warning {
    background-color: #78350f;
    color: #fef3c7;
}

body.dark-theme .alert-info {
    background-color: #164e63;
    color: #cffafe;
}

body.dark-theme .status-badge,
body.dark-theme .badge,
body.dark-theme .count,
body.dark-theme .tag {
    border-color: rgba(148, 163, 184, 0.32);
}

body.dark-theme .extension-form,
body.dark-theme .filter-bar,
body.dark-theme .search-box,
body.dark-theme .form-row,
body.dark-theme .form-section {
    background-color: #111827;
    border-color: rgba(148, 163, 184, 0.28);
    color: #e2e8f0;
}

body.dark-theme .category-link,
body.dark-theme .index a,
body.dark-theme .category-index a {
    background: #1e293b !important;
    border-color: #64748b !important;
    color: #f8fafc !important;
}

body.dark-theme .category-link span,
body.dark-theme .index a span,
body.dark-theme .category-index a span {
    background: #334155 !important;
    color: #f8fafc !important;
}

body.dark-theme .login-box {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

body.dark-theme button:not(.theme-toggle) {
    color: #f8fafc;
}

body.dark-theme .book-cover-placeholder,
body.dark-theme .copy-stat {
    background: linear-gradient(135deg, #172554, #134e4a) !important;
    color: #e2e8f0 !important;
    border-color: #475569 !important;
}

body.dark-theme .copy-stat span,
body.dark-theme .copy-stat strong {
    color: #e2e8f0 !important;
}

.panel {
    border-top: 3px solid #0d9488 !important;
    box-shadow: 0 12px 26px rgba(15, 23, 42, 0.08) !important;
}

.panel table thead th {
    background: linear-gradient(135deg, #0f766e, #0891b2) !important;
    color: #ffffff !important;
    border-bottom-color: #0f766e !important;
}

.panel table tbody tr:nth-child(even) {
    background: #f0fdfa;
}

body.dark-theme .panel {
    border-top-color: #2dd4bf !important;
    box-shadow: 0 14px 30px rgba(2, 6, 23, 0.45) !important;
}

body.dark-theme .panel table tbody tr:nth-child(even) {
    background: rgba(20, 78, 74, 0.35) !important;
}

@media (max-width: 760px) {
    .layout { display: block !important; }
    .sidebar { width: 100% !important; min-height: auto !important; }
    .content { min-width: 0 !important; padding: 22px 14px 30px !important; }
    .panel, .table-wrap, .table-container, .table-wrapper { max-width: 100%; overflow-x: auto; }
    table { min-width: 620px; }
    form, .grid, .form-grid, .borrow-grid { max-width: 100%; }
    input, select, textarea, button { max-width: 100%; }
}

@media print {
    body.dark-theme,
    body.dark-theme .content,
    body.dark-theme .panel,
    body.dark-theme table {
        background: #fff !important;
        color: #000 !important;
    }

    body.dark-theme th,
    body.dark-theme td,
    body.dark-theme h1,
    body.dark-theme h2,
    body.dark-theme h3,
    body.dark-theme p {
        color: #000 !important;
    }
}
