/* Remover fundo — pro editor chrome
   top actions + center canvas + right options rail
*/

/* Static before/after in article body (SEO + trust — not the live editor) */
.itool-ba-demo {
  margin: 0 0 18px;
  padding: 0;
  border: 1px solid #e4e9f2;
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}
.itool-ba-demo img {
  display: block;
  width: 100%;
  height: auto;
  margin: 0;
}
.itool-ba-demo figcaption {
  margin: 0;
  padding: 10px 14px 12px;
  font-size: 0.86rem;
  line-height: 1.45;
  color: #64748b;
  border-top: 1px solid #e4e9f2;
  background: #f8fafc;
}
html[data-theme="dark"] .itool-ba-demo {
  background: #151922;
  border-color: #2a3140;
}
html[data-theme="dark"] .itool-ba-demo figcaption {
  background: #11161f;
  border-top-color: #2a3140;
  color: #94a3b8;
}

/* Shared shell for IA image tools: remover fundo, desfocar, colorir P&B */
body.is-fullscreen .fs-workspace.rbg-fs,
body.is-fullscreen .fs-workspace:has(#rbg-app),
body.is-fullscreen .fs-workspace:has(#dfr-app),
body.is-fullscreen .fs-workspace:has(#dfb-app),
body.is-fullscreen .fs-workspace:has(#clr-app),
body.is-fullscreen .fs-workspace:has(#up-app) {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  padding: 10px 12px 14px !important;
  box-sizing: border-box;
  min-height: min(78vh, 920px);
  background: #e8ecf3 !important;
}

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

.rbg-app {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  min-height: min(70vh, 860px);
  height: min(74vh, 900px);
  margin: 0;
  background: #fff;
  color: var(--dica-body, #0f172a);
  overflow: hidden;
  border-radius: 16px;
  border: 1px solid #e4e9f2;
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.04),
    0 12px 36px rgba(15, 23, 42, 0.08);
}

html[data-theme="dark"] .rbg-app {
  background: #151922;
  border-color: #2a3140;
  color: #e2e8f0;
}

/* ---- Top bar ---- */
.rbg-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  flex: 0 0 auto;
  padding: 8px 12px;
  border-bottom: 1px solid #e4e9f2;
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  color: #f8fafc;
}

.rbg-topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1 1 auto;
}

.rbg-brand {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #2563eb;
  color: #fff;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.rbg-brand-icon {
  display: block;
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.rbg-brand-text {
  font-weight: 800;
  font-size: 0.92rem;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.rbg-top-status {
  font-size: 0.8rem;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: min(480px, 42vw);
}

.rbg-top-status.is-ok {
  color: #86efac;
}
.rbg-top-status.is-error {
  color: #fca5a5;
}
.rbg-top-status.is-loading {
  color: #fde68a;
}

.rbg-topbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  position: relative;
  z-index: 2;
}

/* Primary CTA + first-run honesty line under it */
.rbg-primary-wrap {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 3px;
  max-width: 11.5rem;
}

.rbg-primary-wrap .rbg-top-btn-primary {
  width: 100%;
  text-align: center;
}

.rbg-first-run-hint {
  display: block;
  font-size: 0.62rem;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0.01em;
  color: #94a3b8;
  white-space: normal;
  text-align: center;
  padding: 0 2px;
}

.rbg-first-run-hint[hidden] {
  display: none !important;
}

html[data-theme="dark"] .rbg-first-run-hint {
  color: #8b93a7;
}

@media (max-width: 720px) {
  .rbg-primary-wrap {
    max-width: 7.5rem;
  }
  .rbg-first-run-hint {
    font-size: 0.58rem;
  }
}

.rbg-top-btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: #f1f5f9;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 7px 12px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
}

.rbg-top-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.12);
}

.rbg-top-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.rbg-top-btn-primary {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}

.rbg-top-btn-primary:hover:not(:disabled) {
  background: #1d4ed8;
  border-color: #1d4ed8;
}

.rbg-top-btn-ghost {
  border-color: transparent;
  background: transparent;
  color: #94a3b8;
}

/* ---- Body ---- */
.rbg-body {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
}

/* Workspace */
.rbg-workspace {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(45deg, #eef2f7 25%, transparent 25%),
    linear-gradient(-45deg, #eef2f7 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #eef2f7 75%),
    linear-gradient(-45deg, transparent 75%, #eef2f7 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  background-color: #f1f5f9;
  overflow: auto;
}

html[data-theme="dark"] .rbg-workspace {
  background-color: #0f141d;
  background-image:
    linear-gradient(45deg, #151b26 25%, transparent 25%),
    linear-gradient(-45deg, #151b26 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #151b26 75%),
    linear-gradient(-45deg, transparent 75%, #151b26 75%);
}

.rbg-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* Drop */
.rbg-drop {
  margin: auto;
  max-width: 440px;
  width: calc(100% - 48px);
  padding: 36px 28px;
  border: 2px dashed #94a3b8;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.9);
  text-align: center;
  cursor: pointer;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.06);
}

.rbg-drop[hidden] {
  display: none !important;
}

.rbg-drop:hover,
.rbg-drop.is-dragover {
  border-color: #2563eb;
  background: #fff;
}

.rbg-drop-icon {
  color: #64748b;
  margin-bottom: 10px;
}

.rbg-drop-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 6px;
}

.rbg-drop-hint {
  font-size: 0.85rem;
  color: #64748b;
  margin-bottom: 16px;
}

.rbg-drop-cta {
  appearance: none;
  border: none;
  background: #2563eb;
  color: #fff;
  font: inherit;
  font-weight: 800;
  font-size: 0.9rem;
  padding: 10px 18px;
  border-radius: 10px;
  cursor: pointer;
}

html[data-theme="dark"] .rbg-drop {
  background: rgba(21, 25, 34, 0.92);
  border-color: #475569;
}
html[data-theme="dark"] .rbg-drop-title {
  color: #f1f5f9;
}

/* Stage */
.rbg-stage-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 16px 18px;
  margin: auto 0;
  width: 100%;
  box-sizing: border-box;
}

.rbg-stage-wrap[hidden] {
  display: none !important;
}

.rbg-stage-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.rbg-stage-bar-btn {
  appearance: none;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #334155;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
}

.rbg-meta {
  font-size: 0.78rem;
  font-weight: 600;
  color: #64748b;
}

/* Compare panes */
.rbg-compare {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  width: 100%;
}

@media (min-width: 720px) {
  .rbg-compare:has(.rbg-result-pane:not([hidden])) {
    grid-template-columns: 1fr 1fr;
  }
}

.rbg-pane {
  min-width: 0;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 14px;
  padding: 12px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

html[data-theme="dark"] .rbg-pane {
  background: rgba(21, 25, 34, 0.75);
  border-color: #2a3140;
}

.rbg-pane-label {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 8px;
}

.rbg-preview-wrap:not(.is-visible) {
  display: none;
}

.rbg-preview-wrap.is-visible {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
}

.rbg-preview-wrap img,
.rbg-result-wrap img {
  max-width: 100%;
  max-height: min(48vh, 420px);
  width: auto;
  height: auto;
  display: block;
  margin: 0 auto;
  border-radius: 10px;
}

/* Colorir P&B / upscale — drop actions + before/after slider */
.clr-drop-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: center;
  margin-top: 14px;
}

/* Sample CTA stack: button + selling caption */
.rbg-sample-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.rbg-sample-caption {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 600;
  color: #64748b;
  line-height: 1.25;
  text-align: center;
}

html[data-theme="dark"] .rbg-sample-caption {
  color: #94a3b8;
}

.rbg-drop-actions-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

.rbg-drop-actions-col .clr-drop-actions {
  margin-top: 0;
}

/* Mobile short CTA for IA tools (upscale + rbg shell) */
.up-btn-label-short,
.rbg-btn-label-short {
  display: none;
}
@media (max-width: 720px) {
  .up-btn-label-full,
  .rbg-btn-label-full {
    display: none;
  }
  .up-btn-label-short,
  .rbg-btn-label-short {
    display: inline;
  }
}

/* Keep clear usable while busy (cancel + reset) */
.rbg-app.is-busy .rbg-top-btn-ghost#rbg-btn-clear,
.rbg-app.is-busy .rbg-top-btn-ghost#clr-btn-clear,
.rbg-app.is-busy .rbg-top-btn-ghost#dfr-btn-clear,
.rbg-app.is-busy .rbg-top-btn-ghost#dfb-btn-clear,
.rbg-app.is-busy .rbg-top-btn-ghost#up-btn-clear {
  opacity: 1;
  pointer-events: auto;
}

/* Visually hidden label for file input */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.clr-ba {
  width: 100%;
  max-width: 720px;
  margin: 0 auto 4px;
  user-select: none;
  touch-action: none;
}

.clr-ba[hidden] {
  display: none !important;
}

.clr-ba-frame {
  position: relative;
  width: 100%;
  border-radius: 14px;
  overflow: hidden;
  background: #0f172a;
  border: 1px solid rgba(15, 23, 42, 0.12);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.12);
  aspect-ratio: 4 / 3;
  max-height: min(52vh, 460px);
}

.clr-ba-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  pointer-events: none;
  background: #0f172a;
}

.clr-ba-clip {
  position: absolute;
  inset: 0 auto 0 0;
  width: 50%;
  overflow: hidden;
  z-index: 2;
  border-right: 2px solid rgba(255, 255, 255, 0.92);
}

/* Gray layer must match full frame width so clip reveals aligned pixels */
.clr-ba-clip .clr-ba-img--gray {
  width: 100cqi;
  max-width: none;
  left: 0;
}

.clr-ba-frame {
  container-type: inline-size;
}

/* Fallback when container query units unavailable */
@supports not (width: 1cqi) {
  .clr-ba-clip .clr-ba-img--gray {
    width: 100vw;
    max-width: 720px;
  }
}

.clr-ba-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  z-index: 3;
  width: 0;
  pointer-events: none;
  transform: translateX(-50%);
}

.clr-ba-line {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  background: rgba(255, 255, 255, 0.95);
  transform: translateX(-50%);
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.35);
}

.clr-ba-knob {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #fff;
  color: #0f172a;
  font-size: 14px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
  border: 2px solid #e2e8f0;
}

.clr-ba-range {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: ew-resize;
  z-index: 4;
}

.clr-ba-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #64748b;
}

/* When BA slider is visible, hide dual panes (less clutter) */
.rbg-compare.clr-compare--dual {
  display: none !important;
}

html[data-theme="dark"] .clr-ba-frame {
  border-color: #2a3140;
  background: #0b0e14;
}

html[data-theme="dark"] .clr-ba-img {
  background: #0b0e14;
}

html[data-theme="dark"] .clr-ba-knob {
  background: #1e293b;
  color: #f8fafc;
  border-color: #475569;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
}

html[data-theme="dark"] .clr-ba-line {
  background: rgba(248, 250, 252, 0.92);
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.55);
}

html[data-theme="dark"] .clr-ba-clip {
  border-right-color: rgba(248, 250, 252, 0.88);
}

html[data-theme="dark"] .clr-ba-labels {
  color: #94a3b8;
}

/* Checkerboard BA (transparent PNG compare — remover fundo) */
.clr-ba--checker .clr-ba-frame {
  background-color: #fff;
  background-image:
    linear-gradient(45deg, #cfcfcf 25%, transparent 25%),
    linear-gradient(-45deg, #cfcfcf 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #cfcfcf 75%),
    linear-gradient(-45deg, transparent 75%, #cfcfcf 75%);
  background-size: 14px 14px;
  background-position: 0 0, 0 7px, 7px -7px, -7px 0;
}

.clr-ba--checker .clr-ba-img--color {
  background: transparent;
}

.clr-ba--checker .clr-ba-img--gray {
  background: #0f172a;
}

html[data-theme="dark"] .clr-ba--checker .clr-ba-frame {
  background-color: #1a1f2a;
  background-image:
    linear-gradient(45deg, #2a3344 25%, transparent 25%),
    linear-gradient(-45deg, #2a3344 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #2a3344 75%),
    linear-gradient(-45deg, transparent 75%, #2a3344 75%);
  border-color: #2a3140;
}

html[data-theme="dark"] .clr-ba--checker .clr-ba-img--gray {
  background: #0b0e14;
}

.rbg-result-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
}

/* Classic transparent-PNG checker (Photoshop-style) */
.rbg-checker {
  background-color: #fff;
  background-image:
    linear-gradient(45deg, #cfcfcf 25%, transparent 25%),
    linear-gradient(-45deg, #cfcfcf 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #cfcfcf 75%),
    linear-gradient(-45deg, transparent 75%, #cfcfcf 75%);
  background-size: 14px 14px;
  background-position: 0 0, 0 7px, 7px -7px, -7px 0;
  border-radius: 12px;
  padding: 12px;
  border: 1px solid #e2e8f0;
}

.rbg-checker img {
  background: transparent;
  max-width: 100%;
  height: auto;
}

html[data-theme="dark"] .rbg-checker {
  background-color: #1a1f2a;
  background-image:
    linear-gradient(45deg, #2a3344 25%, transparent 25%),
    linear-gradient(-45deg, #2a3344 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #2a3344 75%),
    linear-gradient(-45deg, transparent 75%, #2a3344 75%);
  border-color: #334155;
}

/* ---- Cross-tool next-step chips (post-result, one line) ---- */
.rbg-next {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  width: 100%;
  max-width: 720px;
  margin: 10px auto 0;
  padding: 0 4px 2px;
}

.rbg-next[hidden] {
  display: none !important;
}

.rbg-next-label {
  flex: 0 0 auto;
  font-size: 0.78rem;
  font-weight: 800;
  color: #64748b;
  letter-spacing: 0.01em;
}

.rbg-next-chip {
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid #dbe3f0;
  background: #f8fafc;
  color: #0f172a !important;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.15;
  text-decoration: none !important;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.rbg-next-chip:hover {
  border-color: #93c5fd;
  background: #eff6ff;
  color: #1d4ed8 !important;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.1);
}

html[data-theme="dark"] .rbg-next-label {
  color: #94a3b8;
}

html[data-theme="dark"] .rbg-next-chip {
  background: #1a2030;
  border-color: #3a4558;
  color: #e8ecf4 !important;
}

html[data-theme="dark"] .rbg-next-chip:hover {
  background: #243044;
  border-color: #60a5fa;
  color: #93c5fd !important;
}

/* ---- Sticky result actions (mobile-safe after success) ---- */
.rbg-result-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid #e4e9f2;
  box-shadow: 0 -10px 28px rgba(15, 23, 42, 0.1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.rbg-result-bar[hidden] {
  display: none !important;
}

.rbg-result-bar-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  align-items: center;
  max-width: 720px;
  margin: 0 auto;
}

.rbg-result-bar-btn {
  appearance: none;
  border: 1px solid #d0d7e4;
  background: #fff;
  color: #0f172a;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  min-width: 5.5rem;
  line-height: 1.1;
}

.rbg-result-bar-btn:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}

.rbg-result-bar-btn-primary {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}

.rbg-result-bar-btn-primary:hover {
  background: #1d4ed8;
  border-color: #1d4ed8;
}

.rbg-result-bar-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

html[data-theme="dark"] .rbg-result-bar {
  background: rgba(15, 18, 28, 0.96);
  border-top-color: #2a3140;
  box-shadow: 0 -10px 28px rgba(0, 0, 0, 0.35);
}

html[data-theme="dark"] .rbg-result-bar-btn {
  background: #1a2030;
  border-color: #3a4558;
  color: #e8ecf4;
}

html[data-theme="dark"] .rbg-result-bar-btn:hover {
  background: #243044;
  border-color: #5a6a85;
}

html[data-theme="dark"] .rbg-result-bar-btn-primary {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}

/* Keep page content above the fixed bar when visible */
body.is-fullscreen:has(.rbg-result-bar:not([hidden])) .main-container,
body.is-fullscreen:has(.rbg-result-bar:not([hidden])) .fs-workspace {
  padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
}

@media (max-width: 720px) {
  .rbg-result-bar-inner {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .rbg-result-bar-btn {
    min-width: 0;
    width: 100%;
    padding: 11px 10px;
  }
}

/* Progress */
.rbg-progress-wrap {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
}

.rbg-progress-wrap[hidden] {
  display: none !important;
}

.rbg-progress-bar {
  height: 8px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}

.rbg-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #2563eb, #60a5fa);
  transition: width 0.2s ease;
}

.rbg-progress-text {
  margin-top: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #64748b;
  text-align: center;
}

html[data-theme="dark"] .rbg-progress-bar {
  background: #2a3140;
}

html[data-theme="dark"] .rbg-progress-fill {
  background: linear-gradient(90deg, #3b82f6, #93c5fd);
}

html[data-theme="dark"] .rbg-progress-text {
  color: #94a3b8;
}

.rbg-app.is-busy .rbg-drop {
  pointer-events: none;
  opacity: 0.7;
}

/* ---- Right options rail ---- */
.rbg-rail {
  display: flex;
  flex-direction: column;
  flex: 0 0 260px;
  width: 260px;
  border-left: 1px solid #e4e9f2;
  background: #f8fafc;
  padding: 14px 14px 16px;
  overflow-y: auto;
  gap: 14px;
}

html[data-theme="dark"] .rbg-rail {
  background: #11161f;
  border-left-color: #2a3140;
}

.rbg-rail-title {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #64748b;
}

/* Grouped options: Processamento / Saída */
.rbg-rail-group {
  margin: 0;
  padding: 0;
  border: none;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.rbg-rail-group + .rbg-rail-group {
  margin-top: 2px;
  padding-top: 12px;
  border-top: 1px solid #e4e9f2;
}

html[data-theme="dark"] .rbg-rail-group + .rbg-rail-group {
  border-top-color: #2a3140;
}

.rbg-rail-group-title {
  padding: 0;
  margin: 0 0 2px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #94a3b8;
  float: none;
  width: auto;
}

/* Locked until an image is loaded (fieldset:disabled + visual) */
.rbg-rail.is-locked .rbg-rail-group,
.rbg-rail-group:disabled {
  opacity: 0.48;
}

.rbg-rail-group:disabled .rbg-select,
.rbg-rail-group:disabled .rbg-color,
.rbg-rail-group:disabled input {
  cursor: not-allowed;
}

.rbg-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.rbg-field[hidden] {
  display: none !important;
}

.rbg-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: #334155;
}

html[data-theme="dark"] .rbg-label {
  color: #cbd5e1;
}

.rbg-select,
.rbg-color {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  color: #0f172a;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 9px 10px;
}

.rbg-color {
  height: 42px;
  padding: 4px;
  cursor: pointer;
}

html[data-theme="dark"] .rbg-select,
html[data-theme="dark"] .rbg-color {
  background: #1e293b;
  border-color: #334155;
  color: #e2e8f0;
}

.rbg-field-hint {
  margin: 0;
  font-size: 0.72rem;
  line-height: 1.35;
  color: #94a3b8;
}

.rbg-rail-foot {
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid #e4e9f2;
}

.rbg-rail-foot p {
  margin: 0;
  font-size: 0.74rem;
  line-height: 1.4;
  color: #94a3b8;
}

html[data-theme="dark"] .rbg-rail-foot {
  border-top-color: #2a3140;
}

/* Mobile */
@media (max-width: 860px) {
  .rbg-app {
    height: auto;
    min-height: 70vh;
  }

  .rbg-body {
    flex-direction: column;
  }

  .rbg-rail {
    flex: 0 0 auto;
    width: 100%;
    border-left: none;
    border-top: 1px solid #e4e9f2;
  }

  .rbg-top-status {
    display: none;
  }

  .rbg-brand-text {
    display: none;
  }

  .rbg-preview-wrap img,
  .rbg-result-wrap img {
    max-height: 280px;
  }
}

/* History strip for IA tools (mirror img-tools.css) */
/* ── Local history strip — app card (thumb + ghost actions) ── */
.itool-hist-host {
  margin: 14px 0 10px;
  width: 100%;
  max-width: 920px;
  padding: 0 12px;
  box-sizing: border-box;
}
.rbg-workspace > .itool-hist-host,
.rbg-app .itool-hist-host {
  margin-left: auto;
  margin-right: auto;
  max-width: min(920px, 100%);
}
.itool-hist-host[hidden] {
  display: none !important;
}
.itool-hist {
  margin: 0;
  width: 100%;
}
.itool-hist-card {
  margin: 0;
  padding: 16px 18px 14px;
  border-radius: 16px;
  border: 1px solid #e8edf5;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03), 0 8px 24px rgba(15, 23, 42, 0.04);
  box-sizing: border-box;
}
.itool-hist-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  margin-bottom: 12px;
  padding-bottom: 2px;
}
.itool-hist-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.itool-hist-label {
  display: block;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-transform: none;
  color: #0f172a;
  line-height: 1.25;
}
.itool-hist-hint {
  display: block;
  font-size: 0.78rem;
  font-weight: 500;
  color: #94a3b8;
  line-height: 1.3;
}
.itool-hist-clear {
  appearance: none;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #e8edf5;
  background: #fff;
  color: #64748b;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 10px;
  line-height: 1.2;
  white-space: nowrap;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.itool-hist-clear-icon {
  display: block;
  flex-shrink: 0;
  opacity: 0.85;
}
.itool-hist-clear:hover {
  color: #b91c1c;
  border-color: #fecaca;
  background: #fef2f2;
}
.itool-hist-list {
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.itool-hist-list > li {
  list-style: none !important;
  margin: 0;
  padding: 0;
}
.itool-hist-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 14px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid #eef2f7;
  box-sizing: border-box;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.itool-hist-item:hover {
  background: #f1f5f9;
  border-color: #e2e8f0;
}
.itool-hist-thumb {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  overflow: hidden;
  background: #e2e8f0;
  border: 1px solid #e8edf5;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.itool-hist-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.itool-hist-thumb-ph {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #e2e8f0 0%, #f1f5f9 100%);
}
.itool-hist-meta {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  justify-content: center;
}
.itool-hist-name {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: min(48vw, 420px);
  line-height: 1.3;
  letter-spacing: -0.01em;
}
.itool-hist-sub {
  display: block;
  font-size: 0.76rem;
  font-weight: 500;
  color: #94a3b8;
  line-height: 1.3;
}
.itool-hist-actions {
  display: flex;
  flex-shrink: 0;
  flex-wrap: nowrap;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
}
.itool-hist-btn {
  appearance: none;
  border: 1px solid #dbe3f0;
  background: #fff;
  color: #2563eb;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 10px;
  cursor: pointer;
  line-height: 1.2;
  white-space: nowrap;
  min-height: 36px;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease, box-shadow 0.12s ease;
}
.itool-hist-btn-open,
.itool-hist-btn-dl {
  border-color: #dbe3f0;
  background: #fff;
  color: #2563eb;
}
.itool-hist-btn:hover,
.itool-hist-btn-open:hover,
.itool-hist-btn-dl:hover {
  border-color: #93c5fd;
  background: #eff6ff;
  color: #1d4ed8;
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.08);
}
html[data-theme="dark"] .itool-hist-card {
  background: #1a2030;
  border-color: #2a3344;
  box-shadow: none;
}
html[data-theme="dark"] .itool-hist-label {
  color: #f1f5f9;
}
html[data-theme="dark"] .itool-hist-hint {
  color: #94a3b8;
}
html[data-theme="dark"] .itool-hist-item {
  background: #151b28;
  border-color: #2a3344;
}
html[data-theme="dark"] .itool-hist-item:hover {
  background: #1c2434;
  border-color: #3a4558;
}
html[data-theme="dark"] .itool-hist-name {
  color: #e2e8f0;
}
html[data-theme="dark"] .itool-hist-sub {
  color: #94a3b8;
}
html[data-theme="dark"] .itool-hist-thumb {
  background: #0f172a;
  border-color: #2a3344;
}
html[data-theme="dark"] .itool-hist-clear {
  background: transparent;
  border-color: #2a3344;
  color: #94a3b8;
}
html[data-theme="dark"] .itool-hist-clear:hover {
  color: #fecaca;
  border-color: rgba(248, 113, 113, 0.45);
  background: rgba(127, 29, 29, 0.25);
}
html[data-theme="dark"] .itool-hist-btn {
  background: #151b28;
  border-color: #2a3344;
  color: #60a5fa;
}
html[data-theme="dark"] .itool-hist-btn:hover {
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(96, 165, 250, 0.45);
  color: #93c5fd;
}
@media (max-width: 560px) {
  .itool-hist-card {
    padding: 14px 12px 12px;
  }
  .itool-hist-item {
    flex-wrap: wrap;
    gap: 10px;
  }
  .itool-hist-meta {
    flex: 1 1 calc(100% - 56px);
    min-width: 0;
  }
  .itool-hist-name {
    max-width: 100%;
  }
  .itool-hist-actions {
    width: 100%;
    padding-left: 56px;
  }
  .itool-hist-btn {
    flex: 1 1 auto;
    text-align: center;
  }
  .itool-hist-clear span {
    /* keep icon+label on mobile */
  }
}

