/* ================ Research Project Management System - Modern UI ================ */

/* ---------- CSS Variables / Design Tokens ---------- */
:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: #eef2ff;
    --secondary: #0ea5e9;
    --secondary-hover: #0284c7;
    --success: #16a34a;
    --success-light: #f0fdf4;
    --warning: #d97706;
    --warning-light: #fffbeb;
    --danger: #dc2626;
    --danger-light: #fef2f2;
    --info: #6366f1;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    --radius: 0.75rem;
    --radius-sm: 0.5rem;
    --shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);
    --transition: all .2s ease;
    /* Table zebra stripe colors */
    --stripe-even: #f8fafc;
    --stripe-odd: #ffffff;
    --row-hover: #eef2ff;
}

/* ---------- Global Reset & Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.6;
    margin: 0;
}

/* ---------- Modern Header/Navbar ---------- */
.navbar {
    background: linear-gradient(135deg, var(--gray-900) 0%, #1e3a5f 100%);
    color: white;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgb(0 0 0 / .18);
}
.navbar-brand {
    font-size: 1.25rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: .75rem;
    color: white;
    text-decoration: none;
}
.navbar-brand svg { width: 28px; height: 28px; }
.navbar-actions { display: flex; align-items: center; gap: .75rem; }
.navbar-user {
    font-size: .875rem;
    color: var(--gray-300);
    margin-right: .5rem;
}
.navbar-user-info {
    display: flex;
    align-items: center;
    gap: .625rem;
    margin-right: .25rem;
    padding: .375rem .75rem .375rem .375rem;
    border-radius: 9999px;
    background: rgba(255,255,255,.08);
    cursor: default;
    text-decoration: none;
}
.navbar-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255,255,255,.25);
    flex-shrink: 0;
}
.navbar-avatar-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    font-size: .8rem;
}
.navbar-user-details {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}
.navbar-user-name {
    font-size: .8125rem;
    font-weight: 600;
    color: #fff;
}
.navbar-user-role {
    font-size: .6875rem;
    color: var(--gray-400);
    text-transform: capitalize;
}

/* ---------- Hamburger Menu Button ---------- */
.hamburger-btn {
    display: none;
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: .375rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    flex-shrink: 0;
}
.hamburger-btn:hover { background: rgba(255,255,255,.12); }
.hamburger-btn svg { display: block; }
/* Sidebar overlay backdrop */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    top: 64px;
    background: rgba(0,0,0,.45);
    z-index: 149;
    opacity: 0;
    transition: opacity .25s ease;
}
.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* ---------- Sidebar ---------- */
.sidebar {
    width: 260px;
    background: linear-gradient(180deg, var(--gray-900) 0%, #162032 100%);
    min-height: calc(100vh - 64px);
    color: white;
    padding: 1.5rem 0;
    flex-shrink: 0;
    transition: transform .3s cubic-bezier(.4,0,.2,1);
    z-index: 150;
}
.sidebar a, .sidebar button {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .75rem 1.5rem;
    color: var(--gray-300);
    text-decoration: none;
    font-size: .875rem;
    transition: var(--transition);
    border: none;
    background: none;
    width: 100%;
    cursor: pointer;
    text-align: left;
}
.sidebar a:hover, .sidebar button:hover {
    background: rgba(255,255,255,.08);
    color: white;
}
.sidebar a.active, .sidebar button.active {
    background: rgba(79, 70, 229, .25);
    color: white;
    border-left: 3px solid var(--primary);
    padding-left: calc(1.5rem - 3px);
}
.sidebar .sidebar-label {
    text-transform: uppercase;
    font-size: .7rem;
    letter-spacing: .05em;
    color: var(--gray-500);
    padding: 1rem 1.5rem .5rem;
    font-weight: 600;
}

/* ---------- Layout ---------- */
.layout { display: flex; min-height: calc(100vh - 64px); }
.main-content {
    flex: 1;
    padding: 2rem;
    max-width: 1280px;
    margin: 0 auto;
    width: 100%;
}

/* ---------- Cards ---------- */
.card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    overflow: hidden;
}
.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 2px solid var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, #fafbff 0%, #f1f5ff 100%);
}
.card-header h2, .card-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0;
}
.card-body { padding: 1.5rem; }

/* ---------- Stat Cards ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    border-top: 3px solid var(--primary);
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    transition: var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.stat-icon {
    width: 48px; height: 48px;
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.stat-icon.blue { background: var(--primary-light); color: var(--primary); }
.stat-icon.green { background: var(--success-light); color: var(--success); }
.stat-icon.yellow { background: var(--warning-light); color: var(--warning); }
.stat-icon.red { background: var(--danger-light); color: var(--danger); }
.stat-icon.purple { background: #f5f3ff; color: #7c3aed; }
.stat-icon svg { width: 24px; height: 24px; }
.stat-value { font-size: 1.75rem; font-weight: 700; line-height: 1; color: var(--gray-900); }
.stat-label { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--gray-500); margin-top: .25rem; }

/* ---------- Tables ---------- */
.modern-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.modern-table thead { background: linear-gradient(135deg, var(--gray-800), #1e3a5f); }
.modern-table th {
    padding: .75rem 1rem;
    text-align: left;
    font-weight: 600;
    color: #e2e8f0;
    text-transform: uppercase;
    font-size: .75rem;
    letter-spacing: .05em;
    border-bottom: 2px solid var(--gray-700);
}
.modern-table td {
    padding: .75rem 1rem;
    border-bottom: 1px solid var(--gray-100);
    vertical-align: middle;
}
/* Zebra-striped alternating rows */
.modern-table tbody tr:nth-child(odd) { background: var(--stripe-odd); }
.modern-table tbody tr:nth-child(even) { background: var(--stripe-even); }
.modern-table tbody tr:hover { background: var(--row-hover); }
.modern-table tbody tr:last-child td { border-bottom: none; }
/* Responsive card-layout for tables on mobile */
@media (max-width: 768px) {
    .table-responsive-cards thead { display: none; }
    .table-responsive-cards tbody tr {
        display: block;
        margin-bottom: .75rem;
        border: 1px solid var(--gray-200);
        border-radius: var(--radius-sm);
        padding: .5rem;
        background: white !important;
        box-shadow: var(--shadow);
    }
    .table-responsive-cards tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: .375rem .625rem;
        border-bottom: 1px solid var(--gray-100);
        font-size: .8125rem;
    }
    .table-responsive-cards tbody td:last-child { border-bottom: none; }
    .table-responsive-cards tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--gray-600);
        text-transform: uppercase;
        font-size: .7rem;
        letter-spacing: .03em;
        margin-right: .75rem;
        flex-shrink: 0;
    }
}

/* ---------- Badges ---------- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: .2rem .6rem;
    font-size: .75rem;
    font-weight: 600;
    border-radius: 9999px;
    line-height: 1.4;
    white-space: nowrap;
}
.badge-blue { background: #dbeafe; color: #1d4ed8; border: 1px solid #93c5fd; }
.badge-green { background: #dcfce7; color: #15803d; border: 1px solid #86efac; }
.badge-yellow { background: #fef9c3; color: #a16207; border: 1px solid #fde047; }
.badge-red { background: #fee2e2; color: #b91c1c; border: 1px solid #fca5a5; }
.badge-purple { background: #ede9fe; color: #6d28d9; border: 1px solid #c4b5fd; }
.badge-gray { background: var(--gray-100); color: var(--gray-600); border: 1px solid var(--gray-300); }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .5rem 1rem;
    font-size: .875rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    line-height: 1.4;
    white-space: nowrap;
}
.btn:focus { outline: 2px solid var(--primary); outline-offset: 2px; }
.btn-sm { padding: .35rem .75rem; font-size: .8rem; }
.btn-xs { padding: .2rem .5rem; font-size: .75rem; }
.btn-primary { background: var(--primary); color: white; box-shadow: 0 1px 2px rgb(79 70 229 / .3); }
.btn-primary:hover { background: var(--primary-hover); box-shadow: 0 2px 6px rgb(79 70 229 / .35); }
.btn-secondary { background: var(--secondary); color: white; box-shadow: 0 1px 2px rgb(14 165 233 / .3); }
.btn-secondary:hover { background: var(--secondary-hover); }
.btn-success { background: var(--success); color: white; box-shadow: 0 1px 2px rgb(22 163 74 / .3); }
.btn-success:hover { background: #15803d; }
.btn-danger { background: var(--danger); color: white; box-shadow: 0 1px 2px rgb(220 38 38 / .3); }
.btn-danger:hover { background: #b91c1c; }
.btn-warning { background: var(--warning); color: white; box-shadow: 0 1px 2px rgb(217 119 6 / .3); }
.btn-warning:hover { background: #b45309; }
.btn-ghost { background: transparent; color: var(--gray-700); border: 1px solid var(--gray-300); }
.btn-ghost:hover { background: var(--gray-100); }
.btn-link { background: none; border: none; color: var(--primary); padding: 0; cursor: pointer; }
.btn-link:hover { text-decoration: underline; }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 1rem; }
.form-label {
    display: block;
    font-size: .875rem;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: .375rem;
}
.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: .625rem .875rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: .875rem;
    transition: var(--transition);
    background: white;
    color: var(--gray-800);
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, .15);
}
.form-textarea { resize: vertical; min-height: 100px; }
.form-help { font-size: .75rem; color: var(--gray-500); margin-top: .25rem; }

/* ---------- Alerts ---------- */
.alert {
    padding: .875rem 1rem;
    border-radius: var(--radius-sm);
    font-size: .875rem;
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-bottom: 1rem;
    position: relative;
}
.alert .alert-close {
    margin-left: auto;
    background: none;
    border: none;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    color: inherit;
    opacity: .6;
    padding: 0 .25rem;
}
.alert .alert-close:hover {
    opacity: 1;
}
.alert-success { background: #ecfdf5; border: 1px solid #6ee7b7; color: #065f46; }
.alert-warning { background: #fffbeb; border: 1px solid #fcd34d; color: #92400e; }
.alert-danger  { background: #fef2f2; border: 1px solid #fca5a5; color: #991b1b; }
.alert-error   { background: #fef2f2; border: 1px solid #fca5a5; color: #991b1b; }
.alert-info    { background: #eff6ff; border: 1px solid #93c5fd; color: #1e40af; }

/* ---------- Milestone / Deadline Indicators ---------- */
.badge-overdue { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; font-weight: 600; }
.badge-due-soon { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; font-weight: 600; }
.badge-completed-ms { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.overdue-indicator {
    display: inline-flex; align-items: center; gap: .2rem;
    padding: .1rem .4rem; border-radius: 999px;
    font-size: .7rem; font-weight: 600;
    background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5;
}
.milestone-row {
    display: grid; grid-template-columns: 1fr 140px 1fr auto;
    gap: .5rem; align-items: end; margin-bottom: .5rem;
}
.milestone-row .form-group { margin-bottom: 0; }

/* ---------- Modals ---------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    backdrop-filter: blur(4px);
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.modal-overlay.active { display: flex; }
.modal {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalIn .2s ease;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }
.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.modal-header h3 { margin: 0; font-size: 1.125rem; font-weight: 600; }
.modal-close {
    background: none; border: none; cursor: pointer;
    color: var(--gray-400); font-size: 1.5rem; line-height: 1;
    padding: .25rem; transition: var(--transition);
}
.modal-close:hover { color: var(--gray-700); }
.modal-body { padding: 1.5rem; }
.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--gray-100);
    display: flex;
    justify-content: flex-end;
    gap: .5rem;
}

/* ---------- Pagination ---------- */
.pagination-wrapper,
.pagination-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .875rem 1.25rem;
    border-top: 1px solid var(--gray-100);
    background: var(--gray-50);
}
.pagination-per-page {
    display: flex;
    align-items: center;
    gap: .375rem;
}
.pagination-select {
    width: auto;
    min-width: 60px;
    padding: .25rem .5rem;
    font-size: .8rem;
    height: 32px;
}
.pagination-ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    color: var(--gray-400);
    font-size: .875rem;
}
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .25rem;
}
.pagination button, .pagination a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 .5rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    background: white;
    color: var(--gray-700);
    font-size: .875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}
.pagination button:hover, .pagination a:hover {
    background: var(--gray-100);
    border-color: var(--gray-400);
}
.pagination button.active, .pagination a.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}
.pagination button:disabled, .pagination a:disabled,
.pagination a.disabled {
    opacity: .5;
    cursor: not-allowed;
    pointer-events: none;
}
.pagination-info {
    font-size: .8rem;
    color: var(--gray-500);
    white-space: nowrap;
}

/* ---------- Sortable Column Headers ---------- */
.sort-header {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    color: inherit;
    text-decoration: none;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}
.sort-header:hover { color: var(--primary); }
.sort-arrow {
    font-size: .75rem;
    opacity: .35;
    transition: opacity .15s ease;
}
.sort-arrow.active {
    opacity: 1;
    color: var(--primary);
}

/* ---------- Notification Items ---------- */
.notification-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--gray-100);
    transition: var(--transition);
}
.notification-item:hover { background: var(--gray-50); }
.notification-item:last-child { border-bottom: none; }
.notification-msg { font-size: .875rem; color: var(--gray-800); }
.notification-time { font-size: .75rem; color: var(--gray-400); margin-top: .25rem; }

/* ---------- Notification Bell & Dropdown ---------- */
.notif-bell-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
}
.notif-bell-btn {
    position: relative;
    background: none;
    border: none;
    cursor: pointer;
    color: rgba(255,255,255,.85);
    padding: .375rem;
    border-radius: 50%;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.notif-bell-btn:hover {
    color: #fff;
    background: rgba(255,255,255,.15);
}
.notif-badge {
    position: absolute;
    top: 0;
    right: 0;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--danger);
    color: #fff;
    font-size: .65rem;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    transform: translate(40%, -30%);
    box-shadow: 0 0 0 2px var(--gray-900);
    animation: notif-pulse 2s ease-in-out infinite;
    pointer-events: none;
}
@keyframes notif-pulse {
    0%, 100% { box-shadow: 0 0 0 2px var(--gray-900); }
    50% { box-shadow: 0 0 0 2px var(--gray-900), 0 0 0 6px rgba(220,38,38,.25); }
}
.notif-dropdown {
    position: absolute;
    top: calc(100% + .5rem);
    right: 0;
    width: 340px;
    max-height: 420px;
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--gray-200);
    display: none;
    flex-direction: column;
    z-index: 1050;
    overflow: hidden;
}
.notif-dropdown.open { display: flex; }
.notif-dropdown-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .75rem 1rem;
    border-bottom: 1px solid var(--gray-100);
    background: var(--gray-50);
}
.notif-dropdown-title {
    font-weight: 600;
    font-size: .9rem;
    color: var(--gray-800);
}
.notif-mark-all {
    background: none;
    border: none;
    cursor: pointer;
    font-size: .75rem;
    color: var(--primary);
    padding: .125rem .375rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}
.notif-mark-all:hover {
    background: var(--primary-light);
    color: var(--primary-hover);
}
.notif-dropdown-body {
    flex: 1;
    overflow-y: auto;
    max-height: 300px;
}
.notif-dropdown-body::-webkit-scrollbar { width: 5px; }
.notif-dropdown-body::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }
.notif-dropdown-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    color: var(--gray-400);
    font-size: .85rem;
    gap: .25rem;
}
.notif-dropdown-footer {
    padding: .5rem 1rem;
    text-align: center;
    border-top: 1px solid var(--gray-100);
    background: var(--gray-50);
}
.notif-dropdown-footer a {
    font-size: .8rem;
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}
.notif-dropdown-footer a:hover { text-decoration: underline; }

/* Individual notification items in dropdown */
.notif-item {
    display: flex;
    align-items: flex-start;
    gap: .625rem;
    padding: .75rem 1rem;
    border-bottom: 1px solid var(--gray-100);
    cursor: pointer;
    transition: var(--transition);
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--gray-50); }
.notif-item-unread { background: #eef2ff; }
.notif-item-unread:hover { background: #e0e7ff; }
.notif-item-dot {
    flex-shrink: 0;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-top: 5px;
    background: transparent;
}
.notif-item-unread .notif-item-dot { background: var(--primary); }
.notif-item-content { flex: 1; min-width: 0; }
.notif-item-msg {
    font-size: .8rem;
    color: var(--gray-700);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.notif-item-unread .notif-item-msg { color: var(--gray-900); font-weight: 500; }
.notif-item-time {
    font-size: .7rem;
    color: var(--gray-400);
    margin-top: .2rem;
}

/* ---------- Discussion / Comment Thread ---------- */
.comment-thread { display: flex; flex-direction: column; gap: .25rem; }
.comment-item {
    display: flex;
    gap: .75rem;
    padding: .75rem 0;
    border-bottom: 1px solid var(--gray-100);
}
.comment-item:last-child { border-bottom: none; }
.comment-reply { padding-top: .5rem; padding-bottom: .5rem; border-bottom: none; }
.comment-reply::before {
    content: '';
    position: absolute;
    left: -1rem;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--gray-200);
}
.comment-reply { position: relative; }
.comment-avatar { flex-shrink: 0; }
.comment-avatar-img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--gray-200);
}
.comment-avatar-placeholder {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    font-size: .8rem;
}
.comment-body { flex: 1; min-width: 0; }
.comment-header {
    display: flex;
    align-items: baseline;
    gap: .5rem;
    flex-wrap: wrap;
    margin-bottom: .25rem;
}
.comment-author { font-weight: 600; font-size: .875rem; color: var(--gray-900); }
.comment-time { font-size: .75rem; color: var(--gray-400); }
.comment-edited { font-size: .7rem; color: var(--gray-400); font-style: italic; }
.comment-text {
    font-size: .875rem;
    line-height: 1.6;
    color: var(--gray-700);
    word-break: break-word;
}
.comment-deleted-text { font-style: italic; color: var(--gray-400); }
.comment-actions {
    display: flex;
    align-items: center;
    gap: .125rem;
    margin-top: .375rem;
}
.comment-action-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: .75rem;
    color: var(--gray-400);
    padding: .125rem .5rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}
.comment-action-btn:hover { color: var(--primary); background: var(--primary-light); }
.comment-action-delete:hover { color: var(--danger); background: var(--danger-light); }
.comment-reply-form,
.comment-edit-form { margin-top: .5rem; }
.comment-reply-form .form-textarea,
.comment-edit-form .form-textarea { font-size: .8rem; padding: .5rem .75rem; }
.comment-form .form-textarea { min-height: 70px; }

/* ---------- Empty States ---------- */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--gray-400);
}
.empty-state svg { width: 48px; height: 48px; margin: 0 auto .75rem; opacity: .5; }
.empty-state p { font-size: .875rem; }

/* ---------- Section Titles ---------- */
.section-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: .5rem;
}

/* ---------- Auth Pages ---------- */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e3a5f 0%, #4f46e5 50%, #7c3aed 100%);
    padding: 1rem;
}
.auth-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 440px;
    padding: 2.5rem;
}
.auth-logo {
    text-align: center;
    margin-bottom: 2rem;
}
.auth-logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-900);
    margin: .5rem 0 0;
}
.auth-logo p { font-size: .875rem; color: var(--gray-500); margin-top: .25rem; }
.auth-divider {
    text-align: center;
    margin: 1.5rem 0;
    font-size: .8rem;
    color: var(--gray-400);
}

/* ---------- Responsive ---------- */

/* Tablet & below */
@media (max-width: 768px) {
    /* Show hamburger */
    .hamburger-btn { display: inline-flex; }

    /* Sidebar slides in from left as overlay */
    .sidebar {
        position: fixed;
        top: 64px;
        left: 0;
        bottom: 0;
        width: 260px;
        min-height: unset;
        transform: translateX(-100%);
        box-shadow: 4px 0 20px rgb(0 0 0 / .25);
        overflow-y: auto;
    }
    .sidebar.open { transform: translateX(0); }

    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .navbar { padding: 0 .75rem; gap: .5rem; }
    .navbar-brand { font-size: 1rem; gap: .5rem; }
    .navbar-brand svg { width: 22px; height: 22px; }
    .main-content { padding: 1rem; }
    .auth-card { padding: 1.5rem; }

    /* Navbar actions wrap */
    .navbar-actions { gap: .375rem; }
    .navbar-actions .btn-sm,
    .navbar-actions .btn-ghost { font-size: .7rem; padding: .25rem .5rem; }
    .navbar-user-details { display: none; }
    .navbar-user-info { padding: .25rem; background: none; }

    /* Notification dropdown full-width on mobile */
    .notif-dropdown {
        position: fixed;
        top: 64px;
        right: 0;
        left: 0;
        width: auto;
        max-height: calc(100vh - 80px);
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    /* Card header stacking */
    .card-header { flex-wrap: wrap; gap: .5rem; padding: 1rem 1rem; }
    .card-body { padding: 1rem; }

    /* Form layouts */
    .grid-2 { grid-template-columns: 1fr; }
    .milestone-row { grid-template-columns: 1fr; }

    /* Pagination compact */
    .pagination-wrapper { flex-direction: column; align-items: stretch; text-align: center; }
    .pagination-per-page { justify-content: center; }
    .pagination { justify-content: center; flex-wrap: wrap; }
    .pagination button, .pagination a { min-width: 32px; height: 32px; font-size: .8rem; }

    /* Modal full width */
    .modal { max-width: 100%; margin: .5rem; }
}

/* Phone */
@media (max-width: 480px) {
    .stat-grid { grid-template-columns: 1fr; }
    .navbar-brand span { display: none; }
    .card-header h2, .card-header h3 { font-size: .975rem; }
}

/* ---------- Utilities ---------- */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: .25rem; }
.gap-2 { gap: .5rem; }
.gap-3 { gap: .75rem; }
.gap-4 { gap: 1rem; }
.mt-1 { margin-top: .25rem; }
.mt-2 { margin-top: .5rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mb-2 { margin-bottom: .5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.ml-2 { margin-left: .5rem; }
.mr-2 { margin-right: .5rem; }
.p-4 { padding: 1rem; }
.text-sm { font-size: .875rem; }
.text-xs { font-size: .75rem; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.text-muted { color: var(--gray-500); }
.hidden { display: none !important; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.w-full { width: 100%; }
.inline { display: inline; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* ── Site-wide Footer ── */
.site-footer {
    background: linear-gradient(160deg, #0f172a 0%, #1a2744 55%, #1e3a5f 100%);
    color: #94a3b8;
    font-size: .83rem;
    line-height: 1.6;
    margin-top: auto;
    position: relative;
    width: 100%;
}
.site-footer::before {
    content: '';
    display: block;
    height: 3px;
    background: linear-gradient(90deg, #4f46e5 0%, #818cf8 40%, #06b6d4 75%, #22d3ee 100%);
    width: 100%;
}
.site-footer__inner {
    max-width: 1140px;
    margin: 0 auto;
    padding: 3rem 2rem 2rem;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 3rem;
}
/* Brand column */
.site-footer__brand { display: flex; flex-direction: column; gap: 1rem; }
.site-footer__brand-row { display: flex; align-items: center; gap: .75rem; }
.site-footer__logo {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #4f46e5 0%, #818cf8 100%);
    border-radius: .75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: 0 4px 12px rgba(79,70,229,.4);
}
.site-footer__name {
    font-size: .95rem;
    font-weight: 700;
    color: #f1f5f9;
    letter-spacing: -.01em;
}
.site-footer__tagline {
    font-size: .78rem;
    color: #64748b;
    line-height: 1.5;
    max-width: 260px;
}
.site-footer__badges {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
    margin-top: .25rem;
}
.site-footer__badge {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    font-size: .7rem;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 9999px;
    background: rgba(255,255,255,.06);
    color: #94a3b8;
    border: 1px solid rgba(255,255,255,.1);
    white-space: nowrap;
}
/* Nav / info columns */
.site-footer__col-heading {
    display: block;
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: #475569;
    margin-bottom: .9rem;
    padding-bottom: .5rem;
    border-bottom: 1px solid rgba(255,255,255,.06);
}
.site-footer__nav ul,
.site-footer__info ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: .5rem;
}
.site-footer__nav ul li a {
    color: #64748b;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: .45rem;
    transition: color .15s, transform .15s;
    padding: 2px 0;
}
.site-footer__nav ul li a::before {
    content: '';
    width: 4px;
    height: 4px;
    background: #4f46e5;
    border-radius: 50%;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity .15s;
}
.site-footer__nav ul li a:hover { color: #e2e8f0; transform: translateX(3px); }
.site-footer__nav ul li a:hover::before { opacity: 1; }
.site-footer__info ul li {
    display: flex;
    align-items: center;
    gap: .5rem;
    color: #64748b;
    padding: 2px 0;
}
.site-footer__info ul li svg { flex-shrink: 0; color: #4f46e5; opacity: .85; }
/* Bottom bar */
.site-footer__bottom {
    border-top: 1px solid rgba(255,255,255,.06);
    padding: 1.1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .75rem;
    font-size: .77rem;
    color: #475569;
    max-width: 100%;
}
.site-footer__bottom-left { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.site-footer__bottom-right { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.site-footer__bottom a {
    color: #64748b;
    text-decoration: none;
    transition: color .15s;
}
.site-footer__bottom a:hover { color: #c7d2fe; }
.site-footer__dot {
    width: 3px;
    height: 3px;
    background: #334155;
    border-radius: 50%;
    display: inline-block;
    vertical-align: middle;
}
/* Responsive */
@media (max-width: 900px) {
    .site-footer__inner {
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
    }
    .site-footer__brand {
        grid-column: 1 / -1;
    }
}
@media (max-width: 540px) {
    .site-footer__inner {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        padding: 2rem 1.25rem 1.5rem;
    }
    .site-footer__bottom {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 1rem 1.25rem;
        gap: .4rem;
    }
    .site-footer__dot { display: none; }
}
