:root {
  font-family: "Segoe UI", Arial, sans-serif;
  color: #263747;
  background: #edf1f5;
  font-size: 13px;
  font-synthesis: none;
  --page: #edf1f5;
  --surface: #ffffff;
  --ink: #263747;
  --muted: #778594;
  --line: #e0e6ed;
  --accent: #1f6fb2;
  --accent-dark: #175a92;
  --accent-soft: #edf5fc;
  --rail: #20303f;
  --green: #25856b;
  --amber: #a87520;
  --red: #b64545;
  --shadow: 0 2px 5px rgb(26 47 66 / 3%);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 360px; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .48; }
button, input, select, textarea { color: inherit; }
button { line-height: 1.35; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dark); text-decoration: underline; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid #84b9e4;
  outline-offset: 3px;
}
input:focus, select:focus, textarea:focus { border-color: #76a9d1; }
::selection { background: #cfe4f6; }
svg { display: block; flex-shrink: 0; }
[hidden] { display: none !important; }
.skip-link { position: fixed; top: 8px; left: 76px; z-index: 100; background: white; padding: 12px 18px; border-radius: 6px; transform: translateY(-160%); }
.skip-link:focus { transform: translateY(0); }

.app-rail {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  display: flex;
  align-items: center;
  flex-direction: column;
  width: 64px;
  color: #aec0cf;
  background: var(--rail);
}
.brand { position: relative; display: grid; place-items: center; width: 36px; height: 36px; margin: 17px 0 28px; border: 1px solid #698093; border-radius: 10px; color: white; font-size: 22px; font-weight: 700; letter-spacing: -2px; padding-right: 2px; }
.brand span { position: absolute; width: 6px; height: 6px; border: 2px solid var(--rail); border-radius: 50%; background: #70c6a3; right: -3px; bottom: 1px; }
.rail-button { position: relative; width: 54px; min-height: 61px; margin: 0 0 9px; padding: 8px 4px; border: 0; border-radius: 7px; background: transparent; color: #9eafbd; font-size: 10px; font-weight: 600; letter-spacing: .2px; }
.rail-symbol { display: block; margin-bottom: 3px; color: #b7c5d1; font-size: 24px; font-weight: 400; line-height: 27px; }
.rail-button:hover { color: #fff; background: #2b3e4f; }
.rail-button.active { color: #dfeeff; background: #31516d; }
.rail-button.active::before { content: ""; position: absolute; width: 3px; height: 26px; left: -5px; top: 16px; background: #72b9ef; border-radius: 0 2px 2px 0; }
.rail-button.active .rail-symbol { color: #d5eaff; }
.rail-bottom { display: flex; align-items: center; flex-direction: column; gap: 8px; margin-top: auto; padding-bottom: 18px; }
.rail-bottom .avatar { background: #4a5e6e; color: #e1e9ef; width: 31px; height: 31px; font-size: 10px; }
.rail-bottom small { font-size: 8px; color: #9eafbd; }
.workspace { min-height: 100vh; margin-left: 64px; }
.app-header { display: flex; align-items: center; justify-content: space-between; min-height: 60px; gap: 20px; padding: 0 28px; background: white; border-bottom: 1px solid var(--line); }
.workspace-title { display: flex; align-items: center; gap: 16px; white-space: nowrap; font-size: 14px; font-weight: 600; color: #425468; }
.workspace-title span { color: #c2cbd4; font-weight: 400; }
.workspace-title strong { font-size: 13px; color: #758393; font-weight: 400; }
.header-tools { display: flex; align-items: center; gap: 24px; }
.demo-user-picker { display: grid; gap: 2px; font-size: 9px; color: var(--muted); }
.demo-user-picker .input { width: 205px; min-height: 28px; height: 28px; padding: 3px 6px; font-size: 11px; }
.demo-badge { display: flex; align-items: center; gap: 7px; color: #7b8895; font-size: 11px; white-space: nowrap; }
.demo-badge i { width: 6px; height: 6px; border-radius: 50%; background: #8dacbe; }
.text-button { padding: 6px 0; border: 0; background: transparent; color: #7b8996; font-size: 11px; }
.text-button:hover { color: var(--accent); }
.workspace-tabs { display: flex; align-items: stretch; min-height: 48px; gap: 28px; padding: 0 28px; background: white; border-bottom: 1px solid var(--line); overflow-x: auto; overflow-y: hidden; }
.workspace-tabs > button { position: relative; display: flex; align-items: center; gap: 8px; padding: 0; border: 0; background: transparent; color: #7b8895; font-size: 12px; font-weight: 600; white-space: nowrap; }
.workspace-tabs > button.active { color: var(--accent); }
.workspace-tabs > button.active::after { content: ""; position: absolute; height: 2px; background: var(--accent); inset: auto 0 0; }
.workspace-tabs > button:hover { color: var(--accent); }
.workspace-tabs > button > span { padding: 2px 5px; border-radius: 4px; background: #f0f3f6; color: #8894a1; font-size: 10px; font-weight: 400; }
.workspace-tabs > button.active > span { color: var(--accent); background: #eaf3fb; }
.save-status { margin-left: auto; display: flex; align-items: center; color: #97a2ae; font-size: 10px; white-space: nowrap; }
#main { padding: 25px 28px 28px; max-width: 1920px; margin: 0 auto; min-height: calc(100vh - 153px); }
#main:focus { outline: none; }
.workspace-footer { display: flex; gap: 9px; justify-content: center; padding: 13px 25px 18px; font-size: 10px; line-height: 1.6; color: #95a0ab; text-align: center; }
.workspace-footer > span { color: #bdc6cf; }

.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 21px; }
.heading-left { min-width: 0; }
.back-link { display: inline-flex; align-items: center; gap: 6px; border: 0; padding: 0; margin-bottom: 10px; background: transparent; color: #8493a1; font-size: 11px; }
.back-link:hover { color: var(--accent); }
.eyebrow { margin: 0 0 8px; color: #7f8d9b; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .9px; }
h1 { margin: 0; color: #253848; font-size: 24px; font-weight: 600; line-height: 1.3; letter-spacing: -.5px; }
h2 { margin: 0; font-size: 15px; font-weight: 600; line-height: 1.4; }
h3 { margin: 0; font-size: 13px; font-weight: 600; line-height: 1.45; }
p { line-height: 1.6; }
.heading-left > p { margin: 7px 0 0; color: #82909e; font-size: 11px; }
.heading-left h1 .badge { vertical-align: middle; margin-left: 10px; }
.deal-heading-left { flex: 1 1 320px; }
.deal-heading-left .deal-name-input {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 0;
  padding: 2px 5px;
  margin-left: -6px;
  border: 1px solid transparent;
  border-radius: 3px;
  background: transparent;
  color: inherit;
  font: inherit;
  line-height: inherit;
}
.deal-heading-left .deal-name-input:hover { border-color: #d8e2cc; }
.deal-heading-left .deal-name-input:focus { border-color: var(--accent); background: #fff; }
.deal-heading-left .deal-manager-input {
  display: inline-block;
  width: auto;
  max-width: 100%;
  min-height: 26px;
  margin-left: 3px;
  padding: 3px 23px 3px 6px;
  font-size: 11px;
  vertical-align: middle;
}
.page-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; padding-bottom: 2px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 35px; padding: 8px 13px; border: 1px solid transparent; border-radius: 6px; font-weight: 600; font-size: 11px; text-decoration: none; white-space: nowrap; }
.button:hover { text-decoration: none; }
.button.primary { border-color: var(--accent); background: var(--accent); color: white; box-shadow: 0 1px 2px rgb(22 73 117 / 12%); }
.button.primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.button.secondary { border-color: #d7e0e8; background: white; color: #54697a; }
.button.secondary:hover { background: #f5f9fc; border-color: #b6cadb; color: var(--accent); }
.button.ghost { border-color: transparent; background: transparent; color: #6d8497; }
.button.ghost:hover { background: #e5eef6; color: var(--accent); }
.button.small { min-height: 29px; padding: 5px 10px; font-size: 10px; }
.button.danger { color: var(--red); background: white; border-color: #edd6d6; }
.button.danger:hover { background: #fff3f3; border-color: #d8a1a1; }
.icon-button { display: inline-grid; place-items: center; flex-shrink: 0; min-width: 29px; height: 29px; border: 1px solid transparent; border-radius: 5px; background: transparent; color: #91a0ae; font-size: 18px; }
.icon-button:hover { border-color: #d9e2eb; color: var(--accent); background: #f5f8fb; }
.badge { display: inline-flex; align-items: center; gap: 5px; width: fit-content; padding: 4px 7px; border: 1px solid transparent; border-radius: 4px; font-size: 10px; font-weight: 500; line-height: 1.3; white-space: nowrap; }
.badge.blue { color: #3c79a8; background: #edf5fc; border-color: #dceaf6; }
.badge.green { color: #35816c; background: #edf7f3; border-color: #dceee6; }
.badge.amber { color: #a07730; background: #fbf5e9; border-color: #f1e7d2; }
.badge.gray { color: #7e8b98; background: #f1f4f6; border-color: #e7ebef; }
.badge.red { color: #b45a5a; background: #fbefef; border-color: #f0dddd; }
.positive { color: var(--green) !important; }
.negative { color: var(--red) !important; }
.muted { color: var(--muted); }
.mono, .amount, .offer-price, .summary-card strong, .total strong, .finance-row strong { font-family: "Segoe UI", Arial, sans-serif; font-variant-numeric: tabular-nums lining-nums; }
.amount { white-space: nowrap; }

.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 22px; }
.summary-card { position: relative; min-width: 0; min-height: 98px; padding: 16px 18px 13px; background: white; border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
.summary-card > label { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; min-height: 19px; margin-bottom: 7px; color: #85919d; font-size: 10px; }
.summary-card > label .badge { padding: 2px 5px; font-size: 9px; }
.summary-card strong { display: block; color: #344b5e; font-size: 23px; line-height: 1.15; font-weight: 600; letter-spacing: -.5px; white-space: nowrap; }
.summary-card small { display: block; margin-top: 7px; color: #93a0ac; font-size: 10px; }
.summary-card strong small { display: inline; font-size: 12px; font-weight: 400; }
.deal-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; align-items: start; gap: 20px; }
.main-column, .side-column { display: flex; flex-direction: column; min-width: 0; gap: 18px; }
.card { min-width: 0; border: 1px solid #dfe6ed; border-radius: 8px; background: white; box-shadow: var(--shadow); overflow: hidden; }
.card-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; padding: 14px 18px; border-bottom: 1px solid #e9edf2; }
.card-heading h2 { font-size: 13px; }
.card-heading .badge { margin-left: 6px; }
.card-heading > div { min-width: 0; }
.card-heading p { margin: 4px 0 0; font-size: 10px; color: #8997a4; }
.card-body { padding: 18px; }
.card-body > :first-child { margin-top: 0; }
.card-body > :last-child { margin-bottom: 0; }
.section-subtitle { margin: 0 0 12px; color: #8b97a3; font-size: 10px; font-weight: 600; letter-spacing: .7px; text-transform: uppercase; }
.client-strip { display: flex; align-items: center; gap: 14px; padding: 17px 18px; }
.client-main { display: flex; align-items: center; gap: 11px; flex: 1; min-width: 0; }
.client-main strong { display: block; margin-bottom: 4px; color: #364c5f; font-size: 13px; font-weight: 600; }
.client-main p, .client-main small { margin: 0; color: #8b98a5; font-size: 11px; }
.client-meta { display: flex; flex-wrap: wrap; gap: 14px 24px; padding: 14px 18px; border-top: 1px solid #edf0f4; background: #fbfcfd; }
.client-meta > div { min-width: 120px; }
.client-meta label, .client-meta small { display: block; margin-bottom: 5px; color: #8f9ca8; font-size: 10px; }
.client-meta strong { font-size: 11px; font-weight: 500; }
.card-body > .client-meta { display: block; margin: 15px 0 10px; padding: 0; border: 0; background: transparent; color: #8193a1; font-size: 11px; line-height: 1.9; }
.avatar { display: inline-grid; place-items: center; flex-shrink: 0; width: 36px; height: 36px; border-radius: 50%; color: #658ba7; background: #eaf2f8; font-size: 11px; font-weight: 600; }
.next-action { border-left: 3px solid #91b8d7; padding: 13px 14px; background: #f3f8fc; border-radius: 0 5px 5px 0; }
.next-action strong { display: block; margin: 5px 0 6px; font-size: 12px; font-weight: 600; }
.next-action p { margin: 4px 0 0; color: #8092a1; font-size: 11px; }
.next-action .due, .due { color: #7d8f9d; font-size: 10px; }
.timeline { padding: 1px 0; }
.timeline-item { position: relative; padding: 0 0 19px 20px; border-left: 1px solid #e1e8ef; margin-left: 4px; }
.timeline-item:last-child { padding-bottom: 0; border-color: transparent; }
.timeline-dot { position: absolute; left: -4px; top: 5px; width: 7px; height: 7px; background: #93b0c7; border: 2px solid white; border-radius: 50%; box-shadow: 0 0 0 1px #cfdae4; }
.timeline-item:first-child .timeline-dot { background: var(--accent); box-shadow: 0 0 0 1px #bfd4e7; }
.timeline-dot.blue { background: var(--accent); }
.timeline-date { display: block; margin-bottom: 6px; color: #a0aab4; font-size: 9px; }
.timeline-item strong { display: block; margin: 0 0 4px; font-size: 11px; font-weight: 600; color: #536a7c; }
.timeline-item p { margin: 0; font-size: 11px; color: #84919d; line-height: 1.6; overflow-wrap: anywhere; }
.timeline-item .badge { margin-top: 7px; font-size: 9px; }
.note-form { display: flex; flex-direction: column; gap: 9px; padding-top: 16px; border-top: 1px solid #edf0f4; margin-top: 18px; }
.note-form .button { align-self: flex-end; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, label.field { color: #7e8e9c; font-size: 11px; }
.input, .select, .field input, .field select, .field textarea, .note-form textarea { width: 100%; min-height: 35px; padding: 8px 10px; border: 1px solid #dce3eb; border-radius: 5px; background: white; color: #3f566a; font-size: 12px; line-height: 1.45; }
.input:hover, .select:hover, .field input:hover, .field select:hover { border-color: #b9cbd9; }
.input::placeholder, .field input::placeholder, textarea::placeholder { color: #a0acb7; }
textarea { resize: vertical; min-height: 72px; }
.help { margin: 0; color: #94a0ac; font-size: 10px; line-height: 1.6; }
.help + .help { margin-top: 5px; }
.input-suffix { position: relative; }
.input-suffix .input { padding-right: 32px; font-size: 11px; }
.input-suffix > span { position: absolute; top: 50%; right: 10px; transform: translateY(-50%); color: #91a2af; font-size: 10px; pointer-events: none; }
.input[aria-invalid="true"], input[aria-invalid="true"] { border-color: #bc6c6c; background: #fff7f7; }
.sales-add-position { display: flex; align-items: center; justify-content: flex-start; padding: 8px 18px; }
.sales-add-position > .button { min-height: 32px; padding: 6px 12px; }
.totals-strip { display: flex; justify-content: flex-end; gap: 32px; padding: 16px 18px; background: #f9fbfd; border-top: 1px solid #e8edf2; }
.totals-strip > .help { margin-right: auto; }
.totals-strip > div { display: flex; flex-direction: column; gap: 5px; align-items: flex-end; }
.totals-strip > div > span { color: #8194a3; font-size: 10px; }
.totals-strip > div > strong, .totals-strip > strong { font-size: 19px; font-weight: 600; color: #3d617d; white-space: nowrap; font-variant-numeric: tabular-nums; }
.total { min-width: 90px; text-align: right; }
.total label { display: block; margin-bottom: 7px; font-size: 10px; color: #8b99a6; }
.total strong { display: block; font-size: 17px; color: #36566f; font-weight: 600; white-space: nowrap; }
.total small { display: block; margin-top: 5px; font-size: 10px; color: #93a0ac; }
.notice { display: flex; align-items: flex-start; gap: 8px; padding: 10px 12px; border: 1px solid #e3e9ef; border-radius: 5px; color: #7b8f9e; background: #f7f9fb; font-size: 10px; line-height: 1.65; }
.notice.blue { color: #5d829d; background: #f1f7fc; border-color: #e0edf6; }
.notice.amber { color: #987c45; background: #fcf8ee; border-color: #f1e8d3; }
.card > .notice { margin: 0 18px 16px; }
.card-body > .notice { margin-top: 14px; }

.table-scroll { overflow-x: auto; overscroll-behavior-x: contain; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th { background: #f9fbfd; color: #92a0ad; text-align: left; font-weight: 500; font-size: 10px; line-height: 1.4; padding: 11px 12px; border-bottom: 1px solid #e5ebf1; }
td { padding: 15px 12px; border-bottom: 1px solid #e9eef3; color: #4f6476; font-size: 11px; line-height: 1.5; }
.item-table { min-width: 800px; }
.item-table th:first-child, .item-table td:first-child { width: 38px; }
.item-table th:first-child, .item-table td:first-child { padding-left: 18px; }
.item-table th:last-child, .item-table td:last-child { padding-right: 16px; }
.item-table th.amount, .item-table td.amount { text-align: right; }
.item-table .item-name { min-width: 200px; width: 43%; }
.item-table .item-name input { width: 100%; min-width: 190px; height: 31px; margin: -3px 0 4px; padding: 5px 7px; border: 1px solid #e1e8ef; border-radius: 4px; background: #fcfdff; color: #3b5b74; font-weight: 600; font-size: 12px; }
.item-table .item-name input:hover { border-color: #dbe4ed; background: #fbfdff; }
.item-table .item-name input:focus { border-color: #79abd1; background: white; }
.item-name > strong { color: #3b5b74; font-size: 12px; }
.item-source { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; color: #95a2ae; font-size: 10px; padding-left: 7px; }
.item-source .badge { padding: 2px 5px; font-size: 9px; }
.item-number { width: 68px; height: 31px; min-height: 31px; padding: 5px 7px; border: 1px solid #dde5ed; border-radius: 4px; background: #fff; color: #526b7f; font-size: 11px; font-variant-numeric: tabular-nums; text-align: right; }
.item-number[data-field="price"] { width: 92px; }
.item-table td > .help { display: block; margin-top: 4px; font-size: 9px; white-space: nowrap; }
.item-table td.amount strong { display: block; color: #426078; font-size: 12px; font-weight: 600; }
.item-table td.amount small { display: block; margin-top: 5px; font-size: 9px; font-weight: 400; }
.item-row > td { vertical-align: middle; }
.item-row .mini-label { margin-bottom: 7px; font-size: 8px; color: #9aa8b4; }
.item-number:hover { border-color: #b6ccdd; }
.row-toggle { display: inline-flex; align-items: center; justify-content: center; gap: 4px; width: 22px; min-height: 30px; background: transparent; color: #8ca0b1; border: 0; border-radius: 4px; padding: 5px 0; font-size: 20px; }
.row-toggle:hover { color: var(--accent); }
.row-toggle[aria-expanded="true"] { color: var(--accent); }
.expanded-row > td { padding: 0 !important; border-bottom: 1px solid #e0e8ef; background: #f7fafd; }
.item-detail { margin: 0 18px 16px; padding: 16px; border: 1px solid #dfe8f0; border-radius: 6px; background: #fbfdff; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.07fr) minmax(0, 1fr) minmax(0, .85fr); gap: 18px; }
.detail-panel { min-width: 0; }
.detail-panel + .detail-panel { border-left: 1px solid #e3ebf2; padding-left: 17px; }
.detail-panel .field-grid { grid-template-columns: minmax(0, 1fr); gap: 9px; }
.detail-panel .field > span { font-size: 9px; }
.detail-panel .help { margin-top: 8px; font-size: 9px; }
.item-detail-footer { display: flex; justify-content: space-between; align-items: center; gap: 15px; padding-top: 13px; margin-top: 15px; border-top: 1px solid #e2eaf1; }
.item-detail-footer .help { font-size: 9px; }
.link-button.danger { color: #b47878; font-size: 10px; white-space: nowrap; }
.link-button.danger:hover { color: #a44a4a; }
.mini-label { margin: 0 0 9px; color: #95a1ad; font-size: 9px; font-weight: 600; text-transform: uppercase; letter-spacing: .6px; }
.source-title { margin: 0 0 8px; font-size: 11px; font-weight: 600; color: #527590; line-height: 1.6; }
.source-facts { display: flex; flex-wrap: wrap; gap: 5px 14px; margin: 7px 0 10px; font-size: 10px; color: #8e9da9; line-height: 1.6; }
.source-facts strong { color: #66839a; font-weight: 500; }
.stock-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px; margin: 7px 0 10px; color: #8d9dab; font-size: 10px; line-height: 1.5; }
.stock-line > .muted { flex-basis: 100%; font-size: 9px; }
.stock-line strong { text-align: right; color: #628173; font-weight: 500; }
.cost-lines { margin: 0; }
.cost-line { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 8px 0; font-size: 10px; color: #8597a5; }
.cost-line strong, .cost-line b { color: #577187; font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cost-line.total { border-top: 1px solid #e1e9f0; padding-top: 10px; margin-top: 12px; text-align: left; }
.cost-line.total strong, .cost-line.total b { font-size: 12px; font-weight: 600; }
.cost-line label { margin: 0; font-size: inherit; }
.cost-line .input, .cost-line input { width: 72px; min-height: 27px; padding: 4px 6px; text-align: right; font-size: 10px; }
.detail-panel .notice { margin: 12px 0; font-size: 9px; padding: 8px 10px; }
.detail-panel .button-row { margin-top: 12px; }
.button-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.link-button { padding: 2px 0; border: 0; background: transparent; color: #5287af; font-size: 11px; text-align: left; }
.link-button:hover { color: var(--accent-dark); text-decoration: underline; }
.empty-state { padding: 46px 24px; text-align: center; color: #8d9ba8; font-size: 12px; line-height: 1.7; }
.empty-state strong { display: block; color: #657c8f; font-size: 14px; font-weight: 600; margin-bottom: 7px; }
.empty-state p { margin: 0; }
.empty-state .button { margin-top: 14px; }

.route { display: flex; gap: 0; padding: 4px 0 10px; }
.route-step { position: relative; flex: 1; min-width: 0; padding: 0 18px 0 15px; border-left: 2px solid #dbe6ef; }
.route-step::before { content: ""; position: absolute; top: 0; left: -4px; width: 6px; height: 6px; border-radius: 50%; background: #8facbf; }
.route-step strong, .route-step b { display: block; font-size: 11px; color: #5e7d94; font-weight: 600; margin-bottom: 5px; }
.route-step p { font-size: 10px; color: #929fab; margin: 0; }
.context-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.context-card { min-width: 0; padding: 16px 18px; background: white; border: 1px solid var(--line); border-radius: 7px; }
.context-card.card { padding: 0; }
.context-card .card-heading h3 { margin: 0; }
.context-card h3 { color: #506e84; font-size: 12px; margin-bottom: 8px; }
.context-card p { color: #8494a2; font-size: 11px; margin: 0 0 12px; }
.context-card > .badge { margin-bottom: 10px; }
.context-card .button-row { margin-top: 14px; }
.kanban { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; padding: 2px 1px 20px; align-items: start; }
.kanban-column { min-width: 0; min-height: 395px; background: #e7ecf2; border: 1px solid #e0e6ed; border-radius: 7px; padding: 13px 10px; }
.kanban-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 1px 4px 13px; margin-bottom: 1px; color: #6d8193; font-size: 11px; font-weight: 600; }
.kanban-heading > span { font-size: 10px; color: #94a2af; font-weight: 400; }
.kanban-column:nth-child(2) .kanban-heading { color: #3f86b7; }
.deal-tile { display: block; width: 100%; text-align: left; padding: 15px 13px; border: 1px solid #dae3eb; border-radius: 6px; background: white; box-shadow: 0 2px 3px rgb(36 58 78 / 3%); color: inherit; margin-bottom: 11px; }
button.deal-tile:hover { border-color: #8eb8d6; box-shadow: 0 3px 8px rgb(42 89 126 / 7%); }
.deal-tile.featured { border-color: #91bad9; box-shadow: inset 0 3px 0 #5899c7, 0 2px 4px rgb(36 58 78 / 4%); }
.deal-tile .eyebrow { font-size: 8px; line-height: 1.6; letter-spacing: .5px; color: #9aa9b5; }
.deal-tile.featured .eyebrow { color: #729ab8; }
.deal-tile h3, .deal-tile > strong { display: block; margin: 0 0 8px; color: #4c6d85; font-size: 12px; font-weight: 600; line-height: 1.55; }
.deal-tile p { margin: 6px 0; color: #94a0ac; font-size: 10px; }
.deal-tile .amount { display: block; margin: 12px 0; color: #405e75; font-size: 16px; font-weight: 600; }
.deal-tile .badge { font-size: 9px; margin: 4px 0 7px; }
.deal-tile .due { display: block; margin-top: 12px; padding-top: 10px; border-top: 1px solid #edf1f5; font-size: 9px; line-height: 1.6; }
.tile-next { margin-top: 14px; padding-top: 11px; border-top: 1px solid #eaf0f5; color: #91a0ad; font-size: 10px; line-height: 1.7; }
.kanban-note { font-size: 10px; color: #98a5b1; padding: 17px 10px; line-height: 1.7; text-align: center; }
.kanban-toolbar { display: flex; align-items: end; flex-wrap: wrap; gap: 12px; margin-bottom: 18px; }
.kanban-search { display: grid; gap: 5px; flex: 1 1 280px; max-width: 460px; font-size: 11px; color: var(--muted); }
.kanban-toolbar > span { margin-bottom: 8px; font-size: 11px; color: var(--muted); }
.kanban-stage-total { margin: -5px 4px 14px; font-size: 12px; font-weight: 600; color: var(--ink); }
.kanban-stage-create { width: 100%; min-height: 40px; margin-top: 2px; }
.deal-tile-number { display: block; margin-bottom: 7px; font-size: 10px; color: var(--muted); }
.deal-tile small { display: block; color: var(--muted); font-size: 10px; line-height: 1.6; }
.deal-tile-client { overflow-wrap: anywhere; }
.deal-tile .deal-tile-amount { margin-top: 10px; font-size: 16px; color: var(--ink); }
.deal-tile h3 { overflow-wrap: anywhere; }
.kanban-empty { margin: 20px 4px; font-size: 12px; color: var(--muted); }
.kanban-footnote { margin: 0 0 20px; }
.deal-tile[draggable="true"] { cursor: grab; }
.deal-tile[draggable="true"].is-drag-source { opacity: .45; }
.is-kanban-dragging .deal-tile { cursor: grabbing; }
.kanban-column.is-drop-target { outline: 2px dashed var(--brand-green, #71be00); outline-offset: -2px; box-shadow: inset 0 0 0 3px #f2f8e9; background: #e7f2d9; }
.deal-stage-control { margin-bottom: 16px; }
#new-deal-dialog { width: min(530px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow-y: auto; border: 1px solid var(--line); border-radius: 5px; }
#new-deal-form > .field, #new-deal-form > .field-grid { margin-bottom: 14px; }
#new-deal-form .button-row { justify-content: flex-end; }
#stage-settings-dialog { width: min(640px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow-y: auto; border: 1px solid var(--line); border-radius: 5px; }
.stage-settings-list { display: grid; gap: 8px; }
.stage-settings-row { display: grid; grid-template-columns: 20px 42px minmax(0, 1fr) auto; align-items: center; gap: 8px; }
.stage-color-picker { width: 42px; min-width: 0; height: 34px; padding: 3px; border: 1px solid var(--line); border-radius: 3px; background: #fff; cursor: pointer; }
.stage-settings-row > span { color: var(--muted); font-size: 11px; }
.stage-move-buttons { display: flex; gap: 3px; }
.stage-move-buttons .icon-button { min-width: 28px; width: 28px; height: 30px; }
.stage-move-buttons .stage-remove-button { color: #ad3131; margin-left: 3px; }
.stage-move-buttons .stage-remove-button:disabled { color: var(--muted); opacity: .45; }
#stage-removal-dialog { width: min(500px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow-y: auto; border: 1px solid var(--line); border-radius: 5px; }
#stage-removal-form > .field { margin: 16px 0; }
#stage-removal-form > .button-row { justify-content: flex-end; margin-top: 16px; }
.field-label-with-settings { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.field-settings-button { background: transparent; border: 0; padding: 0 3px; color: var(--muted); cursor: pointer; font-size: 16px; line-height: 1; }
.field-settings-button:hover { color: var(--brand-green, #71be00); }
.required-mark { color: #b33b3b; }
#prepayment-field-settings-dialog { width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow-y: auto; border: 1px solid var(--line); border-radius: 5px; }
.field-rule-toggle { display: flex; align-items: center; gap: 8px; margin: 12px 0; font-weight: 600; }
#prepayment-required-stages { display: grid; gap: 8px; margin: 15px 0; padding: 12px; border: 1px solid var(--line); border-radius: 4px; }
#prepayment-required-stages label { display: flex; align-items: center; gap: 8px; }
#prepayment-required-stages:disabled { opacity: .55; }
#prepayment-field-settings-form > .button-row { justify-content: flex-end; }
.stage-settings-row input[readonly] { background: #f2f4f5; color: var(--muted); }
.stage-add-row { display: flex; align-items: center; gap: 10px; padding-top: 16px; margin-top: 16px; border-top: 1px solid var(--line); }
.stage-add-row > .input { flex: 1; min-width: 0; }
#stage-settings-form > .button-row { justify-content: flex-end; margin-top: 15px; }
@media (max-width: 700px) { .header-tools { gap: 10px; } .header-tools .demo-badge { display: none; } .demo-user-picker .input { width: 160px; } }
@media (max-width: 480px) { .stage-add-row { align-items: stretch; flex-direction: column; } }
@media (max-width: 1100px) { .kanban { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .kanban { grid-template-columns: minmax(0, 1fr); } .kanban-column { min-height: 150px; } }
.filters { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; }
.filters .select { width: auto; min-width: 155px; font-size: 11px; }
.search-field { position: relative; flex: 1; min-width: 220px; max-width: 360px; }
.search-field .input { padding-left: 12px; font-size: 11px; }
.view-caption { color: #8a99a6; font-size: 11px; margin: 0 0 19px; line-height: 1.7; }
.screen-note { padding: 13px 16px; margin: 20px 0 0; border: 1px dashed #ccd9e3; border-radius: 6px; font-size: 11px; color: #8294a3; line-height: 1.8; }
.card > .screen-note { margin: 0; border: 0; border-top: 1px solid #e7edf3; border-radius: 0; padding: 12px 18px; color: #94a2ae; font-size: 9px; line-height: 1.7; }
#main > .notice { margin-bottom: 18px; }
.financial-list { display: flex; flex-direction: column; gap: 0; }
.finance-row { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 12px 0; border-bottom: 1px solid #eaf0f4; font-size: 11px; color: #8495a3; }
.finance-row:first-child { padding-top: 0; }
.finance-row:last-child { border: 0; padding-bottom: 0; }
.finance-row strong { font-size: 12px; font-weight: 600; color: #547188; white-space: nowrap; }
.finance-row small { display: block; color: #99a6b1; font-size: 10px; margin-top: 4px; }
.stage-tabs { display: flex; flex-wrap: wrap; gap: 5px; padding: 13px 18px; border-bottom: 1px solid #e8edf2; background: #fcfdfe; }
.stage-tabs button { padding: 6px 9px; border: 1px solid #e3e9ef; border-radius: 4px; background: white; color: #8b9aa7; font-size: 10px; }
.stage-tabs button:hover { border-color: #aac7dd; color: var(--accent); }
.stage-tabs button.active, .stage-tabs [aria-pressed="true"] { color: #5082a7; background: #edf5fb; border-color: #cce0ee; }

dialog { color: var(--ink); border: 0; padding: 0; }
dialog::backdrop { background: rgb(24 42 57 / 35%); }
#picker { position: fixed; inset: 0 0 0 auto; width: min(760px, 95vw); max-width: none; height: 100dvh; max-height: 100dvh; margin: 0 0 0 auto; border-radius: 0; background: #f4f7fa; box-shadow: -10px 0 40px rgb(18 39 57 / 14%); }
#picker-content { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.picker-layout { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.picker-header { flex-shrink: 0; padding: 22px 26px 18px; border-bottom: 1px solid #dfe7ef; background: white; }
.picker-titlebar { display: flex; justify-content: space-between; align-items: flex-start; gap: 15px; }
.picker-header h2 { font-size: 19px; color: #324d64; font-weight: 600; letter-spacing: -.3px; }
.picker-header p { margin: 7px 30px 0 0; color: #8899a7; font-size: 11px; line-height: 1.7; }
.picker-search { display: flex; flex-direction: column; gap: 10px; margin: 0 0 20px; }
.picker-search .stage-tabs { padding: 0 0 14px; background: transparent; }
.picker-search .stage-tabs button { padding: 8px 12px; font-size: 11px; }
.picker-search .search-field { width: 100%; max-width: none; min-width: 0; }
.picker-search .search-field > span { position: absolute; left: 12px; top: 6px; color: #8098aa; font-size: 21px; }
.picker-search .search-field .input { padding-left: 35px; }
.picker-search .input, .picker-search .select { height: 37px; background: #fbfcfe; font-size: 11px; }
.picker-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior-y: contain; padding: 20px 26px 24px; }
.picker-results { display: flex; flex-direction: column; gap: 11px; }
.picker-results > .mini-label { margin-bottom: 0; }
.offer-card { position: relative; display: block; padding: 16px 17px 14px; border: 1px solid #dae3ec; border-radius: 7px; background: white; cursor: pointer; }
.offer-card { width: 100%; text-align: left; }
.offer-card > h3 { color: #496b84; font-size: 12px; margin: 9px 0 0; }
.offer-card > small { display: block; margin: 11px 0 0; font-size: 9px; }
.offer-card:hover { border-color: #abc9df; box-shadow: 0 2px 5px rgb(35 81 115 / 5%); }
.offer-card.selected { border-color: #5b9bcb; box-shadow: 0 0 0 1px #5b9bcb; background: #fcfeff; }
.offer-top { display: flex; align-items: flex-start; gap: 11px; }
.offer-top > div { flex: 1; min-width: 0; }
.offer-top > strong { flex: 1; }
.offer-top strong, .offer-top h3 { display: block; color: #466d8b; font-size: 12px; font-weight: 600; line-height: 1.6; }
.offer-radio { flex-shrink: 0; margin-left: auto; color: #80a2bc; font-size: 10px; }
.offer-card.selected .offer-radio { color: #46876e; font-weight: 600; }
.offer-spec { margin: 5px 0 0; color: #8c9dab; font-size: 10px; line-height: 1.65; }
.offer-bottom { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin: 13px 0 0; padding-top: 12px; border-top: 1px solid #ecf1f5; }
.offer-bottom > span { font-size: 10px; color: #8197a8; }
.offer-bottom > div { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.offer-bottom small { color: #9aa6b1; font-size: 9px; }
.offer-price { color: #416984; font-size: 17px; font-weight: 600; white-space: nowrap; }
.offer-price small { font-size: 10px; color: #8597a6; font-weight: 400; }
.picker-form { margin-top: 22px; padding: 18px; border: 1px solid #dce5ed; border-radius: 7px; background: white; }
.picker-form h3 { color: #57758d; font-size: 12px; margin-bottom: 16px; }
.picker-form > .field { margin-bottom: 14px; }
.picker-form > .field-grid + .field-grid { margin-top: 13px; }
.picker-form > .help { margin-top: 10px; }
.field-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.field-grid .help { margin-top: 1px; }
.required-mark { color: #ab6970; }
.validation-error { margin: 10px 0 0; color: #b65e5e; font-size: 11px; line-height: 1.6; }
.picker-footer { flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 15px 26px; border-top: 1px solid #dce5ed; background: white; box-shadow: 0 -3px 12px rgb(32 58 78 / 3%); }
.picker-footer p { margin: 0; font-size: 10px; color: #95a2ad; line-height: 1.65; max-width: 300px; }
.picker-footer .button-row { flex-shrink: 0; }
#confirm-dialog, #remove-component-dialog, #remove-item-dialog, #copy-item-dialog { max-width: min(430px, calc(100vw - 32px)); border: 1px solid #dce4ec; border-radius: 10px; box-shadow: 0 18px 50px rgb(24 44 63 / 20%); }
#remove-component-dialog, #remove-item-dialog, #copy-item-dialog { max-height: calc(100dvh - 32px); overflow-y: auto; overflow-wrap: anywhere; }
#remove-component-dialog .delete-confirm, #remove-item-dialog .delete-confirm { color: #fff; border-color: #b64545; background: #b64545; }
#remove-component-dialog .delete-confirm:hover, #remove-item-dialog .delete-confirm:hover { background: #9d3737; }
#quote-dialog { width: min(850px, calc(100vw - 40px)); max-width: none; max-height: calc(100dvh - 48px); border-radius: 9px; box-shadow: 0 18px 60px rgb(24 44 63 / 23%); overflow-y: auto; }
#quote-dialog .card-heading { padding: 19px 23px; }
#quote-dialog .card-body { padding: 20px 23px; }
#quote-dialog .item-table { min-width: 600px; }
#quote-dialog .item-table td:first-child, #quote-dialog .item-table th:first-child { width: 45%; padding-left: 12px; }
#quote-dialog .totals-strip { margin: 0 0 18px; }
#quote-dialog .notice { margin-bottom: 0; }
.confirmation { padding: 25px; }
.confirmation h2 { font-size: 17px; }
.confirmation p { color: #8294a2; font-size: 12px; margin: 12px 0 22px; }
.confirmation .button-row { justify-content: flex-end; }
#copy-item-dialog { width: min(430px, calc(100vw - 32px)); }
#copy-item-dialog .sale-copy-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
#copy-item-dialog .sale-copy-options > .button { width: 100%; min-height: 38px; padding: 8px 10px; white-space: normal; }
#copy-item-dialog .confirmation .help { margin: 12px 0 18px; font-size: 11px; }
#toast { position: fixed; z-index: 100; bottom: 24px; left: calc(50% + 32px); transform: translateX(-50%); max-width: calc(100vw - 110px); padding: 12px 18px; border-radius: 7px; background: #2d465a; color: #f6f9fc; box-shadow: 0 5px 20px rgb(26 50 70 / 18%); font-size: 12px; line-height: 1.5; pointer-events: none; opacity: 0; }
#toast.visible, #toast.show { opacity: 1; }
noscript { display: block; margin: 20px 20px 20px 85px; padding: 20px; border: 1px solid #e0c48c; background: #fff9e9; }

@media (min-width: 1550px) {
  .deal-layout { grid-template-columns: minmax(0, 1fr) 330px; gap: 24px; }
  .summary-grid { gap: 18px; }
  .item-table td { padding-top: 18px; padding-bottom: 18px; }
}
@media (max-width: 1280px) {
  #main { padding: 24px 22px; }
  .app-header, .workspace-tabs { padding-left: 22px; padding-right: 22px; }
  .deal-layout { gap: 16px; grid-template-columns: minmax(0, 1fr) 280px; }
  .summary-card { padding: 15px; }
  .summary-card strong { font-size: 21px; }
  .detail-grid { gap: 15px; }
  .detail-panel + .detail-panel { padding-left: 15px; }
}
@media (max-width: 1150px) {
  .deal-layout { grid-template-columns: minmax(0, 1fr); }
  .side-column { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .side-column > .card:only-child { grid-column: 1 / -1; }
  .page-heading { align-items: flex-start; }
  .page-actions { padding-top: 4px; }
  .context-grid { gap: 14px; }
}
@media (max-width: 850px) {
  .header-tools { gap: 14px; }
  .save-status { display: none; }
  .summary-grid { gap: 10px; }
  .summary-card { padding: 13px; min-height: 91px; }
  .summary-card strong { font-size: 19px; }
  .summary-card small { font-size: 9px; }
  h1 { font-size: 22px; }
  .page-heading { flex-wrap: wrap; gap: 14px; }
  .page-actions { padding-top: 0; }
  .route { flex-wrap: wrap; gap: 18px; }
  .route-step { flex-basis: 40%; }
  .detail-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .detail-panel:last-child { grid-column: 1 / -1; border-left: 0; border-top: 1px solid #e3ebf2; padding: 13px 0 0; }
  .detail-panel:last-child .cost-lines { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px; }
  .detail-panel:last-child .cost-line { min-width: 0; }
}
@media (max-width: 700px) {
  .app-rail { width: 52px; }
  .brand { width: 30px; height: 30px; margin: 18px 0 25px; font-size: 19px; border-radius: 8px; }
  .rail-button { width: 44px; font-size: 9px; }
  .rail-bottom small { display: none; }
  .workspace { margin-left: 52px; }
  .app-header { min-height: 54px; padding: 0 16px; gap: 10px; }
  .workspace-title { font-size: 12px; gap: 10px; }
  .workspace-title strong { font-size: 11px; }
  .demo-badge { display: none; }
  .text-button { font-size: 10px; }
  .workspace-tabs { min-height: 45px; gap: 21px; padding: 0 16px; }
  .workspace-tabs > button { font-size: 11px; }
  .workspace-tabs > button > span { font-size: 9px; }
  #main { padding: 20px 16px; }
  .page-heading { margin-bottom: 17px; }
  h1 { font-size: 21px; }
  .eyebrow { font-size: 9px; }
  .page-actions { width: 100%; flex-wrap: wrap; }
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 17px; }
  .summary-card { min-height: 89px; padding: 13px 14px; }
  .summary-card strong { font-size: 22px; }
  .side-column { display: flex; }
  .card-heading { padding: 13px 15px; }
  .card-body { padding: 15px; }
  .card > .notice { margin-left: 15px; margin-right: 15px; }
  .client-strip { padding: 15px; }
  .client-meta { padding: 13px 15px; gap: 14px; }
  .client-meta > div { flex: 1 0 40%; min-width: 100px; }
  .context-grid { grid-template-columns: minmax(0, 1fr); }
  .item-detail { width: calc(100vw - 122px); min-width: 236px; padding: 14px; }
  .detail-grid { grid-template-columns: minmax(0, 1fr); gap: 15px; }
  .detail-panel + .detail-panel { border-left: 0; border-top: 1px solid #e3ebf2; padding: 13px 0 0; }
  .detail-panel:last-child { grid-column: auto; }
  .detail-panel:last-child .cost-lines { display: block; }
  .item-detail-footer { align-items: flex-start; flex-direction: column; gap: 9px; }
  .totals-strip { flex-wrap: wrap; gap: 20px; padding: 16px 15px; }
  .total { flex: 1; min-width: 85px; }
  .total strong { font-size: 16px; }
  .workspace-footer { display: block; padding: 12px 16px 20px; font-size: 9px; }
  .workspace-footer span { margin: 0 4px; }
  .filters { gap: 8px; }
  .search-field { max-width: none; flex-basis: 100%; }
  .filters .select { flex: 1; min-width: 130px; }
  .kanban { grid-auto-columns: 240px; }
  .picker-header { padding: 18px; }
  .picker-header h2 { font-size: 18px; }
  .picker-header p { font-size: 10px; }
  .picker-search { grid-template-columns: minmax(0, 1fr); margin-top: 15px; gap: 8px; }
  .picker-body { padding: 16px 18px 20px; }
  .picker-footer { padding: 14px 18px; flex-wrap: wrap; gap: 10px; }
  .picker-footer p { max-width: none; width: 100%; font-size: 9px; }
  .picker-footer .button-row { width: 100%; justify-content: flex-end; }
  .offer-card { padding: 14px; }
  .offer-bottom { margin-left: 0; }
  .picker-form { padding: 15px; }
  .field-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #toast { left: calc(50% + 26px); bottom: 16px; max-width: calc(100vw - 80px); font-size: 11px; }
}
@media (max-width: 430px) {
  .workspace-title > span, .workspace-title > strong { display: none; }
  .workspace-tabs { gap: 16px; }
  .workspace-tabs > button > span { display: none; }
  #main { padding: 17px 12px; }
  h1 { font-size: 19px; }
  .summary-card { padding: 12px; }
  .summary-card strong { font-size: 19px; }
  .summary-card label { font-size: 9px; }
  .page-actions .button { flex: 1; }
  .card-heading { padding: 12px; }
  .card-heading h2 { font-size: 12px; }
  .card-heading .button { font-size: 9px; padding: 5px 7px; }
  .route-step { flex-basis: 100%; }
  .field-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}

/* Readable daily-work density: secondary information remains readable at every width. */
.button { font-size: 12px; }
.button.small, .card-heading .button, .link-button.danger { font-size: 11px; }
.link-button { font-size: 12px; }
.badge, .summary-card > label .badge, .item-source .badge, .timeline-item .badge,
.deal-tile .badge { font-size: 11px; padding: 3px 7px; }
.summary-card > label, .summary-card small { font-size: 11px; color: #607284; }
.summary-card > label { min-height: 21px; }
th { font-size: 11px; color: #607284; }
td { font-size: 12px; }
.item-table .item-name input { font-size: 13px; }
.item-source, .item-row .mini-label { font-size: 11px; color: #65798b; }
.item-source { padding-left: 0; line-height: 1.6; }
.item-row .mini-label { letter-spacing: .3px; }
.item-number { font-size: 12px; }
.item-table td > .help, .item-table td.amount small { font-size: 11px; }
.item-table td.amount strong { font-size: 13px; }
.help, .muted, .field > label, label.field, .mini-label, .section-subtitle,
.card-heading p, .heading-left > p, .view-caption { color: #647789; }
.help, .field > label, label.field, .mini-label, .section-subtitle,
.card-heading p, .heading-left > p { font-size: 11px; }
.detail-panel .field > span, .detail-panel .help, .item-detail-footer .help,
.detail-panel .notice, .input-suffix > span { font-size: 11px; color: #647789; }
.detail-panel .input { font-size: 12px; }
.source-title { font-size: 12px; }
.source-facts, .stock-line, .stock-line > .muted { font-size: 11px; color: #617688; }
.cost-line { font-size: 12px; color: #617688; }
.cost-line strong, .cost-line b { font-size: 12px; }
.cost-line.total strong, .cost-line.total b { font-size: 13px; }
.timeline-date { font-size: 11px; color: #677b8c; line-height: 1.6; }
.timeline-item strong, .timeline-item p { font-size: 12px; }
.timeline-item p { color: #5f7182; }
.timeline-item > small { display: block; font-size: 11px; margin-top: 5px; }
.next-action p { font-size: 12px; color: #60778a; }
.next-action .due, .due { font-size: 11px; color: #617789; }
.client-main p, .client-main small { font-size: 11px; color: #617587; }
.card-body > .client-meta { font-size: 12px; color: #617587; }
.notice, .card > .screen-note, .screen-note { font-size: 11px; }
.notice { color: #617587; }
.notice.blue { color: #4d738f; }
.notice.amber { color: #876827; }
.card > .screen-note, .screen-note { color: #647789; }
.totals-strip > div > span, .total label, .total small { font-size: 11px; color: #63778a; }
.context-card p, .route-step p { font-size: 12px; color: #637789; }
.route-step strong, .route-step b { font-size: 12px; }
.finance-row, .finance-row strong { font-size: 12px; }
.finance-row small { font-size: 11px; color: #64798b; }
.offer-top strong, .offer-top h3, .offer-card > h3 { font-size: 13px; }
.offer-spec, .offer-card > small, .offer-bottom > span, .offer-bottom small,
.offer-radio, .offer-price small { font-size: 11px; color: #61788a; }
.offer-spec { line-height: 1.7; }
.picker-header p, .picker-search .input, .picker-search .select,
.picker-form > .help, .picker-footer p, .picker-footer .help { font-size: 11px; color: #607587; }
.picker-form .field > span { font-size: 12px; }
.picker-form .input { font-size: 13px; }
.deal-tile p, .tile-next, .kanban-heading > span, .kanban-note { font-size: 11px; color: #64798b; }
.deal-tile .eyebrow, .eyebrow { font-size: 10px; color: #6e8192; }
.deal-tile h3 { font-size: 13px; }
.workspace-tabs > button { font-size: 12px; }
.save-status, .demo-badge, .text-button, .workspace-footer { font-size: 11px; color: #6b7f90; }

/* Two compact rows for a position's purchase source and cost calculation. */
.item-detail.compact-detail {
  width: auto;
  min-width: 0;
  margin: 0;
  padding: 8px 16px 9px;
  border: 0;
  border-left: 3px solid #bfd8ea;
  border-radius: 0;
  background: #f7fafd;
}
.compact-source-row, .compact-cost-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px 12px;
  min-height: 31px;
  font-size: 12px;
  color: #5f7182;
}
.compact-cost-row { margin-top: 4px; padding-top: 6px; border-top: 1px solid #e2eaf1; }
.compact-kicker { flex: 0 0 auto; font-size: 10px; font-weight: 600; color: #667f92; text-transform: uppercase; letter-spacing: .3px; }
.compact-source-name { flex: 1 1 225px; color: #3b617d; font-size: 12px; line-height: 1.5; }
.compact-source-price, .compact-availability, .compact-status { white-space: nowrap; font-size: 11px; }
.compact-source-price b { color: #3f5d73; font-weight: 600; }
.compact-availability { color: #427962; }
.compact-status { color: #637f94; font-size: 10px; }
.compact-replace { padding: 3px 0; font-size: 11px; }
.compact-field { display: inline-flex; align-items: center; gap: 5px; margin: 0; font-size: 11px; white-space: nowrap; }
.compact-field .input { width: 67px; min-width: 0; min-height: 27px; height: 27px; padding: 3px 6px; font-size: 12px; text-align: right; border-color: #cedce7; }
.compact-field .input[data-field="materialPerUnit"] { width: 49px; }
.compact-unit { color: #708291; font-size: 11px; }
.compact-line-totals { display: flex; align-items: center; gap: 14px; margin-left: auto; white-space: nowrap; font-size: 11px; }
.compact-line-totals b { margin-left: 4px; font-size: 12px; font-variant-numeric: tabular-nums; }
.compact-info { font-size: 11px; }
.compact-info > summary { padding: 4px 0; cursor: pointer; color: #426f90; }
.compact-info[open] { flex: 1 0 100%; padding-top: 4px; border-top: 1px dashed #d5e1ea; }
.compact-info-body { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 18px; padding: 4px 0; line-height: 1.55; color: #607587; }
.compact-info-body > span { flex: 1 0 100%; }
.compact-info-body .danger { margin-left: auto; padding: 3px 0; }
.compact-warning { margin: 7px 0 0; padding: 5px 8px; }

/* Keep the sales line to a name row and a short source caption. */
.item-row > td { padding-top: 7px; padding-bottom: 7px; }
.sale-name-line { display: flex; align-items: center; gap: 7px; min-width: 0; }
.sale-kind { flex: 0 0 auto; color: #6b7f90; font-size: 10px; white-space: nowrap; }
.row-drag-handle { display: inline-grid; place-items: center; width: 18px; height: 24px; border-radius: 4px; color: #8195a5; cursor: grab; user-select: none; font-size: 18px; line-height: 1; }
.row-drag-handle:hover { background: #e9f2f9; color: #1f6fb2; }
.row-drag-handle:active, .is-row-dragging .row-drag-handle { cursor: grabbing; }
.item-row.is-drag-source > td { background: #e9f2f9; opacity: .6; }
[data-drop-row].drop-before > td { box-shadow: inset 0 3px 0 #1f6fb2; }
[data-drop-row].drop-after > td { box-shadow: inset 0 -3px 0 #1f6fb2; }
.item-table .sale-name-line input {
  flex: 1 1 auto;
  width: 0;
  min-width: 120px;
  height: 27px;
  margin: 0;
  padding: 3px 6px;
  font-size: 13px;
}
.item-row .item-source {
  display: block;
  width: 0;
  min-width: 100%;
  margin-top: 2px;
  font-size: 11px;
  line-height: 15px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.item-row .item-number { height: 27px; min-height: 27px; padding: 3px 6px; }
.item-row td > .help { margin-top: 2px; line-height: 15px; }
.item-row td.amount small { margin-top: 2px; line-height: 15px; }
.item-row .row-toggle { min-height: 26px; padding-top: 2px; padding-bottom: 2px; }
.item-row .badge { padding-top: 3px; padding-bottom: 3px; }
@media (max-width: 850px) {
  .item-detail.compact-detail { padding-left: 12px; padding-right: 12px; }
  .compact-source-row, .compact-cost-row { gap: 5px 9px; }
  .compact-source-name { flex-basis: 200px; }
  .compact-line-totals { margin-left: 0; }
}

/* Keep units with their values and each sale position's component costs together. */
.sales-inline-value { display: inline-flex; align-items: center; flex-wrap: nowrap; gap: 5px; height: 27px; white-space: nowrap; }
.sales-inline-value > span { color: #64798b; font-size: 11px; }
.item-table .sales-inline-value .item-number { flex: 0 0 auto; width: 62px; }
.item-table .sales-inline-value .item-number[data-field="price"] { width: 85px; }
.component-section { min-width: 0; }
.component-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding: 2px 0 8px; }
.position-lead-time { display: flex; align-items: center; justify-content: flex-start; flex-wrap: wrap; gap: 5px 8px; min-width: 0; font-size: 11px; color: var(--muted); }
.position-lead-time > .lead-time-title { flex: 0 0 auto; }
.position-lead-time > label { display: inline-flex; align-items: center; gap: 4px; margin: 0; white-space: nowrap; }
.position-lead-time .input { min-width: 0; min-height: 28px; height: 28px; padding: 3px 5px; font-size: 11px; }
.position-lead-time input.input { width: 56px; text-align: right; }
.position-lead-time select.input { width: 139px; }
.sale-position-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 18px; min-width: 0; }
.sale-position-toolbar > .position-lead-time { flex: 0 1 auto; margin-left: auto; justify-content: flex-end; text-align: right; }
.sales-table .purchase-toggle-button { flex: 0 1 auto; width: max-content; min-width: min(300px, 100%); max-width: 100%; min-height: 30px; padding: 4px 9px; justify-content: flex-start; flex-wrap: wrap; gap: 4px 8px; font-size: 11px; line-height: 20px; }
.purchase-toggle-button::before { content:'▸'; font-size:15px; }
.purchase-toggle-button[aria-expanded="true"]::before { content:'▾'; }
.purchase-toggle-button > [data-purchase-toggle-label] { flex: 0 0 auto; }
.sales-table .purchase-toggle-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.purchase-toggle-count { display: inline-flex; flex: 0 0 auto; align-items: center; justify-content: center; min-width: 38px; height: 20px; padding: 0 5px; border-radius: 3px; background: #edf1f5; color: #647786; font-size: 10px; font-variant-numeric: tabular-nums; }
.purchase-toggle-total { flex: 0 1 auto; min-width: 0; margin-left: auto; color: #4b672f; font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; white-space: normal; overflow-wrap: anywhere; }
.purchase-toggle-total.is-loss { color: #9f3030; }
.client-name-fields { min-width: 0; flex: 1; }
.client-name-fields .input { width: 100%; min-width: 0; }
.client-name-input { font-weight: 600; }
.client-note-input { margin-top: 5px; font-size: 11px; }
.client-contact-fields { display: grid; gap: 9px; margin: 14px 0; }
.client-contact-fields label { display: grid; gap: 3px; min-width: 0; }
.client-contact-fields label > span { color: var(--muted); font-size: 10px; }
.client-contact-fields .input { width: 100%; min-width: 0; }
.component-heading > strong, .component-heading > h3, .component-heading > .compact-kicker { color: #4c6c83; font-size: 12px; font-weight: 600; }
.component-table { width: 100%; table-layout: fixed; }
.component-table th, .component-table td { padding: 7px 8px; font-size: 12px; vertical-align: middle; }
.component-table th { background: #f0f5f9; font-size: 11px; }
.component-table th:first-child, .component-table td:first-child { width: 95px; padding-left: 8px; }
.component-table th:nth-child(3), .component-table td:nth-child(3) { width: 105px; }
.component-table th:nth-child(4), .component-table td:nth-child(4) { width: 125px; text-align: right; }
.component-table th:nth-child(5), .component-table td:nth-child(5) { width: 80px; text-align: left; }
.component-table th:nth-child(6), .component-table td:nth-child(6) { width: 110px; text-align: right; }
.component-table th:last-child, .component-table td:last-child { width: 140px; padding-right: 8px; text-align: right; }
.component-kind { color: #60798c; font-size: 11px; }
.component-name { overflow-wrap: anywhere; }
.component-name strong { display: block; color: #3f6078; font-size: 12px; font-weight: 600; line-height: 1.45; }
.component-name small, .component-basis { display: block; margin-top: 2px; color: #657b8d; font-size: 11px; line-height: 1.45; }
.component-price, .component-actions { white-space: nowrap; }
.component-actions .link-button { padding: 2px 0; font-size: 11px; }
.component-actions .icon-button { min-width: 25px; height: 25px; margin-left: 5px; vertical-align: middle; }
.component-totals { display: flex; align-items: baseline; justify-content: flex-end; flex-wrap: wrap; gap: 6px 22px; padding: 9px 8px 1px; color: #607689; font-size: 11px; }
.component-totals strong, .component-totals b { margin-left: 5px; color: #405f77; font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.component-summary-text { color: #61798b; font-size: 11px; line-height: 1.5; }
.component-warning { margin: 8px 0 0; padding: 6px 9px; }
.component-empty { margin: 0; padding: 12px 8px; border: 1px dashed #d5e2ec; border-radius: 5px; color: #647b8c; font-size: 12px; line-height: 1.6; }
#component-dialog { width: min(680px, 95vw); max-width: none; max-height: 90dvh; overflow: auto; border: 1px solid #dce4ec; border-radius: 9px; box-shadow: 0 18px 50px rgb(24 44 63 / 20%); }
.component-form { padding: 20px; }
.component-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.component-form-grid .full-width { grid-column: 1 / -1; }
.component-form .field > span { font-size: 12px; color: #607689; }
.component-preview { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 8px 18px; margin-top: 17px; padding: 12px; border: 1px solid #dce8f1; border-radius: 5px; background: #f3f8fc; color: #607689; font-size: 12px; }
.component-preview strong { color: #3d617d; font-size: 16px; font-variant-numeric: tabular-nums; }
.component-form > .button-row { justify-content: flex-end; margin-top: 18px; padding-top: 15px; border-top: 1px solid #e3ebf2; }
#supplier-dialog { width: min(640px, calc(100vw - 32px)); max-width: none; max-height: calc(100dvh - 40px); overflow-y: auto; border: 1px solid #dce2d5; border-radius: 6px; box-shadow: 0 18px 50px rgb(24 44 63 / 20%); }
#supplier-dialog > .card-heading { padding: 18px 20px; }
.supplier-form { padding: 20px; }
.supplier-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.supplier-form-grid > .full-width { grid-column: 1 / -1; }
.supplier-form-grid > .field { min-width: 0; }
.supplier-form .field > span { font-size: 12px; }
.supplier-form .input { width: 100%; min-width: 0; }
.supplier-business-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; min-width: 0; }
.supplier-card-form > .supplier-business-fields { margin-top: 16px; }
.supplier-address-control > .supplier-website-button { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 44px; min-width: 44px; min-height: 44px; padding: 6px; }
.supplier-website-button svg { flex-shrink: 0; }
.supplier-address-control { display: flex; align-items: stretch; gap: 8px; min-width: 0; }
.supplier-address-control > .input { flex: 1 1 0; min-width: 0; }
.supplier-address-control > .supplier-map-button { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 44px; min-width: 44px; min-height: 44px; padding: 6px; }
.supplier-form .field > label, .supplier-card-form .field > label { font-size: 12px; }
.supplier-field-optional { font-weight: 400; color: var(--muted); }
.supplier-warehouse-row > .supplier-map-field { grid-column: 1 / -1; }
.supplier-directions { min-width: 0; margin: 0; padding: 0; border: 0; }
.supplier-directions legend { padding: 0; margin-bottom: 8px; font-size: 12px; color: #7e8e9c; }
.supplier-directions > div { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.supplier-directions label { display: inline-flex; align-items: center; gap: 7px; font-size: 14px; cursor: pointer; }
.supplier-directions input { flex: 0 0 17px; width: 17px; height: 17px; margin: 0; accent-color: var(--brand-green, #71be00); }
.supplier-picker-filter { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; color: #7e8e9c; font-size: 12px; border-bottom: 1px solid #e1e6d9; }
.supplier-picker-filter button { flex-shrink: 0; padding: 3px 7px; border: 0; background: transparent; color: var(--accent); cursor: pointer; font: inherit; }
.supplier-line-actions { display: inline-flex; align-items: center; gap: 10px; white-space: nowrap; }
.supplier-form-grid > .supplier-price-draft { grid-column: 1 / -1; min-width: 0; margin-top: 0; }
.supplier-line-actions .supplier-price-link { color: var(--accent); font-size: 13px; text-decoration: none; padding: 6px 0; }
.supplier-line-actions .supplier-price-link:hover { text-decoration: underline; }
.sales-table .routing-map-link { display: inline-flex; flex: 0 0 28px; align-items: center; justify-content: center; width: 28px; min-height: 28px; border-radius: 5px; }
.sales-table .routing-map-link svg { width: 20px; height: 20px; }
.sales-table .routing-map-link:hover { background: #f1f5f8; }
.sales-table .routing-map-link:focus-visible, .supplier-price-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.supplier-form > .button-row { justify-content: flex-end; flex-wrap: wrap; margin-top: 18px; padding-top: 15px; border-top: 1px solid #e1e6d9; }
#supplier-card-dialog { width: min(760px, calc(100vw - 32px)); max-width: none; max-height: calc(100dvh - 40px); overflow-y: auto; border: 1px solid #dce2d5; border-radius: 6px; box-shadow: 0 18px 50px rgb(24 44 63 / 20%); }
#supplier-card-dialog > .card-heading { padding: 18px 20px; }
.supplier-card-form { padding: 20px; }
.supplier-card-form .field { min-width: 0; }
.supplier-card-form .input { width: 100%; min-width: 0; }
.supplier-directory-section { margin-top: 18px; padding-top: 15px; border-top: 1px solid #e1e6d9; }
.supplier-directory-heading, .supplier-directory-section > header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.supplier-directory-heading h3, .supplier-directory-section > header h3 { margin: 0; font-size: 13px; }
.supplier-warehouse-row, .supplier-contact-row { display: grid; align-items: start; gap: 8px 10px; margin-top: 10px; padding: 10px; border: 1px solid #e1e6d9; border-radius: 4px; background: #fcfdfa; }
.supplier-warehouse-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); }
.supplier-contact-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.supplier-warehouse-row > .icon-button, .supplier-contact-row > .icon-button { grid-column: 1 / -1; justify-self: end; }
.supplier-contact-scopes { display: flex; grid-column: 1 / -1; flex-wrap: wrap; gap: 6px 14px; min-width: 0; font-size: 11px; color: #6a7462; }
.supplier-contact-scopes > label { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; overflow-wrap: anywhere; }
.supplier-contact-scopes input[type="checkbox"] { flex: 0 0 15px; width: 15px; height: 15px; margin: 0; accent-color: var(--brand-green, #71be00); }
.supplier-directory-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 18px; padding-top: 15px; border-top: 1px solid #e1e6d9; }
.supplier-directory-empty { margin: 8px 0 0; color: #6a7462; font-size: 11px; line-height: 1.4; }
.supplier-contact-overview dl { display: grid; gap: 8px; margin: 0; }
.supplier-contact-overview dl > div { padding: 8px 10px; border: 1px solid var(--line, #dce3e9); border-radius: 7px; }
.supplier-contact-overview dt { color: var(--muted, #526377); font-size: 12px; }
.supplier-contact-overview dd { margin: 3px 0 0; overflow-wrap: anywhere; }
.supplier-contact-inputs .field { min-width: 0; }
.supplier-client-link, .supplier-warehouse-section { margin-top: 14px; }
.supplier-warehouse-section .supplier-directory-heading { margin-bottom: 6px; }
.supplier-warehouse-section .supplier-directory-heading h3 { margin-bottom: 0; }
.supplier-warehouse-details { margin-top: 6px; min-width: 0; }
.supplier-warehouse-details > summary { padding: 7px 10px; border: 1px solid var(--line, #dce3e9); border-radius: 7px; cursor: pointer; overflow-wrap: anywhere; }
.supplier-warehouse-details > summary span { margin-left: 8px; color: var(--muted, #526377); }
.supplier-warehouse-details > .supplier-warehouse-row { min-width: 0; margin-top: 4px; }
.supplier-contact-extra { margin-top: 10px; min-width: 0; }
.supplier-contact-extra > summary { color: var(--accent); cursor: pointer; font-size: 13px; overflow-wrap: anywhere; }
.supplier-contact-extra[open] > summary { margin-bottom: 10px; }
.supplier-contact-fields { min-width: 0; border: 0; padding: 0; margin: 0; }
.supplier-contact-extra .supplier-business-fields { grid-column: 1 / -1; }
#supplier-card-title .contact-card-badges, #supplier-title .contact-card-badges { vertical-align: middle; }
.supplier-picker-menu {
  position: fixed;
  z-index: 85;
  max-width: calc(100vw - 24px);
  max-height: min(320px, calc(100dvh - 24px));
  margin: 0;
  padding: 4px;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid #bdcfaa;
  border-radius: 3px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 5px 18px rgb(36 43 50 / 16%);
  font-size: 12px;
  line-height: 1.4;
}
.supplier-picker-menu[hidden] { display: none; }
.supplier-picker-option, .supplier-create-option {
  display: block;
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 2px;
  background: #fff;
  color: inherit;
  font: inherit;
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
  cursor: pointer;
}
.supplier-picker-option + .supplier-picker-option { border-top-color: #edf0e8; }
.supplier-picker-option strong { display: block; color: #424b54; font-size: 12px; font-weight: 600; }
.supplier-picker-option small { display: block; margin-top: 2px; color: #6a7462; font-size: 10px; }
.supplier-picker-option:hover, .supplier-picker-option[aria-selected="true"], .supplier-create-option:hover, .supplier-create-option[aria-selected="true"] { border-color: #d7e5c6; background: #f0f6e7; }
.supplier-picker-empty { margin: 0; padding: 8px 10px; color: #6a7462; font-size: 11px; }
.supplier-create-option { color: var(--accent); border-top-color: #e1e6d9; font-weight: 600; }
@media (max-width: 700px) {
  .supplier-form, .supplier-card-form { padding: 16px; }
  .supplier-form-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .supplier-business-fields { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .supplier-warehouse-row, .supplier-contact-row { grid-template-columns: minmax(0, 1fr); }
}
.component-table .component-inline-supplier {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 26px;
  height: 26px;
  margin-top: 3px;
  padding: 3px 6px;
  font-size: 12px;
  color: #526d82;
  background: #fff;
}
.component-inline-value { display: inline-flex; align-items: center; flex-wrap: nowrap; gap: 5px; white-space: nowrap; }
.component-inline-value .input { flex: 0 0 auto; width: 48px; min-width: 0; min-height: 27px; height: 27px; padding: 3px 5px; font-size: 12px; text-align: right; }
.component-inline-value .input[data-field="price"] { width: 74px; }
.component-inline-value > span { font-size: 11px; color: #657b8d; }
.component-table th:nth-child(4), .component-table td:nth-child(4) { width: 145px; }
.component-table .input[aria-invalid="true"] { border-color: #bc6c6c; background: #fff7f7; }
.component-table .component-inline-name { display: block; width: 100%; min-width: 0; height: 27px; min-height: 27px; padding: 3px 6px; font-size: 12px; font-weight: 600; color: #3f6078; }
.component-inline-value .component-inline-unit { width: 56px; padding: 3px 4px; font-size: 11px; text-align: left; }
.component-table th:nth-child(3), .component-table td:nth-child(3) { width: 125px; }
.sales-inline-value .sale-unit { flex: 0 0 auto; width: 52px; min-width: 0; min-height: 27px; height: 27px; padding: 3px 4px; font-size: 11px; }
.item-table .sale-name-line .sale-include { flex: 0 0 16px; width: 16px; min-width: 16px; height: 16px; margin: 0; padding: 0; cursor: pointer; accent-color: #1f6fb2; }
.item-row.is-excluded { background: #f4f6f8; }
.item-row.is-excluded .item-source, .item-row.is-excluded .amount { color: #7e8c99; }
.item-row.is-excluded .sale-name-line input[data-field="name"] { font-weight: 400; background: #f7f9fb; }
.excluded-note { display: block; margin-top: 2px; color: #7b6d42; font-size: 10px; line-height: 13px; }
.quote-variant-row { display: flex; align-items: center; gap: 16px; padding: 8px 0; border-bottom: 1px solid #e7edf2; }
.quote-variant-row:last-child { border-bottom: 0; }
.quote-variant-row > div { flex: 1; min-width: 0; }
.quote-variant-row strong { display: block; color: #3f6078; font-size: 12px; overflow-wrap: anywhere; }
.quote-variant-row small { display: block; margin-top: 3px; color: #697e8e; font-size: 11px; }
.quote-variant-row > b { font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.quote-save { display: flex; align-items: end; gap: 12px; margin: 18px 0; }
.quote-save .field { flex: 1; }
@media (max-width: 700px) { .quote-save { flex-wrap: wrap; } .quote-save .field { flex-basis: 100%; } }
@media (max-width: 700px) {
  .component-form { padding: 16px; }
  .component-form-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .component-totals { gap: 6px 16px; }
}

/* The receipt metric opens the deal's locally recorded client prepayments. */
button.summary-card.summary-action { appearance: none; text-align: left; padding-right: 36px; transition: border-color .15s, background .15s; }
.summary-action .summary-label { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; min-height: 21px; margin-bottom: 7px; color: #607284; font-size: 11px; }
.summary-action .summary-label .badge { font-size: 11px; padding: 3px 7px; }
.summary-action::after { content: "›"; position: absolute; right: 16px; top: 50%; transform: translateY(-50%); color: #7c9bb3; font-size: 25px; font-weight: 400; line-height: 1; }
.summary-action:hover { border-color: #9ebfd9; background: #f8fbfe; }
.summary-action:hover::after { color: var(--accent); }
#prepayment-dialog { width: min(720px, calc(100vw - 32px)); max-width: none; max-height: calc(100dvh - 40px); overflow-y: auto; border: 1px solid #dce4ec; border-radius: 9px; box-shadow: 0 18px 50px rgb(24 44 63 / 20%); }
#prepayment-dialog > .card-heading { padding: 18px 22px; }
#prepayment-dialog > .card-body { padding: 18px 22px 22px; }
.prepayment-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; padding: 13px 16px; border: 1px solid #dce8f1; border-radius: 6px; background: #f3f8fc; }
.prepayment-summary small { display: block; color: #607689; font-size: 12px; }
.prepayment-summary strong { display: block; margin-top: 5px; color: #3d617d; font-size: 21px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.25; }
.prepayment-list { margin: 14px 0 0; padding: 0; list-style: none; }
#prepayment-dialog .prepayment-list { max-height: min(240px, 30dvh); overflow-y: auto; padding-right: 4px; }
.prepayment-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid #e5edf3; }
.prepayment-row:last-child { border-bottom: 0; }
.prepayment-info { min-width: 0; color: #526d82; }
.prepayment-info > strong { margin-right: 7px; font-size: 12px; font-weight: 600; }
.prepayment-info .badge { font-size: 10px; vertical-align: middle; }
.prepayment-info p { margin: 5px 0 0; color: #64798b; font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; white-space: pre-wrap; }
.prepayment-row > b { flex-shrink: 0; padding-top: 2px; color: var(--green); font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.prepayment-empty { margin: 16px 0; padding: 14px; border: 1px dashed #d5e2ec; border-radius: 5px; color: #647b8c; font-size: 12px; line-height: 1.6; }
.prepayment-form { margin-top: 18px; padding-top: 18px; border-top: 1px solid #dce5ed; }
.prepayment-form h3 { margin: 0 0 13px; color: #4c6c83; font-size: 14px; font-weight: 600; }
.prepayment-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.prepayment-form .field > span { color: #607689; font-size: 12px; }
.prepayment-form > .field { margin-top: 12px; }
.prepayment-form textarea { min-height: 58px; resize: vertical; }
.prepayment-form > .button-row { justify-content: flex-end; margin-top: 14px; }
.payment-demo-actor { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; margin-bottom: 14px; }
.payment-demo-actor > label { font-size: 11px; color: var(--muted); }
.payment-demo-actor > .input { width: auto; max-width: 100%; min-width: 0; }
.payment-demo-actor > small { flex-basis: 100%; color: var(--muted); font-size: 10px; }
.payment-pending-total { padding: 8px 10px; margin: 10px 0 0; border: 1px solid #eadab5; background: #fcf8ed; color: #866021; font-size: 11px; line-height: 1.5; }
.prepayment-info .payment-account-name { margin-top: 6px; color: var(--ink); font-weight: 600; }
.prepayment-info > small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.payment-row-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; margin-top: 9px; }
.prepayment-row.is-pending > b { color: #866021; }
.prepayment-row.is-rejected > b { color: var(--muted); }
.payment-account-balances { padding-top: 12px; border-top: 1px solid var(--line); margin-top: 10px; }
.payment-account-balances > summary { color: var(--accent); cursor: pointer; font-size: 12px; }
.payment-account-balance { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 8px 0; font-size: 11px; }
.payment-account-balance > span { min-width: 0; overflow-wrap: anywhere; }
.payment-account-balance small { display: block; margin-top: 3px; color: #866021; }
.payment-account-balance > b { white-space: nowrap; }
#prepayment-confirm-dialog { width: min(470px, calc(100vw - 32px)); max-height: calc(100dvh - 40px); overflow-y: auto; border: 1px solid var(--line); border-radius: 5px; }
#prepayment-confirm-dialog .delete-confirm { color: #fff; border-color: #b64545; background: #b64545; }
#prepayment-confirm-dialog .delete-confirm:hover { background: #9d3737; }
.prepayment-fields { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.4fr); }
@media (max-width: 600px) {
  #prepayment-dialog { max-height: calc(100dvh - 24px); }
  #prepayment-dialog > .card-heading, #prepayment-dialog > .card-body { padding: 16px; }
  .prepayment-summary { gap: 12px; padding: 12px; }
  .prepayment-summary strong { font-size: 18px; }
  .prepayment-fields { grid-template-columns: minmax(0, 1fr); gap: 10px; }
}

/* Deal tasks share the compact sidebar card and a single editing dialog. */
.next-action-heading { display: flex; align-items: center; flex-wrap: wrap; gap: 5px 7px; }
.next-action-heading .mini-label { margin-right: auto; }
.next-action-heading .icon-button { min-width: 25px; height: 25px; color: #5b84a2; font-size: 19px; }
.next-action h3 { margin: 7px 0 5px; color: #36536b; font-size: 13px; font-weight: 600; line-height: 1.5; overflow-wrap: anywhere; }
.next-action p { line-height: 1.6; overflow-wrap: anywhere; white-space: pre-wrap; }
.next-action .due { margin-top: 4px; line-height: 1.5; }
.task-card-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 14px; margin-top: 8px; }
.task-card-actions .link-button { padding: 2px 0; font-size: 11px; }
#tasks-dialog { width: min(760px, calc(100vw - 32px)); max-width: none; max-height: calc(100dvh - 40px); overflow-y: auto; border: 1px solid #dce4ec; border-radius: 9px; box-shadow: 0 18px 50px rgb(24 44 63 / 20%); }
#tasks-dialog > .card-heading { padding: 18px 22px; }
#tasks-dialog > .card-body { padding: 18px 22px 22px; }
.deal-task-list { max-height: min(260px, 32dvh); overflow-y: auto; margin: 0; padding: 0 4px 0 0; list-style: none; }
.deal-task-row { display: flex; align-items: flex-start; gap: 10px; padding: 12px 0; border-bottom: 1px solid #e5edf3; }
.deal-task-row:first-child { padding-top: 0; }
.deal-task-row:last-child { border-bottom: 0; }
.deal-task-row > label { display: flex; align-items: center; min-height: 21px; cursor: pointer; }
.deal-task-check { flex-shrink: 0; width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--accent); cursor: pointer; }
.deal-task-info { flex: 1; min-width: 0; }
.deal-task-info > strong { display: block; color: #3f6078; font-size: 13px; font-weight: 600; line-height: 1.5; overflow-wrap: anywhere; }
.deal-task-info > .due { display: block; margin-top: 3px; line-height: 1.5; }
.deal-task-info > p { margin: 5px 0 0; color: #64798b; font-size: 12px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.deal-task-actions { display: flex; flex-shrink: 0; flex-direction: column; align-items: flex-end; gap: 5px; padding-top: 1px; }
.deal-task-actions .link-button { padding: 2px 0; font-size: 11px; }
.deal-task-row.is-completed .deal-task-info > strong { color: #7a8b99; text-decoration: line-through; }
.deal-task-row.is-completed .deal-task-info > p, .deal-task-row.is-completed .due { color: #7a8b99; }
.deal-task-empty { margin: 0; padding: 14px; border: 1px dashed #d5e2ec; border-radius: 5px; color: #647b8c; font-size: 12px; line-height: 1.6; }
.deal-task-form { margin-top: 18px; padding-top: 18px; border-top: 1px solid #dce5ed; }
.deal-task-form h3 { margin: 0 0 13px; color: #4c6c83; font-size: 14px; font-weight: 600; }
.task-form-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(190px, 1fr); gap: 12px; }
.deal-task-form .field > span { color: #607689; font-size: 12px; }
.deal-task-form > .field { margin-top: 12px; }
.deal-task-form textarea { min-height: 58px; resize: vertical; }
.task-form-buttons { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
@media (max-width: 600px) {
  #tasks-dialog { max-height: calc(100dvh - 24px); }
  #tasks-dialog > .card-heading, #tasks-dialog > .card-body { padding: 16px; }
  .task-form-grid { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .deal-task-row { flex-wrap: wrap; gap: 5px 10px; }
  .deal-task-info { flex-basis: calc(100% - 26px); }
  .deal-task-actions { flex: 1 0 calc(100% - 26px); flex-direction: row; align-items: center; justify-content: space-between; margin-left: 26px; padding-top: 3px; }
}

/* Sale positions own their nested composition; suppliers are secondary fields. */
.sales-table { width: 100%; min-width: 0; table-layout: fixed; --sale-row-padding: 8px; --sale-action-size: 24px; --sale-action-gap: 1px; --sale-amount-gap: 5px; }
.sales-table > thead > tr > th { background: #f6f9fc; }
.sales-table > .sale-position > .item-row > td {
  padding-top: 8px;
  padding-bottom: 8px;
  border-bottom-color: #d4e1ec;
  background-color: #edf4fa;
}
.sales-table > .sale-position + .sale-position > .item-row > td { border-top: 5px solid #fff; }
.sales-table > .sale-position > .item-row > td { border-bottom: 0; }
.sales-table > .sale-position > .sale-lead-time-row > td {
  width: auto;
  min-width: 0;
  padding: 0 12px 8px calc(4% + 8px);
  border-bottom: 1px solid #d4e1ec;
  background-color: #edf4fa;
}
.sales-table > .sale-position > .item-row > td:first-child,
.sales-table > .sale-position > .sale-lead-time-row > td,
.sales-table > .sale-position > .expanded-row > td {
  background-image: linear-gradient(to right, #6e9dbe 3px, transparent 3px);
}
.sales-table > .sale-position.is-open > .item-row > td { border-bottom-color: #e0eaf2; }
.sales-table > .sale-position > .expanded-row > td {
  background-color: #edf4fa;
  border-bottom-color: #cbddea;
}
.sales-table .sale-name-line input[data-field="name"] {
  color: #294e6b;
  background: #fff;
  border-color: #bdd2e3;
  font-weight: 600;
}
.sales-table .sale-name-line input[data-field="name"]:hover { border-color: #8fb4d0; }
.sales-table .sale-name-line input[data-field="name"]:focus { border-color: #4e92c4; }
.sales-table .item-row .item-source {
  padding-left: 70px;
  color: #657e91;
  font-size: 11px;
}
.sales-table .item-row .sale-kind { color: #5a7c96; font-weight: 600; }
.sales-table .item-row > td.amount > strong { color: #294e6b; font-size: 14px; }
.sales-table .sale-amount-layout { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: var(--sale-amount-gap); min-width: 0; }
.sales-table .sale-amount-values { min-width: 0; text-align: left; }
.sales-table .item-row .sale-amount-values > strong { display: block; color: #294e6b; font-size: 14px; line-height: 27px; }
.sales-table .sale-amount-values > small { display: block; }
.sales-table .sale-position-actions { display: flex; align-items: center; gap: var(--sale-action-gap); padding-top: 1px; }
.sales-table .sale-position-actions > .icon-button { width: var(--sale-action-size); min-width: var(--sale-action-size); height: 25px; margin: 0; padding: 0; font-size: 18px; line-height: 1; }
.sales-table .sale-position-actions > .icon-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.sales-table .sale-position-actions > .icon-button:disabled { opacity: .4; cursor: default; }
.sales-table .sale-position-actions > .icon-button:disabled:hover { border-color: transparent; background: transparent; color: #91a0ae; }
.sales-table .sale-position-actions > .sale-remove:hover { border-color: #e6c2c2; background: #fff2f1; color: #b64545; }
.sales-table .item-row .row-toggle { color: #5385a9; }
.sales-table .item-row .row-toggle:hover { background: #dbeaf5; color: #175a92; }
.sales-table .item-detail.component-section {
  width: auto;
  min-width: 0;
  margin: 0 10px 10px 34px;
  padding: 8px 10px 7px;
  border: 1px solid #d7e3ed;
  border-top: 0;
  border-left: 2px solid #c3d7e6;
  border-radius: 0 0 5px 5px;
  background: #fbfcfe;
}
.sales-table .component-heading { display: flex; align-items: center; justify-content: flex-start; padding: 0 0 8px; }
.sales-table .component-heading > .compact-kicker {
  color: #5f778a;
  font-size: 11px;
  text-transform: none;
  letter-spacing: 0;
}
.sales-table .component-heading .component-parent-reference {
  margin-left: 6px;
  color: #788d9d;
  font-weight: 400;
}
.sales-table .component-add-row { display: flex; justify-content: flex-start; padding: 8px 6px; }
.sales-table .component-add-row > .component-add-purchase { max-width: 100%; font-size: 11px; }
.sales-table .component-table th,
.sales-table .component-table td { padding: 6px; font-size: 11px; }
.sales-table .component-table th { background: #f1f5f8; color: #607587; font-size: 11px; }
.sales-table .component-table th:first-child,
.sales-table .component-table td:first-child { width: 70px; padding-left: 6px; }
.sales-table .component-table th:nth-child(3),
.sales-table .component-table td:nth-child(3) { width: 126px; }
.sales-table .component-table th:nth-child(4),
.sales-table .component-table td:nth-child(4) { width: 132px; }
.sales-table .component-table th:nth-child(5),
.sales-table .component-table td:nth-child(5) { width: 80px; }
.sales-table .component-table th:nth-child(6),
.sales-table .component-table td:nth-child(6) { width: 102px; }
.sales-table .component-table th:last-child,
.sales-table .component-table td:last-child { width: 136px; padding-right: 6px; }
.sales-table .component-table tbody tr:last-child > td { border-bottom: 0; }
.sales-table .component-table .component-kind { color: #607587; font-size: 11px; }
.sales-table .component-table .component-inline-name { color: #38586f; border-color: #d7e2ec; }
.sales-table .component-table { --purchase-choice-width: 60px; --purchase-name-gap: 8px; }
.sales-table .component-name-heading,
.sales-table .component-purchase-name {
  display: grid;
  grid-template-columns: var(--purchase-choice-width) minmax(0, 1fr);
  align-items: center;
  gap: var(--purchase-name-gap);
  min-width: 0;
}
.sales-table .component-name-heading > :first-child { text-align: center; white-space: nowrap; }
.sales-table .component-name-heading > :last-child { min-width: 0; text-align: left; }
.sales-table .component-name-title { display: inline-flex; align-items: baseline; flex-wrap: wrap; gap: 0 8px; }
.sales-table .component-name-label { display: none; align-items: baseline; flex-wrap: wrap; gap: 0 8px; margin-bottom: 4px; color: #64725a; font-size: 10px; line-height: 1.35; }
.sales-table .component-purchase-name { min-height: 27px; grid-template-columns:calc(var(--purchase-choice-width) - 24px) 20px minmax(0,1fr); column-gap:4px; }
.sales-table .component-copy-sale-name { width:20px; height:22px; padding:0; font-size:14px; line-height:1; color:#476633; background:#f1f6eb; border:1px solid #cbdabb; border-radius:4px; cursor:pointer; }
.sales-table .component-copy-sale-name:disabled { color:#899186; background:#f5f6f3; border-color:#e1e5dc; cursor:default; }
.sales-table .component-purchase-name > .component-inline-name { grid-column: 3; width: 100%; min-width: 0; }
.sales-table .component-purchase-name > .component-include {
  justify-self: center;
  appearance: auto;
  width: 18px;
  min-width: 18px;
  height: 18px;
  min-height: 18px;
  margin: 0;
  padding: 0;
  cursor: pointer;
  accent-color: var(--accent);
}
.sales-table .purchase-supplier-block {
  --supplier-label-width: 64px;
  --supplier-field-gap: 6px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.8fr);
  align-items: start;
  gap: 3px 14px;
  width: 100%;
  min-width: 0;
  margin: 0;
}
.sales-table .component-table .component-purchase-row > td { border-bottom: 0; }
.sales-table .component-table .component-supplier-row > td:nth-child(n) { width: auto; min-width: 0; padding: 0 6px 6px; }
.sales-table .component-supplier-row.is-excluded > td { background-color: #f3f5f0; }
.sales-table .component-excluded-note[hidden] { display: none; }
.sales-table .component-excluded-note {
  display: inline;
  margin: 0;
  color: #74808a;
  font-size: 12px;
  font-weight: 400;
  line-height: inherit;
  white-space: nowrap;
}
.sales-table .component-purchase-row.is-excluded > td { background: #f4f6f8; }
.sales-table .component-purchase-row.is-excluded .component-inline-name { font-weight: 400; }
.sales-table .purchase-check {
  display: block;
  min-width: 0;
  max-width: 100%;
  margin: 4px 0 0 70px;
  padding: 4px 6px;
  border: 1px solid transparent;
  border-left-width: 3px;
  border-radius: 3px;
  font-size: 10px;
  line-height: 1.4;
  white-space: normal;
  overflow-wrap: anywhere;
}
.sales-table .purchase-check[hidden] { display: none; }
.sales-table .purchase-check.is-loss { color: #9f3030; background: #fff1ef; border-color: #edc0bc; }
.sales-table .purchase-check.is-insufficient { color: #876016; background: #fff8e8; border-color: #ead39d; }
.sales-table .component-supplier-line {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  margin-top: 2px;
  border-bottom: 1px solid #e2e9ef;
  border-radius: 3px 3px 0 0;
}
.sales-table .component-supplier-label {
  flex: 0 0 auto;
  padding-left: 3px;
  color: #607587;
  font-size: 10px;
  font-weight: 400;
}
.sales-table .component-table .component-inline-supplier {
  flex: 1 1 auto;
  width: 0;
  min-width: 0;
  min-height: 23px;
  height: 23px;
  margin: 0;
  padding: 2px 3px;
  border: 1px solid transparent;
  border-radius: 3px;
  background: transparent;
  color: #60798c;
  font-size: 11px;
  font-weight: 400;
}
.sales-table .purchase-supplier-block .component-supplier-line {
  display: grid;
  grid-template-columns: var(--supplier-label-width) minmax(0, 1fr) auto;
  gap: var(--supplier-field-gap);
  align-items: center;
  min-height: 25px;
  margin: 0;
}
.sales-table .purchase-supplier-block .component-supplier-label { min-width: 0; padding-left: 0; }
.sales-table .purchase-supplier-block .component-inline-supplier { width: 100%; min-width: 0; border-color: #dce2d5; background: #fff; }
.sales-table .component-supplier-line .supplier-name-link,
.sales-table .component-supplier-line .supplier-change-button,
.sales-table .component-supplier-line .supplier-cancel-button {
  appearance: none;
  min-width: 0;
  min-height: 23px;
  margin: 0;
  padding: 2px 0;
  border: 0;
  border-radius: 0;
  color: var(--accent);
  background: none;
  font: inherit;
  font-size: 10px;
  text-align: left;
  cursor: pointer;
}
.sales-table .component-supplier-line .supplier-name-link { display: block; width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #38586f; font-size: 14px; font-weight: 600; }
.sales-table .component-supplier-line .supplier-change-button,
.sales-table .component-supplier-line .supplier-cancel-button { white-space: nowrap; }
.sales-table .component-supplier-line .supplier-name-link:hover,
.sales-table .component-supplier-line .supplier-name-link:focus-visible,
.sales-table .component-supplier-line .supplier-change-button:hover,
.sales-table .component-supplier-line .supplier-cancel-button:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.sales-table .purchase-routing {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 3px 12px;
  min-width: 0;
  margin: 0;
}
.sales-table .purchase-routing-field { min-width: 0; }
.sales-table .purchase-routing-field > label { display: grid; grid-template-columns: var(--supplier-label-width) minmax(0, 1fr); gap: var(--supplier-field-gap); align-items: center; min-width: 0; min-height: 25px; }
.sales-table .purchase-routing-field > label > span { color: #6a7462; font-size: 10px; }
.sales-table .purchase-routing-field > label > .supplier-routing-empty { grid-column: 2; }
.sales-table .purchase-routing select.input { width: 100%; min-width: 0; height: 25px; min-height: 25px; margin: 0; padding: 2px 4px; font-size: 10px; }
.sales-table .purchase-routing-detail { display: flex; align-items: flex-start; gap: 4px; min-width: 0; margin: 3px 0 0 calc(var(--supplier-label-width) + var(--supplier-field-gap)); }
.sales-table .purchase-routing-value { flex: 1 1 auto; min-width: 0; padding-top: 3px; color: #6a7462; font-size: 10px; line-height: 1.4; white-space: normal; overflow-wrap: anywhere; }
.sales-table .routing-copy-button { display: inline-grid; place-items: center; flex: 0 0 22px; width: 22px; min-width: 22px; height: 22px; min-height: 22px; margin: 0; padding: 3px; border: 1px solid transparent; border-radius: 3px; background: transparent; color: #829272; font: inherit; font-size: 15px; line-height: 1; cursor: pointer; }
.sales-table .routing-copy-button:hover { border-color: #d3dfc7; background: #edf4e5; color: var(--accent-dark); }
.sales-table .routing-copy-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.sales-table .purchase-routing .supplier-directory-empty { grid-column: 1 / -1; min-width: 0; margin: 0; padding: 0; text-align: left; font-size: 10px; white-space: normal; overflow-wrap: anywhere; }
.sales-table .supplier-routing-empty { grid-column: 1 / -1; margin: 0; color: #7a8275; font-size: 10px; line-height: 1.4; overflow-wrap: anywhere; }
.sales-table .component-action-buttons .component-copy { font-size: 18px; line-height: 1; }
.sales-table .component-supplier-line:hover { background: #f1f6fa; border-bottom-color: #b9cedd; }
.sales-table .component-supplier-line:focus-within { background: #fff; border-bottom-color: #6c9dbf; }
.sales-table .component-inline-supplier:focus-visible { outline: 2px solid #84b9e4; outline-offset: -1px; }
.sales-table .component-table .component-inline-supplier[aria-invalid="true"] { border-color: #bc6c6c; background: #fff7f7; }
.sales-table .component-basis { font-size: 11px; color: #687d8d; }
.sales-table .component-totals { gap: 5px 18px; padding: 7px 6px 0; border-top: 1px solid #e1e9f0; }
.sales-table .component-summary-text { font-size: 11px; }
.sales-table > .sale-position.is-excluded > .item-row > td { background-color: #f0f3f6; }
.sales-table > .sale-position.is-excluded > .sale-lead-time-row > td { background-color: #f0f3f6; }
.sales-table > .sale-position.is-excluded > .expanded-row > td { background-color: #f0f3f6; }
.sales-table > .sale-position.is-excluded > .item-row > td:first-child,
.sales-table > .sale-position.is-excluded > .sale-lead-time-row > td,
.sales-table > .sale-position.is-excluded > .expanded-row > td { background-image: linear-gradient(to right, #aab8c4 3px, transparent 3px); }
.sales-table .item-row.is-excluded .sale-name-line input[data-field="name"] { color: #657d8f; font-weight: 400; background: #f8fafb; }
.sales-table > .sale-position > .item-row.is-drag-source > td { background-color: #dcebf6; }

/* Fit the deal's available width; reflow fields instead of scrolling or clipping. */
.sales-table-wrap { container: sale-lines / inline-size; width: 100%; min-width: 0; }
.sales-table > thead > tr > th { overflow-wrap: anywhere; }
.sales-table > thead > tr > th:nth-child(1) { width: 28px; padding-left: 5px; padding-right: 0; }
.sales-table > thead > tr > th:nth-child(2) { width: calc(44% - 28px); }
.sales-table > thead > tr > th:nth-child(3) { width: 12%; }
.sales-table > thead > tr > th:nth-child(4) { width: 14%; }
.sales-table > thead > tr > th:nth-child(5) { width: 18%; }
.sales-table > thead > tr > th:nth-child(6) { width: 12%; }
.sale-position-type {
  flex: 0 0 76px;
  width: 76px;
  max-width: 76px;
  min-width: 0;
  min-height: 32px;
  padding: 5px 16px 5px 6px;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #60758a 50%), linear-gradient(135deg, #60758a 50%, transparent 50%);
  background-position: calc(100% - 10px) 50%, calc(100% - 6px) 50%;
  background-size: 4px 4px;
  background-repeat: no-repeat;
}
.sale-name-heading { display: flex; align-items: center; gap: 5px; }
.sale-type-heading { flex: 0 0 76px; }
.technical-spec-cell { overflow-wrap:anywhere; }
.technical-spec-link { padding:0; text-align:left; }
.technical-spec-state,.technical-spec-stale,.technical-spec-unneeded { display:block; font-size:11px; margin-top:5px; color:var(--muted); }
.technical-spec-stale { color:#a26711; }
.archived-technical-specs { margin:14px; }
.archived-technical-specs summary { cursor:pointer; color:var(--muted); }
.archived-technical-specs .link-button { display:block; margin-top:8px; }
.production-technical-spec { margin-bottom:15px; }
.sales-table > thead > tr > th.amount { padding-left: var(--sale-row-padding); padding-right: var(--sale-row-padding); text-align: left; }
.sales-table > .sale-position > .item-row > td { min-width: 0; padding-left: var(--sale-row-padding); padding-right: var(--sale-row-padding); vertical-align: top; }
.sales-table .item-row > td.amount > strong { line-height: 27px; }
.sales-table > .sale-position > .item-row > td:first-child { padding-left: 5px; padding-right: 0; }
.sales-table .item-name { width: auto; min-width: 0; }
.sales-table .sale-name-line { gap: 5px; }
.sales-table .row-drag-handle { flex: 0 0 18px; }
.sales-table .sale-name-line input[data-field="name"] { min-width: 0; min-height: 27px; }
.sales-table {
  --measure-number-width: 70px;
  --measure-unit-width: 52px;
  --measure-gap: 5px;
  --measure-width: calc(var(--measure-number-width) + var(--measure-unit-width) + var(--measure-gap));
}
.sales-table .sales-inline-value,
.sales-table .component-inline-value,
.sales-table .availability-editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--measure-unit-width);
  gap: var(--measure-gap);
  align-items: start;
  width: var(--measure-width);
  max-width: 100%;
  min-width: 0;
  height: 27px;
}
.sales-table .sales-inline-value > .item-number,
.sales-table .sales-inline-value > .item-number[data-field="price"],
.sales-table .component-inline-value > .input,
.sales-table .component-inline-value > .input[data-field="price"],
.sales-table .availability-editor > .availability-quantity {
  width: 100%;
  min-width: 0;
  height: 27px;
  min-height: 27px;
  margin: 0;
  padding: 3px 5px;
  font-size: 12px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.sales-table .sales-inline-value > span,
.sales-table .component-inline-value > span {
  display: block;
  width: var(--measure-unit-width);
  min-width: 0;
  height: 27px;
  padding: 0 2px;
  border: 0;
  background: transparent;
  font-size: 11px;
  line-height: 27px;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sales-table .component-table { min-width: 0; }
.sales-table .component-table > tbody > tr > td { vertical-align: top; }
.sales-table .component-kind { display: flex; align-items: center; min-height: 27px; }
.sales-table .component-table td.amount > b { display: block; line-height: 27px; }
.sales-table .component-table th:nth-child(1), .sales-table .component-table td:nth-child(1) { width: 68px; }
.sales-table .component-table th:nth-child(2), .sales-table .component-table td:nth-child(2) { width: auto; }
.sales-table .component-table th:nth-child(3), .sales-table .component-table td:nth-child(3),
.sales-table .component-table th:nth-child(4), .sales-table .component-table td:nth-child(4),
.sales-table .component-table th:nth-child(5), .sales-table .component-table td:nth-child(5) { width: 139px; text-align: left; }
.sales-table .component-table th:nth-child(6), .sales-table .component-table td:nth-child(6) { width: 86px; }
.sales-table .component-table th:nth-child(7), .sales-table .component-table td:nth-child(7) { width: 132px; }
.sales-table .component-table th { overflow-wrap: anywhere; }
.sales-table .component-kind { white-space: nowrap; overflow-wrap: normal; }
.sales-table .component-availability { text-align: left; }
.sales-table .availability-value { display: flex; align-items: center; flex-wrap: wrap; gap: 0 3px; min-height: 27px; max-width: 100%; color: var(--green, #4d8200); font-size: 11px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.sales-table .availability-value > small { color: inherit; font-size: inherit; font-weight: 400; }
.sales-table .availability-value.is-empty { color: var(--muted); }
.sales-table .availability-empty { display: flex; align-items: center; min-height: 27px; color: var(--muted); font-weight: 400; }
.sales-table .unit-picker { display: flex; width: var(--measure-unit-width); min-width: 0; height: 27px; border: 1px solid #d6dce0; border-radius: 2px; background: #fff; }
.sales-table .unit-picker:focus-within { border-color: var(--brand-green, #71be00); }
.sales-table .unit-picker > input.input { flex: 1 1 0; width: 0; min-width: 0; min-height: 25px; height: 25px; margin: 0; padding: 3px; border: 0; background: transparent; font-size: 11px; text-align: left; }
.sales-table .unit-picker > .unit-choice { flex: 0 0 17px; width: 17px; min-width: 17px; height: 25px; min-height: 25px; margin: 0; padding: 0; border: 0; border-radius: 0; font-size: 0; color: #424b54; background-color: transparent; cursor: pointer; }
.sales-table .unit-choice option { font-size: 12px; color: #424b54; background: #fff; }
.sales-table .component-price, .sales-table .component-actions { white-space: normal; }
.sales-table .component-actions .link-button { display: inline-block; max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
.sales-table .component-actions .icon-button { margin-left: 2px; }
.sales-table .component-action-buttons { display: flex; justify-content: flex-end; align-items: center; min-height: 27px; gap: 3px; }
.sales-table .component-action-buttons > .link-button { flex: 0 0 auto; white-space: nowrap; }
.sales-table .component-action-buttons > .icon-button { flex: 0 0 25px; min-width: 25px; margin: 0; }
.sales-table .amount, .sales-table .amount strong, .sales-table .amount b,
.sales-table .component-totals span, .sales-table .component-totals b { min-width: 0; white-space: normal; overflow-wrap: anywhere; }
.sales-table .component-table .component-purchase-headings > th.amount { width:110px; white-space:nowrap; overflow-wrap:normal; }
.sales-table .component-table .component-purchase-row > td.amount b { white-space:nowrap; overflow-wrap:normal; }
.sales-table .component-heading { flex-wrap: wrap; }
.sales-table .component-totals > *, .sales-table .component-totals .link-button { max-width: 100%; overflow-wrap: anywhere; }

@container sale-lines (max-width: 1000px) {
  .sales-table .purchase-supplier-block { margin-left: 0; }
  .sales-table .purchase-routing { margin-left: 0; }
}

/* Keep the familiar table on narrower desktops; share space within its columns. */
@container sale-lines (min-width: 761px) and (max-width: 1000px) {
  .sales-table .component-table { --measure-unit-width: 44px; }
  .sales-table .component-table th:nth-child(1), .sales-table .component-table td:nth-child(1) { width: 7.5%; }
  .sales-table .component-table th:nth-child(2), .sales-table .component-table td:nth-child(2) { width: 25.5%; }
  .sales-table .component-table th:nth-child(3), .sales-table .component-table td:nth-child(3),
  .sales-table .component-table th:nth-child(4), .sales-table .component-table td:nth-child(4),
  .sales-table .component-table th:nth-child(5), .sales-table .component-table td:nth-child(5) { width: 15%; }
  .sales-table .component-table th:nth-child(6), .sales-table .component-table td:nth-child(6) { width: 10%; }
  .sales-table .component-table th:nth-child(7), .sales-table .component-table td:nth-child(7) { width: 12%; }
  .sales-table .component-action-buttons { flex-wrap: wrap; gap: 0; }
}

@container sale-lines (max-width: 760px) {
  .sales-table .purchase-supplier-block { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .sales-table .purchase-routing { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 10px; }
  .sales-table, .sales-table > .sale-position { display: block; width: 100%; }
  .sales-table > thead { display: none; }
  .sales-table > .sale-position > .item-row {
    display: grid;
    grid-template-columns: 24px repeat(3, minmax(0, 1fr));
    grid-template-areas: "drag name name name" ". quantity price amount" ". spec spec spec";
    gap: 0 6px;
    background: #edf4fa;
  }
  .sales-table > .sale-position + .sale-position > .item-row { border-top: 5px solid #fff; }
  .sales-table > .sale-position > .item-row > td { display: block; width: auto; min-width: 0; padding: 6px 4px; border: 0; }
  .sales-table > .sale-position > .item-row > td:nth-child(1) { grid-area: drag; }
  .sales-table > .sale-position > .item-row > td:nth-child(2) { grid-area: name; }
  .sales-table > .sale-position > .item-row > td:nth-child(3) { grid-area: quantity; }
  .sales-table > .sale-position > .item-row > td:nth-child(4) { grid-area: price; }
  .sales-table > .sale-position > .item-row > td:nth-child(5) { grid-area: amount; }
  .sales-table > .sale-position > .item-row > td:nth-child(6) { grid-area: spec; }
  .sales-table > .sale-position > .item-row > td[data-column]::before {
    content: attr(data-column);
    display: block;
    margin-bottom: 3px;
    color: #64798b;
    font-size: 10px;
    line-height: 1.35;
    text-align: left;
  }
  .sales-table .item-row .item-source { width: auto; min-width: 0; white-space: normal; overflow-wrap: anywhere; }
  .sales-table > .sale-position > .sale-lead-time-row,
  .sales-table > .sale-position > .sale-lead-time-row > td { display: block; width: 100%; min-width: 0; }
  .sales-table > .sale-position > .sale-lead-time-row > td { padding: 2px 8px 8px 35px; }
  .sales-table .sale-position-toolbar { gap: 8px 12px; }
  .sales-table .purchase-check { margin-left: 0; }
  .sales-table > .sale-position > .expanded-row,
  .sales-table > .sale-position > .expanded-row > td { display: block; width: 100%; }
  .sales-table .item-detail.component-section { min-width: 0; margin-left: 18px; margin-right: 8px; padding: 8px; }
  .sales-table .component-table > thead,
  .sales-table .component-table > tbody > tr.component-purchase-headings { display: none; }
  .sales-table .component-name-label { display: flex; }
  .sales-table .component-table td[data-column]::before {
    content: attr(data-column);
    display: block;
    margin-bottom: 4px;
    color: #64725a;
    font-size: 10px;
    line-height: 1.35;
    text-align: left;
  }
  .sales-table .component-table, .sales-table .component-table > tbody { display: block; width: 100%; }
  .sales-table .component-table > tbody > tr {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-template-areas: "kind name name name" "quantity price availability cost" "actions actions actions actions";
    gap: 4px 6px;
    padding: 7px 0;
    border-bottom: 1px solid #e1e9f0;
  }
  .sales-table .component-table > tbody > tr:last-child { border-bottom: 0; }
  .sales-table .component-table td:nth-child(n) { display: block; width: auto; min-width: 0; padding: 3px; border: 0; }
  .sales-table .component-table td:nth-child(1) { grid-area: kind; }
  .sales-table .component-table td:nth-child(2) { grid-area: name; }
  .sales-table .component-table td:nth-child(3) { grid-area: quantity; }
  .sales-table .component-table td:nth-child(4) { grid-area: price; }
  .sales-table .component-table td:nth-child(5) { grid-area: availability; }
  .sales-table .component-table td:nth-child(6) { grid-area: cost; }
  .sales-table .component-table td:nth-child(7) { grid-area: actions; display: flex; flex-wrap: wrap; align-content: start; gap: 3px; text-align: left; }
  .sales-table .component-table > tbody > tr.component-purchase-row { border-bottom: 0; padding-bottom: 3px; }
  .sales-table .component-table > tbody > tr.component-supplier-row { display: block; padding: 0 0 7px; grid-template: none; }
  .sales-table .component-table .component-supplier-row > td:nth-child(n) { display: block; grid-area: auto; width: 100%; padding: 0 3px; }
  .sales-table .component-actions .icon-button { margin: 0; }
  .sales-table .component-actions .link-button { flex-basis: auto; }
  .sales-table .component-action-buttons { width: 100%; flex-wrap: wrap; justify-content: flex-start; }
  .sales-table .component-action-buttons > .link-button { flex: 0 0 auto; text-align: left; }
  .sales-table .component-totals { justify-content: flex-start; gap: 6px 14px; }
  .sales-table > .sale-position.is-excluded > .item-row { background: #f0f3f6; }
}

@container sale-lines (max-width: 480px) {
  .sales-table .purchase-routing { grid-template-columns: minmax(0, 1fr); }
  .sales-table .component-table > tbody > tr {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas: "kind kind" "name name" "quantity price" "availability cost" "actions actions";
  }
  .sales-table .component-table td.component-actions { justify-content: flex-end; align-items: center; }
  .sales-table .component-actions .link-button { flex-basis: auto; }
  .sales-table .component-action-buttons { justify-content: flex-end; }
  .sales-table .component-action-buttons > .link-button { flex-basis: auto; }
  .sales-table .component-supplier-line { flex-wrap: wrap; gap: 2px 6px; }
  .sales-table .component-table .component-inline-supplier { flex-basis: 100px; }
  .sales-table .position-lead-time > .lead-time-title { flex-basis: 100%; }
  .sales-table > .sale-position > .item-row {
    grid-template-columns: 24px repeat(2, minmax(0, 1fr));
    grid-template-areas: "drag name name" ". quantity price" ". amount spec";
  }
  .sales-table > .sale-position > .item-row > td.amount { text-align: left; }
  .sales-table .sale-amount-values { text-align: left; }
}
/* Commercial terms share the existing purchase disclosure and keep editing controls mounted. */
.purchase-commercial { margin: 10px 0 3px; padding-top: 9px; text-align:left; }
.purchase-commercial > summary { width: fit-content; max-width: 100%; cursor: pointer; color: #475b36; font-weight: 600; }
.purchase-commercial-grid { display:grid; grid-template-columns:repeat(3,minmax(160px,1fr)); gap:12px; margin-top:12px; }
.purchase-commercial-grid [hidden] { display:none; }
.purchase-agreed-price { position:relative; min-width:0; }
.purchase-agreed-price > .input { width:100%; padding-right:42px; }
.purchase-agreed-price > .purchase-price-refresh { position:absolute; right:6px; top:50%; transform:translateY(-50%); min-width:26px; width:26px; height:26px; padding:0; border:1px solid #cbd8bc; background:#f1f6ea; color:#4d7516; font-size:21px; line-height:1; }
.purchase-agreed-price > .purchase-price-refresh:hover { border-color:#76a834; background:#e3efcf; color:#294a0b; }
.purchase-agreed-price > .purchase-price-refresh:disabled { opacity:.4; cursor:default; }
.purchase-agreed-price > .purchase-price-refresh:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }
.purchase-payment-grid { display:grid; grid-template-columns:repeat(2,minmax(160px,1fr)); gap:12px; align-items:end; margin-top:16px; }
.purchase-payment-grid .button { justify-self:start; margin-bottom:2px; }
.purchase-vat { margin-top:14px; }
.purchase-vat > span { display:block; font-size:12px; margin-bottom:6px; }
.purchase-vat-options { display:flex; gap:6px; flex-wrap:wrap; }
.purchase-vat-options .button[aria-pressed="true"], .purchase-vat-options .button[aria-pressed="true"]:hover { border-color:#639300; background:#dcecbd; color:#284600; box-shadow:inset 0 0 0 1px #639300; font-weight:700; }
.purchase-vat-manual { max-width:160px; margin-top:10px; }
.purchase-vat-manual[hidden] { display:none; }
.purchase-invoice-upload { margin-top:14px; padding:12px; border:1px dashed #cfdbc5; border-radius:6px; }
.purchase-invoice-upload input[type="file"] { font-size:12px; }
.purchase-file { display:flex; gap:10px; margin-top:8px; align-items:center; }
.purchase-file a { overflow-wrap:anywhere; }
.purchase-accounting { margin-top:12px; border-top:1px solid #e4e9df; padding-top:10px; }
.purchase-accounting .field { margin-top:10px; }
@media(max-width:600px){.purchase-payment-grid{grid-template-columns:1fr}}
.quote-pricing-controls { display:flex; flex-wrap:wrap; align-items:end; gap:16px; padding:18px; background:#f2f5ee; }
.quote-pricing-controls .field { flex:1; min-width:220px; }
.quote-pricing-controls [hidden] { display:none; }
.quote-payment-parts { width:100%; }
.refusal-dialog { width:min(720px,calc(100vw - 32px)); }
.refusal-dialog .field { display:grid; gap:6px; margin-bottom:16px; }
.refusal-dialog [hidden] { display:none; }
.refusal-summary { background:#fff3f1; border:1px solid #ead1cb; border-radius:6px; padding:14px 18px; margin-bottom:18px; }
.refusal-summary p { margin:8px 0; white-space:pre-wrap; }
.refusal-reasons-list { display:grid; gap:12px; }
.refusal-reason-row { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:8px 16px; align-items:center; }
.refusal-reason-row small { grid-column:1/-1; color:#718070; }
.refusal-add-row { display:flex; gap:12px; margin:16px 0; }
.quote-payment-row { display:grid; grid-template-columns:minmax(170px,1.2fr) minmax(130px,1fr) minmax(120px,1fr) auto; gap:12px; align-items:end; margin-bottom:12px; }
.expected-prepayment-summary { grid-column:1/-1; padding:12px 16px; border:1px solid #dce3d4; border-radius:6px; background:#fafcf6; }
.expected-prepayment-summary>div { display:flex; gap:14px; align-items:center; }
.expected-prepayment-summary small { display:block; margin-top:5px; color:#718070; }
.quote-variant-row { flex-wrap:wrap; }
.quote-payment-row .field { min-width:0; }
.quote-part-payable { padding-bottom:12px; }
.quote-payment-hint,.quote-pricing-controls .validation-error { width:100%; margin:0; }
.quote-discount-summary { display:grid; gap:9px; padding:18px 0 6px; }
.quote-discount-summary>div { display:flex; justify-content:space-between; gap:16px; }
.quote-conditions dd[data-quote-payment-terms] { white-space:pre-line; }
@media(max-width:700px){.quote-payment-row{grid-template-columns:minmax(0,1fr) minmax(0,1fr) auto}.quote-payment-row .field:first-child{grid-column:1 / -1}.quote-part-payable{font-size:13px}}
.commercial-profile-row { display:grid; grid-template-columns:1.6fr 1.1fr 1.4fr .8fr auto; gap:14px; align-items:end; margin-bottom:18px; padding-bottom:18px; border-bottom:1px solid #e4e9df; }
.commercial-profile-row .field { min-width:0; }
#commercial-settings-dialog { width:min(1100px,94vw); }
#commercial-settings-error { color:#a52a2a; margin:12px 0; }
@media(max-width:800px){.purchase-commercial-grid{grid-template-columns:1fr 1fr}.commercial-profile-row{grid-template-columns:1fr}.quote-pricing-controls{align-items:stretch}}
@media(max-width:500px){.purchase-commercial-grid{grid-template-columns:1fr}}
