:root {
    --ink: #101936;
    --muted: #74809a;
    --line: #e7eaf1;
    --brand: #2c176d;
    --brand-2: #5f3bd4;
    --bg: #f6f7fb;
    --ok: #0e8f5a;
    --danger: #b42318;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--ink);
    background: var(--bg);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
    color: inherit;
    text-decoration: none;
}

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

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 24px 14px;
    background: #fff;
    border-right: 1px solid var(--line);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 10px 28px;
    font-size: 20px;
}

.brand.center {
    justify-content: center;
    padding: 0;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    color: #111827;
    background: #7ed957;
    border: 3px solid #111827;
    border-radius: 50%;
    font-weight: 900;
}

.role {
    margin: 0 10px 14px;
    color: #8790aa;
    font-size: 11px;
    letter-spacing: 3px;
    text-transform: uppercase;
}

nav {
    display: grid;
    gap: 12px;
}

nav a,
.logout {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    padding: 0 16px;
    border-radius: 8px;
    font-weight: 800;
}

nav a.active {
    color: #fff;
    background: var(--brand);
    box-shadow: 0 16px 30px rgba(44, 23, 109, .22);
}

.logout {
    position: absolute;
    right: 14px;
    bottom: 18px;
    left: 14px;
    color: var(--danger);
    background: #fff3f1;
}

.content {
    padding: 28px;
}

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

h1,
h2 {
    margin: 0;
}

h1 {
    font-size: 28px;
}

h2 {
    margin-bottom: 16px;
    font-size: 18px;
}

.topbar p,
.empty,
small {
    color: var(--muted);
}

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

.metric-grid article,
.panel,
.login-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 10px 24px rgba(16, 25, 54, .05);
}

.metric-grid article {
    padding: 18px;
}

.metric-grid span {
    display: block;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.metric-grid strong {
    display: block;
    margin-top: 8px;
    font-size: 28px;
}

.panel {
    padding: 20px;
    margin-bottom: 20px;
}

.split {
    display: grid;
    grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

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

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

label {
    display: grid;
    gap: 6px;
    color: #35405a;
    font-size: 13px;
    font-weight: 800;
}

input,
select,
textarea,
button {
    width: 100%;
    min-height: 42px;
    border-radius: 7px;
    font: inherit;
}

input,
select,
textarea {
    border: 1px solid #d8deea;
    padding: 9px 11px;
    color: var(--ink);
    background: #fff;
}

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

button {
    border: 0;
    padding: 0 16px;
    color: #fff;
    background: var(--brand);
    font-weight: 900;
    cursor: pointer;
}

button.secondary {
    width: auto;
    color: var(--brand);
    background: #eee9ff;
}

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

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

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

th {
    color: #5f6c86;
    background: #f8f9fc;
    font-size: 12px;
    text-transform: uppercase;
}

.alert {
    margin-bottom: 18px;
    padding: 12px 14px;
    border-radius: 8px;
    font-weight: 800;
}

.alert.success {
    color: var(--ok);
    background: #eaf8f1;
}

.alert.error {
    color: var(--danger);
    background: #fff0ee;
}

.login-page {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 18px;
}

.login-card {
    width: min(420px, 100%);
    padding: 28px;
}

.login-card h1 {
    margin: 18px 0;
    text-align: center;
}

.item-row {
    display: grid;
    grid-template-columns: 1fr 140px 140px;
    gap: 10px;
    margin-bottom: 10px;
}

code {
    padding: 2px 5px;
    background: #f0f2f7;
    border-radius: 5px;
}

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

    .sidebar {
        position: static;
        height: auto;
    }

    .logout {
        position: static;
        margin-top: 14px;
    }

    .metric-grid,
    .form-row,
    .item-row {
        grid-template-columns: 1fr;
    }
}
