/* ============================================================
   CARFICATE EDITOR — Light Theme
   ============================================================ */

/* ── PAGE LAYOUT ────────────────────────────────────────────── */
body.editor-body {
  background: #f2f1ef;
}

.editor-page {
  display: grid;
  grid-template-columns: 500px 1fr;
  min-height: calc(100vh - var(--nav-h));
  padding-top: var(--nav-h);
}

/* Override dark nav for editor */
.editor-body .nav {
  background: rgba(255,255,255,.95);
  border-bottom: 1px solid #e0e0e0;
  backdrop-filter: blur(16px);
}
.editor-body .nav.scrolled {
  background: rgba(255,255,255,.98);
}
.editor-body .brand-name,
.editor-body .navlinks a,
.editor-body .navlinks { color: #111; }
.editor-body .brand-sub { color: #999; }
.editor-body .navlinks a { opacity: .7; }
.editor-body .brand img {
  width: 160px;
  height: 104px;
  mix-blend-mode: multiply;
  filter: contrast(1.8) brightness(0.6);
}
.editor-body .navlinks a:hover { opacity: 1; }
.editor-body .navlinks a.active::after { background: #111; }
.editor-body .nav-cta {
  border-color: rgba(0,0,0,.2);
  background: linear-gradient(180deg, #111, #333);
  color: #fff;
}
.editor-body .nav-cta:hover { border-color: #000; background: #000; }
.editor-body .hamburger span { background: #111; }


/* ── LEFT: FORM PANEL ───────────────────────────────────────── */
.editor-form {
  background: #fff;
  border-right: 1px solid #e4e4e4;
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--nav-h));
  position: sticky;
  top: var(--nav-h);
  overflow: hidden;
}

/* ── STEP TABS ──────────────────────────────────────────────── */
.editor-steps {
  display: flex;
  border-bottom: 1px solid #ebebeb;
  flex-shrink: 0;
  background: #fafafa;
}
.editor-step {
  flex: 1;
  padding: 11px 6px;
  text-align: center;
  font-size: 9px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: #bbb;
  cursor: pointer;
  border-right: 1px solid #ebebeb;
  border-bottom: 2px solid transparent;
  transition: color .18s, border-color .18s, background .18s;
  user-select: none;
}
.editor-step:last-child { border-right: none; }
.editor-step.active  { color: #111; border-bottom-color: #111; background: #fff; }
.editor-step.done    { color: #888; }
.editor-step-num     { display: block; font-size: 12px; font-weight: 700; margin-bottom: 2px; }

/* ── SCROLLABLE FIELDS ──────────────────────────────────────── */
.editor-fields {
  flex: 1;
  overflow-y: auto;
  padding: 20px 32px;
  scrollbar-width: thin;
  scrollbar-color: #ddd transparent;
}
.editor-fields::-webkit-scrollbar { width: 3px; }
.editor-fields::-webkit-scrollbar-thumb { background: #ddd; }

.editor-panel { display: none; }
.editor-panel.active { display: block; }

.editor-panel-title {
  font-size: 17px;
  font-weight: 600;
  color: #111;
  margin-bottom: 4px;
  letter-spacing: -.2px;
}
.editor-panel-sub {
  font-size: 13px;
  color: #888;
  margin-bottom: 14px;
  line-height: 1.4;
}

/* ── FORM ELEMENTS ──────────────────────────────────────────── */
.f-row   { display: grid; gap: 14px; margin-bottom: 16px; }
.f-row.c2 { grid-template-columns: 1fr 1fr; }
.f-row.c3 { grid-template-columns: 1fr 1fr 1fr; }
.f-group { display: flex; flex-direction: column; gap: 6px; }

.f-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #555;
}
.f-input, .f-select, .f-textarea {
  background: #fff;
  border: 1.5px solid #ddd;
  border-radius: 6px;
  color: #111;
  font-family: inherit;
  font-size: 14px;
  font-weight: 400;
  padding: 11px 14px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  width: 100%;
}
.f-input:focus, .f-select:focus, .f-textarea:focus {
  border-color: #111;
  box-shadow: 0 0 0 3px rgba(0,0,0,.07);
}
.f-input::placeholder { color: #ccc; }
.f-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M5 6L0 0h10z' fill='%23999'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}
.f-textarea { min-height: 100px; resize: vertical; }
.f-hint { font-size: 11px; color: #aaa; margin-top: 4px; }
.f-hint-inline { font-size: 10px; color: #bbb; font-weight: 400; text-transform: none; letter-spacing: 0; margin-left: 4px; }

/* ── PHOTO UPLOAD ───────────────────────────────────────────── */
.upload-zone {
  border: 2px dashed #d0d0d0;
  border-radius: 10px;
  padding: 0;
  text-align: center;
  cursor: pointer;
  position: relative;
  transition: border-color .2s, background .2s;
  margin-bottom: 12px;
  background: #fafafa;
  overflow: hidden;
  min-height: 150px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.upload-zone:hover { border-color: #888; background: #f5f5f5; }
.upload-zone.has-image { border-style: solid; border-color: #111; }
.upload-zone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; z-index: 2; }
.upload-placeholder { padding: 22px 24px; pointer-events: none; }
.upload-icon  { font-size: 28px; margin-bottom: 8px; }
.upload-label { font-size: 14px; font-weight: 500; color: #333; margin-bottom: 4px; }
.upload-sub   { font-size: 12px; color: #aaa; }
.upload-preview-img {
  width: 100%; height: 150px;
  object-fit: cover;
  display: none;
}
.upload-preview-img.visible { display: block; }
.upload-actions {
  position: absolute; bottom: 10px; right: 10px; z-index: 3;
  display: none;
  gap: 6px;
}
.upload-action-btn {
  background: rgba(0,0,0,.6); color: #fff;
  font-size: 10px; letter-spacing: .1em; text-transform: uppercase;
  padding: 5px 10px; border-radius: 3px;
  cursor: pointer;
  pointer-events: all;
  transition: background .15s;
}
.upload-action-btn:hover { background: rgba(0,0,0,.8); }
.upload-action-btn.upload-remove-btn:hover { background: #c0392b; }
.upload-zone.has-image .upload-actions { display: flex; }
.upload-zone.has-image .upload-placeholder { display: none; }

/* ── PHOTO POSITION/ZOOM ADJUST ───────────────────────────────── */
.photo-adjust {
  display: none;
  margin-bottom: 10px;
  padding: 10px 14px;
  background: #fafafa;
  border: 1.5px solid #e8e6e3;
  border-radius: 10px;
}
.photo-adjust.visible { display: block; }
.photo-adjust-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.photo-adjust-head .f-label { margin-bottom: 0; }
.crop-toggle-btn {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #555;
  background: #fff;
  border: 1.5px solid #ddd;
  border-radius: 20px;
  padding: 6px 14px;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s, color .15s, border-color .15s;
  white-space: nowrap;
}
.crop-toggle-btn:hover { border-color: #bbb; }
.crop-toggle-btn.active { background: #c8a96e; color: #fff; border-color: #c8a96e; }
.photo-adjust-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.photo-adjust-row .f-label { margin-bottom: 0; white-space: nowrap; }
.photo-adjust-row input[type="range"] {
  flex: 1;
  accent-color: #111;
}
.photo-reset-btn {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #555;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  font-family: inherit;
}
.photo-reset-btn:hover { color: #111; }

/* ── PHOTO QUALITY CHECK ────────────────────────────────────── */
.quality-check {
  display: none;
  margin-bottom: 10px;
  padding: 10px 14px;
  background: #fafafa;
  border: 1.5px solid #e8e6e3;
  border-radius: 10px;
}
.quality-check.visible { display: block; }

.quality-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.quality-head .f-label { margin-bottom: 0; }

.quality-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 20px;
  white-space: nowrap;
}
.quality-badge.q-great { background: #e3f3e6; color: #1f8a3d; }
.quality-badge.q-good  { background: #ecf2ed; color: #57795a; }
.quality-badge.q-risky { background: #fdf0e3; color: #b9650f; }
.quality-badge.q-low   { background: #fbe7e7; color: #c0392b; }

.quality-rows {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
}
.quality-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 11px;
  color: #888;
}
.quality-row span:last-child {
  color: #333;
  font-weight: 600;
}

.quality-message {
  font-size: 11px;
  line-height: 1.45;
  color: #555;
  margin: 0;
}

.quality-tips {
  display: none;
  margin: 8px 0 0;
  padding-left: 16px;
  font-size: 10.5px;
  line-height: 1.5;
  color: #888;
}
.quality-tips.visible { display: block; }
.quality-tips li { margin-bottom: 2px; }

/* ── OWNER IDENTITY / CF NUMBER ────────────────────────────────── */
.hidden { display: none !important; }

.identity-section {
  margin-bottom: 20px;
  padding: 14px 14px 4px;
  background: #fafafa;
  border: 1.5px solid #e8e6e3;
  border-radius: 10px;
}
.identity-section .f-label { margin-bottom: 10px; }
.identity-section .f-row:last-of-type { margin-bottom: 12px; }

.pseudo-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  margin-bottom: 12px;
  background: #fff;
  border: 1.5px solid #ddd;
  border-radius: 8px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.pseudo-toggle:hover { border-color: #bbb; }
.pseudo-toggle.active { border-color: #111; background: #f5f5f5; }
.pseudo-toggle-label {
  font-size: 13px;
  font-weight: 600;
  color: #111;
  margin-bottom: 2px;
}
.pseudo-toggle-desc {
  font-size: 11px;
  color: #999;
  line-height: 1.4;
}
.pseudo-toggle-check {
  flex-shrink: 0;
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 1.5px solid #ccc;
  background: #fff;
  color: transparent;
  font-size: 12px;
  font-weight: 700;
  line-height: 17px;
  text-align: center;
  transition: background .15s, border-color .15s, color .15s;
}
.pseudo-toggle.active .pseudo-toggle-check {
  background: #111;
  border-color: #111;
  color: #fff;
}

.pseudo-input-wrap { display: none; margin-bottom: 12px; }
.pseudo-input-wrap.visible { display: block; }

.cf-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 12px;
  background: #fff;
  border: 1.5px solid #ddd;
  border-radius: 8px;
  flex-wrap: wrap;
}
.cf-preview-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #999;
}
.cf-preview-value {
  font-family: 'Courier New', monospace;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .04em;
  color: #111;
}

/* ── STORY EDITOR ───────────────────────────────────────────── */
.story-section {
  margin-top: 20px;
  border: 2px solid #c8a96e;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}
.story-section-header {
  padding: 18px 18px 0;
}
.story-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: 'Cinzel', serif;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: #c8a96e;
  background: rgba(200,169,110,.1);
  border: 1px solid rgba(200,169,110,.35);
  border-radius: 20px;
  padding: 4px 10px;
  margin-bottom: 10px;
}
.story-title {
  font-family: 'Cinzel', serif;
  font-size: 16px;
  font-weight: 600;
  color: #111;
  letter-spacing: .3px;
  margin: 0 0 8px;
  line-height: 1.3;
}
.story-hint {
  font-size: 12.5px;
  color: #888;
  margin: 0 0 16px;
  line-height: 1.55;
}
.story-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 7px 12px;
  border-top: 1px solid rgba(200,169,110,.2);
  border-bottom: 1px solid rgba(200,169,110,.2);
  background: rgba(200,169,110,.05);
}
.story-tb-btn {
  width: 30px; height: 28px;
  border: none;
  background: transparent;
  border-radius: 5px;
  cursor: pointer;
  font-size: 13px;
  color: #555;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .12s, color .12s;
  font-family: inherit;
  line-height: 1;
}
.story-tb-btn:hover { background: rgba(200,169,110,.15); color: #111; }
.story-tb-btn.active { background: #c8a96e; color: #fff; }
.story-tb-sep {
  width: 1px;
  height: 18px;
  background: rgba(200,169,110,.3);
  margin: 0 4px;
  flex-shrink: 0;
}
.story-editor {
  font-family: 'Lora', Georgia, serif;
  font-size: 14.5px;
  line-height: 1.85;
  color: #1a1a1a;
  min-height: 160px;
  max-height: 320px;
  overflow-y: auto;
  padding: 16px 18px 20px;
  outline: none;
}
.story-editor:empty::before {
  content: attr(data-placeholder);
  color: #c8b98a;
  pointer-events: none;
  font-style: italic;
}
.story-editor b, .story-editor strong { font-weight: 600; }
.story-editor i, .story-editor em { font-style: italic; }
.story-editor u { text-decoration: underline; }
.story-editor ul { margin: 6px 0 6px 18px; padding: 0; }
.story-editor li { margin-bottom: 3px; }
.story-char-count {
  font-size: 10px;
  color: #c8a96e;
  letter-spacing: .02em;
  opacity: .7;
}
.story-char-count.warn { color: #e07b2a; opacity: 1; }

/* Zapisz bar */
.story-save-bar {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}
.story-save-btn {
  background: #111;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 9px 20px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .04em;
  cursor: pointer;
  transition: background .15s, transform .1s;
}
.story-save-btn:hover { background: #2a2a2a; }
.story-save-btn:active { transform: scale(.97); }
.story-save-btn.saved { background: #2d6a3f; }

/* ── SIZE SELECTOR ──────────────────────────────────────────── */
.size-selector-bar {
  flex-shrink: 0;
  padding: 14px 32px;
  border-bottom: 1px solid #ebebeb;
  background: #fff;
}
.size-selector { margin-bottom: 0; }
.size-selector-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #555;
  margin-bottom: 2px;
}
.size-selector-sub {
  font-size: 13px;
  font-weight: 700;
  color: #111;
  letter-spacing: .04em;
  margin-bottom: 10px;
}
.size-btns {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}
.size-btn {
  border: 1.5px solid #ddd;
  border-radius: 8px;
  padding: 10px 8px;
  text-align: center;
  cursor: pointer;
  background: #fff;
  transition: border-color .15s, box-shadow .15s, background .15s;
  position: relative;
}
.size-btn:hover { border-color: #888; background: #fafafa; }
.size-btn.active {
  border-color: #1f8a3d;
  background: #f3faf4;
  box-shadow: 0 0 0 3px rgba(31,138,61,.14);
}
.size-btn.active .size-btn-letter,
.size-btn.active .size-btn-price {
  color: #1f8a3d;
}
.size-btn.active::after {
  content: '✓';
  position: absolute;
  top: 6px; right: 6px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #1f8a3d;
  color: #fff;
  font-size: 10px;
  line-height: 16px;
  font-weight: 700;
}
.size-btn-letter {
  font-size: 22px;
  font-weight: 700;
  color: #111;
  line-height: 1;
  margin-bottom: 4px;
}
.size-btn-name {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #333;
  margin-bottom: 3px;
}
.size-btn-dims {
  font-size: 10px;
  color: #999;
  line-height: 1.4;
}
.size-btn-price {
  font-size: 12px;
  font-weight: 700;
  color: #111;
  margin-top: 6px;
}
.size-btn-badge {
  position: absolute;
  top: -8px; left: 50%;
  transform: translateX(-50%);
  background: #111;
  color: #fff;
  font-size: 8px;
  letter-spacing: .1em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 20px;
  white-space: nowrap;
}

/* Disabled (not yet available) size option */
.size-btn.disabled {
  opacity: .4;
  cursor: not-allowed;
  pointer-events: none;
}
.size-btn-soon {
  position: absolute;
  top: -8px; left: 50%;
  transform: translateX(-50%);
  background: #999;
  color: #fff;
  font-size: 8px;
  letter-spacing: .1em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 20px;
  white-space: nowrap;
}

/* ── BOTTOM NAV BAR ─────────────────────────────────────────── */
.editor-nav-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 32px;
  border-top: 1px solid #ebebeb;
  background: #fff;
  flex-shrink: 0;
  gap: 12px;
}
.editor-nav-bar .step-info { font-size: 11px; color: #bbb; letter-spacing: .08em; }
.btn-back-light {
  height: 40px; padding: 0 20px;
  border: 1.5px solid #ddd; border-radius: 6px;
  background: #fff; color: #555;
  font-family: inherit; font-size: 12px;
  font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; cursor: pointer;
  transition: border-color .15s, color .15s;
}
.btn-back-light:hover { border-color: #888; color: #111; }
.btn-next-light {
  height: 40px; padding: 0 24px;
  border: none; border-radius: 6px;
  background: #111; color: #fff;
  font-family: inherit; font-size: 12px;
  font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; cursor: pointer;
  transition: background .15s, transform .15s;
  flex: 1; max-width: 200px;
}
.btn-next-light:hover { background: #000; transform: translateY(-1px); }

/* ── RIGHT: PREVIEW PANEL ───────────────────────────────────── */
.editor-preview {
  background: #eceae7;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: sticky;
  top: var(--nav-h);
  height: calc(100vh - var(--nav-h));
  gap: 24px;
  padding: 40px 48px;
}

/* Front / Rewers toggle */
.plate-side-toggle {
  display: flex;
  gap: 6px;
}
.side-btn {
  padding: 7px 18px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  cursor: pointer;
  color: #888;
  background: #fff;
  border: 1.5px solid #ddd;
  border-radius: 20px;
  font-family: inherit;
  transition: background .15s, color .15s, border-color .15s;
  user-select: none;
}
.side-btn.active { background: #111; color: #fff; border-color: #111; }

/* Plate wrapper */
.plate-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  width: 100%;
}

/* ── PLATE STAGE (3D flip + tilt + drag-to-rotate) ────────────── */
.plate-stage {
  position: relative;
  perspective: 1600px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  touch-action: none;
}
.plate-stage:active,
.plate-stage.dragging {
  cursor: grabbing;
}

/* ── THE PLATE (clean, flippable) ─────────────────────────────── */
.live-plate {
  position: relative;
  transform-style: preserve-3d;
  cursor: grab;
  transition:
    width .35s cubic-bezier(.4,0,.2,1),
    height .35s cubic-bezier(.4,0,.2,1),
    transform .35s cubic-bezier(.4,0,.2,1);
}

/* Faces */
.plate-face {
  position: absolute; inset: 0;
  border-radius: 4px;
  overflow: hidden;
  backface-visibility: hidden;
  border: 1px solid rgba(0,0,0,.06);
  box-shadow: 0 0 0 1px rgba(0,0,0,.04), 0 32px 80px rgba(0,0,0,.18);
}
.plate-front {
  background: linear-gradient(160deg, #f7f6f4 0%, #ebe9e6 100%);
}
.plate-back {
  background:
    repeating-linear-gradient(
      88deg,
      transparent 0px,
      rgba(255,255,255,.04) 1px,
      transparent 2px,
      transparent 5px
    ),
    linear-gradient(165deg,
      #dcdcdc 0%, #c4c4c4 12%,
      #dadadb 30%, #bfbfbf 50%,
      #d6d6d6 68%, #c9c9c9 85%,
      #d3d3d3 100%
    );
  border-color: rgba(0,0,0,.08);
  transform: rotateY(180deg);
}

/* Front photo */
.plate-photo { position: absolute; inset: 0; overflow: hidden; }
.plate-photo-img {
  position: absolute; inset: 0;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  transform-origin: center;
}
.p-photo-placeholder {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 8px; color: rgba(0,0,0,.18);
  font-size: 10px; letter-spacing: .15em; text-transform: uppercase;
}
.plate-photo.has-photo .p-photo-placeholder { display: none; }
.plate-photo.has-photo { cursor: grab; touch-action: none; }
.plate-photo.has-photo:active { cursor: grabbing; }

/* Back placeholder */
.plate-back-content { text-align: center; }
.plate-back-logo {
  display: block; font-size: 11px; letter-spacing: 5px;
  color: rgba(255,255,255,.5); text-transform: uppercase; margin-bottom: 10px;
}
.plate-back-soon {
  display: block; font-size: 10px; letter-spacing: 3px;
  color: rgba(255,255,255,.25); text-transform: uppercase;
}

/* Floating toolbar — top-right corner of the whole editor preview workspace */
.preview-toolbar {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 20;
  display: flex;
  gap: 6px;
}
.plate-zoom-btn,
.plate-scale-btn {
  width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid rgba(0,0,0,.1); background: rgba(255,255,255,.85);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; cursor: pointer; backdrop-filter: blur(4px);
  transition: background .15s, transform .15s;
  font-family: inherit;
}
.plate-zoom-btn:hover,
.plate-scale-btn:hover { background: #fff; transform: scale(1.06); }
.plate-scale-btn { font-size: 16px; font-weight: 600; line-height: 1; color: #333; }

/* Background context selector: visualize the plate in a room setting */
.preview-bg-toggle {
  position: absolute;
  bottom: 16px;
  left: 16px;
  z-index: 20;
  display: flex;
  gap: 6px;
}
.bg-thumb {
  position: relative;
  width: 46px;
  height: 46px;
  padding: 0;
  border-radius: 8px;
  border: 2px solid rgba(255,255,255,.8);
  cursor: pointer;
  overflow: hidden;
  background-size: cover;
  background-position: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.12);
  transition: border-color .15s, transform .15s;
  font-family: inherit;
}
.bg-thumb:hover { transform: scale(1.05); }
.bg-thumb.active { border-color: #c8a96e; box-shadow: 0 2px 10px rgba(0,0,0,.22); }

.bg-thumb-label {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  text-align: center;
  line-height: 1.2;
  padding: 2px 0;
  color: #fff;
  background: rgba(0,0,0,.45);
}

.bg-thumb-none { background-color: #eceae7; }
.bg-thumb-none .bg-thumb-label { color: #555; background: rgba(255,255,255,.75); }

.bg-thumb-garage {
  background-image: url('assets/bg-garage.png');
  background-size: cover;
  background-position: center;
}
.bg-thumb-office {
  background-image: url('assets/bg-office.png');
  background-size: cover;
  background-position: center;
}

/* Photo-based room backgrounds */
.editor-preview.bg-office {
  background-image: url('assets/bg-office.png');
  background-size: cover;
  background-position: center;
}
.editor-preview.bg-office .plate-hint,
.editor-preview.bg-office .preview-size-label {
  color: rgba(255,255,255,.7);
}
.editor-preview.bg-garage {
  background-image: url('assets/bg-garage.png');
  background-size: cover;
  background-position: center;
}
.editor-preview.bg-garage .plate-hint,
.editor-preview.bg-garage .preview-size-label {
  color: rgba(255,255,255,.6);
}

/* In room-context views, hang the plate on the wall: shift it up and
   scale it down to fit the scene. Size variants (A4/M smaller, A3/L
   larger) stay proportional. Plate look stays the same as in the editor. */
.editor-preview.bg-office .plate-wrap,
.editor-preview.bg-garage .plate-wrap {
  transform: translateY(-16%) scale(.78);
}

/* Hint under front/rewers toggle */
.plate-hint { font-size: 11px; color: #aaa; text-align: center; margin-top: 8px; letter-spacing: .03em; }

/* Crop-mode indicator on the preview workspace */
.editor-preview.crop-mode {
  box-shadow: inset 0 0 0 3px #c8a96e;
}
.editor-preview.crop-mode::after {
  content: 'Tryb kadrowania — przeciągnij zdjęcie';
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 20;
  background: #c8a96e;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 8px 14px;
  border-radius: 20px;
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
}
.editor-preview.crop-mode .plate-stage { cursor: default; }
.editor-preview.crop-mode .live-plate { cursor: default; }

/* ── PLATE SIZE VARIANTS ─────────────────────────────────────── */
.live-plate.size-l { width: 280px; height: 396px; }
.live-plate.size-m { width: 240px; height: 340px; }
.live-plate.size-s { width: 190px; height: 267px; }

/* ── LIGHTBOX ───────────────────────────────────────────────── */
.plate-lightbox {
  display: none;
  position: fixed; inset: 0; z-index: 3000;
  background: rgba(20,20,20,.78);
  backdrop-filter: blur(10px);
  align-items: center; justify-content: center;
}
.plate-lightbox.visible { display: flex; }
.plate-lightbox-close {
  position: absolute; top: 24px; right: 28px;
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.25); background: rgba(255,255,255,.08);
  color: #fff; font-size: 16px; cursor: pointer;
  transition: background .15s;
}
.plate-lightbox-close:hover { background: rgba(255,255,255,.18); }
.plate-lightbox-scene {
  perspective: 1800px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.plate-lightbox-plate {
  position: relative;
  border-radius: 6px;
  transform-style: preserve-3d;
  transition: transform .7s cubic-bezier(.4,0,.2,1);
  box-shadow: 0 40px 120px rgba(0,0,0,.6);
}
.plate-lightbox-plate.flipped {
  transform: rotateY(180deg);
}
.plate-lightbox-plate .plate-face {
  position: absolute; inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
  border-radius: 6px;
}
.plate-lightbox-plate.size-s { width: 280px; height: 393px; }
.plate-lightbox-plate.size-m { width: 420px; height: 595px; }
.plate-lightbox-plate.size-l { width: 480px; height: 679px; }

/* Flip button */
.plate-lightbox-flip {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 7px;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 24px;
  color: rgba(255,255,255,.85);
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  letter-spacing: .04em;
  padding: 8px 20px;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: background .15s, border-color .15s;
}
.plate-lightbox-flip:hover {
  background: rgba(255,255,255,.2);
  border-color: rgba(255,255,255,.38);
}
.plf-icon {
  font-size: 17px;
  line-height: 1;
  display: inline-block;
  transition: transform .5s;
}
.plate-lightbox-plate.flipped ~ .plate-lightbox-flip .plf-icon,
.plate-lightbox-flip.flipped-state .plf-icon {
  transform: rotate(180deg);
}

/* ── PREVIEW FOOTER ─────────────────────────────────────────── */
.preview-footer { text-align: center; margin-top: 14px; }
.preview-size-label { font-size: 12px; color: #888; }

/* ── ORDER OVERLAY ───────────────────────────────────────────── */
#order-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(8px);
  align-items: center; justify-content: center;
}
#order-overlay.visible { display: flex; }
.overlay-box {
  background: #fff;
  border-radius: 12px;
  padding: 52px 44px;
  max-width: 480px; width: 92%;
  text-align: center;
  box-shadow: 0 32px 80px rgba(0,0,0,.25);
}
.overlay-icon  { font-size: 48px; margin-bottom: 20px; }
.overlay-title { font-size: 24px; font-weight: 700; color: #111; margin-bottom: 10px; letter-spacing: -.3px; }
.overlay-body  { font-size: 14px; color: #666; line-height: 1.7; margin-bottom: 28px; }
.overlay-body strong { color: #111; }

/* ── FIELD VALIDATION ───────────────────────────────────────── */
.f-input.f-error, .f-select.f-error, .f-textarea.f-error {
  border-color: #d33 !important;
  box-shadow: 0 0 0 3px rgba(221,51,51,.08) !important;
}
.f-error-msg {
  font-size: 11px;
  color: #d33;
  margin-top: 5px;
}

/* ── UPLOAD ERROR + DRAG STATE ───────────────────────────────── */
.upload-zone.drag-over { border-color: #111; background: #f0f0f0; }
.upload-error-msg {
  font-size: 11px;
  color: #d33;
  margin: -12px 0 16px;
}

/* ── DIGITAL CERTIFICATE PREVIEW ──────────────────────────────── */
.cert-preview { margin: 4px 0 20px; }
.cert-preview-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #888;
  margin-bottom: 12px;
}
/* ── ORDER FORM SECTIONS ────────────────────────────────────── */
.order-summary-box {
  background: #f4fbf6;
  border: 2px solid #1f8a3d;
  border-radius: 10px;
  padding: 16px 18px;
  margin-bottom: 16px;
}
.order-summary-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #1f8a3d;
  margin-bottom: 12px;
}
.order-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: #333;
  margin-bottom: 8px;
}
.order-summary-price {
  font-size: 16px;
  font-weight: 700;
  color: #111;
}
.order-summary-shipping {
  display: flex;
  align-items: center;
  gap: 8px;
}
.order-summary-shipping-old {
  font-size: 12px;
  color: #bbb;
  text-decoration: line-through;
}
.order-summary-shipping-free {
  font-size: 12px;
  font-weight: 700;
  color: #1f8a3d;
}
.order-summary-divider {
  height: 1px;
  background: rgba(31,138,61,.15);
  margin-bottom: 8px;
}
.order-summary-cf {
  font-size: 11px;
  color: #888;
}

.order-login-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f5f5f5;
  border: 1px solid #e8e8e8;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 20px;
  font-size: 12px;
  color: #888;
}
.order-login-link {
  color: #111;
  font-weight: 600;
  text-decoration: none;
  font-size: 12px;
}
.order-login-link:hover { text-decoration: underline; }

.order-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #555;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #ebebeb;
}

/* Payment method tiles */
.payment-methods {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 4px;
}
.payment-tile {
  border: 1.5px solid #ddd;
  border-radius: 8px;
  padding: 12px 10px;
  text-align: center;
  cursor: pointer;
  background: #fff;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.payment-tile:hover { border-color: #999; }
.payment-tile.active {
  border-color: #111;
  background: #f8f8f8;
  box-shadow: 0 0 0 3px rgba(0,0,0,.07);
}
.payment-tile-name {
  font-size: 13px;
  font-weight: 700;
  color: #111;
  margin-bottom: 3px;
}
.payment-tile-desc {
  font-size: 10px;
  color: #aaa;
}

/* Account upsell banner */
.account-upsell {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fffbf0;
  border: 1.5px solid #e8c96e;
  border-radius: 10px;
  padding: 14px 16px;
  margin-top: 8px;
}
.account-upsell-icon { font-size: 22px; flex-shrink: 0; }
.account-upsell-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.account-upsell-text strong {
  font-size: 13px;
  color: #111;
}
.account-upsell-text span {
  font-size: 11px;
  color: #888;
  line-height: 1.4;
}
.account-upsell-discount {
  font-weight: 700;
  color: #c8a96e;
}
.account-upsell-btn {
  flex-shrink: 0;
  background: #111;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 9px 14px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: background .15s;
}
.account-upsell-btn:hover { background: #333; }

/* Account creation modal */
.account-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
}
.account-modal-overlay.visible {
  opacity: 1;
  pointer-events: all;
}
.account-modal-box {
  background: #fff;
  border-radius: 20px 20px 0 0;
  padding: 32px 28px 36px;
  width: 100%;
  max-width: 520px;
  position: relative;
  transform: translateY(40px);
  transition: transform .3s ease;
}
.account-modal-overlay.visible .account-modal-box {
  transform: translateY(0);
}
.account-modal-close {
  position: absolute;
  top: 16px; right: 16px;
  background: #f0f0f0;
  border: none;
  width: 30px; height: 30px;
  border-radius: 50%;
  font-size: 12px;
  cursor: pointer;
  color: #555;
  display: flex; align-items: center; justify-content: center;
}
.account-modal-badge {
  display: inline-block;
  background: #fffbf0;
  border: 1px solid #e8c96e;
  color: #b8860b;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  margin-bottom: 14px;
}
.account-modal-title {
  font-family: 'Cinzel', serif;
  font-size: 22px;
  font-weight: 600;
  color: #111;
  line-height: 1.25;
  margin: 0 0 10px;
}
.account-modal-highlight { color: #c8a96e; }
.account-modal-sub {
  font-size: 13px;
  color: #888;
  line-height: 1.5;
  margin-bottom: 16px;
}
.account-modal-perks {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 20px;
  padding: 12px 14px;
  background: #f8f8f8;
  border-radius: 8px;
}
.account-modal-perk {
  font-size: 12px;
  color: #444;
}
.account-modal-cta {
  width: 100%;
  background: #111;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 15px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .04em;
  cursor: pointer;
  font-family: inherit;
  margin-bottom: 10px;
  transition: background .15s;
}
.account-modal-cta:hover { background: #333; }
.account-modal-skip {
  width: 100%;
  background: none;
  border: none;
  color: #aaa;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
  padding: 6px;
  text-decoration: underline;
}
.account-modal-skip:hover { color: #555; }

/* ── CF CERTIFICATE PLATE — authentication plaque ──────────── */

/* Panel preview: center the plate */
.cert-preview-wrap {
  display: flex;
  justify-content: center;
  padding: 4px 0 8px;
}

.cert-note {
  font-size: 11px;
  color: #aaa;
  line-height: 1.6;
  margin-top: 10px;
}

/* The plate itself */
.cf-cert {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 14em;
  min-height: 22.4em; /* 54:86 ≈ 1:1.593 → 14 × 1.593 ≈ 22.3 */
  border-radius: .95em;
  background:
    repeating-linear-gradient(
      88deg,
      transparent 0px,
      rgba(255,255,255,.038) 1px,
      transparent 2px,
      transparent 4px
    ),
    linear-gradient(170deg,
      #dadadb 0%, #c3c4c4 10%,
      #d9dada 28%, #bcbdbd 48%,
      #d5d6d6 66%, #c8c9c9 84%,
      #d2d3d3 100%
    );
  border: .1em solid rgba(0,0,0,.22);
  box-shadow:
    inset 0 0 0 .06em rgba(255,255,255,.5),
    0 .2em .5em rgba(0,0,0,.18);
  color: #1f1f1f;
  overflow: hidden;
  font-size: 10px; /* default — overridden per context */
}

/* Inner double border via ::before */
.cf-cert::before {
  content: '';
  position: absolute;
  inset: .5em;
  border: .07em solid rgba(0,0,0,.14);
  border-radius: .6em;
  pointer-events: none;
  z-index: 0;
}

/* Frame: all content goes here */
.cf-cert-frame {
  position: relative; z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  padding: .9em .85em .65em;
}

/* === CONTEXT SIZES === */
.cf-cert--panel { font-size: 13px; }

/* Rewers cert plaque — inside rb-bottom, flex sibling of tech data */
.cf-cert--rewers {
  position: relative;
  bottom: auto;
  right: auto;
  flex-shrink: 0;
  align-self: stretch;
  box-shadow:
    inset 0 0 0 .06em rgba(255,255,255,.4),
    0 .2em .6em rgba(0,0,0,.3),
    0 .05em .15em rgba(0,0,0,.18);
}
.live-plate.size-m .cf-cert--rewers  { font-size: 4.2px; }
.live-plate.size-l .cf-cert--rewers  { font-size: 5.4px; }
.plate-lightbox-plate.size-m .cf-cert--rewers { font-size: 8.5px; }
.plate-lightbox-plate.size-l .cf-cert--rewers { font-size: 11px; }

/* === QR SECTION === */
.cf-cert-qr-sec {
  width: 100%;
  display: flex;
  justify-content: center;
  margin-bottom: .45em;
}
.cf-cert-qr-wrap {
  position: relative;
  width: 8.6em; height: 8.6em;
}
.cf-qr-canvas { width: 100%; height: 100%; }
.cf-qr-canvas canvas,
.cf-qr-canvas img {
  width: 100% !important;
  height: 100% !important;
  display: block;
}
/* CF shield badge centered in QR */
.cf-cert-qr-logo {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 2.1em; height: 2.5em;
  display: flex; align-items: center; justify-content: center;
  background: rgba(207,208,208,.92);
  border-radius: 18% 18% 48% 48% / 12% 12% 32% 32%;
  padding: .14em .13em;
}
.cf-cert-qr-logo img {
  width: 100%; height: 100%;
  object-fit: contain;
  mix-blend-mode: multiply;
}

/* === SEPARATOR: line · shield · line === */
.cf-cert-sep {
  display: flex; align-items: center; gap: .4em;
  width: 100%; margin-bottom: .38em;
}
.cf-cert-sep-line {
  flex: 1; height: .06em; background: rgba(0,0,0,.2);
}
.cf-cert-sep-icon {
  width: .95em; height: 1.12em;
  object-fit: contain;
  mix-blend-mode: multiply;
  opacity: 0.48;
  flex-shrink: 0;
  display: block;
}

/* === BRAND NAME === */
.cf-cert-brand-name {
  font-family: 'Cinzel', serif;
  font-weight: 400;
  font-size: 1.45em; letter-spacing: .22em;
  color: #1a1a1a;
  text-align: center;
  margin-bottom: .25em;
  white-space: nowrap;
  overflow: hidden;
}

/* === THIN RULE DIVIDER === */
.cf-cert-rule {
  width: 100%;
  height: .06em;
  background: rgba(0,0,0,.17);
  margin: .28em 0;
  flex-shrink: 0;
}

/* === META LABELS === */
.cf-cert-meta-lbl {
  font-size: .72em; letter-spacing: .13em;
  text-transform: uppercase; color: rgba(0,0,0,.32);
  text-align: center; margin-bottom: .18em;
}

/* === CERTIFICATE NUMBER === */
.cf-cert-num-wrap {
  width: 95%;
  border: .09em solid rgba(0,0,0,.22);
  border-radius: .35em;
  padding: .28em .3em;
  text-align: center;
  margin-bottom: .1em;
  background: transparent;
  overflow: hidden;
}
.cf-cert-num {
  font-family: 'Courier New', monospace;
  font-size: 1em; font-weight: 700; letter-spacing: .01em;
  color: #111;
  white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; display: block;
}

/* === VIN === */
.cf-cert-vin-val {
  font-family: 'Courier New', monospace;
  font-size: .86em; color: #1e1e1e; letter-spacing: .04em;
  text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 100%;
  margin-bottom: .05em;
}

/* === BOTTOM ROW: Verifier + Hologram === */
.cf-cert-bottom-row {
  display: flex; align-items: center; gap: .4em;
  width: 100%;
}
.cf-cert-verif-col {
  flex: 1; display: flex; flex-direction: column;
}
.cf-cert-sig {
  font-family: 'Dancing Script', cursive;
  font-weight: 400;
  font-size: 1.65em; color: #1a1a1a; line-height: 1.1;
  margin: .1em 0 .08em;
}
.cf-cert-role {
  font-size: .65em; letter-spacing: .1em;
  color: rgba(0,0,0,.28); text-transform: uppercase;
}

/* Hologram: stamp circle with SVG curved text + iridescent disc */
.cf-cert-holo-col {
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.cf-cert-holo {
  position: relative;
  width: 5em; height: 5em;
  flex-shrink: 0;
}
.cf-cert-holo-stamp {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  overflow: visible;
}
.cf-cert-holo-disc {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 54%; height: 54%;
  border-radius: 50%;
  background: conic-gradient(from 0deg,
    rgba(255,200,200,.75),
    rgba(255,255,170,.75),
    rgba(180,255,185,.75),
    rgba(175,210,255,.75),
    rgba(225,175,255,.75),
    rgba(255,200,200,.75)
  );
  box-shadow: inset 0 0 0 .5px rgba(255,255,255,.45);
}

/* === ARCHIVE ROW === */
.cf-cert-archive-row {
  display: flex; align-items: center; gap: .35em;
  width: 100%;
}
.cf-cert-archive-txt {
  font-size: .68em; letter-spacing: .1em;
  color: rgba(0,0,0,.26); text-transform: uppercase;
  white-space: nowrap; flex-shrink: 0;
}

/* === FOOTER BADGE (shield icon) === */
.cf-cert-footer-badge {
  display: flex; justify-content: center; align-items: center;
  margin-top: .18em;
}
.cf-cert-footer-icon {
  width: 1.2em; height: 1.45em;
  object-fit: contain;
  mix-blend-mode: multiply;
  opacity: 0.42;
  display: block;
}

/* ── REWERS PLATE (plate-back inner layout) ─────────────────── */
.rb {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  font-size: 5.5px; /* base for .size-m preview */
  color: #1a1a1a;
  overflow: hidden;
}
.live-plate.size-l .rb          { font-size: 7px; }
.plate-lightbox-plate.size-m .rb { font-size: 9.5px; }
.plate-lightbox-plate.size-l .rb { font-size: 12.5px; }

.rb-frame {
  position: absolute; inset: 1.6em;
  border: .18em solid rgba(0,0,0,.2);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.rb-frame::before {
  content: '';
  position: absolute; inset: .55em;
  border: .07em solid rgba(0,0,0,.1);
  pointer-events: none;
  z-index: 0;
}

/* Sections stack above ::before */
.rb-header, .rb-gallery, .rb-story, .rb-bottom, .rb-footer {
  position: relative; z-index: 1;
}

/* HEADER */
.rb-header {
  flex-shrink: 0;
  text-align: center;
  padding: .9em 1em .6em;
  border-bottom: .08em solid rgba(0,0,0,.1);
}
.rb-logo {
  font-family: 'Cinzel', serif;
  font-size: 1.15em;
  letter-spacing: .25em;
  color: rgba(0,0,0,.3);
  margin-bottom: .45em;
}
.rb-car-name {
  font-family: 'Cinzel', serif;
  font-size: 2.1em;
  font-weight: 600;
  letter-spacing: .07em;
  color: #111;
  line-height: 1.1;
  margin-bottom: .35em;
  text-shadow: 0 .08em 0 rgba(255,255,255,.7), 0 -.05em 0 rgba(0,0,0,.12);
}
.rb-car-spec {
  display: flex; align-items: center; gap: .6em;
}
.rb-spec-line {
  flex: 1; height: .07em; background: rgba(0,0,0,.18);
}
.rb-spec-text {
  font-size: .95em; letter-spacing: .18em;
  text-transform: uppercase; color: rgba(0,0,0,.4);
  white-space: nowrap;
}

/* GALLERY */
.rb-gallery {
  flex-shrink: 0;
  display: flex; gap: .5em;
  padding: .55em .8em;
  height: 9em;
  border-bottom: .08em solid rgba(0,0,0,.1);
}
.rb-photo {
  flex: 1; position: relative;
  border: .1em solid rgba(0,0,0,.14);
  border-radius: .3em; overflow: hidden;
  background: rgba(0,0,0,.04);
}
.rb-photo-bg {
  position: absolute; inset: 0;
  background-size: cover; background-position: center;
}
.rb-photo-ph {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 1em; letter-spacing: .15em;
  color: rgba(0,0,0,.18); text-transform: uppercase;
}
.rb-photo.has-photo .rb-photo-ph { display: none; }
.rb-photo-label {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: rgba(0,0,0,.42);
  color: rgba(255,255,255,.85);
  font-size: .9em; letter-spacing: .14em;
  text-transform: uppercase; text-align: center;
  padding: .2em 0;
}

/* STORY — fixed height so layout stays stable regardless of content */
.rb-story {
  flex-shrink: 0;
  height: 13em;
  padding: .55em .8em;
  border-bottom: .08em solid rgba(0,0,0,.1);
  display: flex;
  flex-direction: column;
}
.rb-sec-head {
  display: flex; align-items: center; gap: .55em;
  margin-bottom: .5em;
}
.rb-sec-line {
  flex: 1; height: .07em; background: rgba(0,0,0,.18);
}
.rb-sec-label {
  font-size: .95em; letter-spacing: .18em;
  text-transform: uppercase; color: rgba(0,0,0,.38);
  white-space: nowrap;
}
.rb-story-box {
  position: relative;
  flex: 1;
  border: .1em solid rgba(0,0,0,.12);
  border-radius: .2em;
  padding: .55em .7em;
  display: flex;
  align-items: center;
  overflow: hidden;
}
.rb-story-box::before, .rb-story-box::after {
  content: '';
  position: absolute;
  width: .6em; height: .6em;
  border-style: solid;
  border-color: rgba(0,0,0,.22);
}
.rb-story-box::before { top: -.1em; left: -.1em; border-width: .15em 0 0 .15em; }
.rb-story-box::after  { bottom: -.1em; right: -.1em; border-width: 0 .15em .15em 0; }
.rb-story-text {
  margin: 0;
  width: 100%;
  font-family: 'Lora', Georgia, serif;
  font-size: 1.4em; line-height: 1.6;
  color: #1c1c1c;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  overflow: hidden;
}

/* BOTTOM ROW */
.rb-bottom {
  flex: 1; min-height: 0;
  display: flex; gap: .5em;
  padding: .55em .8em;
  overflow: hidden;
}

/* Panels */
.rb-panel {
  position: relative;
  display: flex; flex-direction: column;
  border: .1em solid rgba(0,0,0,.14);
  border-radius: .2em;
  padding: .55em .6em;
  overflow: hidden;
}
.rb-panel::before, .rb-panel::after {
  content: '';
  position: absolute;
  width: .65em; height: .65em;
  border-style: solid;
  border-color: rgba(0,0,0,.22);
}
.rb-panel::before { top: -.1em; left: -.1em; border-width: .15em 0 0 .15em; }
.rb-panel::after  { bottom: -.1em; right: -.1em; border-width: 0 .15em .15em 0; }

.rb-tech { flex: 1; min-width: 0; } /* takes remaining space beside cert plaque */

/* Tech data rows */
.rb-tech-rows {
  flex: 1;
  display: flex; flex-direction: column;
  justify-content: space-between;
  margin-top: .4em;
  overflow: hidden;
}
.rb-tech-row {
  display: flex; align-items: center; gap: .4em;
  border-bottom: .05em solid rgba(0,0,0,.07);
  padding: .2em 0;
}
.rb-tech-row:last-child { border-bottom: none; }
.rb-tech-row::before {
  content: '';
  width: .32em; height: .32em;
  border-radius: 50%;
  background: rgba(0,0,0,.25);
  flex-shrink: 0;
}
.rb-tk {
  font-size: .95em; letter-spacing: .08em;
  color: rgba(0,0,0,.42); flex-shrink: 0;
  min-width: 4.8em;
}
.rb-tv {
  font-size: 1.02em; font-weight: 600;
  color: #111; flex: 1; text-align: right;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Certificate panel inner */
.rb-cert-inner {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column;
  align-items: center; text-align: center;
  margin-top: .4em;
  overflow: hidden;
}
.rb-cert-qr-wrap {
  position: relative;
  width: 5.5em; height: 5.5em;
  flex-shrink: 0; margin-bottom: .35em;
}
.rb-cert-qr-canvas { width: 100%; height: 100%; }
.rb-cert-qr-canvas canvas,
.rb-cert-qr-canvas img {
  width: 100% !important; height: 100% !important;
  display: block;
}
.rb-cert-qr-overlay {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 1.5em; height: 1.5em;
  border-radius: 50%;
  background: #cfcfcf; border: .15em solid #1e1e1e;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Cinzel', serif;
  font-size: .9em; font-weight: 700; color: #1a1a1a;
  letter-spacing: 0;
}
.rb-cert-brand {
  font-family: 'Cinzel', serif;
  font-size: 1.2em; letter-spacing: .22em;
  color: #111; margin-bottom: .2em;
  text-shadow: 0 .1em 0 rgba(255,255,255,.6), 0 -.04em 0 rgba(0,0,0,.12);
}
.rb-cert-meta-label {
  font-size: .82em; letter-spacing: .1em;
  text-transform: uppercase; color: rgba(0,0,0,.32);
  margin-top: .2em;
}
.rb-cert-cf {
  font-family: 'Courier New', monospace;
  font-size: 1em; font-weight: 700; letter-spacing: .04em;
  color: #111;
  border: .1em solid rgba(0,0,0,.18);
  border-radius: .2em;
  padding: .1em .4em;
  margin: .12em 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 100%; display: block;
}
.rb-cert-vin {
  font-family: 'Courier New', monospace;
  font-size: .8em; color: #333; letter-spacing: .03em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 100%;
}
.rb-cert-verifier {
  font-size: 1em; font-style: italic; color: #222;
  margin-top: .12em;
}
.rb-cert-verifier-sub {
  font-size: .78em; letter-spacing: .1em;
  color: rgba(0,0,0,.28); margin-bottom: .25em;
}
.rb-cert-holo {
  display: flex; align-items: center; gap: .4em;
  margin: .2em 0;
}
.rb-cert-holo-circle {
  width: 2.8em; height: 2.8em; border-radius: 50%;
  border: .1em dashed rgba(0,0,0,.22);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.rb-cert-holo-core {
  width: 2em; height: 2em; border-radius: 50%;
  background: conic-gradient(from 0deg,
    rgba(255,107,107,.65),
    rgba(255,210,58,.65),
    rgba(107,200,120,.65),
    rgba(80,148,255,.65),
    rgba(196,122,255,.65),
    rgba(255,107,107,.65)
  );
}
.rb-cert-holo-text {
  display: flex; flex-direction: column; gap: .1em;
  font-size: .8em; letter-spacing: .1em;
  color: rgba(0,0,0,.28); text-transform: uppercase; text-align: left;
}
.rb-cert-archive {
  font-size: .78em; letter-spacing: .07em;
  color: rgba(0,0,0,.28); text-transform: uppercase;
  margin-top: auto;
}

/* FOOTER */
.rb-footer {
  flex-shrink: 0;
  text-align: center;
  padding: .5em .8em .85em;
  border-top: .08em solid rgba(0,0,0,.1);
}
.rb-footer-rule {
  display: flex; align-items: center; gap: .6em;
  margin-bottom: .2em;
}
.rb-footer-brand {
  font-family: 'Cinzel', serif;
  font-size: 1.2em; letter-spacing: .2em;
  color: rgba(0,0,0,.32); white-space: nowrap;
}
.rb-footer-tagline {
  font-size: .88em; letter-spacing: .15em;
  color: rgba(0,0,0,.18); text-transform: uppercase;
}

/* ── REWERS PHOTO UPLOADS (Panel 0) ─────────────────────────── */
.rewers-photos-section { margin-top: 20px; }
.rewers-photos-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.rewers-upload {
  position: relative;
  aspect-ratio: 4 / 3;
  border: 1.5px dashed #ccc;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  background: #fafafa;
  transition: border-color .15s, background .15s;
}
.rewers-upload:hover { border-color: #999; background: #f4f4f4; }
.rewers-upload.has-image {
  border-style: solid;
  border-color: #ddd;
  background: #000;
}
.rewers-upload input[type="file"] {
  position: absolute; inset: 0;
  opacity: 0; cursor: pointer;
  width: 100%; height: 100%; z-index: 2;
}
.rewers-upload-preview {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  display: none;
  z-index: 1;
}
.rewers-upload.has-image .rewers-upload-preview { display: block; }
.rewers-upload-ph {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 5px;
  pointer-events: none;
}
.rewers-upload.has-image .rewers-upload-ph { display: none; }
.rewers-ph-icon { font-size: 20px; opacity: .25; }
.rewers-ph-label {
  font-size: 9px; letter-spacing: .12em;
  color: rgba(0,0,0,.28); text-transform: uppercase;
}
.rewers-remove-btn {
  position: absolute; top: 5px; right: 5px;
  width: 20px; height: 20px; border-radius: 50%;
  background: rgba(0,0,0,.55); color: #fff;
  border: none; font-size: 10px;
  cursor: pointer; z-index: 4;
  display: none; align-items: center; justify-content: center;
  line-height: 1; padding: 0;
  transition: background .12s;
}
.rewers-upload.has-image .rewers-remove-btn { display: flex; }
.rewers-remove-btn:hover { background: rgba(200,40,40,.85); }

/* ── RESPONSIVE ─────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .editor-page { grid-template-columns: 420px 1fr; }
}
@media (max-width: 860px) {
  .editor-page { grid-template-columns: 1fr; }
  .editor-form { position: static; height: auto; }
  .editor-preview { position: relative; top: auto; height: auto; min-height: 480px; order: -1; }
}
@media (max-width: 480px) {
  .editor-fields { padding: 24px 20px; }
  .size-selector-bar { padding: 12px 20px; }
  .size-btns { grid-template-columns: 1fr; }
}
