/* PDF Editor workspace — Phase 1 */
.editor-limits {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--peach, #f3d7b8) 35%, #fff);
  border: 1px solid color-mix(in srgb, var(--line, #e7dccb) 80%, #d9c4a8);
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--ink, #2b261f);
}
.editor-limits strong { font-weight: 700; }
.editor-workspace {
  display: grid;
  grid-template-columns: minmax(112px, 148px) minmax(0, 1fr) minmax(220px, 280px);
  gap: 14px;
  align-items: start;
  margin-top: 8px;
}
.editor-rail,
.editor-stage,
.editor-tools {
  background: var(--card, #fffdf8);
  border: 1px solid var(--line, #e7dccb);
  border-radius: 18px;
  padding: 12px;
  min-width: 0;
}
.editor-rail h3,
.editor-tools h3 {
  margin: 0 0 10px;
  font-size: 0.95rem;
}
.editor-thumbs {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
  max-height: min(70vh, 640px);
  overflow: auto;
}
.editor-thumb {
  position: relative;
  border: 2px solid transparent;
  border-radius: 12px;
  padding: 6px;
  background: #f7f1e6;
  cursor: grab;
  touch-action: manipulation;
}
.editor-thumb.is-active { border-color: var(--accent, #b94d27); }
.editor-thumb.is-discarded { opacity: 0.45; }
.editor-thumb.is-dragging { opacity: 0.55; }
.editor-thumb canvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
  background: #fff;
}
.editor-thumb-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: 0.78rem;
  color: var(--muted, #71665d);
}
.editor-thumb-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}
.editor-thumb-actions button {
  min-height: 36px;
  padding: 4px 8px;
  font-size: 0.78rem;
}
.editor-stage-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.editor-stage-head p {
  margin: 0;
  color: var(--muted, #71665d);
  font-size: 0.88rem;
}
.editor-canvas-wrap {
  position: relative;
  width: 100%;
  min-height: 220px;
  border-radius: 14px;
  background: repeating-conic-gradient(#efe6d8 0% 25%, #f7f1e6 0% 50%) 50% / 18px 18px;
  overflow: hidden;
  display: grid;
  place-items: center;
}
.editor-canvas-wrap.is-placeable { cursor: crosshair; }
#preview-canvas {
  display: block;
  max-width: 100%;
  height: auto;
  background: #fff;
  box-shadow: 0 8px 28px rgba(40, 28, 12, 0.12);
}
.editor-overlay-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.editor-overlay-marker {
  position: absolute;
  transform: translate(-50%, -50%);
  max-width: 46%;
  padding: 4px 8px;
  border-radius: 8px;
  background: rgba(255, 248, 239, 0.92);
  border: 1px dashed var(--accent, #b94d27);
  color: var(--ink, #2b261f);
  font-size: 0.78rem;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.editor-mode-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 12px;
}
.editor-mode-tabs button {
  min-height: 44px;
}
.editor-mode-tabs button[aria-pressed="true"] {
  background: color-mix(in srgb, var(--accent, #b94d27) 14%, #fff);
  border-color: var(--accent, #b94d27);
  color: var(--accent, #b94d27);
  font-weight: 700;
}
.editor-panel[hidden] { display: none !important; }
.editor-panel .control-field { margin-bottom: 12px; }
.editor-sign-canvas-wrap {
  border: 1px solid var(--line, #e7dccb);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}
#sign-canvas {
  display: block;
  width: 100%;
  height: 140px;
  touch-action: none;
  cursor: crosshair;
}
.editor-overlay-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: grid;
  gap: 6px;
  max-height: 160px;
  overflow: auto;
}
.editor-overlay-list li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 10px;
  background: #f7f1e6;
  font-size: 0.85rem;
}
.editor-empty {
  text-align: center;
  padding: 28px 12px;
  color: var(--muted, #71665d);
}
.editor-workspace[data-ready="false"] .editor-rail,
.editor-workspace[data-ready="false"] .editor-stage,
.editor-workspace[data-ready="false"] .editor-tools {
  opacity: 0.55;
  pointer-events: none;
}

@media (max-width: 980px) {
  .editor-workspace {
    grid-template-columns: 1fr;
  }
  .editor-thumbs {
    display: flex;
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 8px;
    padding-bottom: 4px;
  }
  .editor-thumb {
    flex: 0 0 112px;
  }
  .editor-workspace[data-ready="false"] .editor-rail,
  .editor-workspace[data-ready="false"] .editor-stage,
  .editor-workspace[data-ready="false"] .editor-tools {
    opacity: 1;
    pointer-events: auto;
  }
  .editor-workspace[data-ready="false"] .editor-rail,
  .editor-workspace[data-ready="false"] .editor-tools {
    display: none;
  }
}

@media (max-width: 390px) {
  .editor-mode-tabs { gap: 4px; }
  .editor-mode-tabs button { font-size: 0.82rem; padding: 6px 4px; }
  .editor-thumb-actions button { min-height: 40px; }
}

.editor-mode-tabs-6 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.editor-crop-guide {
  position: absolute;
  pointer-events: none;
  border: 2px dashed var(--accent, #b94d27);
  box-shadow: 0 0 0 9999px rgba(30, 22, 12, 0.35);
  border-radius: 2px;
  z-index: 2;
}
@media (max-width: 390px) {
  .editor-mode-tabs-6 button { font-size: 0.72rem; padding: 4px 2px; min-height: 40px; }
}
