/* ── LEFT / RIGHT PANEL SHELLS ──────────────────────────────────── */
.panel-left {
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  height: 100%;
}
.panel-right {
  background: var(--surface);
  border-left: 1px solid var(--border);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* ── DESKTOP PANEL HALVES ───────────────────────────────────────── */
.panel-half {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.panel-half + .panel-half { border-top: 2px solid var(--border2); }

/* ── DESKTOP TAB BAR ────────────────────────────────────────────── */
.ptab-bar {
  display: flex;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.ptab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 0;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all .15s;
  font-size: 9px; font-weight: 600;
  letter-spacing: .04em; text-transform: uppercase;
  color: var(--text2);
  font-family: var(--font);
  flex: 1;
  background: none;
  border-top: none; border-left: none; border-right: none;
  outline: none;
}
.ptab svg { opacity: .65; transition: opacity .15s; }
.ptab:hover { color: var(--text2); background: var(--surface3); }
.ptab:hover svg { opacity: .8; }
.ptab.on { color: var(--accent); border-bottom-color: var(--accent); background: var(--surface); }
.ptab.on svg { opacity: 1; }
.ppane { display: none; overflow-y: auto; flex: 1; min-height: 0; }
.ppane.on { display: block; }

/* ── MOBILE TAB BARS ────────────────────────────────────────────── */
.mob-tabbar {
  display: none;
  position: sticky;
  top: 0; z-index: 20;
  background: var(--surface2);
  border-bottom: 1px solid var(--border2);
  overflow-x: auto;
  scrollbar-width: none;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}
.mob-tabbar::-webkit-scrollbar { display: none; }
.mob-panes { display: none; }


/* ── SECTION ────────────────────────────────────────────────────── */
.section {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}
.section:last-child { border-bottom: none; }
.sec-label {
  font-size: 10px; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 12px;
}

/* ── PLATFORM GRID ──────────────────────────────────────────────── */
.plat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
}
.plat-btn {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 7px 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: var(--surface2);
  transition: all .15s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.plat-btn:hover  { border-color: var(--border2); background: var(--surface3); }
.plat-btn.active { border-color: var(--accent); background: var(--accent-dim); }
.plat-icon {
  width: 22px; height: 22px;
  border-radius: 5px;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 600; font-family: var(--mono);
}
.plat-name { font-size: 9px; color: var(--text2); }
.plat-btn.active .plat-name { color: var(--accent); }

/* ── UPLOAD DROP ────────────────────────────────────────────────── */
.upload-drop {
  border: 1.5px dashed var(--border2);
  border-radius: var(--radius);
  padding: 18px 12px;
  text-align: center;
  cursor: pointer;
  transition: all .15s;
  position: relative; overflow: hidden;
  touch-action: manipulation; display: block;
  -webkit-tap-highlight-color: transparent;
}
.upload-drop:hover   { border-color: var(--accent); background: var(--accent-dim); }
.upload-drop.has-img { border-color: var(--accent); border-style: solid; }
.ud-icon {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--accent-dim);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 8px;
}
.ud-title { font-size: 12px; font-weight: 500; color: var(--text); }
.ud-sub   { font-size: 10px; color: var(--text3); margin-top: 3px; }
.ud-change { font-size: 10px; color: var(--accent); font-weight: 500; }

/* ── TABS ───────────────────────────────────────────────────────── */
.tabs {
  display: flex; gap: 3px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 3px;
}
.tab {
  flex: 1;
  padding: 5px 0;
  text-align: center;
  font-size: 11px; font-weight: 500;
  border-radius: 4px;
  cursor: pointer;
  color: var(--text3);
  border: none; background: transparent;
  font-family: var(--font);
  transition: all .12s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.tab:hover { color: var(--text2); }
.tab.on { background: var(--surface2); color: var(--text); border: 1px solid var(--border2); }

/* ── SLIDERS ────────────────────────────────────────────────────── */
.srow {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 9px;
}
.srow:last-child { margin-bottom: 0; }
.slb { font-size: 11px; color: var(--text2); min-width: 62px; }
.svl {
  font-size: 11px; font-weight: 500; color: var(--text);
  min-width: 34px; text-align: right; font-family: var(--mono);
}
input[type=range] {
  flex: 1; height: 3px;
  -webkit-appearance: none;
  background: var(--surface3);
  border-radius: 2px; outline: none;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 2px solid var(--bg);
}

/* ── SWATCHES ───────────────────────────────────────────────────── */
.swatch-row {
  display: flex; gap: 5px; flex-wrap: wrap; align-items: center;
}
.sw {
  width: 20px; height: 20px; border-radius: 50%;
  cursor: pointer; border: 2px solid transparent;
  flex-shrink: 0; transition: transform .1s;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.sw:hover { transform: scale(1.15); }
.sw.on { border-color: var(--text); }
input[type=color] {
  width: 20px; height: 20px; border-radius: 50%;
  border: 1px solid var(--border2);
  padding: 0; cursor: pointer;
  background: transparent; flex-shrink: 0;
}

/* ── CHIPS ──────────────────────────────────────────────────────── */
.chip-row { display: flex; gap: 4px; flex-wrap: wrap; }
.chip {
  padding: 4px 9px; border-radius: 20px; font-size: 11px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface2); color: var(--text2);
  font-family: var(--font); transition: all .12s;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.chip:hover { border-color: var(--border2); color: var(--text); }
.chip.on { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }

/* ── BORDER OPTIONS ─────────────────────────────────────────────── */
.bopt {
  width: 28px; height: 28px; border-radius: 50%;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
  background: var(--surface2); transition: all .12s;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.bopt:hover { border-color: var(--border2); }
.bopt.on { border: 2px solid var(--accent); background: var(--accent-dim); }

/* ── GRADIENT STOPS ─────────────────────────────────────────────── */
.stop-row {
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 5px; padding: 5px 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.stop-row input[type=color] { width: 24px; height: 24px; border-radius: 4px; }
.stop-pos {
  font-size: 10px; color: var(--text3);
  min-width: 28px; text-align: right; font-family: var(--mono);
}
.stop-del {
  background: none; border: none; cursor: pointer;
  color: var(--text3); font-size: 15px; padding: 0 2px;
  line-height: 1; transition: color .1s;
}
.stop-del:hover { color: var(--danger); }
.grad-bar {
  height: 18px; border-radius: 9px;
  border: 1px solid var(--border);
  margin: 8px 0 10px;
}
.add-stop-btn {
  width: 100%; padding: 5px;
  background: none;
  border: 1px dashed var(--border2);
  border-radius: var(--radius-sm);
  font-size: 11px; color: var(--text3);
  cursor: pointer; font-family: var(--font);
  transition: all .12s;
}
.add-stop-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }

/* ── POSITION GRID ──────────────────────────────────────────────── */
.pos-grid { display: grid; grid-template-columns: repeat(3, 26px); gap: 3px; }
.pos-btn {
  width: 26px; height: 26px; border-radius: 4px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
  background: var(--surface2); transition: all .12s;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.pos-btn:hover { border-color: var(--border2); }
.pos-btn.on { border: 2px solid var(--accent); background: var(--accent-dim); }

/* ── PRESET GRID ────────────────────────────────────────────────── */
.preset-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.pf {
  border-radius: var(--radius-sm);
  aspect-ratio: 1;
  cursor: pointer;
  border: 2px solid transparent;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 600;
  overflow: hidden; transition: all .12s; position: relative;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.pf:hover { border-color: var(--border2); }
.pf.on    { border-color: var(--accent); }

/* ── OVERLAY UPLOAD ─────────────────────────────────────────────── */
.ov-upload {
  border: 1.5px dashed var(--border2);
  border-radius: var(--radius-sm);
  padding: 12px; text-align: center;
  cursor: pointer; transition: all .15s;
  touch-action: manipulation; display: block;
  -webkit-tap-highlight-color: transparent;
}
.ov-upload:hover  { border-color: var(--accent); background: var(--accent-dim); }
.ov-upload.loaded { border-color: var(--accent); border-style: solid; background: var(--accent-dim); }
.ov-info {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 9px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-top: 8px;
}
.ov-thumb {
  width: 36px; height: 36px; border-radius: 5px;
  background: var(--surface3); border: 1px solid var(--border);
  object-fit: contain; flex-shrink: 0;
}
.ov-meta { flex: 1; min-width: 0; }
.ov-name {
  font-size: 11px; font-weight: 500; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ov-dim  { font-size: 9px; color: var(--text3); font-family: var(--mono); }
.ov-del  {
  background: none; border: none; cursor: pointer;
  color: var(--text3); padding: 4px; transition: color .1s;
}
.ov-del:hover { color: var(--danger); }

/* ── INFO BLOCK ─────────────────────────────────────────────────── */
.info-block {
  font-size: 10px; color: var(--text3);
  background: rgba(34,201,142,0.06);
  border: 1px solid rgba(34,201,142,0.15);
  border-radius: var(--radius-sm);
  padding: 7px 9px; line-height: 1.6;
}

/* ── FONT CHIPS ─────────────────────────────────────────────────── */
.fn-chip {
  padding: 4px 9px; border-radius: var(--radius-sm);
  font-size: 11px; cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface2); color: var(--text2);
  font-family: var(--font); transition: all .12s;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.fn-chip:hover { border-color: var(--border2); }
.fn-chip.on { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }

/* ── FORMAT CHIPS ───────────────────────────────────────────────── */
.fmt-row { display: flex; gap: 4px; }
.fmt-chip {
  padding: 6px 16px; text-align: center;
  border-radius: var(--radius-sm);
  font-size: 12px; font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface2); color: var(--text2);
  font-family: var(--mono); transition: all .12s; white-space: nowrap;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.fmt-chip:hover { border-color: var(--border2); }
.fmt-chip.on { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }

/* ── GOLD FRAMES ────────────────────────────────────────────────── */
.gf-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 10px; }
.gf-thumb {
  border-radius: 50%; cursor: pointer;
  border: 2px solid transparent; transition: all .15s; display: block;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.gf-thumb:hover  { border-color: var(--border2); }
.gf-thumb.active { border-color: #d4af37; box-shadow: 0 0 8px rgba(212,175,55,0.5); }
.gf-none {
  width: 52px; height: 52px; border-radius: 50%;
  border: 2px solid var(--border2);
  background: var(--surface2);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 2px; cursor: pointer; transition: all .15s;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.gf-none span { font-size: 8px; color: var(--text3); font-family: var(--mono); }
.gf-none:hover  { border-color: var(--border2); background: var(--surface3); }
.gf-none.active { border-color: var(--accent); background: var(--accent-dim); }
.gf-none.active span { color: var(--accent); }

/* ── CROP CONTROLS ──────────────────────────────────────────────── */
.apply-crop-btn {
  width: 100%; padding: 7px 0;
  background: var(--accent); color: #0a1a12;
  border: none; border-radius: var(--radius-sm);
  font-size: 12px; font-weight: 600;
  cursor: pointer; font-family: var(--font);
  transition: background .12s;
  touch-action: manipulation;
}
.apply-crop-btn:hover { background: var(--accent2); }
.reset-crop-btn {
  width: 100%; padding: 6px 0;
  background: none;
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  font-size: 11px; color: var(--text2);
  cursor: pointer; font-family: var(--font);
  margin-top: 5px; transition: all .12s;
}
.reset-crop-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ── STICKERS ───────────────────────────────────────────────────── */
.stk-group { margin-bottom: 12px; }
.stk-group-label {
  font-size: 9px; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase;
  color: var(--text3); margin-bottom: 5px;
}
.stk-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
}
.stk-item {
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  background: var(--surface2);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  padding: 4px;
  transition: all .12s;
  touch-action: manipulation;
}
.stk-item:hover { border-color: var(--border2); background: var(--surface3); }
.stk-item.on    { border-color: var(--accent); background: var(--accent-dim); }
.stk-thumb { display: block; width: 40px; height: 40px; }

/* ── LAPTOP PANELS (1024px – 1279px) ───────────────────────────── */
@media (min-width: 1024px) and (max-width: 1279px) {
  .section { padding: 12px 14px; }
  .plat-grid { grid-template-columns: repeat(4, 1fr); gap: 4px; }
  .plat-name { font-size: 8px; }
  .srow { gap: 6px; }
  .slb  { font-size: 10px; min-width: 56px; }
  .preset-grid { grid-template-columns: repeat(3, 1fr); }
  .gf-grid { grid-template-columns: repeat(4, 1fr); gap: 5px; }
}

/* ── TABLET PANELS (769px – 1023px) ─────────────────────────────── */
@media (min-width: 769px) and (max-width: 1023px) {
  .section { padding: 10px 12px; }
  .plat-grid { grid-template-columns: repeat(3, 1fr); gap: 4px; }
  .plat-name { font-size: 8px; }
  .plat-icon { width: 20px; height: 20px; }
  .srow { gap: 5px; }
  .slb  { font-size: 10px; min-width: 50px; }
  .svl  { font-size: 10px; }
  .chip { font-size: 10px; padding: 3px 7px; }
  .preset-grid { grid-template-columns: repeat(3, 1fr); gap: 4px; }
  .gf-grid  { grid-template-columns: repeat(3, 1fr); gap: 5px; }
  .gf-none  { width: 44px; height: 44px; }
  .fmt-chip { padding: 4px 10px; font-size: 10px; }
  .stop-row { padding: 4px 6px; }
  .pos-grid { grid-template-columns: repeat(3, 24px); gap: 2px; }
  .pos-btn  { width: 24px; height: 24px; }
}

/* ── MOBILE PANELS (≤768px) ─────────────────────────────────────── */
@media (max-width: 768px) {
  .panel-left, .panel-right { height: auto; overflow: visible; flex-direction: column; }
  .panel-half { display: none !important; }
  .mob-tabbar { display: flex !important; padding: 0; gap: 0; }
  .mob-panes  { display: block !important; }
  .mob-tabbar .ptab {
    flex: 1 1 0 !important;
    min-width: 0 !important;
    min-height: 48px;
    padding: 8px 4px 6px;
    font-size: 9px;
    gap: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }
  .mob-tabbar .ptab svg { width: 16px; height: 16px; }
  .mob-panes .ppane {
    display: none; max-height: 300px;
    overflow-y: auto; overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    -webkit-mask-image: linear-gradient(to bottom, black 85%, transparent 100%);
    mask-image: linear-gradient(to bottom, black 85%, transparent 100%);
  }
  .mob-panes .ppane.scrolled-end { -webkit-mask-image: none; mask-image: none; }
  .mob-panes .ppane.on { display: block; }
  .section { padding: 10px 12px; margin-bottom: 2px; }
  .plat-grid { grid-template-columns: repeat(4, 1fr); gap: 4px; }
  .plat-btn  { padding: 6px 3px; }
  .plat-name { font-size: 8px; }
  .plat-icon { width: 20px; height: 20px; }
  .srow { gap: 6px; margin-bottom: 6px; }
  .slb  { font-size: 10px; min-width: 52px; }
  .svl  { font-size: 10px; min-width: 28px; }
  .chip { font-size: 10px; padding: 3px 7px; }
  .preset-grid { grid-template-columns: repeat(3, 1fr); gap: 4px; }
  .gf-grid  { grid-template-columns: repeat(4, 1fr); gap: 5px; }
  .gf-none  { width: 100%; aspect-ratio: 1; height: auto; }
  .upload-drop { padding: 14px 10px; }
  .ud-title { font-size: 11px; }
  .ud-icon  { width: 28px; height: 28px; }
  .swatch-row { gap: 4px; }
  .sw { width: 18px; height: 18px; }
  .tabs { padding: 2px; }
  .tab  { font-size: 10px; padding: 4px 0; }
  .fmt-chip { padding: 4px 10px; font-size: 10px; }
  .apply-crop-btn { font-size: 11px; padding: 6px 0; }
  .reset-crop-btn { font-size: 10px; }
}
/* ── PILL OVERFLOW FIX ──────────────────────────────────────────── */
#txtPillControls { overflow: hidden; width: 100%; box-sizing: border-box; }
.panel-right { overflow-x: hidden; }
.panel-right .section { overflow: hidden; box-sizing: border-box; }

/* ── ELEMENTOR BUTTON OVERRIDE ─────────────────────────────────── */
#dpApp button.ptab,
#dpApp .ptab-bar button {
  background-color: transparent !important;
  width: auto !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
}
#dpApp .mob-tabbar button {
  background-color: transparent !important;
  box-sizing: border-box !important;
}
#dpApp button.ptab.on {
  background-color: var(--surface) !important;
}
#dpApp button.ptab:hover {
  background-color: var(--surface3) !important;
}

/* ── EXTRA SMALL (≤380px) ───────────────────────────────────────── */
@media (max-width: 380px) {
  .mob-tabbar .ptab { font-size: 8px; padding: 7px 4px 5px; }

  .preset-grid { grid-template-columns: repeat(2, 1fr); }
  .plat-grid   { grid-template-columns: repeat(3, 1fr); }
  .mob-panes .ppane { max-height: 260px; }
}