:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #eef2ff;
    --dark: #0f172a;
    --dark-2: #1e293b;
    --gray: #64748b;
    --gray-light: #f1f5f9;
    --border: #e2e8f0;
    --white: #ffffff;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --shadow-sm: 0 1px 2px rgba(15,23,42,0.06);
    --shadow: 0 4px 6px -1px rgba(15,23,42,0.08), 0 2px 4px -1px rgba(15,23,42,0.04);
    --shadow-lg: 0 10px 25px -3px rgba(15,23,42,0.1), 0 4px 6px -2px rgba(15,23,42,0.05);
    --radius: 10px;
    --radius-lg: 16px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: #f8fafc;
    color: var(--dark);
    line-height: 1.6;
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; transition: color .15s; }
a:hover { color: var(--primary-dark); }
code, pre { font-family: 'JetBrains Mono', monospace; }
img { max-width: 100%; height: auto; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }

/* ---------- HEADER ---------- */
.site-header {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 100;
    backdrop-filter: blur(8px);
}
.header-inner {
    display: flex; align-items: center; justify-content: space-between;
    height: 68px; gap: 24px;
}
.brand {
    display: flex; align-items: center; gap: 10px;
    font-weight: 800; font-size: 1.25rem; color: var(--dark);
}
.brand:hover { color: var(--primary); }
.brand-icon { font-size: 1.5rem; }
.brand-light { color: var(--white); }
.main-nav { display: flex; gap: 4px; }
.main-nav a {
    padding: 8px 14px; border-radius: 8px;
    color: var(--dark-2); font-weight: 500; font-size: 0.94rem;
}
.main-nav a:hover { background: var(--gray-light); color: var(--primary); }

.header-actions { display: flex; align-items: center; gap: 10px; }
.nav-toggle {
    display: none; background: none; border: none; font-size: 1.5rem;
    cursor: pointer; color: var(--dark);
}

.user-menu { position: relative; }
.avatar {
    width: 40px; height: 40px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: white; font-weight: 700; cursor: pointer;
    box-shadow: var(--shadow-sm);
}
.user-menu .dropdown {
    position: absolute; right: 0; top: 52px;
    background: var(--white); border-radius: var(--radius);
    box-shadow: var(--shadow-lg); border: 1px solid var(--border);
    min-width: 210px; padding: 8px;
    opacity: 0; visibility: hidden; transform: translateY(-6px);
    transition: all .18s;
}
.user-menu:hover .dropdown { opacity: 1; visibility: visible; transform: translateY(0); }
.dropdown a {
    display: block; padding: 10px 14px; border-radius: 6px;
    color: var(--dark-2); font-size: 0.9rem;
}
.dropdown a:hover { background: var(--primary-light); color: var(--primary); }
.dropdown hr { border: none; border-top: 1px solid var(--border); margin: 6px 0; }

/* ---------- BUTTONS ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 20px; border-radius: 8px; border: none;
    font-weight: 600; font-size: 0.94rem; cursor: pointer;
    transition: all .15s; font-family: inherit; text-decoration: none;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); color: white; transform: translateY(-1px); box-shadow: var(--shadow); }
.btn-secondary { background: var(--dark); color: white; }
.btn-secondary:hover { background: var(--dark-2); color: white; }
.btn-ghost { background: transparent; color: var(--dark-2); }
.btn-ghost:hover { background: var(--gray-light); }
.btn-outline { border: 1px solid var(--border); background: white; color: var(--dark); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; color: white; }
.btn-success { background: var(--success); color: white; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }
.btn-sm { padding: 6px 14px; font-size: 0.85rem; }
.btn-block { width: 100%; }

/* ---------- MAIN ---------- */
.site-main { min-height: calc(100vh - 400px); padding: 40px 0; }

/* ---------- HERO ---------- */
.hero {
    background: linear-gradient(135deg, var(--dark) 0%, #1e1b4b 50%, var(--primary-dark) 100%);
    color: white; padding: 80px 0 90px; position: relative; overflow: hidden;
}
.hero::after {
    content: ''; position: absolute; inset: 0;
    background: radial-gradient(circle at 80% 20%, rgba(99,102,241,0.3), transparent 50%);
}
.hero .container { position: relative; z-index: 1; text-align: center; max-width: 820px; }
.hero h1 {
    font-size: 3.2rem; font-weight: 800; line-height: 1.15;
    margin-bottom: 20px; letter-spacing: -0.02em;
}
.hero h1 .accent {
    background: linear-gradient(135deg, #a5b4fc, #818cf8);
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p { font-size: 1.15rem; color: #cbd5e1; margin-bottom: 32px; }
.hero-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

/* ---------- STATS ---------- */
.stats-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px; margin: -50px 0 40px; position: relative; z-index: 2;
}
.stat-card {
    background: var(--white); padding: 24px; border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg); border: 1px solid var(--border);
    transition: transform .2s;
}
.stat-card:hover { transform: translateY(-3px); }
.stat-card .stat-label { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--gray); font-weight: 600; }
.stat-card .stat-value { font-size: 2rem; font-weight: 800; color: var(--dark); margin-top: 6px; }
.stat-card .stat-icon { font-size: 1.5rem; margin-bottom: 8px; }

/* ---------- CARDS ---------- */
.card {
    background: var(--white); border-radius: var(--radius-lg);
    box-shadow: var(--shadow); border: 1px solid var(--border);
    padding: 28px; margin-bottom: 24px;
}
.card-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 20px; flex-wrap: wrap; gap: 12px;
}
.card-title { font-size: 1.25rem; font-weight: 700; }

.section-title {
    font-size: 1.75rem; font-weight: 800; margin-bottom: 24px;
    letter-spacing: -0.02em;
}

/* ---------- TABLES ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
.table {
    width: 100%; background: var(--white);
    border-collapse: separate; border-spacing: 0;
    border-radius: var(--radius); overflow: hidden;
    box-shadow: var(--shadow); border: 1px solid var(--border);
}
.table th, .table td { padding: 14px 18px; text-align: left; border-bottom: 1px solid var(--border); }
.table th {
    background: var(--gray-light); font-weight: 600; font-size: 0.82rem;
    text-transform: uppercase; letter-spacing: 0.05em; color: var(--gray);
}
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #fafbfc; }
.table a { font-weight: 500; }

/* ---------- BADGES ---------- */
.badge {
    display: inline-block; padding: 4px 10px; border-radius: 6px;
    font-size: 0.72rem; font-weight: 700; letter-spacing: 0.03em;
    text-transform: uppercase;
}
.badge-low { background: #d1fae5; color: #065f46; }
.badge-medium { background: #fef3c7; color: #92400e; }
.badge-high { background: #fed7aa; color: #9a3412; }
.badge-critical { background: #fecaca; color: #991b1b; }
.badge-pending { background: #e2e8f0; color: #334155; }
.badge-approved { background: #dbeafe; color: #1e40af; }
.badge-rejected { background: #fee2e2; color: #991b1b; }
.badge-fixed { background: #d1fae5; color: #065f46; }

/* ---------- FORMS ---------- */
.form-card {
    background: var(--white); padding: 36px;
    border-radius: var(--radius-lg); box-shadow: var(--shadow);
    border: 1px solid var(--border); max-width: 620px; margin: 0 auto;
}
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-weight: 600; margin-bottom: 8px; font-size: 0.9rem; color: var(--dark-2); }
.form-label .required { color: var(--danger); }
.form-hint { font-size: 0.8rem; color: var(--gray); margin-top: 6px; }
.form-control {
    width: 100%; padding: 12px 14px; border: 1px solid var(--border);
    border-radius: 8px; font-size: 0.95rem; font-family: inherit;
    transition: all .15s; background: var(--white); color: var(--dark);
}
.form-control:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}
textarea.form-control { resize: vertical; min-height: 100px; }
select.form-control { cursor: pointer; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ---------- ALERTS ---------- */
.alert {
    padding: 14px 20px; border-radius: 8px; margin-bottom: 20px;
    display: flex; justify-content: space-between; align-items: center;
    font-size: 0.92rem; font-weight: 500; border-left: 4px solid;
}
.alert-success { background: #ecfdf5; color: #065f46; border-color: var(--success); }
.alert-error { background: #fef2f2; color: #991b1b; border-color: var(--danger); }
.alert-info { background: #eff6ff; color: #1e40af; border-color: var(--info); }
.alert-warning { background: #fffbeb; color: #92400e; border-color: var(--warning); }
.alert-close { background: none; border: none; font-size: 1.4rem; cursor: pointer; color: inherit; opacity: .6; }
.alert-close:hover { opacity: 1; }

/* ---------- REPORT DETAIL ---------- */
.report-header { padding-bottom: 24px; border-bottom: 1px solid var(--border); margin-bottom: 24px; }
.report-title { font-size: 1.85rem; font-weight: 800; margin-bottom: 14px; line-height: 1.25; }
.report-meta { display: flex; flex-wrap: wrap; gap: 18px; font-size: 0.88rem; color: var(--gray); align-items: center; }
.report-meta .dot { color: var(--border); }
.report-section { margin-top: 28px; }
.report-section h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 12px; color: var(--dark); }
.report-section p { color: var(--dark-2); white-space: pre-wrap; }
.code-block {
    background: #0f172a; color: #e2e8f0; padding: 20px;
    border-radius: var(--radius); overflow-x: auto;
    font-family: 'JetBrains Mono', monospace; font-size: 0.85rem; line-height: 1.6;
}

/* ---------- COMMENTS ---------- */
.comment {
    background: var(--white); padding: 18px 20px;
    border-radius: var(--radius); margin-bottom: 14px;
    border: 1px solid var(--border);
}
.comment-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.comment-head .avatar { width: 34px; height: 34px; font-size: 0.85rem; }
.comment-author { font-weight: 600; font-size: 0.92rem; }
.comment-time { font-size: 0.8rem; color: var(--gray); margin-left: auto; }
.comment-body { color: var(--dark-2); font-size: 0.94rem; }

/* ---------- FILTERS ---------- */
.filter-bar {
    display: flex; gap: 12px; flex-wrap: wrap;
    padding: 18px 20px; background: var(--white);
    border-radius: var(--radius); box-shadow: var(--shadow-sm);
    border: 1px solid var(--border); margin-bottom: 24px;
}
.filter-bar input, .filter-bar select {
    padding: 10px 14px; border: 1px solid var(--border);
    border-radius: 8px; font-family: inherit; font-size: 0.9rem;
}
.filter-bar input[type="text"] { flex: 1; min-width: 200px; }
.filter-bar input:focus, .filter-bar select:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}

/* ---------- EMPTY STATE ---------- */
.empty-state { text-align: center; padding: 60px 20px; color: var(--gray); }
.empty-state .icon { font-size: 3rem; margin-bottom: 16px; opacity: .4; }
.empty-state h3 { color: var(--dark); margin-bottom: 8px; }

/* ---------- PAGINATION ---------- */
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 24px; }
.pagination a, .pagination span {
    padding: 8px 14px; border-radius: 8px;
    background: var(--white); border: 1px solid var(--border);
    color: var(--dark-2); font-weight: 500; font-size: 0.9rem;
}
.pagination .active { background: var(--primary); color: white; border-color: var(--primary); }
.pagination a:hover { border-color: var(--primary); color: var(--primary); }

/* ---------- LEADERBOARD ---------- */
.rank { display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: 50%; font-weight: 700; font-size: 0.85rem;
    background: var(--gray-light); color: var(--dark-2); }
.rank.gold { background: linear-gradient(135deg, #fbbf24, #f59e0b); color: white; }
.rank.silver { background: linear-gradient(135deg, #cbd5e1, #94a3b8); color: white; }
.rank.bronze { background: linear-gradient(135deg, #d97706, #b45309); color: white; }

/* ---------- FOOTER ---------- */
.site-footer { background: var(--dark); color: #94a3b8; padding: 60px 0 0; margin-top: 80px; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 40px; padding-bottom: 40px; }
.footer-grid h4 { color: white; font-size: 0.95rem; margin-bottom: 14px; font-weight: 600; }
.footer-grid a { display: block; color: #94a3b8; padding: 5px 0; font-size: 0.9rem; }
.footer-grid a:hover { color: white; }
.footer-desc { font-size: 0.9rem; margin-top: 14px; max-width: 320px; line-height: 1.7; }
.footer-bottom { border-top: 1px solid #1e293b; padding: 20px 0; }
.footer-bottom p { font-size: 0.85rem; text-align: center; }

/* ---------- AUTH PAGES ---------- */
.auth-wrap {
    min-height: calc(100vh - 68px);
    display: flex; align-items: center; justify-content: center;
    padding: 40px 20px;
    background: linear-gradient(135deg, #eef2ff 0%, #faf5ff 100%);
}
.auth-card {
    width: 100%; max-width: 440px;
    background: var(--white); padding: 44px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg); border: 1px solid var(--border);
}
.auth-card h1 { font-size: 1.75rem; margin-bottom: 6px; font-weight: 800; }
.auth-card .subtitle { color: var(--gray); margin-bottom: 28px; font-size: 0.92rem; }
.auth-footer { text-align: center; margin-top: 22px; font-size: 0.9rem; color: var(--gray); }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 900px) {
    .hero h1 { font-size: 2.2rem; }
    .footer-grid { grid-template-columns: 1fr 1fr; }
    .form-row { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
    .main-nav {
        display: none; position: absolute; top: 68px; left: 0; right: 0;
        background: var(--white); border-bottom: 1px solid var(--border);
        flex-direction: column; padding: 12px; gap: 4px;
        box-shadow: var(--shadow-lg);
    }
    body.nav-open .main-nav { display: flex; }
    .nav-toggle { display: block; }
    .hero { padding: 50px 0 70px; }
    .hero h1 { font-size: 1.8rem; }
    .hero p { font-size: 1rem; }
    .header-actions .btn-ghost { display: none; }
    .stats-grid { margin-top: -30px; }
    .footer-grid { grid-template-columns: 1fr; gap: 28px; }
    .card { padding: 22px; }
    .form-card, .auth-card { padding: 28px 22px; }
    .table th, .table td { padding: 10px 12px; font-size: 0.85rem; }
}