/* ==========================================================================
   University Repository Portal - Master Stylesheet
   Replicating exact layout, colors, typography, and UI elements from specification
   ========================================================================== */

:root {
    /* Theme Colors */
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #eff6ff;
    --sidebar-bg: #ffffff;
    --sidebar-hover: #f1f5f9;
    --sidebar-active: #eff6ff;
    --sidebar-text: #475569;
    --sidebar-text-active: #2563eb;
    --sidebar-border: #e2e8f0;
    
    /* Backgrounds & Surface */
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --border-color: #e2e8f0;
    --border-light: #f1f5f9;
    
    /* Text Colors */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    
    /* Status Colors */
    --status-verification-bg: #fef3c7;
    --status-verification-text: #b45309;
    --status-returned-bg: #fee2e2;
    --status-returned-text: #b91c1c;
    --status-approved-bg: #dcfce7;
    --status-approved-text: #15803d;
    --status-draft-bg: #f1f5f9;
    --status-draft-text: #475569;
    
    /* KPI Card Colors */
    --kpi-blue-bg: #eff6ff;
    --kpi-blue-border: #dbeafe;
    --kpi-blue-icon: #2563eb;
    
    --kpi-amber-bg: #fef3c7;
    --kpi-amber-border: #fde68a;
    --kpi-amber-icon: #d97706;
    
    --kpi-red-bg: #fee2e2;
    --kpi-red-border: #fecaca;
    --kpi-red-icon: #dc2626;
    
    --kpi-green-bg: #dcfce7;
    --kpi-green-border: #bbf7d0;
    --kpi-green-icon: #16a34a;

    /* Fonts & Radii */
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-full: 9999px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
}

/* Reset and base */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-main);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    line-height: 1.5;
    overflow-x: hidden;
    height: 100vh;
}

/* Layout Container */
.app-layout {
    display: flex;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

/* ==========================================================================
   SIDEBAR (White Theme)
   ========================================================================== */
.sidebar {
    width: 250px;
    min-width: 250px;
    background-color: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 24px 16px 20px 16px;
    color: var(--sidebar-text);
    border-right: 1px solid var(--sidebar-border);
    box-shadow: 1px 0 3px rgba(0, 0, 0, 0.02);
    z-index: 40;
    transition: width 0.2s ease;
    overflow-y: auto;
}

/* Sidebar Brand */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 8px 24px 8px;
    text-decoration: none;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 12px;
}

.brand-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    background: #eff6ff;
    border: 1px solid #dbeafe;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #2563eb;
}

.brand-icon svg {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.brand-text {
    display: flex;
    flex-direction: column;
}

.brand-title {
    font-size: 16.5px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.2px;
    color: #0f172a;
}

.brand-subtitle {
    font-size: 14.5px;
    font-weight: 600;
    line-height: 1.2;
    color: #2563eb;
}

/* Sidebar Nav */
.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s ease;
    cursor: pointer;
    position: relative;
}

.nav-item:hover {
    background-color: var(--sidebar-hover);
    color: #0f172a;
}

.nav-item.active {
    background-color: var(--sidebar-active);
    color: var(--primary);
    font-weight: 600;
}

.nav-item svg {
    width: 19px;
    height: 19px;
    stroke-width: 2;
    flex-shrink: 0;
    color: inherit;
}

.nav-badge {
    margin-left: auto;
    background: #e2e8f0;
    color: #475569;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-weight: 600;
}

.nav-item.active .nav-badge {
    background: #dbeafe;
    color: #1e40af;
}

.nav-badge.danger {
    background: #fee2e2;
    color: #dc2626;
}

/* Sidebar Footer / Logout */
.sidebar-footer {
    padding-top: 16px;
    border-top: 1px solid var(--border-light);
}

.logout-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    color: #64748b;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s ease;
    cursor: pointer;
}

.logout-link svg {
    width: 19px;
    height: 19px;
    stroke-width: 2;
    flex-shrink: 0;
}

.logout-link:hover {
    background-color: #fee2e2;
    color: #dc2626;
}

/* ==========================================================================
   MAIN CONTENT AREA
   ========================================================================== */
.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow-y: auto;
    background-color: var(--bg-main);
}

/* Top Navbar */
.top-navbar {
    height: 64px;
    min-height: 64px;
    background-color: #ffffff;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 30;
}

/* Global Search */
.search-box-container {
    position: relative;
    width: 360px;
}

.search-icon-nav {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    width: 17px;
    height: 17px;
    pointer-events: none;
}

.global-search-input {
    width: 100%;
    height: 38px;
    padding: 0 14px 0 38px;
    background-color: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    color: var(--text-primary);
    outline: none;
    transition: all 0.2s ease;
}

.global-search-input:focus {
    border-color: var(--primary);
    background-color: #ffffff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Nav Actions Right */
.navbar-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Interactive Role Switcher for Client Demo */
.role-switcher-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f1f5f9;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    padding: 4px 12px 4px 10px;
    cursor: pointer;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-secondary);
    transition: all 0.15s ease;
}

.role-switcher-badge:hover {
    background: #e2e8f0;
}

.role-tag-pill {
    background: #2563eb;
    color: white;
    font-size: 10.5px;
    padding: 1px 7px;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    font-weight: 700;
}

/* Notification Bell */
.notification-btn {
    position: relative;
    background: none;
    border: none;
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    border-radius: var(--radius-full);
    transition: background 0.15s ease;
}

.notification-btn:hover {
    background: #f1f5f9;
}

.notification-btn svg {
    width: 20px;
    height: 20px;
    stroke-width: 2;
}

.notification-dot {
    position: absolute;
    top: 6px;
    right: 7px;
    width: 8px;
    height: 8px;
    background-color: #ef4444;
    border-radius: 50%;
    border: 2px solid #ffffff;
}

/* User Profile Badge */
.user-profile-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: var(--radius-md);
    transition: background 0.15s ease;
}

.user-profile-badge:hover {
    background: #f8fafc;
}

.user-avatar-circle {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background-color: #3b82f6;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}

.user-role-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.chevron-icon {
    width: 14px;
    height: 14px;
    color: var(--text-muted);
}

/* ==========================================================================
   VIEW CONTAINER & HEADINGS
   ========================================================================== */
.main-content {
    padding: 28px;
    max-width: 1380px;
    margin: 0 auto;
    width: 100%;
}

.view-section {
    display: none;
    animation: fadeIn 0.2s ease-in-out;
}

.view-section.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Page Header */
.dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.welcome-title-group h1 {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
    line-height: 1.2;
}

.welcome-title-group p {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Primary Button */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background-color: var(--primary);
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(37, 99, 235, 0.2);
    transition: all 0.15s ease;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.3);
}

.btn-primary svg {
    width: 16px;
    height: 16px;
    stroke-width: 2.5;
}

/* Secondary Button */
.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background-color: #ffffff;
    color: var(--text-secondary);
    font-size: 13.5px;
    font-weight: 500;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-secondary:hover {
    background-color: #f8fafc;
    border-color: #cbd5e1;
    color: var(--text-primary);
}

/* ==========================================================================
   KPI SUMMARY CARDS
   ========================================================================== */
.kpi-cards-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 28px;
}

.kpi-card {
    border-radius: var(--radius-lg);
    padding: 22px 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 130px;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    border: 1px solid transparent;
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.kpi-card-blue {
    background-color: var(--kpi-blue-bg);
    border-color: var(--kpi-blue-border);
}

.kpi-card-amber {
    background-color: var(--kpi-amber-bg);
    border-color: var(--kpi-amber-border);
}

.kpi-card-red {
    background-color: var(--kpi-red-bg);
    border-color: var(--kpi-red-border);
}

.kpi-card-green {
    background-color: var(--kpi-green-bg);
    border-color: var(--kpi-green-border);
}

.kpi-icon-wrapper {
    margin-bottom: 12px;
}

.kpi-icon-wrapper svg {
    width: 26px;
    height: 26px;
    stroke-width: 2;
}

.kpi-card-blue svg { color: var(--kpi-blue-icon); }
.kpi-card-amber svg { color: var(--kpi-amber-icon); }
.kpi-card-red svg { color: var(--kpi-red-icon); }
.kpi-card-green svg { color: var(--kpi-green-icon); }

.kpi-value {
    font-size: 30px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.1;
    margin-bottom: 4px;
}

.kpi-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}

/* ==========================================================================
   DATA TABLE CARD (Exact replica of image)
   ========================================================================== */
.table-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 28px;
    overflow: hidden;
}

.table-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-light);
    gap: 16px;
    flex-wrap: wrap;
}

.table-card-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.table-filters-group {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.select-filter {
    height: 36px;
    padding: 0 32px 0 12px;
    background-color: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    color: var(--text-secondary);
    outline: none;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 14px;
    transition: border-color 0.15s ease;
}

.select-filter:focus {
    border-color: var(--primary);
}

.table-search-box {
    position: relative;
    width: 220px;
}

.table-search-box input {
    width: 100%;
    height: 36px;
    padding: 0 12px 0 34px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    color: var(--text-primary);
    outline: none;
}

.table-search-box input:focus {
    border-color: var(--primary);
}

.table-search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    width: 15px;
    height: 15px;
}

/* Table Style */
.table-responsive {
    overflow-x: auto;
    width: 100%;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 14px;
}

.data-table th {
    padding: 14px 24px;
    background-color: #fafbfc;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 12.5px;
    text-transform: capitalize;
    border-bottom: 1px solid var(--border-color);
    letter-spacing: 0.1px;
    white-space: nowrap;
}

.data-table td {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-primary);
    vertical-align: middle;
}

.data-table tr:hover td {
    background-color: #fbfcfe;
}

.col-num {
    color: var(--text-muted);
    font-weight: 500;
    width: 48px;
}

/* File Title Cell with File Type Badges */
.file-title-cell {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
    color: var(--text-primary);
}

.file-type-badge {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.3px;
    flex-shrink: 0;
    text-transform: uppercase;
}

.badge-pdf {
    background-color: #ef4444;
    color: #ffffff;
}

.badge-doc {
    background-color: #2563eb;
    color: #ffffff;
}

.badge-xls {
    background-color: #10b981;
    color: #ffffff;
}

/* Status Badges */
.status-pill {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 12.5px;
    font-weight: 600;
    white-space: nowrap;
}

.status-under-verification {
    background-color: var(--status-verification-bg);
    color: var(--status-verification-text);
}

.status-returned {
    background-color: var(--status-returned-bg);
    color: var(--status-returned-text);
}

.status-approved {
    background-color: var(--status-approved-bg);
    color: var(--status-approved-text);
}

.status-draft {
    background-color: var(--status-draft-bg);
    color: var(--status-draft-text);
}

/* Current Stage */
.stage-text {
    font-size: 13.5px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Action Buttons */
.action-buttons-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-action-view {
    background-color: var(--primary-light);
    color: var(--primary);
    border: none;
    border-radius: var(--radius-sm);
    padding: 6px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-action-view:hover {
    background-color: #dbeafe;
}

.btn-action-edit {
    background-color: #f1f5f9;
    color: var(--text-secondary);
    border: none;
    border-radius: var(--radius-sm);
    padding: 6px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-action-edit:hover {
    background-color: #e2e8f0;
    color: var(--text-primary);
}

.btn-more-dots {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: background 0.15s ease;
}

.btn-more-dots:hover {
    background-color: #f1f5f9;
    color: var(--text-primary);
}

/* ==========================================================================
   BOTTOM ROW: DONUT CHART & RECENT ACTIVITY
   ========================================================================== */
.bottom-analytics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.card-widget {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 24px;
}

.card-widget-title {
    font-size: 16.5px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 20px;
}

/* Donut Chart Container */
.donut-chart-container {
    display: flex;
    align-items: center;
    justify-content: space-around;
    min-height: 180px;
}

.chart-svg-wrap {
    position: relative;
    width: 170px;
    height: 170px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.donut-center-text {
    position: absolute;
    text-align: center;
    pointer-events: none;
}

.donut-center-num {
    font-size: 24px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
}

.donut-center-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    margin-top: 3px;
}

.donut-legend {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.legend-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    font-size: 13.5px;
}

.legend-label-group {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary);
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.dot-yellow { background-color: #f59e0b; }
.dot-red { background-color: #ef4444; }
.dot-green { background-color: #10b981; }

.legend-count {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 14px;
}

/* Recent Activity Feed */
.activity-list {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.activity-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    font-size: 13.5px;
}

.activity-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.activity-icon-bubble {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.activity-icon-bubble.blue {
    background-color: var(--kpi-blue-bg);
    color: var(--primary);
}

.activity-icon-bubble.red {
    background-color: var(--kpi-red-bg);
    color: #ef4444;
}

.activity-icon-bubble.green {
    background-color: var(--kpi-green-bg);
    color: #10b981;
}

.activity-icon-bubble svg {
    width: 17px;
    height: 17px;
}

.activity-desc {
    color: var(--text-primary);
    font-weight: 500;
}

.activity-time {
    color: var(--text-muted);
    font-size: 12px;
    white-space: nowrap;
}

/* ==========================================================================
   FORM & MODALS (Upload Document, Evidence Preview, Return Reason)
   ========================================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    padding: 20px;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-dialog {
    background: #ffffff;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 820px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    transform: scale(0.96);
    transition: transform 0.2s ease;
    overflow: hidden;
}

.modal-overlay.active .modal-dialog {
    transform: scale(1);
}

.modal-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #ffffff;
}

.modal-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-close-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close-btn:hover {
    background: #f1f5f9;
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    background: #fafbfc;
}

/* Form Groups & Controls */
.form-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-label .req {
    color: #ef4444;
}

.form-control {
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    color: var(--text-primary);
    background: #ffffff;
    outline: none;
    transition: all 0.15s ease;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

textarea.form-control {
    height: auto;
    min-height: 80px;
    padding: 10px 12px;
    resize: vertical;
}

/* Auto-fetch Profile Banner (Section 5.1 & 6.1) */
.profile-autofetch-card {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 8px;
}

.autofetch-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.autofetch-label {
    font-size: 11px;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--text-muted);
}

.autofetch-val {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* File Upload Drag & Drop Area */
.dropzone-area {
    border: 2px dashed #cbd5e1;
    border-radius: var(--radius-md);
    padding: 24px;
    text-align: center;
    background-color: #fafbfc;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.dropzone-area:hover {
    border-color: var(--primary);
    background-color: var(--primary-light);
}

.dropzone-icon {
    width: 36px;
    height: 36px;
    color: var(--primary);
}

.dropzone-text-primary {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.dropzone-text-secondary {
    font-size: 12px;
    color: var(--text-muted);
}

/* Status Timeline */
.timeline-track {
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: relative;
    padding-left: 28px;
    margin: 12px 0;
}

.timeline-track::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 6px;
    bottom: 6px;
    width: 2px;
    background: var(--border-color);
}

.timeline-point {
    position: relative;
}

.timeline-marker {
    position: absolute;
    left: -28px;
    top: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #ffffff;
    border: 3px solid var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.timeline-marker.done {
    background: #10b981;
    border-color: #10b981;
}

.timeline-marker.returned {
    background: #ef4444;
    border-color: #ef4444;
}

.timeline-content-group {
    display: flex;
    flex-direction: column;
}

.timeline-step-title {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--text-primary);
}

.timeline-step-meta {
    font-size: 12px;
    color: var(--text-muted);
}

.timeline-step-comment {
    margin-top: 4px;
    padding: 8px 12px;
    background: #f8fafc;
    border-left: 3px solid #cbd5e1;
    border-radius: 4px;
    font-size: 12.5px;
    color: var(--text-secondary);
}

.timeline-step-comment.danger {
    background: #fef2f2;
    border-left-color: #ef4444;
    color: #991b1b;
}

/* Certificate Preview Display */
.cert-preview-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: #ffffff;
    padding: 24px;
    box-shadow: inset 0 0 12px rgba(0,0,0,0.03);
    border-top: 6px solid #2563eb;
    text-align: center;
    position: relative;
}

.cert-institution-name {
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 0.5px;
    color: #1e3a8a;
    text-transform: uppercase;
}

.cert-subhead {
    font-size: 12px;
    color: #64748b;
    margin-bottom: 16px;
}

.cert-recipient {
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
    border-bottom: 2px dashed #94a3b8;
    display: inline-block;
    padding-bottom: 4px;
    margin: 8px 0;
}

.cert-description {
    font-size: 13.5px;
    color: #334155;
    max-width: 500px;
    margin: 12px auto;
    line-height: 1.6;
}

.cert-footer-grid {
    display: flex;
    justify-content: space-between;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.cert-sig-block {
    text-align: center;
    font-size: 11px;
    color: #64748b;
}

/* Toast Notification */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background: #ffffff;
    border-left: 4px solid var(--primary);
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius-sm);
    padding: 14px 18px;
    min-width: 320px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13.5px;
    color: var(--text-primary);
    pointer-events: auto;
    animation: slideIn 0.25s ease-out;
}

.toast.success { border-left-color: #10b981; }
.toast.danger { border-left-color: #ef4444; }
.toast.warning { border-left-color: #f59e0b; }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Dropdown Menu (Context) */
.context-menu-popup {
    position: absolute;
    background: #ffffff;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    border-radius: var(--radius-md);
    padding: 6px 0;
    z-index: 50;
    min-width: 180px;
    display: none;
}

.context-menu-popup.active {
    display: block;
}

.context-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.15s ease;
}

.context-menu-item:hover {
    background: #f1f5f9;
    color: var(--text-primary);
}

/* Badges for Criteria */
.criteria-chip {
    display: inline-block;
    background: #f1f5f9;
    color: #0f172a;
    font-size: 11.5px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

/* Responsive */
@media (max-width: 1024px) {
    .kpi-cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .bottom-analytics-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -260px;
        top: 0;
        bottom: 0;
    }
    .sidebar.open {
        left: 0;
    }
    .kpi-cards-grid {
        grid-template-columns: 1fr;
    }
    .top-navbar {
        padding: 0 16px;
    }
    .search-box-container {
        width: 180px;
    }
    .profile-autofetch-card {
        grid-template-columns: 1fr 1fr;
    }
}


/* ==========================================================================
   UI / UX OVERHAUL & POLISH
   ========================================================================== */

/* Enhanced Header Academic Badge */
.header-badges-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 6px;
    flex-wrap: wrap;
}

.academic-cycle-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
    font-size: 11.5px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: var(--radius-full);
}

.academic-cycle-badge svg {
    width: 13px;
    height: 13px;
}

.erp-sync-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f8fafc;
    color: #475569;
    border: 1px solid #e2e8f0;
    font-size: 11.5px;
    font-weight: 500;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all 0.15s ease;
}

.erp-sync-badge:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.erp-sync-badge svg {
    width: 12px;
    height: 12px;
}

.spin-anim {
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    100% { transform: rotate(360deg); }
}

/* Keyboard Shortcut Hint in Search Box */
.search-kbd-hint {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 10px;
    font-weight: 700;
    color: #64748b;
    pointer-events: none;
    font-family: inherit;
}

/* Role Switcher with Live Pulse Dot */
.role-live-pulse {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background-color: #10b981;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.3);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
    70% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Interactive KPI Cards */
.kpi-card {
    cursor: pointer;
    user-select: none;
    position: relative;
    overflow: hidden;
}

.kpi-card::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: transparent;
    transition: background 0.2s ease;
}

.kpi-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.kpi-card.active-filter {
    outline: 2px solid var(--primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.18);
    transform: translateY(-2px);
}

.kpi-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.kpi-trend-pill {
    font-size: 10.5px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: var(--radius-full);
}

.trend-blue { background: #dbeafe; color: #1e40af; }
.trend-amber { background: #fef08a; color: #854d0e; }
.trend-red { background: #fee2e2; color: #991b1b; }
.trend-green { background: #dcfce7; color: #166534; }

/* Status Pill with Pulsing Indicators */
.status-pill {
    position: relative;
    padding-left: 20px !important;
}

.status-pill::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.status-under-verification::before {
    background-color: #d97706;
    box-shadow: 0 0 0 2px rgba(217, 119, 6, 0.25);
}

.status-returned::before {
    background-color: #dc2626;
    box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.25);
}

.status-approved::before {
    background-color: #16a34a;
    box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.25);
}

.status-draft::before {
    background-color: #64748b;
}

/* Sortable Table Headers */
.sortable-th {
    cursor: pointer;
    user-select: none;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.sortable-th:hover {
    background-color: #f1f5f9 !important;
    color: var(--text-primary) !important;
}

.sort-icon {
    display: inline-block;
    margin-left: 4px;
    font-size: 11px;
    color: var(--text-muted);
    opacity: 0.5;
}

.sortable-th.active-sort .sort-icon {
    color: var(--primary);
    opacity: 1;
    font-weight: 800;
}

/* Custom Checkbox */
.custom-checkbox {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
    border-radius: 4px;
    vertical-align: middle;
}

/* Table Row Active / Selected State */
.data-table tr.row-selected td {
    background-color: #eff6ff !important;
}

/* Table Pagination & Footer */
.table-footer-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    border-top: 1px solid var(--border-light);
    background-color: #fafbfc;
    font-size: 13px;
    color: var(--text-muted);
    flex-wrap: wrap;
    gap: 12px;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 16px;
}

.page-size-selector {
    display: flex;
    align-items: center;
    gap: 8px;
}

.select-filter-sm {
    height: 30px;
    padding: 0 8px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 12.5px;
    background: #ffffff;
    cursor: pointer;
}

.pagination-buttons {
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-page {
    height: 30px;
    padding: 0 10px;
    border: 1px solid var(--border-color);
    background: #ffffff;
    border-radius: var(--radius-sm);
    font-size: 12.5px;
    color: var(--text-primary);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-page:hover:not(:disabled) {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.btn-page:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.page-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: var(--radius-sm);
    font-size: 12.5px;
    font-weight: 600;
}

.page-number.active {
    background: var(--primary);
    color: #ffffff;
}

/* Floating Bulk Action Toolbar */
.floating-bulk-bar {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(120px);
    background: #0f172a;
    color: #ffffff;
    padding: 10px 18px;
    border-radius: var(--radius-full);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.25);
    display: flex;
    align-items: center;
    gap: 16px;
    z-index: 90;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
    opacity: 0;
    pointer-events: none;
}

.floating-bulk-bar.visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.bulk-count-pill {
    font-size: 13px;
    font-weight: 600;
    padding-right: 12px;
    border-right: 1px solid rgba(255, 255, 255, 0.2);
}

.bulk-actions-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-bulk-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.12);
    border: none;
    color: #ffffff;
    padding: 6px 12px;
    border-radius: var(--radius-full);
    font-size: 12.5px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease;
}

.btn-bulk-action:hover {
    background: rgba(255, 255, 255, 0.22);
}

.btn-bulk-action svg {
    width: 14px;
    height: 14px;
}

.btn-bulk-clear {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 12px;
    padding: 4px 8px;
}

.btn-bulk-clear:hover {
    color: #ffffff;
}

/* Quick Feedback Tags for Return Modal */
.quick-tags-wrap {
    background: #fafbfc;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px;
    margin-bottom: 12px;
}

.quick-tags-title {
    display: block;
    font-size: 11.5px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 8px;
}

.quick-tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.quick-tag {
    background: #ffffff;
    border: 1px solid #fecaca;
    color: #991b1b;
    font-size: 11.5px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}

.quick-tag:hover {
    background: #fee2e2;
    border-color: #ef4444;
    transform: translateY(-1px);
}

/* Certificate Preview Toolbar & Styling */
.cert-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.cert-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 700;
    color: #047857;
    background: #d1fae5;
    padding: 4px 10px;
    border-radius: var(--radius-full);
}

.cert-status-badge svg {
    width: 14px;
    height: 14px;
}

.cert-toolbar-actions {
    display: flex;
    gap: 8px;
}

.btn-cert-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-cert-action:hover {
    background: #f1f5f9;
    color: var(--text-primary);
}

.btn-cert-action svg {
    width: 13px;
    height: 13px;
}

/* Certificate Inner Framing & Watermark */
.cert-preview-card {
    background: radial-gradient(circle at center, #ffffff 60%, #fbfcfe 100%) !important;
    border: 2px solid #cbd5e1 !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06), inset 0 0 0 8px #f8fafc !important;
    padding: 30px !important;
}

/* Donut Slice Hover Interaction */
#donut-svg circle {
    cursor: pointer;
    transition: stroke-width 0.2s ease, opacity 0.2s ease;
}

#donut-svg circle:hover {
    stroke-width: 28;
    opacity: 0.9;
}

.donut-legend .legend-item {
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.15s ease;
}

.donut-legend .legend-item:hover {
    background: #f1f5f9;
}


/* ==========================================================================
   AUTHENTICATION & LOGIN PAGE
   ========================================================================== */
.login-screen-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.login-screen-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.login-container-card {
    background: #ffffff;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 460px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    animation: loginCardPop 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes loginCardPop {
    from { transform: scale(0.95) translateY(10px); opacity: 0; }
    to { transform: scale(1) translateY(0); opacity: 1; }
}

.login-header-banner {
    padding: 32px 32px 24px 32px;
    text-align: center;
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
    border-bottom: 1px solid var(--border-light);
}

.login-brand-logo {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #2563eb;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.15);
}

.login-brand-logo svg {
    width: 30px;
    height: 30px;
}

.login-title {
    font-size: 22px;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.3px;
    margin-bottom: 4px;
}

.login-subtitle {
    font-size: 13.5px;
    color: #64748b;
}

.login-body-form {
    padding: 28px 32px 32px 32px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.login-role-pills {
    display: flex;
    gap: 6px;
    background: #f1f5f9;
    padding: 4px;
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
}

.login-role-pill {
    flex: 1;
    text-align: center;
    padding: 6px 4px;
    font-size: 11.5px;
    font-weight: 600;
    color: #64748b;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}

.login-role-pill.active {
    background: #ffffff;
    color: #2563eb;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.login-input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.login-label {
    font-size: 12.5px;
    font-weight: 600;
    color: #334155;
    display: flex;
    justify-content: space-between;
}

.login-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.login-input-icon {
    position: absolute;
    left: 12px;
    width: 17px;
    height: 17px;
    color: #94a3b8;
    pointer-events: none;
}

.login-input {
    width: 100%;
    height: 42px;
    padding: 0 14px 0 38px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    color: #0f172a;
    outline: none;
    transition: all 0.15s ease;
}

.login-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.login-btn-submit {
    height: 44px;
    background: var(--primary);
    color: #ffffff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14.5px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.25);
    transition: all 0.15s ease;
    margin-top: 6px;
}

.login-btn-submit:hover {
    background: var(--primary-hover);
    box-shadow: 0 6px 10px -1px rgba(37, 99, 235, 0.35);
}

.login-footer-hint {
    font-size: 11.5px;
    color: #64748b;
    text-align: center;
    border-top: 1px solid var(--border-light);
    padding-top: 14px;
    margin-top: 8px;
}
