:root {
    color-scheme: dark;
    --bg: #0b1020;
    --panel: #151d33;
    --panel2: #1b2743;
    --text: #eef3ff;
    --muted: #aeb9d3;
    --accent: #4f8cff;
    --accent2: #73a7ff;
    --danger: #d9534f;
    --ok: #2fa36b;
    --border: #2e3d60;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: Arial, Helvetica, sans-serif;
    background: linear-gradient(135deg, #080c18, #111a2d);
    color: var(--text);
}

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

.topbar {
    min-height: 64px;
    padding: 12px clamp(16px, 4vw, 48px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    background: rgba(8, 12, 24, .94);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.brand {
    color: white;
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: .5px;
}

.topbar nav {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.container {
    width: min(1180px, calc(100% - 28px));
    margin: 30px auto;
    min-height: calc(100vh - 150px);
}

.page-title {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

h1, h2 { margin-top: 0; }
h1 { margin-bottom: 0; }
h2 { font-size: 1.15rem; }

.card {
    background: rgba(21, 29, 51, .96);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 22px;
    margin-bottom: 20px;
    box-shadow: 0 18px 45px rgba(0,0,0,.22);
}

.narrow {
    max-width: 520px;
    margin-left: auto;
    margin-right: auto;
}

.grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

label {
    display: block;
    font-weight: 700;
    margin-bottom: 14px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="file"],
input:not([type]) {
    width: 100%;
    margin-top: 7px;
    padding: 11px 12px;
    color: var(--text);
    background: #0e1528;
    border: 1px solid var(--border);
    border-radius: 9px;
}

input[type="file"] { padding: 9px; }

button, .button {
    display: inline-block;
    border: 0;
    border-radius: 9px;
    padding: 10px 15px;
    background: var(--accent);
    color: white;
    font-weight: 800;
    cursor: pointer;
    text-decoration: none;
}

button:hover, .button:hover { filter: brightness(1.08); text-decoration: none; }
button.danger, .danger { background: var(--danger); }
.small { padding: 7px 10px; font-size: .9rem; }

.alert {
    padding: 12px 14px;
    margin-bottom: 16px;
    border-radius: 10px;
    background: #26385c;
    border: 1px solid #42629b;
}
.alert.success { background: #143a2a; border-color: #2c7d57; }
.alert.error { background: #481f26; border-color: #9a414e; }

.hint {
    color: var(--muted);
    font-size: .9rem;
    line-height: 1.45;
}

.permission-list {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
}

.permission-list span {
    padding: 8px 10px;
    border-radius: 999px;
    font-size: .9rem;
    border: 1px solid var(--border);
}
.permission-list .yes { background: #143a2a; border-color: #2c7d57; }
.permission-list .no { background: #3d2026; border-color: #7f3e48; opacity: .72; text-decoration: line-through; }

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

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

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

th { color: var(--muted); font-size: .9rem; }

.actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.actions form { margin: 0; }

fieldset {
    border: 1px solid var(--border);
    border-radius: 10px;
    margin: 12px 0 16px;
}

legend {
    padding: 0 8px;
    color: var(--muted);
}

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

.checks label {
    margin: 0;
    font-weight: 500;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.user-cards {
    display: grid;
    gap: 16px;
}

.user-card {
    background: var(--panel2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
}

footer {
    padding: 20px;
    text-align: center;
    color: var(--muted);
    border-top: 1px solid var(--border);
}

@media (max-width: 800px) {
    .grid, .form-row { grid-template-columns: 1fr; }
    .page-title { align-items: flex-start; flex-direction: column; }
    .topbar { align-items: flex-start; flex-direction: column; }
}
