:root {
    color-scheme: light;
    --ink: #111827;
    --muted: #667085;
    --line: #d9e0ea;
    --panel: #ffffff;
    --bg: #f4f7fb;
    --blue: #0f6fc6;
    --red: #e11d2e;
    --green: #047857;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    color: var(--ink);
    background: var(--bg);
    min-height: 100vh;
}

.login-screen {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #07182b, #0f6fc6 48%, #e11d2e);
}
.login-card {
    width: min(380px, calc(100vw - 32px));
    background: #fff;
    border-radius: 8px;
    padding: 28px;
    box-shadow: 0 22px 60px rgba(0, 0, 0, .28);
}
.brand, .brand-link {
    font-weight: 800;
    color: var(--blue);
    text-decoration: none;
}
.brand-link {
    display: grid;
    gap: 2px;
    font-size: 20px;
    line-height: 1;
}
.brand-link span {
    color: var(--ink);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0;
}
.login-card h1 { margin: 8px 0 22px; }

label { display: grid; gap: 6px; font-size: 13px; font-weight: 700; }
input, select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 6px;
    min-height: 40px;
    padding: 8px 10px;
    font: inherit;
    background: #fff;
}
input[readonly], select:disabled {
    background: #eef2f7;
    color: #667085;
}
button, .primary, .secondary, .small-link, .danger {
    border: 0;
    border-radius: 6px;
    padding: 10px 14px;
    font-weight: 800;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
}
button, .primary { background: var(--blue); color: #fff; }
.secondary { background: #e8eef7; color: var(--ink); }
.small-link { color: var(--blue); background: #eef6ff; min-height: 32px; padding: 7px 10px; }
.danger { background: #fff1f2; color: #be123c; border: 1px solid #fecdd3; }

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
}
.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    background: #fff;
    border-right: 1px solid var(--line);
    padding: 22px 16px;
    display: grid;
    grid-template-rows: auto 1fr auto;
    gap: 24px;
}
.side-nav {
    display: grid;
    align-content: start;
    gap: 8px;
}
.side-nav a {
    display: grid;
    gap: 4px;
    padding: 12px;
    border-radius: 8px;
    color: var(--ink);
    text-decoration: none;
    border: 1px solid transparent;
}
.side-nav a span {
    color: var(--muted);
    font-size: 12px;
}
.side-nav a.active {
    background: #eef6ff;
    border-color: #c7ddf4;
    color: var(--blue);
}
.logout-box {
    display: grid;
    gap: 10px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 13px;
}
.logout-box button { background: #111827; }
.content { min-width: 0; }
.content-head {
    min-height: 76px;
    background: #fff;
    border-bottom: 1px solid var(--line);
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}
.content-head h1 {
    margin: 2px 0 0;
    font-size: 24px;
}
.eyebrow {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}
.page { width: min(1440px, calc(100vw - 298px)); margin: 24px auto; }
.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 22px;
    box-shadow: 0 10px 28px rgba(15, 23, 42, .06);
}
.panel-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 20px;
}
.action-group {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex-wrap: wrap;
}
h1, h2, p { margin-top: 0; }
h1 { font-size: 26px; margin-bottom: 6px; }
h2 { font-size: 18px; margin-bottom: 0; }
p { color: var(--muted); margin-bottom: 0; }
.grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}
.state-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfe;
    margin-bottom: 24px;
}
.state-row p {
    margin-top: 8px;
    font-size: 13px;
}
.label {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    margin-bottom: 6px;
}
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 26px;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}
.badge.quote { background: #fff7ed; color: #c2410c; }
.badge.offered { background: #eff6ff; color: #0f6fc6; }
.badge.accepted { background: #ecfdf5; color: #047857; }
.badge.neutral { background: #eef2f7; color: #475467; }
.check-row {
    display: inline-flex;
    grid-template-columns: none;
    align-items: center;
    gap: 10px;
    min-width: 190px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}
.check-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.check-row input {
    width: 18px;
    min-height: 18px;
}
.hint-box {
    max-width: 260px;
    padding: 10px 12px;
    border-radius: 8px;
    background: #eef6ff;
    color: var(--blue);
    font-size: 13px;
    font-weight: 800;
}
.items-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 8px 0 12px;
}
.items { display: grid; gap: 12px; }
.item-row {
    display: grid;
    grid-template-columns: 1.5fr .6fr .8fr .85fr .85fr .7fr .8fr .7fr .7fr;
    gap: 10px;
    align-items: end;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfe;
}
.calc-box {
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    padding: 5px 9px;
    display: grid;
    gap: 2px;
}
.calc-box span { font-size: 11px; color: var(--muted); font-weight: 700; }
.calc-box strong { font-size: 14px; }
.totals {
    margin-top: 18px;
    padding: 14px;
    background: #111827;
    color: #fff;
    border-radius: 8px;
    display: flex;
    gap: 22px;
    justify-content: flex-end;
    flex-wrap: wrap;
}
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { font-size: 12px; text-transform: uppercase; color: var(--muted); }
.filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
    gap: 12px;
    align-items: end;
    margin-bottom: 18px;
}
.filters button,
.filters .secondary {
    width: 100%;
}
.report-cards {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 22px;
}
.report-cards div,
.mini-total {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfe;
    padding: 12px;
    display: grid;
    gap: 6px;
}
.report-cards span,
.mini-total span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}
.report-cards strong,
.mini-total strong {
    font-size: 20px;
}
.section-gap { height: 26px; }
.panel-head.slim {
    align-items: center;
    margin-bottom: 12px;
}
.panel-head.slim h2 { margin-bottom: 4px; }
.mini-total { min-width: 180px; }
.positive { color: var(--green); font-weight: 800; }
.negative { color: var(--red); font-weight: 800; }
.alert, .success {
    padding: 11px 13px;
    border-radius: 6px;
    margin-bottom: 14px;
    font-weight: 700;
}
.alert { background: #fff1f2; color: #be123c; }
.success { background: #ecfdf5; color: #047857; }
.empty { color: var(--muted); text-align: center; }

@media (max-width: 1100px) {
    .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .item-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .report-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar {
        position: static;
        height: auto;
        grid-template-rows: auto auto auto;
    }
    .side-nav { grid-template-columns: 1fr 1fr; }
    .content-head { display: grid; }
    .page { width: min(100vw - 20px, 1360px); margin: 10px auto; }
    .panel { padding: 14px; }
    .panel-head { display: grid; }
    .grid, .item-row { grid-template-columns: 1fr; }
    .state-row { display: grid; }
    .check-group { justify-content: flex-start; }
    .filters, .report-cards { grid-template-columns: 1fr; }
    .totals { justify-content: flex-start; }
}
