:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --ink: #383a3e;
  --muted: #6b7280;
  --faint: #9aa1ab;
  --line: #e4e7ec;
  --line-strong: #d0d5dd;
  --field: #ffffff;
  --hover: #f2f4f7;
  --accent: #557f69;
  --accent-soft: #e6f0ea;
  --accent-hover: #486e5a;
  --accent-ink: #ffffff;
  --danger: #e5484d;
  --mat-bg: #26272b;
  --mat-in: #18191c;
  --ruler-bg: #1e1f23;
  --ruler-ink: #8e949f;
  --seg-bg: #eef0f3;
  --icon: #4b5563;
  --label: #434343;
  --toggle-off: #d5d9df;
  --glass: rgba(255, 255, 255, 0.78);
  --shadow: 0 2px 6px rgba(16, 24, 40, 0.08), 0 6px 20px rgba(16, 24, 40, 0.08);
  --f-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="dark"] {
  --bg: #18191c;
  --panel: #212226;
  --ink: #e7e8ea;
  --muted: #9ea4ae;
  --faint: #6c717a;
  --line: #32343a;
  --line-strong: #41444c;
  --field: #1b1c20;
  --hover: #2b2d33;
  --accent: #5e8a73;
  --accent-soft: #28382f;
  --accent-hover: #6c9a82;
  --danger: #f26464;
  --mat-bg: #25262a;
  --mat-in: #141518;
  --ruler-bg: #1c1d21;
  --ruler-ink: #898f9a;
  --seg-bg: #2b2d32;
  --icon: #c5c9d0;
  --label: #cfd2d7;
  --toggle-off: #484b52;
  --glass: rgba(33, 34, 38, 0.82);
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.35), 0 8px 24px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font: 13px/1.4 var(--f-body);
  font-feature-settings: "tnum" 1;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

[hidden] {
  display: none !important;
}

.app {
  height: 100vh;
  display: grid;
  grid-template-rows: 52px 1fr;
}

/* ==================== HEADER ==================== */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.logo-mark {
  display: grid;
  place-items: center;
}

.brand h1.logo {
  margin: 0;
  font-size: 16.5px;
  font-weight: 800;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 2px;
}

.brand h1.logo b {
  color: var(--accent);
}

.cdr-badge {
  margin-left: 6px;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 700;
  border-radius: 5px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  letter-spacing: 0.03em;
}

.brand .sep {
  width: 1px;
  height: 20px;
  background: var(--line);
}

.brand .doc {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand .doc span {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--ink);
}

.brand .doc small {
  font-size: 10.5px;
  color: var(--accent);
}

.hright {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hgroup {
  display: flex;
  align-items: center;
  gap: 2px;
}

.cdr-upload-top {
  background: var(--accent-soft) !important;
  border-color: var(--accent) !important;
  color: #84c5a2 !important;
  font-weight: 600 !important;
}
:root:not([data-theme="dark"]) .cdr-upload-top {
  color: var(--accent) !important;
}
.cdr-upload-top:hover {
  background: var(--accent) !important;
  color: #fff !important;
}

/* ==================== BUTTONS & SEGMENTS ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 31px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  background: var(--panel);
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  font-weight: 500;
  font-size: 12.5px;
  transition: all 0.12s ease;
}

.btn:hover {
  background: var(--hover);
}

.btn.primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}

.btn.primary:hover {
  background: var(--accent-hover);
}

.btn.primary-soft {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--ink);
  font-weight: 600;
}

.btn.primary-soft:hover {
  background: var(--accent);
  color: #fff;
}

.btn.sm {
  height: 27px;
  padding: 0 8px;
  font-size: 12px;
}

.btn.big {
  height: 38px;
  font-weight: 600;
}

.btn.ghost {
  border-color: transparent;
  background: transparent;
}

.btn.ghost:hover {
  background: var(--hover);
}

.icon-btn {
  width: 30px;
  padding: 0;
  border-color: transparent;
  background: transparent;
  color: var(--icon);
}

.icon-btn:hover {
  background: var(--hover);
  color: var(--ink);
}

.icon-btn[aria-pressed="true"] {
  background: var(--accent-soft);
  color: var(--accent);
}

.split {
  display: inline-flex;
}

.split .btn:first-child {
  border-radius: 8px 0 0 8px;
}

.split .btn:last-child {
  border-radius: 0 8px 8px 0;
  border-left: 1px solid rgba(255, 255, 255, 0.28);
  width: 26px;
  padding: 0;
}

.menu-wrap {
  position: relative;
}

.menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 60;
  min-width: 300px;
  padding: 6px;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.menu hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 4px 2px;
}

.menu button.mi2 {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 10px;
  border: 0;
  background: none;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  color: var(--ink);
}

.menu button.mi2:hover {
  background: var(--hover);
}

.menu button.mi2 svg {
  flex: none;
  margin-top: 2px;
  color: var(--accent);
}

.mi2 > span {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mi2 b {
  font-weight: 600;
  font-size: 12.5px;
}

.mi2 small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}

.seg {
  display: inline-flex;
  padding: 2px;
  gap: 2px;
  background: var(--seg-bg);
  border-radius: 9px;
}

.seg button {
  height: 26px;
  padding: 0 11px;
  border: 0;
  background: transparent;
  border-radius: 7px;
  cursor: pointer;
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
}

.seg button:hover {
  color: var(--ink);
}

.seg button[aria-pressed="true"] {
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.seg.blue button[aria-pressed="true"] {
  background: var(--accent);
  color: #fff;
}

/* Theme switch */
.theme-tgl {
  position: relative;
  width: 52px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--seg-bg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.theme-tgl .tt-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--panel);
  transition: transform 0.2s ease;
}

.theme-tgl[aria-checked="true"] .tt-knob {
  transform: translateX(24px);
}

.theme-tgl .tt-ico {
  position: relative;
  z-index: 1;
  width: 25px;
  text-align: center;
  font-size: 12px;
}

/* ==================== MAIN WORKSPACE LAYOUTS ==================== */
main {
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 315px;
}

.stages-container {
  min-width: 0;
  min-height: 0;
  display: grid;
  height: 100%;
}

/* Formato Vídeo: 3D em cima (50%), Moldes 2D embaixo (50%) */
main.layout-split-v .stages-container {
  grid-template-rows: 48% 52%;
  grid-template-columns: 1fr;
}

/* Formato Lado a Lado: Moldes à esquerda, 3D à direita */
main.layout-split-h .stages-container {
  grid-template-columns: 52% 48%;
  grid-template-rows: 1fr;
}
main.layout-split-h .stage-pat {
  order: 1;
}
main.layout-split-h .stage-3d {
  order: 2;
  border-left: 1px solid var(--line);
}

main.layout-pattern .stages-container {
  grid-template-rows: 1fr;
}
main.layout-pattern .stage-3d {
  display: none;
}

main.layout-3d .stages-container {
  grid-template-rows: 1fr;
}
main.layout-3d .stage-pat {
  display: none;
}

.stage {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.stage-pat {
  border-top: 1px solid var(--line);
}

/* ==================== 3D STAGE ==================== */
#view {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: hidden;
  background: #5b705f;
}

#viewBg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

#photoModel {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 56px 12px 56px;
}

#photoModel[hidden] {
  display: none;
}

.fabric-bar {
  position: absolute;
  z-index: 5;
  left: 12px;
  bottom: 46px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 7px;
  border-radius: 11px;
  background: rgba(28, 29, 33, 0.85);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.fabric-swatches {
  display: flex;
  gap: 5px;
}

.fabric-swatches .sw {
  width: 20px;
  height: 20px;
}

.fabric-bar input[type="color"] {
  width: 24px;
  height: 24px;
  border-radius: 6px;
}

#photoCanvas {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  display: block;
}

#view > canvas {
  position: relative;
  z-index: 1;
  display: block;
  width: 100% !important;
  height: 100% !important;
  cursor: grab;
}

#view > canvas:active {
  cursor: grabbing;
}

/* Floating Selected Item Card (igual ao canto superior esquerdo do vídeo) */
.floating-selected {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 10;
  width: 260px;
  max-width: calc(100% - 20px);
  box-sizing: border-box;
  background: rgba(28, 29, 33, 0.94);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 10px;
  color: #e7e8ea;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  font-size: 11.5px;
}

.fs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  font-size: 12px;
  margin-bottom: 8px;
  color: #fff;
}

.fs-header button {
  border: 0;
  background: none;
  color: #9ea4ae;
  cursor: pointer;
}

.fs-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.fs-actions-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
}

.fs-btn {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  height: 26px;
  padding: 0 4px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
  color: #e5e7eb;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.12s;
}

.fs-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

.fs-btn[aria-pressed="true"] {
  background: rgba(94, 138, 115, 0.35);
  border-color: #6ca386;
  color: #9ce0bc;
}

.fs-btn.danger {
  color: #ff7b7b;
}

.fs-btn.full {
  width: 100%;
}

.fs-wrap-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.info-pill {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.3);
  display: inline-grid;
  place-items: center;
  font-size: 10px;
  font-style: italic;
  color: #9ea4ae;
  cursor: help;
  flex: none;
}

.fs-bleed-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #b5bac2;
}

.fs-bleed-row input {
  width: 52px;
  height: 24px;
  border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  padding: 0 5px;
  text-align: center;
}

.fs-place-title {
  margin-top: 2px;
  font-size: 10.5px;
  color: #9ea4ae;
  font-weight: 600;
}

.fs-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.fs-presets button {
  height: 24px;
  padding: 0 7px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  background: rgba(255, 255, 255, 0.04);
  color: #d5d8de;
  font-size: 10.5px;
  cursor: pointer;
}

.fs-presets button:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* Garment Picker Top-Right of 3D */
.gp {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.gp-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 12px 5px 6px;
  border-radius: 13px;
  cursor: pointer;
  text-align: left;
  background: rgba(33, 34, 38, 0.76);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.28);
}

.gp-ico {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: rgba(94, 138, 115, 0.25);
  font-size: 17px;
}

.gp-txt b {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: #84c5a2;
  letter-spacing: 0.03em;
}

.gp-txt small {
  display: block;
  font-size: 10.5px;
  color: #cbd0d8;
}

.gp-panel {
  margin-top: 6px;
  width: 350px;
  max-height: 420px;
  padding: 12px;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.gp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.gp-head h3 {
  margin: 0;
  font-size: 14px;
  color: var(--accent);
}

.gp-count {
  padding: 1px 7px;
  border-radius: 99px;
  background: var(--seg-bg);
  font-size: 11px;
  font-weight: 700;
}

.gp-chips {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.gp-chips button {
  height: 26px;
  padding: 0 9px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--field);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.gp-chips button[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.gp-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  overflow-y: auto;
}

.g-card {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--field);
  cursor: pointer;
  text-align: left;
  transition: all 0.12s;
}

.g-card:hover {
  border-color: var(--accent);
}

.g-card[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.g-card .gc-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 18px;
}

.g-card .gc-name {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
}

.g-card .gc-cut {
  font-size: 10px;
  color: var(--accent);
}

/* Live badge & 3D bottom bar */
.live-badge {
  position: absolute;
  z-index: 5;
  left: 12px;
  bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 99px;
  background: rgba(24, 25, 28, 0.76);
  backdrop-filter: blur(8px);
  color: #d5d8de;
  font-size: 11px;
  pointer-events: none;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #34a853;
  box-shadow: 0 0 0 3px rgba(52, 168, 83, 0.25);
}

.viewbar {
  position: absolute;
  z-index: 5;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px 6px;
  border-radius: 11px;
  background: rgba(28, 29, 33, 0.85);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #e5e7eb;
}

.viewbar .vsep {
  width: 1px;
  height: 16px;
  background: rgba(255, 255, 255, 0.15);
  margin: 0 3px;
}

/* ==================== 2D PATTERN EDITOR ==================== */
#mat {
  flex: 1;
  min-height: 0;
  position: relative;
  background: var(--mat-bg);
  overflow: hidden;
  user-select: none;
}

#mat.inside {
  background: var(--mat-in);
}

#mat.drop-active::after {
  content: attr(data-drop);
  position: absolute;
  inset: 28px 14px 14px 36px;
  border: 2px dashed var(--accent);
  background: rgba(94, 138, 115, 0.16);
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: #9ce0bc;
  font-size: 15px;
  font-weight: 600;
  z-index: 30;
  pointer-events: none;
}

.ruler {
  position: absolute;
  z-index: 4;
  background: var(--ruler-bg);
  pointer-events: none;
}

.ruler-top {
  top: 0;
  left: 24px;
  right: 0;
  height: 22px;
  border-bottom: 1px solid var(--line);
}

.ruler-left {
  top: 22px;
  left: 0;
  bottom: 0;
  width: 24px;
  border-right: 1px solid var(--line);
}

.ruler-corner {
  position: absolute;
  top: 0;
  left: 0;
  width: 24px;
  height: 22px;
  z-index: 5;
  background: var(--ruler-bg);
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  display: grid;
  place-items: center;
  font-size: 9.5px;
  color: var(--ruler-ink);
  font-weight: 600;
}

#patternCanvas {
  position: absolute;
  top: 22px;
  left: 24px;
  width: calc(100% - 24px);
  height: calc(100% - 22px);
  display: block;
  touch-action: none;
}

.pattern-top-bar {
  position: absolute;
  top: 30px;
  right: 14px;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pattern-status-pill {
  padding: 4px 10px;
  border-radius: 99px;
  background: rgba(24, 25, 28, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 11px;
  color: #9ce0bc;
}

/* Left Floating Tools on Pattern Mat */
.tools {
  position: absolute;
  z-index: 6;
  left: 34px;
  top: 32px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 5px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 11px;
  box-shadow: var(--shadow);
}

.tool {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--icon);
  cursor: pointer;
}

.tool:hover {
  background: var(--hover);
  color: var(--ink);
}

.tool[aria-pressed="true"] {
  background: var(--accent);
  color: #fff;
}

.tool-wrap {
  position: relative;
}

.tool-pop {
  position: absolute;
  left: calc(100% + 8px);
  top: 0;
  display: grid;
  grid-template-columns: repeat(4, 34px);
  gap: 4px;
  padding: 6px;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  box-shadow: var(--shadow);
}

.shape-btn {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-size: 15px;
}

.shape-btn:hover {
  background: var(--accent);
  color: #fff;
}

/* Unit selector (mm, cm, in) */
.unit-box {
  position: absolute;
  z-index: 6;
  left: 34px;
  top: 222px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 11px;
  box-shadow: var(--shadow);
}

.unit-box button {
  width: 32px;
  height: 24px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.unit-box button[aria-pressed="true"] {
  background: var(--accent-soft);
  color: #84c5a2;
}
:root:not([data-theme="dark"]) .unit-box button[aria-pressed="true"] {
  color: var(--accent);
}

.mat-foot {
  position: absolute;
  z-index: 5;
  left: 36px;
  bottom: 12px;
  color: #9ea4ae;
  font-size: 11.5px;
  pointer-events: none;
}

.zoombar {
  position: absolute;
  z-index: 6;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 11px;
  box-shadow: var(--shadow);
}

.zoombar .zv {
  min-width: 44px;
  text-align: center;
  font-size: 11.5px;
  font-weight: 600;
}

.zoombar .vsep {
  width: 1px;
  height: 16px;
  background: var(--line);
  margin: 0 3px;
}

/* ==================== RIGHT SIDEBAR (INSPECTOR) ==================== */
aside {
  border-left: 1px solid var(--line);
  background: var(--panel);
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.tabs {
  display: flex;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
  flex: none;
}

.tab {
  flex: 1;
  height: 44px;
  border: 0;
  background: none;
  cursor: pointer;
  color: var(--muted);
  font-weight: 600;
  font-size: 13px;
  position: relative;
}

.tab[aria-selected="true"] {
  color: var(--accent);
}

.tab[aria-selected="true"]::after {
  content: "";
  position: absolute;
  left: 12%;
  right: 12%;
  bottom: -1px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
}

.pane {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 4px 14px 16px;
  display: flex;
  flex-direction: column;
}

.sec {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.sec:last-child {
  border-bottom: 0;
}

.sec h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.badge-cdr {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--accent-soft);
  color: #84c5a2;
}

.sec .subt {
  margin: -4px 0 2px;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.row > .btn {
  flex: 1 1 auto;
}

.preset-art-box {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 2px;
  padding: 8px;
  border-radius: 9px;
  background: var(--field);
  border: 1px solid var(--line);
}

.preset-art-label {
  font-size: 10.5px;
  color: var(--muted);
  font-weight: 600;
}

.preset-art-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}

.preset-chip {
  height: 26px;
  padding: 0 6px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--panel);
  font-size: 10.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
}

.preset-chip:hover {
  border-color: var(--accent);
  color: #84c5a2;
}

/* Transform grid */
.xgrid {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 6px 8px;
  align-items: center;
}

.xgrid > span {
  color: var(--muted);
  font-size: 11.5px;
}

.num {
  display: flex;
  align-items: center;
  height: 28px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--field);
  padding: 0 7px;
}

.num input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-weight: 600;
  font-size: 12px;
}

.num em {
  font-style: normal;
  color: var(--faint);
  font-size: 11px;
  padding-left: 3px;
}

.rot90 {
  display: flex;
  gap: 6px;
}

.rot90 .btn {
  flex: 1;
}

.sub-inspector {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  border-radius: 8px;
  background: var(--field);
  border: 1px solid var(--line);
}

.f-stack {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11.5px;
  color: var(--muted);
}

textarea, select {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--panel);
  padding: 5px 8px;
  font-size: 12px;
}

.aligns {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  overflow: hidden;
}

.aligns button {
  height: 28px;
  border: 0;
  border-left: 1px solid var(--line);
  background: var(--field);
  cursor: pointer;
  color: var(--icon);
  font-size: 13px;
}

.aligns button:first-child {
  border-left: 0;
}

.aligns button:hover {
  background: var(--hover);
  color: var(--ink);
}

/* Layers list */
.layers {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-height: 175px;
  overflow-y: auto;
}

.layers li {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: var(--field);
  cursor: pointer;
}

.layers li:hover {
  border-color: var(--line-strong);
}

.layers li.active {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.layer-thumb {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  background: #fff;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  overflow: hidden;
  flex: none;
  color: #111;
  font-weight: 700;
  font-size: 12px;
}

.layer-thumb img {
  max-width: 26px;
  max-height: 26px;
  object-fit: contain;
}

.layer-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.layer-meta b {
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.layer-meta small {
  font-size: 10px;
  color: var(--muted);
}

.layer-eye {
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.layer-eye:hover {
  background: var(--hover);
  color: var(--ink);
}

.add-mini {
  width: 24px;
  height: 24px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--field);
  cursor: pointer;
  font-size: 12px;
}

.add-mini:hover {
  border-color: var(--accent);
}

/* Swatches */
.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.sw {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  cursor: pointer;
  padding: 0;
}

.sw[aria-pressed="true"] {
  box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--accent);
}

.custom-color-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
  font-size: 11px;
  color: var(--muted);
}

input[type="color"] {
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--field);
  cursor: pointer;
}

/* Toggles & Sliders */
.tgl {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  font-size: 12px;
}

.tgl input {
  appearance: none;
  -webkit-appearance: none;
  width: 34px;
  height: 19px;
  border-radius: 10px;
  background: var(--toggle-off);
  position: relative;
  cursor: pointer;
  transition: background 0.15s;
  margin: 0;
}

.tgl input::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s;
}

.tgl input:checked {
  background: var(--accent);
}

.tgl input:checked::after {
  transform: translateX(15px);
}

label.f {
  display: grid;
  grid-template-columns: 78px 1fr 38px;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

label.f.wide {
  grid-template-columns: 92px 1fr;
}

label.f > span:first-child {
  color: var(--label);
}

label.f output {
  color: var(--muted);
  text-align: right;
  font-size: 11px;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  height: 16px;
  margin: 0;
}

.look-card {
  margin-top: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.look-card h4 {
  margin: 0;
  font-size: 12px;
}

.look-reset {
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: var(--field);
  cursor: pointer;
  font-weight: 600;
  font-size: 12px;
}

.look-reset:hover {
  border-color: var(--accent);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  z-index: 100;
  padding: 9px 16px;
  border-radius: 10px;
  background: #141518;
  border: 1px solid var(--accent);
  color: #fff;
  font-size: 12.5px;
  font-weight: 500;
  box-shadow: var(--shadow);
}

/* campo de texto simples (etiqueta da gola) */
.inp-text {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--panel);
  padding: 5px 8px;
  font-size: 12px;
  color: inherit;
  box-sizing: border-box;
}
