:root {
    --bg: #f4f7fb;
    --panel: #ffffff;
    --line: #d9e1ec;
    --text: #1b2430;
    --muted: #667487;
    --accent: #1f5eff;
    --accent-soft: #eef4ff;
    --success: #1f8b4c;
    --success-soft: #eaf7ee;
    --warning: #9c6500;
    --warning-soft: #fff5e2;
    --danger: #c62828;
    --danger-soft: #fdecec;
    --shadow: 0 16px 40px rgba(22, 32, 46, 0.08);
    --radius: 18px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    background: var(--bg);
    color: var(--text);
    font: 14px/1.5 Inter, Arial, Helvetica, sans-serif;
}

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

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 280px 1fr;
}

.sidebar {
    background: #0f1722;
    color: #fff;
    padding: 24px 18px;
}

.brand-box {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 24px;
}

.brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #3a7bff, #1f5eff);
    font-weight: 800;
    font-size: 20px;
}

.brand-title {
    font-size: 21px;
    font-weight: 800;
}

.brand-subtitle {
    color: #b7c4d4;
    font-size: 12px;
}

.user-card {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 16px;
    padding: 14px;
    margin-bottom: 18px;
}

.user-name { font-weight: 700; margin-bottom: 4px; }
.user-role, .user-meta { color: #c8d2df; font-size: 13px; }

.nav-block {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-block a {
    color: #dce6f2;
    padding: 10px 12px;
    border-radius: 10px;
    text-decoration: none;
}

.nav-block a:hover {
    background: rgba(255,255,255,0.08);
}

.main-content {
    padding: 28px;
}

.guest-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.auth-card {
    width: 100%;
    max-width: 460px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 24px;
    padding: 30px;
    box-shadow: var(--shadow);
}

.auth-brand {
    font-size: 14px;
    font-weight: 800;
    color: var(--accent);
    margin-bottom: 8px;
    letter-spacing: 0.08em;
}

.page-title {
    margin: 0 0 18px;
    font-size: 30px;
    line-height: 1.2;
}

.section-title {
    margin: 26px 0 14px;
    font-size: 22px;
}

.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
}

.hero-card { margin-bottom: 18px; }
.stat-card { min-height: 120px; }
.stat-label { color: var(--muted); }
.stat-value {
    margin-top: 10px;
    font-size: 34px;
    font-weight: 800;
}

.muted { color: var(--muted); }
.small { font-size: 12px; }
.mt-12 { margin-top: 12px; }

.stats-grid,
.cards-grid,
.two-col {
    display: grid;
    gap: 18px;
}

.stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cards-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cards-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.module-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.module-icon {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: var(--accent-soft);
    font-size: 24px;
}

.form-grid {
    display: grid;
    gap: 14px;
}

label {
    display: grid;
    gap: 6px;
    font-weight: 700;
}

input, select, textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 11px 12px;
    font: inherit;
    background: #fff;
    color: var(--text);
}

textarea {
    min-height: 96px;
    resize: vertical;
}

.btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    border: 0;
    border-radius: 12px;
    padding: 10px 16px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
}

.btn:hover { text-decoration: none; opacity: 0.96; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-secondary { background: #e9eef8; color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }

.toolbar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.compact-toolbar {
    margin: 0;
}

.alert {
    border-radius: 14px;
    padding: 12px 14px;
    margin-bottom: 16px;
    border: 1px solid transparent;
}

.alert-success {
    background: var(--success-soft);
    border-color: #b6e1c4;
    color: #19693a;
}

.alert-error {
    background: var(--danger-soft);
    border-color: #f2c1c1;
    color: #8a1f1f;
}

.badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 6px 11px;
    font-size: 12px;
    font-weight: 800;
}

.badge-primary { background: var(--accent-soft); color: var(--accent); }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }

.info-box,
.inner-panel {
    background: #fbfcfe;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 16px;
}

.users-layout {
    display: grid;
    grid-template-columns: 520px 1fr;
    gap: 18px;
}

.sticky-card {
    align-self: start;
}

.permission-row {
    display: grid;
    grid-template-columns: 1fr 180px;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px dashed var(--line);
}

.checkbox-row {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
}

.inline-check {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 400;
}

.inline-check input {
    width: auto;
}

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

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

th, td {
    border-bottom: 1px solid var(--line);
    padding: 12px 10px;
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.stack-badges {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: flex-start;
}

.plain-list {
    margin: 0;
    padding-left: 18px;
}

@media (max-width: 1200px) {
    .users-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 980px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .stats-grid,
    .cards-grid,
    .cards-grid.two,
    .two-col,
    .permission-row {
        grid-template-columns: 1fr;
    }

    .main-content {
        padding: 18px;
    }
}


.toolbar-inline {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 14px;
}
