:root {
  color-scheme: light;
  --ink: #1e211f;
  --muted: #6c6a62;
  --line: #ddd4c4;
  --paper: #f5f2ec;
  --panel: #fffdfa;
  --accent: #08757d;
  --accent-2: #c55b3e;
  --gold: #b89154;
  --charcoal: #171b1a;
  --floor: #e9e1d3;
  --shadow: 0 18px 48px rgba(26, 24, 21, 0.18);
  --soft-shadow: 0 10px 26px rgba(26, 24, 21, 0.08);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

/* The Three.js application is imported only after the server-authorized gate succeeds. */
.access-gate {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #eef2ef;
  color: #171714;
}

.access-gate__card {
  width: min(100%, 520px);
  padding: clamp(28px, 6vw, 56px);
  background: #fff;
  box-shadow: 0 24px 80px rgba(23, 23, 20, 0.14);
}

.access-gate__card h1 {
  margin: 12px 0 20px;
  font-size: clamp(28px, 5vw, 48px);
  line-height: 1.05;
}

.access-gate__card a {
  display: inline-block;
  margin-top: 20px;
  padding: 13px 20px;
  color: #fff;
  text-decoration: none;
  background: #171714;
}

.access-gate__card .eyebrow {
  font-size: 12px;
  letter-spacing: 0.18em;
}

* {
  box-sizing: border-box;
}

[hidden],
.legacy-selected-tools-hidden {
  display: none !important;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--paper);
  color: var(--ink);
}

html {
  min-height: 100%;
  overflow: hidden;
}

body {
  position: fixed;
  inset: 0;
}

button,
input,
label {
  font: inherit;
}

button,
.import-button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  transition:
    border-color 150ms ease,
    background 150ms ease,
    transform 150ms ease,
    box-shadow 150ms ease;
}

button:hover,
.import-button:hover {
  border-color: var(--accent);
  background: #eef8f7;
}

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

.primary-action {
  border-color: #0c6f7a;
  background: linear-gradient(135deg, #08757d, #0f5c63);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 10px 22px rgba(8, 117, 125, 0.18);
}

.primary-action:hover {
  border-color: #075e68;
  background: #075e68;
}

.danger-action {
  border-color: #b94631;
  background: #fff6f2;
  color: #98351f;
  font-weight: 800;
}

.danger-action:hover {
  border-color: #98351f;
  background: #fde7de;
}

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

.compact-action {
  padding-inline: 16px;
}

.app-shell {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  min-height: 0;
  height: 100%;
  max-height: 100dvh;
  overflow: auto;
  padding: 22px;
  border-right: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 253, 250, 0.92), rgba(245, 242, 236, 0.96)),
    var(--paper);
}

.brand-block {
  padding: 4px 0 10px;
  border-bottom: 1px solid rgba(184, 145, 84, 0.34);
}

.brand-identity {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}

.brand-logo {
  display: block;
  width: 72px;
  height: 108px;
  border-radius: 6px;
  object-fit: cover;
  box-shadow: 0 10px 24px rgba(17, 17, 17, 0.2);
}

.brand-copy {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: 26px;
  line-height: 1.12;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 14px;
  line-height: 1.2;
}

.panel {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--soft-shadow);
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.section-title span,
.hint,
small {
  color: var(--muted);
  font-size: 12px;
}

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

.catalog-grid {
  display: grid;
  gap: 14px;
}

.catalog-tools {
  display: grid;
  gap: 8px;
}

.catalog-tools input {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  padding: 0 11px;
  outline: none;
}

.catalog-tools input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(8, 117, 125, 0.12);
}

.wall-slot-panel {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdfa;
}

.wall-slot-panel[hidden] {
  display: none;
}

.wall-slot-heading {
  display: grid;
  gap: 3px;
  font-size: 12px;
}

.wall-slot-heading span {
  color: var(--muted);
}

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

.wall-slot-list button.is-assigned:not(.is-active) {
  opacity: 0.62;
}

.catalog-family-switch {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.catalog-folder {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.catalog-folder summary {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  min-height: 42px;
  padding: 0 11px;
  cursor: pointer;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.catalog-folder summary small {
  font-weight: 700;
}

.catalog-folder[open] summary {
  border-bottom: 1px solid var(--line);
  background: #f6f2ea;
}

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

.catalog-card {
  display: grid;
  gap: 8px;
  align-content: start;
  min-height: 132px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  text-align: left;
}

.catalog-card:hover {
  border-color: var(--accent);
}

.catalog-card:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.catalog-empty {
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fffdfa;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f6f2ea;
}

.segmented button {
  min-height: 34px;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  padding: 0 8px;
}

.segmented button.is-active {
  border-color: #0c6f7a;
  background: #dff1ef;
  color: #0d5158;
  font-weight: 800;
}

.segmented button[hidden] {
  display: none;
}

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

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

.material-scope-switch {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.material-scope-switch button:first-child {
  grid-column: 1 / -1;
}

.live-validation {
  display: grid;
  gap: 6px;
}

.live-validation-row {
  display: grid;
  grid-template-columns: 10px 1fr;
  gap: 8px;
  align-items: start;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.live-validation-row::before {
  content: "";
  width: 8px;
  height: 8px;
  margin-top: 5px;
  border-radius: 999px;
  background: var(--accent);
}

.live-validation-row.is-error {
  border-color: rgba(197, 91, 62, 0.36);
  background: #fff4ef;
  color: #7d3420;
}

.live-validation-row.is-error::before {
  background: var(--accent-2);
}

.live-validation-row.is-warning {
  border-color: rgba(184, 145, 84, 0.4);
  background: #fff8e9;
  color: #725126;
}

.live-validation-row.is-warning::before {
  background: var(--gold);
}

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

.space-row {
  display: grid;
  gap: 5px;
}

.space-row-header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.space-track {
  overflow: hidden;
  height: 8px;
  border-radius: 99px;
  background: #eee8dd;
}

.space-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.space-row.is-tight .space-fill {
  background: var(--accent-2);
}

.mini-preview {
  position: relative;
  height: 56px;
  border-radius: 6px;
  background:
    linear-gradient(90deg, rgba(8, 127, 140, 0.14), transparent),
    #f5f1ea;
  overflow: hidden;
}

.catalog-preview-image {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #f4f1eb;
  opacity: 0;
  transition: opacity 180ms ease;
}

.mini-preview.is-loaded .catalog-preview-image {
  opacity: 1;
}

.mini-preview.is-loading::after {
  animation: catalog-preview-loading 900ms ease-in-out infinite alternate;
}

.mini-preview.is-loaded::before,
.mini-preview.is-loaded::after {
  opacity: 0;
}

.mini-preview.is-fallback .catalog-preview-image {
  display: none;
}

@keyframes catalog-preview-loading {
  from { opacity: 0.35; }
  to { opacity: 0.85; }
}

.mini-preview::before,
.mini-preview::after {
  content: "";
  position: absolute;
  background: var(--preview-color, #d7c3a0);
  border: 1px solid rgba(34, 32, 29, 0.18);
}

.mini-preview::before {
  width: var(--preview-w, 54px);
  height: var(--preview-h, 34px);
  left: 13px;
  bottom: 8px;
}

.mini-preview::after {
  width: calc(var(--preview-w, 54px) * 0.72);
  height: 7px;
  left: 13px;
  bottom: 42px;
  background: #4a4035;
}

.catalog-card strong {
  font-size: 13px;
  line-height: 1.2;
}

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

.file-drop {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 10px;
  align-items: center;
  min-height: 66px;
  padding: 12px;
  border: 1px dashed var(--accent);
  border-radius: 8px;
  background: #eef8f7;
}

.file-drop.is-dragging,
.file-picker:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  background: #e1f2ef;
}

.file-drop.is-loading {
  opacity: 0.72;
}

.file-picker {
  grid-column: 1 / -1;
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--muted);
  padding: 6px;
}

.file-picker::file-selector-button {
  min-height: 28px;
  margin-right: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #eef8f7;
  color: var(--ink);
  cursor: pointer;
}

.hidden-input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.file-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 24px;
  line-height: 1;
}

.file-drop span:last-child {
  display: grid;
  gap: 2px;
  min-width: 0;
  font-weight: 700;
}

.material-block {
  display: grid;
  gap: 8px;
}

.material-block > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

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

.material-swatch {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 8px;
  align-items: center;
  min-height: 48px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  text-align: left;
}

.material-swatch.is-active {
  border-color: var(--accent);
  background: #eef8f7;
}

.swatch-chip {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(34, 32, 29, 0.16);
  border-radius: 6px;
  background-color: var(--swatch-color);
  background-image: var(--swatch-image);
  background-size: cover;
  background-position: center;
}

.material-swatch strong {
  min-width: 0;
  font-size: 12px;
  line-height: 1.15;
}

.field {
  display: grid;
  grid-template-columns: 1fr 48px;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
}

.number-field,
.text-field {
  grid-template-columns: 1fr 104px;
}

.number-field input,
.text-field select {
  width: 100%;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  padding: 0 9px;
}

input[type="color"] {
  width: 48px;
  height: 34px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

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

.project-file-tools {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.project-file-tools > button,
.project-file-tools > .import-button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 7px 9px;
  text-align: center;
  line-height: 1.2;
}

.autosave-status {
  grid-column: 1 / -1;
  color: var(--muted);
  line-height: 1.35;
}

.autosave-status.is-saving {
  color: #8a5a16;
}

.autosave-status.is-saved {
  color: #146047;
}

.autosave-status.is-error {
  color: #96351f;
}

.project-cooktop-action {
  width: 100%;
  margin-bottom: 10px;
  background: #fffdfa;
  font-weight: 800;
}

.icon-button {
  min-width: 40px;
  width: 44px;
  padding: 0;
}

.hint {
  margin-bottom: 0;
  line-height: 1.45;
}

.guard-message {
  min-height: 42px;
  padding: 10px 11px;
  border: 1px solid #c6e2df;
  border-radius: 8px;
  background: #eef8f7;
  color: #14545b;
  font-size: 12px;
  line-height: 1.35;
}

.guard-message.is-warning {
  border-color: #efb7a7;
  background: #fff2ed;
  color: #8d321b;
}

.modal-backdrop {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(26, 24, 21, 0.48);
}

.modal-backdrop[hidden] {
  display: none;
}

.checkout-modal {
  display: grid;
  gap: 16px;
  width: min(1060px, 100%);
  max-height: min(860px, calc(100dvh - 48px));
  overflow: auto;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.modal-header,
.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-header h2,
.checkout-section h3,
.contact-form h3 {
  margin: 0;
}

.checkout-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 12px;
}

.checkout-section,
.contact-form {
  display: grid;
  gap: 11px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

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

.validation-list,
.summary-list {
  display: grid;
  gap: 8px;
}

.validation-item,
.summary-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: start;
  padding: 8px 9px;
  border: 1px solid #dce7e4;
  border-radius: 7px;
  background: #f4faf9;
  font-size: 12px;
}

.validation-item.is-error {
  border-color: #efb7a7;
  background: #fff2ed;
  color: #8d321b;
}

.validation-item.is-warning {
  border-color: #ead39d;
  background: #fff9e9;
  color: #775719;
}

.summary-row strong {
  text-align: right;
}

.order-table-wrap {
  overflow: auto;
  max-height: 260px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.order-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 780px;
  font-size: 12px;
}

.order-table th,
.order-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.order-table th {
  position: sticky;
  top: 0;
  background: #f6f2ea;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

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

.contact-form label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.contact-form input,
.contact-form textarea,
.checkout-section select,
.checkout-section input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  padding: 9px;
  font: inherit;
}

#sendStatus.is-quote-sent {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: #176c3a;
  font-weight: 800;
}

#sendStatus.is-quote-sent::before {
  content: "✓";
  display: inline-grid;
  place-items: center;
  flex: 0 0 26px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #1f9d55;
  color: #fff;
  font-size: 17px;
  line-height: 1;
  box-shadow: 0 4px 12px rgba(31, 157, 85, 0.22);
}

.quote-options-section label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.quote-options-section .consent-row {
  grid-column: 1 / -1;
}

.consent-row {
  grid-template-columns: 18px 1fr;
  align-items: start;
}

.consent-row input {
  width: 16px;
  height: 16px;
  padding: 0;
}

.viewport-wrap {
  position: relative;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  background: linear-gradient(180deg, #dbe9e9 0%, #f6f2ea 55%, #e3d7c7 100%);
}

#sceneCanvas {
  display: block;
  width: 100%;
  height: 100%;
}

.topbar {
  position: absolute;
  z-index: 4;
  top: 18px;
  left: 18px;
  right: 18px;
  display: grid;
  grid-template-columns: minmax(260px, auto) minmax(360px, 1fr) auto;
  gap: 10px;
  align-items: stretch;
  pointer-events: none;
}

.top-metrics,
.selection-toolbar,
.top-actions,
.topbar button {
  pointer-events: auto;
}

.top-metrics,
.selection-toolbar,
.top-actions {
  box-shadow: var(--shadow);
}

.top-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(88px, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid rgba(221, 212, 196, 0.72);
  border-radius: 8px;
  background: rgba(23, 27, 26, 0.9);
  backdrop-filter: blur(16px);
}

.metric {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 9px 12px;
  background: rgba(255, 253, 250, 0.92);
}

.metric span {
  color: var(--muted);
  font-size: 11px;
}

.metric strong {
  font-size: 16px;
}

.selection-toolbar {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 64px;
  padding: 10px;
  border: 1px solid rgba(221, 212, 196, 0.72);
  border-radius: 8px;
  background: rgba(23, 27, 26, 0.9);
  color: #fffdfa;
  backdrop-filter: blur(16px);
}

.selection-toolbar.is-empty {
  background: rgba(255, 253, 250, 0.92);
  color: var(--ink);
}

.selection-summary {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.selection-summary span {
  color: var(--gold);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.selection-summary strong {
  overflow: hidden;
  font-size: 15px;
  line-height: 1.18;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selection-summary small {
  overflow: hidden;
  color: rgba(255, 253, 250, 0.72);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selection-toolbar.is-empty .selection-summary small {
  color: var(--muted);
}

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

.realistic-color-toggle {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid rgba(23, 27, 26, 0.12);
  border-radius: 8px;
  background: rgba(255, 253, 250, 0.94);
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
  gap: 7px;
  pointer-events: auto;
  white-space: nowrap;
}

.realistic-color-toggle input {
  width: 15px;
  height: 15px;
  accent-color: var(--ink);
}

.size-control {
  display: grid;
  gap: 3px;
  min-width: 136px;
  color: rgba(255, 253, 250, 0.74);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.size-control[hidden] {
  display: none;
}

.size-control select {
  width: 100%;
  min-height: 36px;
  border: 1px solid rgba(255, 253, 250, 0.24);
  border-radius: 7px;
  background: rgba(255, 253, 250, 0.12);
  color: #fffdfa;
  padding: 0 9px;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  text-transform: none;
}

.size-control select:disabled {
  opacity: 0.58;
}

.selection-toolbar.is-empty .size-control {
  color: var(--muted);
}

.selection-toolbar.is-empty .size-control select {
  border-color: var(--line);
  background: #fff;
  color: var(--muted);
}

.toolbar-actions button,
.top-actions button {
  min-height: 36px;
  box-shadow: none;
  white-space: nowrap;
}

.toolbar-actions button {
  border-color: rgba(255, 253, 250, 0.22);
  background: rgba(255, 253, 250, 0.1);
  color: #fffdfa;
  font-weight: 800;
}

.toolbar-actions button:hover {
  border-color: rgba(184, 145, 84, 0.9);
  background: rgba(184, 145, 84, 0.18);
}

.toolbar-actions .danger-action {
  border-color: rgba(210, 93, 62, 0.76);
  background: rgba(197, 91, 62, 0.14);
  color: #ffd9ce;
}

.selection-toolbar.is-empty .toolbar-actions button {
  background: #fff;
  color: var(--muted);
}

.top-actions {
  justify-content: flex-end;
  padding: 8px;
  border: 1px solid rgba(221, 212, 196, 0.72);
  border-radius: 8px;
  background: rgba(255, 253, 250, 0.92);
  backdrop-filter: blur(16px);
}

@media (max-width: 1500px) {
  .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .selection-toolbar {
    grid-column: 1 / -1;
    grid-row: 2;
    grid-template-columns: minmax(180px, 1fr) auto;
  }

  .toolbar-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .top-actions {
    grid-column: 2;
    grid-row: 1;
  }

  .top-metrics {
    grid-column: 1;
    grid-row: 1;
  }
}

@media (max-width: 820px) {
  body {
    overflow: hidden;
  }

  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(230px, 42dvh) minmax(0, 1fr);
    min-height: 0;
    height: 100vh;
    height: 100dvh;
  }

  .sidebar {
    height: 100%;
    max-height: none;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .catalog-grid {
    overflow-x: auto;
  }

  .catalog-section-grid {
    grid-template-columns: repeat(3, minmax(118px, 1fr));
  }

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

  .viewport-wrap {
    min-height: 0;
  }

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

  .selection-toolbar,
  .top-actions,
  .top-metrics {
    grid-column: 1;
  }

  .top-actions {
    grid-row: 3;
  }
}

.island-panel .zone-switch {
  margin-top: 12px;
}

.island-position-grid,
.island-action-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.island-option-row {
  margin-top: 12px;
}

.island-panel-options {
  display: grid;
  gap: 2px;
}

.island-structure-controls {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border, rgba(40, 32, 27, 0.12));
}

.island-structure-controls h3 {
  margin: 0;
  font-size: 0.9rem;
}

.island-row-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.island-row-lists,
.island-row-list {
  display: grid;
  gap: 8px;
}

.island-row-list > div:first-child,
.island-row-cabinet {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.island-row-cabinet {
  padding: 7px 8px;
  border: 1px solid var(--border, rgba(40, 32, 27, 0.12));
  border-radius: 9px;
  font-size: 0.78rem;
}

.island-row-order-actions {
  display: flex;
  gap: 4px;
}

.island-row-order-actions button {
  min-width: 30px;
  padding: 4px 7px;
}

.island-structure-validation.is-warning {
  color: #9a351f;
  font-weight: 700;
}

.island-structure-metrics {
  display: grid;
  gap: 5px;
  padding: 9px 10px;
  border-radius: 9px;
  background: var(--surface-muted, rgba(40, 32, 27, 0.045));
  font-size: 0.76rem;
}

.island-structure-metrics span {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.island-structure-validation {
  display: grid;
  gap: 3px;
}

.catalog-island-meta {
  color: var(--accent, #8c6848);
  font-weight: 700;
}

.island-panel .danger-action {
  width: 100%;
  margin-top: 12px;
}

.sidebar.is-island-workspace {
  gap: 0;
  overflow: hidden;
  padding: 0;
  background: #f4f0e9;
}

.sidebar.is-island-workspace > :not(#islandPanel) {
  display: none !important;
}

.sidebar.is-island-workspace #islandPanel {
  display: flex;
  flex-direction: column;
  gap: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.sidebar.is-island-workspace .island-launch-title,
.sidebar.is-island-workspace #activateIslandBtn {
  display: none !important;
}

.island-workspace {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

.island-workspace-sticky {
  position: sticky;
  z-index: 20;
  top: 0;
  display: grid;
  flex: none;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 253, 250, 0.98);
  box-shadow: 0 8px 24px rgba(30, 24, 20, 0.08);
}

.island-workspace-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.island-workspace-title > div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.island-workspace-title > div > strong {
  font-size: 17px;
}

.island-workspace-title > div > span,
.island-workspace-title > div > small {
  color: var(--muted);
  font-size: 11px;
}

.island-validity {
  flex: none;
  padding: 5px 7px;
  border-radius: 999px;
  background: #eee8dd;
  color: #6c6255;
  font-size: 10px;
  font-weight: 800;
}

.island-validity.is-valid {
  background: #dff1ef;
  color: #0d6269;
}

.island-validity.is-warning {
  background: #fff0e8;
  color: #963c24;
}

.island-finish-action {
  width: 100%;
  min-height: 36px;
  border-color: #80bbb2;
  background: #dff1ef;
  color: #0d6269;
  font-weight: 900;
}

.island-finish-action:hover,
.island-finish-action:focus-visible {
  border-color: #0d757d;
  background: #cae8e4;
}

.island-selector-row {
  display: grid;
  grid-template-columns: 1fr minmax(120px, 1.15fr);
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.island-selector-row select {
  width: 100%;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  padding: 0 8px;
}

.island-quick-nav {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
}

.island-quick-nav button {
  min-height: 29px;
  padding: 0 4px;
  border-color: transparent;
  background: #f3eee6;
  font-size: 10px;
  font-weight: 800;
}

.island-quick-nav button.is-active {
  border-color: var(--accent);
  background: #dff1ef;
  color: #0d5158;
}

.island-workspace-control {
  display: grid;
  gap: 4px;
}

.island-workspace-control > span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.island-layout-switch,
.island-row-switch {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.island-seating-switch {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.island-workspace-sticky .segmented {
  gap: 3px;
  padding: 3px;
}

.island-workspace-sticky .segmented button {
  min-height: 29px;
  font-size: 11px;
}

.island-workspace-sticky .zone-switch {
  margin-top: 0;
}

.island-extension-field {
  grid-template-columns: 1fr 92px;
  gap: 8px;
}

.island-extension-field input {
  height: 30px;
}

.island-row-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.island-row-summary span {
  padding: 4px 6px;
  border-radius: 6px;
  background: #f3eee6;
  color: var(--muted);
  font-size: 10px;
}

.island-row-summary strong {
  color: var(--ink);
}

.island-workspace-sticky .island-structure-validation {
  max-height: 42px;
  margin: 0;
  overflow: auto;
  font-size: 10px;
}

.island-workspace:not([data-active-workspace-target="structure"]) .island-workspace-sticky > .island-workspace-control,
.island-workspace:not([data-active-workspace-target="structure"]) .island-workspace-sticky > .island-extension-field,
.island-workspace:not([data-active-workspace-target="structure"]) .island-workspace-sticky > .island-row-summary,
.island-workspace:not([data-active-workspace-target="structure"]) .island-workspace-sticky > .island-structure-validation {
  display: none !important;
}

.island-workspace:not([data-active-workspace-target="rows"]):not([data-active-workspace-target="structure"]) .island-workspace-sticky > .island-row-switch {
  display: none !important;
}

.island-workspace-scroll {
  display: grid;
  flex: 1;
  gap: 12px;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 12px;
  scroll-behavior: smooth;
  scroll-padding-top: 8px;
}

.island-workspace-slot:empty {
  display: none;
}

.island-workspace-slot > .panel,
.island-active-row-section,
.island-settings-section {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fffdfa;
  box-shadow: 0 8px 20px rgba(30, 24, 20, 0.06);
}

.island-workspace-slot > .panel {
  margin: 0;
}

.island-catalog-target {
  margin: 0;
  padding: 8px 9px;
  border-radius: 7px;
  background: #dff1ef;
  color: #0d5158;
  font-size: 12px;
  font-weight: 900;
}

.island-row-select {
  justify-content: flex-start;
  min-height: 30px;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
}

.island-row-select:hover {
  border-color: transparent;
  background: transparent;
  color: var(--accent);
}

.island-row-order-actions button {
  min-width: 26px;
  min-height: 28px;
  padding: 2px 6px;
}

.material-gallery-status {
  grid-column: 1 / -1;
  padding: 7px 8px;
  border: 1px solid #c6e2df;
  border-radius: 7px;
  background: #eef8f7;
  color: #14545b;
  font-size: 11px;
  font-weight: 700;
}

.material-gallery-status.is-empty {
  border-color: var(--line);
  background: #f6f2ea;
  color: var(--muted);
}

.material-gallery-status.is-error {
  border-color: #efb7a7;
  background: #fff2ed;
  color: #8d321b;
}

.swatch-chip {
  position: relative;
  overflow: hidden;
}

.material-thumbnail {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.material-thumbnail.is-error {
  display: none;
}

.island-top-actions {
  order: 6;
  display: grid;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(40, 32, 27, 0.12);
}

.island-top-actions > button {
  width: 100%;
}

#activateIslandBtn,
#editIslandBtn {
  border-color: rgba(13, 117, 125, 0.28);
  background: rgba(255, 255, 255, 0.88);
  color: #184d52;
  font-weight: 850;
}

#activateIslandBtn:hover,
#editIslandBtn:hover,
#activateIslandBtn:focus-visible,
#editIslandBtn:focus-visible {
  border-color: #0d757d;
  background: #eaf6f4;
}

.selected-island-info {
  padding: 2px 4px;
  color: #184d52;
  font-size: 10px;
  font-weight: 800;
  text-align: center;
}

.island-edit-picker {
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid rgba(13, 117, 125, 0.22);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.96);
}

.island-edit-picker[hidden] {
  display: none;
}

.island-edit-picker label {
  color: #443b33;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.3;
}

.island-edit-picker select {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  padding: 0 7px;
  font-size: 11px;
}

.swatch-chip.is-color-fallback::after {
  content: "Culoare";
  position: absolute;
  right: 4px;
  bottom: 4px;
  padding: 2px 4px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.8);
  color: #443b33;
  font-size: 8px;
  font-weight: 800;
}

@media (max-width: 760px) {
  .island-workspace-sticky {
    padding: 9px;
  }

  .island-quick-nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .island-workspace-scroll {
    padding: 9px;
  }

  .top-actions {
    max-height: calc(100dvh - 110px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }
}

@media (max-width: 520px) {
  .sidebar {
    padding: 16px;
  }

  .catalog-grid,
  .catalog-section-grid,
  .button-row {
    grid-template-columns: 1fr 1fr;
  }

  .topbar {
    top: 10px;
    left: 10px;
    right: 10px;
    grid-template-columns: 1fr;
  }

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

  .selection-toolbar {
    grid-template-columns: 1fr;
  }

  .toolbar-actions,
  .top-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .size-control {
    grid-column: 1 / -1;
  }

  .toolbar-actions button,
  .top-actions button {
    width: 100%;
  }
}
