:root {
    --bg: #080d19;
    --sidebar: #0b1220;
    --panel: #111a2b;
    --panel2: #172239;
    --border: rgba(148,163,184,.15);
    --text: #f1f5f9;
    --muted: #91a0b8;
    --accent: #38bdf8;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, system-ui, sans-serif;
}

.dashboard-shell {
    display: grid;
    grid-template-columns: 250px minmax(0,1fr);
    min-height: 100vh;
}

.sidebar {
    padding: 25px 17px;
    background: var(--sidebar);
    border-right: 1px solid var(--border);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 5px 10px 30px;
}

.brand-icon {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border-radius: 13px;
    background: linear-gradient(135deg,#0284c7,#4f46e5);
    font-weight: 800;
}

.sidebar-label {
    margin: 20px 10px 9px;
    color: #64748b;
    font-size: 10px;
    letter-spacing: 1.3px;
    text-transform: uppercase;
}

.nav-link {
    display: block;
    padding: 12px;
    margin-bottom: 4px;
    color: #a5b4c9;
    text-decoration: none;
    font-size: 13px;
    border-radius: 9px;
}

.nav-link:hover {
    background: var(--panel2);
    color: white;
}

.main-content {
    min-width: 0;
    padding: 30px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 30px;
}

.account-info {
    text-align: right;
}

.logout-btn {
    margin-top: 8px;
    background: none;
    border: 0;
    color: var(--accent);
    cursor: pointer;
}

.muted, .stat-label {
    color: var(--muted);
    font-size: 13px;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(3,minmax(0,1fr));
    gap: 16px;
    margin-bottom: 22px;
}

.stat-card, .panel {
    padding: 22px;
    margin-bottom: 20px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 15px;
}

.stat-number {
    margin: 12px 0;
    font-size: 29px;
    font-weight: 750;
}

.status-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 18px;
}

.pill {
    display: inline-block;
    padding: 5px 9px;
    border-radius: 20px;
    color: #6ee7b7;
    background: rgba(52,211,153,.12);
    font-size: 11px;
}

.status-inactive {
    color: #fca5a5;
    font-size: 11px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    text-align: left;
    padding: 14px 10px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

th { color: var(--muted); }
td { color: #dbe5f3; }

.table-wrap { overflow-x: auto; }

.success-message {
    padding: 14px;
    margin-bottom: 20px;
    color: #6ee7b7;
    background: rgba(16,185,129,.12);
    border: 1px solid rgba(16,185,129,.24);
    border-radius: 10px;
}

.error {
    padding: 14px;
    margin-bottom: 20px;
    color: #fca5a5;
    background: rgba(239,68,68,.12);
    border: 1px solid rgba(239,68,68,.25);
    border-radius: 10px;
}

.section-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 17px;
    border: 0;
    border-radius: 10px;
    background: linear-gradient(100deg,#0284c7,#4f46e5);
    color: white;
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.small-action {
    display: inline-block;
    padding: 8px 11px;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: #7dd3fc;
    background: var(--panel);
    text-decoration: none;
    font-size: 12px;
    cursor: pointer;
}

.action-group {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
}

.role-chip {
    display: inline-block;
    padding: 5px 8px;
    margin: 2px;
    border: 1px solid rgba(56,189,248,.18);
    border-radius: 7px;
    background: rgba(56,189,248,.1);
    color: #7dd3fc;
    font-size: 11px;
}

.field { margin-bottom: 20px; }

.field label {
    display: block;
    margin-bottom: 8px;
    color: #cbd5e1;
    font-size: 13px;
}

.field input:not([type=checkbox]),
.field select {
    display: block;
    width: 100%;
    padding: 13px;
    background: #0a1221;
    color: white;
    border: 1px solid var(--border);
    border-radius: 10px;
}

.form-panel { max-width: 850px; }

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 24px;
}

.permission-group {
    margin-top: 25px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
}

.permission-group-title {
    margin-bottom: 15px;
    color: #7dd3fc;
    font-size: 12px;
    font-weight: 750;
    text-transform: uppercase;
}

.permission-grid, .role-selection {
    display: grid;
    grid-template-columns: repeat(3,minmax(0,1fr));
    gap: 10px;
}

.permission-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--border);
    background: #0e192a;
    border-radius: 10px;
    cursor: pointer;
}

.permission-item input {
    accent-color: #0ea5e9;
    flex-shrink: 0;
}

.permission-item strong {
    display: block;
    overflow-wrap: anywhere;
    font-size: 12px;
}

.permission-item small {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 10px;
}

.danger-panel {
    border-color: rgba(239,68,68,.25);
}

.danger-btn {
    padding: 11px 16px;
    color: white;
    background: #991b1b;
    border: 1px solid #b91c1c;
    border-radius: 9px;
    cursor: pointer;
}

@media(max-width:950px) {
    .permission-grid, .role-selection {
        grid-template-columns: repeat(2,minmax(0,1fr));
    }
}

@media(max-width:800px) {
    .dashboard-shell { grid-template-columns: 1fr; }
    .sidebar { border-right: 0; border-bottom: 1px solid var(--border); }
    .stat-grid { grid-template-columns: 1fr; }
    .main-content { padding: 18px 13px; }
}

@media(max-width:600px) {
    .topbar, .section-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .account-info { text-align: left; }

    .permission-grid, .role-selection {
        grid-template-columns: 1fr;
    }
}
