:root {
    --sidebar-w: 220px;
    --brand-bg: #0f172a;
    --sidebar-bg: #1e293b;
    --sidebar-hover: #334155;
    --sidebar-active: #2563eb;
    --topbar-bg: #ffffff;
    --content-bg: #f8fafc;
    --border: #e2e8f0;
    --text: #1e293b;
    --text-muted: #64748b;
    --primary: #2563eb;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #d97706;
    --radius: 8px;
}

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

body.admin-body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
    display: flex;
    min-height: 100vh;
    background: var(--content-bg);
    color: var(--text);
}

/* ── Sidebar ── */
.sidebar {
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: fixed;
    top: 0; left: 0; bottom: 0;
}

.sidebar-brand {
    background: var(--brand-bg);
    padding: 20px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
}
.brand-icon { font-size: 24px; color: #60a5fa; }
.brand-name { font-weight: 700; font-size: 15px; }
.brand-sub  { font-size: 11px; color: #94a3b8; }

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

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius);
    color: #cbd5e1;
    text-decoration: none;
    margin-bottom: 2px;
    transition: background 0.15s;
}
.nav-item:hover  { background: var(--sidebar-hover); color: white; }
.nav-item.active { background: var(--sidebar-active); color: white; font-weight: 600; }
.nav-icon { font-size: 16px; width: 20px; text-align: center; }

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid #334155;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.sidebar-user { font-size: 12px; color: #94a3b8; }
.btn-logout {
    font-size: 12px;
    color: #f87171;
    text-decoration: none;
    padding: 6px 0;
}
.btn-logout:hover { color: #fca5a5; }

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

.topbar {
    background: var(--topbar-bg);
    border-bottom: 1px solid var(--border);
    padding: 16px 28px;
}
.page-title { font-size: 18px; font-weight: 600; }

.content-area { padding: 28px; }

/* ── Cards ── */
.card {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
}
.card-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}
.card-value { font-size: 28px; font-weight: 700; color: var(--text); }
.card-sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

/* ── Tables ── */
.table-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.table-card-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
}
table { width: 100%; border-collapse: collapse; }
th {
    background: #f8fafc;
    padding: 10px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--border);
}
td {
    padding: 12px 16px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 13px;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f8fafc; }

/* ── Badges ── */
.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}
.badge-active   { background: #dcfce7; color: #16a34a; }
.badge-inactive { background: #fee2e2; color: #dc2626; }
.badge-standard     { background: #dbeafe; color: #1d4ed8; }
.badge-professional { background: #ede9fe; color: #6d28d9; }
.badge-enterprise   { background: #fef9c3; color: #854d0e; }

/* ── Buttons ── */
.btn {
    display: inline-block;
    padding: 8px 16px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: opacity 0.15s;
}
.btn:hover { opacity: 0.85; }
.btn-primary  { background: var(--primary); color: white; }
.btn-success  { background: var(--success); color: white; }
.btn-danger   { background: var(--danger);  color: white; }
.btn-warning  { background: var(--warning); color: white; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}

/* ── Forms ── */
.form-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    max-width: 560px;
}
.form-group { margin-bottom: 18px; }
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 6px;
}
.form-control {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.15s;
}
.form-control:focus { outline: none; border-color: var(--primary); }
.form-select {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    background: white;
}
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.form-actions { display: flex; gap: 10px; margin-top: 24px; }
.field-validation-error { color: var(--danger); font-size: 12px; }

/* ── Alerts ── */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 14px;
}
.alert-success { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.alert-error   { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }

/* ── Login Page ── */
body.login-page {
    background: #0f172a;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}
.login-box {
    background: white;
    border-radius: 12px;
    padding: 40px;
    width: 380px;
}
.login-logo {
    text-align: center;
    margin-bottom: 28px;
}
.login-logo .logo-icon { font-size: 40px; color: var(--primary); }
.login-logo h1 { font-size: 20px; font-weight: 700; margin-top: 8px; }
.login-logo p  { font-size: 13px; color: var(--text-muted); }
.btn-login {
    width: 100%;
    padding: 10px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 8px;
}
.btn-login:hover { opacity: 0.9; }
.login-error {
    background: #fee2e2;
    color: #b91c1c;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 16px;
    display: none;
}

/* ── Detail sections ── */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}
.detail-item label { font-size: 12px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; }
.detail-item span  { display: block; font-size: 14px; margin-top: 2px; }
