:root {
  color-scheme: light;
  --background: #f3f6f8;
  --surface: #fff;
  --tint: #f7f9fb;
  --ink: #162a39;
  --muted: #546777;
  --border: #dae3e9;
  --accent: #176c62;
  --accent-ink: #105b51;
  --accent-tint: #e9f5f1;
  --accent-line: #b8ddd3;
  --warm: #885717;
  --warm-tint: #fff5df;
  --error: #a12c37;
  --error-tint: #fff0f0;
  --top: #182a36;
  --top-border: #455564;
  font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-synthesis: none;
}
:root[data-firm="vale"] {
  --accent: #495387;
  --accent-ink: #3d4b83;
  --accent-tint: #eff0fa;
  --accent-line: #d0d4ee;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --background: #101920;
  --surface: #17232d;
  --tint: #1c2b36;
  --ink: #e6eef3;
  --muted: #abbcc9;
  --border: #354858;
  --accent: #67ccb8;
  --accent-ink: #8bdfcd;
  --accent-tint: #203c38;
  --accent-line: #365e53;
  --warm: #f5cc83;
  --warm-tint: #3a3124;
  --error: #ffadb3;
  --error-tint: #472931;
  --top: #0b1319;
  --top-border: #455564;
}
:root[data-theme="dark"][data-firm="vale"] {
  --accent: #bac1ff;
  --accent-ink: #cbd0ff;
  --accent-tint: #303651;
  --accent-line: #4c567c;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; color: var(--ink); background: var(--background); font-size: 14px; line-height: 1.45; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
button, a, input, select, textarea, summary { outline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent); }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.85rem, 3.6vw, 2.65rem); font-weight: 660; letter-spacing: -.05em; line-height: 1.07; }
h2 { font-size: 21px; font-weight: 650; letter-spacing: -.022em; }
h3 { font-size: 15px; }
small { font-size: 12px; }
strong { font-weight: 650; }
.skip, .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(100%); white-space: nowrap; }
.skip:focus { top: 6px; left: 6px; clip-path: none; width: auto; height: auto; padding: 8px; background: var(--surface); z-index: 2; color: var(--ink); }
.preview { background: var(--top); color: #edf4f8; }
.preview-inner, .portal-inner, .footer-inner, main, .notice { width: min(100% - 72px, 1400px); margin-inline: auto; }
.preview-inner, .portal-inner, .footer-inner { display: flex; justify-content: space-between; align-items: center; }
.preview-inner { gap: 16px; min-height: 54px; }
.preview-brand, .preview-controls { display: flex; align-items: center; gap: 11px; }
.preview-brand strong { font-size: 15px; letter-spacing: -.02em; }
.preview-note { color: #c1cbd3; padding-left: 12px; border-left: 1px solid var(--top-border); font-size: 12px; }
.py-mark { display: grid; grid-template-columns: repeat(2, 5px); grid-template-rows: repeat(2, 5px); gap: 2px; }
.py-mark i { background: #91decc; border-radius: 1px; }
.py-mark i:last-child { background: #53897d; }
.preview-controls label { color: #d1dce2; font-size: 12px; white-space: nowrap; }
.preview-controls select, .preview-controls .btn { color: #eef4f8; border-color: var(--top-border); background: #233745; min-height: 32px; font-size: 12px; }
.preview-controls .btn:hover { background: #314958; }
.preview-controls select { max-width: 290px; color-scheme: dark; }
.portal-head { background: var(--surface); border-bottom: 1px solid var(--border); }
.portal-inner { min-height: 78px; gap: 30px; }
.firm, .account { display: flex; align-items: center; gap: 11px; }
.firm { flex: 1 0 auto; }
.monogram { display: grid; place-items: center; border-radius: 8px; width: 42px; height: 42px; color: var(--accent-ink); background: var(--accent-tint); border: 1px solid var(--accent-line); font-size: 24px; font-family: Georgia, serif; font-weight: 700; }
.firm-name { font-size: 17px; font-weight: 690; letter-spacing: -.025em; line-height: 1.2; }
.firm-name small, .account small { display: block; color: var(--muted); font-weight: 450; letter-spacing: 0; margin-top: 3px; }
.account { flex: 1; justify-content: flex-end; text-align: right; }
.account strong { white-space: nowrap; font-size: 13px; }
.account .btn { min-height: 34px; font-size: 12px; margin-left: 8px; }
nav { align-self: stretch; display: flex; gap: 4px; }
nav button { border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; background: transparent; color: var(--muted); padding-inline: 16px; font-weight: 580; white-space: nowrap; }
nav button:hover { color: var(--ink); background: var(--tint); }
nav button[aria-current] { color: var(--accent-ink); border-color: var(--accent); }
main { flex: 1; padding-block: 37px 42px; min-width: 0; }
main:focus { outline: none; }
.page-heading, .detail-head, .list-heading, .pagination, .catalogue-bottom { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.page-heading { margin-bottom: 24px; min-height: 65px; }
.page-heading p { color: var(--muted); margin-top: 9px; }
.btn { min-height: 38px; padding: 7px 13px; border: 1px solid var(--border); border-radius: 7px; color: var(--ink); background: var(--surface); font-weight: 600; white-space: nowrap; }
.btn:hover:not(:disabled) { background: var(--tint); border-color: var(--accent-line); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: white; }
[data-theme="dark"] .btn.primary { color: var(--top); }
.btn.primary:hover:not(:disabled) { filter: brightness(.92); background: var(--accent); }
.btn.accent { color: var(--accent-ink); background: var(--accent-tint); border-color: var(--accent-line); }
.commercial { display: grid; grid-template-columns: 1fr 1fr 1fr 1.75fr; background: var(--accent-tint); border: 1px solid var(--accent-line); border-radius: 9px; margin-bottom: 20px; padding: 13px 0; }
.commercial > div { display: grid; gap: 3px; padding-inline: 18px; }
.commercial > div + div { border-left: 1px solid var(--accent-line); }
.commercial span, .meta { color: var(--muted); font-size: 12px; }
.commercial strong { font-size: 13px; }
.workspace { background: var(--surface); border: 1px solid var(--border); border-radius: 11px; min-width: 0; }
.filters { display: grid; grid-template-columns: minmax(180px, 1fr) repeat(3, minmax(105px, 150px)) auto; align-items: end; gap: 12px; padding: 16px; }
label { display: grid; gap: 5px; font-size: 12px; font-weight: 600; color: var(--ink); }
label span { color: var(--muted); }
input, textarea, select { min-width: 0; min-height: 38px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); color: var(--ink); padding: 7px 10px; }
input[readonly] { background: var(--tint); color: var(--muted); }
textarea { resize: vertical; }
input::placeholder { color: var(--muted); opacity: .88; }
.list-heading { padding: 11px 16px; border-top: 1px solid var(--border); background: var(--tint); }
.list-heading h2 { font-size: 13px; letter-spacing: 0; }
.list-heading small, .pagination span, .muted, .catalogue-bottom p { color: var(--muted); }
.products { border-collapse: collapse; width: 100%; }
.products th, .products td { border-top: 1px solid var(--border); padding: 10px 16px; text-align: left; vertical-align: middle; }
.products thead th { background: var(--tint); color: var(--muted); font-size: 11px; font-weight: 650; white-space: nowrap; }
.products tbody tr:hover { background: var(--tint); }
.products th:first-child { width: 38%; }
.products td:last-child { text-align: right; }
.products .number { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.products .price { font-weight: 650; }
.product-brand, .product-name, .ean, .cell-note { display: block; }
.product-brand { font-size: 11px; color: var(--muted); font-weight: 600; }
.product-name { font-size: 14px; font-weight: 650; margin-block: 1px 2px; }
.product-name small { color: var(--muted); font-weight: 450; }
.ean, .cell-note { font-size: 11px; color: var(--muted); font-weight: 450; }
.ean { font-variant-numeric: tabular-nums; letter-spacing: .025em; }
.cell-note { margin-top: 4px; }
.tag { display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px; border-radius: 5px; color: var(--muted); background: var(--tint); font-size: 11px; font-weight: 650; white-space: nowrap; }
.dot { background: currentColor; width: 5px; height: 5px; border-radius: 50%; }
.tag.good { color: var(--accent-ink); background: var(--accent-tint); }
.tag.warn { color: var(--warm); background: var(--warm-tint); }
.row-action .btn { min-height: 34px; font-size: 12px; }
.pagination { justify-content: flex-end; border-top: 1px solid var(--border); padding: 10px 16px; }
.pagination span { margin-right: auto; font-size: 12px; }
.pagination .btn { min-height: 32px; font-size: 12px; }
.catalogue-bottom { margin: 16px 0 22px; }
.split { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 18px; align-items: start; }
.record-list h2 { padding: 14px; font-size: 13px; }
.record-list button { display: grid; text-align: left; gap: 3px; width: 100%; background: var(--surface); color: var(--ink); border: 0; border-top: 1px solid var(--border); padding: 13px 14px; }
.record-list button:last-child { border-radius: 0 0 10px 10px; }
.record-list button:hover { background: var(--tint); }
.record-list button[aria-current] { border-left: 3px solid var(--accent); padding-left: 11px; background: var(--accent-tint); }
.record-list small { color: var(--muted); }
.list-ref { display: flex; align-items: baseline; flex-wrap: wrap; gap: 3px 8px; color: var(--accent-ink); font-weight: 650; font-size: 12px; }
.detail { padding: 22px; }
.detail-head { align-items: flex-start; margin-bottom: 12px; }
.overline { color: var(--accent-ink); font-weight: 650; font-size: 12px; }
.detail h2 { font-size: 24px; margin-bottom: 4px; }
.terms { display: grid; grid-template-columns: repeat(auto-fit, minmax(122px, 1fr)); gap: 0; border: 1px solid var(--border); border-radius: 7px; background: var(--tint); margin: 16px 0; }
.terms > div { padding: 10px 12px; }
.terms dt { color: var(--muted); font-size: 12px; }
.terms dd { margin: 3px 0 0; font-weight: 650; font-variant-numeric: tabular-nums; }
.subsection { border-top: 1px solid var(--border); margin-top: 17px; padding-top: 15px; }
.subsection h3 + p { margin-top: 5px; }
.item-line { margin-top: 8px; }
.note { border-left: 2px solid var(--accent-line); padding: 7px 10px; background: var(--tint); color: var(--muted); margin-block: 12px; overflow-wrap: anywhere; }
.actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.actions:empty { display: none; }
.timeline { margin: 10px 0 0 4px; padding-left: 14px; color: var(--accent-ink); list-style: square; }
.timeline li { padding: 0 0 10px 5px; }
.timeline li small { display: block; color: var(--muted); }
.event-log summary { cursor: pointer; font-weight: 650; }
.empty { padding: 27px 20px; }
.empty p { color: var(--muted); margin: 5px 0 12px; }
.empty .btn + .btn { margin-left: 8px; }
.loading { padding: 22px 16px; color: var(--muted); }
.notice { padding: 10px 13px; margin-top: 12px; border-radius: 7px; }
#notice:empty { display: none; }
.notice.success { color: var(--accent-ink); background: var(--accent-tint); }
.notice.error { color: var(--error); background: var(--error-tint); }
.walkthrough { margin-top: 22px; color: var(--muted); font-size: 12px; }
.walkthrough summary { cursor: pointer; }
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 9px; }
.steps button { text-align: left; background: var(--surface); color: var(--ink); border: 1px solid var(--border); padding: 8px 10px; border-radius: 7px; }
.steps button[aria-current] { background: var(--accent-tint); border-color: var(--accent-line); }
.steps strong, .steps small { display: block; }
.steps small { color: var(--muted); }
footer { border-top: 1px solid var(--border); background: var(--surface); color: var(--muted); font-size: 12px; }
.footer-inner { min-height: 48px; gap: 10px; }
dialog { width: min(600px, calc(100% - 24px)); max-height: calc(100% - 28px); background: var(--surface); color: var(--ink); border: 1px solid var(--border); border-radius: 13px; padding: 0; }
dialog::backdrop { background: #101b25aa; }
.modal-head, .modal-body, .modal-actions { padding: 15px 19px; }
.modal-head { display: flex; justify-content: space-between; gap: 14px; border-bottom: 1px solid var(--border); }
.modal-head p, .selected-product small { color: var(--muted); }
.icon-close { border: 0; border-radius: 5px; width: 34px; height: 34px; background: var(--tint); color: var(--ink); font-size: 22px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; background: var(--tint); border-top: 1px solid var(--border); }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.field-grid label { display: block; }
.field-grid label > span { font-weight: 400; margin-inline-start: 3px; }
.field-grid input, .field-grid select, .field-grid textarea { display: block; width: 100%; margin-top: 5px; }
.field-grid .wide { grid-column: 1 / -1; }
.selected-product { margin-bottom: 13px; background: var(--accent-tint); border: 1px solid var(--accent-line); border-radius: 7px; padding: 9px; }
.form-error { margin: 0 19px 12px; color: var(--error); }
.form-error:empty { display: none; }
@media (max-width: 970px) {
  .preview-inner, .portal-inner, .footer-inner, main, .notice { width: min(100% - 40px, 1400px); }
  .portal-inner { gap: 13px; }
  nav button { padding-inline: 10px; }
  .products th, .products td { padding-inline: 10px; }
  .split { grid-template-columns: 200px minmax(0, 1fr); gap: 12px; }
}
@media (max-width: 740px) {
  .preview-inner, .portal-inner, .footer-inner, main, .notice { width: calc(100% - 28px); }
  .preview-inner { flex-wrap: wrap; padding-block: 7px; gap: 7px; }
  .preview-controls { gap: 7px; max-width: 100%; }
  .preview-controls select { max-width: 63vw; }
  .portal-inner { gap: 3px 12px; flex-wrap: wrap; padding-block: 10px 0; }
  .portal-inner nav { width: 100%; min-height: 43px; order: 3; }
  .account strong { white-space: normal; }
  .account .btn { margin-left: 0; }
  .firm { flex-basis: auto; }
  .firm-name { font-size: 15px; }
  .monogram { width: 34px; height: 34px; }
  main { padding-block: 22px 28px; }
  .page-heading { align-items: flex-start; flex-wrap: wrap; margin-bottom: 14px; }
  .commercial { grid-template-columns: 1fr 1fr; row-gap: 8px; }
  .commercial > div { padding-inline: 10px; }
  .commercial > div:nth-child(3) { border-left: 0; }
  .filters { grid-template-columns: 1fr 1fr; padding: 10px; }
  .filters .search { grid-column: 1 / -1; }
  .products { display: block; }
  .products thead { position: absolute; height: 1px; width: 1px; clip-path: inset(100%); }
  .products tbody { display: block; }
  .products tbody tr { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 5px 8px; border-top: 1px solid var(--border); padding: 10px; }
  .products th:first-child, .products td { border: 0; padding: 0; width: auto; text-align: left; }
  .products th:first-child { grid-column: 1 / -1; }
  .products td:first-of-type { grid-column: 1 / -1; }
  .products .number { text-align: left; }
  .products td[data-label]::before { content: attr(data-label) " "; color: var(--muted); font-size: 11px; font-weight: 450; }
  .products .row-action { grid-column: 1 / -1; text-align: left; margin-top: 3px; }
  .catalogue-bottom, .detail-head { flex-wrap: wrap; }
  .split { grid-template-columns: 1fr; }
  .detail { padding: 13px; }
  .steps { grid-template-columns: 1fr 1fr; }
  .terms { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); }
}

.request-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.quote-callout { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; background: var(--accent-tint); border: 1px solid var(--accent-line); border-radius: 8px; padding: 12px; margin-top: 12px; }
.quote-callout p { color: var(--muted); }
.table-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: 7px; margin-top: 10px; }
.table-scroll .quote-lines { display: table; min-width: max-content; }
.table-scroll .quote-lines thead { position: static; clip-path: none; display: table-header-group; width: auto; height: auto; }
.table-scroll .quote-lines tbody { display: table-row-group; }
.table-scroll .quote-lines tr { display: table-row; }
.table-scroll .quote-lines td, .table-scroll .quote-lines th { border-top: 1px solid var(--border); padding: 8px 10px; white-space: nowrap; }
.table-scroll .quote-lines tr:first-child th { border-top: 0; }
.table-scroll .quote-lines td { text-align: right; font-variant-numeric: tabular-nums; }
.line-editor { display: grid; gap: 8px; border: 1px solid var(--border); border-radius: 8px; padding: 9px 12px 12px; margin: 0 0 12px; min-width: 0; }
.line-editor legend { font-weight: 650; padding-inline: 5px; }
.row-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 520px) {
  .row-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
#account { display:flex; gap:12px; align-items:center; padding-block:10px; }
.card-list { display:grid; gap:12px; margin-block:12px 28px; }
.login { max-width:520px; margin:auto; padding:24px; }
.login .field-grid { grid-template-columns:1fr; margin-top:18px; }
.check { display:flex; align-items:center; gap:8px; padding:6px; }
.check input { min-height:20px; }
.table-scroll { overflow-x:auto; }
.table-scroll table { min-width:500px; }
#account label { min-width: 0; }
#account select { max-width: 290px; width: 100%; }
@media (max-width: 740px) {
  #account { flex-wrap: wrap; width:100%; }
  #account label { width: 100%; }
  #account select { max-width: none; }
  .portal-inner { padding-bottom:10px; }
}
/* Catalogue preparation and exact-version approval. */
dialog:has(#prep-enquiry), dialog:has(#prep-review), dialog:has(.preparation-table) { width: min(1050px, calc(100% - 24px)); }
.preparation-table { min-width: 680px; }
.preparation-table small { display: block; color: var(--muted); margin-top: 3px; font-weight: 400; }
.preparation-table th:first-child { width: 38%; }
.source-table th:first-child { width: 52px; }
.source-table th:nth-child(2) { width: 38%; }
.preparation-table input[type=number] { width: 86px; }
.modal-body > label, .modal-body > fieldset { display: block; margin-block: 14px; }
.modal-body > label > input, .modal-body > label > textarea { display: block; width: 100%; margin-top: 5px; }
#prep-source .actions { margin-block: 14px; }
#prep-search label { min-width: 250px; }
.sourcing-nav { margin-block: 22px; flex-wrap: wrap; }
.sourcing-totals { margin-block: 16px; padding: 15px; background: var(--tint); border: 1px solid var(--border); border-radius: 8px; }
.sourcing-totals strong { display: block; font-size: 21px; margin-top: 4px; }
#source-form label, #quote-form label { display: block; margin-bottom: 10px; }
#source-form label > input, #source-form label > select, #quote-form label > input { display: block; width: 100%; margin-top: 5px; }
#source-form label.check { display: flex; align-items: center; gap: 8px; }
#source-form label.check input { width: auto; margin: 0; }
