/* ── Reset & Variables ─────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg:        #070b14;
    --surface:   #0d1117;
    --surface2:  #161b27;
    --border:    #1e2533;
    --accent:    #7c6dfa;
    --accent2:   #a78bfa;
    --green:     #22c55e;
    --amber:     #f59e0b;
    --blue:      #3b82f6;
    --red:       #ef4444;
    --text:      #e2e8f0;
    --muted:     #64748b;
    --sidebar-w: 260px;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    font-size: 14px;
    line-height: 1.5;
}
a { color: inherit; text-decoration: none; }

/* ── Login page ─────────────────────────────────── */
body.login-page { align-items: center; justify-content: center; }
.login-card {
    width: 100%; max-width: 420px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 2.5rem 2rem;
    box-shadow: 0 24px 64px rgba(0,0,0,.5);
}
.login-card__logo { text-align: center; margin-bottom: 2rem; }
.login-card__logo svg { width: 48px; height: 48px; }
.login-card__logo h1 { font-size: 1.5rem; font-weight: 700; margin-top: .5rem; }
.login-card__logo p  { color: var(--muted); font-size: .875rem; margin-top: .3rem; }

/* ── Sidebar ─────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-w);
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 50;
    transition: transform .25s ease;
    overflow-y: auto;
}
.sidebar-logo {
    display: flex; align-items: center; gap: .75rem;
    padding: 1.25rem 1.25rem 1rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.sidebar-logo-icon {
    width: 34px; height: 34px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.sidebar-logo-icon svg { width: 18px; height: 18px; }
.sidebar-logo-text { font-size: .95rem; font-weight: 700; letter-spacing: -.01em; }
.sidebar-logo-text span { color: var(--accent2); }
.sidebar-section {
    padding: 1.1rem 1rem .4rem;
    font-size: .65rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .1em;
    color: var(--muted);
}
.nav-link {
    display: flex; align-items: center; gap: .7rem;
    padding: .55rem 1rem; margin: .1rem .5rem;
    border-radius: 8px;
    color: var(--muted);
    font-size: .84rem; font-weight: 500;
    transition: background .15s, color .15s;
    position: relative; cursor: pointer;
}
.nav-link svg { width: 16px; height: 16px; flex-shrink: 0; }
.nav-link:hover { background: var(--surface2); color: var(--text); }
.nav-link.active { background: rgba(124,109,250,.15); color: var(--accent2); }
.nav-link.active::before {
    content: '';
    position: absolute; left: -.5rem; top: 20%; bottom: 20%;
    width: 3px; border-radius: 0 3px 3px 0;
    background: var(--accent);
}
.nav-link.danger { color: var(--red); }
.nav-link.danger:hover { background: rgba(239,68,68,.1); }
.nav-badge {
    margin-left: auto;
    background: rgba(124,109,250,.2); color: var(--accent2);
    font-size: .62rem; font-weight: 700;
    padding: .12rem .45rem; border-radius: 999px;
}
.sidebar-footer {
    margin-top: auto; padding: 1rem;
    border-top: 1px solid var(--border); flex-shrink: 0;
}
.user-card {
    display: flex; align-items: center; gap: .7rem;
    padding: .7rem; border-radius: 10px;
    background: var(--surface2); border: 1px solid var(--border);
    transition: background .15s;
}
.user-card:hover { background: #1e2535; }

/* ── Avatar ─────────────────────────────────────── */
.avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: .8rem; color: #fff; flex-shrink: 0;
}
.avatar-lg { width: 42px; height: 42px; font-size: 1rem; }
.user-info { flex: 1; overflow: hidden; }
.user-info strong { display: block; font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-info small { color: var(--muted); font-size: .7rem; }

/* ── Layout ─────────────────────────────────────── */
.layout { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-height: 100vh; }

/* ── Topbar ─────────────────────────────────────── */
.topbar {
    position: sticky; top: 0; z-index: 40;
    background: rgba(7,11,20,.88); backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: .8rem 1.75rem;
    display: flex; align-items: center; gap: 1rem;
}
.topbar-title { font-size: .95rem; font-weight: 600; flex: 1; }
.topbar-time  { color: var(--muted); font-size: .78rem; }
.topbar-actions { display: flex; align-items: center; gap: .5rem; }
.icon-btn {
    width: 32px; height: 32px; border-radius: 8px;
    background: var(--surface2); border: 1px solid var(--border);
    color: var(--muted);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: background .15s, color .15s;
}
.icon-btn:hover { background: #1e2535; color: var(--text); }
.icon-btn svg { width: 15px; height: 15px; }
.status-dot {
    display: flex; align-items: center; gap: .4rem;
    background: rgba(34,197,94,.1); border: 1px solid rgba(34,197,94,.25);
    border-radius: 999px; padding: .22rem .7rem;
    font-size: .7rem; font-weight: 600; color: var(--green);
}
.status-dot::before {
    content: ''; width: 5px; height: 5px; border-radius: 50%;
    background: var(--green); box-shadow: 0 0 6px var(--green);
    animation: pulse 2s infinite;
}
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.4} }

/* ── Main ───────────────────────────────────────── */
.main { flex: 1; padding: 1.75rem 2rem; }
.page-header { margin-bottom: 1.75rem; }
.page-header h1 { font-size: 1.5rem; font-weight: 700; }
.page-header p  { color: var(--muted); margin-top: .3rem; font-size: .84rem; }

/* ── Panels ─────────────────────────────────────── */
.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px; overflow: hidden;
}
.panel-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: .9rem 1.25rem; border-bottom: 1px solid var(--border);
}
.panel-header h2 { font-size: .875rem; font-weight: 600; }
.panel-header a  { font-size: .75rem; color: var(--accent2); }
.panel-header a:hover { text-decoration: underline; }
.panel-body { padding: 1.25rem; }

/* ── Stat cards ─────────────────────────────────── */
.stats-grid {
    display: grid; grid-template-columns: repeat(4, 1fr);
    gap: 1rem; margin-bottom: 1.5rem;
}
.stat-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 14px; padding: 1.2rem;
    display: flex; flex-direction: column; gap: .2rem;
    position: relative; overflow: hidden;
    transition: border-color .2s, transform .2s;
}
.stat-card:hover { border-color: #2d3448; transform: translateY(-1px); }
.stat-card::after {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,.02) 0%, transparent 60%);
    pointer-events: none;
}
.stat-card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: .5rem; }
.stat-icon { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; }
.stat-icon svg { width: 18px; height: 18px; }
.stat-trend { font-size: .68rem; font-weight: 600; padding: .18rem .45rem; border-radius: 999px; }
.trend-up  { background: rgba(34,197,94,.12); color: var(--green); }
.trend-neu { background: rgba(100,116,139,.12); color: var(--muted); }
.trend-red { background: rgba(239,68,68,.12); color: var(--red); }
.stat-label { color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .07em; }
.stat-value { font-size: 1.6rem; font-weight: 700; line-height: 1.1; margin-top: .1rem; }
.stat-sub   { color: var(--muted); font-size: .72rem; margin-top: .1rem; }

/* ── Content grids ──────────────────────────────── */
.content-grid { display: grid; grid-template-columns: 1fr 320px; gap: 1.25rem; margin-bottom: 1.25rem; }

/* ── Tables ─────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .84rem; }
thead th {
    text-align: left; padding: .75rem 1rem;
    font-size: .7rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .07em;
    color: var(--muted); border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
tbody td { padding: .8rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(255,255,255,.02); }

/* ── Forms ──────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: .4rem; margin-bottom: 1rem; }
.form-group label { font-size: .8rem; font-weight: 600; color: var(--muted); }
.form-row { display: flex; gap: .75rem; flex-wrap: wrap; align-items: flex-end; }
.form-row .form-group { flex: 1; min-width: 160px; margin-bottom: 0; }

input[type=text], input[type=email], input[type=password], input[type=search],
select, textarea {
    width: 100%;
    background: var(--surface2); border: 1px solid var(--border);
    border-radius: 8px; padding: .6rem .9rem;
    color: var(--text); font-size: .875rem; font-family: inherit;
    transition: border-color .15s; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
input::placeholder, textarea::placeholder { color: var(--muted); }
select { cursor: pointer; }
select option { background: var(--surface2); }

/* ── Buttons ────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; gap: .4rem;
    padding: .6rem 1.2rem; border-radius: 8px;
    font-size: .84rem; font-weight: 600;
    cursor: pointer; border: none;
    transition: opacity .15s, background .15s;
    white-space: nowrap; font-family: inherit;
}
.btn:hover { opacity: .88; }
.btn svg { width: 15px; height: 15px; flex-shrink: 0; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-ghost   { background: rgba(255,255,255,.07); color: var(--text); border: 1px solid var(--border); }
.btn-danger  { background: rgba(239,68,68,.15); color: var(--red); border: 1px solid rgba(239,68,68,.25); }
.btn-success { background: rgba(34,197,94,.15); color: var(--green); border: 1px solid rgba(34,197,94,.25); }
.btn-sm      { padding: .35rem .8rem; font-size: .78rem; border-radius: 7px; }
.btn-full    { width: 100%; justify-content: center; }

/* ── Badges ─────────────────────────────────────── */
.badge {
    display: inline-flex; align-items: center; gap: .3rem;
    padding: .18rem .6rem; border-radius: 999px;
    font-size: .68rem; font-weight: 700;
    letter-spacing: .03em; text-transform: uppercase;
}
.badge-admin  { background: rgba(124,109,250,.15); color: var(--accent2); border: 1px solid rgba(124,109,250,.25); }
.badge-user   { background: rgba(34,197,94,.12);   color: var(--green);   border: 1px solid rgba(34,197,94,.25); }
.badge-online { background: rgba(34,197,94,.12);   color: var(--green);   border: 1px solid rgba(34,197,94,.2); }
.badge-muted  { background: rgba(100,116,139,.12); color: var(--muted);   border: 1px solid rgba(100,116,139,.2); }

/* ── Alerts ─────────────────────────────────────── */
.alert {
    padding: .75rem 1rem; border-radius: 10px;
    font-size: .84rem; font-weight: 500;
    margin-bottom: 1rem; display: flex; align-items: center; gap: .6rem;
}
.alert-error   { background: rgba(239,68,68,.1);  border: 1px solid rgba(239,68,68,.25);  color: #fca5a5; }
.alert-success { background: rgba(34,197,94,.1);  border: 1px solid rgba(34,197,94,.25);  color: #86efac; }
.alert-info    { background: rgba(59,130,246,.1); border: 1px solid rgba(59,130,246,.25); color: #93c5fd; }
.alert-warning { background: rgba(245,158,11,.1); border: 1px solid rgba(245,158,11,.25); color: #fcd34d; }

/* ── Activity feed ───────────────────────────────── */
.activity-list { padding: .25rem 0; }
.activity-item {
    display: flex; align-items: flex-start; gap: .85rem;
    padding: .7rem 1.25rem; border-bottom: 1px solid var(--border);
    transition: background .15s;
}
.activity-item:last-child { border-bottom: none; }
.activity-item:hover { background: rgba(255,255,255,.02); }
.activity-dot { width: 7px; height: 7px; border-radius: 50%; margin-top: .4rem; flex-shrink: 0; }
.activity-content { flex: 1; }
.activity-title { font-size: .82rem; font-weight: 500; }
.activity-time  { font-size: .72rem; color: var(--muted); margin-top: .1rem; }

/* ── Info rows ───────────────────────────────────── */
.info-list { padding: .25rem 0; }
.info-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: .75rem 1.25rem; border-bottom: 1px solid var(--border); font-size: .82rem;
}
.info-row:last-child { border-bottom: none; }
.info-label { color: var(--muted); display: flex; align-items: center; gap: .5rem; }
.info-label svg { width: 14px; height: 14px; }
.info-value { font-weight: 500; }

/* ── Quick cards ────────────────────────────────── */
.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; padding: 1.25rem; }
.quick-card {
    background: var(--surface2); border: 1px solid var(--border);
    border-radius: 10px; padding: 1rem;
    display: flex; flex-direction: column; gap: .45rem;
    transition: border-color .15s, background .15s;
}
.quick-card:hover { background: #1a2033; border-color: var(--accent); }
.quick-card-icon { width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center; }
.quick-card-icon svg { width: 15px; height: 15px; }
.quick-card-label { font-size: .8rem; font-weight: 600; }
.quick-card-desc  { font-size: .72rem; color: var(--muted); }

/* ── Admin banner ───────────────────────────────── */
.admin-banner {
    background: linear-gradient(135deg, rgba(124,109,250,.1), rgba(167,139,250,.05));
    border: 1px solid rgba(124,109,250,.2);
    border-radius: 14px; padding: 1.5rem;
    display: flex; align-items: center; gap: 1.25rem;
    margin-bottom: 1.25rem; position: relative; overflow: hidden;
}
.admin-banner::before {
    content: ''; position: absolute; top: -40px; right: -40px;
    width: 140px; height: 140px; border-radius: 50%;
    background: radial-gradient(circle, rgba(124,109,250,.12) 0%, transparent 70%);
    pointer-events: none;
}
.admin-banner-icon {
    width: 46px; height: 46px; border-radius: 12px;
    background: rgba(124,109,250,.2);
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.admin-banner-icon svg { width: 24px; height: 24px; }
.admin-banner h3 { font-size: .92rem; font-weight: 700; }
.admin-banner p  { color: var(--muted); font-size: .8rem; margin-top: .2rem; line-height: 1.5; }
.admin-banner-actions { margin-top: .75rem; display: flex; gap: .5rem; }

/* ── Section divider ────────────────────────────── */
.section-divider {
    display: flex; align-items: center; gap: .75rem;
    margin: 1.5rem 0 1rem;
    color: var(--muted); font-size: .7rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .08em;
}
.section-divider::before, .section-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ── Pagination ─────────────────────────────────── */
.pagination { display: flex; align-items: center; gap: .5rem; padding: 1rem 1.25rem; border-top: 1px solid var(--border); }
.page-btn {
    width: 32px; height: 32px; border-radius: 7px;
    background: var(--surface2); border: 1px solid var(--border);
    color: var(--muted); display: flex; align-items: center; justify-content: center;
    font-size: .8rem; font-weight: 600; cursor: pointer;
    transition: background .15s, color .15s;
}
.page-btn:hover { background: #1e2535; color: var(--text); }
.page-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.page-info { color: var(--muted); font-size: .8rem; margin-left: auto; }

/* ── Empty state ────────────────────────────────── */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.empty-state svg { width: 40px; height: 40px; margin: 0 auto 1rem; display: block; opacity: .4; }
.empty-state p { font-size: .9rem; }

/* ── Modal ──────────────────────────────────────── */
.modal-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,.6); z-index: 100;
    align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
    background: var(--surface2); border: 1px solid var(--border);
    border-radius: 14px; padding: 1.5rem; width: 420px; max-width: 92vw;
}
.modal h3 { font-size: 1rem; font-weight: 700; margin-bottom: 1.25rem; }
.modal-actions { display: flex; gap: .5rem; justify-content: flex-end; margin-top: 1rem; }

/* ── Responsive ─────────────────────────────────── */
@media (max-width: 1100px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .content-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .layout { margin-left: 0; }
    .main { padding: 1.25rem; }
    .topbar { padding: .7rem 1.25rem; }
}
@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
}
