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

body.is-fullscreen .fs-workspace.rbg-fs,
body.is-fullscreen .fs-workspace:has(#rbg-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) {
  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;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.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;
}

.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;
}

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

.rbg-checker {
  background-color: #f1f5f9;
  background-image:
    linear-gradient(45deg, #e2e8f0 25%, transparent 25%),
    linear-gradient(-45deg, #e2e8f0 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e2e8f0 75%),
    linear-gradient(-45deg, transparent 75%, #e2e8f0 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  border-radius: 12px;
  padding: 12px;
  border: 1px solid #e2e8f0;
}

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

/* 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;
}

.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;
}

.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;
  }
}
