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

:root {
    --bg:        #0d0d0d;
    --bg2:       #141414;
    --bg3:       #1c1c1c;
    --border:    #2a2a2a;
    --green:     #22c55e;
    --green-dim: #16a34a;
    --green-glow:#22c55e22;
    --text:      #e5e5e5;
    --text-muted:#888;
    --red:       #ef4444;
    --yellow:    #f59e0b;
    --blue:      #3b82f6;
    --radius:    10px;
    --sidebar-w: 240px;
    --shadow:    0 4px 24px rgba(0,0,0,.5);
}

html, body {
    height: 100%;
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    font-size: 14px;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

a { color: var(--green); text-decoration: none; }
a:hover { opacity: .8; }

/* ── Layout ───────────────────────────────────────────────── */
.layout { display: flex; min-height: 100vh; }

/* ── Sidebar ──────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-w);
    background: linear-gradient(180deg, #0f0f0f 0%, #141414 100%);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    z-index: 100;
    overflow-y: auto;
}

.sidebar-logo {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, #22c55e08 0%, transparent 100%);
}

.sidebar-logo img {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
}

.sidebar-logo-text {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}

.sidebar-logo-sub {
    font-size: 11px;
    color: var(--text-muted);
}

.sidebar-nav {
    padding: 12px 0;
    flex: 1;
}

.nav-section {
    padding: 8px 16px 4px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    transition: all .15s;
    border-left: 3px solid transparent;
    cursor: pointer;
    letter-spacing: .01em;
}

.nav-item:hover {
    background: var(--bg3);
    color: var(--text);
    border-left-color: var(--border);
}

.nav-item.active {
    background: var(--green-glow);
    color: var(--green);
    border-left-color: var(--green);
}

.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; }

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-muted);
}

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

.topbar {
    background: linear-gradient(90deg, #141414 0%, #111 100%);
    border-bottom: 1px solid var(--border);
    padding: 0 28px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(10px);
}

.topbar-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}

.topbar-actions { display: flex; align-items: center; gap: 12px; }

.topbar-user {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
}

.avatar {
    width: 30px;
    height: 30px;
    background: var(--green-glow);
    border: 1px solid var(--green);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: var(--green);
}

.content { padding: 28px; flex: 1; }

/* ── Cards ────────────────────────────────────────────────── */
.card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 24px;
    margin-bottom: 20px;
}

.card-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ── Stats grid ───────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: linear-gradient(135deg, #1a1a1a 0%, #161616 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    position: relative;
    overflow: hidden;
    transition: border-color .2s, box-shadow .2s;
}

.stat-card:hover {
    border-color: #22c55e40;
    box-shadow: 0 0 24px #22c55e10;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 3px;
    height: 100%;
    background: linear-gradient(180deg, var(--green), #16a34a);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: -40px; right: -40px;
    width: 100px;
    height: 100px;
    background: radial-gradient(circle, #22c55e08 0%, transparent 70%);
    border-radius: 50%;
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
    line-height: 1;
}

.stat-sub {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ── Table ────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

th {
    text-align: left;
    padding: 10px 14px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    background: var(--bg3);
}

td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg3); }

.mono {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 12px;
    color: var(--green);
    letter-spacing: .03em;
}

/* ── Badge ────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all .15s;
    text-decoration: none;
}

.btn-primary {
    background: var(--green);
    color: #000;
}
.btn-primary:hover { background: var(--green-dim); color: #000; opacity: 1; }

.btn-secondary {
    background: var(--bg3);
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--border); }

.btn-danger {
    background: #ef444420;
    color: var(--red);
    border: 1px solid #ef444440;
}
.btn-danger:hover { background: var(--red); color: #fff; }

.btn-sm { padding: 5px 10px; font-size: 12px; }

/* ── Forms ────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }

label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
select,
textarea {
    width: 100%;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 9px 12px;
    font-size: 13px;
    color: var(--text);
    outline: none;
    transition: border-color .15s;
    font-family: inherit;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--green);
    box-shadow: 0 0 0 3px var(--green-glow);
}

select option { background: var(--bg2); }

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

/* ── Modal ────────────────────────────────────────────────── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.7);
    z-index: 200;
    align-items: center;
    justify-content: center;
}

.modal-overlay.open { display: flex; }

.modal {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 28px;
    width: 100%;
    max-width: 480px;
    box-shadow: var(--shadow);
    animation: fadeUp .2s ease;
}

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

.modal-title {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

/* ── Alert ────────────────────────────────────────────────── */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.alert-success { background: #22c55e20; border: 1px solid #22c55e40; color: #22c55e; }
.alert-error   { background: #ef444420; border: 1px solid #ef444440; color: #ef4444; }
.alert-info    { background: #3b82f620; border: 1px solid #3b82f640; color: #3b82f6; }

/* ── Login page ───────────────────────────────────────────── */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    background-image:
        radial-gradient(ellipse at 20% 50%, #22c55e0a 0%, transparent 60%),
        radial-gradient(ellipse at 80% 20%, #22c55e06 0%, transparent 50%);
}

.login-box {
    width: 100%;
    max-width: 380px;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 36px 32px;
    box-shadow: var(--shadow);
}

.login-logo {
    text-align: center;
    margin-bottom: 28px;
}

.login-logo img {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    object-fit: cover;
    margin-bottom: 10px;
}

.login-logo h1 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
}

.login-logo p {
    font-size: 12px;
    color: var(--text-muted);
}

/* ── Copy button ─────────────────────────────────────────── */
.copy-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    transition: all .15s;
}
.copy-btn:hover { color: var(--green); background: var(--green-glow); }

/* ── Scrollbar ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #444; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); transition: transform .25s; }
    .sidebar.open { transform: translateX(0); }
    .main { margin-left: 0; }
    .form-row { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
}

/* ── Public pages ────────────────────────────────────────── */
.public-page {
    max-width: 760px;
    margin: 60px auto;
    padding: 0 24px 60px;
}

.public-page h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
}

.public-page .updated {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 32px;
}

.public-page h2 {
    font-size: 15px;
    font-weight: 600;
    color: var(--green);
    margin: 24px 0 8px;
}

.public-page p, .public-page li {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.8;
}

.public-page ul { padding-left: 20px; margin: 8px 0; }
.public-page a { color: var(--green); }

.public-header {
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    padding: 16px 24px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    font-weight: 700;
}
