/* ============================================================
   OmniEditor — UI do editor
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

:root {
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', 'SF Mono', Menlo, monospace;
  --topbar-h: 48px;
  --bottombar-h: 0px;   /* vira 48px só no celular (ver @media 760px) */
  --left-w: 264px;
  --right-w: 308px;
  --radius: 8px;
  --radius-sm: 6px;
}

/* -------- Accent palettes -------- */
body[data-accent="purple"] { --accent:#8B5CF6; --accent-strong:#7C3AED; --accent-soft:rgba(139,92,246,.14); }
body[data-accent="blue"]   { --accent:#3B82F6; --accent-strong:#2563EB; --accent-soft:rgba(59,130,246,.14); }
body[data-accent="cyan"]   { --accent:#06B6D4; --accent-strong:#0891B2; --accent-soft:rgba(6,182,212,.14); }
body[data-accent="green"]  { --accent:#10B981; --accent-strong:#059669; --accent-soft:rgba(16,185,129,.14); }
body[data-accent="amber"]  { --accent:#F59E0B; --accent-strong:#D97706; --accent-soft:rgba(245,158,11,.16); }
body[data-accent="pink"]   { --accent:#EC4899; --accent-strong:#DB2777; --accent-soft:rgba(236,72,153,.14); }
body[data-accent="red"]    { --accent:#EF4444; --accent-strong:#DC2626; --accent-soft:rgba(239,68,68,.14); }

/* -------- Themes -------- */
body[data-theme="dark"] {
  --bg: #101014;
  --bg-2: #17171d;
  --bg-3: #1e1e26;
  --bg-4: #26262f;
  --canvas-bg: #0b0b0e;
  --border: #2a2a34;
  --border-soft: #23232c;
  --text: #ececf1;
  --text-2: #a2a2b0;
  --text-3: #6b6b78;
  --input-bg: #101015;
  --shadow: 0 8px 32px rgba(0,0,0,.5);
  --frame-shadow: 0 12px 48px rgba(0,0,0,.55);
  color-scheme: dark;
}
body[data-theme="light"] {
  --bg: #ffffff;
  --bg-2: #f7f7f9;
  --bg-3: #efeff3;
  --bg-4: #e6e6ec;
  --canvas-bg: #e9e9ee;
  --border: #dcdce3;
  --border-soft: #e7e7ec;
  --text: #17171d;
  --text-2: #5d5d6b;
  --text-3: #9a9aa6;
  --input-bg: #ffffff;
  --shadow: 0 8px 32px rgba(20,20,40,.16);
  --frame-shadow: 0 12px 40px rgba(20,20,40,.18);
  color-scheme: light;
}

html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 13px;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

button { font-family: var(--font); cursor: pointer; }
svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ============ TOPBAR ============ */
.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 12px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 50;
}
.topbar-left, .topbar-center, .topbar-right { display: flex; align-items: center; gap: 8px; }
.topbar-left { flex: 1; min-width: 0; }
.topbar-right { flex: 1; justify-content: flex-end; }

.logo { display: flex; align-items: center; gap: 8px; user-select: none; }
.logo-mark {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  filter: drop-shadow(0 2px 4px color-mix(in srgb, var(--accent) 45%, transparent));
}
.logo-mark svg { width: 100%; height: 100%; stroke: none; }
.logo-name { font-size: 14px; font-weight: 400; color: var(--text-2); letter-spacing: -.01em; }
.logo-name b { color: var(--text); font-weight: 700; }

/* visibilidade por dispositivo */
.mobile-only { display: none !important; }
/* visível só em tablet/mobile (≤1100px) — ex.: toggle do painel de edição */
.narrow-only { display: none !important; }
@media (max-width: 1100px) { .narrow-only { display: grid !important; } }

.file-info { display: flex; align-items: center; gap: 7px; margin-left: 10px; padding: 4px 10px; background: var(--bg-3); border-radius: 20px; min-width: 0; }
.file-name { font-size: 12px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.dirty-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: none; }

.sep { width: 1px; height: 20px; background: var(--border); margin: 0 2px; }

.icon-btn {
  display: grid; place-items: center;
  width: 30px; height: 30px;
  border: none; border-radius: var(--radius-sm);
  background: transparent; color: var(--text-2);
  transition: background .15s, color .15s;
}
.icon-btn:hover:not(:disabled) { background: var(--bg-3); color: var(--text); }
.icon-btn.active { background: var(--accent-soft); color: var(--accent); }
.icon-btn:disabled { opacity: .35; cursor: default; }

.history-btns, .device-btns { display: flex; align-items: center; gap: 2px; }
.device-width-input {
  width: 58px; height: 28px; margin-left: 4px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--input-bg); color: var(--text);
  font-size: 12px; padding: 0 8px; font-family: var(--font);
}
.device-width-input:focus { outline: none; border-color: var(--accent); }

.zoom-select {
  height: 28px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--input-bg); color: var(--text-2); font-size: 12px; padding: 0 6px;
  font-family: var(--font);
}
.zoom-select:focus { outline: none; border-color: var(--accent); }

.btn {
  height: 30px; padding: 0 14px;
  border: none; border-radius: var(--radius-sm);
  font-size: 12.5px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 7px;
  white-space: nowrap; flex: none;
  transition: filter .15s, background .15s;
}
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-strong); }
.btn.ghost { background: var(--bg-3); color: var(--text); }
.btn.ghost:hover { background: var(--bg-4); }
.btn.lg { height: 40px; padding: 0 20px; font-size: 13.5px; border-radius: var(--radius); }
.btn.danger { background: rgba(239,68,68,.12); color: #ef4444; }
.btn.danger:hover { background: rgba(239,68,68,.2); }

/* botão Salvar com seta (menu de arquivo) */
.save-split { display: inline-flex; flex: none; }
.save-split #btnSave { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.save-split .split-arrow {
  padding: 0 7px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  border-left: 1px solid rgba(255,255,255,.28);
}
.save-split .split-arrow svg { width: 14px; height: 14px; stroke: #fff; }

.dropdown-menu {
  position: fixed; z-index: 400; min-width: 184px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow); padding: 5px; animation: popIn .12s ease;
}
.dd-item {
  display: flex; align-items: center; gap: 9px;
  width: 100%; padding: 8px 10px;
  border: none; background: none; border-radius: 6px;
  color: var(--text); font-size: 12.5px; font-family: var(--font);
  text-align: left; cursor: pointer;
}
.dd-item svg { width: 15px; height: 15px; color: var(--text-3); flex: none; }
.dd-item:hover { background: var(--accent-soft); color: var(--accent); }
.dd-item:hover svg { color: var(--accent); }

/* ============ WORKSPACE ============ */
.workspace {
  display: grid;
  grid-template-columns: var(--left-w) 1fr var(--right-w);
  height: calc(100vh - var(--topbar-h) - var(--bottombar-h));
}
/* painel de edição (direita) recolhido no desktop */
body.no-right .workspace { grid-template-columns: var(--left-w) 1fr; }
body.no-right .sidebar.right { display: none; }

.sidebar {
  background: var(--bg);
  display: flex; flex-direction: column;
  min-height: 0;
}
.sidebar.left { border-right: 1px solid var(--border); }
.sidebar.right { border-left: 1px solid var(--border); }

.side-tabs {
  display: flex; gap: 2px; padding: 8px 10px 0;
  border-bottom: 1px solid var(--border-soft);
  flex: none;
}
.side-tab {
  flex: 1; padding: 8px 4px 10px;
  background: none; border: none;
  color: var(--text-3); font-size: 12.5px; font-weight: 600;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color .15s;
}
.side-tab:hover { color: var(--text-2); }
.side-tab.active { color: var(--text); border-bottom-color: var(--accent); }

.side-panel { display: none; flex: 1; overflow-y: auto; min-height: 0; }
.side-panel.active { display: block; }

.panel-hint { padding: 12px 14px 6px; color: var(--text-3); font-size: 11.5px; }

/* ---- Grupos de elementos (Componentes / Seções) ---- */
.el-group { border-bottom: 1px solid var(--border-soft); }
.el-group-head {
  width: 100%; display: flex; align-items: center; gap: 8px;
  padding: 11px 14px;
  background: none; border: none;
  color: var(--text); font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em;
  text-align: left;
}
.el-group-head:hover { background: var(--bg-2); }
.el-group-head svg { width: 11px; height: 11px; color: var(--text-3); transition: transform .15s; }
.el-group.open .el-group-head svg { transform: rotate(90deg); }
.el-group-head .el-count { margin-left: auto; color: var(--text-3); font-size: 10.5px; font-weight: 600; background: var(--bg-3); border-radius: 10px; padding: 1px 7px; }
.el-group-body { display: none; }
.el-group.open .el-group-body { display: block; }

/* ---- Widgets grid ---- */
.widgets-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 8px; padding: 8px 12px 16px;
}
.widgets-grid.sections { grid-template-columns: 1fr; }
.widgets-grid.sections .widget-item { flex-direction: row; justify-content: flex-start; gap: 10px; padding: 11px 12px; }
.widgets-grid.sections .widget-item svg { width: 18px; height: 18px; }
.widget-item {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  padding: 13px 6px 11px;
  background: var(--bg-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  color: var(--text-2); font-size: 11.5px; font-weight: 500;
  cursor: grab;
  transition: border-color .15s, color .15s, background .15s, transform .1s;
  user-select: none;
}
.widget-item:hover { border-color: var(--accent); color: var(--text); background: var(--bg-3); }
.widget-item:active { cursor: grabbing; transform: scale(.97); }
.widget-item svg { width: 20px; height: 20px; color: var(--accent); stroke-width: 1.6; }

/* ---- Layers ---- */
.layers-tree { padding: 8px 6px 16px; }
.layer-row {
  display: flex; align-items: center; gap: 4px;
  height: 28px; padding: 0 6px 0 0;
  border-radius: var(--radius-sm);
  color: var(--text-2); font-size: 12px;
  cursor: pointer; user-select: none;
  white-space: nowrap;
}
.layer-row:hover { background: var(--bg-3); color: var(--text); }
.layer-row.selected { background: var(--accent-soft); color: var(--accent); }
.layer-row.drop-into { outline: 1.5px dashed var(--accent); outline-offset: -1.5px; }
.layer-caret {
  width: 18px; height: 18px; flex: none;
  display: grid; place-items: center;
  background: none; border: none; color: var(--text-3); padding: 0;
}
.layer-caret svg { width: 10px; height: 10px; transition: transform .12s; }
.layer-caret.open svg { transform: rotate(90deg); }
.layer-caret.hidden-caret { visibility: hidden; }
.layer-tag { font-weight: 600; }
.layer-extra { color: var(--text-3); font-size: 11px; overflow: hidden; text-overflow: ellipsis; }
.layer-row.selected .layer-extra { color: var(--accent); opacity: .7; }
.layer-actions { margin-left: auto; display: none; gap: 2px; }
.layer-row:hover .layer-actions { display: flex; }
.layer-actions button {
  width: 20px; height: 20px; display: grid; place-items: center;
  background: none; border: none; color: var(--text-3); border-radius: 4px; padding: 0;
}
.layer-actions button:hover { color: var(--text); background: var(--bg-4); }
.layer-actions svg { width: 12px; height: 12px; }
.layer-children { margin-left: 14px; border-left: 1px solid var(--border-soft); padding-left: 2px; }
.layer-drop-line { height: 2px; background: var(--accent); border-radius: 2px; margin: 0 6px; }
.layer-row.el-hidden { opacity: .45; }

/* ---- Painel de seletores CSS ---- */
.sel-toolbar { padding: 10px 12px 8px; display: flex; flex-direction: column; gap: 8px; border-bottom: 1px solid var(--border-soft); }
.sel-chips { display: flex; gap: 6px; }
.chip {
  padding: 4px 10px;
  background: var(--bg-3); border: 1px solid transparent; border-radius: 20px;
  color: var(--text-2); font-size: 11px; font-weight: 600;
}
.chip:hover { color: var(--text); }
.chip.active { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.btn.sm { height: 26px; font-size: 11.5px; padding: 0 10px; justify-content: center; }
.sel-list { padding: 6px 8px 20px; }
.sel-group-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 6px 4px;
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-3);
}
.sel-group-count { background: var(--bg-3); border-radius: 10px; padding: 1px 7px; font-size: 10px; }
.sel-row {
  display: flex; align-items: center; gap: 6px;
  width: 100%; padding: 6px 8px;
  background: none; border: none; border-radius: var(--radius-sm);
  color: var(--text-2); font-size: 12px; font-family: var(--mono);
  text-align: left; cursor: pointer;
}
.sel-row:hover { background: var(--bg-3); color: var(--text); }
.sel-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.sel-name .tk-class { color: var(--accent); font-weight: 600; }
.sel-name .tk-id { color: #E0A040; font-weight: 600; }
.sel-media { font-size: 9.5px; color: var(--text-3); background: var(--bg-3); padding: 2px 6px; border-radius: 4px; white-space: nowrap; }
.sel-empty { padding: 24px 12px; color: var(--text-3); font-size: 12px; text-align: center; }

/* ---- Drawer de edição de regra ---- */
.rule-drawer { width: 480px; z-index: 85; }
.rule-head-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.rule-selector { font-family: var(--mono); font-size: 13.5px; color: var(--accent); word-break: break-all; }
.rule-body { flex: 1; overflow-y: auto; display: flex; flex-direction: column; padding: 12px 14px; gap: 8px; }
.rule-section-label {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-3); margin-top: 6px;
  display: flex; justify-content: space-between; align-items: baseline;
}
.rule-section-label .css-hint { text-transform: none; letter-spacing: 0; font-weight: 400; }
.rule-controls .ctrl-row { grid-template-columns: 1fr 1fr; }
.rule-controls input.ctl-input, .rule-controls .color-wrap input[type="text"] { font-family: var(--mono); font-size: 11px; }
#ruleCode {
  min-height: 180px; flex: none; resize: vertical;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--input-bg); color: var(--text);
  font-family: var(--mono); font-size: 12px; line-height: 1.6;
  padding: 12px; tab-size: 2; outline: none;
}
#ruleCode:focus { border-color: var(--accent); }
.rule-foot { padding: 10px 14px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; }

/* ---- Painel do documento (Geral / CSS / JS) ---- */
.doc-tabs { display: flex; gap: 2px; padding: 8px 10px 0; border-bottom: 1px solid var(--border-soft); flex: none; }
.doc-tab {
  flex: 1; padding: 8px 4px 10px; background: none; border: none;
  color: var(--text-3); font-size: 12.5px; font-weight: 600;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.doc-tab:hover { color: var(--text-2); }
.doc-tab.active { color: var(--text); border-bottom-color: var(--accent); }
.doc-body { flex: 1; overflow-y: auto; min-height: 0; display: flex; flex-direction: column; }
.doc-panel { display: none; flex: 1; min-height: 0; flex-direction: column; padding: 12px 14px; }
.doc-panel.active { display: flex; }
.doc-hint { margin: 0 0 10px; color: var(--text-3); font-size: 11.5px; line-height: 1.5; }
.doc-code-label { display: block; font-size: 11px; font-weight: 600; color: var(--text-2); margin: 6px 0; }
.doc-code {
  width: 100%; flex: 1 1 auto; min-height: 120px; resize: vertical;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--input-bg); color: var(--text);
  font-family: var(--mono); font-size: 12.5px; line-height: 1.6;
  padding: 12px; tab-size: 2; outline: none;
}
.doc-code:focus { border-color: var(--accent); }
#userJsHead { min-height: 90px; flex: 0 0 auto; }

/* ---- aba Estilos (design system da página) ---- */
#docStyles { display: none; overflow-y: auto; }
#docStyles.active { display: block; }
.ds-section { margin-bottom: 20px; }
.ds-title {
  display: flex; align-items: center; gap: 7px; margin: 0 0 10px;
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-2);
}
.ds-count {
  font-size: 10px; font-weight: 600; letter-spacing: 0;
  padding: 1px 6px; border-radius: 20px;
  background: var(--bg-3); color: var(--text-3);
}
.ds-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 8px; }
.ds-card {
  display: flex; align-items: center; gap: 9px; padding: 7px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-2); min-width: 0;
}
/* xadrez atrás da amostra: deixa a transparência visível */
.ds-swatch {
  position: relative; flex: none; width: 30px; height: 30px; padding: 0;
  border: 1px solid var(--border); border-radius: 7px; cursor: pointer;
  background: var(--c);
}
.ds-swatch.has-alpha {
  background:
    linear-gradient(var(--c), var(--c)),
    repeating-conic-gradient(var(--text-3) 0 25%, transparent 0 50%) 0 0 / 10px 10px;
}
.ds-swatch:hover { border-color: var(--accent); }
.ds-picker { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.ds-info { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.ds-value {
  font-family: var(--mono); font-size: 11px; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ds-uses { font-size: 10.5px; color: var(--text-3); }
.ds-font {
  display: flex; align-items: center; gap: 11px; padding: 9px 10px; margin-bottom: 7px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-2);
}
.ds-font-preview {
  flex: none; width: 34px; text-align: center;
  font-size: 20px; line-height: 1.2; color: var(--text);
}
.ds-font-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.ds-font-input { width: 100%; box-sizing: border-box; font-family: var(--mono); font-size: 11px; }
#userJsBody { min-height: 120px; }

/* ---- Barra de texto rico ---- */
.rte-toolbar {
  position: fixed; z-index: 350;
  display: flex; align-items: center; gap: 1px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 9px; box-shadow: var(--shadow); padding: 3px;
  animation: popIn .12s ease;
}
.rte-toolbar button {
  min-width: 28px; height: 28px; padding: 0 6px;
  display: grid; place-items: center;
  border: none; background: none; border-radius: 6px;
  color: var(--text); font-size: 13px; font-family: var(--font); cursor: pointer;
}
.rte-toolbar button:hover { background: var(--accent-soft); color: var(--accent); }
.rte-toolbar svg { width: 15px; height: 15px; }
.rte-sep { width: 1px; height: 18px; background: var(--border); margin: 0 3px; }

/* ---- Seletor de arquivo ---- */
.file-switch {
  width: 20px; height: 20px; display: grid; place-items: center;
  background: none; border: none; color: var(--text-3); border-radius: 4px; padding: 0; cursor: pointer;
}
.file-switch:hover { color: var(--text); background: var(--bg-4); }
.file-switch svg { width: 13px; height: 13px; }

/* ---- Sobre ---- */
.about-modal { width: 440px; }
.about-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.about-logo { width: 48px; height: 48px; display: grid; place-items: center; filter: drop-shadow(0 4px 10px color-mix(in srgb, var(--accent) 45%, transparent)); }
.about-logo svg { width: 100%; height: 100%; stroke: none; }
.about-head h3 { margin: 0; font-size: 18px; }
.about-version { font-size: 12px; color: var(--text-3); font-family: var(--mono); }
.about-text { margin: 0 0 12px; color: var(--text-2); font-size: 13px; line-height: 1.6; }
.about-text a { color: var(--accent); text-decoration: none; }
.about-text a:hover { text-decoration: underline; }
.about-disclaimer { color: var(--text-3); font-size: 12px; border-top: 1px solid var(--border-soft); padding-top: 12px; }

/* ---- Seletor de tamanho de tela (mobile): ícone + seta ---- */
.device-picker {
  display: inline-flex; align-items: center; gap: 2px;
  height: 30px; padding: 0 6px 0 8px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-3); color: var(--text);
  cursor: pointer; flex: none;
}
.device-picker:hover { background: var(--bg-4); }
.device-picker .dp-icon { display: grid; place-items: center; }
.device-picker .dp-icon svg { width: 16px; height: 16px; }
.device-picker .dp-caret { width: 13px; height: 13px; color: var(--text-3); }
.dd-item.active { background: var(--accent-soft); color: var(--accent); }
.dd-item.active svg { color: var(--accent); }

/* ---- Modal de entrada (substitui prompt) ---- */
.prompt-modal { width: 380px; }
.prompt-modal h3 { margin: 0 0 12px; }
.prompt-label { display: block; font-size: 12px; color: var(--text-2); margin-bottom: 6px; }
.prompt-modal .modal-actions { gap: 8px; }

/* ---- Exportar ---- */
.export-modal { width: 470px; max-width: 92vw; }
.export-modal h3 { margin: 0 0 16px; }
.export-label {
  display: block; font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-2); margin: 0 0 8px;
}
.export-opts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 18px; }
.export-opts.sizes { grid-template-columns: repeat(4, 1fr); }
.export-opt {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 12px 8px; min-width: 0;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-2); color: var(--text-2);
  font-family: var(--font); cursor: pointer; text-align: center;
  transition: border-color .15s ease, background .15s ease;
}
.export-opt:hover { border-color: var(--accent); }
.export-opt.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.export-opt svg {
  width: 20px; height: 20px; fill: none; stroke: currentColor;
  stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}
.export-opt b { font-size: 12.5px; font-weight: 600; }
.export-opt small { font-size: 10px; color: var(--text-3); line-height: 1.35; }
.export-opt.active small { color: inherit; opacity: .8; }
.export-status {
  margin: 0 0 4px; font-size: 12px; color: var(--text-2);
  display: flex; align-items: center; gap: 8px;
}
/* separa as ações do corpo do modal */
.export-modal .modal-actions {
  gap: 12px; margin-top: 20px; padding-top: 16px;
  border-top: 1px solid var(--border-soft);
}
.export-modal .modal-actions .btn { min-width: 104px; justify-content: center; }

/* ---- Confirmação ---- */
.confirm-modal { width: 400px; max-width: 92vw; }
.confirm-modal h3 { margin: 0; font-size: 15px; line-height: 1.45; }
.confirm-message { margin: 10px 0 0; font-size: 12.5px; color: var(--text-2); line-height: 1.55; }
.confirm-modal .modal-actions { margin-top: 20px; }
.confirm-modal .btn { min-width: 96px; justify-content: center; }
.btn.primary.danger { background: #ef4444; border-color: #ef4444; color: #fff; }
.btn.primary.danger:hover { background: #dc2626; border-color: #dc2626; }

/* ---- Assinatura ---- */
.made-by {
  margin: 18px 0 0; padding-top: 12px;
  border-top: 1px solid var(--border-soft);
  text-align: center; font-size: 11px; color: var(--text-3);
}
.made-by a { color: var(--text-2); text-decoration: none; }
.made-by a:hover { color: var(--accent); text-decoration: underline; }

/* ============ CANVAS ============ */
.canvas-area {
  position: relative;
  background: var(--canvas-bg);
  display: flex; flex-direction: column;
  min-width: 0; min-height: 0;
  background-image: radial-gradient(color-mix(in srgb, var(--text) 7%, transparent) 1px, transparent 1px);
  background-size: 22px 22px;
}
.canvas-scroll {
  flex: 1; overflow: auto;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 28px;
  min-height: 0;
}
.device-frame {
  width: 100%;
  height: calc(100% - 0px);
  background: #fff;
  border-radius: 10px;
  box-shadow: var(--frame-shadow);
  overflow: hidden;
  transition: width .25s ease;
  transform-origin: top center;
  flex: none;
}
#canvasFrame { width: 100%; height: 100%; border: none; display: block; background: #fff; }

/* modo de visualização na view nativa do aparelho: página de ponta a ponta,
   só com a barra do topo (ver isNativeView em app.js) */
body.preview-full .canvas-scroll { padding: 0; }
body.preview-full .canvas-area { background-image: none; }
body.preview-full .device-frame { border-radius: 0; box-shadow: none; }
body.preview-full .breadcrumbs { display: none; }

.breadcrumbs {
  height: 32px; flex: none;
  display: flex; align-items: center; gap: 2px;
  padding: 0 14px;
  background: var(--bg);
  border-top: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}
.breadcrumbs:empty { display: none; }
.crumb {
  background: none; border: none;
  color: var(--text-3); font-size: 11.5px; font-family: var(--mono);
  padding: 3px 7px; border-radius: 4px;
  white-space: nowrap;
}
.crumb:hover { background: var(--bg-3); color: var(--text); }
.crumb.current { color: var(--accent); font-weight: 600; }
.crumb-sep { color: var(--text-3); font-size: 10px; }

/* ---- Welcome ---- */
.welcome {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  background: var(--canvas-bg);
  background-image: radial-gradient(color-mix(in srgb, var(--text) 7%, transparent) 1px, transparent 1px);
  background-size: 22px 22px;
  z-index: 10;
}
.welcome-card {
  text-align: center; max-width: 460px; padding: 40px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.welcome-logo {
  width: 60px; height: 60px; margin: 0 auto 18px;
  display: grid; place-items: center;
  filter: drop-shadow(0 6px 16px color-mix(in srgb, var(--accent) 45%, transparent));
}
.welcome-logo svg { width: 100%; height: 100%; stroke: none; }
.welcome-card h1 { margin: 0 0 8px; font-size: 22px; letter-spacing: -.02em; }
.welcome-sub { margin: 0 0 24px; color: var(--text-2); font-size: 13px; line-height: 1.55; }
.welcome-actions { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.welcome-actions .btn { justify-content: center; }
.welcome-row { display: flex; justify-content: center; align-items: center; gap: 8px; }
.reopen-row { margin-bottom: 16px; }
.reopen-row .btn { width: 100%; justify-content: center; }
.link-btn { background: none; border: none; color: var(--accent); font-size: 12.5px; font-weight: 500; padding: 2px; }
.link-btn:hover { text-decoration: underline; }
.dot-sep { color: var(--text-3); }
.welcome-drop { margin: 22px 0 0; color: var(--text-3); font-size: 11.5px; }
.welcome.dragover .welcome-card { outline: 2px dashed var(--accent); outline-offset: 6px; }
.welcome-close { position: absolute; top: 16px; right: 16px; display: none; }
body.has-doc .welcome-close { display: grid; }

/* ============ INSPECTOR ============ */
.inspector-head {
  display: flex; align-items: baseline; gap: 8px;
  padding: 12px 14px 4px;
  flex: none; min-width: 0;
}
.insp-tag {
  font-family: var(--mono); font-size: 12px; font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 3px 8px; border-radius: 5px;
}
.insp-name { color: var(--text-3); font-size: 11.5px; font-family: var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.inspector-body { flex: 1; overflow-y: auto; min-height: 0; }
.itab-panel { display: none; padding-bottom: 40px; }
.itab-panel.active { display: block; }

.inspector-empty {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 60px 30px; text-align: center;
  color: var(--text-3);
}
.inspector-empty svg { width: 28px; height: 28px; opacity: .5; }
.inspector-empty p { margin: 0; font-size: 12.5px; line-height: 1.5; }

/* ---- Accordion sections ---- */
.acc-section { border-bottom: 1px solid var(--border-soft); }
.acc-head {
  width: 100%; display: flex; align-items: center; gap: 8px;
  padding: 11px 14px;
  background: none; border: none;
  color: var(--text); font-size: 12.5px; font-weight: 600;
  text-align: left;
}
.acc-head:hover { background: var(--bg-2); }
.acc-head svg { width: 11px; height: 11px; color: var(--text-3); transition: transform .15s; margin-left: auto; }
.acc-section.open .acc-head svg { transform: rotate(90deg); }
.acc-body { display: none; padding: 2px 14px 16px; }
.acc-section.open .acc-body { display: block; }

/* ---- Controls ---- */
.ctrl { margin-top: 10px; }
.ctrl-label {
  display: flex; align-items: center; justify-content: space-between;
  color: var(--text-2); font-size: 11.5px; font-weight: 500;
  margin-bottom: 5px;
}
.ctrl-label .ctrl-val { color: var(--text-3); font-family: var(--mono); font-size: 10.5px; }

.ctrl-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ctrl-row .ctrl { margin-top: 10px; }

input.ctl-input, select.ctl-select, textarea.ctl-textarea {
  width: 100%; height: 28px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--input-bg); color: var(--text);
  font-size: 12px; padding: 0 8px;
  font-family: var(--font);
  transition: border-color .12s;
}
textarea.ctl-textarea { height: auto; min-height: 64px; padding: 8px; resize: vertical; font-family: var(--mono); font-size: 11.5px; line-height: 1.5; }
input.ctl-input:focus, select.ctl-select:focus, textarea.ctl-textarea:focus { outline: none; border-color: var(--accent); }
input.ctl-input::placeholder, textarea.ctl-textarea::placeholder { color: var(--text-3); }

/* number + unit */
.nu-wrap { display: flex; }
.nu-wrap input {
  width: 100%; height: 28px; min-width: 0;
  border: 1px solid var(--border); border-right: none;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  background: var(--input-bg); color: var(--text);
  font-size: 12px; padding: 0 8px; font-family: var(--font);
}
.nu-wrap select {
  height: 28px; width: 52px; flex: none;
  border: 1px solid var(--border);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--bg-3); color: var(--text-3);
  font-size: 10.5px; padding: 0 2px; font-family: var(--font);
  text-align: center;
}
.nu-wrap input:focus, .nu-wrap select:focus { outline: none; border-color: var(--accent); }

/* slider */
.slider-wrap { display: flex; align-items: center; gap: 10px; }
.slider-wrap input[type="range"] {
  flex: 1; -webkit-appearance: none; appearance: none;
  height: 4px; border-radius: 2px;
  background: var(--bg-4);
  outline: none;
}
.slider-wrap input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--bg);
  box-shadow: 0 1px 4px rgba(0,0,0,.3);
  cursor: pointer;
}
.slider-wrap input[type="number"] {
  width: 58px; height: 26px; flex: none;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--input-bg); color: var(--text);
  font-size: 11.5px; padding: 0 6px; text-align: center; font-family: var(--font);
}
.slider-wrap input[type="number"]:focus { outline: none; border-color: var(--accent); }

/* color */
.color-wrap { display: flex; gap: 6px; align-items: center; }
.color-swatch {
  width: 28px; height: 28px; flex: none;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 0; background: transparent; position: relative; overflow: hidden;
  background-image: conic-gradient(#ccc 25%, #fff 0 50%, #ccc 0 75%, #fff 0);
  background-size: 10px 10px;
}
.color-swatch .sw-fill { position: absolute; inset: 0; }
.color-swatch input[type="color"] { position: absolute; inset: -6px; opacity: 0; cursor: pointer; width: 44px; height: 44px; }
.color-wrap input[type="text"] {
  flex: 1; height: 28px; min-width: 0;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--input-bg); color: var(--text);
  font-size: 11.5px; padding: 0 8px; font-family: var(--mono);
}
.color-wrap input[type="text"]:focus { outline: none; border-color: var(--accent); }
.color-clear {
  width: 24px; height: 28px; flex: none; display: grid; place-items: center;
  background: none; border: none; color: var(--text-3); border-radius: 4px;
}
.color-clear:hover { color: var(--text); }
.color-clear svg { width: 12px; height: 12px; }

/* button group */
.btngroup { display: flex; background: var(--bg-3); border-radius: var(--radius-sm); padding: 2px; gap: 2px; }
.btngroup button {
  flex: 1; height: 26px;
  display: grid; place-items: center;
  background: none; border: none; border-radius: 5px;
  color: var(--text-3); font-size: 11px; font-weight: 600;
}
.btngroup button:hover { color: var(--text); }
.btngroup button.active { background: var(--bg); color: var(--accent); box-shadow: 0 1px 3px rgba(0,0,0,.18); }
.btngroup svg { width: 14px; height: 14px; }

/* box4 (margin/padding/radius/inset) */
.box4 { display: grid; grid-template-columns: repeat(4, 1fr) 26px; gap: 5px; align-items: center; }
.box4 input {
  width: 100%; height: 27px; min-width: 0;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--input-bg); color: var(--text);
  font-size: 11px; padding: 0 4px; text-align: center; font-family: var(--font);
}
.box4 input:focus { outline: none; border-color: var(--accent); }
.box4-link {
  width: 26px; height: 27px; display: grid; place-items: center;
  background: none; border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text-3); padding: 0;
}
.box4-link.active { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.box4-link svg { width: 12px; height: 12px; }
.box4-labels { display: grid; grid-template-columns: repeat(4, 1fr) 26px; gap: 5px; margin-top: 3px; }
.box4-labels span { text-align: center; font-size: 9.5px; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; }

/* toggle */
.toggle-row { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.toggle-row .ctrl-label { margin: 0; }
.switch { position: relative; width: 34px; height: 20px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.switch .track {
  position: absolute; inset: 0; border-radius: 20px;
  background: var(--bg-4); transition: background .15s;
  pointer-events: none;
}
.switch .track::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3);
  transition: transform .15s;
}
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(14px); }

/* small action buttons row */
.mini-actions { display: flex; gap: 8px; margin-top: 12px; }
.mini-actions .btn { flex: 1; justify-content: center; height: 28px; font-size: 12px; }

.insp-note { color: var(--text-3); font-size: 11px; line-height: 1.5; margin: 10px 0 0; }

/* seletor de estado (Normal / Hover / Active) */
.state-bar { padding: 12px 14px 12px; border-bottom: 1px solid var(--border-soft); background: var(--bg-2); }
.state-bar .ctrl { margin-top: 0; }
.state-note { color: var(--accent); font-weight: 500; }

/* campo de src de imagem com botão de escolher */
.img-src-row { display: flex; gap: 6px; }
.img-src-row input { flex: 1; min-width: 0; }
.img-src-row .btn { flex: none; }

/* chips de #id/.classe na aba Avançado */
.attr-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.attr-chips .chip { font-family: var(--mono); font-size: 11px; border-color: var(--border-soft); }
.attr-chips .chip.tk-class { color: var(--accent); }
.attr-chips .chip.tk-id { color: #E0A040; }
.attr-chips .chip:hover { border-color: currentColor; background: var(--bg-4); }

.anim-play-row { display: flex; gap: 8px; margin-top: 14px; }
.anim-play-row .btn { flex: 1; justify-content: center; }

/* ============ CSS DRAWER ============ */
.css-drawer {
  position: fixed; right: 0; top: var(--topbar-h); bottom: var(--bottombar-h);
  width: 440px; max-width: 90vw;
  background: var(--bg);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: flex; flex-direction: column;
  z-index: 80;
  animation: slideIn .2s ease;
}
@keyframes slideIn { from { transform: translateX(30px); opacity: 0; } }
.css-drawer-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  flex: none;
}
.css-drawer-head strong { font-size: 13px; }
.css-hint { color: var(--text-3); font-size: 11px; flex: 1; }
.css-drawer textarea {
  flex: 1; resize: none;
  border: none; outline: none;
  background: var(--input-bg); color: var(--text);
  font-family: var(--mono); font-size: 12.5px; line-height: 1.6;
  padding: 14px; tab-size: 2;
}

/* ============ POPOVER ============ */
.popover {
  position: fixed; top: calc(var(--topbar-h) + 8px); right: 12px;
  width: 240px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 14px;
  z-index: 100;
  animation: popIn .15s ease;
}
@keyframes popIn { from { transform: translateY(-6px); opacity: 0; } }
.pop-section + .pop-section { margin-top: 14px; }
.pop-label { display: block; font-size: 11px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 8px; }
.theme-toggle { display: flex; gap: 6px; }
.theme-toggle button {
  flex: 1; height: 34px;
  display: flex; align-items: center; justify-content: center; gap: 7px;
  background: var(--bg-3); border: 1px solid transparent; border-radius: var(--radius-sm);
  color: var(--text-2); font-size: 12px; font-weight: 500;
}
.theme-toggle button.active { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.accent-swatches { display: flex; gap: 8px; flex-wrap: nowrap; justify-content: space-between; }
.accent-swatches button {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--sw); border: 2px solid transparent;
  outline: 2px solid transparent; outline-offset: 2px;
  transition: outline-color .12s;
  padding: 0; flex: none;
}
.accent-swatches button.active { outline-color: var(--sw); }
.pop-wide { width: 100%; justify-content: center; }
#langSelect { width: 100%; height: 32px; }

/* ============ MODO FOCO (sem painéis) ============ */
body.zen .workspace { grid-template-columns: 1fr; }
body.zen .sidebar { display: none; }

/* ============ MODAL ============ */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  display: grid; place-items: center;
  z-index: 200;
}
.modal {
  width: 420px; max-width: 90vw; max-height: 70vh;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 20px;
  display: flex; flex-direction: column;
}
.modal h3 { margin: 0 0 14px; font-size: 15px; }
.file-list { overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.file-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  background: var(--bg-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  color: var(--text); font-size: 13px; text-align: left;
}
.file-item:hover { border-color: var(--accent); background: var(--bg-3); }
.file-item svg { color: var(--accent); }
.file-item .fi-path { color: var(--text-3); font-size: 11px; margin-left: auto; font-family: var(--mono); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }
.modal-sub { margin: -8px 0 12px; color: var(--text-3); font-size: 12px; }

/* ---- Histórico ---- */
.history-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  background: var(--bg-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
}
.history-item .hi-main { flex: 1; min-width: 0; }
.history-item .hi-label { font-size: 12.5px; font-weight: 600; color: var(--text); }
.history-item .hi-meta { font-size: 11px; color: var(--text-3); margin-top: 2px; font-family: var(--mono); }
.history-item .hi-actions { display: flex; gap: 4px; }
.history-item .hi-actions .icon-btn { width: 26px; height: 26px; }
.history-item .hi-actions .icon-btn svg { width: 13px; height: 13px; }
.history-empty { color: var(--text-3); font-size: 12.5px; text-align: center; padding: 24px 0; }

/* ============ MENU DE CONTEXTO ============ */
.ctx-menu {
  position: fixed; z-index: 400;
  min-width: 218px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 5px;
  animation: popIn .12s ease;
}
.ctx-head {
  padding: 6px 10px 7px;
  font-family: var(--mono); font-size: 11px; font-weight: 600;
  color: var(--accent);
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ctx-item {
  display: flex; align-items: center; gap: 9px;
  width: 100%; padding: 7px 10px;
  border: none; background: none;
  color: var(--text); font-size: 12.5px; font-family: var(--font);
  border-radius: 6px; text-align: left; cursor: pointer;
}
.ctx-item svg { width: 14px; height: 14px; color: var(--text-3); flex: none; }
.ctx-item:hover:not(:disabled) { background: var(--accent-soft); color: var(--accent); }
.ctx-item:hover:not(:disabled) svg { color: var(--accent); }
.ctx-item:disabled { opacity: .4; cursor: default; }
.ctx-item .kbd { margin-left: auto; color: var(--text-3); font-size: 10.5px; font-family: var(--mono); }
.ctx-item.danger { color: #ef4444; }
.ctx-item.danger svg { color: #ef4444; }
.ctx-item.danger:hover:not(:disabled) { background: rgba(239,68,68,.12); color: #ef4444; }
.ctx-sep { height: 1px; background: var(--border-soft); margin: 5px 8px; }

/* ============ TOASTS ============ */
.toast-wrap {
  position: fixed; bottom: calc(44px + var(--bottombar-h)); left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  z-index: 300; pointer-events: none;
}
.toast {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 12.5px; font-weight: 500;
  padding: 9px 16px;
  border-radius: 10px;
  box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 8px;
  animation: toastIn .2s ease;
}
.toast.ok svg { color: #10B981; }
.toast.err svg { color: #EF4444; }
.toast.info svg { color: var(--accent); }
@keyframes toastIn { from { transform: translateY(8px); opacity: 0; } }
.toast.out { animation: toastOut .25s ease forwards; }
@keyframes toastOut { to { transform: translateY(8px); opacity: 0; } }

/* ============ RESPONSIVO ============ */
.mobile-backdrop {
  position: fixed; inset: var(--topbar-h) 0 var(--bottombar-h) 0;
  background: rgba(0,0,0,.45); z-index: 60;
  animation: fadeIn .15s ease;
}

/* barra inferior: ferramentas de edição ao alcance do polegar (só no celular) */
.bottombar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 80;
  height: var(--bottombar-h);
  display: flex; align-items: center; justify-content: space-around;
  gap: 2px; padding: 0 6px;
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
@keyframes fadeIn { from { opacity: 0; } }

/* janelas médias: painéis mais estreitos */
@media (max-width: 1100px) {
  :root { --left-w: 224px; --right-w: 268px; }
  .logo-name { display: none; }
}

/* tablets/telas estreitas: esconde rótulos longos do topo */
@media (max-width: 900px) {
  .file-info { display: none; }
}

/* celular / toque: painéis viram gavetas */
@media (max-width: 760px) {
  /* a barra do topo se divide em duas: identidade/saída em cima,
     ferramentas de edição embaixo (ver .bottombar e syncBarLayout) */
  :root { --bottombar-h: calc(48px + env(safe-area-inset-bottom)); }
  /* no modo de visualização a barra inferior some e o canvas recupera o espaço */
  body.zen { --bottombar-h: 0px; }
  body.zen .bottombar { display: none; }

  .mobile-only { display: grid !important; }
  .desktop-only { display: none !important; }
  #zoomSelect, .device-width-input, .topbar-center .sep { display: none; }
  .device-picker.mobile-only { display: inline-flex !important; }

  .topbar { padding: 0 8px; gap: 6px; }
  .topbar-left, .topbar-right { gap: 3px; flex: none; }
  .topbar-center { gap: 3px; flex: 1; justify-content: center; }
  .icon-btn { width: 32px; height: 32px; }
  .btn { padding: 0 12px; height: 32px; }
  .logo { display: flex; gap: 7px; }
  .logo-mark { width: 24px; height: 24px; }
  .logo-name { display: block; font-size: 13px; }

  .workspace { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; top: var(--topbar-h); bottom: var(--bottombar-h); z-index: 70;
    width: 84vw; max-width: 340px;
    transition: transform .25s ease;
    box-shadow: 0 0 40px rgba(0,0,0,.4);
  }
  .sidebar.left  { left: 0;  transform: translateX(-106%); }
  .sidebar.right { right: 0; transform: translateX(106%); }
  body.drawer-left  .sidebar.left  { transform: none; }
  body.drawer-right .sidebar.right { transform: none; }
  /* no toque o painel de edição é gaveta: nunca esconder via no-right */
  body.no-right .sidebar.right { display: flex; }
  /* modo foco não se aplica em telas de toque */
  body.zen .workspace { grid-template-columns: 1fr; }
  body.zen .sidebar { display: flex; }

  .css-drawer:not(.rule-drawer), .rule-drawer { width: 100vw; max-width: 100vw; }
  .popover { right: 8px; left: 8px; width: auto; top: calc(var(--topbar-h) + 6px); }
  .breadcrumbs { display: none; }
  .canvas-scroll { padding: 12px; }
  .welcome-card { padding: 28px 22px; max-width: 92vw; }

  /* alvos de toque maiores nos controles */
  input.ctl-input, select.ctl-select, .nu-wrap input, .nu-wrap select,
  .box4 input, .color-wrap input[type="text"] { height: 34px; font-size: 13px; }
  .side-tab { padding: 12px 4px 13px; }
}

/* scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--bg-4); border-radius: 6px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }
.canvas-scroll::-webkit-scrollbar-thumb { border-color: var(--canvas-bg); }
