*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #0f1117;
    --surface: #1a1d27;
    --surface2: #222636;
    --border: #2d3147;
    --accent: #6c63ff;
    --accent-hover: #5a52e0;
    --danger: #e05252;
    --danger-hover: #c43f3f;
    --success: #4caf82;
    --text: #e8eaf0;
    --muted: #8890a8;
    --radius: 10px;
}

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

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

/* ---- Login ---- */
.login-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1rem;
}
.login-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 380px;
}
.login-box h1 {
    font-size: 1.4rem;
    margin-bottom: 0.25rem;
}
.login-box .subtitle {
    color: var(--muted);
    font-size: 0.875rem;
    margin-bottom: 2rem;
}

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

.sidebar {
    width: 230px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 1.5rem 0;
    flex-shrink: 0;
}
.sidebar-logo {
    padding: 0 1.5rem 1.5rem;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent);
    border-bottom: 1px solid var(--border);
    margin-bottom: 1rem;
}
.sidebar-logo span { color: var(--text); font-weight: 400; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.65rem 1.5rem;
    color: var(--muted);
    font-size: 0.9rem;
    transition: color .15s, background .15s;
    cursor: pointer;
}
.nav-item:hover, .nav-item.active {
    color: var(--text);
    background: var(--surface2);
    text-decoration: none;
}
.nav-item.active { border-left: 3px solid var(--accent); padding-left: calc(1.5rem - 3px); }
.nav-icon { font-size: 1rem; width: 20px; text-align: center; }

.sidebar-bottom {
    margin-top: auto;
    border-top: 1px solid var(--border);
    padding-top: 1rem;
}
.user-info { padding: 0.5rem 1.5rem; font-size: 0.8rem; color: var(--muted); }
.user-info strong { color: var(--text); display: block; }

.main { flex: 1; display: flex; flex-direction: column; overflow: auto; }

.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.topbar h2 { font-size: 1.1rem; font-weight: 600; }

.content { padding: 2rem; flex: 1; }

/* ---- Cards ---- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}
.card-title {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--muted);
    margin-bottom: 1rem;
}

/* ---- Forms ---- */
.form-group { margin-bottom: 1rem; }
label { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 0.4rem; }
input[type=text], input[type=password], input[type=email], select {
    width: 100%;
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 6px;
    padding: 0.65rem 0.85rem;
    font-size: 0.95rem;
    outline: none;
    transition: border-color .15s;
}
input:focus, select:focus { border-color: var(--accent); }

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 1.25rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: background .15s, opacity .15s;
    text-decoration: none;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); text-decoration: none; color: #fff; }
.btn-danger  { background: var(--danger);  color: #fff; }
.btn-danger:hover  { background: var(--danger-hover); text-decoration: none; color: #fff; }
.btn-ghost   { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--border); text-decoration: none; }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---- Table ---- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th { text-align: left; padding: 0.65rem 1rem; font-size: 0.78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); border-bottom: 1px solid var(--border); }
td { padding: 0.75rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface2); }

/* ---- Badge ---- */
.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge-admin   { background: rgba(108,99,255,.2); color: var(--accent); }
.badge-user    { background: rgba(140,148,170,.15); color: var(--muted); }
.badge-active  { background: rgba(76,175,130,.15); color: var(--success); }
.badge-inactive{ background: rgba(224,82,82,.15);  color: var(--danger); }

/* ---- Alert ---- */
.alert {
    padding: 0.8rem 1rem;
    border-radius: 6px;
    margin-bottom: 1.2rem;
    font-size: 0.9rem;
    border-left: 3px solid;
}
.alert-error   { background: rgba(224,82,82,.1);   border-color: var(--danger);  color: var(--danger); }
.alert-success { background: rgba(76,175,130,.1);  border-color: var(--success); color: var(--success); }
.alert-info    { background: rgba(108,99,255,.1);  border-color: var(--accent);  color: var(--accent); }

/* ---- 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(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    width: 100%;
    max-width: 420px;
}
.modal h3 { margin-bottom: 1.25rem; }

/* ---- Misc ---- */
.flex { display: flex; }
.gap-2 { gap: 0.5rem; }
.mt-1 { margin-top: 0.5rem; }
.text-muted { color: var(--muted); font-size: 0.85rem; }
