:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #151a17;
  background: #f8f9f9;
  line-height: 1.45;
  --green-950: #003b22;
  --green-900: #004a2a;
  --green-800: #075c36;
  --green-700: #0d6a40;
  --green-100: #e9f5ee;
  --green-50: #f4faf6;
  --blue-700: #0a4f91;
  --orange-700: #bd6500;
  --text: #151a17;
  --muted: #5f6762;
  --subtle: #8a918d;
  --border: #cdd4d0;
  --border-soft: #e4e8e5;
  --surface: #ffffff;
  --surface-muted: #f7f9f8;
  --danger: #9c2f2f;
  --danger-bg: #fff0f0;
  --warning: #755700;
  --warning-bg: #fff8e2;
  --shadow: 0 12px 36px rgba(20, 45, 31, 0.08);
  --radius: 10px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: #f8f9f9;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, #ffffff 0, #f8f9f9 340px);
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a,
summary,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: var(--green-700);
}

svg {
  display: block;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

:focus-visible {
  outline: 3px solid rgba(26, 122, 76, 0.32);
  outline-offset: 2px;
}

/* App shell */
.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  height: 68px;
  color: #ffffff;
  background: linear-gradient(100deg, var(--green-950), #005a31);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.12);
}

.topbar-inner {
  width: min(100%, 1536px);
  height: 100%;
  margin: 0 auto;
  padding: 0 clamp(18px, 2.2vw, 34px);
  display: flex;
  align-items: stretch;
  gap: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  flex: 0 0 auto;
  padding-right: 28px;
  border-right: 1px solid rgba(255, 255, 255, 0.24);
  color: #ffffff;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.025em;
  text-decoration: none;
}

.brand-mark {
  width: 32px;
  height: 32px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.primary-nav {
  display: flex;
  align-items: stretch;
  min-width: 0;
}

.primary-nav a {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 144px;
  padding: 0 20px;
  color: rgba(255, 255, 255, 0.86);
  font-size: 16px;
  font-weight: 700;
  text-decoration: none;
}

.primary-nav a:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.06);
}

.primary-nav a[aria-current="page"] {
  color: #ffffff;
}

.primary-nav a[aria-current="page"]::after {
  position: absolute;
  right: 20px;
  bottom: 0;
  left: 20px;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: #ffffff;
  content: "";
}

.primary-nav svg,
.account-menu summary > svg:first-child {
  width: 25px;
  height: 25px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.account-menu {
  position: relative;
  margin-left: auto;
}

.account-menu > summary {
  height: 68px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 4px 0 16px;
  color: #ffffff;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}

.account-menu > summary::-webkit-details-marker {
  display: none;
}

.account-menu .chevron {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 160ms ease;
}

.account-menu[open] .chevron {
  transform: rotate(180deg);
}

.account-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 220px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: var(--shadow);
}

.account-popover a,
.account-popover .link-button {
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  border: 0;
  border-radius: 7px;
  color: var(--text);
  background: transparent;
  font-size: 14px;
  font-weight: 650;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.account-popover a:hover,
.account-popover .link-button:hover {
  background: var(--green-50);
  color: var(--green-800);
}

.account-popover form {
  margin: 0;
}

.container {
  width: min(100%, 1536px);
  margin: 0 auto;
  padding: 26px clamp(18px, 2.2vw, 34px) 72px;
}

/* Shared typography and controls */
.page-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.page-heading h1 {
  margin: 0 0 4px;
  color: #151817;
  font-size: clamp(30px, 3vw, 40px);
  line-height: 1.14;
  letter-spacing: -0.04em;
}

.page-heading p,
.muted {
  margin: 0;
  color: var(--muted);
}

h2,
h3 {
  color: var(--text);
}

button,
.button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 750;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, transform 150ms ease;
}

button svg,
.button svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

button:active,
.button:active {
  transform: translateY(1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.primary {
  color: #ffffff;
  background: linear-gradient(135deg, var(--green-800), var(--green-950));
  box-shadow: 0 8px 18px rgba(0, 74, 42, 0.18);
}

.primary:hover {
  background: linear-gradient(135deg, var(--green-700), var(--green-900));
}

.secondary {
  color: var(--green-800);
  border-color: var(--green-700);
  background: #ffffff;
}

.secondary:hover {
  color: var(--green-950);
  background: var(--green-50);
}

label {
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  padding: 11px 13px;
  border: 1px solid #bfc8c2;
  border-radius: 8px;
  color: var(--text);
  background: #ffffff;
  font-size: 15px;
  line-height: 1.35;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

input::placeholder,
textarea::placeholder {
  color: #808781;
}

input:hover,
select:hover,
textarea:hover {
  border-color: #97a49c;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--green-700);
  outline: none;
  box-shadow: 0 0 0 3px rgba(13, 106, 64, 0.13);
}

input[aria-invalid="true"] {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(156, 47, 47, 0.12);
}

textarea {
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
}

.notice,
.warning,
.error {
  padding: 13px 15px;
  border-radius: 8px;
  margin-bottom: 18px;
}

.notice {
  color: var(--green-900);
  border: 1px solid #b9dfc8;
  background: var(--green-100);
}

.warning {
  color: var(--warning);
  border: 1px solid #ecd98b;
  background: var(--warning-bg);
}

.error {
  color: var(--danger);
  border: 1px solid #edbcbc;
  background: var(--danger-bg);
}

pre.warning {
  white-space: pre-wrap;
  font-family: inherit;
}

.panel,
.history-panel {
  padding: 22px;
  margin-bottom: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 2px 10px rgba(17, 42, 27, 0.035);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 13px 11px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: top;
  text-align: left;
}

th {
  color: #4f5852;
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.table-wrap {
  overflow-x: auto;
}

/* Dashboard */
.quote-heading {
  margin-bottom: 8px;
}

.quote-heading p {
  font-size: 16px;
}

.quote-only-note {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0 20px;
  color: #4e5952;
  font-size: 15px;
}

.quote-only-note strong {
  color: var(--green-800);
}

.quote-only-note svg,
.supplier-help svg {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  fill: none;
  stroke: var(--green-700);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.batch-quote-form {
  margin: 0;
}

.batch-error {
  display: grid;
  gap: 3px;
}

.batch-error small {
  font-size: 12px;
}

.quote-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 344px;
  align-items: start;
  gap: 24px;
}

.product-entry-panel,
.supplier-panel {
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.product-entry-panel {
  min-width: 0;
  padding: 18px;
}

.quote-row-head,
.quote-input-row {
  display: grid;
  grid-template-columns: 42px minmax(250px, 1.75fr) minmax(154px, 0.72fr) 88px minmax(172px, 0.86fr) 42px;
  gap: 12px;
  align-items: center;
}

.quote-row-head {
  padding: 0 0 9px;
  color: #242a26;
  font-size: 13px;
  font-weight: 750;
}

.quote-row-head small {
  color: var(--muted);
  font-size: inherit;
  font-weight: 500;
}

.quote-input-row {
  position: relative;
  padding: 7px 0;
}

.row-number {
  width: 42px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: #222824;
  background: var(--surface-muted);
  font-size: 16px;
  font-weight: 700;
}

.quote-input-row input[type="text"],
.quote-input-row input[type="number"],
.image-picker {
  height: 48px;
}

.row-quantity input {
  padding-right: 8px;
  padding-left: 10px;
  text-align: center;
}

.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.image-picker {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 11px;
  overflow: hidden;
  border: 1px solid #bfc8c2;
  border-radius: 8px;
  color: #5e6661;
  background: #ffffff;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.file-input:focus-visible + .image-picker {
  border-color: var(--green-700);
  outline: 3px solid rgba(26, 122, 76, 0.24);
  outline-offset: 2px;
}

.image-picker:hover {
  border-color: #97a49c;
}

.image-picker > span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-picker-preview {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 5px;
  background: var(--surface-muted);
}

.image-picker-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-picker-preview svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: #2a332e;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-button {
  width: 42px;
  height: 44px;
  min-height: 0;
  padding: 0;
  color: #39433d;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

.icon-button:hover {
  color: var(--danger);
  background: var(--danger-bg);
}

.icon-button svg {
  width: 23px;
  height: 23px;
  stroke-width: 1.65;
}

.quote-form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 18px;
}

.add-row-button,
.search-quotes-button {
  min-height: 52px;
  padding: 0 20px;
  font-size: 16px;
}

.search-quotes-button {
  min-width: 238px;
}

.form-message {
  display: none;
  margin-top: 10px;
  color: var(--danger);
  font-size: 14px;
  font-weight: 650;
}

.form-message:not(:empty) {
  display: block;
}

.form-message.is-info {
  color: var(--green-800);
}

.supplier-panel {
  padding: 22px;
}

.supplier-panel fieldset {
  margin: 0;
  padding: 0;
  border: 0;
}

.supplier-panel legend {
  padding: 0;
  margin: 0 0 17px;
  color: var(--text);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.025em;
}

.supplier-list {
  display: grid;
  gap: 12px;
}

.supplier-option {
  position: relative;
  min-height: 76px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 11px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #ffffff;
}

label.supplier-option {
  cursor: pointer;
}

.supplier-option.is-ready {
  border-color: var(--green-700);
  background: linear-gradient(90deg, #f8fcf9, #f0f8f3);
}

.supplier-option.is-ready:hover {
  box-shadow: 0 4px 14px rgba(0, 74, 42, 0.08);
}

.supplier-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.supplier-option input:focus-visible ~ .supplier-state {
  outline: 3px solid rgba(26, 122, 76, 0.28);
  outline-offset: 2px;
}

.supplier-state {
  width: 38px;
  height: 38px;
  color: #69706c;
}

.supplier-state svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.supplier-option.is-ready .supplier-state {
  color: var(--green-800);
}

.supplier-option.is-pending .supplier-state,
.supplier-option.is-pending .supplier-copy small {
  color: var(--orange-700);
}

.supplier-copy {
  min-width: 0;
  display: grid;
}

.supplier-copy strong {
  overflow: hidden;
  color: var(--text);
  font-size: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.supplier-copy small {
  color: var(--green-800);
  font-size: 13px;
  font-weight: 550;
}

.supplier-chevron {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: #2b342e;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.supplier-option.is-ready:has(input:not(:checked)) {
  border-color: var(--border);
  background: #ffffff;
}

.supplier-option.is-ready:has(input:not(:checked)) .supplier-state {
  color: #6e7671;
}

.supplier-empty {
  padding: 18px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.supplier-help {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 18px 0 10px;
  color: var(--muted);
  font-size: 13px;
}

.supplier-help svg {
  width: 19px;
  height: 19px;
  stroke: #68716b;
}

.supplier-settings-link {
  display: inline-flex;
  font-size: 13px;
  font-weight: 700;
}

/* Bling catalog source */
.bling-import-panel {
  display: grid;
  grid-template-columns: minmax(300px, 0.9fr) minmax(360px, 1.1fr);
  gap: 24px 34px;
  align-items: end;
  padding: 22px 24px;
  margin: 0 0 24px;
  border: 1px solid #b8d7c5;
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 100% 0, rgba(40, 144, 89, 0.1), transparent 42%),
    var(--green-50);
}

.source-kicker {
  display: block;
  margin-bottom: 5px;
  color: var(--green-800);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.bling-import-copy h2 {
  margin: 0 0 6px;
  color: var(--green-900);
  font-size: 22px;
  letter-spacing: -0.025em;
}

.bling-import-copy p,
.bling-connect-cta span {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.bling-import-form {
  display: grid;
  gap: 7px;
}

.bling-import-form > div {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) auto;
  gap: 10px;
}

.bling-import-form label {
  font-size: 13px;
  font-weight: 750;
}

.bling-connect-cta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
}

.bling-recent-orders {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 7px 14px;
  padding-top: 13px;
  border-top: 1px solid #cce0d3;
  font-size: 12px;
}

.bling-recent-orders > span {
  color: var(--muted);
}

.bling-recent-orders a {
  font-weight: 750;
  text-decoration: none;
}

.field-help {
  color: var(--muted);
  font-size: 12px;
}

.bling-order-heading {
  align-items: flex-start;
}

.read-only-badge {
  display: inline-flex;
  padding: 7px 11px;
  border: 1px solid #b8d7c5;
  border-radius: 999px;
  color: var(--green-900);
  background: var(--green-50);
  font-size: 12px;
  font-weight: 800;
}

.bling-order-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 22px;
  align-items: start;
}

.bling-item-panel {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #ffffff;
}

.bling-item-list {
  display: grid;
}

.bling-item-card {
  display: grid;
  grid-template-columns: 34px 64px minmax(0, 1fr) minmax(150px, 0.3fr);
  gap: 14px;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-soft);
}

.bling-item-card:last-child {
  border-bottom: 0;
}

.bling-line-number {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 50%;
  color: var(--green-900);
  background: var(--green-100);
  font-size: 12px;
  font-weight: 800;
}

.bling-item-card > img,
.bling-image-placeholder {
  width: 64px;
  height: 64px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: #f8faf8;
  object-fit: contain;
}

.bling-image-placeholder {
  display: grid;
  place-items: center;
  color: #7b867e;
}

.bling-image-placeholder svg {
  width: 29px;
  height: 29px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
}

.bling-item-main {
  min-width: 0;
}

.bling-item-main h3 {
  margin: 0 0 6px;
  font-size: 15px;
  line-height: 1.35;
}

.bling-item-main p {
  max-width: 760px;
  margin: 8px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bling-item-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 7px;
}

.bling-item-tags span {
  padding: 3px 7px;
  border-radius: 5px;
  color: #405048;
  background: #edf3ef;
  font-size: 11px;
  font-weight: 650;
}

.bling-item-commercial {
  display: grid;
  gap: 7px;
  margin: 0;
}

.bling-item-commercial > div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.bling-item-commercial dt {
  color: var(--muted);
  font-size: 11px;
}

.bling-item-commercial dd {
  margin: 0;
  font-size: 12px;
  font-weight: 750;
  text-align: right;
}

.bling-quote-sidebar {
  position: sticky;
  top: 92px;
}

.bling-quote-sidebar .supplier-list {
  grid-template-columns: 1fr;
}

.bling-similar-option {
  padding: 14px 0;
  border-top: 1px solid var(--border-soft);
  font-size: 13px;
}

.bling-start-quote {
  width: 100%;
}

/* History */
.history-heading .button {
  min-height: 48px;
}

.history-panel {
  padding: 0;
  overflow: hidden;
}

.section-heading {
  padding: 22px 24px 16px;
  border-bottom: 1px solid var(--border-soft);
}

.section-heading h2 {
  margin: 0 0 3px;
  font-size: 21px;
  letter-spacing: -0.02em;
}

.section-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.history-table th,
.history-table td {
  padding: 16px 24px;
}

.history-table tbody tr:hover {
  background: var(--green-50);
}

.history-table tbody tr:last-child td {
  border-bottom: 0;
}

.job-status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 3px 10px;
  border-radius: 999px;
  color: #3f4943;
  background: #edf1ee;
  font-size: 12px;
  font-weight: 750;
}

.job-status.status-completed,
.job-status.status-finalized {
  color: var(--green-900);
  background: var(--green-100);
}

.job-status.status-completed_with_warnings {
  color: #775400;
  background: #fff5d4;
}

.job-status.status-running,
.job-status.status-created {
  color: #775400;
  background: #fff5d4;
}

.job-status.status-error {
  color: var(--danger);
  background: var(--danger-bg);
}

.history-action {
  text-align: right;
}

.history-action a,
.offer-access a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--green-800);
  font-weight: 750;
  text-decoration: none;
  white-space: nowrap;
}

.history-action svg,
.offer-access svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.empty-table-state {
  padding: 44px !important;
  color: var(--muted);
  text-align: center;
}

/* Results */
.result-page-heading {
  align-items: flex-end;
}

.quote-finalize-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 20px;
  margin: 4px 0 26px;
  border: 1px solid #b9d8c6;
  border-radius: var(--radius);
  background: var(--green-50);
}

.quote-finalize-panel strong {
  color: var(--green-900);
  font-size: 16px;
}

.quote-finalize-panel p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.quote-finalize-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
}

.quote-finalize-actions form {
  margin: 0;
}

.provider-code {
  color: var(--green-800) !important;
  font-weight: 700 !important;
}

.history-memory-banner {
  align-items: center;
  background: #eef8f2;
  border: 1px solid #b8ddc6;
  border-radius: 12px;
  color: var(--green-900);
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin: 0 0 20px;
  padding: 14px 18px;
}

.history-memory-banner span {
  color: #315e45;
}

.history-match-badge {
  background: #dff3e7;
  border-radius: 999px;
  color: var(--green-900) !important;
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 800;
  margin-top: 6px;
  padding: 4px 8px;
  width: fit-content;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 7px;
  color: var(--green-800);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.back-link svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.quote-result-group {
  margin-top: 30px;
}

.result-group-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 13px;
}

.query-product {
  display: flex;
  align-items: center;
  gap: 13px;
}

.query-product > img,
.query-image-placeholder {
  width: 54px;
  height: 54px;
  flex: 0 0 54px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: #ffffff;
  object-fit: contain;
}

.query-image-placeholder {
  display: grid;
  place-items: center;
  color: #7c8680;
}

.query-image-placeholder svg {
  width: 27px;
  height: 27px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.45;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.result-group-heading h2 {
  margin: 0 0 2px;
  font-size: 25px;
  line-height: 1.18;
  letter-spacing: -0.03em;
}

.result-group-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.result-limit {
  text-align: right;
}

.result-table-wrap {
  overflow-x: auto;
  border: 1px solid #aeb8b2;
  border-radius: var(--radius);
  background: #ffffff;
}

.result-table {
  min-width: 1200px;
}

.result-table thead th {
  padding: 14px 14px;
  border-bottom-color: #abb5af;
  color: #242a26;
  background: #fbfcfb;
  font-size: 11px;
}

.result-table td {
  padding: 15px 14px;
  vertical-align: middle;
}

.result-table .result-candidate:last-child .supplier-comparison-row td {
  border-bottom: 0;
}

.result-main-row:hover {
  background: #fbfdfb;
}

.result-match {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--blue-700);
}

.result-match.match-exact {
  color: var(--green-800);
}

.result-match.match-same_product_different_pack {
  color: var(--orange-700);
}

.result-match-icon {
  width: 31px;
  height: 31px;
  flex: 0 0 31px;
}

.result-match-icon svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.result-match strong {
  max-width: 105px;
  font-size: 13px;
  line-height: 1.2;
}

.found-product {
  min-width: 230px;
  display: flex;
  align-items: center;
  gap: 11px;
}

.found-product img,
.product-image-placeholder {
  width: 48px;
  height: 58px;
  flex: 0 0 48px;
  border-radius: 6px;
  background: #f6f8f7;
  object-fit: contain;
}

.product-image-placeholder {
  display: grid;
  place-items: center;
  color: #8a938d;
}

.product-image-placeholder svg {
  width: 25px;
  height: 25px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.found-product > span,
.result-main-row td > strong + small,
.result-main-row time {
  display: grid;
}

.found-product strong {
  color: var(--text);
  font-size: 14px;
  line-height: 1.35;
}

.found-product small,
.result-main-row td small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.partial-cost {
  color: var(--orange-700) !important;
}

.availability {
  color: #5e6862;
  font-size: 13px;
  white-space: nowrap;
}

.availability-in_stock {
  color: var(--green-800);
  font-weight: 700;
}

.availability-out_of_stock,
.availability-region_blocked {
  color: var(--danger);
}

.result-main-row time {
  font-size: 13px;
  white-space: nowrap;
}

.offer-access {
  text-align: right;
}

.supplier-comparison-row > td {
  padding: 0 14px 11px;
  background: #fbfcfb;
}

.supplier-comparison > summary {
  width: max-content;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 0;
  color: var(--green-800);
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
  list-style: none;
}

.supplier-comparison > summary::-webkit-details-marker {
  display: none;
}

.supplier-comparison > summary svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 150ms ease;
}

.supplier-comparison[open] > summary svg {
  transform: rotate(180deg);
}

.comparison-table-wrap {
  overflow-x: auto;
  margin: 4px 0 7px;
  border: 1px solid var(--border-soft);
  border-radius: 7px;
  background: #ffffff;
}

.comparison-table th,
.comparison-table td {
  padding: 10px 12px;
  font-size: 12px;
}

.comparison-table tbody tr:last-child td {
  border-bottom: 0;
}

.empty-results {
  min-height: 112px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: #6e7771;
  background: #ffffff;
}

.empty-results > svg {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.55;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.empty-results h2,
.empty-results h3 {
  margin: 0 0 3px;
  font-size: 18px;
}

.empty-results p {
  margin: 0;
  color: var(--muted);
}

.page-empty-state {
  margin-top: 40px;
}

.review-section {
  margin-top: 15px;
  padding: 14px 17px;
  border: 1px solid #ead28c;
  border-radius: var(--radius);
  background: #fffdf6;
}

.review-section > summary {
  color: #6e5000;
  font-size: 14px;
  font-weight: 750;
  cursor: pointer;
}

.review-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.review-candidate {
  display: grid;
  gap: 10px;
}

.review-candidate-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.review-candidate-heading h3 {
  margin: 0;
  font-size: 16px;
}

.review-candidate-heading span {
  color: var(--muted);
  font-size: 12px;
}

.review-card {
  padding: 16px;
  border: 1px solid #eadcae;
  border-radius: 8px;
  background: #ffffff;
}

.review-card-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

.review-card-heading > div {
  display: grid;
}

.review-card-heading span {
  color: var(--muted);
  font-size: 12px;
}

.review-card-heading a {
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: 700;
}

.review-commercial-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 10px 0 14px;
}

.review-commercial-grid > div {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid var(--border-soft);
  border-radius: 7px;
  background: #f8faf8;
}

.review-commercial-grid span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.025em;
  text-transform: uppercase;
}

.review-commercial-grid strong {
  font-size: 14px;
}

.review-form {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(260px, 1.2fr);
  gap: 12px;
  margin-top: 13px;
}

.review-form label {
  display: grid;
  gap: 6px;
}

/* Existing catalog, connections, and login surfaces */
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 22px;
}

.stats > div {
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #ffffff;
}

.stats strong {
  display: block;
  color: var(--green-800);
  font-size: 30px;
}

.stats span {
  color: var(--muted);
}

.connection-list {
  display: grid;
  gap: 14px;
}

.connection summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

.connection summary span:first-child {
  display: grid;
}

.connection summary small {
  color: var(--muted);
  font-weight: 400;
}

.status,
.match-label {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  color: #3b4b41;
  background: #eef2ef;
  font-size: 12px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.wide {
  grid-column: 1 / -1;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
}

.checkbox input {
  width: auto;
}

.actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.actions code {
  padding: 8px;
  border-radius: 6px;
  background: #eef1ef;
}

.connection-workflow {
  padding: 18px;
  margin-top: 20px;
  border: 1px solid #cddbd2;
  border-radius: 10px;
  background: var(--green-50);
}

.connection-workflow h3 {
  margin: 0 0 8px;
  color: var(--green-900);
}

.connection-workflow > p {
  margin: 0 0 14px;
}

.connection-workflow .notice,
.connection-workflow .error {
  margin: 14px 0;
}

.connection-workflow-actions {
  display: grid;
  gap: 14px;
}

.connection-workflow-actions > form:first-child {
  justify-self: start;
}

.calibration-form {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto;
  align-items: end;
  gap: 12px;
}

.workflow-next-step {
  color: var(--muted);
  font-size: 14px;
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.split .panel {
  display: grid;
  gap: 12px;
}

.login-shell {
  min-height: 75vh;
  display: grid;
  place-items: center;
}

.login-panel {
  width: min(420px, 100%);
  display: grid;
  gap: 16px;
}

.login-panel h1 {
  margin-bottom: 0;
}

@media (max-width: 1220px) {
  .topbar-inner {
    gap: 10px;
  }

  .brand {
    padding-right: 18px;
    font-size: 19px;
  }

  .primary-nav a {
    min-width: auto;
    padding: 0 15px;
  }

  .quote-workspace {
    grid-template-columns: minmax(0, 1fr);
  }

  .supplier-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .bling-order-layout {
    grid-template-columns: minmax(0, 1fr) 300px;
  }

  .bling-item-card {
    grid-template-columns: 34px 58px minmax(0, 1fr);
  }

  .bling-item-commercial {
    grid-column: 3;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 960px) {
  .topbar-inner {
    padding: 0 14px;
  }

  .brand {
    border-right: 0;
  }

  .brand span {
    display: none;
  }

  .primary-nav {
    flex: 1;
  }

  .primary-nav a {
    flex: 1;
    justify-content: center;
  }

  .account-menu > summary > span {
    display: none;
  }

  .account-menu > summary {
    padding-left: 6px;
  }

  .quote-row-head {
    display: none;
  }

  .quote-input-row {
    grid-template-columns: 38px minmax(0, 1fr) 110px 42px;
    grid-template-areas:
      "number product product remove"
      ". gtin quantity quantity"
      ". image image image";
    padding: 14px 0;
    border-bottom: 1px solid var(--border-soft);
  }

  .quote-input-row:last-child {
    border-bottom: 0;
  }

  .row-number {
    grid-area: number;
    width: 38px;
  }

  .row-product {
    grid-area: product;
  }

  .row-gtin {
    grid-area: gtin;
  }

  .row-quantity {
    grid-area: quantity;
  }

  .row-image {
    grid-area: image;
  }

  .remove-row {
    grid-area: remove;
  }

  .supplier-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .bling-import-panel,
  .bling-order-layout {
    grid-template-columns: 1fr;
  }

  .bling-quote-sidebar {
    position: static;
  }

  .result-group-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .result-limit {
    text-align: left;
  }
}

@media (max-width: 720px) {
  .topbar {
    height: 62px;
  }

  .topbar-inner {
    height: 62px;
    gap: 2px;
  }

  .brand {
    padding-right: 5px;
  }

  .brand-mark {
    width: 28px;
    height: 28px;
  }

  .primary-nav a {
    min-width: 52px;
    padding: 0 9px;
  }

  .primary-nav a span,
  .account-menu .chevron {
    display: none;
  }

  .primary-nav a[aria-current="page"]::after {
    right: 8px;
    left: 8px;
  }

  .account-menu > summary {
    height: 62px;
  }

  .container {
    padding: 22px 14px 54px;
  }

  .page-heading,
  .result-page-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .page-heading h1 {
    font-size: 31px;
  }

  .page-heading .button {
    width: 100%;
  }

  .product-entry-panel,
  .supplier-panel {
    padding: 15px;
  }

  .supplier-list {
    grid-template-columns: 1fr;
  }

  .bling-import-panel {
    padding: 18px;
  }

  .bling-import-form > div {
    grid-template-columns: 1fr;
  }

  .bling-connect-cta {
    align-items: stretch;
    flex-direction: column;
  }

  .bling-item-card {
    grid-template-columns: 32px 54px minmax(0, 1fr);
    gap: 10px;
    padding: 14px;
  }

  .bling-item-card > img,
  .bling-image-placeholder {
    width: 54px;
    height: 54px;
  }

  .bling-item-commercial {
    grid-column: 2 / -1;
    grid-template-columns: 1fr;
    padding-top: 9px;
    border-top: 1px solid var(--border-soft);
  }

  .quote-form-actions {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .quote-form-actions button,
  .search-quotes-button {
    width: 100%;
  }

  .history-panel {
    border-right: 0;
    border-left: 0;
    border-radius: 0;
    margin-right: -14px;
    margin-left: -14px;
  }

  .history-table thead {
    display: none;
  }

  .history-table,
  .history-table tbody,
  .history-table tr,
  .history-table td {
    display: block;
    width: 100%;
  }

  .history-table tr {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-soft);
  }

  .history-table td {
    display: grid;
    grid-template-columns: 115px minmax(0, 1fr);
    gap: 12px;
    padding: 5px 0;
    border: 0;
  }

  .history-table td::before {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    content: attr(data-label);
  }

  .history-table .history-action {
    display: flex;
    justify-content: flex-end;
    padding-top: 12px;
  }

  .history-table .history-action::before,
  .history-table .empty-table-state::before {
    display: none;
  }

  .result-table-wrap {
    overflow: visible;
    border: 0;
    background: transparent;
  }

  .result-table {
    min-width: 0;
  }

  .result-table > thead {
    display: none;
  }

  .result-table,
  .result-table > tbody,
  .result-main-row,
  .result-main-row > td,
  .supplier-comparison-row,
  .supplier-comparison-row > td {
    display: block;
    width: 100%;
  }

  .result-candidate {
    margin-bottom: 14px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #ffffff;
  }

  .result-main-row {
    padding: 14px 16px 7px;
  }

  .result-main-row > td {
    display: grid;
    grid-template-columns: 122px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    padding: 8px 0;
    border: 0;
  }

  .result-main-row > td::before {
    color: var(--muted);
    font-size: 11px;
    font-weight: 750;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    content: attr(data-label);
  }

  .result-main-row .offer-access {
    display: flex;
    justify-content: flex-end;
    padding-top: 13px;
    border-top: 1px solid var(--border-soft);
  }

  .result-main-row .offer-access::before {
    display: none;
  }

  .supplier-comparison-row > td {
    padding: 0 16px 11px;
    border: 0;
  }

  .comparison-table {
    min-width: 680px;
  }

  .found-product {
    min-width: 0;
  }

  .review-card-heading,
  .review-form {
    flex-direction: column;
  }

  .quote-finalize-panel,
  .quote-finalize-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .quote-finalize-actions .button,
  .quote-finalize-actions button {
    width: 100%;
  }

  .review-commercial-grid,
  .review-form {
    grid-template-columns: 1fr;
  }

  .stats,
  .split,
  .form-grid,
  .calibration-form {
    grid-template-columns: 1fr;
  }

  .wide {
    grid-column: auto;
  }
}

@media (max-width: 480px) {
  .quote-input-row {
    grid-template-columns: 34px minmax(0, 1fr) 40px;
    grid-template-areas:
      "number product remove"
      ". gtin gtin"
      ". quantity quantity"
      ". image image";
    gap: 9px;
  }

  .row-number {
    width: 34px;
    height: 44px;
  }

  .query-product {
    align-items: flex-start;
  }

  .result-main-row > td {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

.quote-processing-panel {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 20px 0;
  padding: 20px;
  border: 1px solid #b7dcc8;
  border-radius: 14px;
  background: #f1faf5;
}

.quote-processing-panel > div {
  flex: 1;
}

.quote-processing-panel p {
  margin: 5px 0 0;
  color: var(--muted);
}

.quote-processing-spinner {
  display: inline-block;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border: 3px solid #b7dcc8;
  border-top-color: var(--green-700);
  border-radius: 50%;
  animation: quote-processing-spin 0.9s linear infinite;
}

@keyframes quote-processing-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 680px) {
  .quote-processing-panel {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  .quote-processing-spinner {
    animation: none;
  }
}
