:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f3f5f8;
  color: #18243a;
  --surface: #fff;
  --line: #e1e7ef;
  --muted: #52617a;
  --navy: #101d30;
  --red: #b51d2d;
  --red-hover: #951726;
  --focus: #2368b6;
  --radius: 14px;
  --shadow: 0 2px 4px #172e4b08;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
button, input, select, textarea { font: inherit; }
a { color: inherit; }
button, select { cursor: pointer; }
.visually-hidden, .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.skip-link { position: fixed; top: 10px; left: 10px; transform: translateY(-160%); z-index: 10; padding: 12px; border-radius: 8px; background: white; }
.skip-link:focus { transform: none; }
.loading { padding: 48px 24px; text-align: center; }

.workspace { min-height: 100dvh; display: grid; grid-template-columns: 230px minmax(0, 1fr); }
.rail { position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; padding: 26px 17px 17px; background: var(--navy); color: #f4f8ff; border-right: 1px solid #23314a; }
.brand { display: flex; align-items: center; gap: 11px; margin: 0 0 44px; padding: 0 6px; text-decoration: none; color: inherit; font-size: 17px; font-weight: 760; line-height: 1.15; }
.brand img { border: 1px solid #344158; border-radius: 10px; }
.brand small { display: block; margin-top: 5px; font-size: 11px; font-weight: 520; letter-spacing: .025em; color: #b5c2d5; }
.rail nav { display: grid; gap: 6px; }
.rail nav a { min-height: 46px; display: flex; gap: 12px; align-items: center; padding: 10px 13px; border: 1px solid transparent; border-radius: 9px; color: #bac8db; text-decoration: none; font-size: 14px; font-weight: 650; }
.rail nav a:hover { background: #1d2c44; color: white; }
.rail nav a[aria-current] { color: white; background: #293a55; border-color: #3a4c68; box-shadow: inset 3px 0 #f14b57; }
.rail-footer { margin-top: auto; display: grid; gap: 13px; }
.env { display: inline-flex; align-items: center; gap: 7px; width: fit-content; padding: 5px 9px; border: 1px solid #cdaa58; border-radius: 6px; background: #fff1cd; color: #624a12; font-size: 11px; font-weight: 720; }
.env i { width: 7px; height: 7px; border-radius: 50%; background: #a16b08; }
.account { display: flex; align-items: center; gap: 9px; color: #e4eaf5; border-top: 1px solid #344158; padding: 12px 0 0; font-size: 13px; }
.account .signout { margin-left: auto; color: #e4eaf5; }
.account .signout:hover { background: #293a55; }
.avatar { display: grid; flex-shrink: 0; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: #304560; font-weight: 750; font-size: 11px; }
.account-name { overflow-wrap: anywhere; }

.main { width: 100%; max-width: 1530px; justify-self: center; padding: 40px clamp(22px, 4.2vw, 64px) 48px; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 28px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(27px, 3.25vw, 40px); line-height: 1.12; letter-spacing: -.04em; overflow-wrap: anywhere; }
.page-heading p { color: var(--muted); margin-top: 8px; font-size: 14px; line-height: 1.5; }
h2 { font-size: 18px; letter-spacing: -.015em; }
.muted { color: var(--muted); font-size: 13px; line-height: 1.55; }
.surface { border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.button, .icon-button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border-radius: 8px; font-weight: 680; text-decoration: none; font-size: 13px; line-height: 1.25; }
.button { min-height: 42px; padding: 9px 14px; border: 1px solid transparent; }
.button svg, .icon-button svg { flex-shrink: 0; }
.primary { color: white; background: var(--red); box-shadow: 0 3px 6px #8e132221; }
.primary:hover { background: var(--red-hover); }
.secondary { background: white; color: #263b59; border-color: #d1dbe9; }
.secondary:hover { background: #edf3fb; }
.button:disabled { opacity: .55; cursor: wait; }
.icon-button { width: 38px; height: 38px; padding: 0; border: 0; background: transparent; color: #496282; }
.icon-button:hover { background: #edf3fb; }
.full { width: 100%; }

.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 25px; }
.metric { display: flex; gap: 12px; align-items: center; min-height: 94px; padding: 15px; }
.metric-icon { display: grid; place-items: center; flex-shrink: 0; width: 39px; height: 39px; border-radius: 10px; }
.metric-navy { background: #e9eef7; color: #293f62; }
.metric-amber { background: #fff2df; color: #8c570c; }
.metric-blue { background: #e6f0fc; color: #255f9b; }
.metric-green { background: #e6f3ec; color: #246c48; }
.metric span { display: block; color: var(--muted); font-size: 12px; font-weight: 650; }
.metric strong { display: block; margin-top: 3px; font-size: 25px; font-variant-numeric: tabular-nums; line-height: 1; }
.offer-list { overflow: hidden; }
.list-tools { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px; }
.search-field { display: flex; align-items: center; gap: 10px; padding-left: 12px; width: min(420px, 100%); border: 1px solid #cfd8e5; border-radius: 8px; color: #526580; }
.search-field input { border: 0; min-width: 0; }
.search-field:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.search-field input:focus-visible { outline: none; }
.offers-table, .quote-paper table { width: 100%; border-collapse: collapse; text-align: left; }
.offers-table th, .offers-table td { padding: 13px 16px; border-top: 1px solid var(--line); }
.offers-table th { background: #f7f9fc; color: #556781; font-size: 12px; font-weight: 720; }
.offers-table td { font-size: 13px; }
.offers-table tr:hover td { background: #f8fafd; }
.offers-table tr td:first-child { overflow-wrap: anywhere; }
.offers-table small { display: block; margin-top: 4px; font-size: 11px; color: var(--muted); }
.offers-table .mobile-customer { display: none; }
.offer-link { color: #182f51; text-decoration: none; font-weight: 740; }
.offer-link:hover { text-decoration: underline; }
.offer-amount { font-variant-numeric: tabular-nums; font-weight: 760; white-space: nowrap; }
.badge { display: inline-flex; gap: 5px; align-items: center; padding: 4px 7px; border-radius: 30px; font-size: 11px; font-weight: 720; white-space: nowrap; background: #ecf1f8; color: #3e5270; }
.badge::before { content: ""; width: 5px; height: 5px; background: currentColor; border-radius: 50%; }
.badge-ready { background: #fff0d9; color: #7a4d0a; }
.badge-sent { background: #e7f1ff; color: #285a94; }
.badge-accepted { background: #e3f4e9; color: #175f3f; }
.badge-rejected { background: #fbe8eb; color: #962436; }
.empty { padding: 38px 16px; text-align: center; color: var(--muted); }
.empty p { margin-top: 6px; font-size: 13px; }

label { color: #344761; font-size: 13px; font-weight: 650; }
input, select, textarea { display: block; width: 100%; min-height: 41px; border: 1px solid #cfd8e5; border-radius: 8px; padding: 9px 10px; background: white; color: #18243a; font-size: 14px; font-weight: 460; }
input::placeholder { color: #586b83; }
textarea { resize: vertical; }
.back-link { display: inline-flex; gap: 6px; align-items: center; width: fit-content; margin-bottom: 8px; color: #36577f; text-decoration: none; font-size: 13px; font-weight: 690; }
.back-link svg { width: 16px; }
.back-link:hover { text-decoration: underline; }
.editor-grid { display: grid; grid-template-columns: minmax(0, 1.85fr) minmax(260px, 1fr); gap: 18px; align-items: start; }
.editor-form, .editor-summary { display: grid; gap: 15px; }
.section { padding: 19px; min-width: 0; }
.section > h2 { margin-bottom: 14px; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.field-grid label, .item-row label, .notes, .login label { display: grid; gap: 6px; align-content: start; }
.item-row { display: grid; grid-template-columns: minmax(85px, .9fr) minmax(120px, 1.55fr) minmax(65px, .6fr) minmax(92px, .8fr) 36px; gap: 8px; align-items: end; padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.item-row .remove { color: #a32a3e; }
.reductions { margin-top: 16px; }
.notes { margin-top: 13px; }
.editor-actions { display: flex; justify-content: space-between; gap: 10px; }
dl { margin: 0; }
dl > div { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 8px 0; line-height: 1.35; font-size: 13px; }
dt { color: var(--muted); }
dd { margin: 0; font-weight: 700; text-align: right; white-space: nowrap; }
.price-total { border-top: 1px solid var(--line); padding-top: 11px; margin-top: 6px; font-size: 17px; }
.price-total dt { color: #223a5a; font-weight: 720; }
.finance-heading { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.finance-fields { margin-bottom: 13px; }
.finance-section .button.full { margin-top: 11px; }
#offer-finance-form { padding-top: 12px; }
.finance-amount { padding: 14px; margin: 11px 0 8px; border-radius: 9px; background: #edf4ff; color: #183e74; }
.finance-amount span { display: block; font-size: 13px; font-weight: 650; }
.finance-amount strong { display: block; font-size: 27px; margin-top: 3px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.finance-amount small { font-size: 12px; }
.fineprint { font-size: 12px; margin-top: 7px; }
.text-button { padding-inline: 0; padding-block: 0; background: transparent; color: #a32a3e; }
.inline-alert { color: #923044; font-size: 13px; margin-top: 10px; }
.notice { padding: 11px 13px; margin-bottom: 15px; border: 1px solid #b8dec4; border-radius: 8px; background: #e8f7ee; color: #205b3a; font-size: 14px; }
.notice.error { background: #fdf0f3; color: #96223b; border-color: #edbdc9; }
.login-page { display: grid; min-height: 100dvh; place-items: center; padding: 18px; }
.login { width: min(420px, 100%); padding: 27px; display: grid; gap: 14px; }
.login .brand { padding: 0; margin-bottom: 4px; }
.login .brand small { color: var(--muted); }
.login h1 { font-size: 30px; }
.login .notice { margin: 0; }
.login label small { font-weight: 400; font-size: 12px; }
.login label.check { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-weight: 500; }
.login label.check input { display: inline-block; flex: none; width: 18px; height: 18px; min-height: 0; margin: 0; padding: 0; }
.login label.check small { flex-basis: 100%; padding-left: 26px; }

.quote-paper { margin: 0 auto; max-width: 840px; padding: clamp(15px, 5vw, 45px); }
.paper-test { color: #90263c; border-bottom: 2px solid #e6aebe; padding-bottom: 8px; margin-bottom: 14px; font-size: 12px; font-weight: 750; text-transform: uppercase; }
.paper-heading { border-bottom: 3px solid #1c3658; margin-bottom: 18px; padding-bottom: 12px; }
.paper-heading > div { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 10px; }
.paper-heading h2 { font-size: 28px; }
.quote-paper h3 { font-size: 16px; }
.quote-paper p { margin-top: 7px; line-height: 1.45; }
.quote-paper table { margin: 18px 0; }
.quote-paper td, .quote-paper th { border-bottom: 1px solid #d7dfe9; padding: 9px 4px; font-size: 13px; overflow-wrap: anywhere; }
.quote-paper td:not(:first-child), .quote-paper th:not(:first-child) { text-align: right; }
.quote-paper dl { margin: 0 0 18px auto; width: min(360px, 100%); }
.paper-notes { white-space: pre-wrap; overflow-wrap: anywhere; }

@media (max-width: 1180px) {
  .item-row { grid-template-columns: 1fr 1fr 40px; }
  .item-row label:nth-child(2) { grid-row: 1; grid-column: 1 / -1; }
  .item-row label:nth-child(1) { grid-column: 1 / -1; }
  .item-row label:nth-child(3) { grid-row: 3; }
}
@media (max-width: 980px) {
  .workspace { grid-template-columns: 190px minmax(0, 1fr); }
  .main { padding: 29px 22px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric { min-height: 76px; }
  .offers-table th, .offers-table td { padding-inline: 10px; }
  .column-open, .offers-table th:last-child { display: none; }
  .editor-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .workspace { display: block; min-height: 100dvh; }
  .rail { z-index: 2; position: sticky; height: auto; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; padding: 10px 14px 7px; }
  .brand { margin: 0; padding: 0; font-size: 15px; gap: 7px; }
  .brand img { width: 34px; height: 34px; }
  .brand small { font-size: 10px; margin-top: 3px; }
  .rail nav { grid-row: 2; grid-column: 1 / -1; display: flex; }
  .rail nav a { min-height: 40px; padding: 8px 11px; gap: 6px; font-size: 12px; }
  .rail nav a svg { width: 16px; }
  .rail-footer { display: flex; align-items: center; gap: 5px; margin: 0; }
  .env { font-size: 10px; padding: 3px 5px; }
  .account { border: 0; padding: 0; }
  .account .avatar, .account-name { display: none; }
  .main { padding: 20px 14px 30px; }
  .page-heading { margin-bottom: 17px; align-items: flex-start; flex-wrap: wrap; gap: 10px; }
  .page-heading p { font-size: 13px; }
  .metrics { gap: 8px; margin-bottom: 17px; }
  .metric { padding: 9px; min-height: 61px; gap: 8px; }
  .metric strong { font-size: 21px; }
  .metric span { font-size: 11px; }
  .metric-icon { width: 32px; height: 32px; }
  .metric-icon svg { width: 17px; }
  .list-tools { padding: 9px; gap: 6px; }
  .list-tools select { max-width: 120px; }
  .list-tools input, .list-tools select { font-size: 12px; }
  .search-field { padding-left: 7px; gap: 3px; }
  .search-field svg { width: 16px; flex-shrink: 0; }
  .offers-table th, .offers-table td { padding: 9px 7px; font-size: 12px; }
  .offers-table .column-customer, .offers-table .column-date, .offers-table th:nth-child(2), .offers-table th:nth-child(4) { display: none; }
  .offers-table .mobile-customer { display: block; }
  .badge { font-size: 10px; gap: 3px; padding: 4px 5px; }
  .section { padding: 14px; }
  input, select, textarea { min-height: 44px; font-size: 16px; }
}
@media print {
  :root { background: white; }
  .rail, .no-print, .skip-link, .notice { display: none !important; }
  .workspace, .main { display: block; padding: 0; }
  .quote-paper { border: 0; box-shadow: none; padding: 0; max-width: none; }
  .quote-paper tr, .quote-paper dl { break-inside: avoid; }
  @page { margin: 17mm; }
}
