:root {
  color-scheme: light;
  --bg: #ffffff;
  --fg: #050505;
  --muted: #050505;
  --line: transparent;
  --soft: #ffffff;
  --field: #ffffff;
  --panel: #ffffff;
  --danger: #b00020;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--fg);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #050505;
  --fg: #ffffff;
  --muted: #ffffff;
  --line: transparent;
  --soft: #050505;
  --field: #050505;
  --panel: #050505;
  --danger: #ff6b7a;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

* {
  box-sizing: border-box;
}

html,
body,
#app {
  height: 100%;
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  overflow: hidden;
}

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

button {
  color: inherit;
}

.icon {
  width: 20px;
  height: 20px;
  display: block;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand-logo {
  display: inline-flex;
  align-items: center;
}

.brand-logo img {
  display: block;
  object-fit: contain;
}

.brand-logo-mark img {
  width: 44px;
  height: 44px;
}

.brand-logo-wordmark img {
  width: min(240px, 60vw);
  height: auto;
}

.logo-dark,
[data-theme="dark"] .logo-light {
  display: none;
}

[data-theme="dark"] .logo-dark {
  display: block;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(420px, 100%);
  border: 1px solid var(--line);
  padding: 28px;
  background: var(--bg);
  box-shadow: var(--shadow);
}

.login-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
}

.form-stack {
  display: grid;
  gap: 16px;
}

.field {
  display: grid;
  gap: 7px;
  position: relative;
}

.field span,
.eyebrow {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0;
  margin: 0;
}

input,
select,
textarea {
  width: 100%;
  min-height: 36px;
  border: 1px solid transparent;
  border-radius: 0;
  background: var(--field);
  color: var(--fg);
  padding: 8px 10px;
  outline: none;
}

textarea {
  resize: vertical;
  line-height: 1.4;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--fg);
  background: var(--bg);
}

.primary,
.secondary-button,
.quiet-button,
.icon-button {
  border: 1px solid var(--fg);
  background: var(--fg);
  color: var(--bg);
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
}

.primary {
  padding: 0 18px;
  font-weight: 800;
}

.secondary-button,
.quiet-button {
  padding: 0 14px;
  font-weight: 800;
}

.secondary-button {
  background: transparent;
  color: var(--fg);
}

.quiet-button {
  border-color: var(--line);
  background: transparent;
  color: var(--muted);
}

.icon-button {
  width: 38px;
  padding: 0;
}

.icon-only {
  width: 40px;
  padding: 0;
}

.icon-pair {
  width: 58px;
  padding: 0;
  gap: 4px;
}

.icon-pair .icon {
  width: 18px;
  height: 18px;
}

.icon-button[data-action="theme"],
.topbar-actions .icon-button {
  border-color: var(--line);
  background: transparent;
  color: var(--fg);
}

.topbar-actions .icon-button[data-active="true"] {
  border-color: var(--fg);
  background: var(--fg);
  color: var(--bg);
}

.topbar-actions .icon-button:disabled {
  opacity: 0.35;
  cursor: default;
}

.primary:hover,
.secondary-button:hover,
.quiet-button:hover,
.icon-button:hover {
  opacity: 0.82;
}

.error {
  min-height: 20px;
  color: var(--danger);
  font-weight: 700;
}

.qr-box {
  display: grid;
  place-items: center;
  background: #fff;
  padding: 16px;
  border: 1px solid var(--line);
}

.workbench {
  height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
}

.topbar {
  min-height: 64px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 22px;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
}

.topbar-brand {
  display: flex;
  align-items: center;
  min-width: 148px;
}

.topbar-brand .brand-logo-wordmark img {
  width: 136px;
  max-height: 42px;
  object-fit: contain;
}

.topbar-stats,
.topbar-actions,
.saved-refs {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-stats {
  justify-content: center;
  align-self: stretch;
}

.stat {
  min-width: 72px;
  border: 0;
  border-left: 1px solid var(--line);
  padding: 0 10px;
  display: grid;
  align-content: center;
}

.stat:first-child {
  border-left: 0;
}

.stat strong {
  display: block;
  font-size: 18px;
  line-height: 1;
}

.stat span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

.single-product {
  display: grid;
  grid-template-columns: minmax(360px, 40vw) minmax(560px, 1fr);
  gap: 0;
  height: calc(100vh - 64px);
  min-height: 0;
  overflow: hidden;
}

.source-panel,
.catalog-form {
  min-width: 0;
  padding: 14px 16px;
}

.source-panel {
  border-right: 1px solid var(--line);
  display: grid;
  grid-template-rows: clamp(240px, 45vh, 382px) minmax(0, 1fr);
  gap: 14px;
  min-height: 0;
  overflow: hidden;
}

.source-image {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--panel);
}

button.source-image {
  padding: 0;
  background: transparent;
  color: inherit;
  cursor: zoom-in;
}

button.source-image:hover,
button.source-image:focus-visible {
  border-color: var(--fg);
  outline: none;
}

.source-image img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
}

.source-image-fit {
  position: absolute;
  inset: 12px;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
}

.missing-image {
  width: 100%;
  height: 100%;
  min-height: 260px;
  display: grid;
  place-items: center;
  color: var(--muted);
}

.source-info {
  display: grid;
  align-content: start;
  gap: 14px;
  min-height: 0;
  overflow: hidden;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(20px, 1.65vw, 30px);
  line-height: 1.12;
  max-width: 18ch;
}

.source-info h1 {
  max-width: none;
}

.raw-alert {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: fit-content;
  border: 1px solid var(--line);
  color: var(--muted);
  padding: 6px 8px;
  font-size: 12px;
  font-weight: 800;
}

.raw-alert .icon {
  width: 16px;
  height: 16px;
}

h2 {
  font-size: 20px;
  line-height: 1.1;
}

.raw-grid {
  display: flex;
  flex-wrap: wrap;
  align-content: start;
  gap: 6px;
}

.raw-chip {
  border: 1px solid var(--line);
  background: var(--field);
  min-width: 124px;
  min-height: 54px;
  padding: 8px 10px;
  max-width: 100%;
}

.raw-chip span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 3px;
}

.raw-chip strong {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 13px;
}

.catalog-form {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 8px;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.form-head {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding-bottom: 0;
}

.catalog-form .form-head .eyebrow {
  display: none;
}

.form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

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

.catalog-form .field {
  gap: 4px;
  border: 1px solid var(--line);
  background: var(--field);
  padding: 6px 8px;
  min-width: 0;
}

.catalog-form .field:focus-within {
  border-color: var(--fg);
  background: var(--bg);
}

.catalog-form .field span,
.catalog-form .eyebrow {
  font-size: 11px;
  font-weight: 760;
  line-height: 1;
}

.catalog-form input,
.catalog-form select,
.catalog-form textarea {
  min-height: 24px;
  border: 0;
  background: transparent;
  padding: 0;
  box-shadow: none;
}

.catalog-form textarea {
  padding-top: 2px;
}

.catalog-body {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  min-height: 0;
  overflow: hidden;
}

.catalog-core,
.evidence-panel {
  min-width: 0;
  min-height: 0;
}

.catalog-core {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-content: start;
  gap: 8px;
  min-height: 0;
  overflow: hidden;
}

.evidence-panel {
  display: grid;
  grid-template-columns: minmax(108px, 150px) minmax(0, 1fr);
  align-content: start;
  gap: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 8px;
  overflow: hidden;
}

.evidence-main {
  display: grid;
  grid-template-columns: minmax(92px, 0.35fr) minmax(0, 1fr) auto auto;
  align-content: start;
  align-items: end;
  gap: 6px 8px;
  min-width: 0;
}

.evidence-compare {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  min-width: 0;
}

.evidence-compare figure {
  display: grid;
  grid-template-rows: auto minmax(0, 64px);
  gap: 2px;
  min-width: 0;
  margin: 0;
}

.evidence-compare figure > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.evidence-compare figure > div {
  position: relative;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  min-width: 0;
  height: 64px;
  overflow: hidden;
  background: var(--bg);
}

.evidence-compare img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
}

.evidence-compare .icon {
  color: var(--muted);
}

.evidence-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  grid-column: 1 / 2;
  grid-row: 1;
  align-self: center;
}

.evidence-head > div {
  min-width: 0;
}

.evidence-head .eyebrow {
  display: none;
}

.evidence-head strong {
  display: block;
  max-width: 100%;
  margin-top: 3px;
  font-size: 13px;
  line-height: 1.18;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-height: 18px;
  color: var(--fg);
}

.evidence-work {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 6px;
  align-items: end;
  min-width: 0;
}

.evidence-main > .evidence-work:not(.hds-work) {
  grid-column: 2 / 5;
  grid-row: 1;
}

.image-url-field {
  grid-column: 1 / 4;
  grid-row: 2;
}

.evidence-secondary {
  grid-column: 4 / 5;
  grid-row: 2;
  align-self: stretch;
  min-width: 0;
}

.evidence-secondary summary {
  width: 34px;
  min-height: 34px;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  list-style: none;
  cursor: pointer;
  background: var(--bg);
}

.evidence-secondary summary::-webkit-details-marker {
  display: none;
}

.evidence-secondary summary:hover,
.evidence-secondary summary:focus-visible {
  border-color: var(--fg);
  outline: none;
}

.evidence-secondary[open] {
  grid-column: 1 / -1;
  grid-row: 3;
}

.evidence-secondary[open] summary {
  margin-bottom: 6px;
}

.evidence-secondary-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.9fr) minmax(0, 1.1fr) minmax(170px, 0.58fr) auto;
  gap: 6px;
  align-items: end;
  min-width: 0;
}

.evidence-secondary .official-url-field,
.evidence-secondary .brand-url-field,
.evidence-secondary .hds-work,
.evidence-secondary .document-grid,
.evidence-secondary .image-ok-toggle {
  grid-column: auto;
  grid-row: auto;
}

.priority-grid {
  grid-column: 1 / -1;
  grid-template-columns: minmax(92px, 0.5fr) minmax(0, 0.95fr) minmax(0, 1.1fr) minmax(0, 0.84fr);
}

.tax-grid {
  grid-column: 1 / -1;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 0.46fr);
  align-items: start;
}

.detail-grid {
  grid-column: 1 / 3;
  grid-template-columns: minmax(0, 1fr);
}

.specs-field {
  grid-column: 3 / -1;
}

.tax-grid .field:last-child input {
  font-size: 14px;
  font-weight: 750;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sat-product-field input {
  font-size: 14px;
  font-weight: 750;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.key-field input {
  min-height: 28px;
  font-size: 18px;
  font-weight: 800;
}

.key-field {
  border-color: var(--fg);
  background: var(--bg);
}

.assist-button {
  min-height: 36px;
  border: 1px solid var(--fg);
  background: var(--fg);
  color: var(--bg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 12px;
  font-weight: 800;
  cursor: pointer;
}

.tool-button {
  width: 38px;
  min-height: 36px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--fg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.catalog-form .tool-button,
.catalog-form .assist-button {
  min-height: 34px;
}

.tool-button:hover {
  border-color: var(--fg);
}

.tool-button:disabled {
  opacity: 0.35;
  cursor: default;
}

.research-url,
.official-url-field,
.brand-url-field,
.hds-url-field {
  min-width: 0;
}

.research-url input,
.official-url-field input,
.brand-url-field input,
.hds-url-field input {
  min-width: 0;
  font-size: clamp(11px, 0.72vw, 16px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hds-work {
  grid-column: 1 / 4;
  grid-row: 3;
  grid-template-columns: minmax(0, 1fr) auto;
}

.document-grid {
  grid-column: 4 / 6;
  grid-row: 3;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: 6px;
}

.evidence-panel .image-ok-toggle {
  grid-column: 6 / 7;
  grid-row: 3;
  align-self: end;
  min-width: 40px;
  min-height: 34px;
  padding: 0;
  justify-content: center;
}

.evidence-panel .image-ok-toggle span {
  display: none;
}

.evidence-panel .evidence-secondary .image-ok-toggle {
  grid-column: auto;
  grid-row: auto;
  align-self: end;
  width: 40px;
}

.image-url-field input {
  min-height: 32px;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.image-url-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
}

.image-url-control input[readonly] {
  color: var(--muted);
}

.image-ok-toggle {
  min-height: 34px;
  width: fit-content;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--fg);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 820;
  cursor: pointer;
  user-select: none;
}

.image-ok-toggle input {
  appearance: none;
  width: 15px;
  height: 15px;
  margin: 0;
  border: 1px solid var(--fg);
  display: grid;
  place-items: center;
}

.image-ok-toggle input:checked {
  background: var(--fg);
  box-shadow: inset 0 0 0 3px var(--bg);
}

.image-ok-toggle:focus-within {
  outline: 1px solid var(--fg);
  outline-offset: 2px;
}

.evidence-status {
  min-height: 18px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.field[data-state="suggested"] input,
.field[data-state="suggested"] select,
.field[data-state="suggested"] textarea {
  border-color: transparent;
  box-shadow: none;
}

.field[data-state="confirmed"] input,
.field[data-state="confirmed"] select,
.field[data-state="confirmed"] textarea {
  border-color: transparent;
  box-shadow: none;
}

.field[data-state="pending"] input:required,
.field[data-state="pending"] select:required,
.field[data-state="pending"] textarea:required {
  border-color: transparent;
  border-style: none;
}

.catalog-form .field[data-state="suggested"],
.catalog-form .field[data-state="confirmed"] {
  box-shadow: inset 2px 0 0 var(--muted);
}

.catalog-form .field[data-state="suggested"] {
  box-shadow: inset 2px 0 0 var(--fg);
}

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

.variant-field {
  align-content: start;
}

.variant-chips,
.attribute-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 24px;
  max-height: 24px;
  overflow: hidden;
}

.variant-chips span,
.variant-chips em,
.attribute-chips span,
.attribute-chips em {
  border: 1px solid var(--line);
  color: var(--muted);
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.attribute-chips {
  max-height: 58px;
  overflow: hidden;
}

.description-field textarea {
  min-height: 50px;
  max-height: 50px;
  resize: none;
}

.specs-field textarea {
  min-height: 58px;
  max-height: 58px;
  resize: none;
}

.catalog-review {
  min-height: 0;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  padding: 16px;
}

.catalog-review-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.catalog-review-head strong {
  border-left: 1px solid var(--line);
  padding-left: 12px;
  font-size: 22px;
}

.catalog-review-counts {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  min-width: 0;
}

.catalog-review-counts span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 780;
  white-space: nowrap;
}

.catalog-review-grid {
  min-height: 0;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(254px, 320px));
  align-content: start;
  gap: 12px;
  padding-right: 4px;
}

.catalog-review-shell {
  min-height: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
}

.catalog-filters {
  width: 260px;
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--line);
  background: var(--field);
  display: grid;
  align-content: start;
}

.catalog-filters.is-collapsed {
  width: 52px;
  overflow: hidden;
}

.catalog-filter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  border-bottom: 1px solid var(--line);
}

.catalog-filter-head > div {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.catalog-filter-head strong,
.catalog-filter-title span {
  font-size: 13px;
}

.catalog-filter-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.catalog-filters.is-collapsed .catalog-filter-head {
  display: grid;
  justify-content: stretch;
  gap: 8px;
  padding: 8px;
}

.catalog-filters.is-collapsed .catalog-filter-head > div,
.catalog-filters.is-collapsed .catalog-filter-head .tool-button[disabled] {
  display: none;
}

.catalog-filter-rail {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 8px;
}

.catalog-filter-rail .tool-button[data-active="true"] {
  border-color: var(--fg);
  background: var(--fg);
  color: var(--bg);
}

.catalog-filter-group {
  display: grid;
  gap: 8px;
  padding: 10px;
  border-bottom: 1px solid var(--line);
}

.catalog-filter-title {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.catalog-filter-title .icon {
  width: 16px;
  height: 16px;
}

.catalog-filter-title strong {
  color: var(--muted);
  font-size: 11px;
}

.catalog-filter-options {
  display: grid;
  gap: 5px;
}

.catalog-filter-option {
  min-width: 0;
  min-height: 30px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--fg);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 0 8px;
  text-align: left;
  cursor: pointer;
}

.catalog-filter-option span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 760;
}

.catalog-filter-option strong {
  color: var(--muted);
  font-size: 11px;
}

.catalog-filter-option:hover,
.catalog-filter-option:focus-visible,
.catalog-filter-option[data-active="true"] {
  border-color: var(--fg);
  outline: none;
}

.catalog-filter-option[data-active="true"] {
  background: var(--fg);
  color: var(--bg);
}

.catalog-filter-option[data-active="true"] strong {
  color: var(--bg);
}

.catalog-card {
  border: 1px solid var(--line);
  min-width: 0;
  display: grid;
  grid-template-rows: 184px minmax(0, 1fr);
  padding: 0;
  background: var(--field);
  color: var(--fg);
  text-align: left;
  font: inherit;
  cursor: pointer;
  appearance: none;
  overflow: hidden;
}

.catalog-card:hover,
.catalog-card:focus-visible {
  border-color: var(--fg);
  outline: none;
}

.catalog-card-image {
  position: relative;
  height: 184px;
  border: 0;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
  display: grid;
  place-items: center;
  background: var(--bg);
  padding: 0;
}

.catalog-card-image-fit {
  position: absolute;
  inset: 10px;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
}

.catalog-card-image-flag {
  position: absolute;
  right: 8px;
  top: 8px;
  width: 30px;
  height: 28px;
  border: 1px solid var(--fg);
  background: var(--bg);
  color: var(--fg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0;
  font-size: 11px;
  font-weight: 840;
  line-height: 1;
  z-index: 2;
}

.catalog-card-doc-flag {
  position: absolute;
  left: 8px;
  top: 8px;
  min-width: 34px;
  height: 28px;
  border: 1px solid var(--fg);
  background: var(--bg);
  color: var(--fg);
  display: grid;
  place-items: center;
  z-index: 2;
  cursor: pointer;
}

.source-hds-flag {
  left: 10px;
  top: 10px;
}

.catalog-card-image-flag .icon {
  width: 15px;
  height: 15px;
  color: currentColor;
}

.catalog-card-image-flag span {
  display: none;
}

.catalog-card-image .icon {
  width: 34px;
  height: 34px;
  color: var(--muted);
}

.catalog-card-image .catalog-card-image-flag .icon,
.source-image-flag .icon {
  width: 15px;
  height: 15px;
  color: currentColor;
}

.pdf-icon {
  min-width: 24px;
  height: 18px;
  border: 1px solid currentColor;
  display: inline-grid;
  place-items: center;
  color: currentColor;
  font-size: 8px;
  line-height: 1;
  font-weight: 920;
  letter-spacing: 0;
}

.catalog-card-main {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 6px;
  padding: 11px 12px 13px;
}

.catalog-card h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.16;
  overflow-wrap: anywhere;
}

.catalog-card p,
.catalog-card em {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  font-style: normal;
  overflow-wrap: anywhere;
}

.catalog-card-eyebrow {
  color: var(--fg);
}

.catalog-card-line {
  min-height: 16px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.catalog-card-codes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.catalog-card-codes span {
  min-width: 0;
  border: 1px solid var(--line);
  background: var(--bg);
  padding: 7px 8px;
  display: grid;
  gap: 2px;
}

.catalog-card-codes strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.catalog-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 2px;
  max-height: 52px;
  overflow: hidden;
}

.catalog-card-tags span {
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--fg);
  font-size: 11px;
  font-weight: 800;
  min-height: 22px;
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
}

.catalog-empty {
  min-height: 220px;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  color: var(--muted);
}

.catalog-empty .icon {
  width: 34px;
  height: 34px;
}

.catalog-reader {
  min-width: 0;
  min-height: 0;
  padding: 16px 16px 18px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  align-content: start;
  gap: 14px;
  overflow: auto;
}

.single-product.catalog-read-mode {
  grid-template-columns: minmax(360px, 39vw) minmax(640px, 1fr);
}

.catalog-read-mode .source-panel {
  grid-template-rows: auto minmax(0, 1fr);
  gap: 18px;
  align-content: start;
  justify-items: stretch;
}

.catalog-read-mode .source-image {
  width: min(100%, 520px);
  height: clamp(300px, 44vh, 400px);
  justify-self: center;
  align-self: start;
  padding: 0;
}

.catalog-read-mode .source-info {
  grid-template-rows: auto;
  gap: 12px;
  overflow: visible;
}

.catalog-read-mode .source-info > .eyebrow {
  display: none;
}

.source-image-flag {
  right: 12px;
  top: 12px;
}

.catalog-image-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 820;
}

.catalog-read-mode h1 {
  max-width: none;
  font-size: clamp(24px, 2vw, 36px);
  line-height: 1.04;
  text-wrap: balance;
}

.catalog-read-mode .raw-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  align-content: start;
  border: 1px solid var(--line);
  background: var(--line);
}

.catalog-read-mode .raw-chip {
  min-height: 58px;
  display: grid;
  align-content: center;
  padding: 10px 12px;
  border: 0;
  background: var(--field);
}

.catalog-read-mode .raw-chip span {
  margin-bottom: 5px;
}

.catalog-read-mode .raw-chip strong {
  font-size: 14px;
}

.product-detail {
  align-content: stretch;
}

.product-detail-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

.product-detail-head h2 {
  margin: 8px 0 0;
  font-size: clamp(24px, 2.1vw, 34px);
  line-height: 1;
}

.detail-kind {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 28px;
  border: 1px solid var(--line);
  background: var(--field);
  padding: 0 9px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 820;
}

.detail-kind .icon {
  width: 15px;
  height: 15px;
}

.detail-layout {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
  gap: 10px;
}

.detail-section {
  border: 1px solid var(--line);
  background: var(--field);
  padding: 11px;
  min-width: 0;
  display: grid;
  gap: 10px;
}

.detail-description,
.detail-evidence,
.detail-documents {
  grid-column: 1 / -1;
}

.detail-section-title {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 820;
}

.detail-section-title .icon {
  width: 15px;
  height: 15px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  border: 1px solid var(--line);
  background: var(--line);
}

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

.detail-field {
  min-width: 0;
  min-height: 62px;
  background: var(--bg);
  padding: 10px 12px;
  display: grid;
  align-content: center;
  gap: 5px;
}

.detail-field span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
}

.detail-field strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 16px;
  line-height: 1.18;
}

.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.detail-tags span,
.detail-tags em {
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--fg);
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  padding: 0 9px;
  font-size: 12px;
  font-style: normal;
  font-weight: 820;
}

.detail-tags em {
  color: var(--muted);
}

.detail-description p {
  margin: 0;
  max-width: 82ch;
  color: var(--fg);
  font-size: 15px;
  line-height: 1.45;
}

.detail-evidence {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  column-gap: 14px;
  row-gap: 8px;
}

.detail-evidence .detail-section-title {
  grid-column: 1 / -1;
}

.document-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.document-link,
.document-chip {
  min-height: 30px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--fg);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 840;
  text-decoration: none;
}

button.document-link {
  appearance: none;
  cursor: pointer;
  font: inherit;
}

.document-link:hover,
.document-link:focus-visible {
  border-color: var(--fg);
  outline: none;
}

.document-link.is-missing {
  color: var(--muted);
}

.document-link .pdf-icon,
.detail-section-title .pdf-icon {
  flex: 0 0 auto;
}

.document-chip {
  color: var(--muted);
}

.document-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
}

.document-modal-panel {
  position: relative;
  width: min(1040px, calc(100vw - 48px));
  height: min(820px, calc(100vh - 48px));
  background: var(--bg);
  border: 1px solid var(--line);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 8px;
  padding: 8px;
}

.document-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.document-modal-head > div:first-child {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.document-modal-head strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.document-modal-head span:not(.pdf-icon) {
  color: var(--muted);
  font-size: 12px;
  font-weight: 780;
}

.document-modal-canvas {
  min-height: 0;
  border: 1px solid var(--line);
  background: var(--panel);
  overflow: hidden;
}

.document-modal-canvas iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

.document-modal-empty {
  height: 100%;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
  color: var(--muted);
  text-align: center;
  padding: 24px;
}

.document-modal-empty strong {
  color: var(--fg);
  font-size: 16px;
}

.detail-evidence strong {
  min-width: 110px;
  font-size: 15px;
  overflow-wrap: anywhere;
}

.detail-evidence a {
  color: var(--muted);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-decoration: none;
}

.detail-evidence a:hover,
.detail-evidence a:focus-visible {
  color: var(--fg);
  outline: none;
}

.read-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.read-field,
.read-section {
  border: 1px solid var(--line);
  background: var(--field);
  min-width: 0;
  padding: 10px 12px;
}

.read-field {
  min-height: 58px;
  display: grid;
  align-content: center;
}

.read-field span,
.read-section > span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  margin-bottom: 6px;
}

.read-field strong,
.read-section strong {
  display: block;
  overflow-wrap: anywhere;
}

.read-section-tags {
  display: grid;
  gap: 8px;
}

.read-section p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.read-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.read-tags span,
.read-tags em {
  border: 1px solid var(--line);
  color: var(--muted);
  background: var(--bg);
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.image-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
}

.image-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
}

.image-modal-panel {
  position: relative;
  width: min(920px, calc(100vw - 48px));
  height: min(760px, calc(100vh - 48px));
  background: var(--bg);
  border: 1px solid var(--line);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 8px;
  padding: 8px;
}

.image-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.image-modal-canvas {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--bg);
  padding: 0;
}

.image-modal-fit {
  position: absolute;
  inset: 10px;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
}

.image-modal-status {
  min-height: 18px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.saved-refs {
  flex-wrap: wrap;
}

.catalog-form.saving {
  opacity: 0.62;
  pointer-events: none;
}

.empty-state {
  min-height: calc(100vh - 64px);
  display: grid;
  place-items: center;
  align-content: center;
  gap: 14px;
}

.empty-state .icon {
  width: 44px;
  height: 44px;
}

.empty-state strong {
  font-size: 24px;
}

.single-product {
  grid-template-columns: minmax(300px, 34vw) minmax(680px, 1fr);
}

.source-panel {
  padding: 12px 14px;
  grid-template-rows: minmax(220px, 42vh) minmax(0, 1fr);
  gap: 12px;
  background: var(--bg);
}

.source-image {
  border: 0;
  background: var(--field);
}

.source-image img {
  inset: 10px;
  width: calc(100% - 20px);
  height: calc(100% - 20px);
}

.source-image-fit {
  inset: 10px;
}

.source-info {
  gap: 10px;
}

.source-info h1 {
  font-size: clamp(18px, 1.35vw, 25px);
  line-height: 1.12;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.compact-meta {
  gap: 5px;
  max-height: 78px;
  overflow: hidden;
}

.raw-chip {
  min-width: 0;
  min-height: 30px;
  max-width: 100%;
  padding: 5px 8px;
  display: inline-grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  column-gap: 6px;
  border-color: var(--line);
  background: transparent;
}

.raw-chip span {
  margin: 0;
  font-size: 10px;
  font-weight: 820;
}

.raw-chip strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.raw-chip[data-empty="true"] {
  border-style: dashed;
  color: var(--muted);
}

.raw-alert {
  min-height: 30px;
  padding: 0 8px;
  background: var(--field);
}

.catalog-form {
  gap: 6px;
}

.form-head h2 {
  font-size: 19px;
}

.catalog-body {
  grid-template-rows: auto minmax(0, 1fr);
  gap: 8px;
}

.evidence-panel {
  grid-template-columns: minmax(92px, 124px) minmax(0, 1fr);
  gap: 8px;
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  padding: 7px 0 0;
}

.evidence-main {
  grid-template-columns: minmax(78px, 0.28fr) minmax(0, 1fr) auto auto;
  gap: 5px 6px;
}

.evidence-compare {
  gap: 5px;
}

.evidence-compare figure {
  grid-template-rows: auto minmax(0, 48px);
}

.evidence-compare figure > span {
  font-size: 10px;
}

.evidence-compare figure > div {
  height: 48px;
  border: 0;
  background: var(--field);
}

.evidence-head strong {
  margin-top: 0;
  font-size: 12px;
}

.catalog-form .field {
  padding: 5px 7px;
  background: transparent;
}

.catalog-form .field[data-state="pending"] {
  border-style: dashed;
}

.catalog-form input::placeholder,
.catalog-form textarea::placeholder {
  color: var(--muted);
  opacity: 0.72;
}

.key-field input {
  font-size: 16px;
}

.description-field textarea {
  min-height: 42px;
  max-height: 42px;
}

.specs-field textarea {
  min-height: 36px;
  max-height: 36px;
}

.variant-chips,
.attribute-chips {
  gap: 4px;
  min-height: 20px;
  max-height: 22px;
}

.attribute-chips {
  max-height: 42px;
}

.variant-chips span,
.variant-chips em,
.attribute-chips span,
.attribute-chips em {
  min-height: 20px;
  border: 0;
  background: var(--field);
  padding: 0 6px;
  font-size: 11px;
}

.icon-only,
.tool-button.icon-only,
.quiet-button.icon-only,
.secondary-button.icon-only,
.primary.icon-only {
  width: 36px;
  min-height: 36px;
  aspect-ratio: 1;
  padding: 0;
}

.catalog-form .tool-button,
.catalog-form .assist-button {
  min-height: 32px;
}

.catalog-review {
  height: calc(100vh - 64px);
  padding: 12px 14px;
  gap: 10px;
}

.catalog-review-head h2 {
  font-size: 22px;
}

.catalog-review-counts {
  gap: 8px;
}

.catalog-review-head strong {
  min-width: 40px;
  min-height: 32px;
  border-left: 0;
  background: var(--fg);
  color: var(--bg);
  display: grid;
  place-items: center;
  padding: 0 10px;
  font-size: 18px;
}

.catalog-review-shell {
  gap: 10px;
}

.catalog-review-grid {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  padding: 0 2px 2px 0;
}

.catalog-card {
  grid-template-rows: 142px auto;
  min-height: 224px;
  background: var(--bg);
}

.catalog-card:hover,
.catalog-card:focus-visible {
  background: var(--panel);
}

.catalog-card-image {
  height: 134px;
  margin: 8px 8px 0;
  border-bottom: 0;
  background: var(--field);
}

.catalog-card-image-fit {
  inset: 8px;
}

.catalog-card-image-flag,
.catalog-card-doc-flag {
  top: 6px;
  height: 26px;
  border-color: var(--line);
}

.catalog-card-image-flag {
  right: 6px;
  width: 28px;
}

.catalog-card-doc-flag {
  left: 6px;
  min-width: 30px;
}

.catalog-card-main {
  grid-template-rows: auto auto;
  gap: 6px;
  padding: 9px 10px 10px;
}

.catalog-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-height: 24px;
  overflow: hidden;
}

.catalog-card-meta span {
  max-width: 100%;
  min-height: 20px;
  background: var(--field);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  padding: 0 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10px;
  font-weight: 820;
}

.catalog-card h3 {
  font-size: 14px;
  line-height: 1.18;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.catalog-card-placeholder {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
}

.catalog-card-tags {
  gap: 4px;
  max-height: 24px;
  padding-top: 0;
}

.catalog-card-tags span {
  min-height: 20px;
  border: 0;
  background: var(--field);
  padding: 0 6px;
  font-size: 10px;
}

.catalog-card-foot {
  min-height: 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  color: var(--muted);
}

.catalog-card-foot span {
  min-width: 0;
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10px;
  font-weight: 820;
}

.catalog-card-foot .icon {
  width: 13px;
  height: 13px;
}

.catalog-card-foot .pdf-icon {
  min-width: 20px;
  height: 15px;
  font-size: 7px;
}

.catalog-reader {
  padding: 14px;
  gap: 10px;
  overflow: hidden;
}

.single-product.catalog-read-mode {
  grid-template-columns: minmax(300px, 34vw) minmax(680px, 1fr);
}

.catalog-read-mode .source-panel {
  grid-template-rows: minmax(250px, 40vh) minmax(0, 1fr);
  gap: 14px;
}

.catalog-read-mode .source-image {
  width: min(100%, 480px);
  height: clamp(250px, 40vh, 360px);
}

.catalog-read-mode .source-info {
  gap: 10px;
}

.catalog-read-mode h1 {
  font-size: clamp(20px, 1.65vw, 30px);
  line-height: 1.08;
}

.catalog-read-mode .raw-grid {
  display: flex;
  border: 0;
  background: transparent;
  gap: 5px;
}

.product-detail-head {
  gap: 10px;
  padding-bottom: 8px;
}

.product-detail-head h2 {
  margin-top: 6px;
  font-size: clamp(22px, 1.8vw, 28px);
}

.detail-layout {
  gap: 8px;
  overflow: hidden;
}

.detail-section {
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  padding: 8px 0 0;
  gap: 8px;
}

.detail-description p {
  font-size: 13px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.detail-grid {
  border: 0;
  background: transparent;
  gap: 6px;
}

.detail-field {
  min-height: 48px;
  background: var(--field);
  padding: 8px 10px;
}

.detail-field[data-empty="true"] {
  border: 1px dashed var(--line);
  background: transparent;
}

.detail-field[data-empty="true"] strong {
  color: var(--muted);
}

.detail-tags {
  gap: 4px;
}

.detail-tags span,
.detail-tags em {
  min-height: 22px;
  border: 0;
  background: var(--field);
  padding: 0 7px;
  font-size: 11px;
}

.detail-evidence {
  grid-template-columns: 1fr;
}

.detail-evidence-links {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.detail-evidence .detail-evidence-link {
  min-width: 0;
  border: 1px solid var(--line);
  background: var(--field);
  color: var(--fg);
  display: grid;
  gap: 3px;
  padding: 7px 8px;
  overflow: visible;
  text-decoration: none;
  text-overflow: clip;
  white-space: normal;
}

.detail-evidence .detail-evidence-link span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 780;
}

.detail-evidence .detail-evidence-link strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.detail-evidence .detail-evidence-link.is-empty {
  border-style: dashed;
  color: var(--muted);
}

@media (max-width: 980px) {
  .topbar {
    grid-template-columns: auto auto;
  }

  .topbar-stats {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: flex-start;
    overflow-x: auto;
  }

  .topbar-actions {
    justify-content: flex-end;
  }

  .single-product {
    grid-template-columns: 1fr;
    overflow-y: auto;
  }

  .source-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    grid-template-rows: clamp(190px, 34vh, 280px) minmax(0, auto);
  }

  .catalog-form {
    height: auto;
    overflow: visible;
  }

  .catalog-body {
    grid-template-columns: 1fr;
    overflow: visible;
  }

  .catalog-review-shell {
    grid-template-columns: auto minmax(0, 1fr);
    overflow: visible;
  }

  .catalog-filters {
    max-height: 320px;
  }

  .evidence-panel {
    grid-template-columns: 1fr;
    border-top: 1px solid var(--line);
    padding-top: 14px;
  }

  .form-head {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .form-actions {
    justify-content: flex-start;
    overflow-x: auto;
  }

  .evidence-work {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .topbar,
  .source-panel,
  .catalog-form {
    padding: 16px;
  }

  .form-grid,
  .raw-grid,
	  .priority-grid,
	  .tax-grid,
	  .detail-grid,
  .read-grid,
  .evidence-work,
  .evidence-compare {
    grid-template-columns: 1fr;
  }

  .form-head {
    align-items: stretch;
  }

  .primary,
  .secondary-button,
  .quiet-button,
  .assist-button {
    width: 100%;
  }

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

  .stat {
    min-width: 92px;
  }
}

.topbar-progress {
  justify-self: center;
  font-size: 18px;
  font-weight: 860;
  line-height: 1;
}

.catalog-review {
  background: var(--bg);
}

.catalog-review-head {
  padding: 0 2px;
}

.catalog-review-head h2,
.copy-head h2 {
  margin: 0;
  font-size: 26px;
  line-height: 1;
}

.catalog-review-head strong,
.copy-head strong {
  min-width: 0;
  min-height: 0;
  background: transparent;
  color: var(--fg);
  padding: 0;
  font-size: 18px;
  border: 0;
}

.catalog-review-shell {
  gap: 16px;
}

.catalog-filters {
  background: var(--bg);
  border: 0;
}

.catalog-filter-option,
.catalog-filter-group,
.catalog-filter-head {
  border: 0;
  background: var(--bg);
}

.catalog-review-grid {
  grid-template-columns: repeat(auto-fill, minmax(276px, 1fr));
  gap: 28px 18px;
  padding: 4px 4px 20px 0;
}

.catalog-card {
  min-height: 0;
  grid-template-rows: clamp(210px, 28vw, 360px) auto;
  border: 0;
  background: var(--bg);
}

.catalog-card:hover,
.catalog-card:focus-visible {
  background: var(--bg);
  outline: 0;
}

.catalog-card:hover h3,
.copy-card:hover h3 {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.catalog-card:focus-visible,
.copy-card:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 8px;
}

.catalog-card-image {
  height: auto;
  margin: 0;
  border: 0;
  background: var(--bg);
}

.catalog-card-image-fit {
  inset: 0;
  background-size: contain;
}

.catalog-card-main {
  padding: 10px 0 0;
  gap: 8px;
}

.catalog-card-meta {
  max-height: 24px;
  gap: 6px;
}

.catalog-card-meta span,
.catalog-card-tags span,
.copy-card-tags span,
.copy-modal-tags span {
  background: var(--bg);
  color: var(--fg);
  border: 0;
  padding: 0;
  font-size: 11px;
  font-weight: 820;
}

.catalog-card-meta span + span::before,
.copy-card-tags span + span::before,
.copy-modal-tags span + span::before {
  content: "/";
  margin-right: 6px;
}

.catalog-card h3 {
  font-size: clamp(18px, 1.45vw, 26px);
  line-height: 1.06;
  -webkit-line-clamp: 3;
}

.catalog-card-image-flag,
.catalog-card-doc-flag {
  border: 0;
  background: var(--fg);
  color: var(--bg);
}

.copy-board {
  height: calc(100vh - 64px);
  min-height: 0;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 18px;
  padding: 16px;
}

.copy-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.copy-grid {
  min-height: 0;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  align-content: start;
  gap: 30px 18px;
  padding: 4px 4px 28px 0;
}

.copy-card {
  min-height: 310px;
  display: grid;
  align-content: end;
  gap: 10px;
  border: 0;
  background: var(--bg);
  color: var(--fg);
  padding: 0;
  text-align: left;
  cursor: pointer;
}

.copy-card:hover,
.copy-card:focus-visible {
  outline: 0;
}

.copy-card-top,
.copy-card-tags,
.copy-modal-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 11px;
  font-weight: 820;
}

.copy-card-top {
  justify-content: space-between;
}

.copy-card h3 {
  margin: 0;
  font-size: clamp(26px, 3vw, 48px);
  line-height: 0.98;
  letter-spacing: 0;
}

.copy-card p {
  margin: 0;
  max-width: 40ch;
  font-size: 14px;
  line-height: 1.28;
  font-weight: 700;
}

.copy-card > strong {
  font-size: 12px;
  font-weight: 860;
}

.copy-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 28px;
}

.copy-modal-backdrop {
  position: absolute;
  inset: 0;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
}

.copy-modal-panel {
  position: relative;
  width: min(920px, 100%);
  max-height: min(760px, calc(100vh - 56px));
  overflow: auto;
  display: grid;
  gap: 18px;
  background: var(--bg);
  color: var(--fg);
  padding: 28px;
  box-shadow: none;
}

.copy-modal-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: start;
}

.copy-modal-head span,
.copy-modal section > span {
  font-size: 12px;
  font-weight: 860;
}

.copy-modal h2 {
  margin: 6px 0 0;
  max-width: 16ch;
  font-size: clamp(32px, 5vw, 72px);
  line-height: 0.96;
}

.copy-modal section {
  display: grid;
  gap: 6px;
}

.copy-modal p {
  margin: 0;
  max-width: 74ch;
  font-size: 16px;
  line-height: 1.42;
  font-weight: 650;
}

.topbar .icon-button,
.tool-button.icon-only,
.quiet-button.icon-only,
.secondary-button.icon-only,
.primary.icon-only {
  border: 0;
  background: var(--bg);
  color: var(--fg);
}

.topbar .icon-button:hover,
.tool-button.icon-only:hover,
.quiet-button.icon-only:hover,
.secondary-button.icon-only:hover,
.primary.icon-only:hover {
  opacity: 0.72;
}

.copy-card:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 8px;
}

/* IoT Control Center + Traceability */
.iot-page {
  display: grid;
  gap: 24px;
  padding: 16px 20px 40px;
  max-width: 1280px;
  margin: 0 auto;
}
.iot-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.iot-topbar h1 {
  font-size: 28px;
  font-weight: 860;
  letter-spacing: -0.02em;
  margin: 0;
}
.iot-topbar .iot-status {
  display: flex;
  gap: 12px;
  align-items: center;
  font-size: 13px;
}
.iot-status-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
}
.iot-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
}
@media (max-width: 900px) {
  .iot-grid { grid-template-columns: 1fr; }
}
.iot-editor-panel,
.iot-side-panel {
  min-width: 0;
  display: grid;
  gap: 14px;
  align-content: start;
}
.iot-panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: end;
}
.iot-panel-head h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.1;
}
.iot-panel-head span {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  opacity: 0.68;
}
.iot-floorplan-stage {
  --iot-floor-bg: #f7f7f4;
  border: 1px solid #e2e2de;
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
  min-height: 420px;
}
[data-theme="dark"] .iot-floorplan-stage {
  --iot-floor-bg: #121212;
  border-color: #27272a;
}
.iot-floor-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px;
  border-bottom: 1px solid #e5e5e5;
  background: var(--soft);
  min-width: 0;
}
[data-theme="dark"] .iot-floor-toolbar { border-color: #222; }
.iot-floor-toolbar-sep {
  width: 1px;
  height: 28px;
  background: #d6d6d6;
  margin: 0 3px;
}
[data-theme="dark"] .iot-floor-toolbar-sep { background: #333; }
.iot-floor-tool {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #cfcfcf;
  border-radius: 8px;
  background: var(--bg);
  color: var(--fg);
  font-size: 12px;
  font-weight: 850;
  cursor: pointer;
}
.iot-floor-tool[data-active="true"],
.iot-floor-tool.primary {
  background: var(--fg);
  border-color: var(--fg);
  color: var(--bg);
}
.iot-floor-tool:disabled {
  cursor: default;
  opacity: 0.35;
}
.iot-floor-meta {
  margin-left: auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  opacity: 0.7;
}
.iot-floor-canvas-wrap {
  padding: 10px;
  overflow: auto;
}
.iot-floor-svg {
  display: block;
  width: 100%;
  min-width: 680px;
  height: auto;
  color: #111827;
  touch-action: none;
  user-select: none;
}
[data-theme="dark"] .iot-floor-svg { color: #f3f4f6; }
.iot-floor-stroke {
  pointer-events: none;
}
.iot-placement {
  cursor: grab;
  outline: none;
}
.iot-placement:active { cursor: grabbing; }
.iot-placement text {
  fill: #fff;
  font-size: 15px;
  font-weight: 850;
  pointer-events: none;
}
.iot-vault-content {
  min-height: 64px;
}
.iot-vault-list {
  display: grid;
  gap: 6px;
  max-height: 260px;
  overflow: auto;
}
.iot-vault-item {
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  background: var(--bg);
  color: var(--fg);
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 8px;
  align-items: center;
  min-height: 46px;
  padding: 6px 8px;
  text-align: left;
  cursor: pointer;
}
[data-theme="dark"] .iot-vault-item { border-color: #2a2a2a; }
.iot-vault-item[data-placed="true"] {
  opacity: 0.62;
}
.iot-vault-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 850;
}
.iot-vault-item strong,
.iot-vault-item small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.iot-vault-item strong { font-size: 12px; }
.iot-vault-item small {
  font-size: 11px;
  opacity: 0.62;
}
.iot-vault-empty {
  padding: 14px;
  font-size: 12px;
  line-height: 1.35;
  opacity: 0.68;
}
@media (max-width: 640px) {
  .iot-page { padding: 12px 10px 24px; }
  .iot-floor-toolbar {
    position: sticky;
    top: 0;
    z-index: 2;
    overflow-x: auto;
  }
  .iot-floor-tool {
    width: 44px;
    height: 44px;
    flex: 0 0 auto;
  }
  .iot-floor-meta {
    min-width: 160px;
    white-space: normal;
    line-height: 1.2;
  }
  .iot-floor-canvas-wrap { padding: 6px; }
  .iot-floor-svg { min-width: 760px; }
}
.iot-floorplan {
  background: #f8f8f8;
  border: 1px solid #e5e5e5;
  border-radius: 12px;
  padding: 16px;
  position: relative;
  min-height: 380px;
  overflow: hidden;
}
[data-theme="dark"] .iot-floorplan {
  background: #111;
  border-color: #222;
}
.iot-floorplan svg {
  width: 100%;
  height: auto;
  display: block;
}
.iot-floorplan .hotspot {
  cursor: pointer;
  transition: opacity .1s;
}
.iot-floorplan .hotspot:hover {
  opacity: 0.85;
}
.iot-floorplan .hotspot text {
  pointer-events: none;
  font-size: 10px;
  fill: #111;
}
[data-theme="dark"] .iot-floorplan .hotspot text { fill: #eee; }
.iot-controls {
  display: grid;
  gap: 16px;
}
.iot-group {
  border: 1px solid #e5e5e5;
  border-radius: 10px;
  padding: 14px;
  background: var(--panel, #fff);
}
[data-theme="dark"] .iot-group { border-color: #222; }
.iot-group h4 {
  margin: 0 0 10px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
}
.iot-entity {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid #eee;
}
[data-theme="dark"] .iot-entity { border-color: #222; }
.iot-entity:first-child { border-top: 0; padding-top: 0; }
.iot-entity label { font-size: 13px; font-weight: 600; }
.iot-entity .controls {
  display: flex;
  align-items: center;
  gap: 8px;
}
.iot-btn {
  font-size: 12px;
  padding: 4px 10px;
  border: 1px solid #ccc;
  background: var(--bg);
  border-radius: 6px;
  cursor: pointer;
}
.iot-btn.primary { background: #111; color: #fff; border-color: #111; }
[data-theme="dark"] .iot-btn.primary { background: #fff; color: #111; border-color: #fff; }
.iot-btn:active { transform: scale(0.98); }
.iot-slider {
  width: 110px;
}
.iot-status-panel {
  background: var(--soft);
  border: 1px solid #e5e5e5;
  border-radius: 10px;
  padding: 14px;
  font-size: 13px;
  display: grid;
  gap: 8px;
}
.iot-status-panel h4 { margin: 0 0 6px; font-size: 12px; }
.iot-status-row {
  display: flex;
  justify-content: space-between;
}
.iot-timeline {
  border: 1px solid #e5e5e5;
  border-radius: 10px;
  padding: 14px;
  background: var(--panel);
}
.iot-timeline h3 { margin: 0 0 10px; font-size: 14px; }
.iot-event {
  font-family: ui-monospace, monospace;
  font-size: 12px;
  padding: 6px 0;
  border-top: 1px dashed #ddd;
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 8px;
}
.iot-event:first-child { border-top: none; }
.iot-event time { color: #666; }
.iot-linker {
  margin-top: 12px;
  padding: 12px;
  border: 1px dashed #999;
  border-radius: 8px;
  font-size: 12px;
}
.iot-linker select, .iot-linker button {
  font-size: 12px;
  padding: 4px 8px;
}
.iot-cam-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.iot-cam-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  padding: 4px 6px;
  background: rgba(0,0,0,0.03);
  border-radius: 6px;
}
[data-theme="dark"] .iot-cam-item { background: rgba(255,255,255,0.05); }
.iot-floor-label {
  font-size: 10px;
  fill: #555;
  pointer-events: none;
}

/* === COMMS + WIDGETS + CHATS STYLES === */
.badge { display:inline-flex; align-items:center; justify-content:center; min-width:16px; height:16px; font-size:10px; padding:0 4px; background:var(--danger); color:#fff; border-radius:999px; margin-left:4px; }
.comms-center { display:flex; flex-direction:column; height:100%; }
.comms-layout { display:flex; flex:1; min-height:0; gap:0; }
.comms-sidebar { width:240px; border-right:1px solid var(--line); padding:12px; background:var(--soft); display:flex; flex-direction:column; gap:12px; overflow:auto; }
.sb-head { font-weight:600; margin-bottom:4px; }
.sb-nav { display:flex; flex-direction:column; gap:2px; }
.sb-link { text-align:left; padding:8px 10px; border-radius:4px; background:transparent; border:1px solid transparent; }
.sb-link.active { background:var(--panel); border-color:var(--line); }
.sb-parties { margin-top:12px; font-size:13px; }
.party-row { padding:4px 6px; cursor:pointer; border-radius:3px; }
.party-row:hover { background:var(--panel); }
.comms-main { flex:1; padding:12px 16px; overflow:auto; display:flex; flex-direction:column; gap:12px; min-width:0; }
.comms-tabs { display:flex; gap:6px; align-items:center; border-bottom:1px solid var(--line); padding-bottom:8px; }
.tab-btn { padding:4px 10px; background:transparent; border:1px solid var(--line); }
.tab-btn.active { background:var(--fg); color:var(--bg); }
.comms-widget { margin:8px 0; padding:8px; border:1px solid var(--line); background:var(--panel); font-size:12px; border-radius:4px; }
.comms-widget.empty { opacity:0.7; }
.widget-head { display:flex; align-items:center; gap:4px; font-weight:600; margin-bottom:4px; }
.widget-body { display:flex; flex-direction:column; gap:2px; }
.comms-row { display:flex; gap:6px; font-size:11px; align-items:baseline; padding:1px 0; border-bottom:1px dotted var(--line); }
.comms-row .chan { font-family:monospace; opacity:0.7; }
.comms-row .prev { flex:1; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.comms-widget .widget-actions { margin-top:4px; }
.product-card { border:1px solid var(--line); padding:8px; margin:6px 0; background:var(--soft); font-size:13px; }
.pc-head { margin-bottom:4px; }
.pc-meta { font-size:11px; opacity:0.7; display:block; }
.pc-actions { display:flex; gap:6px; margin-top:6px; }
.da-section, .wa-section, .sent-section { border:1px solid var(--line); padding:12px; background:var(--panel); }
.da-table { width:100%; border-collapse:collapse; font-size:13px; }
.da-table th, .da-table td { border:1px solid var(--line); padding:4px 6px; text-align:left; }
.wa-threads { width:240px; border-right:1px solid var(--line); padding-right:8px; }
.wa-thread { padding:8px; margin-bottom:4px; cursor:pointer; border:1px solid transparent; }
.wa-thread.active { border-color:var(--fg); background:var(--soft); }
.wa-chat { flex:1; display:flex; flex-direction:column; }
.wa-messages { flex:1; overflow:auto; border:1px solid var(--line); padding:8px; background:var(--bg); min-height:180px; }
.wa-msg { margin:6px 0; padding:4px 8px; border-radius:4px; max-width:80%; }
.wa-msg.out { margin-left:auto; background:#e8f0ff; }
.wa-msg.in { background:#f4f4f4; }
[data-theme="dark"] .wa-msg.out { background:#223; }
[data-theme="dark"] .wa-msg.in { background:#222; }
.wa-input { display:flex; gap:6px; margin-top:8px; }
.wa-input input { flex:1; }
.wa-chat-head { display:flex; justify-content:space-between; align-items:center; margin-bottom:6px; }
.sent-row { border-bottom:1px dotted var(--line); padding:6px 0; font-size:12px; }
.sent-meta { opacity:0.8; font-size:11px; }
.trace-log { font-size:11px; opacity:0.8; margin-top:12px; }
.trace { font-family:monospace; padding:1px 0; }
.send-row { display:flex; gap:6px; margin-top:12px; align-items:center; }
.send-row input, .send-row select { flex:1; }
.workbench.comms-center .topbar-actions button { font-size:13px; }
.single-product.has-comms .comms-widget { margin:12px 0; }
.catalog-card + .product-card { margin-top:-2px; }
