/* ════════════════════════════════════════════════════════════════════
   FireSysDiagram — casca nova (22/09/2026)
   Desenho aprovado no protótipo "Prancheta do FSD" (11–12/09/2026):
   • menu lateral igual ao do Control/CRM (260 px, recolhe para 64 px
     clicando no logo), com seções, grupos, favoritos e o rodapé do CRM;
   • barra de cima só com os comandos de uso;
   • barra azul de contexto, que só aparece com algo selecionado e fica
     POR CIMA do desenho (se empurrasse o canvas, o bloco pularia sob o
     mouse no meio do arraste);
   • propriedades recolhem numa faixa vertical, como as paletas do AutoCAD;
   • zoom flutuante no canto do canvas e abas de layout renomeáveis.
   Os ids e as funções do app.js continuam os mesmos: esta folha só muda
   onde as coisas moram e como aparecem. Ícones: [data-ic] recebe a
   máscara SVG definida no fsd-shell.js (sobrevive ao app reescrever o
   texto do botão, como fazem clearAll, toggleGrid e o status de salvar).
   ════════════════════════════════════════════════════════════════════ */

:root {
  --fsd-sb-w: 260px;
  --fsd-ui: 1;
  --fsd-props-w: var(--props-w, 260px);
  --fsd-blue: #60a5fa;
  --fsd-blue-bg: rgba(96,165,250,.12);
  --fsd-blue-border: rgba(96,165,250,.40);
}

/* ── Grade da página ─────────────────────────────────────────────── */
.fsd-shell {
  flex: 1;
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-columns: calc(var(--fsd-sb-w) * var(--fsd-ui)) minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas: "sb top" "sb body";
  transition: grid-template-columns .22s cubic-bezier(.4,0,.2,1);
  overflow: hidden;
}
.fsd-shell[data-mini="1"] { --fsd-sb-w: 64px; }
.fsd-sidebar { grid-area: sb; }
.fsd-shell > #tb1-wrap { grid-area: top; min-width: 0; zoom: var(--fsd-ui); }
.fsd-shell > #body { grid-area: body; min-width: 0; }

/* ── Ícones por máscara ──────────────────────────────────────────── */
[data-ic]::before {
  content: "";
  width: 15px; height: 15px;
  flex: none;
  background-color: currentColor;
  -webkit-mask: var(--ic) center / contain no-repeat;
          mask: var(--ic) center / contain no-repeat;
  opacity: .9;
}

/* ════════════════════════════════════════════════════════════════════
   MENU LATERAL — classes e medidas do layout.js / sidebar-crm.js
   ════════════════════════════════════════════════════════════════════ */
.fsd-sidebar {
  width: var(--fsd-sb-w);
  min-width: 0;
  zoom: var(--fsd-ui);
  background: linear-gradient(180deg, #1a1d2e 0%, #0f1419 100%);
  border-right: 1px solid rgba(255,255,255,.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 4px 0 12px rgba(0,0,0,.3);
  color: var(--sb-tx-1, rgba(255,255,255,.92));
  z-index: 30;
  transition: width .22s cubic-bezier(.4,0,.2,1);
}
.fsd-sidebar .sidebar__header {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255,255,255,.1);
  background: rgba(0,0,0,.18);
  display: flex; align-items: center; gap: 12px;
  flex-shrink: 0;
}
.fsd-sidebar .sidebar__gear-btn {
  background: none; border: none; cursor: pointer; padding: 0;
  display: flex; align-items: center; justify-content: center;
  transition: transform .2s; border-radius: 50%;
}
.fsd-sidebar .sidebar__gear-btn:hover { transform: scale(1.04); }
.fsd-sidebar .sidebar__gear-btn:focus-visible { outline: 2px solid #facc15; outline-offset: 2px; }
.fsd-sidebar #app-logo {
  width: 52px; height: 52px; display: block;
  filter: drop-shadow(0 6px 14px rgba(0,0,0,.40));
}
.fsd-sidebar .sidebar__logo-text-wrapper { display: flex; flex-direction: column; line-height: 1.1; pointer-events: none; min-width: 0; }
.fsd-sidebar .sidebar__logo-text { font-family: var(--font-brand, 'Syne', sans-serif); font-size: 18px; font-weight: 900; color: var(--sb-tx-1, #fff); letter-spacing: .3px; }
.fsd-sidebar .sidebar__logo-subtext { font-family: var(--font-brand, 'Syne', sans-serif); font-size: 11px; font-weight: 900; color: #facc15; letter-spacing: 2px; margin-top: 2px; }

.fsd-sidebar .sidebar__nav {
  flex: 1; overflow-y: auto; overflow-x: hidden; padding: 6px 0 10px;
  scrollbar-width: thin; scrollbar-color: var(--sb-tx-4, rgba(255,255,255,.1)) transparent;
}
.fsd-sidebar .sb-always { padding: 4px 0; border-bottom: 1px solid rgba(255,255,255,.06); margin-bottom: 4px; }
.fsd-sidebar .sb-section { margin: 8px 0 2px; }
.fsd-sidebar .sb-section__hd { display: flex; align-items: center; gap: 8px; padding: 9px 16px 5px; }
.fsd-sidebar .sb-section__lbl { flex: 1; font-size: 12px; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; color: var(--sec-color, #f59e0b); }

/* Favoritos (engrenagem de 9 dentes) */
.fsd-sidebar .sb-favs { margin: 6px 0 2px; padding-top: 6px; border-top: 1px solid rgba(255,255,255,.07); }
.fsd-sidebar .sb-favs[hidden] { display: none; }
.fsd-sidebar .sb-favs__hd { display: flex; align-items: center; gap: 8px; padding: 6px 16px 6px 14px; font-size: 9.5px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; color: #f59e0b; opacity: .85; }
.fsd-sidebar .sb-favs__ico { display: flex; align-items: center; color: #f59e0b; }
.fsd-sidebar .sb-favs .sidebar__item { padding-left: 42px; }

/* Grupos */
.fsd-sidebar .sb-group { margin: 2px 0; }
.fsd-sidebar .sb-group__hd {
  width: 100%; padding: 9px 16px 9px 14px;
  display: flex; align-items: center; gap: 10px;
  background: none; border: none; border-left: 2px solid transparent;
  color: var(--sb-tx-2, rgba(255,255,255,.65)); cursor: pointer; text-align: left;
  font-family: var(--font-ui, 'DM Sans', sans-serif);
  transition: background .15s, color .15s;
}
.fsd-sidebar .sb-group__hd:hover { background: var(--sb-hover, rgba(255,255,255,.05)); color: var(--sb-tx-1, rgba(255,255,255,.9)); border-left-color: var(--grp, #60a5fa); }
.fsd-sidebar .sb-group.open > .sb-group__hd { background: var(--sb-hover, rgba(255,255,255,.04)); color: var(--sb-tx-1, rgba(255,255,255,.95)); border-left-color: var(--grp, #60a5fa); }
.fsd-sidebar .sb-group__hd[data-ic]::before { width: 18px; height: 18px; opacity: .8; }
.fsd-sidebar .sb-group__lbl { flex: 1; font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fsd-sidebar .sb-group__arrow { opacity: .45; transition: transform .2s; flex-shrink: 0; width: 12px; height: 12px; }
.fsd-sidebar .sb-group.open > .sb-group__hd .sb-group__arrow { transform: rotate(180deg); opacity: .7; }
.fsd-sidebar .sb-group__body { display: none; }
.fsd-sidebar .sb-group.open > .sb-group__body { display: block; }
.fsd-sidebar .sb-group__body .sidebar__item { padding-left: 42px; }

/* Itens */
.fsd-sidebar .sidebar__item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 9px 16px;
  color: var(--sb-tx-2, rgba(255,255,255,.72)); background: none;
  border: 0; border-left: 2px solid transparent;
  font-family: var(--font-ui, 'DM Sans', sans-serif);
  font-size: 13px; font-weight: 600; text-align: left;
  cursor: pointer; position: relative;
  transition: background .12s, color .12s;
}
.fsd-sidebar .sidebar__item:hover { background: rgba(250,204,21,.08); color: #facc15; border-left-color: rgba(250,204,21,.4); }
.fsd-sidebar .sidebar__item.active { background: rgba(245,158,11,.12); color: #fbbf24; border-left-color: #f59e0b; font-weight: 800; }
.fsd-sidebar .sidebar__item[data-ic]::before { width: 16px; height: 16px; opacity: .75; }
.fsd-sidebar .sidebar__item .sidebar__item-text { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 22px; }
.fsd-sidebar .sidebar__item.danger:hover { background: rgba(239,68,68,.12); color: #f87171; border-left-color: rgba(239,68,68,.5); }
.fsd-sidebar .sidebar__item.on { color: #fbbf24; }
.fsd-sidebar .sidebar__item.on::after {
  content: "ATIVO"; flex: none; margin-right: 22px;
  font: 800 8.5px var(--font-mono, monospace); color: #facc15; letter-spacing: .08em;
}
.fsd-sidebar .sidebar__item.on .sidebar__item-text { padding-right: 0; }
.fsd-shell[data-mini="1"] .sidebar__item.on::after { display: none; }
.fsd-sidebar .sb-fav {
  position: absolute; right: 9px; top: 50%; transform: translateY(-50%);
  display: flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 6px;
  color: #64748b; opacity: .28; cursor: pointer;
  transition: opacity .15s, color .15s, background .15s;
}
.fsd-sidebar .sidebar__item:hover .sb-fav { opacity: .8; }
.fsd-sidebar .sb-fav:hover { opacity: 1; color: #fbbf24; background: rgba(245,158,11,.14); }
.fsd-sidebar .sb-fav.on { opacity: 1; color: #f59e0b; }
.fsd-sidebar .sb-chip {
  margin: 6px 16px 4px 42px; font-size: 10px; font-family: var(--font-mono, monospace);
  color: var(--sb-tx-3, rgba(255,255,255,.5)); display: flex; align-items: center; gap: 7px;
}
.fsd-sidebar .sb-dot { width: 6px; height: 6px; border-radius: 50%; background: #64748b; flex: none; box-shadow: 0 0 0 3px rgba(100,116,139,.18); }
.fsd-sidebar .sb-chip.ok .sb-dot { background: #34d399; box-shadow: 0 0 0 3px rgba(52,211,153,.18); }

/* ── Biblioteca de blocos: a paleta do app mora aqui dentro ── */
.fsd-sidebar #sidebar {
  width: auto; height: auto; background: none; border: 0; box-shadow: none;
  overflow: visible; display: flex; flex-direction: column; gap: 2px;
  padding: 2px 10px 6px 14px;
}
/* display:contents — os sistemas viram irmãos do #palette e a grade entra
   logo abaixo do sistema ativo pelo `order` (ver fsd-shell.js, item 7) */
.fsd-sidebar #cat-tabs,
.fsd-sidebar #cat-tabs.fs-systems { display: contents; }
.fsd-sidebar .fs-sys__hd {
  background: none; border: 0; border-left: 2px solid transparent; border-radius: 0;
  padding: 8px 8px 8px 12px; color: var(--sb-tx-2, rgba(255,255,255,.72)); font-size: 12px;
}
.fsd-sidebar .fs-sys__hd:hover { background: var(--sb-hover, rgba(255,255,255,.05)); color: var(--sb-tx-1, #fff); }
.fsd-sidebar .fs-sys.open > .fs-sys__hd { color: var(--sb-tx-1, #fff); border-left-color: var(--sys-color); background: var(--sb-hover, rgba(255,255,255,.03)); }
.fsd-sidebar .fs-sys__lbl { font-size: 12px; }
.fsd-sidebar .fs-sys__body,
.fsd-sidebar .fs-sys.open .fs-sys__body {
  max-height: none; overflow: visible; transition: none;
  flex-direction: row; flex-wrap: wrap; gap: 4px; padding: 6px 0 10px 14px;
}
.fsd-sidebar .fs-sys:not(.open) .fs-sys__body { display: none; }
.fsd-sidebar #cat-tabs button.fs-cat-btn {
  font-size: 9.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--sb-tx-3, rgba(255,255,255,.55)); background: var(--sb-hover, rgba(255,255,255,.05));
  border: 1px solid rgba(255,255,255,.1); border-radius: 999px;
  padding: 3px 9px; width: auto; text-align: center;
}
.fsd-sidebar #cat-tabs button.fs-cat-btn:hover { color: var(--sb-tx-1, #fff); border-color: var(--sb-tx-4, rgba(255,255,255,.25)); }
.fsd-sidebar #cat-tabs button.fs-cat-btn.active { color: #facc15; background: rgba(250,204,21,.12); border-color: rgba(250,204,21,.4); }
.fsd-sidebar .fs-sys__placeholder { font-size: 10px; color: var(--sb-tx-4, rgba(255,255,255,.4)); padding: 2px 0; }
.fsd-sidebar #palette {
  flex: none; display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
  padding: 0 0 10px 14px; overflow: visible; max-height: none;
}
.fsd-sidebar #palette:empty { display: none; }
.fsd-sidebar .pal-item {
  padding: 6px 4px 6px; gap: 4px; border-radius: 6px;
  background: var(--sb-hover, rgba(255,255,255,.04)); border: 1px solid rgba(255,255,255,.1);
  min-width: 0;
}
.fsd-sidebar .pal-item svg { height: 48px !important; width: auto !important; max-width: 100%; }
.fsd-sidebar .pal-item span { font-size: 9px; line-height: 1.2; color: var(--sb-tx-3, rgba(255,255,255,.6)); max-width: 100%; }
.fsd-sidebar .pal-item:hover span { color: #fbbf24; }

/* ── Planta de fundo (os controles do planta-fundo.js moram aqui) ── */
.fsd-sidebar #pf-barra { display: flex !important; flex-direction: column; align-items: stretch !important; gap: 2px !important; }
.fsd-sidebar #pf-ctrl { flex-wrap: wrap; padding: 4px 16px 6px 42px; gap: 8px !important; }
.fsd-sidebar #pf-ctrl[style*="none"] { display: none !important; }
.fsd-sidebar #pf-ctrl button {
  font: 700 11px var(--font-ui, sans-serif); color: var(--sb-tx-2, rgba(255,255,255,.75));
  background: var(--sb-hover, rgba(255,255,255,.05)); border: 1px solid rgba(255,255,255,.12);
  border-radius: 6px; padding: 5px 9px; cursor: pointer;
}
.fsd-sidebar #pf-ctrl button:hover { color: #facc15; border-color: rgba(250,204,21,.4); }
.fsd-sidebar #pf-ctrl input[type=range] { flex: 1; min-width: 70px; accent-color: #f59e0b; }

/* ── Rodapé (copiado do sidebar-crm.js) ── */
.fsd-sidebar .sidebar__footer {
  padding: 12px; border-top: 1px solid rgba(255,255,255,.1);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: rgba(0,0,0,.18); flex: none; position: relative;
}
.fsd-sidebar .sidebar__badges { display: flex; gap: 12px; align-items: center; flex: 1; min-width: 0; }
.fsd-sidebar .sidebar__badge-wrap { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.fsd-sidebar .sidebar__badge {
  width: 44px; height: 44px; border-radius: 50%; padding: 0; border: 0;
  background: transparent; cursor: pointer; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px rgba(0,0,0,.25);
}
.fsd-sidebar .sidebar__badge svg { width: 100%; height: 100%; display: block; }
.fsd-sidebar .sidebar__badge:focus-visible { outline: 2px solid #facc15; outline-offset: 2px; }
.fsd-sidebar .sidebar__badge-label { font-size: 11px; font-weight: 800; color: var(--sb-tx-2, rgba(255,255,255,.72)); max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; }
.fsd-sidebar .sidebar__badge-sub { font: 600 9.5px var(--font-mono, monospace); color: var(--sb-tx-4, rgba(255,255,255,.42)); max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; margin-top: -3px; letter-spacing: .03em; }
.fsd-sidebar .sidebar__acoes { display: flex; flex-direction: column; align-items: stretch; gap: 6px; flex: none; }
.fsd-sidebar .sidebar__acoes-row { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.fsd-sidebar .sidebar__logout {
  width: 36px; height: 36px; border: none; border-radius: 6px; cursor: pointer;
  background: var(--sb-hover, rgba(255,255,255,.05)); color: var(--sb-tx-3, rgba(255,255,255,.6));
  display: inline-flex; align-items: center; justify-content: center; transition: all .2s;
}
.fsd-sidebar .sidebar__logout:hover { background: rgba(239,68,68,.2); color: #ef4444; }
.fsd-sidebar .sidebar__logout[data-ic]::before { width: 18px; height: 18px; }
.fsd-sidebar .sidebar__ts { display: flex; align-items: center; gap: 1px; width: 100%; background: var(--sb-hover, rgba(255,255,255,.05)); border-radius: 6px; padding: 2px; }
.fsd-sidebar .sidebar__ts__b {
  flex: 1 1 0; min-width: 0; height: 24px; padding: 0 6px; border: none; background: none; border-radius: 4px; cursor: pointer;
  color: var(--sb-tx-2, rgba(255,255,255,.65)); font-size: 15px; font-weight: 700; line-height: 1; font-family: inherit;
}
.fsd-sidebar .sidebar__ts__b:hover { background: rgba(245,158,11,.2); color: #f59e0b; }
.fsd-sidebar .sidebar__ts__a { flex: 0 0 auto; min-width: 22px; text-align: center; font-size: 11px; font-weight: 800; color: var(--sb-tx-3, rgba(255,255,255,.6)); user-select: none; }
.fsd-user-pop {
  position: absolute; left: 12px; bottom: calc(100% + 6px); z-index: 50;
  background: #14182a; border: 1px solid rgba(255,255,255,.14); border-radius: 10px;
  padding: 6px; min-width: 210px; box-shadow: 0 10px 30px rgba(0,0,0,.45);
  display: flex; flex-direction: column; gap: 2px;
}
.fsd-user-pop[hidden] { display: none; }
.fsd-user-pop .sidebar__item { padding: 8px 10px; border-radius: 7px; font-size: 12px; }

/* ── Menu recolhido: 64 px, igual ao Control ── */
.fsd-shell[data-mini="1"] .sidebar__logo-text-wrapper,
.fsd-shell[data-mini="1"] .sidebar__item-text,
.fsd-shell[data-mini="1"] .sb-section__hd,
.fsd-shell[data-mini="1"] .sb-group__lbl,
.fsd-shell[data-mini="1"] .sb-group__arrow,
.fsd-shell[data-mini="1"] .sb-favs__hd,
.fsd-shell[data-mini="1"] .sb-fav,
.fsd-shell[data-mini="1"] .sb-chip,
.fsd-shell[data-mini="1"] .sb-group__body,
.fsd-shell[data-mini="1"] .sidebar__badge-label,
.fsd-shell[data-mini="1"] .sidebar__badge-sub,
.fsd-shell[data-mini="1"] .sidebar__ts { display: none !important; }
.fsd-shell[data-mini="1"] .sidebar__header { padding: 10px 0; justify-content: center; }
.fsd-shell[data-mini="1"] #app-logo { width: 44px; height: 44px; }
.fsd-shell[data-mini="1"] .sidebar__item,
.fsd-shell[data-mini="1"] .sb-group__hd { justify-content: center; padding: 10px 0; border-left: none; }
.fsd-shell[data-mini="1"] .sb-favs .sidebar__item { padding-left: 0; }
.fsd-shell[data-mini="1"] .sidebar__footer { flex-direction: column; gap: 10px; padding: 12px 0; }
.fsd-shell[data-mini="1"] .sidebar__acoes-row { flex-direction: column; gap: 10px; }

/* ════════════════════════════════════════════════════════════════════
   BARRA DE CIMA — só comandos de uso
   ════════════════════════════════════════════════════════════════════ */
#tb1-wrap .tb-arrow, #tb1-wrap .tb-fade-left, #tb1-wrap .tb-fade-right, #tb1-wrap .tb-thumb-track { display: none !important; }
.fsd-shell #toolbar {
  height: 48px; min-height: 48px; padding: 0 10px; gap: 6px;
  box-shadow: none;
}
.fsd-shell #toolbar > button,
.fsd-shell #toolbar #pf-barra > button {
  display: inline-flex; align-items: center; gap: 6px;
  font: 600 11.5px var(--font-ui, 'DM Sans', sans-serif);
  color: var(--text-2); background: var(--bg-2);
  border: 1px solid var(--border-2); border-radius: 6px;
  padding: 6px 10px; height: auto; white-space: nowrap; cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
}
.fsd-shell #toolbar > button:hover { background: var(--bg-4); color: var(--text-1); }
.fsd-shell #toolbar > button.active {
  background: var(--gold-bg-2); border-color: var(--gold-border); color: var(--gold-1);
}
.fsd-shell #toolbar > button:disabled { cursor: default; }
.fsd-shell #toolbar > button:focus-visible { outline: 2px solid var(--gold-2); outline-offset: 1px; }
.fsd-shell #toolbar > button#btn-save-cloud {
  background: var(--green-bg, rgba(52,211,153,.10)); border-color: var(--green-border, rgba(52,211,153,.35)); color: var(--green, #34d399);
}
.fsd-shell #toolbar > .sep { width: 1px; height: 20px; background: var(--border-2); margin: 0 3px; flex: none; }
.fsd-shell #toolbar > .fsd-sp { flex: 1; min-width: 8px; }
.fsd-shell #save-status { font-family: var(--font-mono, monospace); font-size: 10px; color: var(--text-3); white-space: nowrap; }
.fsd-shell #proj-badge { max-width: 240px; margin-left: 2px; }
.fsd-shell #proj-badge .fsd-pb-ic { display: inline-flex; color: var(--gold-2); }
.fsd-shell #proj-badge .fsd-pb-ic::before { width: 15px; height: 15px; }
.fsd-shell #user-bar { display: none !important; }   /* o usuário mora no rodapé do menu */

/* ════════════════════════════════════════════════════════════════════
   BARRA AZUL DE CONTEXTO — por cima do canvas, só com seleção
   ════════════════════════════════════════════════════════════════════ */
.fsd-canvas-col { position: relative; }
.fsd-bars {
  position: absolute; top: 0; left: 0; right: 0; z-index: 15;
  display: flex; flex-direction: column; pointer-events: none;
}
.fsd-bars > * { pointer-events: auto; }
.fsd-bars .tb-arrow, .fsd-bars .tb-fade-left, .fsd-bars .tb-fade-right, .fsd-bars .tb-thumb-track { display: none !important; }
#tb2-wrap { display: none; zoom: var(--fsd-ui); }
#tb2-wrap[data-sel="blocos"], #tb2-wrap[data-sel="linha"] { display: block; }
.fsd-shell #toolbar2 {
  height: 36px; min-height: 36px; padding: 0 10px; gap: 5px;
  background: rgba(15,22,40,.86);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--fsd-blue-border);
  box-shadow: inset 0 0 0 999px var(--fsd-blue-bg);
}
.fsd-shell #toolbar2 .ctx-l {
  font-family: var(--font-mono, monospace); font-size: 10px; font-weight: 600;
  color: var(--fsd-blue); letter-spacing: .05em; text-transform: uppercase;
  white-space: nowrap; margin-right: 4px;
}
.fsd-shell #toolbar2 .ctx-grp { display: none; align-items: center; gap: 5px; }
#tb2-wrap[data-sel="blocos"] .ctx-grp[data-ctx~="blocos"],
#tb2-wrap[data-sel="linha"] .ctx-grp[data-ctx~="linha"] { display: inline-flex; }
.fsd-shell #toolbar2 .ctx-g {
  font-size: 10px; color: var(--text-3); font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; margin: 0 2px 0 8px; white-space: nowrap;
}
.fsd-shell #toolbar2 button {
  display: inline-flex; align-items: center; gap: 5px;
  background: transparent; color: var(--fsd-blue); border: 1px solid var(--fsd-blue-border);
  border-radius: 6px; padding: 4px 8px; font: 600 11px var(--font-ui, sans-serif); white-space: nowrap;
}
.fsd-shell #toolbar2 button:hover { background: var(--fsd-blue-bg); color: #bfdbfe; }
.fsd-shell #toolbar2 button[data-ic]::before { width: 14px; height: 14px; }
.fsd-shell #toolbar2 button.active { background: rgba(96,165,250,.22); color: #dbeafe; }

/* ════════════════════════════════════════════════════════════════════
   PROPRIEDADES — recolhe numa faixa vertical (AutoCAD)
   ════════════════════════════════════════════════════════════════════ */
.fsd-shell #props { width: var(--fsd-props-w); transition: width .22s cubic-bezier(.4,0,.2,1); zoom: var(--fsd-ui); }
.fsd-shell #props-header { justify-content: flex-start; }
.fsd-shell #props-header .props-min {
  margin-left: auto; width: 24px; height: 24px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border-2); background: var(--bg-2); color: var(--text-2);
  border-radius: 6px; cursor: pointer; padding: 0;
}
.fsd-shell #props-header .props-min:hover { background: var(--bg-4); color: var(--text-1); }
.fsd-shell #props-header .props-min::before { width: 13px; height: 13px; }
.fsd-shell .props-strip {
  display: none; width: 28px; flex: 1; padding: 12px 0; gap: 10px;
  background: none; border: 0; cursor: pointer; color: var(--gold-2);
  font-family: var(--font-brand, 'Syne', sans-serif); font-size: 10px; font-weight: 800;
  letter-spacing: .14em; text-transform: uppercase;
  writing-mode: vertical-rl; align-items: center; justify-content: flex-start;
}
.fsd-shell .props-strip:hover { background: var(--bg-3); }
.fsd-shell[data-props="0"] #props { width: 28px; }
.fsd-shell[data-props="0"] #props > :not(.props-strip) { display: none !important; }
.fsd-shell[data-props="0"] .props-strip { display: flex; }

/* a mensagem de status do app fica centrada, mas não passa por baixo do zoom */
.fsd-shell #status-msg { max-width: calc(100% - 330px); overflow: hidden; text-overflow: ellipsis; }

/* ── Zoom flutuante ── */
.fsd-zoom {
  position: absolute; right: 12px; bottom: 12px; z-index: 12;
  display: flex; align-items: center; gap: 2px;
  background: var(--bg-2); border: 1px solid var(--border-2); border-radius: 8px;
  padding: 3px; box-shadow: 0 4px 12px rgba(0,0,0,.25);
}
.fsd-zoom button {
  width: 26px; height: 24px; border: 0; background: none; color: var(--text-2);
  font-size: 14px; font-weight: 700; cursor: pointer; border-radius: 5px;
  display: inline-flex; align-items: center; justify-content: center; padding: 0;
}
.fsd-zoom button:hover { background: var(--bg-4); color: var(--text-1); }
.fsd-zoom button[data-ic]::before { width: 13px; height: 13px; }
.fsd-zoom .fsd-zoom__v {
  font-family: var(--font-mono, monospace); font-size: 10.5px; color: var(--text-2);
  min-width: 44px; text-align: center; font-variant-numeric: tabular-nums;
  background: none; border: 0; cursor: pointer; border-radius: 5px; padding: 4px 2px;
}
.fsd-zoom .fsd-zoom__v:hover { background: var(--bg-4); color: var(--text-1); }

/* ── Abas de layout ── */
.fsd-shell #layout-bar { gap: 6px; padding: 0 10px; background: var(--bg-2); }
.fsd-shell .lt-tab {
  height: 22px; margin: 0; padding: 0 10px; gap: 6px;
  border: 1px solid var(--border-2); border-radius: 5px;
  background: none; color: var(--text-3); font-size: 10.5px; font-weight: 700;
}
.fsd-shell .lt-tab:hover { color: var(--gold-1); border-color: var(--gold-border); }
.fsd-shell .lt-tab.active { color: var(--gold-2); background: var(--gold-bg); border-color: var(--gold-border); }
.fsd-shell .lt-tab .lt-input {
  font: inherit; color: inherit; background: var(--bg-0);
  border: 1px solid var(--gold-border); border-radius: 4px;
  padding: 1px 5px; width: 14ch; outline: none;
}
.fsd-shell .lt-add-btn { height: 22px; border-style: dashed; }
.fsd-shell .fsd-lt-hint { font-family: var(--font-mono, monospace); font-size: 9.5px; color: var(--text-3); margin-left: 6px; white-space: nowrap; }

/* ════════════════════════════════════════════════════════════════════
   PRANCHA TÉCNICA · NBR 17240 (fsd-tecnico.js)
   Símbolos e cabos desenham em currentColor: aqui é a tinta da tela;
   na impressão (página sem este CSS) vira preto no papel.
   ════════════════════════════════════════════════════════════════════ */
#canvas[data-desenho="tecnico"] { color: #e8ecf5; }
/* folha de impressão (printDiagram monta no próprio documento): tinta preta.
   Sem isto o currentColor herdaria o cinza-claro do body e o símbolo sumiria. */
#_print_layer { color: #111; }
html[data-fsd-desenho="tecnico"] .fsd-sidebar .pal-item { color: var(--sb-tx-1, rgba(255,255,255,.85)); }
html[data-fsd-desenho="tecnico"] .fsd-sidebar .pal-item svg > rect:first-child { stroke: transparent; }
.fsd-shell .fsd-lt-nbr {
  font: 800 8px var(--font-mono, monospace); letter-spacing: .08em;
  color: var(--text-2); border: 1px solid var(--border-2); border-radius: 3px; padding: 0 3px;
}
#legend .fsd-leg-r { display: flex; align-items: center; gap: 8px; font-size: 10px; line-height: 1.35; color: var(--text-2); margin-bottom: 7px; }
#legend .fsd-leg-s { width: 26px; flex: none; display: flex; align-items: center; justify-content: center; color: var(--text-1); }
#legend .fsd-leg-r > svg { flex: none; color: var(--text-1); }
#legend .fsd-leg-r small { margin-left: auto; padding-left: 6px; font-family: var(--font-mono, monospace); color: var(--text-3); }
#legend .fsd-leg-t { font-size: 9.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); margin: 12px 0 8px; }
#legend .fsd-leg-vazio { font-size: 10px; color: var(--text-3); }

/* ── Embutido no CRM e somente leitura ── */
html.fsd-embed .fsd-sidebar .sb-always,
html.fsd-embed .fsd-sidebar .sb-favs,
html.fsd-embed .fsd-sidebar [data-sec="projeto"],
html.fsd-embed .fsd-sidebar [data-sec="integracoes"],
html.fsd-embed .fsd-sidebar .sidebar__footer { display: none !important; }
html.fds-ro .fsd-shell { grid-template-columns: 0 minmax(0, 1fr); }
html.fds-ro .fsd-sidebar { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  .fsd-shell, .fsd-sidebar, .fsd-shell #props { transition: none; }
}

/* ════════════════════════════════════════════════════════════════════
   MENU NOVO (26/09/2026) — checklist "Tela pronta" do plano Rosto único

   Três ações à vista, o resto no menu Ações; favoritos logo abaixo, com a
   engrenagem de 9 dentes; a paleta com todo o resto da lateral, sempre
   aberta, com busca. Uma rolagem só: a da paleta. Só tokens, nenhuma cor
   fixa — o modo dia herda tudo.
   ════════════════════════════════════════════════════════════════════ */

/* a lateral vira coluna: ações fixas em cima, paleta enchendo o resto */
.fsd-sidebar .sidebar__nav {
  flex: 1; min-height: 0; display: flex; flex-direction: column;
  overflow: hidden; padding: 6px 0 0;
}
.fsd-sidebar .sb-acoes { flex: none; padding: 2px 0 6px; border-bottom: 1px solid var(--border, rgba(255,255,255,.08)); }
.fsd-sidebar .sb-doca { display: none; }

/* selo do módulo dentro do item */
.fsd-sidebar .sb-selo {
  margin-left: auto; flex: none;
  font: 800 8.5px/1 var(--font-mono, monospace); letter-spacing: .08em;
  padding: 3px 5px; border-radius: 4px;
  color: var(--gold-1, #facc15); background: var(--gold-bg, rgba(250,204,21,.12));
  border: 1px solid var(--gold-border, rgba(250,204,21,.35));
}
.fsd-sidebar .sb-selo[data-mod="diagrama"] { color: var(--blue, #60a5fa); background: var(--blue-bg, rgba(96,165,250,.12)); border-color: var(--blue-border, rgba(96,165,250,.35)); }
.fsd-sidebar .sb-selo[data-mod="isometrico"] { color: var(--green, #34d399); background: var(--green-bg, rgba(52,211,153,.10)); border-color: var(--green-border, rgba(52,211,153,.35)); }

/* favoritos: logo depois do bloco fixo, como no padrão do ecossistema */
.fsd-sidebar .sb-favoritos { flex: none; padding: 4px 0 6px; border-bottom: 1px solid var(--border, rgba(255,255,255,.08)); }
.fsd-sidebar .sb-favoritos__hd {
  display: flex; align-items: center; gap: 8px; padding: 6px 16px 4px;
  font-size: 9.5px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase;
  color: var(--gold-1, #f59e0b); opacity: .85;
}
.fsd-sidebar .sb-favoritos__ico { display: flex; align-items: center; color: var(--gold-1, #f59e0b); }

/* ── Paleta: dona do resto da lateral ─────────────────────────────── */
.fsd-sidebar .sb-paleta { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.fsd-sidebar .sb-paleta__rolo {
  flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden;
  scrollbar-width: thin; scrollbar-color: var(--sb-tx-4, rgba(255,255,255,.1)) transparent;
}
.fsd-sidebar .sb-busca { flex: none; position: relative; display: flex; align-items: center; padding: 8px 12px 6px 14px; }
.fsd-sidebar .sb-busca__ico { position: absolute; left: 22px; width: 13px; height: 13px; color: var(--sb-tx-4, rgba(255,255,255,.4)); pointer-events: none; }
.fsd-sidebar .sb-busca input {
  width: 100%; padding: 6px 24px 6px 26px;
  font: 500 11.5px/1.2 var(--font-ui, system-ui); color: var(--sb-tx-1, #fff);
  background: var(--sb-hover, rgba(255,255,255,.05));
  border: 1px solid var(--border, rgba(255,255,255,.1)); border-radius: 6px;
  outline: none;
}
.fsd-sidebar .sb-busca input::placeholder { color: var(--sb-tx-4, rgba(255,255,255,.35)); }
.fsd-sidebar .sb-busca input:focus { border-color: var(--gold-border, rgba(250,204,21,.4)); background: var(--bg-4, rgba(255,255,255,.07)); }
.fsd-sidebar .sb-busca input::-webkit-search-cancel-button { display: none; }
.fsd-sidebar .sb-busca__x {
  position: absolute; right: 18px; width: 16px; height: 16px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  background: none; border: 0; cursor: pointer; color: var(--sb-tx-3, rgba(255,255,255,.5));
}
.fsd-sidebar .sb-busca__x svg { width: 12px; height: 12px; }
.fsd-sidebar .sb-busca__x:hover { color: var(--gold-1, #facc15); }
.fsd-sidebar .sb-busca__vazio { padding: 14px 16px; font-size: 11px; color: var(--sb-tx-4, rgba(255,255,255,.4)); }
/* durante a busca, os sistemas somem: a lista é o resultado */
.fsd-sidebar #sidebar.buscando #cat-tabs { display: none; }
.fsd-sidebar #sidebar.buscando #palette { padding-left: 14px; }

/* recolhido (64 px): some tudo que é texto; a paleta também */
.fsd-shell[data-mini="1"] .sb-paleta,
.fsd-shell[data-mini="1"] .sb-favoritos__hd,
.fsd-shell[data-mini="1"] .sb-selo { display: none !important; }

/* ── Pop-up centralizado ──────────────────────────────────────────── */
.fsd-pop-ov {
  position: fixed; inset: 0; z-index: 9000;
  display: flex; align-items: center; justify-content: center; padding: 24px;
  background: rgba(2, 6, 23, .58); backdrop-filter: blur(2px);
}
.fsd-pop {
  width: 100%; max-width: 560px; max-height: calc(100vh - 48px);
  display: flex; flex-direction: column;
  background: var(--bg-2, #14182a); color: var(--text-1, rgba(255,255,255,.92));
  border: 1px solid var(--border-2, rgba(255,255,255,.14)); border-radius: 12px;
  box-shadow: var(--sh-modal, 0 24px 80px rgba(0,0,0,.8));
}
.fsd-pop__hd { display: flex; align-items: center; gap: 12px; padding: 14px 16px 10px; border-bottom: 1px solid var(--border, rgba(255,255,255,.08)); }
.fsd-pop__ti { flex: 1; margin: 0; font: 800 15px/1.2 var(--font-brand, 'Syne', sans-serif); letter-spacing: .01em; color: var(--text-1); }
.fsd-pop__x { width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; background: none; border: 0; border-radius: 6px; color: var(--text-3); cursor: pointer; }
.fsd-pop__x svg { width: 15px; height: 15px; }
.fsd-pop__x:hover { background: var(--sb-hover, rgba(255,255,255,.06)); color: var(--text-1); }
.fsd-pop__bd { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 16px; }
.fsd-pop__pe { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 16px 14px; border-top: 1px solid var(--border, rgba(255,255,255,.08)); }
.fsd-pop__b {
  padding: 8px 16px; font: 700 12px var(--font-ui, system-ui); border-radius: 7px; cursor: pointer;
  background: var(--sb-hover, rgba(255,255,255,.06)); color: var(--text-1);
  border: 1px solid var(--border-2, rgba(255,255,255,.14));
}
.fsd-pop__b:hover { border-color: var(--border-strong, rgba(255,255,255,.22)); }
/* um dourado cheio por tela: é este */
.fsd-pop__b.principal { background: var(--gold-1, #facc15); color: #1a1205; border-color: transparent; }
.fsd-pop__b.principal:hover { background: var(--gold-2, #fbbf24); }
.fsd-pop__b.perigo { color: var(--red, #f87171); border-color: var(--red-border, rgba(239,68,68,.4)); }
.fsd-pop__planta { display: flex; flex-direction: column; gap: 8px; }

/* ── Menu Ações ───────────────────────────────────────────────────── */
.fsd-acoes__g {
  padding: 12px 2px 5px; font: 800 9.5px/1 var(--font-ui, system-ui);
  letter-spacing: .1em; text-transform: uppercase; color: var(--text-3);
}
.fsd-acoes__g:first-child { padding-top: 2px; }
.fsd-acoes__linha { display: flex; align-items: stretch; gap: 4px; }
.fsd-acoes__b {
  flex: 1; display: flex; flex-direction: column; align-items: flex-start; gap: 1px;
  padding: 8px 10px; text-align: left; cursor: pointer; border-radius: 7px;
  background: none; border: 1px solid transparent; color: var(--text-1);
}
.fsd-acoes__b[data-ic]::before {
  content: ''; position: absolute; left: 12px; width: 15px; height: 15px;
  background: currentColor; -webkit-mask: var(--ic) center/contain no-repeat; mask: var(--ic) center/contain no-repeat;
}
.fsd-acoes__b { position: relative; padding-left: 36px; }
.fsd-acoes__b:hover { background: var(--gold-bg, rgba(250,204,21,.10)); border-color: var(--gold-border, rgba(250,204,21,.3)); color: var(--gold-1, #facc15); }
.fsd-acoes__b.perigo:hover { background: var(--red-bg, rgba(239,68,68,.1)); border-color: var(--red-border, rgba(239,68,68,.4)); color: var(--red, #f87171); }
.fsd-acoes__t { font: 700 12.5px/1.25 var(--font-ui, system-ui); }
.fsd-acoes__s { font: 500 10.5px/1.3 var(--font-ui, system-ui); color: var(--text-3); }
.fsd-acoes__b:hover .fsd-acoes__s { color: inherit; opacity: .8; }
.fsd-acoes__fav {
  flex: none; width: 30px; display: flex; align-items: center; justify-content: center;
  background: none; border: 0; border-radius: 7px; cursor: pointer;
  color: var(--text-4); opacity: .5;
}
.fsd-acoes__fav:hover { opacity: 1; color: var(--gold-1, #facc15); background: var(--gold-bg, rgba(250,204,21,.1)); }
.fsd-acoes__fav.on { opacity: 1; color: var(--gold-1, #f59e0b); }
.fsd-acoes__fav svg { width: 13px; height: 13px; }

/* ── Seletor de módulo ────────────────────────────────────────────── */
.fsd-mods__grade { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.fsd-mod {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  padding: 12px; text-align: left; cursor: pointer; border-radius: 10px;
  background: var(--sb-hover, rgba(255,255,255,.04)); color: var(--text-1);
  border: 1.5px solid var(--border, rgba(255,255,255,.1));
}
.fsd-mod:hover { border-color: var(--border-strong, rgba(255,255,255,.25)); }
.fsd-mod.on { border-color: var(--gold-1, #facc15); background: var(--gold-bg, rgba(250,204,21,.1)); }
.fsd-mod__fig { display: block; width: 100%; color: var(--text-2); }
.fsd-mod.on .fsd-mod__fig { color: var(--gold-1, #facc15); }
.fsd-mod__fig svg { width: 100%; height: 42px; }
.fsd-mod__nome { font: 800 13px/1.2 var(--font-brand, 'Syne', sans-serif); }
.fsd-mod__desc { font: 500 10.5px/1.35 var(--font-ui, system-ui); color: var(--text-3); }
.fsd-mods__iso { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border, rgba(255,255,255,.08)); }
.fsd-mods__iso-rot { font: 700 11px var(--font-ui, system-ui); color: var(--text-2); margin-bottom: 8px; }
.fsd-mods__iso-bs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.fsd-iso-b {
  display: flex; flex-direction: column; gap: 2px; padding: 8px 6px; cursor: pointer;
  border-radius: 8px; background: var(--sb-hover, rgba(255,255,255,.04));
  border: 1.5px solid var(--border, rgba(255,255,255,.1)); color: var(--text-1);
}
.fsd-iso-b.on { border-color: var(--green, #34d399); background: var(--green-bg, rgba(52,211,153,.1)); color: var(--green, #34d399); }
.fsd-iso-b__n { font: 700 12px var(--font-ui, system-ui); }
.fsd-iso-b__m { font: 500 9.5px var(--font-ui, system-ui); color: var(--text-3); }
.fsd-iso-b.on .fsd-iso-b__m { color: inherit; opacity: .8; }

/* ── Selo do módulo na aba do layout ──────────────────────────────── */
.lt-mod {
  flex: none; margin-right: 6px; padding: 2px 4px; border-radius: 3px;
  font: 800 8px/1 var(--font-mono, monospace); letter-spacing: .06em;
  color: var(--gold-1, #facc15); background: var(--gold-bg, rgba(250,204,21,.12));
}
.lt-mod[data-mod="diagrama"] { color: var(--blue, #60a5fa); background: var(--blue-bg, rgba(96,165,250,.12)); }
.lt-mod[data-mod="isometrico"] { color: var(--green, #34d399); background: var(--green-bg, rgba(52,211,153,.1)); }

/* ── Módulo isométrico ────────────────────────────────────────────── */
/* a malha quadrada dá lugar ao losango nos sistemas de projeção 30° */
#canvas[data-modulo="isometrico"][data-iso-motor="30"] #grid-bg { fill: url(#gl-iso); }
:root { --iso-malha: rgba(148,163,184,.16); --iso-faixa: rgba(255,255,255,.028); --iso-faixa-2: rgba(255,255,255,.012);
        --iso-linha: rgba(148,163,184,.35); --iso-rotulo: rgba(148,163,184,.75); }
html[data-theme="light"] { --iso-malha: rgba(15,23,42,.14); --iso-faixa: rgba(15,23,42,.035); --iso-faixa-2: rgba(15,23,42,.015);
        --iso-linha: rgba(15,23,42,.30); --iso-rotulo: rgba(15,23,42,.65); }

/* editor de pavimentos */
.fsd-pav__cab, .fsd-pav__linha { display: grid; grid-template-columns: 1fr 88px 30px; gap: 8px; align-items: center; }
.fsd-pav__cab { padding: 0 2px 6px; font: 800 9.5px/1 var(--font-ui, system-ui); letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); }
.fsd-pav__linha { margin-bottom: 6px; }
.fsd-pav input {
  width: 100%; padding: 7px 9px; font: 500 12px var(--font-ui, system-ui);
  color: var(--text-1); background: var(--sb-hover, rgba(255,255,255,.05));
  border: 1px solid var(--border, rgba(255,255,255,.1)); border-radius: 6px; outline: none;
}
.fsd-pav input:focus { border-color: var(--gold-border, rgba(250,204,21,.4)); }
.fsd-pav__x {
  width: 28px; height: 30px; font-size: 16px; line-height: 1; cursor: pointer; border-radius: 6px;
  color: var(--text-3); background: none; border: 1px solid var(--border, rgba(255,255,255,.1));
}
.fsd-pav__x:hover { color: var(--red, #f87171); border-color: var(--red-border, rgba(239,68,68,.4)); }
.fsd-pav__add {
  margin-top: 8px; width: 100%; padding: 8px; cursor: pointer; border-radius: 7px;
  font: 700 11.5px var(--font-ui, system-ui); color: var(--text-2);
  background: var(--sb-hover, rgba(255,255,255,.04)); border: 1px dashed var(--border-2, rgba(255,255,255,.18));
}
.fsd-pav__add:hover { color: var(--gold-1, #facc15); border-color: var(--gold-border, rgba(250,204,21,.4)); }
.fsd-pav__aviso { margin: 0; font: 500 12px/1.5 var(--font-ui, system-ui); color: var(--text-2); }
