:root {
  color-scheme: light;
  --ink: #1f2937;
  --muted: #667085;
  --line: #d8e3f5;
  --blue: #2f66c8;
  --blue-dark: #234f9c;
  --green: #1c7c67;
  --red: #c2413a;
  --paper: #ffffff;
  --soft: #f5f8fd;
  --yellow: #f7c948;
  --shadow: 0 10px 30px rgba(31, 41, 55, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, #f6f8fc 0%, #eef3fb 100%);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

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

button {
  cursor: pointer;
}

.app-shell {
  width: min(1480px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0;
}

.combined-print-plan {
  display: none;
}

.topbar,
.panel-heading,
.quote-meta,
.summary-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar {
  margin-bottom: 16px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
}

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

h1 {
  font-size: clamp(24px, 3vw, 34px);
}

h2 {
  font-size: 18px;
}

.topbar-actions,
.quote-tools,
.dialog-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.primary-button,
.ghost-button,
.danger-button,
.file-button,
.icon-button {
  border: 1px solid transparent;
  min-height: 38px;
  border-radius: 6px;
  padding: 0 14px;
  background: var(--paper);
  color: var(--ink);
}

.primary-button {
  background: var(--blue);
  color: white;
  border-color: var(--blue);
}

.primary-button:hover {
  background: var(--blue-dark);
}

.ghost-button,
.file-button {
  border-color: #c9d6ea;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.danger-button {
  color: white;
  background: var(--red);
}

.icon-button {
  width: 38px;
  padding: 0;
  border-color: #c9d6ea;
  font-size: 22px;
  line-height: 1;
}

.file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.file-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.quote-meta,
.library-panel,
.quote-panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.quote-meta {
  padding: 14px 16px;
  margin-bottom: 16px;
}

.quote-meta label,
.form-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.quote-meta label {
  flex: 1;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #cbd7ea;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 9px 10px;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(47, 102, 200, 0.12);
}

.compact-select,
.compact-input {
  width: auto;
  min-width: 116px;
  min-height: 38px;
}

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

.library-panel,
.quote-panel {
  min-width: 0;
}

.library-panel {
  padding: 16px;
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  overflow: auto;
}

.search-row {
  display: grid;
  gap: 8px;
  margin: 14px 0;
}

.search-row select,
.search-row button {
  min-height: 38px;
}

.price-filter {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.filter-clear {
  width: 100%;
}

.active-target {
  margin: 0 0 14px;
  padding: 9px 10px;
  border: 1px solid #c9d6ea;
  border-radius: 6px;
  background: #f8fbff;
  color: var(--blue-dark);
  font-size: 13px;
  font-weight: 700;
}

.platform-priority-panel {
  display: grid;
  grid-template-columns: minmax(180px, auto) minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  margin-bottom: 16px;
  padding: 16px;
  border: 1px solid #b9c9e8;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(47, 102, 200, 0.1), rgba(28, 124, 103, 0.08)),
    #ffffff;
  box-shadow: var(--shadow);
}

.platform-priority-panel h2 {
  font-size: 18px;
}

.quote-platform-priority {
  grid-template-columns: 1fr;
  gap: 10px;
  margin: 14px 0 12px;
  padding: 12px;
  background: #f8fbff;
  box-shadow: none;
}

.quote-platform-priority h2 {
  font-size: 15px;
}

.platform-choice-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(116px, 1fr));
  gap: 8px;
}

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

.platform-choice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 44px;
  border: 1px solid #c9d6ea;
  border-radius: 8px;
  padding: 0 11px;
  background: #fff;
  color: #334155;
  font-weight: 800;
}

.platform-choice span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.platform-choice strong {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  height: 24px;
  border-radius: 999px;
  background: #eef4ff;
  color: #234f9c;
  font-size: 12px;
}

.platform-choice.is-active {
  border-color: var(--blue);
  background: #eaf2ff;
  color: var(--blue-dark);
  box-shadow: 0 8px 18px rgba(47, 102, 200, 0.14);
}

.platform-choice.is-project:not(.is-active) {
  border-color: #8ccabb;
  background: #f0fdfa;
}

.product-library {
  display: grid;
  gap: 8px;
}

.product-card {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  gap: 10px;
  padding: 10px 10px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.product-card:hover {
  border-color: #b8c9e6;
  box-shadow: 0 8px 20px rgba(31, 41, 55, 0.08);
  transform: translateY(-1px);
}

.product-thumb,
.quote-thumb,
.image-preview {
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(47, 102, 200, 0.08), rgba(28, 124, 103, 0.08)),
    #f8fbff;
  color: #7a8ba6;
  border: 1px dashed #b9c7dd;
}

.product-thumb {
  width: 70px;
  height: 70px;
  border-radius: 6px;
  font-size: 12px;
  text-align: center;
}

.product-thumb img,
.quote-thumb img,
.image-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center center;
  display: block;
  background: #fff;
}

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

.product-info strong,
.product-info span,
.product-info small {
  display: block;
}

.product-info strong {
  font-size: 14px;
  line-height: 1.35;
}

.product-info span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.product-info small {
  margin-top: 6px;
  color: var(--green);
  font-weight: 700;
}

.product-actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.product-actions button {
  min-height: 32px;
  border: 1px solid #c9d6ea;
  border-radius: 6px;
  background: #f8fbff;
}

.product-actions button:hover {
  border-color: var(--blue);
  color: var(--blue-dark);
}

.quote-panel {
  overflow: hidden;
}

.quote-heading {
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.section-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: #fbfdff;
}

.section-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  border: 1px solid #c9d6ea;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 0 10px;
}

.section-tab strong {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  border-radius: 999px;
  background: #edf3ff;
  color: var(--blue-dark);
  font-size: 12px;
}

.section-tab.is-active {
  border-color: var(--blue);
  background: #eef4ff;
  color: var(--blue-dark);
  font-weight: 700;
}

.table-wrap {
  overflow: auto;
}

.quote-table {
  width: 100%;
  min-width: 1020px;
  border-collapse: collapse;
  background: white;
  table-layout: fixed;
}

.quote-table .col-category { width: 76px; }
.quote-table .col-brand { width: 70px; }
.quote-table .col-name { width: 128px; }
.quote-table .col-image { width: 118px; }
.quote-table .col-specs { width: 190px; }
.quote-table .col-quantity { width: 58px; }
.quote-table .col-unit { width: 54px; }
.quote-table .col-price { width: 72px; }
.quote-table .col-color { width: 62px; }
.quote-table .col-subtotal { width: 80px; }
.quote-table .col-actions { width: 108px; }

.quote-table th {
  height: 42px;
  background: var(--blue);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.quote-table th,
.quote-table td {
  border: 1px solid var(--line);
  padding: 8px;
  text-align: center;
  vertical-align: middle;
}

.quote-table td {
  min-height: 74px;
  font-size: 13px;
}

.quote-table input,
.quote-table select,
.quote-table textarea {
  min-width: 70px;
  border-color: transparent;
  background: transparent;
  text-align: center;
  padding: 7px;
}

.quote-table textarea {
  min-width: 0;
  width: 100%;
  text-align: left;
}

.quote-table input:focus,
.quote-table select:focus,
.quote-table textarea:focus {
  background: #fff;
  border-color: var(--blue);
}

.quote-thumb {
  width: 118px;
  height: 86px;
  margin: 0 auto;
  border-radius: 4px;
  font-size: 12px;
}

.print-value {
  display: none;
}

.section-row td {
  background: #fbfdff;
  height: 64px;
  font-weight: 700;
  color: #4b5563;
}

.section-row.active-section td {
  background: #eef4ff;
}

.row-actions {
  display: flex;
  gap: 6px;
  justify-content: center;
}

.row-actions button {
  width: 30px;
  height: 30px;
  border: 1px solid #c9d6ea;
  border-radius: 6px;
  background: #fff;
}

.summary-bar {
  padding: 14px 16px;
  border-top: 1px solid var(--line);
  background: #fbfdff;
  justify-content: flex-end;
}

.summary-bar div {
  display: grid;
  gap: 4px;
  min-width: 120px;
  text-align: right;
}

.summary-bar span {
  color: var(--muted);
  font-size: 12px;
}

.summary-bar strong {
  font-size: 20px;
}

.architecture-panel {
  border-top: 1px solid var(--line);
  background: #f7f9fc;
  padding: 16px;
}

.architecture-panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.architecture-diagram {
  display: grid;
  gap: 14px;
}

.architecture-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  padding: 16px;
  border: 1px solid #d5dfef;
  border-radius: 8px;
  background: #fff;
}

.architecture-header h2 {
  margin-bottom: 6px;
  font-size: 22px;
}

.architecture-header p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.architecture-meta {
  display: grid;
  gap: 6px;
  min-width: 220px;
  color: #344054;
  font-size: 13px;
  text-align: right;
}

.architecture-platforms {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid #d5dfef;
  border-radius: 8px;
  background: #fff;
}

.architecture-platforms div {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.architecture-platforms span,
.architecture-pill,
.architecture-room {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  border: 1px solid #cbd7ea;
  border-radius: 999px;
  background: #fff;
  padding: 0 10px;
  color: #344054;
  font-size: 12px;
}

.architecture-platforms span {
  border-color: #a9c0e8;
  background: #eef5ff;
  color: #234f9c;
  font-weight: 700;
}

.architecture-flow {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.architecture-node {
  position: relative;
  min-height: 230px;
  display: grid;
  grid-template-rows: auto auto auto 1fr auto;
  gap: 10px;
  border: 1px solid #d5dfef;
  border-top: 5px solid var(--node-color, var(--blue));
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.architecture-node:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 40px;
  right: -12px;
  width: 12px;
  height: 2px;
  background: #9eb3d0;
}

.architecture-node:not(:last-child)::before {
  content: "";
  position: absolute;
  top: 35px;
  right: -14px;
  border-left: 7px solid #9eb3d0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
}

.architecture-node-entry { --node-color: #2f66c8; }
.architecture-node-network { --node-color: #1c7c67; }
.architecture-node-control { --node-color: #b7791f; }
.architecture-node-device { --node-color: #7c3aed; }
.architecture-node-security { --node-color: #c2413a; }

.architecture-node-index {
  width: 34px;
  height: 26px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: color-mix(in srgb, var(--node-color) 14%, white);
  color: var(--node-color);
  font-size: 12px;
  font-weight: 800;
}

.architecture-node h3 {
  margin: 0;
  font-size: 16px;
  color: #1f2937;
}

.architecture-node p {
  margin: 0;
  color: #667085;
  font-size: 12px;
  line-height: 1.55;
}

.architecture-node > strong {
  color: var(--node-color);
  font-size: 16px;
}

.architecture-pills,
.architecture-room-list {
  display: flex;
  align-content: flex-start;
  flex-wrap: wrap;
  gap: 8px;
}

.architecture-pill strong,
.architecture-room strong {
  color: var(--blue-dark);
}

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

.architecture-bottom {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  gap: 12px;
}

.architecture-bottom > div,
.architecture-empty {
  border: 1px solid #d5dfef;
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.architecture-bottom h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.architecture-bottom ul {
  margin: 0;
  padding-left: 18px;
  color: #344054;
  line-height: 1.8;
}

.architecture-empty {
  color: #667085;
  text-align: center;
}

dialog {
  width: min(720px, calc(100% - 24px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  box-shadow: 0 18px 70px rgba(31, 41, 55, 0.2);
}

dialog::backdrop {
  background: rgba(15, 23, 42, 0.42);
}

.dialog-form {
  padding: 18px;
}

.dialog-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

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

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

.image-preview {
  width: 160px;
  height: 120px;
  margin-top: 14px;
  border-radius: 6px;
}

.form-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.dialog-actions {
  justify-content: space-between;
  margin-top: 16px;
}

.empty-state {
  padding: 32px;
  color: var(--muted);
  text-align: center;
}

.catalog-shell {
  width: min(1500px, calc(100% - 32px));
}

.catalog-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.catalog-summary div,
.catalog-filter-panel,
.catalog-main-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.catalog-summary div {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
}

.catalog-summary span {
  color: var(--muted);
  font-size: 12px;
}

.catalog-summary strong {
  font-size: 22px;
}

.catalog-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.catalog-filter-panel {
  position: sticky;
  top: 16px;
  padding: 16px;
}

.catalog-filter-stack {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.catalog-filter-stack label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.catalog-check {
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  color: var(--ink) !important;
}

.catalog-check input {
  width: 18px;
  height: 18px;
}

.catalog-main-panel {
  min-width: 0;
  overflow: hidden;
}

.catalog-list-heading {
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.catalog-view-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid #dbe6f5;
  border-radius: 8px;
  background: #f8fbff;
}

.catalog-view-toggle button {
  min-height: 32px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0 12px;
  background: transparent;
  color: #475569;
  font-weight: 800;
  cursor: pointer;
}

.catalog-view-toggle button.active {
  border-color: #c9d6ea;
  background: #fff;
  color: #234f9c;
  box-shadow: 0 8px 18px rgba(31, 41, 55, 0.08);
}

.catalog-grid {
  display: grid;
  gap: 16px;
  padding: 16px;
}

.catalog-category-section {
  min-width: 0;
  display: grid;
  gap: 10px;
}

.catalog-category-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 2px;
}

.catalog-category-heading h3 {
  margin: 0;
  color: #111827;
  font-size: 18px;
}

.catalog-category-heading span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.catalog-category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(205px, 1fr));
  gap: 9px;
}

.catalog-card {
  position: relative;
  display: grid;
  grid-template-rows: 154px minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.catalog-card:hover {
  border-color: #b8c9e6;
  box-shadow: 0 10px 26px rgba(31, 41, 55, 0.1);
  transform: translateY(-1px);
}

.catalog-card-thumb {
  display: grid;
  place-items: center;
  position: relative;
  min-width: 0;
  height: 154px;
  padding: 8px 10px 10px;
  background:
    linear-gradient(135deg, rgba(47, 102, 200, 0.08), rgba(28, 124, 103, 0.08)),
    #f8fbff;
  border-bottom: 1px solid var(--line);
  color: #7a8ba6;
  text-align: center;
}

button.catalog-card-thumb {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  cursor: zoom-in;
  font: inherit;
}

.catalog-image-button:hover img {
  transform: scale(1.015);
}

.catalog-card-thumb img {
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  padding: 0;
  object-fit: contain;
  object-position: center center;
  display: block;
  background: #fff;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  transition: transform 0.16s ease;
}

.catalog-zoom-hint {
  position: absolute;
  right: 10px;
  bottom: 10px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.68);
  color: #fff;
  font-size: 12px;
  line-height: 1;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.16s ease, transform 0.16s ease;
  pointer-events: none;
}

.catalog-image-button:hover .catalog-zoom-hint,
.catalog-image-button:focus-visible .catalog-zoom-hint {
  opacity: 1;
  transform: translateY(0);
}

.catalog-img-fallback {
  display: none;
  padding: 0 12px;
}

.catalog-card-body {
  display: grid;
  gap: 7px;
  position: relative;
  z-index: 1;
  padding: 10px;
  background: #fff;
}

.catalog-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.catalog-card-top h3 {
  margin: 5px 0 0;
  font-size: 14px;
  line-height: 1.35;
}

.catalog-card-top strong {
  flex: 0 0 auto;
  color: var(--green);
  font-size: 15px;
}

.catalog-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.catalog-tags span {
  padding: 2px 6px;
  border-radius: 999px;
  background: #eef4ff;
  color: #2456a6;
  font-size: 11px;
}

.catalog-card-body p {
  min-height: 34px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.catalog-meta-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

.catalog-meta-line a {
  color: var(--blue-dark);
  text-decoration: none;
}

.catalog-card-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  display: inline-flex;
  gap: 5px;
}

.catalog-action-button {
  width: 28px;
  height: 28px;
  min-height: 0;
  border: 1px solid #c9d6ea;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: #334155;
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.12);
  cursor: pointer;
}

.catalog-action-button:hover {
  border-color: var(--blue);
  color: var(--blue-dark);
}

.catalog-action-button.approve {
  color: #0f766e;
}

.catalog-action-button.reject,
.catalog-action-button.danger {
  color: var(--red);
}

.catalog-status-badge {
  background: #fff7ed !important;
  color: #b45309 !important;
}

.catalog-status-badge.muted {
  background: #f1f5f9 !important;
  color: #64748b !important;
}

.catalog-grid[data-view-mode="large"] .catalog-category-grid {
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 12px;
}

.catalog-grid[data-view-mode="large"] .catalog-card {
  grid-template-rows: 192px minmax(0, 1fr);
}

.catalog-grid[data-view-mode="large"] .catalog-card-thumb {
  height: 192px;
  padding: 12px 14px 16px;
}

.catalog-grid[data-view-mode="large"] .catalog-card-body {
  gap: 10px;
  padding: 15px 14px 14px;
}

.catalog-grid[data-view-mode="large"] .catalog-card-top h3 {
  margin-top: 8px;
  font-size: 17px;
}

.catalog-grid[data-view-mode="large"] .catalog-card-top strong {
  font-size: 19px;
}

.catalog-grid[data-view-mode="large"] .catalog-tags span {
  padding: 3px 8px;
  font-size: 12px;
}

.catalog-grid[data-view-mode="large"] .catalog-card-body p {
  min-height: 42px;
  font-size: 13px;
  line-height: 1.55;
  -webkit-line-clamp: 3;
}

.catalog-grid[data-view-mode="large"] .catalog-action-button {
  width: 30px;
  height: 30px;
}

.image-preview-dialog {
  width: min(94vw, 980px);
  max-width: 94vw;
  height: min(90vh, 760px);
  max-height: 90vh;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
}

.image-preview-dialog::backdrop {
  background: rgba(15, 23, 42, 0.62);
  backdrop-filter: blur(3px);
}

.image-preview-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100%;
  overflow: hidden;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 26px 60px rgba(15, 23, 42, 0.28);
}

.image-preview-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.image-preview-heading span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.image-preview-heading strong {
  display: block;
  margin-top: 3px;
  color: var(--text);
  font-size: 17px;
}

.image-preview-stage {
  display: grid;
  place-items: center;
  min-height: 0;
  padding: 18px;
  overflow: auto;
  background:
    linear-gradient(45deg, #f8fafc 25%, transparent 25%),
    linear-gradient(-45deg, #f8fafc 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #f8fafc 75%),
    linear-gradient(-45deg, transparent 75%, #f8fafc 75%),
    #fff;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-size: 16px 16px;
}

.image-preview-stage img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.catalog-empty {
  grid-column: 1 / -1;
  padding: 52px 20px;
  border: 1px dashed #b9c7dd;
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 980px) {
  .workspace,
  .quote-meta,
  .catalog-layout,
  .catalog-summary,
  .platform-priority-panel,
  .architecture-flow,
  .architecture-bottom {
    grid-template-columns: 1fr;
    display: grid;
  }

  .library-panel,
  .catalog-filter-panel {
    position: static;
    max-height: none;
  }

  .architecture-node {
    min-height: auto;
  }

  .architecture-node::before,
  .architecture-node::after {
    display: none;
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: min(100% - 20px, 1480px);
    padding: 14px 0;
  }

  .topbar,
  .panel-heading,
  .summary-bar,
  .architecture-panel-heading,
  .architecture-header,
  .architecture-platforms {
    align-items: stretch;
    flex-direction: column;
  }

  .architecture-meta {
    min-width: 0;
    text-align: left;
  }

  .architecture-platforms div {
    justify-content: flex-start;
  }

  .topbar-actions,
  .quote-tools {
    width: 100%;
  }

  .topbar-actions > *,
  .quote-tools > * {
    flex: 1;
  }

  .compact-select,
  .compact-input {
    min-width: 0;
    width: 100%;
  }

  .catalog-grid {
    padding: 10px;
  }

  .catalog-category-grid,
  .catalog-grid[data-view-mode="large"] .catalog-category-grid {
    grid-template-columns: 1fr;
  }

  .catalog-grid[data-view-mode="large"] .catalog-card {
    grid-template-rows: 156px minmax(0, 1fr);
  }

  .catalog-grid[data-view-mode="large"] .catalog-card-thumb {
    height: 156px;
    padding: 10px 12px 14px;
  }

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

@media print {
  @page {
    size: A4 landscape;
    margin: 10mm;
  }

  * {
    box-shadow: none !important;
  }

  html,
  body {
    background: white;
    color: #111827;
    font-size: 10px;
  }

  .app-shell {
    width: 100%;
    padding: 0;
  }

  .topbar {
    margin: 0 0 8px;
    padding: 0 0 8px;
    border: 0;
    border-bottom: 2px solid #244f8f;
    border-radius: 0;
    box-shadow: none;
  }

  .topbar h1 {
    font-size: 22px;
  }

  .topbar .eyebrow {
    color: #244f8f;
  }

  .library-panel,
  .topbar-actions,
  .quote-tools,
  .active-target,
  .section-tabs,
  .screen-only,
  dialog {
    display: none !important;
  }

  .combined-print-plan {
    display: none !important;
  }

  body.combined-printing .combined-print-plan {
    display: block !important;
    break-after: page;
    page-break-after: always;
  }

  body.architecture-printing .app-shell {
    display: none !important;
  }

  body.architecture-printing .combined-print-plan {
    display: block !important;
  }

  body.architecture-printing .architecture-diagram {
    height: 190mm;
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    gap: 4mm;
    color: #111827;
  }

  body.architecture-printing .architecture-header,
  body.architecture-printing .architecture-platforms,
  body.architecture-printing .architecture-node,
  body.architecture-printing .architecture-bottom > div,
  body.architecture-printing .architecture-empty {
    border-color: #9fb0c7;
    border-radius: 0;
    background: #fff;
  }

  body.architecture-printing .architecture-header {
    padding: 4mm 0;
    border-width: 0 0 2px;
    border-color: #244f8f;
  }

  body.architecture-printing .architecture-header h2 {
    font-size: 22px;
  }

  body.architecture-printing .architecture-header p,
  body.architecture-printing .architecture-node p,
  body.architecture-printing .architecture-bottom,
  body.architecture-printing .architecture-meta {
    font-size: 9px;
  }

  body.architecture-printing .architecture-platforms {
    padding: 2.8mm 3.5mm;
  }

  body.architecture-printing .architecture-flow {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 3mm;
  }

  body.architecture-printing .architecture-node {
    min-height: 0;
    padding: 3mm;
    gap: 2mm;
    border-top-width: 1.6mm;
  }

  body.architecture-printing .architecture-node h3 {
    font-size: 12px;
  }

  body.architecture-printing .architecture-node > strong {
    font-size: 12px;
  }

  body.architecture-printing .architecture-pill,
  body.architecture-printing .architecture-room,
  body.architecture-printing .architecture-platforms span {
    min-height: 0;
    padding: 1mm 2mm;
    border-radius: 999px;
    font-size: 8px;
  }

  body.architecture-printing .architecture-bottom {
    grid-template-columns: 0.95fr 1.05fr;
    gap: 3mm;
  }

  body.architecture-printing .architecture-bottom > div,
  body.architecture-printing .architecture-empty {
    padding: 3mm;
  }

  body.architecture-printing .architecture-bottom h3 {
    margin-bottom: 2mm;
    font-size: 11px;
  }

  body.architecture-printing .architecture-bottom ul {
    line-height: 1.55;
  }

  .combined-plan-sheet {
    height: 190mm;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 5mm;
    color: #111827;
  }

  .combined-plan-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10mm;
    padding-bottom: 4mm;
    border-bottom: 2px solid #244f8f;
  }

  .combined-brand {
    display: flex;
    align-items: center;
    gap: 4mm;
  }

  .combined-brand img {
    width: 18mm;
    height: 18mm;
    object-fit: contain;
  }

  .combined-brand p {
    margin: 0 0 1mm;
    color: #244f8f;
    font-size: 9px;
    font-weight: 800;
  }

  .combined-brand h2 {
    margin: 0;
    font-size: 22px;
    color: #111827;
  }

  .combined-plan-meta {
    display: grid;
    grid-template-columns: repeat(2, auto);
    gap: 2mm 8mm;
    color: #334155;
    font-size: 10px;
    text-align: right;
  }

  .combined-plan-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 52mm;
    gap: 5mm;
    min-height: 0;
  }

  .combined-plan-figure {
    margin: 0;
    min-height: 0;
    border: 1px solid #9fb0c7;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .combined-plan-figure img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
  }

  .combined-plan-side {
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 4mm;
    min-height: 0;
  }

  .combined-plan-side section {
    border: 1px solid #9fb0c7;
    background: #f8fbff;
    padding: 3mm;
    min-height: 0;
  }

  .combined-plan-side h3 {
    margin: 0 0 2mm;
    color: #183b6b;
    font-size: 11px;
  }

  .combined-legend-list {
    display: grid;
    gap: 1.8mm;
  }

  .combined-legend-item {
    display: grid;
    grid-template-columns: 8mm minmax(0, 1fr) auto;
    align-items: center;
    gap: 2mm;
    padding-bottom: 1.4mm;
    border-bottom: 1px solid #d4dfef;
    font-size: 9px;
  }

  .combined-legend-item strong {
    color: var(--legend-color);
    font-size: 10px;
  }

  .combined-legend-icon {
    width: 8mm;
    height: 8mm;
    border: 1px solid var(--legend-color);
    border-radius: 999px;
    background: #fff;
    display: grid;
    place-items: center;
  }

  .combined-legend-icon img {
    width: 6mm;
    height: 6mm;
    object-fit: contain;
  }

  .combined-room-list {
    display: flex;
    flex-wrap: wrap;
    gap: 1.6mm;
  }

  .combined-room-pill {
    display: inline-flex;
    align-items: center;
    gap: 2mm;
    padding: 1.4mm 2mm;
    border: 1px solid #c8d6ea;
    background: #fff;
    color: #334155;
    font-size: 9px;
  }

  .combined-room-pill strong {
    color: #244f8f;
  }

  .combined-empty {
    margin: 0;
    color: #64748b;
    font-size: 9px;
  }

  .quote-heading {
    display: none;
  }

  .workspace {
    display: block;
  }

  .quote-meta,
  .quote-panel {
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .quote-meta {
    display: grid;
    grid-template-columns: 1.2fr 1fr 0.8fr;
    gap: 8px;
    padding: 8px 10px;
    margin-bottom: 8px;
    border: 1px solid #9fb0c7;
    background: #f8fbff;
  }

  .quote-meta label {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: end;
    gap: 6px;
    font-size: 10px;
    color: #334155;
  }

  .quote-meta label span {
    font-weight: 700;
  }

  .quote-meta input {
    height: auto;
    min-height: 0;
    border: 0;
    border-bottom: 1px solid #9fb0c7;
    border-radius: 0;
    background: transparent;
    padding: 0 0 1px;
    color: #111827;
    box-shadow: none;
  }

  .table-wrap {
    overflow: visible;
  }

  .quote-table {
    min-width: 0;
    width: 100%;
    table-layout: fixed;
    font-size: 9px;
    page-break-inside: auto;
  }

  .quote-table .col-category { width: 9%; }
  .quote-table .col-brand { width: 7%; }
  .quote-table .col-name { width: 14%; }
  .quote-table .col-image { width: 10%; }
  .quote-table .col-specs { width: 27%; }
  .quote-table .col-quantity { width: 5%; }
  .quote-table .col-unit { width: 5%; }
  .quote-table .col-price { width: 7%; }
  .quote-table .col-color { width: 6%; }
  .quote-table .col-subtotal { width: 10%; }

  .quote-table tr {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .quote-table th {
    height: 26px;
    background: #dbe7fb !important;
    color: #183b6b;
    font-size: 9.5px;
  }

  .quote-table th,
  .quote-table td {
    border-color: #9fb0c7;
    padding: 4px;
  }

  .quote-table td {
    min-height: 0;
    font-size: 9px;
  }

  .screen-control {
    display: none !important;
  }

  .print-value {
    display: block;
    line-height: 1.35;
    color: #111827;
    word-break: break-word;
  }

  .print-value-multiline {
    text-align: left;
    white-space: pre-wrap;
  }

  .quote-thumb {
    width: 68px;
    height: 48px;
    border: 0;
    background: #fff;
  }

  .quote-thumb img {
    object-fit: contain;
  }

  .section-row td,
  .section-row.active-section td {
    height: 26px;
    background: #eef4ff !important;
    color: #183b6b;
    font-size: 10.5px;
    text-align: center;
  }

  .summary-bar {
    display: flex;
    justify-content: flex-end;
    gap: 18px;
    margin-top: 8px;
    padding: 8px 10px;
    border: 1px solid #9fb0c7;
    border-radius: 0;
    background: #f8fbff;
  }

  .summary-bar div {
    min-width: 100px;
  }

  .summary-bar span {
    display: block;
    color: #475569;
    font-size: 9px;
  }

  .summary-bar strong {
    font-size: 15px;
  }

input,
select,
textarea {
  box-shadow: none !important;
  padding: 0;
}
}

/* Stitch-inspired product library workbench. */
.catalog-workbench-page {
  background: #f7f9fb;
}

.catalog-workbench-page .catalog-shell {
  width: min(1640px, calc(100% - 32px));
  padding-top: 18px;
}

.catalog-workbench-page .topbar {
  margin-bottom: 16px;
  border-color: #e2e8f0;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: none;
}

.catalog-workbench-page .app-brand h1 {
  color: #191c1e;
  font-size: 30px;
  line-height: 1.2;
}

.catalog-workbench-page .app-brand p:not(.eyebrow) {
  color: #5b6472;
}

.catalog-header-actions {
  background: transparent;
  border: 0;
  padding: 0;
}

.catalog-header-actions .nav-button,
.catalog-header-actions .file-button {
  min-height: 38px;
  border-radius: 6px;
  box-shadow: none;
}

.catalog-header-actions .nav-primary {
  border-color: #004ac6;
  background: #004ac6;
}

.catalog-summary {
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.catalog-summary div {
  min-height: 88px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: none;
}

.catalog-summary div:last-child {
  border-left: 4px solid #ba1a1a;
}

.catalog-summary span {
  color: #64748b;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.catalog-summary strong {
  color: #191c1e;
  font-size: 25px;
}

.catalog-summary div:last-child strong {
  color: #ba1a1a;
}

.catalog-platform-priority {
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 20px;
  margin-bottom: 16px;
  padding: 16px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: none;
}

.platform-priority-copy {
  display: grid;
  gap: 4px;
}

.platform-priority-copy h2,
.platform-priority-copy p {
  margin: 0;
}

.platform-priority-copy h2 {
  color: #191c1e;
  font-size: 20px;
}

.platform-priority-copy p {
  color: #64748b;
  font-size: 12px;
  line-height: 1.6;
}

.catalog-workbench-page .platform-choice-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.catalog-workbench-page .platform-choice {
  min-height: 34px;
  gap: 8px;
  padding: 0 12px;
  border-color: #cbd5e1;
  border-radius: 999px;
  background: #ffffff;
  color: #475569;
  font-size: 13px;
  box-shadow: none;
}

.catalog-workbench-page .platform-choice strong {
  min-width: 22px;
  height: 20px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #64748b;
  font-size: 11px;
}

.catalog-workbench-page .platform-choice.is-active {
  border-color: #191c1e;
  background: #191c1e;
  color: #ffffff;
  box-shadow: none;
}

.catalog-workbench-page .platform-choice.is-active strong {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
}

.catalog-workbench-page .platform-choice.is-project:not(.is-active) {
  border-color: #10b981;
  background: #ecfdf5;
  color: #047857;
}

.catalog-layout {
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 16px;
}

.catalog-filter-panel,
.catalog-main-panel {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: none;
}

.catalog-filter-panel {
  top: 18px;
  padding: 18px;
}

.catalog-filter-panel .panel-heading h2,
.catalog-list-heading h2 {
  color: #191c1e;
  font-size: 20px;
}

.catalog-filter-stack {
  gap: 14px;
}

.catalog-filter-stack label {
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
}

.catalog-filter-stack input,
.catalog-filter-stack select {
  min-height: 38px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #f8fafc;
}

.catalog-filter-stack input:focus,
.catalog-filter-stack select:focus {
  outline: 2px solid rgba(37, 99, 235, 0.12);
  border-color: #2563eb;
}

.catalog-check {
  min-height: 42px;
  padding-top: 12px;
  border-top: 1px solid #e2e8f0;
}

.catalog-workbench-page .filter-clear {
  min-height: 36px;
  border-radius: 6px;
}

.catalog-list-heading {
  padding: 16px 18px;
  border-bottom: 1px solid #e2e8f0;
}

.catalog-view-toggle {
  gap: 0;
  padding: 3px;
  border-color: #cbd5e1;
  border-radius: 6px;
  background: #f1f5f9;
}

.catalog-view-toggle button {
  min-height: 30px;
  border-radius: 4px;
  color: #64748b;
  font-size: 12px;
}

.catalog-view-toggle button.active {
  border-color: #e2e8f0;
  color: #004ac6;
  background: #ffffff;
  box-shadow: none;
}

.catalog-grid {
  gap: 18px;
  padding: 18px;
}

.catalog-category-section {
  gap: 12px;
}

.catalog-category-heading {
  min-height: 34px;
  padding: 0 0 8px;
  border-bottom: 1px solid #e2e8f0;
}

.catalog-category-heading h3 {
  color: #191c1e;
  font-size: 19px;
}

.catalog-category-heading span {
  color: #64748b;
  font-size: 13px;
}

.catalog-category-grid {
  grid-template-columns: repeat(auto-fill, minmax(224px, 1fr));
  gap: 12px;
}

.catalog-card {
  grid-template-rows: 146px minmax(0, 1fr);
  border-color: #e2e8f0;
  border-radius: 10px;
  box-shadow: none;
}

.catalog-card:hover {
  border-color: #b4c5ff;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
  transform: translateY(-1px);
}

.catalog-card-thumb {
  height: 146px;
  padding: 12px;
  border-bottom-color: #e2e8f0;
  background: #f8fafc;
}

.catalog-card-thumb img {
  object-fit: contain;
  background: transparent;
}

.catalog-card-actions {
  top: 10px;
  right: 10px;
  gap: 4px;
}

.catalog-action-button {
  width: 28px;
  height: 28px;
  border-color: #dbe3ef;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

.catalog-card-body {
  gap: 8px;
  padding: 12px;
}

.catalog-tags span {
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  background: #f8fafc;
  color: #475569;
}

.catalog-tags span:nth-child(3),
.catalog-tags span:nth-child(4),
.catalog-tags span:nth-child(5) {
  border-color: #dbe1ff;
  background: #eef2ff;
  color: #003ea8;
}

.catalog-card-top h3 {
  color: #191c1e;
  font-size: 15px;
}

.catalog-card-top strong {
  color: #006242;
}

.catalog-meta-line {
  padding-top: 4px;
  border-top: 1px solid #f1f5f9;
}

.catalog-grid[data-view-mode="large"] .catalog-category-grid {
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}

.catalog-grid[data-view-mode="large"] .catalog-card {
  grid-template-rows: 204px minmax(0, 1fr);
}

.catalog-grid[data-view-mode="large"] .catalog-card-thumb {
  height: 204px;
}

@media (max-width: 1180px) {
  .catalog-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .catalog-platform-priority,
  .catalog-layout {
    grid-template-columns: 1fr;
  }

  .catalog-filter-panel {
    position: static;
  }
}

@media (max-width: 760px) {
  .catalog-category-grid,
  .catalog-grid[data-view-mode="large"] .catalog-category-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .catalog-category-heading,
  .catalog-card,
  .catalog-card-body,
  .catalog-card-top,
  .catalog-tags,
  .catalog-meta-line {
    min-width: 0;
  }
}

/* Product library filter sidebar size tuning. */
.catalog-workbench-page .catalog-layout {
  grid-template-columns: 420px minmax(0, 1fr);
}

.catalog-workbench-page .catalog-filter-panel {
  padding: 26px;
}

.catalog-workbench-page .catalog-filter-stack {
  gap: 18px;
}

.catalog-workbench-page .catalog-filter-stack input,
.catalog-workbench-page .catalog-filter-stack select {
  min-height: 46px;
  padding-inline: 15px;
  font-size: 15px;
}

.catalog-workbench-page .price-filter {
  gap: 12px;
}

@media (max-width: 1180px) {
  .catalog-workbench-page .catalog-layout {
    grid-template-columns: 1fr;
  }
}
