:root {
    --navy: #172554;
    --blue: #335cff;
    --blue-dark: #2548db;
    --text: #172033;
    --muted: #65718a;
    --border: #e3e8f0;
    --background: #f4f7fb;
    --white: #fff;
    --green: #12805c;
    --red: #c03737;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--background);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI",
        sans-serif;
    font-size: 15px;
}

h1, h2, p {
    margin-top: 0;
}

h1 {
    margin-bottom: 8px;
    font-size: clamp(1.6rem, 4vw, 2.2rem);
    letter-spacing: -0.04em;
}

h2 {
    font-size: 1.1rem;
}

.page-wrap {
    min-height: 100vh;
    padding: 36px 16px;
    display: grid;
    place-items: center;
}

.form-card,
.edit-card,
.table-card,
.stat-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 8px 28px rgba(23, 37, 84, 0.05);
}

.form-card {
    width: min(100%, 520px);
    padding: 32px;
}

.login-card {
    max-width: 430px;
}

.brand-mark {
    width: 42px;
    height: 42px;
    margin-bottom: 20px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: #e9eeff;
    color: var(--blue);
    font-weight: 800;
}

.eyebrow {
    margin-bottom: 8px;
    color: var(--blue);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.13em;
}

.intro {
    margin-bottom: 24px;
    color: var(--muted);
    line-height: 1.5;
}

label {
    display: block;
    margin: 16px 0 7px;
    font-size: 0.88rem;
    font-weight: 650;
}

input,
select {
    width: 100%;
    min-height: 46px;
    padding: 11px 12px;
    border: 1px solid #d7deea;
    border-radius: 9px;
    background: white;
    color: var(--text);
    font: inherit;
    outline: none;
}

input:focus,
select:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(51, 92, 255, 0.12);
}

.button,
.small-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 9px 14px;
    border: 0;
    border-radius: 9px;
    font: inherit;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

.primary {
    background: var(--blue);
    color: white;
}

.primary:hover {
    background: var(--blue-dark);
}

.secondary {
    background: #edf1f7;
    color: var(--text);
}

.danger-outline {
    border: 1px solid #f1c9c9;
    background: #fff;
    color: var(--red);
}

.full-width {
    width: 100%;
    min-height: 48px;
    margin-top: 23px;
}

.privacy-note {
    margin: 18px 0 0;
    color: var(--muted);
    font-size: 0.78rem;
    text-align: center;
}

.notice {
    margin: 16px 0;
    padding: 12px 14px;
    border-radius: 9px;
    line-height: 1.4;
}

.success {
    background: #eaf8f1;
    color: #126b4b;
}

.error {
    background: #fff0f0;
    color: #a42d2d;
}

.dashboard {
    width: min(100% - 32px, 1440px);
    margin: 32px auto;
}

.dashboard-header,
.toolbar,
.button-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin: 22px 0;
}

.stat-card {
    padding: 18px;
}

.stat-card span {
    display: block;
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 0.85rem;
}

.stat-card strong {
    font-size: 1.7rem;
}

.toolbar {
    justify-content: flex-start;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.inline-form {
    display: inline-flex;
    margin: 0;
}

.edit-card,
.table-card {
    margin-top: 18px;
    padding: 20px;
}

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

.edit-grid label {
    margin-top: 8px;
}

.wide {
    grid-column: 1 / -1;
}

.button-row {
    justify-content: flex-start;
    margin-top: 18px;
}

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

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th, td {
    padding: 13px 11px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
    line-height: 1.45;
}

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

td {
    font-size: 0.88rem;
}

.badge {
    display: inline-block;
    padding: 5px 9px;
    border-radius: 20px;
    font-size: 0.76rem;
    font-weight: 750;
}

.badge.active {
    background: #e6f7ef;
    color: var(--green);
}

.badge.banned {
    background: #fff0f0;
    color: var(--red);
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.small-button {
    min-height: 32px;
    padding: 6px 9px;
    background: #edf1f7;
    color: var(--text);
    font-size: 0.78rem;
}

.delete-button {
    background: #fff0f0;
    color: var(--red);
}

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

@media (max-width: 720px) {
    .page-wrap {
        padding: 16px 12px;
        align-items: start;
    }

    .form-card {
        padding: 23px 19px;
    }

    .dashboard {
        width: calc(100% - 24px);
        margin: 18px auto;
    }

    .dashboard-header {
        align-items: flex-start;
    }

    .stats {
        gap: 8px;
    }

    .stat-card {
        padding: 13px 11px;
    }

    .stat-card span {
        font-size: 0.74rem;
    }

    .stat-card strong {
        font-size: 1.35rem;
    }

    .edit-grid {
        grid-template-columns: 1fr;
    }

    .wide {
        grid-column: auto;
    }

    /* Turn table rows into compact mobile cards. */
    .table-scroll {
        overflow: visible;
    }

    table, tbody, tr, td {
        display: block;
        width: 100%;
    }

    thead {
        display: none;
    }

    tbody tr {
        margin-bottom: 12px;
        padding: 10px 12px;
        border: 1px solid var(--border);
        border-radius: 12px;
    }

    td {
        display: grid;
        grid-template-columns: 95px minmax(0, 1fr);
        gap: 8px;
        padding: 8px 0;
        border-bottom: 1px solid #f0f2f6;
        overflow-wrap: anywhere;
    }

    td:last-child {
        border-bottom: 0;
    }

    td::before {
        content: attr(data-label);
        color: var(--muted);
        font-size: 0.76rem;
        font-weight: 700;
    }

    .actions {
        align-items: flex-start;
    }
}

@media (max-width: 420px) {
    .dashboard-header {
        flex-direction: column;
    }

    .toolbar > *,
    .toolbar .inline-form,
    .toolbar .button {
        width: 100%;
    }

    .toolbar .inline-form .button {
        width: 100%;
    }

    .stats {
        grid-template-columns: 1fr;
    }
}