﻿/* Pintar online â€” polished paint card (parity with desenhar shell) */

body.is-fullscreen .fs-workspace.paint-fs,
body.is-fullscreen .fs-workspace:has(#paint-app) {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  padding: 12px 14px 16px !important;
  box-sizing: border-box;
  min-height: min(78vh, 900px);
  background: #eef1f6 !important;
}

html[data-theme="dark"] body.is-fullscreen .fs-workspace.paint-fs,
html[data-theme="dark"] body.is-fullscreen .fs-workspace:has(#paint-app) {
  background: #0b0e14 !important;
}

/* Draft */
.paint-draft-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 10px;
  padding: 10px 14px;
  border-radius: 12px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e3a5f;
  font-size: 0.9rem;
  flex: 0 0 auto;
}
.paint-draft-banner[hidden] {
  display: none !important;
}
.paint-draft-btn {
  appearance: none;
  border: 1px solid #93c5fd;
  background: #fff;
  color: #1d4ed8;
  font: inherit;
  font-weight: 700;
  font-size: 0.82rem;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
}
.paint-draft-dismiss {
  border-color: transparent;
  background: transparent;
  color: #64748b;
}

/* App card */
.paint-app {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: min(70vh, 860px);
  height: min(72vh, 880px);
  margin: 0;
  background: #fff;
  color: var(--dica-body, #0f172a);
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid #e4e9f2;
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.04),
    0 10px 32px rgba(15, 23, 42, 0.07);
}
html[data-theme="dark"] .paint-app {
  background: #151922;
  border-color: #2a3140;
}

/* Shell: thin left rail + workspace */
.paint-shell {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
.paint-workspace {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
}

/* Thin vertical tool rail (editor convention â€” our icons/chrome) */
.paint-rail {
  flex: 0 0 48px;
  width: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
  padding: 8px 4px 10px;
  border-right: 1px solid #e2e8f0;
  background: #f1f5f9;
  z-index: 6;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
}
html[data-theme="dark"] .paint-rail {
  background: #0f141c;
  border-color: #2a3140;
}
.paint-rail .paint-tools {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 100%;
  flex: 0 0 auto;
}
.paint-rail-sep {
  width: 28px;
  height: 1px;
  margin: 4px 0;
  background: #cbd5e1;
  flex: 0 0 auto;
}
html[data-theme="dark"] .paint-rail-sep {
  background: #334155;
}
.paint-rail-fgbg {
  position: relative;
  width: 36px;
  height: 36px;
  margin-top: auto;
  flex: 0 0 auto;
}
.paint-rail-fgbg .paint-well {
  width: 18px;
  height: 18px;
  border-radius: 4px;
}
.paint-rail-fgbg .paint-well-fg {
  left: 2px;
  top: 2px;
}
.paint-rail-fgbg .paint-well-bg {
  right: 2px;
  bottom: 2px;
}
.paint-rail-swap {
  appearance: none;
  position: absolute;
  right: -2px;
  top: -4px;
  z-index: 3;
  border: 0;
  background: #fff;
  border-radius: 4px;
  font-size: 0.62rem;
  line-height: 1;
  padding: 1px 3px;
  cursor: pointer;
  box-shadow: 0 0 0 1px #cbd5e1;
  color: #475569;
}
html[data-theme="dark"] .paint-rail-swap {
  background: #1e2430;
  color: #cbd5e1;
  box-shadow: 0 0 0 1px #334155;
}

/* Menu bar â€” flat, continuous with context strip */
.paint-menubar {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0;
  padding: 0 4px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  background: #e8eaed;
  flex: 0 0 auto;
  z-index: 20;
  min-height: 24px;
  height: 24px;
  max-height: 24px;
  box-sizing: border-box;
  user-select: none;
  overflow: visible;
}
html[data-theme="dark"] .paint-menubar {
  background: #2b2f36;
  border-bottom-color: rgba(0, 0, 0, 0.25);
}
.paint-menu {
  position: relative;
}
.paint-menu-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: #4b5563;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 500;
  padding: 2px 8px;
  cursor: pointer;
  border-radius: 2px;
  margin: 0;
  height: 22px;
  line-height: 18px;
}
.paint-menu-btn:hover,
.paint-menu.is-open .paint-menu-btn {
  background: rgba(0, 0, 0, 0.06);
  color: #1f2937;
}
html[data-theme="dark"] .paint-menu-btn {
  color: #d1d5db;
}
html[data-theme="dark"] .paint-menu-btn:hover,
html[data-theme="dark"] .paint-menu.is-open .paint-menu-btn {
  background: rgba(255, 255, 255, 0.08);
  color: #f3f4f6;
}
.paint-menu-dd {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 220px;
  max-width: min(320px, 90vw);
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.14);
  padding: 6px;
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.paint-menu-dd[hidden] {
  display: none !important;
}
html[data-theme="dark"] .paint-menu-dd {
  background: #1a2030;
  border-color: #2a3140;
}
.paint-menu-dd button,
.paint-menu-dd label.paint-menu-file {
  appearance: none;
  border: 0;
  background: transparent;
  text-align: left;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  color: #334155;
  padding: 7px 10px;
  border-radius: 7px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
}
.paint-menu-dd button:hover,
.paint-menu-dd label.paint-menu-file:hover {
  background: #eff6ff;
  color: #1d4ed8;
}
html[data-theme="dark"] .paint-menu-dd button,
html[data-theme="dark"] .paint-menu-dd label.paint-menu-file {
  color: #e2e8f0;
}
html[data-theme="dark"] .paint-menu-dd button:hover,
html[data-theme="dark"] .paint-menu-dd label.paint-menu-file:hover {
  background: rgba(37, 99, 235, 0.2);
  color: #93c5fd;
}
.paint-menu-dd hr {
  border: 0;
  border-top: 1px solid #eef1f6;
  margin: 4px 6px;
}
html[data-theme="dark"] .paint-menu-dd hr {
  border-color: #2a3140;
}
.paint-menu-dd kbd {
  font-size: 0.68rem;
  font-weight: 700;
  color: #94a3b8;
  background: #f1f5f9;
  padding: 1px 5px;
  border-radius: 4px;
}
html[data-theme="dark"] .paint-menu-dd kbd {
  background: #0f141c;
  color: #64748b;
}
.paint-menu-check,
.paint-menu-select {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #334155;
  padding: 6px 10px;
}
html[data-theme="dark"] .paint-menu-check,
html[data-theme="dark"] .paint-menu-select {
  color: #e2e8f0;
}
.paint-menu-select select {
  flex: 1;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 3px 4px;
  background: #fff;
  color: #334155;
}
html[data-theme="dark"] .paint-menu-select select {
  background: #0f141c;
  border-color: #2a3140;
  color: #e2e8f0;
}
.paint-menu-hint {
  margin: 2px 10px 6px;
  font-size: 0.72rem;
  color: #94a3b8;
  font-weight: 600;
}

/* Context options bar â€” thin flat strip under menu (Photopea options density) */
.paint-ctx-bar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0;
  padding: 0 6px 0 8px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  background: #e8eaed;
  flex: 0 0 auto;
  z-index: 12;
  min-height: 26px;
  height: 26px;
  max-height: 26px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  box-sizing: border-box;
}
.paint-ctx-bar::-webkit-scrollbar {
  display: none;
}
html[data-theme="dark"] .paint-ctx-bar {
  background: #2b2f36;
  border-bottom-color: rgba(0, 0, 0, 0.4);
}
.paint-ctx {
  display: none;
  flex-wrap: nowrap;
  align-items: center;
  gap: 2px 10px;
  width: 100%;
  min-height: 26px;
  height: 26px;
}
.paint-ctx.is-active {
  display: flex;
}
.paint-ctx-label {
  font-size: 0.62rem;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  color: #6b7280;
  margin-right: 0;
  white-space: nowrap;
  opacity: 0.9;
}
html[data-theme="dark"] .paint-ctx-label {
  color: #9ca3af;
}
.paint-ctx-hint {
  font-size: 0.6rem;
  font-weight: 500;
  color: #9ca3af;
  white-space: nowrap;
  opacity: 0.75;
}
html[data-theme="dark"] .paint-ctx-hint {
  color: #6b7280;
}

/* Soft vertical dividers between option groups */
.paint-ctx > .paint-field,
.paint-ctx > .paint-brush-picker,
.paint-ctx > .paint-style-group,
.paint-ctx > .paint-btn {
  position: relative;
}
.paint-ctx > .paint-field + .paint-field,
.paint-ctx > .paint-brush-picker + .paint-field,
.paint-ctx > .paint-field + .paint-color-input,
.paint-ctx > .paint-style-group {
  padding-left: 10px;
}
.paint-ctx > .paint-field + .paint-field::before,
.paint-ctx > .paint-brush-picker + .paint-field::before,
.paint-ctx > .paint-field + .paint-color-input::before,
.paint-ctx > .paint-style-group::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 1px;
  height: 12px;
  background: rgba(0, 0, 0, 0.1);
}
html[data-theme="dark"] .paint-ctx > .paint-field + .paint-field::before,
html[data-theme="dark"] .paint-ctx > .paint-brush-picker + .paint-field::before,
html[data-theme="dark"] .paint-ctx > .paint-field + .paint-color-input::before,
html[data-theme="dark"] .paint-ctx > .paint-style-group::before {
  background: rgba(255, 255, 255, 0.12);
}

/* Compact controls only inside context bar */
.paint-ctx-bar .paint-field {
  gap: 4px;
  font-size: 0.62rem;
  font-weight: 500;
  color: #6b7280;
  height: 20px;
}
.paint-ctx-bar .paint-field span:first-child {
  font-size: 0.62rem;
  font-weight: 500;
  color: #6b7280;
  text-transform: none;
  opacity: 0.95;
}
.paint-ctx-bar .paint-field input[type="range"] {
  width: 64px;
  height: 2px;
  accent-color: #7b8494;
}
.paint-ctx-bar .paint-field-val {
  min-width: 1.4rem;
  font-size: 0.62rem;
  font-weight: 500;
  color: #6b7280;
  opacity: 0.85;
  font-variant-numeric: tabular-nums;
}
/* Compact number fields in options strip (Photopea-like — no native spinners) */
.paint-ctx-bar .paint-num-in {
  -moz-appearance: textfield;
  appearance: textfield;
  width: 2.2rem;
  min-width: 2.2rem;
  height: 18px;
  padding: 0 4px;
  margin: 0;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.55);
  color: #4b5563;
  font: inherit;
  font-size: 0.62rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: center;
  box-sizing: border-box;
  line-height: 16px;
}
.paint-ctx-bar .paint-num-in::-webkit-outer-spin-button,
.paint-ctx-bar .paint-num-in::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
  display: none;
}
.paint-ctx-bar .paint-num-in:focus {
  outline: none;
  border-color: rgba(0, 0, 0, 0.28);
  background: #fff;
}
html[data-theme="dark"] .paint-ctx-bar .paint-num-in,
.paint-app.paint-app--shell .paint-ctx-bar .paint-num-in {
  background: rgba(0, 0, 0, 0.28);
  border-color: rgba(255, 255, 255, 0.12);
  color: #d1d5db;
}
.paint-app.paint-app--shell .paint-ctx-bar .paint-num-in:focus {
  background: #1f2329;
  border-color: rgba(255, 255, 255, 0.22);
  color: #f3f4f6;
}
.paint-ctx-bar .paint-ctx-select {
  max-width: 7.5rem;
  height: 18px;
  padding: 0 2px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.55);
  color: #4b5563;
  font: inherit;
  font-size: 0.62rem;
  font-weight: 500;
}
html[data-theme="dark"] .paint-ctx-bar .paint-ctx-select,
.paint-app.paint-app--shell .paint-ctx-bar .paint-ctx-select {
  background: rgba(0, 0, 0, 0.28);
  border-color: rgba(255, 255, 255, 0.12);
  color: #d1d5db;
}
.paint-ctx-bar .paint-field select.paint-ctx-select {
  max-width: 7.5rem;
}
.paint-ctx-bar .paint-btn {
  min-height: 18px;
  height: 18px;
  padding: 0 6px;
  font-size: 0.62rem;
  font-weight: 500;
  border-radius: 2px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: transparent;
  color: #5b6472;
  box-shadow: none;
}
.paint-ctx-bar .paint-btn:hover {
  background: rgba(0, 0, 0, 0.05);
}
html[data-theme="dark"] .paint-ctx-bar .paint-btn {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.1);
  color: #c4c9d1;
}
html[data-theme="dark"] .paint-ctx-bar .paint-btn:hover {
  background: rgba(255, 255, 255, 0.06);
}
.paint-ctx-bar .paint-chip {
  min-height: 18px;
  height: 18px;
  padding: 0 6px;
  font-size: 0.62rem;
  font-weight: 500;
  border-radius: 2px;
  background: transparent;
  border: 1px solid transparent;
  color: #6b7280;
  box-shadow: none;
}
.paint-ctx-bar .paint-chip:hover {
  background: rgba(0, 0, 0, 0.05);
}
.paint-ctx-bar .paint-chip.is-active {
  background: rgba(0, 0, 0, 0.07);
  color: #374151;
  box-shadow: none;
  border-color: rgba(0, 0, 0, 0.08);
}
html[data-theme="dark"] .paint-ctx-bar .paint-chip {
  color: #9ca3af;
}
html[data-theme="dark"] .paint-ctx-bar .paint-chip.is-active {
  background: rgba(255, 255, 255, 0.1);
  color: #e5e7eb;
  border-color: transparent;
}
.paint-btn-ghost {
  background: transparent !important;
  border-color: #e2e8f0 !important;
}

/* Right panel tabs */
.paint-panel-tabs {
  display: flex;
  gap: 2px;
  margin: -4px -2px 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e2e8f0;
  flex: 0 0 auto;
}
html[data-theme="dark"] .paint-panel-tabs {
  border-color: #2a3140;
}
.paint-panel-tab {
  appearance: none;
  border: 0;
  background: transparent;
  flex: 1 1 0;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 800;
  color: #64748b;
  padding: 6px 4px;
  border-radius: 8px;
  cursor: pointer;
}
.paint-panel-tab:hover {
  background: #eef2f7;
  color: #0f172a;
}
.paint-panel-tab.is-active {
  background: #dbeafe;
  color: #1d4ed8;
}
html[data-theme="dark"] .paint-panel-tab:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #e2e8f0;
}
html[data-theme="dark"] .paint-panel-tab.is-active {
  background: rgba(37, 99, 235, 0.28);
  color: #93c5fd;
}
.paint-panel {
  display: none;
  flex-direction: column;
  gap: 8px;
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}
.paint-panel.is-active {
  display: flex;
}
.paint-panel[hidden] {
  display: none !important;
}
.paint-options-drawer {
  display: none !important;
}

/* Brush picker â€” flat dropdown in options strip */
.paint-brush-picker {
  position: relative;
  flex: 0 0 auto;
}
.paint-brush-picker-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid transparent;
  background: transparent;
  color: #5b6472;
  font: inherit;
  font-size: 0.62rem;
  font-weight: 500;
  padding: 1px 4px 1px 3px;
  border-radius: 2px;
  cursor: pointer;
  min-width: 0;
  height: 18px;
}
.paint-brush-picker-btn:hover,
.paint-brush-picker.is-open .paint-brush-picker-btn {
  border-color: rgba(0, 0, 0, 0.1);
  background: rgba(0, 0, 0, 0.04);
  color: #374151;
}
html[data-theme="dark"] .paint-brush-picker-btn {
  background: transparent;
  border-color: transparent;
  color: #c4c9d1;
}
html[data-theme="dark"] .paint-brush-picker-btn:hover,
html[data-theme="dark"] .paint-brush-picker.is-open .paint-brush-picker-btn {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.1);
  color: #f3f4f6;
}
.paint-brush-picker-ico {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 40%, #9ca3af 0%, #4b5563 70%);
  display: inline-block;
  flex: 0 0 auto;
  opacity: 0.9;
}
.paint-brush-picker-label {
  flex: 0 1 auto;
  text-align: left;
  max-width: 4rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.paint-brush-picker-caret {
  font-size: 0.5rem;
  opacity: 0.45;
}
.paint-brush-picker-dd {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 168px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.14);
  padding: 5px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.paint-brush-picker-dd[hidden] {
  display: none !important;
}
html[data-theme="dark"] .paint-brush-picker-dd {
  background: #1a2030;
  border-color: #2a3140;
}
.paint-brush-pick {
  appearance: none;
  border: 0;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  color: #334155;
  padding: 7px 8px;
  border-radius: 8px;
  cursor: pointer;
}
.paint-brush-pick:hover {
  background: #f1f5f9;
}
.paint-brush-pick.is-active {
  background: #dbeafe;
  color: #1d4ed8;
}
html[data-theme="dark"] .paint-brush-pick {
  color: #e2e8f0;
}
html[data-theme="dark"] .paint-brush-pick:hover {
  background: rgba(255, 255, 255, 0.06);
}
html[data-theme="dark"] .paint-brush-pick.is-active {
  background: rgba(37, 99, 235, 0.28);
  color: #93c5fd;
}
.paint-brush-preview {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: #0f172a;
}
.paint-brush-preview--hard {
  background: #0f172a;
}
.paint-brush-preview--soft {
  background: radial-gradient(circle, #0f172a 20%, transparent 70%);
}
.paint-brush-preview--air {
  background: radial-gradient(circle, rgba(15, 23, 42, 0.45) 10%, transparent 75%);
}
.paint-brush-preview--texture {
  background:
    radial-gradient(circle at 30% 40%, #0f172a 2px, transparent 3px),
    radial-gradient(circle at 70% 60%, #0f172a 1.5px, transparent 2.5px),
    radial-gradient(circle at 50% 50%, rgba(15, 23, 42, 0.35) 40%, transparent 70%);
}
.paint-brush-preview--ink {
  background: linear-gradient(135deg, #0f172a 40%, transparent 70%);
  border-radius: 40% 60% 50% 50%;
}
.paint-brush-preview--chalk {
  background:
    radial-gradient(circle at 35% 40%, #475569 3px, transparent 4px),
    radial-gradient(circle at 65% 55%, #64748b 2px, transparent 3px),
    radial-gradient(circle, rgba(71, 85, 105, 0.4) 50%, transparent 72%);
}
.paint-brush-preview--tip {
  background: conic-gradient(from 0deg, #0f172a, #64748b, #0f172a);
  clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
  border-radius: 0;
}

/* Advanced options drawer */
.paint-options-drawer {
  flex: 0 0 auto;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
  max-height: 140px;
  overflow: auto;
  z-index: 4;
}
.paint-options-drawer[hidden] {
  display: none !important;
}
html[data-theme="dark"] .paint-options-drawer {
  background: #12161e;
  border-color: #2a3140;
}
.paint-options-drawer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  padding: 8px 10px;
}

/* legacy class alias */
.paint-topbar {
  display: none;
}

.paint-tools {
  display: inline-flex;
  gap: 2px;
  flex: 0 0 auto;
}
.paint-tool {
  appearance: none;
  border: 0;
  background: transparent;
  color: #64748b;
  font: inherit;
  font-size: 0.68rem;
  font-weight: 700;
  min-width: 40px;
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  line-height: 1;
  -webkit-tap-highlight-color: transparent;
}
.paint-rail .paint-tool {
  width: 40px;
  height: 36px;
  min-width: 36px;
  border-radius: 8px;
}
.paint-tool:hover {
  background: #e2e8f0;
  color: #0f172a;
}
.paint-tool.is-active {
  background: #dbeafe;
  color: #1d4ed8;
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.25);
}
html[data-theme="dark"] .paint-tool:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #e2e8f0;
}
html[data-theme="dark"] .paint-tool.is-active {
  background: rgba(37, 99, 235, 0.28);
  color: #93c5fd;
  box-shadow: inset 0 0 0 1px rgba(147, 197, 253, 0.2);
}
.paint-tool-ico {
  display: flex;
  width: 22px;
  height: 22px;
  align-items: center;
  justify-content: center;
}
.paint-tool-ico svg {
  width: 20px;
  height: 20px;
  display: block;
}

.paint-sep {
  width: 1px;
  height: 40px;
  background: #e8edf4;
  flex: 0 0 auto;
}
html[data-theme="dark"] .paint-sep {
  background: #2a3140;
}

.paint-brush-presets,
.paint-style-group {
  display: inline-flex;
  gap: 3px;
  flex: 0 0 auto;
  padding: 2px;
  border-radius: 999px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
}
html[data-theme="dark"] .paint-brush-presets,
html[data-theme="dark"] .paint-style-group {
  background: #1a1f2a;
  border-color: #2a3140;
}
.paint-chip {
  appearance: none;
  border: 0;
  background: transparent;
  color: #64748b;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
  line-height: 1.1;
}
.paint-chip:hover {
  color: #0f172a;
  background: rgba(255, 255, 255, 0.7);
}
.paint-chip.is-active {
  background: #fff;
  color: #1d4ed8;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.1);
}
html[data-theme="dark"] .paint-chip.is-active {
  background: #243044;
  color: #93c5fd;
}

.paint-color-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 0 0 auto;
}
.paint-swatches {
  display: grid;
  grid-template-columns: repeat(8, 20px);
  gap: 3px;
  flex: 0 0 auto;
}
.paint-history {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  min-height: 16px;
  max-width: 220px;
}
.paint-color-advanced {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  margin-top: 2px;
}
.paint-hex-field {
  gap: 2px !important;
}
.paint-hex-input {
  width: 64px;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  font-family: ui-monospace, Consolas, monospace;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 3px 5px;
  text-transform: lowercase;
  color: #334155;
  background: #fff;
}
html[data-theme="dark"] .paint-hex-input {
  background: #1a1f2a;
  border-color: #2a3140;
  color: #e2e8f0;
}
.paint-color-advanced .paint-field input[type="range"] {
  width: 72px;
}
.paint-layer-row.is-locked {
  opacity: 0.85;
}
.paint-layer-lock {
  appearance: none;
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 2px 4px;
  color: #64748b;
}
.paint-layer-lock.is-on {
  color: #b45309;
}
.paint-layer-row.is-mask-edit {
  outline: 2px solid #a855f7;
  outline-offset: 1px;
}
.paint-layer-clip {
  appearance: none;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  border-radius: 6px;
  font-size: 0.62rem;
  font-weight: 800;
  color: #64748b;
  padding: 2px 4px;
  cursor: pointer;
  line-height: 1.2;
}
.paint-layer-clip.is-on {
  color: #7c3aed;
  border-color: #c4b5fd;
  background: #f5f3ff;
}
html[data-theme="dark"] .paint-layer-clip {
  background: #0f141c;
  border-color: #2a3140;
  color: #94a3b8;
}
html[data-theme="dark"] .paint-layer-clip.is-on {
  color: #c4b5fd;
  border-color: #6d28d9;
  background: #1e1b2e;
}
.paint-xform {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}
.paint-xform .paint-layer-actions {
  grid-column: 1 / -1;
}
.paint-num {
  -moz-appearance: textfield;
  appearance: textfield;
  width: 100%;
  max-width: 72px;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 3px 5px;
  background: #fff;
  color: #334155;
}
.paint-num::-webkit-outer-spin-button,
.paint-num::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
  display: none;
}
html[data-theme="dark"] .paint-num {
  background: #0f141c;
  border-color: #2a3140;
  color: #e2e8f0;
}
.paint-pal-select {
  flex: 1 1 100%;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 4px 6px;
  background: #fff;
  color: #334155;
  max-width: 100%;
}
html[data-theme="dark"] .paint-pal-select {
  background: #0f141c;
  border-color: #2a3140;
  color: #e2e8f0;
}
.paint-app.is-mask-mode .paint-stage-wrap {
  box-shadow: inset 0 0 0 3px rgba(168, 85, 247, 0.45);
}
.paint-fg-bg {
  position: relative;
  display: inline-flex;
  align-items: flex-end;
  width: 44px;
  height: 36px;
  flex: 0 0 auto;
  margin: 0 4px 0 0;
}
.paint-well {
  appearance: none;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px #94a3b8;
  border-radius: 6px;
  padding: 0;
  cursor: pointer;
  width: 22px;
  height: 22px;
}
.paint-well-fg {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 2;
  background: #0f172a;
}
.paint-well-bg {
  position: absolute;
  right: 0;
  bottom: 0;
  z-index: 1;
  background: #ffffff;
}
.paint-well.is-active {
  box-shadow: 0 0 0 2px #2563eb;
}
.paint-well-swap {
  position: absolute;
  right: -2px;
  top: -4px;
  z-index: 3;
  font-size: 0.65rem !important;
  padding: 0 3px !important;
  min-height: 0 !important;
  line-height: 1.2;
}
.paint-crop-dim {
  position: absolute;
  pointer-events: none;
  border: 1px dashed #f59e0b;
  box-shadow: 0 0 0 9999px rgba(15, 23, 42, 0.45);
  z-index: 5;
}
.paint-tip-import {
  font-size: 0.72rem !important;
  padding: 2px 6px !important;
}
.paint-xform .paint-check {
  grid-column: 1 / -1;
  font-size: 0.75rem;
}
.paint-brush-preset-sel {
  max-width: 110px;
  font-size: 0.7rem !important;
}
.paint-layer-row.is-group {
  background: rgba(37, 99, 235, 0.08);
  font-weight: 700;
}
.paint-layer-row.is-child {
  padding-left: 10px;
}
.paint-layer-row.is-text-layer .paint-layer-name::before {
  content: "T ";
  opacity: 0.55;
  font-weight: 800;
}
.paint-layer-row[draggable="true"] {
  cursor: grab;
}
.paint-layer-row.is-drag-over {
  outline: 2px dashed #2563eb;
}
.paint-history-panel {
  max-height: 120px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 8px;
  font-size: 0.72rem;
}
.paint-hist-step {
  appearance: none;
  border: 1px solid #e2e8f0;
  background: #fff;
  border-radius: 6px;
  padding: 3px 6px;
  text-align: left;
  cursor: pointer;
  color: #475569;
  font: inherit;
  font-weight: 600;
}
.paint-hist-step:hover {
  border-color: #93c5fd;
  color: #1d4ed8;
}
html[data-theme="dark"] .paint-hist-step {
  background: #0f141c;
  border-color: #2a3140;
  color: #94a3b8;
}
.paint-draft-quota {
  font-size: 0.72rem;
  color: #b45309;
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: 8px;
  padding: 6px 8px;
  margin: 6px 0;
}
html[data-theme="dark"] .paint-draft-quota {
  background: #2a2010;
  border-color: #92400e;
  color: #fbbf24;
}
.paint-drag-hint {
  margin-top: 0 !important;
  opacity: 0.85;
}
.paint-rulers {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
}
.paint-ruler {
  position: absolute;
  pointer-events: auto;
  background: rgba(248, 250, 252, 0.92);
  z-index: 5;
}
.paint-ruler-h {
  top: 0;
  left: 18px;
  right: 0;
  height: 16px;
  border-bottom: 1px solid #cbd5e1;
  cursor: col-resize;
}
.paint-ruler-v {
  top: 16px;
  left: 0;
  bottom: 0;
  width: 16px;
  border-right: 1px solid #cbd5e1;
  cursor: row-resize;
}
html[data-theme="dark"] .paint-ruler {
  background: rgba(15, 20, 28, 0.92);
  border-color: #334155;
}
.paint-stage-wrap {
  position: relative;
}
.paint-history .paint-swatch,
.paint-hist {
  width: 16px !important;
  height: 16px !important;
}
.paint-opts-inline {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}
.paint-field select {
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 4px 6px;
  background: #fff;
  color: #334155;
  max-width: 150px;
}
html[data-theme="dark"] .paint-field select {
  background: #1a1f2a;
  border-color: #2a3140;
  color: #e2e8f0;
}
.paint-swatch {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.12);
}
.paint-swatch.is-active {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.28);
}
.paint-swatch.is-light {
  box-shadow: inset 0 0 0 1px #cbd5e1;
}
.paint-color-input {
  width: 34px;
  height: 30px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0;
  cursor: pointer;
  background: #fff;
  flex: 0 0 auto;
}

.paint-sliders {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  flex: 1 1 auto;
}
.paint-field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #475569;
  white-space: nowrap;
}
.paint-field input[type="range"] {
  width: 90px;
  accent-color: #2563eb;
}
.paint-field-val {
  min-width: 38px;
  font-variant-numeric: tabular-nums;
  color: #64748b;
  font-size: 0.75rem;
  font-weight: 600;
}
html[data-theme="dark"] .paint-field {
  color: #cbd5e1;
}

/* Body: canvas center, Camadas panel on the right (editor convention) */
.paint-body {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  flex-direction: row;
}

.paint-sidebar {
  order: 2;
  width: 220px;
  flex: 0 0 auto;
  border-right: 0;
  border-left: 1px solid #eef1f6;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  padding: 12px 10px;
  gap: 8px;
  overflow: auto;
}
html[data-theme="dark"] .paint-sidebar {
  background: #12161e;
  border-color: #2a3140;
}
.paint-side-title {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #94a3b8;
  margin: 0;
}
.paint-layer-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.paint-layer-row {
  display: grid;
  grid-template-columns: 28px 1fr 28px;
  grid-template-rows: auto auto auto;
  gap: 3px 4px;
  padding: 7px 8px;
  border-radius: 12px;
  border: 1px solid #e8edf4;
  background: #fff;
  cursor: pointer;
}
.paint-layer-row .paint-layer-blend,
.paint-layer-row .paint-layer-op {
  grid-column: 1 / -1;
}
.paint-layer-blend {
  grid-column: 1 / -1;
  width: 100%;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 3px 6px;
  background: #f8fafc;
  color: #334155;
}
html[data-theme="dark"] .paint-layer-blend {
  background: #0f141c;
  border-color: #2a3140;
  color: #e2e8f0;
}
.paint-ref-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.paint-ref-preview {
  width: 100%;
  height: 100px;
  border-radius: 10px;
  border: 1px dashed #cbd5e1;
  background: #fff center/contain no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: #94a3b8;
  font-weight: 600;
}
.paint-ref-preview.is-empty {
  background-color: #f8fafc;
}
html[data-theme="dark"] .paint-ref-preview {
  border-color: #2a3140;
  background-color: #0f141c;
}
.paint-export-group {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.paint-sep-h {
  width: 1px;
  height: 28px;
  background: #e2e8f0;
  margin: 0 2px;
}
html[data-theme="dark"] .paint-sep-h {
  background: #2a3140;
}
.paint-layer-row.is-active {
  border-color: #93c5fd;
  background: #eff6ff;
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.12);
}
html[data-theme="dark"] .paint-layer-row {
  background: #1a1f2a;
  border-color: #2a3140;
}
html[data-theme="dark"] .paint-layer-row.is-active {
  background: rgba(37, 99, 235, 0.16);
  border-color: #2563eb;
}
.paint-layer-vis {
  appearance: none;
  border: 0;
  background: #f1f5f9;
  border-radius: 8px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #475569;
  padding: 0;
}
.paint-layer-vis.is-off {
  opacity: 0.45;
}
html[data-theme="dark"] .paint-layer-vis {
  background: #0f141c;
  color: #cbd5e1;
}
.paint-layer-name {
  appearance: none;
  border: 0;
  background: transparent;
  font: inherit;
  font-weight: 700;
  font-size: 0.84rem;
  color: #0f172a;
  text-align: left;
  cursor: pointer;
  padding: 4px 2px;
}
html[data-theme="dark"] .paint-layer-name {
  color: #e2e8f0;
}
.paint-layer-op {
  grid-column: 1 / -1;
  width: 100%;
  accent-color: #2563eb;
  margin: 2px 0 0;
}
.paint-layer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.paint-layer-actions .paint-btn {
  min-height: 32px;
  padding: 4px 10px;
  font-size: 0.78rem;
}
.paint-side-note {
  margin: 4px 0 0;
  font-size: 0.76rem;
  color: #64748b;
  line-height: 1.4;
}

/* Stage (order 1 = left of sidebar which is order 2) */
.paint-stage-wrap {
  order: 1;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  position: relative;
  background:
    linear-gradient(45deg, #e8edf4 25%, transparent 25%),
    linear-gradient(-45deg, #e8edf4 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e8edf4 75%),
    linear-gradient(-45deg, transparent 75%, #e8edf4 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  background-color: #f1f5f9;
}
html[data-theme="dark"] .paint-stage-wrap {
  background-color: #0b0e14;
  background-image: none;
}

.paint-stage {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  touch-action: none;
}

#paint-display {
  display: block;
  width: auto;
  height: auto;
  max-width: none;
  max-height: none;
  touch-action: none;
  cursor: none;
  border-radius: 6px;
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.06),
    0 16px 40px rgba(15, 23, 42, 0.14);
  background: #fafbfc;
  user-select: none;
  -webkit-user-select: none;
}
#paint-display.is-pan {
  cursor: grab;
}

.paint-cursor {
  position: absolute;
  z-index: 6;
  border: 1.5px solid #2563eb;
  border-radius: 999px;
  pointer-events: none;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.7);
  mix-blend-mode: difference;
}
.paint-cursor[hidden] {
  display: none !important;
}

.paint-hint {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 7;
  margin: 0;
  padding: 12px 20px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.95);
  color: #fff;
  font-weight: 700;
  font-size: 0.92rem;
  /* must not block strokes â€” canvas is underneath */
  pointer-events: none;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.18);
  max-width: 90%;
  text-align: center;
}
.paint-hint[hidden] {
  display: none !important;
}

.paint-zoom {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 6;
  font-size: 0.75rem;
  font-weight: 700;
  color: #475569;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  padding: 4px 10px;
  pointer-events: none;
}
html[data-theme="dark"] .paint-zoom {
  background: rgba(26, 31, 42, 0.92);
  border-color: #2a3140;
  color: #cbd5e1;
}

/* Bottom */
.paint-bottombar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  padding: 10px 12px 12px;
  border-top: 1px solid #eef1f6;
  background: #fff;
  flex: 0 0 auto;
  z-index: 5;
}
html[data-theme="dark"] .paint-bottombar {
  background: #151922;
  border-color: #2a3140;
}

.paint-btn {
  appearance: none;
  border: 1px solid #e5eaf1;
  background: #fff;
  color: #475569;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 700;
  min-height: 38px;
  padding: 6px 13px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  line-height: 1.2;
  -webkit-tap-highlight-color: transparent;
}
.paint-btn:hover:not(:disabled) {
  border-color: #bfdbfe;
  color: #1d4ed8;
  background: #f8fbff;
}
.paint-btn:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}
.paint-btn-primary {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.28);
}
.paint-btn-primary:hover:not(:disabled) {
  filter: brightness(1.05);
  color: #fff;
  background: #2563eb;
}
html[data-theme="dark"] .paint-btn {
  background: #1a1f2a;
  border-color: #2a3140;
  color: #cbd5e1;
}
html[data-theme="dark"] .paint-btn-primary {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}

.paint-import-label {
  cursor: pointer;
  margin: 0;
}
.paint-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  user-select: none;
}
html[data-theme="dark"] .paint-check {
  color: #cbd5e1;
}

.paint-tip {
  margin-left: auto;
  font-size: 0.78rem;
  color: #64748b;
  padding: 8px 12px;
  border-radius: 999px;
  background: #eef5ff;
  border: 1px solid #dbeafe;
  line-height: 1.3;
  max-width: 100%;
}
.paint-tip a {
  color: #1d4ed8;
  font-weight: 700;
  text-decoration: none;
}
.paint-tip a:hover {
  text-decoration: underline;
}
.paint-tip kbd {
  font-size: 0.72rem;
  font-weight: 700;
  background: #fff;
  border: 1px solid #bfdbfe;
  border-radius: 4px;
  padding: 0 4px;
}
html[data-theme="dark"] .paint-tip {
  background: #1a2332;
  border-color: #2a3140;
  color: #94a3b8;
}

.paint-status {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.paint-credit {
  font-size: 0.85rem;
  color: #64748b;
  margin-top: 0.75rem;
}

/* ---- Color picker dialog (opens from left rail wells) ---- */
.paint-cp {
  position: absolute;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  background: transparent;
}
.paint-cp:not([hidden]) {
  pointer-events: auto;
}
.paint-cp[hidden] {
  display: none !important;
}
.paint-cp-card {
  width: min(420px, calc(100% - 24px));
  background: #3a3f46;
  color: #e5e7eb;
  border: 1px solid #1f2329;
  border-radius: 4px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  font-size: 0.72rem;
  user-select: none;
  pointer-events: auto;
}
.paint-cp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px 6px 10px;
  background: #2f343b;
  border-bottom: 1px solid #1f2329;
  font-weight: 600;
  font-size: 0.75rem;
  cursor: move;
}
.paint-cp-x {
  appearance: none;
  border: 0;
  background: transparent;
  color: #9ca3af;
  font-size: 1.1rem;
  line-height: 1;
  width: 22px;
  height: 22px;
  cursor: pointer;
  border-radius: 2px;
}
.paint-cp-x:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}
.paint-cp-main {
  display: flex;
  gap: 8px;
  padding: 10px;
  align-items: flex-start;
}
.paint-cp-sv-wrap {
  position: relative;
  width: 180px;
  height: 150px;
  flex: 0 0 auto;
  cursor: crosshair;
  border: 1px solid #1f2329;
  border-radius: 2px;
  overflow: hidden;
}
.paint-cp-sv-wrap canvas {
  display: block;
  width: 180px;
  height: 150px;
}
.paint-cp-ring {
  position: absolute;
  width: 12px;
  height: 12px;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.55);
  transform: translate(-50%, -50%);
  pointer-events: none;
  left: 0;
  top: 0;
}
.paint-cp-hue-wrap {
  position: relative;
  width: 14px;
  height: 150px;
  flex: 0 0 auto;
  cursor: ns-resize;
  border: 1px solid #1f2329;
  border-radius: 2px;
  overflow: hidden;
}
.paint-cp-hue-wrap canvas {
  display: block;
  width: 14px;
  height: 150px;
}
.paint-cp-hue-mark {
  position: absolute;
  left: -2px;
  right: -2px;
  height: 4px;
  border: 1px solid #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  top: 0;
  border-radius: 1px;
}
.paint-cp-side {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.paint-cp-preview {
  width: 100%;
  height: 36px;
  border-radius: 2px;
  border: 1px solid #1f2329;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}
.paint-cp-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px 6px;
}
.paint-cp-field {
  display: flex;
  align-items: center;
  gap: 4px;
  color: #9ca3af;
  font-weight: 500;
}
.paint-cp-field span {
  width: 1.1rem;
  flex: 0 0 auto;
  text-align: right;
  font-size: 0.65rem;
}
.paint-cp-field input {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  background: #1f2329;
  border: 1px solid #4b5563;
  color: #e5e7eb;
  border-radius: 2px;
  padding: 2px 4px;
  font: inherit;
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
}
.paint-cp-field input:focus {
  outline: none;
  border-color: #6b7280;
}
.paint-cp-hex-row {
  grid-column: 1 / -1;
}
.paint-cp-actions {
  display: flex;
  gap: 6px;
  margin-top: 2px;
}
.paint-cp-btn {
  appearance: none;
  flex: 1 1 auto;
  border: 1px solid #4b5563;
  background: #2f343b;
  color: #e5e7eb;
  font: inherit;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 4px 6px;
  border-radius: 2px;
  cursor: pointer;
}
.paint-cp-btn:hover {
  background: #3d434c;
}
.paint-cp-btn-ok {
  background: #4b5563;
  border-color: #6b7280;
}
.paint-cp-btn-ok:hover {
  background: #5b6573;
}
.paint-cp-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  padding: 0 10px 10px;
}
.paint-cp-swatches .paint-swatch {
  width: 16px !important;
  height: 16px !important;
  border-radius: 2px;
  border: 1px solid rgba(0, 0, 0, 0.35);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  padding: 0;
  cursor: pointer;
}
.paint-cp-swatches .paint-swatch.is-light {
  border-color: rgba(255, 255, 255, 0.25);
}

/* =====================================================================
   Dark editor shell + doc tabs + quiet canvas (Photopea-like chrome)
   Forced on .paint-app.paint-app--shell so the tool always feels like an editor
   ===================================================================== */
body.is-fullscreen .fs-workspace.paint-fs,
body.is-fullscreen .fs-workspace:has(#paint-app) {
  padding: 8px 10px 10px !important;
  background: #1a1d22 !important;
}

html body .paint-app.paint-app--shell {
  background: #2b2f36 !important;
  color: #d1d5db;
  border-color: #1f2329 !important;
  border-radius: 8px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}

/* Continuous charcoal chrome */
.paint-app.paint-app--shell .paint-rail {
  background: #2b2f36;
  border-right-color: #1f2329;
}
.paint-app.paint-app--shell .paint-rail-sep {
  background: #3d434c;
}
.paint-app.paint-app--shell .paint-rail-swap {
  background: #3a3f46;
  color: #d1d5db;
  box-shadow: 0 0 0 1px #1f2329;
}
.paint-app.paint-app--shell .paint-menubar,
.paint-app.paint-app--shell .paint-ctx-bar {
  background: #2b2f36;
  border-bottom-color: #1f2329;
}
.paint-app.paint-app--shell .paint-menu-btn {
  color: #c4c9d1;
  font-weight: 500;
}
.paint-app.paint-app--shell .paint-menu-btn:hover,
.paint-app.paint-app--shell .paint-menu.is-open .paint-menu-btn {
  background: rgba(255, 255, 255, 0.08);
  color: #f3f4f6;
}
.paint-app.paint-app--shell .paint-ctx-label,
.paint-app.paint-app--shell .paint-ctx-hint,
.paint-app.paint-app--shell .paint-ctx-bar .paint-field,
.paint-app.paint-app--shell .paint-ctx-bar .paint-field span:first-child,
.paint-app.paint-app--shell .paint-ctx-bar .paint-field-val {
  color: #9ca3af;
}
.paint-app.paint-app--shell .paint-brush-picker-btn {
  color: #c4c9d1;
}
.paint-app.paint-app--shell .paint-brush-picker-btn:hover,
.paint-app.paint-app--shell .paint-brush-picker.is-open .paint-brush-picker-btn {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.1);
  color: #f3f4f6;
}
.paint-app.paint-app--shell .paint-ctx > .paint-field + .paint-field::before,
.paint-app.paint-app--shell .paint-ctx > .paint-brush-picker + .paint-field::before,
.paint-app.paint-app--shell .paint-ctx > .paint-style-group::before {
  background: rgba(255, 255, 255, 0.12);
}
.paint-app.paint-app--shell .paint-ctx-bar .paint-btn,
.paint-app.paint-app--shell .paint-ctx-bar .paint-chip {
  color: #9ca3af;
  border-color: transparent;
  background: transparent;
}
.paint-app.paint-app--shell .paint-ctx-bar .paint-chip.is-active,
.paint-app.paint-app--shell .paint-ctx-bar .paint-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #e5e7eb;
}
.paint-app.paint-app--shell .paint-ctx-bar .paint-field input[type="range"] {
  accent-color: #8b93a0;
}

/* Tools on dark rail */
.paint-app.paint-app--shell .paint-tool {
  color: #9ca3af;
}
.paint-app.paint-app--shell .paint-tool:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #e5e7eb;
}
.paint-app.paint-app--shell .paint-tool.is-active {
  background: rgba(255, 255, 255, 0.12) !important;
  color: #f3f4f6 !important;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1) !important;
}
/* kill blue active from base/dark theme */
html[data-theme="dark"] .paint-app.paint-app--shell .paint-tool.is-active {
  background: rgba(255, 255, 255, 0.12) !important;
  color: #f3f4f6 !important;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1) !important;
}

/* Doc tabs â€” thin strip under options bar */
.paint-doctabs {
  display: flex;
  align-items: flex-end;
  gap: 0;
  flex: 0 0 auto;
  min-height: 24px;
  height: 24px;
  padding: 0 0 0 4px;
  background: #23262b;
  border-bottom: 1px solid #1f2329;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}
.paint-doctabs::-webkit-scrollbar {
  display: none;
}
.paint-doctab {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  max-width: 200px;
  padding: 0 8px 0 8px;
  margin: 2px 1px 0;
  background: #3a3f46;
  color: #d1d5db;
  border: 1px solid #1f2329;
  border-bottom: 0;
  border-radius: 4px 4px 0 0;
  font-size: 0.68rem;
  font-weight: 500;
  cursor: default;
  user-select: none;
  white-space: nowrap;
}
.paint-doctab.is-active {
  background: #454b54;
  color: #f3f4f6;
  z-index: 1;
}
.paint-doctab-ico {
  font-size: 0.62rem;
  opacity: 0.7;
  line-height: 1;
}
.paint-doctab-name {
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  max-width: 140px;
  outline: none;
}
.paint-doctab-name.is-editing {
  background: #1f2329;
  color: #fff;
  border-radius: 2px;
  padding: 0 3px;
  max-width: 160px;
}
.paint-doctab-x {
  appearance: none;
  border: 0;
  background: transparent;
  color: #9ca3af;
  font-size: 0.85rem;
  line-height: 1;
  width: 14px;
  height: 14px;
  padding: 0;
  margin-left: 2px;
  border-radius: 2px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}
.paint-doctab-x:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}
.paint-doctab-add {
  appearance: none;
  border: 0;
  background: transparent;
  color: #9ca3af;
  width: 22px;
  height: 20px;
  margin: 2px 4px 0;
  border-radius: 3px 3px 0 0;
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1;
  flex: 0 0 auto;
}
.paint-doctab-add:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #f3f4f6;
}

/* Sidebar dark continuous */
.paint-app.paint-app--shell .paint-sidebar {
  background: #2b2f36;
  border-left-color: #1f2329;
  padding: 8px 8px;
}
.paint-app.paint-app--shell .paint-panel-tabs {
  margin: 0 0 6px;
  padding-bottom: 6px;
  border-bottom-color: #1f2329;
}
.paint-app.paint-app--shell .paint-panel-tab {
  color: #9ca3af;
  border-radius: 3px;
  font-weight: 600;
  font-size: 0.68rem;
  padding: 4px 3px;
}
.paint-app.paint-app--shell .paint-panel-tab:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #e5e7eb;
}
.paint-app.paint-app--shell .paint-panel-tab.is-active {
  background: rgba(255, 255, 255, 0.1);
  color: #f3f4f6;
}
.paint-app.paint-app--shell .paint-side-title {
  color: #6b7280;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.paint-app.paint-app--shell .paint-layer-list {
  gap: 2px;
}
.paint-app.paint-app--shell .paint-layer-row {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) 22px;
  grid-template-rows: auto;
  gap: 2px 3px;
  background: #23262b;
  border-color: #1f2329;
  border-radius: 3px;
  padding: 3px 4px;
  align-items: center;
}
.paint-app.paint-app--shell .paint-layer-row .paint-layer-blend,
.paint-app.paint-app--shell .paint-layer-row .paint-layer-op,
.paint-app.paint-app--shell .paint-layer-row .paint-layer-clip {
  grid-column: 1 / -1;
}
.paint-app.paint-app--shell .paint-layer-row.is-active {
  background: #3a3f46;
  border-color: #4b5563;
  box-shadow: none;
}
.paint-app.paint-app--shell .paint-layer-row.is-child {
  margin-left: 8px;
  border-left: 2px solid #3d434c;
}
.paint-app.paint-app--shell .paint-layer-row.is-group {
  background: #2a2e35;
}
.paint-app.paint-app--shell .paint-layer-name {
  color: #e5e7eb;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 1px 2px;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.paint-app.paint-app--shell .paint-layer-vis,
.paint-app.paint-app--shell .paint-layer-lock {
  background: #1f2329;
  color: #9ca3af;
  border-radius: 2px;
  width: 20px;
  height: 20px;
  font-size: 0.62rem;
  min-height: 0;
  padding: 0;
}
.paint-app.paint-app--shell .paint-layer-clip {
  grid-column: 1 / -1;
  font-size: 0.6rem;
  min-height: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 2px;
  background: transparent;
  border: 1px solid #3d434c;
  color: #6b7280;
}
.paint-app.paint-app--shell .paint-layer-clip.is-on {
  color: #e5e7eb;
  border-color: #6b7280;
  background: rgba(255, 255, 255, 0.06);
}
.paint-app.paint-app--shell .paint-layer-blend {
  background: #1f2329;
  border-color: #3d434c;
  color: #d1d5db;
  border-radius: 2px;
  font-size: 0.62rem;
  padding: 1px 3px;
  height: 18px;
}
.paint-app.paint-app--shell .paint-layer-op {
  height: 3px;
  margin: 0;
  accent-color: #8b93a0;
}
.paint-app.paint-app--shell .paint-layer-actions {
  gap: 3px;
}
.paint-app.paint-app--shell .paint-layer-actions .paint-btn {
  min-height: 20px;
  height: 20px;
  padding: 0 5px;
  font-size: 0.62rem;
  border-radius: 2px;
}
.paint-app.paint-app--shell .paint-side-title {
  margin-top: 4px;
  font-size: 0.62rem;
}
.paint-app.paint-app--shell .paint-side-note,
.paint-app.paint-app--shell .paint-drag-hint {
  font-size: 0.62rem;
  margin: 2px 0 0;
}
.paint-app.paint-app--shell .paint-ref-preview {
  height: 72px;
  border-radius: 3px;
  font-size: 0.65rem;
}
.paint-app.paint-app--shell .paint-xform {
  gap: 3px;
}
.paint-app.paint-app--shell .paint-num {
  width: 3.2rem;
  height: 18px;
  font-size: 0.62rem;
  padding: 0 3px;
}
.paint-app.paint-app--shell .paint-side-note,
.paint-app.paint-app--shell .paint-drag-hint {
  color: #6b7280;
}
.paint-app.paint-app--shell .paint-ref-preview {
  background-color: #1f2329;
  border-color: #3d434c;
  color: #6b7280;
  border-radius: 4px;
}
.paint-app.paint-app--shell .paint-hex-input,
.paint-app.paint-app--shell .paint-pal-select,
.paint-app.paint-app--shell .paint-num,
.paint-app.paint-app--shell .paint-field select {
  background: #1f2329;
  border-color: #3d434c;
  color: #e5e7eb;
  border-radius: 3px;
}
.paint-app.paint-app--shell .paint-field {
  color: #9ca3af;
}
.paint-app.paint-app--shell .paint-field input[type="range"] {
  accent-color: #8b93a0;
}
.paint-app.paint-app--shell .paint-check {
  color: #9ca3af;
}
.paint-app.paint-app--shell .paint-btn {
  background: #3a3f46;
  border-color: #4b5563;
  color: #d1d5db;
  border-radius: 3px;
  min-height: 26px;
  padding: 3px 8px;
  font-size: 0.72rem;
  font-weight: 600;
}
.paint-app.paint-app--shell .paint-btn:hover:not(:disabled) {
  background: #454b54;
  border-color: #6b7280;
  color: #f3f4f6;
}
.paint-app.paint-app--shell .paint-btn-primary {
  background: #4b5563;
  border-color: #6b7280;
  color: #fff;
  box-shadow: none;
}
.paint-app.paint-app--shell .paint-btn-primary:hover:not(:disabled) {
  background: #5b6573;
  filter: none;
}
.paint-app.paint-app--shell .paint-layer-actions .paint-btn {
  min-height: 24px;
  padding: 2px 7px;
  font-size: 0.68rem;
}

/* Stage â€” quiet dark canvas well */
.paint-app.paint-app--shell .paint-stage-wrap {
  background-color: #1e2126;
  background-image: none;
}
.paint-app.paint-app--shell #paint-display {
  border-radius: 0;
  box-shadow: 0 0 0 1px #111, 0 8px 24px rgba(0, 0, 0, 0.35);
  background: #fafbfc;
}
.paint-app.paint-app--shell .paint-cursor {
  border-color: rgba(255, 255, 255, 0.85);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.45);
  mix-blend-mode: difference;
}

/* Mute center hint â€” never a loud blue pill */
.paint-app.paint-app--shell .paint-hint {
  display: none !important;
}
.paint-hint {
  /* fallback if shell class missing: keep quiet */
  background: rgba(43, 47, 54, 0.88);
  color: #d1d5db;
  font-weight: 500;
  font-size: 0.78rem;
  padding: 6px 12px;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  pointer-events: none;
}

.paint-app.paint-app--shell .paint-zoom {
  background: rgba(43, 47, 54, 0.9);
  border-color: #1f2329;
  color: #9ca3af;
  border-radius: 3px;
  font-weight: 600;
  font-size: 0.68rem;
  padding: 2px 7px;
  right: 8px;
  bottom: 8px;
}

/* Thin status bottom bar (not a big web toolbar) */
.paint-app.paint-app--shell .paint-bottombar {
  background: #2b2f36;
  border-top-color: #1f2329;
  padding: 3px 8px;
  gap: 6px;
  min-height: 28px;
}
.paint-app.paint-app--shell .paint-bottombar .paint-btn {
  min-height: 22px;
  height: 22px;
  padding: 0 8px;
  font-size: 0.68rem;
  border-radius: 2px;
}
.paint-app.paint-app--shell .paint-status-line {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.65rem;
  font-weight: 500;
  color: #6b7280;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 6px;
}
.paint-app.paint-app--shell .paint-tip {
  margin-left: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
  font-size: 0.62rem;
  color: #6b7280;
  max-width: none;
}
.paint-app.paint-app--shell .paint-tip a {
  color: #9ca3af;
  font-weight: 500;
}
.paint-app.paint-app--shell .paint-tip a:hover {
  color: #e5e7eb;
}
.paint-app.paint-app--shell .paint-tip kbd {
  background: #1f2329;
  border-color: #3d434c;
  color: #9ca3af;
  border-radius: 2px;
  font-weight: 600;
  font-size: 0.6rem;
}

/* Draft banner quieter on dark workspace */
body.is-fullscreen .paint-draft-banner {
  background: #2b2f36;
  border-color: #3d434c;
  color: #d1d5db;
  border-radius: 6px;
}
body.is-fullscreen .paint-draft-btn {
  background: #3a3f46;
  border-color: #4b5563;
  color: #e5e7eb;
  border-radius: 4px;
}

/* History list rows on dark shell */
.paint-app.paint-app--shell .paint-history-panel,
.paint-app.paint-app--shell .paint-hist-step {
  color: #9ca3af;
}
.paint-app.paint-app--shell .paint-hist-step {
  border-color: #1f2329;
  background: #23262b;
}
.paint-app.paint-app--shell .paint-hist-step.is-current {
  background: #3a3f46;
  color: #e5e7eb;
}

/* Wells on dark rail */
.paint-app.paint-app--shell .paint-well {
  border-color: #2b2f36;
  box-shadow: 0 0 0 1px #6b7280;
}
.paint-app.paint-app--shell .paint-well.is-active {
  box-shadow: 0 0 0 2px #e5e7eb;
}

/* Rulers if present */
.paint-app.paint-app--shell .paint-ruler {
  background: #2b2f36;
  color: #6b7280;
  border-color: #1f2329;
}

@media (max-width: 960px) {
  .paint-shell {
    flex-direction: column;
  }
  .paint-rail {
    flex: 0 0 auto;
    width: 100%;
    flex-direction: row;
    align-items: center;
    padding: 6px 8px;
    border-right: 0;
    border-bottom: 1px solid #e2e8f0;
    overflow-x: auto;
    overflow-y: hidden;
  }
  .paint-rail .paint-tools {
    flex-direction: row;
    width: auto;
  }
  .paint-rail-sep {
    width: 1px;
    height: 24px;
    margin: 0 4px;
  }
  .paint-rail-fgbg {
    margin-top: 0;
    margin-left: 8px;
  }
  .paint-body {
    flex-direction: column;
  }
  .paint-stage-wrap {
    order: 1;
  }
  .paint-sidebar {
    order: 2;
    width: 100%;
    border-left: 0;
    border-right: 0;
    border-top: 1px solid #eef1f6;
    max-height: 160px;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-start;
  }
  .paint-layer-list {
    flex-direction: row;
    flex-wrap: wrap;
    flex: 1 1 auto;
  }
  .paint-layer-row {
    width: 140px;
  }
  .paint-field input[type="range"] {
    width: 64px;
  }
  .paint-swatches {
    grid-template-columns: repeat(8, 20px);
  }
  .paint-app {
    height: min(78vh, 920px);
  }
  .paint-tip {
    margin-left: 0;
    width: 100%;
    border-radius: 12px;
  }
}
