:root {
  --green: #6bcb4f;
  --green-dark: #3d9e2a;
  --green-light: #8ed972;
  --green-muted: rgba(107, 203, 79, .12);
  --green-glow: rgba(107, 203, 79, .25);
  --ink: #12151a;
  --ink-soft: #4a5160;
  --muted: #7a8290;
  --border: #e6eaef;
  --border-strong: #d2d9e2;
  --surface: #ffffff;
  --surface-2: #f7f9fb;
  --surface-3: #eef2f6;
  --bg: #e9edf2;
  --panel-w: 380px;
  --topbar-h: 64px;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 3px rgba(16, 18, 24, .06);
  --shadow-md: 0 8px 30px rgba(16, 18, 24, .10);
  --shadow-lg: 0 20px 50px rgba(16, 18, 24, .12);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Inter", "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

.app { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }

/* ── Topbar ── */
.topbar {
  height: var(--topbar-h);
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
  z-index: 20;
}
.topbar-brand { display: flex; align-items: center; gap: .85rem; }
.topbar-logo {
  height: 38px;
  width: auto;
  display: block;
  border-radius: 5px;
}
.topbar-meta { display: flex; flex-direction: column; gap: .1rem; }
.topbar-title {
  font-weight: 800;
  font-size: .95rem;
  color: var(--ink);
  letter-spacing: -.02em;
  line-height: 1.2;
}
.topbar-sub {
  font-size: .72rem;
  color: var(--muted);
  font-weight: 500;
}
.topbar-actions { display: flex; align-items: center; gap: .5rem; }

.btn {
  font-family: inherit;
  font-weight: 600;
  font-size: .82rem;
  border-radius: 999px;
  padding: .52rem 1.15rem;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink-soft);
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s, box-shadow .15s, transform .1s;
  white-space: nowrap;
}
.btn:hover { border-color: var(--green); color: var(--green-dark); }
.btn:active { transform: scale(.98); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-3); border-color: transparent; }
.btn-primary {
  background: linear-gradient(135deg, var(--green-dark), var(--green));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 14px var(--green-glow);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #358a22, var(--green-dark));
  color: #fff;
  box-shadow: 0 6px 18px var(--green-glow);
}

/* ── Layout ── */
.layout {
  flex: 1 1 auto;
  display: flex;
  min-height: 0;
  gap: 0;
}

/* ── Viewport ── */
.viewport {
  flex: 1 1 auto;
  position: relative;
  min-width: 0;
  background: #8cb872;
}
#scene { display: block; width: 100%; height: 100%; }

.viewport-brand {
  position: absolute;
  top: 1rem;
  right: 1rem;
  pointer-events: none;
  z-index: 2;
}
.viewport-brand-logo {
  height: 34px;
  width: auto;
  opacity: .9;
  border-radius: 6px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .18);
}

.viewport-badge {
  position: absolute;
  top: 1rem;
  left: 1rem;
  display: flex;
  flex-direction: column;
  gap: .45rem;
  pointer-events: none;
}
.viewport-pill {
  font-size: .72rem;
  font-weight: 600;
  color: rgba(255, 255, 255, .92);
  background: rgba(18, 21, 26, .45);
  backdrop-filter: blur(8px);
  padding: .38rem .75rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .12);
  display: flex;
  align-items: center;
  gap: .4rem;
}
.viewport-pill svg { opacity: .85; flex-shrink: 0; }

.viewport-time {
  position: absolute;
  top: 3.65rem;
  right: 1rem;
  display: flex;
  gap: .35rem;
  z-index: 3;
}
.time-btn {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .72rem;
  font-weight: 600;
  color: rgba(255, 255, 255, .88);
  background: rgba(18, 21, 26, .48);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 999px;
  padding: .4rem .72rem;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.time-btn svg { opacity: .9; flex-shrink: 0; }
.time-btn:hover {
  background: rgba(18, 21, 26, .62);
  border-color: rgba(255, 255, 255, .22);
}
.time-btn.active {
  color: #fff;
  background: rgba(61, 186, 106, .72);
  border-color: rgba(142, 217, 114, .55);
}

.viewport-hint {
  position: absolute;
  left: 50%;
  bottom: 1.1rem;
  transform: translateX(-50%);
  font-size: .72rem;
  font-weight: 600;
  color: rgba(255, 255, 255, .88);
  background: rgba(18, 21, 26, .42);
  backdrop-filter: blur(8px);
  padding: .42rem .9rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .1);
  pointer-events: none;
}

.viewport-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  font-size: .85rem;
  font-weight: 600;
  color: var(--ink-soft);
  background: linear-gradient(160deg, #dce9e0, #eef3ee);
  transition: opacity .35s ease, visibility .35s;
  z-index: 5;
}
.loader.hidden { display: none; }

.boot-error {
  max-width: 26rem;
  margin-top: .75rem;
  padding: .85rem 1rem;
  border-radius: 10px;
  background: rgba(192, 57, 43, .12);
  color: #8b2518;
  font-size: .8rem;
  line-height: 1.55;
  white-space: pre-line;
  text-align: center;
  font-weight: 600;
}
.boot-error.hidden { display: none; }

.boot-retry {
  margin-top: .85rem;
}
.boot-retry.hidden { display: none; }

.viewport-loading.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: -1;
}
.loader {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--green-dark);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Side panel ── */
.panel {
  flex: 0 0 var(--panel-w);
  width: var(--panel-w);
  background: var(--surface-2);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
  box-shadow: -4px 0 24px rgba(16, 18, 24, .04);
}
.panel-header {
  flex: 0 0 auto;
  padding: 1rem 1.15rem .85rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.panel-header-logo {
  height: 30px;
  width: auto;
  display: block;
  margin-bottom: .55rem;
  border-radius: 4px;
}
.panel-header h1 {
  margin: 0 0 .25rem;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--ink);
}
.panel-header p {
  margin: 0;
  font-size: .76rem;
  color: var(--muted);
  line-height: 1.45;
}

/* ── Navigare rapidă secțiuni ── */
.panel-nav {
  flex: 0 0 auto;
  display: flex;
  gap: .35rem;
  padding: .55rem .75rem;
  overflow-x: auto;
  scrollbar-width: none;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  -webkit-overflow-scrolling: touch;
}
.panel-nav::-webkit-scrollbar { display: none; }
.panel-nav-btn {
  flex: 0 0 auto;
  font-family: inherit;
  font-size: .72rem;
  font-weight: 700;
  padding: .42rem .75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--ink-soft);
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
  white-space: nowrap;
}
.panel-nav-btn:hover { border-color: var(--green-light); color: var(--green-dark); }
.panel-nav-btn.active {
  background: var(--green-muted);
  border-color: var(--green-dark);
  color: var(--green-dark);
}

.panel-scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: .85rem .95rem .5rem;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

/* ── Section cards ── */
.group {
  margin-bottom: .75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .85rem .95rem;
  box-shadow: var(--shadow);
}
.group-head {
  display: flex;
  align-items: flex-start;
  gap: .65rem;
  margin-bottom: .75rem;
}
.group-step-num {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--green-dark);
  color: #fff;
  font-size: .72rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: .05rem;
}
.group-head h2 {
  font-size: .88rem;
  font-weight: 800;
  color: var(--ink);
  margin: 0 0 .15rem;
  letter-spacing: -.02em;
}
.group-hint {
  margin: 0;
  font-size: .7rem;
  color: var(--muted);
  font-weight: 500;
  line-height: 1.35;
}
.group-icon {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: var(--green-muted);
  color: var(--green-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.group h2 {
  font-size: .88rem;
  font-weight: 800;
  color: var(--ink);
  margin: 0;
  letter-spacing: -.02em;
}
.group-sub {
  font-size: .68rem;
  color: var(--muted);
  margin: 0 0 .55rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.group-sub + .group-sub,
.group-divider + .group-sub {
  margin-top: 0;
}
.group-divider {
  height: 1px;
  background: var(--border);
  margin: .85rem 0 .75rem;
}

/* ── Fields ── */
.field { display: block; margin-bottom: .75rem; }
.field-tight { margin-bottom: .55rem; }
.field:last-child { margin-bottom: 0; }
.field span {
  display: flex;
  justify-content: space-between;
  font-size: .8rem;
  color: var(--ink-soft);
  margin-bottom: .4rem;
  font-weight: 500;
}
.field span b {
  color: var(--ink);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: var(--surface-3);
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--green-dark);
  box-shadow: 0 2px 6px rgba(0,0,0,.12);
  cursor: pointer;
  transition: transform .1s;
}
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.1); }
input[type="range"]::-webkit-slider-thumb:active { transform: scale(1.15); }
input[type="range"]::-moz-range-thumb {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--green-dark);
  cursor: pointer;
}

/* ── Toggle switch ── */
.checkline {
  display: flex;
  align-items: center;
  gap: .65rem;
  font-size: .82rem;
  color: var(--ink-soft);
  padding: .45rem 0;
  cursor: pointer;
  user-select: none;
}
.checkline input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle {
  width: 40px; height: 22px;
  border-radius: 999px;
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  position: relative;
  flex-shrink: 0;
  transition: background .2s, border-color .2s;
}
.toggle::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.15);
  transition: transform .2s;
}
.checkline input:checked + .toggle {
  background: var(--green-dark);
  border-color: var(--green-dark);
}
.checkline input:checked + .toggle::after { transform: translateX(18px); }
.checkline.disabled { opacity: .4; pointer-events: none; }
.checkline-block { margin-bottom: .15rem; }
.checkline-hint {
  margin: -.15rem 0 .35rem 3.05rem;
  font-size: .74rem;
  color: var(--muted, #8a8f98);
  display: none;
}
.checkline-hint.visible { display: block; }
.checkline-card { padding: 0; margin: 0; }
.gate-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .65rem .7rem;
  background: var(--surface-2);
  margin-bottom: .55rem;
}
.gate-card:last-child { margin-bottom: 0; }
.gate-note {
  font-size: .68rem;
  font-weight: 600;
  color: var(--muted);
}
.nested-fields-card {
  margin-top: .55rem;
  padding-top: .55rem;
  border-top: 1px dashed var(--border);
}

/* ── Swatches ── */
.swatch-row {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
}
.swatch-row-gates {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .45rem;
}
.swatch-row-gates .swatch {
  justify-content: center;
  text-align: center;
  font-size: .72rem;
  padding: .5rem .4rem;
}
.swatch-row-gates-3 {
  grid-template-columns: repeat(3, 1fr);
}
.swatch-row-gates-3 .swatch {
  font-size: .66rem;
  padding: .48rem .3rem;
  line-height: 1.25;
}
.gate-dir-label {
  margin: 0 0 .45rem;
  font-weight: 600;
  color: var(--text);
}
.gate-dir-note {
  font-weight: 500;
  color: var(--muted);
}
.swatch-row-gates-primary .swatch {
  font-size: .78rem;
  font-weight: 600;
  padding: .58rem .5rem;
}

.swatch-row-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .45rem;
}

.swatch {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .45rem .65rem;
  font-size: .76rem;
  font-weight: 600;
  color: var(--ink-soft);
  background: var(--surface-2);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: .45rem;
  transition: border-color .15s, box-shadow .15s, color .15s, background .15s, transform .1s;
  user-select: none;
}
.swatch:hover { border-color: var(--green-light); background: #fff; }
.swatch:active { transform: scale(.98); }
.swatch.active {
  border-color: var(--green-dark);
  background: var(--green-muted);
  color: var(--green-dark);
  box-shadow: 0 0 0 1px var(--green-dark) inset;
}
.swatch .dot {
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 1.5px solid rgba(0,0,0,.12);
  flex: 0 0 auto;
  box-shadow: inset 0 1px 2px rgba(0,0,0,.08);
}

.swatch-card {
  flex-direction: column;
  align-items: stretch;
  padding: .5rem;
  gap: .4rem;
  text-align: center;
}
.swatch-card .swatch-preview-wrap {
  width: 100%;
  height: 52px;
  border-radius: 7px;
  overflow: hidden;
  background: var(--surface-3);
  border: 1px solid var(--border);
  position: relative;
}
.swatch-card .swatch-preview {
  width: 100%;
  height: 100%;
  border-radius: 0;
  background: var(--surface-3);
  border: 0;
  display: block;
}
.swatch-card .swatch-preview-photo {
  object-fit: cover;
  object-position: center;
}
.swatch-card .swatch-preview-canvas {
  position: absolute;
  inset: 0;
}
.swatch-card span {
  font-size: .7rem;
  line-height: 1.25;
}

.swatch-color {
  flex-direction: column;
  align-items: center;
  padding: .55rem .4rem;
  gap: .35rem;
  min-width: 0;
}
.swatch-color .dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
}
.swatch-color .dot-pattern {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1.5px solid rgba(0,0,0,.12);
  display: block;
}
.swatch-color span {
  font-size: .65rem;
  text-align: center;
  line-height: 1.2;
}

.swatch-row-colors {
  grid-template-columns: repeat(3, 1fr);
}
.swatch-row-posts .swatch {
  flex: 1 1 calc(50% - .25rem);
  min-width: 0;
}

/* ── Laturi gard (față/lateral/spate) ── */
.side-chip { padding-right: .5rem; }
.side-chip-del {
  border: none;
  background: transparent;
  color: inherit;
  opacity: .55;
  font-size: .95rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0 0 .15rem;
}
.side-chip-del:hover { opacity: 1; color: #c0392b; }
.side-add-row { margin-top: .5rem; }
.side-add-btn {
  padding: .4rem .7rem;
  font-size: .74rem;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-sm);
}
.side-add-btn:hover { border-color: var(--green); background: var(--green-muted); }
.side-context-hint {
  margin: .3rem 0 0;
  font-size: .72rem;
  font-weight: 600;
  color: var(--green-dark);
  display: none;
}
.side-context-hint.visible { display: block; }

.side-total-block {
  margin: .5rem 0 .85rem;
  padding: .75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.side-total-block.hidden { display: none; }
.field-total-length input {
  width: 100%;
  min-height: 46px;
  margin-top: .35rem;
  padding: .5rem .65rem;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
}
.field-total-length input:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px var(--green-muted);
}
.side-total-hint {
  margin: .55rem 0 0;
  font-size: .74rem;
  line-height: 1.45;
  color: var(--muted);
  font-weight: 500;
}
#frontSegmentEditor.hidden { display: none; }

.segment-block { margin-top: .25rem; }
.segment-intro {
  margin: 0 0 .75rem;
  font-size: .74rem;
  line-height: 1.5;
  color: var(--muted);
}
.segment-intro a { color: var(--green-dark); font-weight: 600; }
.segment-list { display: flex; flex-direction: column; gap: .55rem; margin-bottom: .75rem; }

.segment-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  padding: .65rem .7rem;
}
.segment-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .55rem;
}
.segment-card-title {
  font-size: .78rem;
  font-weight: 800;
  color: var(--ink);
}
.segment-card-sub {
  font-size: .78rem;
  font-weight: 800;
  color: var(--green-dark);
  font-variant-numeric: tabular-nums;
}
.segment-card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .55rem;
}
.segment-field { display: block; }
.segment-field-label {
  display: block;
  font-size: .68rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: .3rem;
}
.segment-field input {
  width: 100%;
  min-height: 44px;
  padding: .45rem .55rem;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  font-family: inherit;
  font-size: .9rem;
  font-weight: 700;
  color: var(--ink);
  background: #fff;
}
.segment-field input:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px var(--green-muted);
}
.segment-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: .55rem;
  padding-top: .5rem;
  border-top: 1px dashed var(--border);
}
.segment-card-hint {
  font-size: .72rem;
  color: var(--muted);
  font-weight: 600;
}
.segment-del {
  font-family: inherit;
  font-size: .72rem;
  font-weight: 700;
  color: #c0392b;
  background: transparent;
  border: 1px solid rgba(192, 57, 43, .25);
  border-radius: 999px;
  padding: .35rem .7rem;
  min-height: 36px;
  cursor: pointer;
}
.segment-del:hover:not(:disabled) { background: rgba(192, 57, 43, .08); }
.segment-del:disabled { opacity: .35; cursor: default; }

.segment-add-card {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  padding: .7rem;
  background: #fff;
  margin-bottom: .65rem;
}
.segment-add-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .55rem;
  margin-bottom: .65rem;
}
.btn-block { width: 100%; min-height: 46px; }

.panel-list-total {
  display: flex;
  justify-content: space-between;
  gap: .75rem;
  font-size: .78rem;
  color: var(--muted);
  padding: .55rem .65rem;
  background: var(--surface-3);
  border-radius: 8px;
  font-weight: 500;
}
.panel-list-total-label {
  display: block;
  font-size: .62rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: .15rem;
}
.panel-list-total b { color: var(--ink); font-weight: 800; font-size: 1rem; }

/* ── Panel list (legacy) ── */
.panel-list-row {
  display: flex;
  align-items: center;
  gap: .45rem;
  padding: .45rem .55rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  margin-bottom: .4rem;
}
.panel-list-field {
  display: flex;
  align-items: center;
  gap: .25rem;
  font-size: .7rem;
  color: var(--muted);
  font-weight: 600;
}
.panel-list-field input {
  width: 3.8rem;
  min-height: 40px;
  padding: .35rem .45rem;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  font-family: inherit;
  font-size: .82rem;
  font-weight: 700;
  color: var(--ink);
  background: #fff;
}
.panel-list-field input:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px var(--green-muted);
}
.panel-list-field-qty input { width: 2.5rem; }
.panel-list-times { font-size: .8rem; color: var(--muted); font-weight: 700; }
.panel-list-spacer { flex: 1 1 auto; }
.panel-list-del {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 1rem;
  cursor: pointer;
  padding: .35rem .55rem;
  min-width: 40px;
  min-height: 40px;
  border-radius: 8px;
  transition: color .15s, background .15s;
}
.panel-list-del:hover { color: #c0392b; background: rgba(192,57,43,.08); }
.panel-list-del:disabled { opacity: .3; cursor: default; }

.panel-add-row {
  display: flex;
  align-items: flex-end;
  gap: .45rem;
  margin-top: .35rem;
}
.panel-add-row label { flex: 1 1 auto; display: block; }
.panel-add-row label span {
  display: block;
  font-size: .68rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: .28rem;
}
.panel-add-row input[type="number"] {
  width: 100%;
  min-height: 44px;
  padding: .5rem .55rem;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  font-family: inherit;
  font-size: .82rem;
  font-weight: 600;
  color: var(--ink);
  background: #fff;
}
.panel-add-row input:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px var(--green-muted);
}
.panel-add-row .btn { flex: 0 0 auto; padding: .48rem .85rem; font-size: .78rem; }

.nested-fields {
  margin-top: .65rem;
  padding-top: .65rem;
  border-top: 1px dashed var(--border);
}

.panel-add-row .btn {
  flex: 0 0 auto;
  padding: .55rem .9rem;
  font-size: .78rem;
  min-height: 44px;
}

/* ── Summary & actions ── */
.panel-footer {
  flex: 0 0 auto;
  background: var(--surface-2);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.panel-summary {
  margin: .65rem .95rem 0;
  padding: .85rem .95rem;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #1a1f26, #2a3140);
  color: rgba(255,255,255,.75);
  font-size: .76rem;
  line-height: 1.65;
}
.panel-summary b { color: #fff; font-weight: 700; }
.summary-stats {
  display: flex;
  gap: .65rem;
  margin-bottom: .55rem;
  padding-bottom: .55rem;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.summary-stat {
  flex: 1 1 auto;
  text-align: center;
}
.summary-stat-val {
  display: block;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--green-light);
  line-height: 1.2;
}
.summary-stat-label {
  font-size: .62rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: rgba(255,255,255,.45);
  font-weight: 600;
}
.summary-warn {
  margin-top: .5rem;
  padding: .4rem .55rem;
  border-radius: 7px;
  background: rgba(231, 76, 60, .2);
  color: #ff9b8f;
  font-size: .72rem;
  line-height: 1.4;
}

.panel-actions-label {
  margin: .7rem .95rem 0;
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
}
.panel-actions {
  display: flex;
  gap: .45rem;
  padding: .4rem .95rem .3rem;
}
.panel-actions .btn {
  flex: 1 1 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  text-align: center;
  min-height: 46px;
  font-size: .85rem;
}
.panel-actions-secondary {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  padding: 0 .95rem .85rem;
}
.panel-actions-secondary .btn {
  flex: 1 1 calc(50% - .2rem);
  min-height: 38px;
  font-size: .76rem;
  color: var(--muted);
}
.btn-whatsapp {
  background: linear-gradient(135deg, #1da851, #25d366);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 14px rgba(37, 211, 102, .35);
}
.btn-whatsapp:hover {
  background: linear-gradient(135deg, #178f43, #1da851);
  color: #fff;
  box-shadow: 0 6px 18px rgba(37, 211, 102, .35);
}

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(1rem);
  background: var(--ink);
  color: #fff;
  font-size: .82rem;
  font-weight: 600;
  padding: .7rem 1.2rem;
  border-radius: 999px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s;
  z-index: 100;
}
.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Bară rapidă Email/WhatsApp, doar pe mobil ── */
.mobile-cta {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  gap: .5rem;
  padding: .5rem .75rem calc(.5rem + env(safe-area-inset-bottom, 0));
  background: var(--surface-2);
  border-top: 1px solid var(--border);
  box-shadow: 0 -8px 24px rgba(16, 18, 24, .1);
}
.mobile-cta .btn {
  flex: 1 1 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  min-height: 46px;
  font-size: .85rem;
}

/* ── Responsive ── */
@media (max-width: 900px) {
  :root { --panel-w: 100%; }
  .layout { flex-direction: column; }
  .viewport {
    flex: 0 0 auto;
    height: 42vh;
    min-height: 240px;
    max-height: 52vh;
  }
  .panel {
    flex: 1 1 auto;
    width: 100%;
    min-height: 0;
    border-left: none;
    border-top: 1px solid var(--border);
    box-shadow: none;
    /* Pe mobil, tot panoul devine singurul container de scroll — altfel
       footer-ul de sumar (înalt) storcea .panel-scroll până la ~0px și
       ascundea toți pașii de configurare (bug: nimic nu mai era accesibil). */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .panel-header {
    padding: .75rem .95rem .65rem;
    position: sticky;
    top: 0;
    z-index: 5;
  }
  .panel-header-logo-desktop { display: none; }
  .panel-header h1 { font-size: .95rem; }
  .panel-nav {
    position: sticky;
    top: 64px;
    z-index: 4;
  }
  .panel-scroll {
    padding: .65rem .85rem .35rem;
    overflow-y: visible;
    flex: 0 0 auto;
  }
  .group-step { scroll-margin-top: 122px; }
  .panel-footer {
    position: static;
    flex: 0 0 auto;
    padding-bottom: calc(3.6rem + env(safe-area-inset-bottom, 0));
  }
  .mobile-cta {
    display: flex;
  }
  .topbar-sub { display: none; }
  .viewport-pill-hide-mobile { display: none; }
  .viewport-brand { display: none; }
  .swatch-row-grid { grid-template-columns: repeat(2, 1fr); }
  .swatch-row-colors { grid-template-columns: repeat(3, 1fr); }
  input[type="range"] { height: 8px; }
  input[type="range"]::-webkit-slider-thumb {
    width: 26px;
    height: 26px;
    border-width: 3px;
  }
  input[type="range"]::-moz-range-thumb {
    width: 26px;
    height: 26px;
    border-width: 3px;
  }
  .panel-nav-btn {
    padding: .5rem .85rem;
    font-size: .75rem;
  }
}
@media (max-width: 640px) {
  .topbar-title { font-size: .85rem; }
  .topbar { padding: 0 1rem; }
  .swatch-row-colors { grid-template-columns: repeat(2, 1fr); }
  .panel-add-row {
    flex-wrap: wrap;
  }
  .panel-add-row label { flex: 1 1 calc(50% - .25rem); }
  .panel-add-row .btn { flex: 1 1 100%; }
}
