:root {
    --brand-red: #d8332f;
    --brand-yellow: #ffc52f;
    --ink: #171717;
    --muted: #6d7178;
    --line: #e7e2d8;
    --paper: #fffdf8;
    --soft: #f5f7fa;
}

body {
    background: var(--soft);
    color: var(--ink);
}

.bg-brand {
    background: #18191b;
}

.nav-logo {
    width: 34px;
    height: 34px;
    object-fit: contain;
    margin-right: .4rem;
    background: #fff;
    border-radius: 6px;
    padding: 2px;
}

.page-shell {
    padding: 28px;
}

.messages {
    max-width: 1100px;
    margin: 0 auto 16px;
}

.page-header {
    max-width: 1180px;
    margin: 0 auto 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.page-header.compact,
.narrow {
    max-width: 820px;
}

.page-header h1 {
    font-size: clamp(1.6rem, 2vw, 2.2rem);
    margin: 0;
}

.eyebrow {
    margin: 0 0 4px;
    color: var(--brand-red);
    font-weight: 700;
    text-transform: uppercase;
    font-size: .78rem;
}

.btn-brand {
    --bs-btn-bg: var(--brand-red);
    --bs-btn-border-color: var(--brand-red);
    --bs-btn-color: #fff;
    --bs-btn-hover-bg: #b82926;
    --bs-btn-hover-border-color: #b82926;
    font-weight: 700;
}

.login-wrap {
    min-height: calc(100vh - 56px);
    display: grid;
    place-items: center;
}

.login-panel,
.surface,
.table-wrap,
.metric,
.module-card {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 12px 28px rgba(20, 20, 20, .06);
}

.login-panel {
    width: min(420px, 92vw);
    padding: 32px;
}

.login-logo {
    width: 96px;
    height: 72px;
    object-fit: contain;
    display: block;
    margin-bottom: 18px;
}

.login-panel h1 {
    font-size: 1.7rem;
    margin-bottom: 20px;
}

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

.module-grid,
.metric-grid,
.detail-grid,
.dashboard-columns {
    max-width: 1180px;
    margin: 0 auto;
    display: grid;
    gap: 16px;
}

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

.module-card {
    min-height: 154px;
    padding: 22px;
    color: inherit;
    text-decoration: none;
    display: grid;
    align-content: start;
    gap: 10px;
    transition: transform .15s ease, border-color .15s ease;
}

.module-card:hover {
    transform: translateY(-2px);
    border-color: var(--brand-yellow);
}

.module-card i {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    background: var(--brand-yellow);
    border-radius: 8px;
    font-size: 1.25rem;
}

.module-title {
    font-size: 1.15rem;
    font-weight: 800;
}

.surface {
    padding: 22px;
}

.table-wrap {
    max-width: 1180px;
    margin: 0 auto;
    overflow-x: auto;
    padding: 8px;
}

.table {
    margin-bottom: 0;
}

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

.form-grid p,
.line-item p,
.surface p {
    margin-bottom: 0;
}

.form-grid textarea,
.surface textarea {
    min-height: 92px;
}

.section-title {
    font-size: 1.1rem;
    font-weight: 800;
    margin: 0 0 14px;
}

.line-items {
    display: grid;
    gap: 12px;
}

.line-item {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

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

.filters {
    max-width: 1180px;
    margin: 0 auto 18px;
    display: grid;
    grid-template-columns: minmax(160px, 240px) minmax(160px, 240px) auto;
    gap: 10px;
}

.metric-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    margin-bottom: 16px;
}

.metric {
    padding: 18px;
}

.metric span {
    display: block;
    color: var(--muted);
    font-size: .9rem;
}

.metric strong {
    display: block;
    font-size: 1.5rem;
    margin-top: 4px;
}

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

@media (max-width: 700px) {
    .page-shell {
        padding: 18px 12px;
    }

    .page-header,
    .filters {
        align-items: stretch;
        grid-template-columns: 1fr;
        flex-direction: column;
    }


    .page-header .btn,
    .filters .btn {
        width: 100%;
    }
}

.dashboard-wide {
    max-width: 1180px;
    margin-left: auto;
    margin-right: auto;
}

.signature-area {
    max-width: 1180px;
    margin-left: auto;
    margin-right: auto;
}

.signature-line {
    width: min(420px, 100%);
    margin-top: 42px;
    padding-top: 8px;
    border-top: 1px solid var(--ink);
    color: var(--muted);
    text-align: center;
}

.item-thumb {
    width: 58px;
    height: 58px;
    display: inline-grid;
    place-items: center;
    object-fit: cover;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.item-thumb--empty {
    color: var(--muted);
    background: var(--soft);
}

.item-thumb.item-thumb--compact {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px;
    max-width: 44px !important;
    max-height: 44px !important;
    object-fit: cover;
}
