:root {
    --bg: #f3f5f9;
    --surface: #ffffff;
    --ink: #18202f;
    --muted: #657083;
    --line: #dfe4ec;
    --blue: #2563eb;
    --blue-dark: #1d4ed8;
    --green: #15803d;
    --red: #b42318;
    --amber: #b7791f;
    --nav: #111827;
}

* {
    box-sizing: border-box;
}

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

a {
    color: inherit;
}

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

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

.sidebar {
    background: var(--nav);
    color: #ffffff;
    padding: 22px;
}

.sidebar-brand {
    display: block;
    margin-bottom: 28px;
    font-size: 18px;
    font-weight: 800;
    text-decoration: none;
}

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

.sidebar nav a {
    padding: 11px 12px;
    border-radius: 8px;
    color: #d1d5db;
    text-decoration: none;
}

.sidebar nav a:hover,
.sidebar nav a:focus {
    background: #1f2937;
    color: #ffffff;
}

.admin-main {
    padding: 26px;
}

.admin-topbar,
.panel-header,
.form-actions,
.actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.admin-topbar {
    margin-bottom: 22px;
}

.section-kicker {
    margin: 0 0 4px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

h1,
h2 {
    margin: 0;
    letter-spacing: 0;
}

h1 {
    font-size: 30px;
}

h2 {
    font-size: 20px;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 9px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    color: var(--ink);
    cursor: pointer;
    font-weight: 800;
    text-decoration: none;
    white-space: nowrap;
}

.button.primary {
    border-color: var(--blue);
    background: var(--blue);
    color: #ffffff;
}

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

.button.ghost {
    background: transparent;
}

.button.danger {
    border-color: #fecaca;
    background: #fff1f2;
    color: var(--red);
}

.button.small {
    min-height: 34px;
    padding: 7px 10px;
    font-size: 13px;
}

.button.full {
    width: 100%;
}

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

.metric,
.panel,
.login-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: 0 10px 30px rgba(17, 24, 39, 0.05);
}

.metric {
    padding: 18px;
}

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

.metric strong {
    font-size: 30px;
}

.panel {
    padding: 20px;
}

.panel-header {
    margin-bottom: 16px;
}

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

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

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

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

td code {
    color: #374151;
    font-size: 13px;
}

.actions {
    justify-content: flex-start;
    flex-wrap: wrap;
}

.actions form {
    margin: 0;
}

.status {
    display: inline-flex;
    padding: 5px 9px;
    border-radius: 999px;
    background: #eef2ff;
    color: var(--blue);
    font-size: 12px;
    font-weight: 800;
}

.status.active {
    background: #dcfce7;
    color: var(--green);
}

.status.inactive {
    background: #fff7ed;
    color: var(--amber);
}

.status.archived {
    background: #f3f4f6;
    color: var(--muted);
}

.flash-stack,
.form-errors {
    display: grid;
    gap: 8px;
    margin-bottom: 16px;
}

.flash,
.form-errors p {
    margin: 0;
    padding: 12px 14px;
    border-radius: 8px;
    font-weight: 700;
}

.flash.success {
    background: #dcfce7;
    color: var(--green);
}

.flash.error,
.form-errors p {
    background: #fee2e2;
    color: var(--red);
}

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

.field {
    display: grid;
    gap: 7px;
    color: var(--ink);
    font-weight: 800;
}

.field.wide,
.form-actions.wide {
    grid-column: 1 / -1;
}

.field input,
.field textarea,
.field select,
.login-card input {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    color: var(--ink);
}

.field textarea {
    resize: vertical;
}

.image-preview {
    display: grid;
    place-items: center;
    min-height: 150px;
    border: 1px dashed #b8c0cc;
    border-radius: 8px;
    background: #f8fafc;
    color: var(--muted);
    font-weight: 700;
    overflow: hidden;
}

.image-preview img {
    max-width: 100%;
    max-height: 220px;
    object-fit: contain;
}

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

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

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

.login-card h1 {
    margin-bottom: 18px;
}

.login-card form {
    display: grid;
    gap: 14px;
}

.login-card label {
    display: grid;
    gap: 7px;
    font-weight: 800;
}

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

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

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