:root {
    --ink: #15191f;
    --muted: #667085;
    --line: #d9dee7;
    --paper: #ffffff;
    --wash: #f3f5f8;
    --night: #16202a;
    --green: #0c7a58;
    --red: #c73c33;
    --gold: #d99a22;
    --blue: #276ef1;
    --radius: 8px;
}

* {
    box-sizing: border-box;
}

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

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

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

.admin-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 250px;
    padding: 20px;
    color: #fff;
    background: var(--night);
}

.admin-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 28px;
    font-size: 18px;
    font-weight: 900;
}

.admin-brand small {
    color: #b9c2cf;
}

.admin-sidebar nav {
    display: grid;
    gap: 8px;
}

.admin-sidebar a {
    border-radius: var(--radius);
    padding: 11px 12px;
    color: #e9eef5;
    font-weight: 800;
}

.admin-sidebar nav a:hover,
.admin-sidebar nav a.is-active {
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
}

.admin-main {
    min-height: 100vh;
    margin-left: 250px;
    padding: 26px;
}

.admin-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    margin-bottom: 22px;
}

.admin-topbar p {
    margin: 0 0 4px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.admin-topbar h1 {
    margin: 0;
    font-size: 30px;
}

.admin-topbar > span {
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    font-weight: 800;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.stat-grid article,
.admin-card,
.login-card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--paper);
}

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

.stat-grid span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

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

.admin-grid {
    display: grid;
    gap: 18px;
}

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

.form-grid {
    grid-template-columns: minmax(0, 1fr) 360px;
    align-items: start;
}

.admin-card {
    padding: 18px;
}

.admin-card h2 {
    margin: 0 0 16px;
    font-size: 21px;
}

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

.card-head h2 {
    margin: 0;
}

.admin-help {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.card-head a,
.button,
.admin-form > button,
.button-row button,
.login-card button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    border: 0;
    border-radius: var(--radius);
    color: #fff;
    background: var(--green);
    font-weight: 900;
    padding: 0 14px;
}

.card-head span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.admin-list {
    display: grid;
    gap: 10px;
}

.admin-list a {
    display: block;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fbfcfe;
}

.admin-list span {
    display: block;
    color: var(--muted);
    font-size: 13px;
}

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

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

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

th {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

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

.actions a,
.actions button {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: var(--ink);
    background: #fff;
    font-size: 13px;
    font-weight: 800;
    padding: 7px 9px;
}

.actions button {
    color: var(--red);
}

.filter-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.filter-pills a {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    color: #344054;
    font-size: 14px;
    font-weight: 800;
    padding: 8px 11px;
}

.filter-pills a.active {
    border-color: #bfd3cc;
    color: var(--green);
    background: #eaf6f2;
}

.admin-form label {
    display: grid;
    gap: 7px;
    margin-bottom: 14px;
    color: #344054;
    font-weight: 800;
}

.admin-form input,
.admin-form select,
.admin-form textarea,
.login-card input {
    width: 100%;
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    color: var(--ink);
    padding: 10px 11px;
}

.admin-form textarea {
    resize: vertical;
}

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

.check-row {
    display: flex !important;
    grid-template-columns: none;
    align-items: center;
    gap: 10px;
}

.check-row input {
    width: auto;
}

.checkbox-list {
    display: grid;
    gap: 8px;
    max-height: 320px;
    overflow: auto;
    padding-right: 4px;
}

.checkbox-list.tall {
    max-height: 520px;
}

.checkbox-list label {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: start;
    gap: 10px;
    margin: 0;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fbfcfe;
}

.checkbox-list input {
    width: auto;
    margin-top: 3px;
}

.checkbox-list strong,
.checkbox-list small {
    display: block;
}

.checkbox-list small {
    color: var(--muted);
    font-size: 12px;
}

.image-preview {
    width: 100%;
    max-height: 210px;
    object-fit: cover;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    margin-bottom: 14px;
}

.button-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
}

.button-row a {
    color: var(--muted);
    font-weight: 900;
}

.admin-alert,
.alert {
    margin-bottom: 14px;
    padding: 12px 14px;
    border: 1px solid #f4c7a1;
    border-radius: var(--radius);
    background: #fff7ed;
    color: #7a3f12;
}

.admin-alert.error,
.alert.error {
    border-color: #efb6b1;
    background: #fff1f0;
    color: #9f241b;
}

.prediction-editor {
    display: grid;
    gap: 8px;
    overflow-x: auto;
}

.prediction-editor-head,
.prediction-editor-row {
    display: grid;
    grid-template-columns: 68px 110px 150px 70px 70px 70px 80px 90px 80px minmax(220px, 1fr);
    gap: 8px;
    min-width: 1050px;
    align-items: center;
}

.prediction-editor-head {
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.login-screen {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: var(--night);
}

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

.login-card img {
    display: block;
    margin-bottom: 14px;
}

.login-card h1 {
    margin: 0 0 6px;
}

.login-card p {
    margin: 0 0 18px;
    color: var(--muted);
}

.login-card label {
    display: grid;
    gap: 7px;
    margin-bottom: 13px;
    color: #344054;
    font-weight: 800;
}

.login-card button {
    width: 100%;
    margin-top: 6px;
}

.login-card small {
    display: block;
    margin-top: 14px;
    color: var(--muted);
}

@media (max-width: 1020px) {
    .admin-sidebar {
        position: static;
        width: auto;
    }

    .admin-main {
        margin-left: 0;
        padding: 18px;
    }

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

    .stat-grid,
    .admin-grid.two,
    .form-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 700px) {
    .admin-sidebar nav,
    .stat-grid,
    .admin-grid.two,
    .form-grid,
    .field-row {
        grid-template-columns: 1fr;
    }

    .admin-topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .actions {
        min-width: 150px;
    }
}
