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

:root {
    --bg:        #0f172a;
    --bg2:       #1e293b;
    --bg3:       #334155;
    --border:    #475569;
    --text:      #e2e8f0;
    --text2:     #94a3b8;
    --primary:   #3b82f6;
    --primary-h: #2563eb;
    --success:   #10b981;
    --danger:    #ef4444;
    --warning:   #f59e0b;
    --radius:    8px;
    --shadow:    0 4px 6px -1px rgb(0 0 0 / .3);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    font-size: 14px;
    line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

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

nav {
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-brand span { color: var(--primary); }

.nav-right { display: flex; align-items: center; gap: 16px; }

.nav-user {
    color: var(--text2);
    font-size: 13px;
}

main { padding: 32px 24px; max-width: 1200px; margin: 0 auto; }

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

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: background .15s, transform .1s;
}

.btn:active { transform: scale(.97); }
.btn-primary   { background: var(--primary);  color: #fff; }
.btn-primary:hover { background: var(--primary-h); }
.btn-danger    { background: var(--danger);   color: #fff; }
.btn-danger:hover  { background: #dc2626; }
.btn-success   { background: var(--success);  color: #fff; }
.btn-success:hover { background: #059669; }
.btn-ghost     { background: transparent; color: var(--text2); border: 1px solid var(--border); }
.btn-ghost:hover   { background: var(--bg3); color: var(--text); }
.btn-sm        { padding: 4px 10px; font-size: 12px; }

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

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

th {
    text-align: left;
    padding: 10px 12px;
    color: var(--text2);
    font-weight: 500;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--bg3);
    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; }

/* ── Badges ───────────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    color: #fff;
    letter-spacing: .3px;
}

/* ── Forms ────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; color: var(--text2); font-size: 13px; }

input, select, textarea {
    width: 100%;
    padding: 9px 12px;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 13px;
    outline: none;
    transition: border-color .15s;
}

input:focus, select:focus, textarea:focus { border-color: var(--primary); }

textarea { resize: vertical; min-height: 80px; font-family: monospace; }

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

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

.modal {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    width: 100%;
    max-width: 520px;
    box-shadow: var(--shadow);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.modal-title { font-size: 16px; font-weight: 600; }

.modal-close {
    background: none;
    border: none;
    color: var(--text2);
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    padding: 4px;
}

.modal-close:hover { color: var(--text); }

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

/* ── Notification ─────────────────────────────────────────── */
.notification {
    display: none;
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 300;
    padding: 12px 20px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    box-shadow: var(--shadow);
    max-width: 360px;
}

.notification.success { background: var(--success); color: #fff; }
.notification.error   { background: var(--danger);  color: #fff; }
.notification.info    { background: var(--primary);  color: #fff; }

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

.page-title { font-size: 22px; font-weight: 700; }
.page-subtitle { color: var(--text2); font-size: 13px; margin-top: 2px; }

/* ── Login page ───────────────────────────────────────────── */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
}

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

.login-logo {
    text-align: center;
    margin-bottom: 28px;
    font-size: 22px;
    font-weight: 800;
}

.login-logo span { color: var(--primary); }

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

.stat-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}

.stat-value { font-size: 28px; font-weight: 700; color: var(--primary); }
.stat-label { color: var(--text2); font-size: 13px; margin-top: 4px; }

/* ── Breadcrumb ───────────────────────────────────────────── */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text2);
    font-size: 13px;
    margin-bottom: 20px;
}

.breadcrumb a { color: var(--text2); }
.breadcrumb a:hover { color: var(--text); }
.breadcrumb .sep { color: var(--border); }
.breadcrumb .current { color: var(--text); }

/* ── Empty state ──────────────────────────────────────────── */
.empty {
    text-align: center;
    padding: 48px 24px;
    color: var(--text2);
}

.empty-icon { font-size: 40px; margin-bottom: 12px; }
.empty-text { font-size: 15px; }

/* ── Disabled row ─────────────────────────────────────────── */
tr.disabled td { opacity: .5; }

/* ── Loader ───────────────────────────────────────────────── */
#loader {
    display: none;
    position: fixed;
    inset: 0;
    background: rgb(0 0 0 / .4);
    z-index: 400;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    color: var(--text);
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 640px) {
    .form-row, .form-row-3 { grid-template-columns: 1fr; }
    .page-header { flex-direction: column; align-items: flex-start; gap: 12px; }
    .card { padding: 16px; }
}
