/* Editor shell specifics */
#editor-root { font-feature-settings: 'cv11', 'ss01'; }
#stage { overflow: hidden; }
#canvas-wrap { will-change: transform; }
#design-canvas { cursor: crosshair; image-rendering: auto; }
#design-canvas[data-current-tool='select'] { cursor: default; }
#design-canvas[data-current-tool='text'] { cursor: text; }
#panel-body .field { display: block; margin-bottom: 10px; }
#panel-body .field span { display: block; margin-bottom: 4px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: #71717a; }
.dark #panel-body .field span { color: #a1a1aa; }
#panel-body input[type='text'], #panel-body textarea, #panel-body select {
  width: 100%; border-radius: 8px; border: 1px solid #d4d4d8; background: transparent; color: inherit;
  padding: 8px 10px; font-size: 13px; outline: none;
}
.dark #panel-body input[type='text'], .dark #panel-body textarea, .dark #panel-body select { border-color: #3f3f46; }
#panel-body textarea { min-height: 62px; resize: vertical; }
.panel-btn {
  display: flex; width: 100%; align-items: center; justify-content: center; gap: 6px;
  height: 36px; border-radius: 8px; font-size: 12px; font-weight: 600; cursor: pointer;
  background: #18181b; color: #fff; border: 0;
}
.dark .panel-btn { background: #fafafa; color: #18181b; }
.panel-btn:hover { opacity: .9; }
.panel-btn.ghost { background: transparent; border: 1px solid #d4d4d8; color: inherit; }
.dark .panel-btn.ghost { border-color: #3f3f46; }
.panel-btn[disabled] { opacity: .5; cursor: not-allowed; }
.swatch { width: 100%; aspect-ratio: 1; border-radius: 6px; border: 1px solid rgba(0,0,0,.12); cursor: pointer; }
.swatch[aria-pressed='true'] { outline: 2px solid #2563eb; outline-offset: 1px; }
.layer-row {
  display: flex; align-items: center; gap: 6px; border-radius: 8px; padding: 5px 6px; font-size: 12px;
  cursor: pointer;
}
.layer-row:hover { background: rgba(0,0,0,.05); }
.dark .layer-row:hover { background: rgba(255,255,255,.06); }
.layer-row[aria-selected='true'] { background: rgba(37,99,235,.14); }
.rail-active { background: #2563eb !important; color: #fff !important; }
.plate-opt { border-radius: 8px; overflow: hidden; border: 1px solid #d4d4d8; cursor: pointer; }
.dark .plate-opt { border-color: #3f3f46; }
.plate-opt img { display: block; width: 100%; aspect-ratio: 420/180; object-fit: cover; }
.hist-row { display: flex; gap: 8px; align-items: center; font-size: 12px; padding: 5px 6px; border-radius: 6px; cursor: pointer; }
.hist-row:hover { background: rgba(0,0,0,.05); }
.dark .hist-row:hover { background: rgba(255,255,255,.06); }

/* ---------- floating zone colour palette ---------- */
.zone-palette {
  position: absolute;
  display: none;
  align-items: center;
  gap: 5px;
  padding: 6px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.22);
  z-index: 1300;
  animation: zp-in 0.14s ease-out;
}
.dark .zone-palette {
  background: #171717;
  border-color: #2e2e2e;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
}
.zone-palette.is-open { display: flex; }
@keyframes zp-in {
  from { opacity: 0; transform: translateY(4px) scale(0.96); }
  to { opacity: 1; transform: none; }
}
.zone-palette .zp-swatch {
  position: relative;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  cursor: pointer;
  padding: 0;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.zone-palette .zp-swatch:hover { transform: translateY(-1px); box-shadow: 0 3px 10px rgba(0, 0, 0, 0.22); }
.zone-palette .zp-custom { overflow: hidden; }
.zone-palette .zp-custom input[type='color'] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  border: 0;
  padding: 0;
}
.zone-palette .zp-rainbow {
  position: absolute;
  inset: 0;
  background: conic-gradient(from 0deg, #ff3b30, #ff9500, #ffcc00, #34c759, #00c7be, #007aff, #5856d6, #af52de, #ff2d55, #ff3b30);
}
.zone-palette .zp-sep { width: 1px; height: 20px; background: rgba(0, 0, 0, 0.12); margin: 0 2px; }
.dark .zone-palette .zp-sep { background: rgba(255, 255, 255, 0.16); }
.zone-palette .zp-clear {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: #71717a;
  background: transparent;
}
.dark .zone-palette .zp-clear { color: #a1a1aa; }
.zone-palette .zp-clear:hover { color: #dc2626; }

/* ---------- first-run hint ---------- */
#editor-hint {
  position: absolute;
  left: 50%;
  bottom: 96px;
  transform: translateX(-50%);
  max-width: min(520px, 80vw);
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(17, 17, 17, 0.92);
  color: #fafafa;
  font-size: 12px;
  line-height: 1.5;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  z-index: 1200;
  cursor: pointer;
  animation: zp-in 0.2s ease-out;
}
#editor-hint strong { color: #60a5fa; }

/* ============================================================
   Responsive editor: tablets and phones
   ============================================================ */
@media (max-width: 1023px) {
  #editor-root header {
    height: 48px;
    padding-inline: 8px;
    gap: 4px;
    flex-wrap: nowrap;
  }
  #editor-root header > a { height: 32px; width: 32px; }
  #editor-root header > a svg { height: 22px; width: 22px; }
  #veh-trigger { white-space: nowrap; padding-inline: 6px; }
  #veh-trigger span[data-veh-label] {
    max-width: 96px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: inline-block;
    vertical-align: bottom;
  }
  #btn-save { padding-inline: 6px; }
  #btn-save svg + * , #btn-save { font-size: 12px; }
  #btn-quote, #btn-share { display: none !important; }
  #btn-lang span { display: none; }
  #btn-export { padding-inline: 10px; }
  #editor-auth button, #editor-auth a { padding: 6px 10px; font-size: 11px; }

  /* left rail: icons only */
  #editor-root .absolute.left-4.top-4 {
    left: 8px !important;
    top: 8px !important;
    width: 46px !important;
    padding: 4px !important;
    gap: 2px !important;
  }
  #editor-root .absolute.left-4.top-4 button { padding-block: 7px !important; }
  #editor-root .absolute.left-4.top-4 button span { display: none; }

  /* side panel becomes a bottom sheet */
  #side-panel {
    left: 0 !important;
    right: 0 !important;
    width: auto !important;
    top: auto !important;
    bottom: 0 !important;
    max-height: 52vh;
    overflow-y: auto;
    border-radius: 16px 16px 0 0 !important;
    transform: translateY(112%);
    transition: transform 0.22s cubic-bezier(0.2, 0.9, 0.3, 1);
    z-index: 1400 !important;
  }
  #side-panel.is-open { transform: translateY(0); }
  #side-panel .panel-sheet-handle { display: block; }

  /* 3D preview: compact card */
  #editor-root .absolute.right-4.top-4 {
    right: 8px !important;
    top: 8px !important;
    width: 152px !important;
    height: 112px !important;
    border-radius: 12px;
  }
  #editor-root .absolute.right-4.top-4 .absolute.left-2.top-2 { font-size: 8px !important; padding: 2px 5px !important; }

  /* toolbar + zoom sit above the bottom edge */
  .floating-toolbar {
    bottom: 10px !important;
    padding: 4px 6px !important;
    max-width: calc(100vw - 16px);
    overflow-x: auto;
    gap: 2px !important;
    border-radius: 10px !important;
  }
  .floating-toolbar button { height: 32px !important; width: 32px !important; }
  .floating-toolbar input[type='range'] { width: 56px !important; }
  #editor-root .absolute.bottom-6.left-4 {
    bottom: 58px !important;
    left: 8px !important;
    padding: 2px !important;
  }
  #tool-settings {
    bottom: 58px !important;
    max-width: calc(100vw - 16px);
    padding: 6px 8px !important;
  }
  #tool-settings input[type='range'] { width: 72px !important; }
  body.sheet-open .floating-toolbar,
  body.sheet-open #editor-root .absolute.bottom-6.left-4,
  body.sheet-open #tool-settings { display: none !important; }
  #editor-hint { bottom: 110px !important; font-size: 11px; }
}

@media (max-width: 480px) {
  #editor-root header > .ms-auto { gap: 4px !important; }
  #btn-export span { display: none; }
  #editor-root .absolute.right-4.top-4 { width: 120px !important; height: 90px !important; }
}

/* panel sheet handle (mobile only) */
.panel-sheet-handle { display: none; }
