:root {
    --bg: #081225;
    --panel: #0d1b34;
    --panel-2: #10203d;
    --border: #1d335a;
    --text: #f4f7fb;
    --muted: #9db0d1;
    --accent: #6ea8ff;
    --accent-strong: #4e8fff;
    --accent-soft: rgba(110, 168, 255, 0.16);
    --success: #1f9d68;
    --success-soft: rgba(31, 157, 104, 0.16);
    --danger: #d05c5c;
    --danger-soft: rgba(208, 92, 92, 0.16);
    --warning: #d6a94b;
    --warning-soft: rgba(214, 169, 75, 0.16);
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
    --radius: 18px;
    --radius-sm: 12px;
}

* {
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

body {
    margin: 0;
    background: radial-gradient(circle at top left, rgba(110, 168, 255, 0.08), transparent 28%), linear-gradient(180deg, #06101f 0%, #081225 100%);
    color: var(--text);
    font-family: "Segoe UI", Inter, Arial, sans-serif;
    line-height: 1.5;
}

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

    a:hover {
        text-decoration: underline;
    }

.layout {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 260px 1fr;
}

.sidebar {
    background: rgba(6, 14, 28, 0.92);
    border-right: 1px solid var(--border);
    padding: 28px 20px;
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.brand {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    margin-bottom: 28px;
}

    .brand span {
        color: var(--accent);
    }

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

    .nav a {
        display: block;
        padding: 12px 14px;
        border-radius: 12px;
        color: var(--text);
        background: transparent;
        transition: 0.18s ease;
    }

        .nav a:hover {
            background: var(--accent-soft);
            text-decoration: none;
        }

.main {
    padding: 28px;
}

.page-header {
    margin-bottom: 22px;
}

.page-title {
    margin: 0 0 6px;
    font-size: 1.9rem;
    font-weight: 700;
}

.page-subtitle {
    margin: 0;
    color: var(--muted);
}

.grid {
    display: grid;
    gap: 18px;
    margin-bottom: 20px;
}

    .grid.cols-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .grid.cols-3 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .grid.cols-4 {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

.card {
    background: linear-gradient(180deg, rgba(16, 32, 61, 0.95), rgba(13, 27, 52, 0.95));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 20px;
}

    .card h1,
    .card h2,
    .card h3 {
        margin-top: 0;
        margin-bottom: 10px;
    }

.muted {
    color: var(--muted);
}

.kpi {
    font-size: 2rem;
    font-weight: 700;
    margin-top: 8px;
}

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

    .form-grid .span-2 {
        grid-column: span 2;
    }

label {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 0.95rem;
    font-weight: 600;
}

input,
select,
textarea {
    width: 100%;
    background: #09162b;
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    padding: 12px 14px;
    font: inherit;
    outline: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

    input::placeholder,
    textarea::placeholder {
        color: #7287ab;
    }

    input:focus,
    select:focus,
    textarea:focus {
        border-color: var(--accent);
        box-shadow: 0 0 0 4px rgba(110, 168, 255, 0.14);
        background: #0b1931;
    }

    input:disabled,
    select:disabled,
    textarea:disabled,
    input[readonly],
    textarea[readonly] {
        opacity: 0.7;
        cursor: not-allowed;
        background: rgba(255, 255, 255, 0.04);
    }

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

.stack {
    display: grid;
    gap: 1rem;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

    .checkbox-row input[type="checkbox"] {
        width: auto;
        margin: 0;
    }

    .checkbox-row label {
        margin: 0;
        color: var(--text);
        font-weight: 500;
    }

.actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

button,
.button,
a.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid transparent;
    background: linear-gradient(180deg, var(--accent), var(--accent-strong));
    color: white;
    padding: 11px 16px;
    border-radius: 12px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.18s ease, opacity 0.18s ease, background 0.18s ease;
    box-shadow: 0 8px 20px rgba(78, 143, 255, 0.24);
    text-decoration: none;
}

    button:hover,
    .button:hover,
    a.button:hover {
        text-decoration: none;
        transform: translateY(-1px);
        opacity: 0.98;
    }

    button.secondary,
    .button.secondary,
    a.button.secondary {
        background: transparent;
        border-color: var(--border);
        color: var(--text);
        box-shadow: none;
    }

        button.secondary:hover,
        .button.secondary:hover,
        a.button.secondary:hover {
            background: rgba(255, 255, 255, 0.04);
        }

    button.danger,
    .button.danger,
    a.button.danger {
        background: linear-gradient(180deg, #d86c6c, #c15454);
        box-shadow: 0 8px 20px rgba(208, 92, 92, 0.24);
    }

    button.warning,
    .button.warning,
    a.button.warning {
        background: linear-gradient(180deg, #dcb55e, #c79a35);
        box-shadow: 0 8px 20px rgba(214, 169, 75, 0.24);
        color: #091225;
    }

    button.sm,
    .button.sm,
    a.button.sm {
        padding: 8px 12px;
        border-radius: 10px;
        font-size: 0.9rem;
    }

.table-wrap {
    overflow-x: auto;
    border-radius: 14px;
}

.table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
}

    .table th,
    .table td {
        text-align: left;
        padding: 14px 12px;
        border-bottom: 1px solid rgba(157, 176, 209, 0.14);
        vertical-align: middle;
    }

    .table th {
        color: #a9bce0;
        font-size: 0.92rem;
        font-weight: 700;
        background: rgba(255, 255, 255, 0.02);
    }

    .table tbody tr:hover {
        background: rgba(255, 255, 255, 0.025);
    }

.badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 700;
    background: rgba(157, 176, 209, 0.14);
    color: var(--text);
}

    .badge.good {
        background: var(--success-soft);
        color: #88e0b8;
    }

    .badge.bad {
        background: var(--danger-soft);
        color: #ffaaaa;
    }

    .badge.warning {
        background: var(--warning-soft);
        color: #ffd98b;
    }

.stat-row {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.stat-pill {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    color: var(--muted);
    border-radius: 999px;
    padding: 8px 12px;
    font-size: 0.92rem;
}

.alert {
    border-radius: 14px;
    padding: 14px 16px;
    margin-bottom: 16px;
    border: 1px solid var(--border);
}

    .alert.success {
        background: var(--success-soft);
        border-color: rgba(31, 157, 104, 0.35);
    }

    .alert.error {
        background: var(--danger-soft);
        border-color: rgba(208, 92, 92, 0.35);
    }

    .alert.warning {
        background: var(--warning-soft);
        border-color: rgba(214, 169, 75, 0.35);
    }

.text-danger,
.validation-summary-errors,
.field-validation-error,
.validation-summary-valid {
    color: #ff9d9d;
    font-size: 0.92rem;
}

    .validation-summary-errors ul {
        margin: 0;
        padding-left: 1.2rem;
    }

.input-validation-error,
select.input-validation-error,
textarea.input-validation-error {
    border-color: var(--danger);
    box-shadow: 0 0 0 4px rgba(208, 92, 92, 0.12);
}

.user-panel {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.user-name {
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}

.user-email {
    font-size: 0.9rem;
    color: var(--muted);
    margin: 4px 0 12px;
    word-break: break-word;
}

pre {
    margin: 0;
    font-family: inherit;
    color: var(--text);
}

hr {
    border: 0;
    border-top: 1px solid var(--border);
    margin: 20px 0;
}

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

    .sidebar {
        position: relative;
        height: auto;
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }

    .grid.cols-3,
    .grid.cols-4,
    .form-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .user-panel {
        margin-top: 2rem;
    }
}

@media (max-width: 720px) {
    .main {
        padding: 18px;
    }

    .grid.cols-2,
    .grid.cols-3,
    .grid.cols-4,
    .form-grid {
        grid-template-columns: 1fr;
    }

        .form-grid .span-2 {
            grid-column: span 1;
        }

    .table {
        min-width: 620px;
    }

    .page-title {
        font-size: 1.5rem;
    }

    .actions {
        flex-direction: column;
        align-items: stretch;
    }

        .actions > * {
            width: 100%;
        }
}
