:root {
    --bg: #f4efe7;
    --panel: #fffdf8;
    --ink: #1d1a16;
    --muted: #6f6558;
    --line: #ded3c5;
    --brand: #9a3412;
    --brand-soft: #f7d9c9;
    --success: #1f6d43;
    --danger: #9f1239;
    --shadow: 0 12px 30px rgba(49, 38, 28, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at top right, rgba(154, 52, 18, 0.08), transparent 28%),
        linear-gradient(180deg, #f8f2ea 0%, var(--bg) 100%);
}

a {
    color: inherit;
}

.shell {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
}

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

.brand {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.brand small,
.muted {
    color: var(--muted);
}

.nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.nav a,
.button,
button {
    border: 1px solid var(--line);
    background: var(--panel);
    color: var(--ink);
    padding: 10px 14px;
    border-radius: 999px;
    text-decoration: none;
    cursor: pointer;
    font: inherit;
    transition: 160ms ease;
}

.nav a.active,
.button.primary,
button.primary {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

.button.danger,
button.danger {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
}

.nav a:hover,
.button:hover,
button:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.card,
.table-card,
.hero {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 20px;
    box-shadow: var(--shadow);
}

.hero,
.card,
.table-card {
    padding: 20px;
}

.hero {
    margin-bottom: 24px;
}

.hero h1,
.card h2,
.table-card h2,
.table-card h3 {
    margin-top: 0;
}

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

.grid.metrics {
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    margin-bottom: 24px;
}

.grid.two {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.metric-value {
    font-size: 2rem;
    font-weight: 700;
    margin: 6px 0;
}

.table-card {
    overflow: hidden;
}

table {
    width: 100%;
    border-collapse: collapse;
}

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

th {
    color: var(--muted);
    font-weight: 600;
    font-size: 0.92rem;
}

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

.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.88rem;
    background: #f2ede5;
}

.pill.ok {
    background: #dbf5e5;
    color: var(--success);
}

.pill.warn {
    background: #fef1d8;
    color: #9a6700;
}

.pill.bad {
    background: #fde2e8;
    color: var(--danger);
}

.inline-form,
.search-form,
.stack {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.stack {
    flex-direction: column;
}

label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: var(--muted);
    font-size: 0.95rem;
}

input,
select,
textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    font: inherit;
    background: #fff;
    color: var(--ink);
}

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

.form-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.flash {
    margin-bottom: 16px;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid var(--line);
}

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

.flash.error {
    background: #fff1f2;
    color: var(--danger);
}

.detail-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.detail-grid dl {
    margin: 0;
}

.detail-grid dt {
    color: var(--muted);
    font-size: 0.88rem;
    margin-bottom: 6px;
}

.detail-grid dd {
    margin: 0 0 14px;
    font-weight: 600;
}

.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 18px;
}

.pagination .actions {
    display: flex;
    gap: 10px;
}

.small {
    font-size: 0.9rem;
}

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

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

.login-card h1 {
    margin-top: 0;
}

.note {
    border-left: 4px solid var(--brand);
    background: #fff6ef;
    padding: 12px 14px;
    border-radius: 12px;
}

@media (max-width: 720px) {
    .shell {
        padding: 16px;
    }

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

    th:nth-child(n+5),
    td:nth-child(n+5) {
        display: none;
    }
}
