:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #18202b;
  --muted: #667085;
  --line: #d9dee7;
  --primary: #1768ac;
  --primary-dark: #0e4f86;
  --soft: #eef5fb;
  --danger: #b42318;
  --success: #027a48;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
}

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

button {
  border: 0;
  cursor: pointer;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 28px;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 6px;
  font-size: 24px;
}

h2 {
  margin-bottom: 4px;
  font-size: 18px;
}

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

.subhead,
.section-title p,
.basket-head p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.top-actions,
.export-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.user-badge {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--primary-dark);
  font-size: 13px;
  font-weight: 700;
}

.hidden {
  display: none !important;
}

.auth-locked {
  overflow: hidden;
}

.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(246, 247, 249, 0.94);
}

.login-card {
  width: min(380px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 18px 50px rgba(24, 32, 43, 0.14);
}

.login-card h2 {
  margin-bottom: 18px;
}

.login-card label {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
  color: var(--muted);
  font-weight: 700;
}

.login-card input {
  width: 100%;
}

.login-card .primary {
  width: 100%;
  margin-top: 4px;
}

.login-message {
  min-height: 20px;
  margin: 12px 0 0;
  color: var(--danger);
  font-size: 13px;
}

.layout {
  display: grid;
  gap: 14px;
  padding: 16px 28px 28px;
}

.workspace-tabs {
  display: flex;
  align-items: flex-end;
  gap: 0;
  margin-bottom: -15px;
  position: relative;
  z-index: 2;
}

.workspace-tab {
  min-height: 44px;
  padding: 0 22px;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: #e9eef2;
  color: var(--text);
  font-weight: 800;
}

.workspace-tab.active {
  background: #d92d20;
  color: #fff;
}

body[data-workspace="standard"] .custom-pool {
  display: none;
}

body[data-workspace="custom"] .intake,
body[data-workspace="custom"] .filters,
body[data-workspace="custom"] #products {
  display: none;
}

.panel,
.basket,
.product-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.basket {
  background: #fffaf0;
  border-color: #f4d398;
}

.basket.just-updated {
  border-color: #12b76a;
  box-shadow: 0 0 0 3px rgba(18, 183, 106, 0.18);
}

.panel {
  padding: 14px;
}

.intake {
  background: #fff8eb;
  border-color: #f6d9a7;
}

.filters {
  background: #eef7ff;
  border-color: #b9d8f2;
}

.custom-pool {
  background: #fff;
  border-color: #f1b8b2;
}

.section-title,
.basket-head,
.card-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.intake.collapsed > :not(.section-title) {
  display: none;
}

.intake .section-title {
  align-items: center;
}

.tabs {
  display: flex;
  gap: 8px;
  margin: 12px 0;
}

.tab {
  padding: 7px 12px;
  background: #edf0f4;
  color: var(--text);
  border-radius: 6px;
}

.tab.active {
  background: var(--primary);
  color: #fff;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.form-grid,
.filter-grid,
.custom-pool-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 10px;
  align-items: start;
}

.custom-pool {
  display: grid;
  gap: 12px;
}

.custom-library-tile,
.custom-secondary-group {
  content-visibility: auto;
  contain: layout paint style;
  contain-intrinsic-size: auto 280px;
}

.custom-project-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff3f1;
  border-color: #f1b8b2;
}

.custom-project-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.custom-project-title h3,
.custom-project-title p {
  margin: 0;
}

.custom-project-title p {
  color: var(--muted);
  font-size: 13px;
}

.custom-project-title h3 {
  color: #b42318;
  font-size: 20px;
  font-weight: 900;
}

#customProjectStatus {
  color: #b42318;
  font-size: 15px;
  font-weight: 800;
}

.custom-current-layout {
  --current-work-height: clamp(560px, calc(100vh - 140px), 760px);
  display: grid;
  grid-template-columns: minmax(320px, 0.92fr) minmax(0, 1.08fr);
  gap: 12px;
  align-items: stretch;
  height: var(--current-work-height);
}

.custom-current-left {
  display: grid;
  gap: 12px;
  min-width: 0;
  min-height: 0;
}

.custom-current-left .custom-pool-form.custom-tab-panel.active {
  grid-template-columns: 1fr;
}

.custom-current-left .custom-pool-form .custom-image-field {
  grid-column: auto;
}

.custom-current-left .custom-fields-grid {
  grid-template-columns: repeat(2, minmax(150px, 1fr));
}

.custom-current-left .custom-pool-form .custom-image-field .image-drop-zone,
.custom-current-left .custom-pool-form .custom-image-field .detail-preview {
  min-height: 220px;
}

.current-project-products {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  height: 100%;
  min-height: 0;
  padding: 12px;
  border: 1px solid #f1b8b2;
  border-radius: 8px;
  background: #fff8f7;
}

.current-project-products.just-updated {
  border-color: #12b76a;
  box-shadow: 0 0 0 3px rgba(18, 183, 106, 0.18);
}

.current-project-products .custom-project-product-list {
  display: grid;
  grid-auto-rows: max-content;
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
  align-content: start;
  align-items: start;
}

.current-project-products .custom-project-product-row {
  grid-template-columns: 82px minmax(0, 1fr) auto;
  grid-template-rows: 82px;
  align-items: center;
  min-height: 104px;
  padding: 8px 10px;
}

.current-project-products .project-product-thumb {
  grid-row: 1;
  width: 76px;
  height: 76px;
}

.current-project-products .project-product-main {
  grid-row: 1;
  padding-top: 0;
}

.current-project-products .project-product-actions {
  grid-column: 3;
  grid-row: 1;
  align-self: end;
  justify-content: flex-end;
  max-width: none;
}

.current-project-category {
  display: grid;
  grid-template-rows: max-content auto;
  gap: 8px;
  align-self: start;
  min-height: 0;
}

.current-project-category.collapsed {
  height: 36px;
  max-height: 36px;
  overflow: hidden;
}

.current-project-category-head {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  text-align: left;
}

.current-project-category-head strong {
  font-size: 14px;
}

.current-project-category-head span:last-child {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
}

.current-project-category-list {
  display: grid;
  gap: 8px;
}

.current-project-category.collapsed .current-project-category-list {
  display: none;
}

.current-project-products h3 {
  color: #b42318;
  font-size: 17px;
  font-weight: 900;
}

.current-project-products .ghost:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.custom-intake-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid #f6d9a7;
  border-radius: 8px;
  background: #fff8eb;
}

.custom-intake-head h3 {
  margin: 0 0 4px;
  color: #92400e;
  font-size: 17px;
  font-weight: 900;
}

.custom-intake-head p {
  margin: 0;
  color: var(--muted);
}

.custom-project-workflow {
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(520px, 1.7fr);
  gap: 12px;
  align-items: stretch;
}

.project-zone {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.project-zone h4,
.project-zone p {
  margin: 0;
}

.project-zone h4 {
  color: #344054;
  font-size: 15px;
  font-weight: 900;
}

.project-zone p {
  color: var(--muted);
  font-size: 12px;
}

.project-existing-zone {
  border-color: #f1b8b2;
}

.project-create-zone {
  border-color: #8bd8f7;
}

.project-create-grid {
  display: grid;
  grid-template-columns: 96px minmax(120px, 1fr) minmax(120px, 1fr) 130px 96px;
  gap: 8px;
  align-items: end;
}

.project-zone label {
  display: grid;
  gap: 4px;
}

.project-zone input,
.project-zone select {
  min-height: 38px;
}

.project-id-select {
  display: none;
}

.project-name-picker {
  position: relative;
  display: block;
}

.project-name-picker input {
  width: 100%;
}

.project-name-options {
  position: absolute;
  z-index: 30;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 220px;
  overflow-y: auto;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(16, 24, 40, 0.14);
}

.project-name-option {
  display: block;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #18202b;
  text-align: left;
  cursor: pointer;
}

.project-name-option:hover,
.project-name-option:focus-visible {
  background: #eef5fb;
}

.project-create-grid .create-project-btn {
  min-height: 38px;
  padding: 0 10px;
  background: #fff;
  border: 1px solid #f1b8b2;
  color: #b42318;
  font-size: 12px;
  white-space: nowrap;
}

.custom-project-archive {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.custom-project-archive.hidden {
  display: none;
}

.custom-project-archive-list {
  display: grid;
  gap: 10px;
}

.custom-project-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.custom-project-card.active {
  border-color: #d92d20;
  box-shadow: 0 0 0 2px rgba(217, 45, 32, 0.08);
}

.custom-project-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.custom-project-card-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.custom-project-card-actions .primary,
.custom-project-card-actions .ghost {
  margin-top: 0;
  white-space: nowrap;
}

.custom-project-card h4 {
  margin: 0 0 4px;
  font-size: 16px;
}

.custom-project-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.custom-project-card-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.custom-project-product-list {
  display: grid;
  gap: 8px;
}

.custom-project-product-list.archive-project-category-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.custom-project-card.collapsed .custom-project-product-list {
  display: none;
}

.archive-project-category {
  display: grid;
  gap: 8px;
  align-content: start;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafc;
}

.archive-project-category.collapsed .archive-project-category-list {
  display: none;
}

.archive-project-category-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.archive-project-category-head strong {
  font-size: 15px;
}

.archive-project-category-head span {
  color: var(--muted);
  font-size: 12px;
}

.archive-project-category-toggle {
  margin-left: auto;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.archive-project-category-list {
  display: grid;
  gap: 8px;
}

.custom-project-product-row {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.project-product-thumb {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 6px;
  background: #eef2f6 center / cover no-repeat;
  color: #667085;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}

.project-product-main {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.project-product-title {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: nowrap;
  gap: 4px;
  min-width: 0;
}

.project-product-title strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1 1 auto;
}

.project-product-title span {
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
}

.project-brand-tag {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  background: #fde8e8;
  color: #c43225;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
  line-height: 1;
}

.project-scene-tag {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  background: #eef4ff;
  color: #175cd3;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
  line-height: 1;
  flex: 0 0 auto;
}

.project-product-spec {
  color: #667085;
  font-size: 12px;
  line-height: 1.45;
}

.project-product-price {
  grid-column: 3;
  grid-row: 1;
  align-self: start;
  justify-self: end;
  color: var(--primary);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.project-product-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: #667085;
  font-size: 11px;
}

.project-product-meta span {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-product-actions {
  grid-column: 2 / -1;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  max-width: 260px;
  justify-self: end;
}

.archive-project-product-row {
  grid-template-columns: 62px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  min-height: 0;
  padding: 8px 10px;
  background: #fff;
  cursor: pointer;
}

.archive-project-product-row .project-product-thumb {
  width: 62px;
  height: 62px;
  cursor: zoom-in;
}

.project-product-category {
  color: #475467;
  font-size: 14px;
  font-weight: 600;
}

.project-product-highlights {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.project-product-highlight {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  background: #eef4ff;
  color: #175cd3;
  font-size: 12px;
  font-weight: 600;
}

.project-product-side {
  display: grid;
  gap: 8px;
  justify-items: end;
  align-self: stretch;
}

.archive-project-product-row .project-product-main {
  gap: 7px;
  padding-top: 0;
}

.archive-project-product-row .project-product-title strong {
  font-size: 17px;
  white-space: normal;
}

.archive-project-product-row .project-product-price {
  position: static;
  grid-column: auto;
  grid-row: auto;
  font-size: 14px;
}

.archive-project-product-row .project-product-actions {
  grid-column: auto;
  justify-content: flex-end;
  max-width: none;
}

.project-product-actions .primary,
.project-product-actions .ghost,
.project-product-actions .danger {
  margin-top: 0;
  white-space: nowrap;
}

.custom-project-mini {
  display: grid;
  grid-template-columns: 44px minmax(0, 120px);
  gap: 8px;
  align-items: center;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.custom-project-mini-image {
  display: grid;
  place-items: center;
  width: 44px;
  aspect-ratio: 4 / 3;
  border-radius: 6px;
  background: linear-gradient(135deg, #edf2f7, #dbe7f3);
  background-position: center;
  background-size: cover;
  color: #56657a;
  font-size: 10px;
  font-weight: 700;
  text-align: center;
}

.custom-project-mini-name {
  overflow: hidden;
  color: #344054;
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.custom-project-more,
.custom-project-empty {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.custom-intake-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 6px;
  border-top: 1px solid var(--line);
}

.custom-intake-head h3 {
  margin: 0 0 4px;
}

.custom-intake-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.custom-tabs {
  margin: 0;
  flex-shrink: 0;
}

.custom-tab-panel {
  display: none;
}

.custom-tab-panel.active {
  display: grid;
}

.custom-pool-form.custom-tab-panel.active {
  grid-template-columns: minmax(420px, 0.9fr) minmax(660px, 1.1fr);
  gap: 12px 16px;
  align-items: start;
}

.custom-pool-form .custom-image-field {
  grid-column: 1;
}

.custom-fields-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 10px 12px;
  min-width: 0;
}

.custom-pool-form .custom-image-field .image-drop-zone {
  min-height: clamp(320px, 23vw, 420px);
}

.custom-pool-form .custom-image-field .detail-preview {
  min-height: clamp(320px, 23vw, 420px);
}

.custom-pool-form .custom-image-field .detail-preview.has-images {
  grid-template-columns: repeat(2, minmax(96px, 1fr));
  align-content: start;
}

.custom-pool-form .custom-image-field .detail-preview.has-images.single-image {
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
  align-content: center;
}

.custom-pool-form .custom-image-field .detail-thumb {
  min-height: 108px;
}

.custom-selling-point-box {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.custom-selling-point-title {
  color: #344054;
  font-size: 12px;
  font-weight: 700;
}

.custom-selling-point-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 38px;
}

.custom-selling-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 10px 0 14px;
  border-radius: 999px;
  background: #fff1f0;
  color: #b42318;
  font-size: 24px;
  font-weight: 800;
  line-height: 1;
}

.custom-selling-chip-remove {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  min-height: 20px;
  padding: 0;
  border-radius: 999px;
  background: #d92d20;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
}

.custom-fields-grid input,
.custom-fields-grid select {
  min-height: 36px;
}

.custom-submit-cell {
  display: grid;
  grid-column: 1 / -1;
  align-self: end;
}

.custom-submit-cell button {
  min-height: 38px;
  width: 100%;
}

.custom-pool-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 12px;
}

.custom-filter-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef7ff;
  border-color: #b9d8f2;
}

.custom-work-area {
  display: block;
}

.custom-results-panel {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f3fbf5;
  border-color: #badfc4;
}

.custom-library-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.custom-basket-slot {
  min-width: 0;
  min-height: 0;
}

.custom-basket-slot .basket {
  position: static;
  height: 100%;
  max-height: none;
  min-height: 0;
  overflow: hidden;
  grid-template-rows: auto auto minmax(180px, 1fr) auto auto auto;
}

.custom-basket-slot .basket-items {
  min-height: 180px;
  overflow: auto;
  padding-right: 4px;
}

.standard-basket-slot {
  display: contents;
}

.custom-project-list {
  display: grid;
  gap: 8px;
}

.custom-project-group {
  display: grid;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.custom-project-group h4 {
  margin: 0;
  color: var(--text);
  font-size: 12px;
}

.custom-secondary-list {
  display: grid;
  grid-template-columns: 1fr;
  align-content: start;
  align-items: start;
  gap: 10px;
}

.custom-secondary-group {
  display: grid;
  grid-template-rows: auto minmax(0, auto);
  gap: 8px;
  min-height: 50px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.custom-secondary-group.expanded {
  min-height: 0;
}

.custom-secondary-group.collapsed {
  grid-template-rows: auto;
  min-height: 50px;
}

.custom-secondary-group.collapsed .product-group-grid {
  display: none;
}

.custom-secondary-head {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  min-height: 32px;
  padding: 0 8px;
  border: 1px solid #e4eaf2;
  border-radius: 6px;
  background: #f5f9ff;
  color: var(--text);
  text-align: left;
}

.custom-secondary-head strong,
.custom-secondary-head span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.custom-secondary-head strong {
  font-size: 13px;
}

.custom-secondary-head span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 11px;
}

.custom-secondary-head .group-arrow {
  color: var(--primary);
  font-size: 13px;
}

.custom-secondary-head strong {
  flex: 1 1 auto;
}

.form-actions,
.card-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.form-actions {
  margin-top: 10px;
  align-items: center;
}

.form-actions .primary,
.form-actions .ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 126px;
  height: 44px;
  min-height: 44px;
  margin-top: 0;
  padding: 0;
  line-height: 1;
  white-space: nowrap;
}

.filter-actions {
  display: flex;
  gap: 8px;
  align-items: end;
  align-self: end;
}

.filter-actions .primary,
.filter-actions .ghost {
  margin-top: 0;
  height: 34px;
  min-height: 34px;
  white-space: nowrap;
}

.hidden {
  display: none !important;
}

label {
  display: grid;
  gap: 5px;
  color: #344054;
  font-size: 12px;
  font-weight: 700;
}

.field-label {
  color: #344054;
  font-size: 12px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 34px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
}

textarea {
  min-height: 64px;
  resize: vertical;
}

.wide {
  grid-column: span 2;
}

.full-row,
.image-pair {
  grid-column: 1 / -1;
}

.image-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
}

.primary,
.ghost,
.danger {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 6px;
  font-weight: 700;
}

.primary {
  margin-top: 10px;
  background: var(--primary);
  color: #fff;
}

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

.secondary {
  background: #1d7f57;
}

.ghost {
  background: var(--soft);
  color: var(--primary);
}

.danger {
  background: #fff1f0;
  color: var(--danger);
}

.small {
  min-height: 30px;
  padding: 0 9px;
  font-size: 12px;
}

.upload-box {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px dashed #9aa6b2;
  border-radius: 8px;
  background: #fbfcfe;
}

.upload-actions {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.image-field {
  display: grid;
  gap: 6px;
}

.image-drop-zone {
  display: grid;
  min-height: 118px;
  border: 1px dashed #9aa6b2;
  border-radius: 8px;
  background: #fbfcfe;
  color: var(--muted);
  outline: none;
}

.image-drop-zone:focus,
.image-drop-zone.dragging {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(23, 104, 172, 0.14);
}

.image-preview {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 118px;
  padding: 10px;
  text-align: center;
  background-position: center;
  background-size: contain;
  background-repeat: no-repeat;
  border-radius: 8px;
}

.image-preview.has-image {
  color: transparent;
}

.image-remove,
.detail-remove {
  position: absolute;
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: rgba(180, 35, 24, 0.95);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
}

.image-remove {
  top: 8px;
  right: 8px;
}

.detail-zone {
  min-height: 118px;
}

.detail-preview {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 118px;
  padding: 10px;
  color: var(--muted);
  text-align: center;
  font-size: 12px;
  line-height: 1.45;
}

.detail-preview.has-images {
  grid-template-columns: repeat(auto-fill, minmax(74px, 92px));
  gap: 8px;
  place-items: stretch;
  align-items: start;
  justify-content: start;
}

.detail-preview.has-images.single-image {
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
  align-items: center;
  justify-content: center;
}

.detail-thumb {
  position: relative;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
}

.detail-preview.has-images.single-image .detail-thumb {
  width: min(100%, 620px);
}

.primary-thumb {
  box-shadow: 0 0 0 2px var(--primary);
}

.primary-badge {
  position: absolute;
  left: 6px;
  top: 6px;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

.detail-remove {
  top: 5px;
  right: 5px;
}

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

.tall-field textarea {
  min-height: 96px;
}

.schema,
.hint {
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.55;
}

.hint.ok {
  color: var(--success);
}

.hint.error {
  color: var(--danger);
}

.pill,
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.saved-combo-inline-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.saved-combo-loose-picker {
  width: 100%;
  margin-top: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8fbff;
}

.saved-combo-loose-picker-title {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.saved-combo-loose-picker-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.saved-combo-loose-option {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
}

.saved-combo-loose-option input {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
}

.saved-combo-loose-picker-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}

.content {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(420px, 500px);
  gap: 14px;
  align-items: start;
}

.intake,
.filters {
  overflow: hidden;
}

.tag-input-field {
  align-content: start;
}

.chip-input-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-height: 42px;
  padding: 6px 8px;
  border: 1px solid #d0d7e2;
  border-radius: 8px;
  background: #fff;
}

.chip-input-box:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(23, 104, 172, 0.14);
}

.chip-input-box input {
  flex: 1 1 130px;
  min-width: 110px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  outline: none;
}

.chip-input-box input:focus {
  box-shadow: none;
}

.input-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 0;
}

.input-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 6px 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f2f4f7;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}

.input-chip-remove {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  min-height: 16px;
  padding: 0;
  border-radius: 999px;
  background: #dde3ec;
  color: #667085;
  font-size: 11px;
  line-height: 1;
  font-weight: 700;
}

.input-chip-remove:hover {
  background: #fee4e2;
  color: #b42318;
}

.products {
  display: grid;
  gap: 10px;
}

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

.custom-library-tile {
  grid-template-rows: auto minmax(0, 1fr);
  height: auto;
  min-height: 0;
  max-height: none;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.58);
  overflow: visible;
}

.custom-library-tile.collapsed {
  grid-template-rows: auto;
  height: 56px;
  min-height: 0;
  max-height: none;
}

.custom-library-tile .custom-secondary-list {
  display: grid;
  gap: 10px;
  min-height: 0;
  overflow: visible;
  padding-right: 4px;
}

.custom-library-tile .custom-secondary-group .product-group-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: 244px;
  align-items: start;
  min-height: 0;
  overflow: hidden;
  padding-right: 0;
}

.custom-library-tile .custom-secondary-group.collapsed .product-group-grid {
  display: none;
}

.custom-library-tile .product-card {
  width: 100%;
  min-width: 0;
  height: 244px;
  min-height: 244px;
  max-height: 244px;
  overflow: hidden;
}

.custom-library-tile .product-card .image {
  height: 112px;
  min-height: 112px;
  max-height: 112px;
  overflow: hidden;
}

.custom-library-tile .product-card .card-body {
  min-height: 0;
  overflow: hidden;
}

.product-group-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  text-align: left;
}

.product-group-head strong {
  font-size: 14px;
}

.product-group-head span:last-child {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
}

.group-arrow {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--primary);
  font-weight: 700;
}

.product-group-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(176px, 1fr));
  gap: 8px;
}

.product-group.collapsed .product-group-grid {
  display: none;
}

.product-group.collapsed .custom-secondary-list {
  display: none;
}

.product-card {
  position: relative;
  display: grid;
  grid-template-rows: 100px 1fr;
  overflow: hidden;
  min-width: 0;
  min-height: 318px;
}

.brand-corner {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  max-width: calc(100% - 16px);
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.3;
  box-shadow: 0 1px 4px rgba(16, 24, 40, 0.12);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image {
  height: 100px;
  background: linear-gradient(135deg, #edf2f7, #dbe7f3);
  background-position: center;
  background-size: cover;
  border-bottom: 1px solid var(--line);
}

.image.placeholder {
  display: grid;
  place-items: center;
  color: #56657a;
  font-weight: 700;
}

.card-body {
  display: grid;
  grid-template-rows: 34px 17px 28px 17px 18px 22px 34px;
  gap: 4px;
  padding: 8px;
  min-width: 0;
  overflow: visible;
}

.card-title {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
  min-height: 34px;
}

.card-title h3 {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  white-space: normal;
  word-break: break-word;
  line-height: 1.25;
  font-size: 13px;
}

.meta,
.code,
.selling {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}

.meta,
.selling {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
}

.meta {
  -webkit-line-clamp: 2;
  min-height: 28px;
}

.selling {
  -webkit-line-clamp: 1;
  min-height: 17px;
}

.code {
  color: #1768ac;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cost-line {
  display: flex;
  align-items: center;
  min-height: 18px;
  min-width: 0;
}

.cost {
  color: var(--muted);
  font-size: 11px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scenario-line {
  margin: 0;
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tags {
  display: none;
  flex-wrap: wrap;
  gap: 5px;
  min-height: 0;
  overflow: hidden;
}

.tag {
  padding: 3px 7px;
  border-radius: 999px;
  background: #f2f4f7;
  color: #475467;
  font-size: 11px;
}

.badge {
  max-width: 54px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.add-btn,
.edit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  min-height: 34px;
  border-radius: 6px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.add-btn {
  flex: 1;
  background: #18202b;
  color: #fff;
}

.edit-btn {
  padding: 0 10px;
  background: var(--soft);
  color: var(--primary);
}

.delete-btn {
  padding: 0 10px;
  background: #fff1f0;
  color: var(--danger);
}

.copy-project-btn {
  padding: 0 9px;
  background: #ecfdf3;
  color: #027a48;
}

.project-status-btn {
  padding: 0 9px;
  background: #f2f4f7;
  color: #667085;
  cursor: default;
}

.project-relation {
  align-self: end;
  min-width: 0;
  color: #667085;
  font-size: 12px;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-actions {
  align-self: end;
  gap: 8px;
}

.custom-compact-card {
  grid-template-rows: 112px auto;
  min-height: 244px;
  height: 244px;
}

.custom-compact-card .image {
  width: auto;
  height: 112px;
  background-size: cover;
  border-right: 0;
  border-bottom: 1px solid var(--line);
}

.custom-compact-card .card-body {
  grid-template-rows: 38px auto;
  gap: 6px;
  padding: 8px;
  overflow: hidden;
}

.custom-compact-card .card-title h3 {
  -webkit-line-clamp: 2;
  font-size: 13px;
}

.custom-compact-card .badge {
  max-width: 58px;
}

.custom-compact-card .code,
.custom-compact-card .meta,
.custom-compact-card .cost-line,
.custom-compact-card .selling,
.custom-compact-card .scenario-line,
.custom-compact-card .tags,
.custom-compact-card .project-relation {
  display: none !important;
}

.custom-compact-card .card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-self: end;
  gap: 6px;
}

.custom-compact-card .copy-project-btn,
.custom-compact-card .project-status-btn {
  grid-column: 1 / -1;
  order: 2;
}

.custom-compact-card .edit-btn,
.custom-compact-card .delete-btn {
  order: 1;
}

.custom-compact-card .edit-btn,
.custom-compact-card .delete-btn,
.custom-compact-card .project-status-btn,
.custom-compact-card .copy-project-btn {
  height: 32px;
  min-height: 32px;
  font-size: 12px;
}

.clickable-card {
  position: relative;
  cursor: pointer;
}

.clickable-card button {
  cursor: pointer;
}

.custom-card-check {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.12);
}

.custom-card-check input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: #1768ac;
}

.basket {
  position: static;
  top: auto;
  padding: 14px;
  max-height: calc(100vh - 120px);
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-gutter: stable;
  scrollbar-width: auto;
}

.custom-basket-slot .basket {
  height: 100%;
  max-height: 100%;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.basket::-webkit-scrollbar {
  width: 12px;
}

.basket::-webkit-scrollbar-track {
  background: #eef2f6;
  border-radius: 999px;
}

.basket::-webkit-scrollbar-thumb {
  background: #98a2b3;
  border-radius: 999px;
  border: 2px solid #eef2f6;
}

.basket-items {
  display: grid;
  align-content: start;
  gap: 8px;
  margin-top: 0;
  min-height: 0;
  max-height: none;
  overflow: visible;
}

.basket-list-shell {
  min-height: 240px;
  max-height: 420px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  scrollbar-gutter: stable;
  scrollbar-width: auto;
}

.custom-basket-slot .basket-list-shell {
  flex: 1 1 auto;
  min-height: 240px;
}

.basket-list-shell::-webkit-scrollbar {
  width: 12px;
}

.basket-list-shell::-webkit-scrollbar-track {
  background: #eef2f6;
  border-radius: 999px;
}

.basket-list-shell::-webkit-scrollbar-thumb {
  background: #98a2b3;
  border-radius: 999px;
  border: 2px solid #eef2f6;
}

.dimension-panel {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.dimension-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.dimension-options label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 26px;
  padding: 0 8px;
  border-radius: 999px;
  background: #f2f4f7;
  color: #475467;
  font-size: 11px;
  font-weight: 700;
}

.dimension-options input {
  width: auto;
  min-height: auto;
}

.basket-items.empty {
  min-height: 180px;
  place-items: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 18px 14px;
}

.basket-item {
  display: grid;
  grid-template-columns: 18px 88px minmax(0, 1fr);
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  align-items: start;
}

.basket-item.combo-mode {
  grid-template-columns: 18px 22px 88px minmax(0, 1fr);
}

.combo-panel {
  display: grid;
  gap: 8px;
  margin-top: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  align-content: start;
}

.combo-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.combo-builder {
  display: grid;
  gap: 8px;
}

.combo-workbench {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid #d6e4ff;
  border-radius: 10px;
  background: linear-gradient(180deg, #f8fbff 0%, #eef6ff 100%);
}

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

.combo-workbench.hidden {
  display: none !important;
}

.combo-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #f2f4f7;
  color: #475467;
  font-size: 12px;
}

.combo-validation {
  min-height: 18px;
  margin: 0;
  color: var(--danger);
  font-size: 12px;
  font-weight: 700;
}

.combo-actions {
  display: flex;
  gap: 8px;
}

.saved-combos {
  display: grid;
  gap: 8px;
}

.saved-combos.empty {
  min-height: 0;
  padding: 0;
  color: var(--muted);
  font-size: 13px;
}

.saved-combo-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.saved-combo-meta {
  display: grid;
  gap: 2px;
}

.saved-combo-meta span {
  color: #667085;
  font-size: 12px;
}

.saved-combo-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0;
  background: transparent;
  text-align: left;
}

.saved-combo-toggle {
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.saved-combo-products {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
}

.saved-combo-product-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #667085;
  font-size: 12px;
}

.saved-combo-item {
  align-items: flex-start;
  padding: 16px 18px;
  border-radius: 14px;
}

.saved-combo-summary {
  align-items: flex-start;
  gap: 20px;
  min-height: 92px;
  flex: 1;
}

.saved-combo-products {
  gap: 10px;
  padding-top: 12px;
}

.saved-combo-product-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.saved-combo-thumb {
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #f4f6f8 center / cover no-repeat;
}

.saved-combo-preview-strip {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  gap: 12px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}

.saved-combo-preview-card {
  display: grid;
  gap: 8px;
}

.saved-combo-preview-thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #f4f6f8 center / cover no-repeat;
}

.saved-combo-preview-name {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
  word-break: break-word;
}

.saved-combo-brief {
  display: grid;
  gap: 8px;
  min-width: 280px;
  padding-top: 6px;
  border-top: 1px dashed var(--line);
}

.saved-combo-brief-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

.saved-combo-expanded-item {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.saved-combo-expanded-thumb {
  width: 88px;
  height: 88px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #f4f6f8 center / cover no-repeat;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
}

.saved-combo-expanded-main {
  display: grid;
  gap: 8px;
  align-content: center;
}

.saved-combo-expanded-title {
  color: var(--text);
}

.saved-combo-expanded-code,
.saved-combo-expanded-meta {
  color: var(--muted);
  font-size: 12px;
}

.saved-combo-expanded-item-card {
  margin-top: 12px;
}

.saved-combo-summary-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.saved-combo-expanded-item-card .basket-controls.readonly label,
.saved-combo-expanded-item-card .basket-controls.readonly .basket-line-margin {
  pointer-events: none;
}

.saved-combo-expanded-item-card .basket-controls.readonly input {
  background: #f7f9fc;
  color: var(--text);
  cursor: default;
}

.saved-combo-products {
  width: 100%;
}

.saved-combo-inline-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

.saved-combo-item-final {
  display: block;
}

.saved-combo-item-final .saved-combo-summary-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.saved-combo-item-final .saved-combo-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 0;
}

.saved-combo-item-final .saved-combo-brief {
  margin-top: 12px;
  min-width: 0;
}

.saved-combo-item-final .saved-combo-products {
  display: block;
  width: 100%;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}

.saved-combo-item-final .saved-combo-expanded-item-card {
  width: 100%;
  margin-top: 12px;
}

.saved-combo-item-final .saved-combo-expanded-item-card:first-child {
  margin-top: 0;
}

.saved-combo-item-final .saved-combo-preview-strip {
  display: none !important;
}

.saved-combo-placeholder {
  visibility: hidden;
  pointer-events: none;
}

.saved-combo-readonly-controls label,
.saved-combo-readonly-controls .basket-line-margin {
  pointer-events: none;
}

.saved-combo-readonly-controls input {
  background: #f7f9fc;
  color: var(--text);
  cursor: default;
}

.saved-combo-expanded-meta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.combo-check {
  display: grid;
  place-items: center;
}

.combo-check input {
  width: 16px;
  height: 16px;
  min-height: 0;
}

.danger-text {
  color: var(--danger);
}

.basket-item.just-added {
  border-color: #12b76a;
  box-shadow: 0 0 0 3px rgba(18, 183, 106, 0.18);
}

.basket-item.dragging {
  opacity: 0.55;
}

.basket-item.drag-over {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(23, 104, 172, 0.14);
}

.saved-combos-v2 {
  gap: 16px;
}

.saved-combo-block-v2 {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  padding: 20px;
}

.saved-combo-layout-v2 {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.saved-combo-sidebar-v2 {
  display: grid;
  gap: 16px;
  align-content: start;
}

.saved-combo-sidebar-head-v2 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.saved-combo-meta-v2 {
  display: grid;
  gap: 6px;
}

.saved-combo-meta-v2 strong {
  font-size: 20px;
}

.saved-combo-meta-v2 span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.saved-combo-brief-v2 {
  display: grid;
  gap: 10px;
}

.saved-combo-brief-line-v2 {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  color: var(--text);
  font-size: 14px;
}

.saved-combo-brief-line-v2 span:last-child {
  color: var(--muted);
  white-space: nowrap;
}

.saved-combo-sidebar-actions-v2 {
  display: flex;
  justify-content: flex-start;
}

.saved-combo-products-v2 {
  display: grid;
  gap: 16px;
}

.saved-combo-card-v2 {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  align-items: center;
}

.saved-combo-card-media {
  display: flex;
  align-items: center;
  justify-content: center;
}

.saved-combo-card-image {
  width: 132px;
  height: 132px;
  border-radius: 14px;
  object-fit: cover;
  border: 1px solid var(--line);
  background: #f7f9fc;
}

.saved-combo-card-image-fallback {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  padding: 12px;
}

.saved-combo-card-body {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.saved-combo-card-title {
  margin: 0;
  font-size: 20px;
  line-height: 1.3;
}

.saved-combo-card-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.saved-combo-card-metric {
  display: grid;
  gap: 8px;
}

.saved-combo-card-metric span {
  color: var(--muted);
  font-size: 13px;
}

.saved-combo-card-metric strong {
  font-size: 18px;
  line-height: 1.2;
}

@media (max-width: 1100px) {
  .saved-combo-layout-v2 {
    grid-template-columns: 1fr;
  }

  .saved-combo-card-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .saved-combo-block-v2 {
    padding: 16px;
  }

  .saved-combo-card-v2 {
    grid-template-columns: 1fr;
  }

  .saved-combo-card-media {
    justify-content: flex-start;
  }

  .saved-combo-card-image {
    width: 96px;
    height: 96px;
  }

  .saved-combo-card-metrics {
    grid-template-columns: 1fr;
  }
}

.basket-drag-handle {
  display: inline-grid;
  place-items: center;
  align-self: stretch;
  width: 18px;
  min-height: 100%;
  padding: 0;
  border-radius: 6px;
  background: #f2f4f7;
  color: #667085;
  cursor: grab;
  font-weight: 900;
}

.basket-drag-handle:active {
  cursor: grabbing;
}

.basket-thumb {
  display: grid;
  place-items: center;
  width: 88px;
  aspect-ratio: 4 / 3;
  border-radius: 6px;
  background: linear-gradient(135deg, #edf2f7, #dbe7f3);
  background-position: center;
  background-size: cover;
  color: #56657a;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.basket-detail {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.basket-detail .code {
  display: none;
}

.basket-line {
  display: block;
  min-width: 0;
}

.basket-line-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.basket-line strong {
  display: block;
  margin: 0;
  font-size: 15px;
  line-height: 1.35;
  color: #18202b;
  word-break: break-word;
}

.basket-merge-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  color: #667085;
  font-size: 12px;
  font-weight: 700;
}

.basket-merge-inline select {
  min-width: 150px;
  min-height: 32px;
  padding: 5px 30px 5px 10px;
  border: 1px solid #d0d5dd;
  border-radius: 999px;
  background: #fff;
  color: #1f2937;
  font-size: 12px;
}

.basket-controls {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(120px, 1fr) 90px 110px auto;
  gap: 8px;
  align-items: end;
}

.basket-controls label {
  display: grid;
  gap: 4px;
  min-width: 0;
  font-size: 12px;
  font-weight: 700;
  color: #475467;
}

.basket-controls input {
  min-height: 30px;
  padding: 5px 7px;
}

.basket-controls .remove {
  min-height: 30px;
  padding: 5px 9px;
}

.basket-line-margin {
  display: grid;
  gap: 3px;
  align-content: end;
  min-height: 48px;
  color: #667085;
  font-size: 11px;
}

.basket-line-margin strong {
  display: grid;
  place-items: center;
  min-height: 30px;
  border-radius: 6px;
  background: #ecfdf3;
  color: #027a48;
  font-size: 13px;
}

.markup-control {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.markup-control label {
  display: grid;
  gap: 4px;
  color: #344054;
  font-size: 12px;
  font-weight: 800;
}

.markup-control label span {
  display: flex;
  align-items: center;
  gap: 5px;
}

.markup-control input {
  width: 86px;
  min-height: 32px;
  padding: 5px 8px;
}

.remove {
  min-height: 34px;
  padding: 0 10px;
  border-radius: 6px;
  color: var(--danger);
  background: #fff1f0;
}

.totals {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.totals div {
  display: flex;
  justify-content: space-between;
}

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

.proposal-form {
  display: grid;
  gap: 8px;
  margin-top: 0;
}

.export-template-picks {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfcfe;
}

.export-template-picks label {
  display: grid;
  gap: 6px;
  font-weight: 700;
}

.export-template-picks select {
  display: block;
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  padding-right: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  appearance: auto;
  -webkit-appearance: menulist;
  -moz-appearance: menulist;
  box-shadow: none;
}

.export-actions {
  align-items: stretch;
  position: static;
  bottom: auto;
  z-index: auto;
  margin: 0;
  padding: 0;
  background: transparent;
  border-top: 0;
}

.export-actions button {
  flex: 1;
  min-height: 40px;
  font-weight: 800;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 28px;
  text-align: center;
  color: var(--muted);
  background: #fff;
  border: 1px dashed var(--line);
  border-radius: 8px;
}

.detail-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(16, 24, 40, 0.42);
}

.detail-overlay.hidden {
  display: none;
}

.detail-modal {
  position: relative;
  width: min(780px, 86vw);
  max-height: 76vh;
  overflow: auto;
  padding: 14px;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(16, 24, 40, 0.28);
}

.detail-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  border-radius: 999px;
  background: #f2f4f7;
  color: #344054;
  font-size: 22px;
  font-weight: 800;
}

.detail-content {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 12px;
}

.detail-gallery-column {
  position: relative;
  min-height: 0;
  padding-bottom: 0;
}

.detail-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 8px;
  align-content: start;
}

.detail-gallery-image {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 118px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  background-position: center;
  background-size: contain;
  background-repeat: no-repeat;
  color: var(--muted);
  font-weight: 700;
  cursor: zoom-in;
}

.detail-selling-points {
  position: static;
  margin-top: 8px;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  pointer-events: none;
}

.detail-selling-points span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 12px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 999px;
  background: rgba(180, 35, 24, 0.9);
  box-shadow: 0 6px 18px rgba(16, 24, 40, 0.2);
  color: #fff;
  font-size: 16px;
  font-weight: 900;
  line-height: 1.15;
  backdrop-filter: blur(6px);
}

.image-preview-overlay {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 28px;
  background: rgba(16, 24, 40, 0.82);
}

.image-preview-overlay.hidden {
  display: none;
}

.image-preview-overlay img {
  max-width: min(96vw, 1280px);
  max-height: 92vh;
  object-fit: contain;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
}

.image-preview-close {
  position: fixed;
  top: 16px;
  right: 16px;
  background: #fff;
}

.detail-info {
  display: grid;
  gap: 8px;
  align-content: start;
  padding-right: 10px;
}

.detail-info h2 {
  margin: 0 0 2px;
  font-size: 20px;
}

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

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

.detail-row {
  display: grid;
  gap: 3px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

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

.detail-row strong {
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
  word-break: break-word;
}

@media (max-width: 1180px) {
  .form-grid,
  .filter-grid,
  .custom-pool-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .custom-pool-form.custom-tab-panel.active {
    grid-template-columns: minmax(340px, 0.8fr) minmax(0, 1.2fr);
  }

  .custom-fields-grid {
    grid-template-columns: repeat(2, minmax(150px, 1fr));
  }

  .content {
    grid-template-columns: minmax(0, 1fr) minmax(380px, 460px);
  }

  .custom-current-layout {
    grid-template-columns: minmax(300px, 0.88fr) minmax(360px, 1.12fr);
  }
}

@media (max-width: 860px) {
  .topbar,
  .content {
    grid-template-columns: 1fr;
    display: grid;
  }

  .top-actions,
  .export-actions {
    flex-wrap: wrap;
  }

  .export-template-picks {
    grid-template-columns: 1fr;
  }

  .layout,
  .topbar {
    padding-left: 16px;
    padding-right: 16px;
  }

  .form-grid,
  .filter-grid,
  .custom-pool-form {
    grid-template-columns: 1fr;
  }

  .custom-pool-form.custom-tab-panel.active {
    grid-template-columns: 1fr;
  }

  .custom-fields-grid {
    grid-template-columns: 1fr;
  }

  .custom-pool-form .custom-image-field,
  .custom-pool-form > label.wide:not(.custom-image-field) {
    grid-column: auto;
    grid-row: auto;
  }

  .custom-pool-form .custom-image-field .image-drop-zone,
  .custom-pool-form .custom-image-field .detail-preview {
    min-height: 180px;
  }

  .filter-actions {
    align-items: stretch;
  }

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

  .product-group-grid {
    grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
  }

  .wide {
    grid-column: auto;
  }

  .full-row,
  .image-pair {
    grid-column: auto;
  }

  .image-pair {
    grid-template-columns: 1fr;
  }

  .basket {
    position: static;
  }

  .custom-current-layout {
    height: auto;
    grid-template-columns: 1fr;
  }

  .current-project-products,
  .custom-basket-slot .basket {
    height: auto;
    max-height: none;
  }

  .current-project-products .custom-project-product-list,
  .custom-basket-slot .basket-items {
    overflow: visible;
  }

  .custom-project-card-head {
    align-items: stretch;
    flex-direction: column;
  }

  .custom-project-card-actions {
    justify-content: flex-start;
  }

  .custom-project-product-row {
    grid-template-columns: 54px minmax(0, 1fr);
  }

  .custom-project-product-list.archive-project-category-grid {
    grid-template-columns: 1fr;
  }

  .archive-project-product-row {
    grid-template-columns: 54px minmax(0, 1fr);
  }

  .project-product-side {
    grid-column: 1 / -1;
    justify-items: start;
  }

  .project-product-price {
    grid-column: 2;
    grid-row: auto;
    justify-self: start;
  }

  .project-product-thumb {
    width: 54px;
    height: 54px;
  }

  .project-product-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
    max-width: none;
  }

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

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

.debug-panel {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 9990;
  width: min(360px, calc(100vw - 24px));
  max-height: 40vh;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border: 1px solid #f2b8b5;
  border-radius: 14px;
  background: rgba(255, 250, 250, 0.96);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
  backdrop-filter: blur(12px);
}

.debug-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #9f1239;
  font-size: 13px;
}

.debug-panel-head button {
  border: 0;
  background: #fff;
  color: #2563eb;
  border-radius: 999px;
  padding: 4px 10px;
  cursor: pointer;
}

.debug-panel-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: auto;
}

.debug-panel-item {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  padding: 8px 10px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid #fecaca;
  color: #991b1b;
  font-size: 12px;
  line-height: 1.5;
}

.debug-panel-item.warn {
  border-color: #fde68a;
  color: #92400e;
  background: #fffbeb;
}

.debug-panel-time {
  color: #64748b;
  font-variant-numeric: tabular-nums;
}

.debug-panel-text {
  word-break: break-word;
}
