:root {
    --bg: #eef3f9;
    --surface: #ffffff;
    --soft: #f8fbff;
    --text: #102033;
    --muted: #64748b;
    --line: #d7e1ee;
    --brand: #2563eb;
    --danger: #dc2626;
    --green: #16a34a;
    --shadow: 0 16px 44px rgba(15, 23, 42, 0.09);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.5;
}

.public-body {
    width: 100%;
    min-width: 0;
}

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

button,
input,
select,
textarea {
    font: inherit;
}

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

.public-layout {
    width: 100%;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 24px 12px 48px;
}

.public-main {
    width: 100%;
    max-width: 1180px;
    min-height: 100vh;
    display: block;
    margin: 0 auto;
    padding: 0;
}

.install-shell {
    width: 100%;
    display: grid;
    gap: 16px;
}

.install-shell > .card,
.install-form {
    width: 100%;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: 18px;
    padding: 18px;
    border-right: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.97);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.brand span {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    background: var(--brand);
    color: #fff;
    font-weight: 900;
}

.sidebar nav {
    display: grid;
    align-content: start;
    gap: 8px;
}

.actor-badge {
    display: block;
    padding: 8px 10px;
    border-radius: 8px;
    background: #f8fbff;
    color: var(--muted);
    font-size: 0.74rem;
    font-weight: 900;
    overflow-wrap: anywhere;
}

.sidebar nav a,
.primary,
.secondary,
.logout,
.actions-cell a,
.actions-cell button,
.pagination a,
.pagination span,
.pagination strong {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    border: 0;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 900;
    white-space: nowrap;
    cursor: pointer;
}

.sidebar nav a,
.secondary,
.pagination a,
.pagination span,
.pagination strong,
.actions-cell a {
    background: #eef4ff;
    color: #24415f;
}

.primary {
    background: var(--brand);
    color: #fff;
}

.logout,
.actions-cell button {
    width: 100%;
    background: #fee2e2;
    color: #991b1b;
}

.main {
    width: min(1180px, calc(100% - 24px));
    margin: 18px auto 48px;
}

.card {
    margin-bottom: 16px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.danger {
    border-color: #fecaca;
}

.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 16px;
}

.eyebrow {
    color: var(--brand);
    font-size: 0.76rem;
    font-weight: 900;
    text-transform: uppercase;
}

h1 {
    margin: 4px 0 0;
    font-size: clamp(1.6rem, 4vw, 2.35rem);
    line-height: 1.1;
}

p {
    color: var(--muted);
    font-weight: 700;
}

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

.filter-row {
    grid-template-columns: minmax(0, 1fr) 150px 150px auto;
    align-items: end;
    margin-bottom: 14px;
}

.stack {
    display: grid;
    gap: 12px;
}

label span {
    display: block;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 900;
}

input,
select,
textarea {
    width: 100%;
    min-height: 42px;
    margin-top: 5px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
}

textarea {
    resize: vertical;
}

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

.actions,
.pagination {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.full {
    width: 100%;
}

.login-card {
    width: min(420px, 100%);
    margin: 10vh auto 0;
}

.install-card {
    width: 100%;
}

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

.alert-success {
    background: #dcfce7;
    color: #166534;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
}

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

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

.stat-card {
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.stat-card span {
    display: block;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 900;
}

.stat-card strong {
    display: block;
    margin-top: 6px;
    color: var(--brand);
    font-size: 1.45rem;
    line-height: 1;
}

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

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

th {
    background: var(--soft);
    color: #344054;
    font-size: 0.82rem;
}

td small {
    display: block;
    color: var(--muted);
}

.status {
    display: inline-flex;
    min-height: 28px;
    align-items: center;
    justify-content: center;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 900;
}

.status-active {
    background: #dcfce7;
    color: #166534;
}

.status-inactive {
    background: #fef3c7;
    color: #92400e;
}

.status-revoked {
    background: #fee2e2;
    color: #991b1b;
}

.status-blocked {
    background: #fee2e2;
    color: #991b1b;
}

.actions-cell {
    display: flex;
    gap: 8px;
}

.actions-cell form {
    margin: 0;
}

@media (max-width: 900px) {
    .layout,
    .form-grid,
    .filter-row,
    .stats-row {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        height: auto;
        grid-template-rows: auto auto auto;
        padding: 12px;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .sidebar nav {
        display: flex;
        overflow-x: auto;
    }

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

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