/* =========================================================================
   SiteFlow — tema escuro
   ========================================================================= */

:root {
  --accent: #db0001;
  --accent-ink: #ffffff;
  --accent-tint: color-mix(in srgb, var(--accent) 16%, transparent);
  --accent-glow: color-mix(in srgb, var(--accent) 34%, transparent);

  --bg: #08090c;
  --surface: #0e1015;
  --surface-2: #14171e;
  --surface-3: #1b1f28;
  --line: #23262f;
  --line-soft: #191c23;

  --ink: #eceef4;
  --ink-2: #9aa2b3;
  --ink-3: #626a7a;

  --danger: #ff5a52;

  --radius: 10px;
  --radius-lg: 16px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .5);
  --shadow-lg: 0 30px 80px rgba(0, 0, 0, .65);

  --topbar-h: 58px;
  --side-w: 274px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

/* Classes abaixo definem `display`, o que sobrescreveria o atributo `hidden`.
   Esta linha garante que `hidden` sempre esconda. */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

button, input, textarea, select { font: inherit; color: inherit; }

::selection { background: var(--accent-glow); }

*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: #2a2e39; border: 3px solid transparent; background-clip: content-box; border-radius: 8px; }
*::-webkit-scrollbar-thumb:hover { background: #3a4050; background-clip: content-box; }

/* ============================================================== primitivos */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, border-color .15s, transform .06s;
}
.btn:hover { background: var(--surface-3); border-color: #2e333f; }
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--accent);
  border-color: transparent;
  color: var(--accent-ink);
  box-shadow: 0 4px 18px var(--accent-glow);
}
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 86%, white); border-color: transparent; }

.btn-danger { background: color-mix(in srgb, var(--danger) 14%, var(--surface-2)); border-color: color-mix(in srgb, var(--danger) 34%, transparent); color: #ff8b84; }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 22%, var(--surface-2)); }

.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--ink-2);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-3); color: var(--ink); }
.icon-btn.sm { width: 26px; height: 26px; font-size: 14px; border-radius: 7px; }

/* Só a bolinha das iniciais: sem texto, nada para estourar a barra. */
.chip {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color .15s, transform .1s;
}
.chip:hover { border-color: color-mix(in srgb, var(--accent) 60%, transparent); transform: scale(1.06); }
.chip .av {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  flex: none;
}

.grow { flex: 1; }
.sep-v { width: 1px; height: 22px; background: var(--line); flex: none; }

.input, .textarea, .select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--ink);
  font-size: 13.5px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input::placeholder, .textarea::placeholder { color: var(--ink-3); }
.input:focus, .textarea:focus, .select:focus {
  border-color: color-mix(in srgb, var(--accent) 60%, var(--line));
  box-shadow: 0 0 0 3px var(--accent-tint);
}
.textarea {
  min-height: 260px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.6;
  resize: vertical;
  tab-size: 2;
}

.field { display: block; margin-bottom: 16px; }
.field > span {
  display: block;
  margin-bottom: 7px;
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 650;
}
.field > .hint, .hint { margin: 7px 0 0; color: var(--ink-3); font-size: 12px; line-height: 1.55; font-weight: 400; }

.row { display: flex; gap: 12px; align-items: flex-end; }
.row > * { flex: 1; min-width: 0; }
.row.tight { gap: 8px; }

.switch { display: inline-flex; align-items: center; gap: 11px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track {
  position: relative;
  width: 40px; height: 23px;
  flex: none;
  border-radius: 999px;
  background: #2b3040;
  transition: background .18s;
}
.switch .track::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 17px; height: 17px;
  border-radius: 50%;
  background: #fff;
  transition: transform .18s;
}
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(17px); }
.switch .label { font-size: 13.5px; font-weight: 550; }

.seg { display: inline-flex; padding: 3px; gap: 3px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 11px; }
.seg button {
  height: 30px;
  padding: 0 13px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--surface-3); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }

.divider { height: 1px; margin: 22px 0; background: var(--line-soft); border: 0; }

.section-title {
  margin: 0 0 14px;
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
}

/* ============================================================ gate de perfil */

.gate {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(900px 500px at 50% -5%, var(--accent-tint), transparent 70%),
    var(--bg);
}
.gate-card {
  width: 100%;
  max-width: 420px;
  padding: 40px 32px 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}
.gate-logo { min-height: 4px; margin-bottom: 22px; }
.gate-logo img { max-width: 190px; max-height: 52px; object-fit: contain; }
.gate-card h1 { margin: 0 0 6px; font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
.gate-sub { margin: 0 0 24px; color: var(--ink-2); font-size: 13.5px; }

.profile-list { display: grid; gap: 8px; margin-bottom: 20px; }
.profile-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  cursor: pointer;
  text-align: left;
  transition: border-color .15s, background .15s, transform .06s;
}
.profile-item:hover { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); background: var(--surface-3); }
.profile-item:active { transform: translateY(1px); }
.profile-item .av {
  display: grid; place-items: center;
  width: 34px; height: 34px;
  flex: none;
  border-radius: 50%;
  color: #fff;
  font-size: 12.5px;
  font-weight: 700;
}
.profile-item .nm { flex: 1; font-size: 14px; font-weight: 600; }
.profile-item .rm { opacity: 0; color: var(--ink-3); font-size: 13px; transition: opacity .15s; }
.profile-item:hover .rm { opacity: 1; }
.profile-item .rm:hover { color: var(--danger); }

.gate-form { display: flex; gap: 8px; padding-top: 20px; border-top: 1px solid var(--line-soft); }
.gate-form .input { flex: 1; min-width: 0; }
.gate-form .btn { flex: none; }

/* ==================================================================== shell */

.app { display: flex; flex-direction: column; height: 100vh; }
.body { display: flex; flex: 1; min-height: 0; }

/* marca ------------------------------------------------------------------ */

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 4px 8px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  transition: background .15s;
}
.brand:hover { background: var(--surface-2); }
.brand-logo { max-height: 30px; max-width: 172px; width: auto; object-fit: contain; display: block; }
.brand-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 190px;
}

/* seletor de cliente ----------------------------------------------------- */

.client-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  max-width: 230px;
  padding: 0 11px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.client-btn:hover { background: var(--surface-3); color: var(--ink); border-color: #2e333f; }
.client-btn.wide { width: 100%; max-width: none; }
.client-btn-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.caret { color: var(--ink-3); font-size: 9px; flex: none; }

.actions { display: flex; align-items: center; gap: 4px; margin-left: auto; flex: none; min-width: 0; }

/* Telas de PC mais estreitas: o botão vira só o ícone em vez de estourar a barra. */
/* O botão de arquivos tem ícone, então pode virar só o ícone.
   O de compartilhar é só texto — se esconder o texto sobra um botão vazio,
   então ele apenas aperta o espaçamento. */
@media (max-width: 1300px) {
  body[data-layout="horizontal"] .btn-files .lb { display: none; }
  body[data-layout="horizontal"] .btn-files { padding: 0 11px; }
  body[data-layout="horizontal"] .btn-share { padding: 0 10px; letter-spacing: .05em; }
}
@media (max-width: 1100px) {
  body[data-layout="horizontal"] .brand-title { max-width: 120px; }
}

/* --------------------------------------------------- layout HORIZONTAL (topo) */

.topbar {
  display: none;
  align-items: center;
  gap: 10px;
  height: var(--topbar-h);
  padding: 0 12px;
  flex: none;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  z-index: 20;
}
body[data-layout="horizontal"] .topbar { display: flex; }
body[data-layout="horizontal"] .sidebar { display: none; }

.top-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.top-nav::-webkit-scrollbar { display: none; }

.tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 33px;
  padding: 0 12px;
  flex: none;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.tab:hover { background: var(--surface-2); color: var(--ink); }
.tab.on { background: var(--accent-tint); color: #fff; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent); }
.tab.home { letter-spacing: .03em; }
.tab .dd { font-size: 8px; color: var(--ink-3); }

/* ---------------------------------------------------- layout VERTICAL (lateral) */

.sidebar {
  position: relative;
  width: var(--side-w);
  flex: none;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #050506;
  border-right: 1px solid #17191f;
}

/* alça para arrastar e mudar a largura */
.side-resize {
  position: absolute;
  top: 0;
  right: -3px;
  bottom: 0;
  width: 7px;
  z-index: 6;
  cursor: col-resize;
}
.side-resize::after {
  content: "";
  position: absolute;
  top: 0; bottom: 0; left: 3px;
  width: 2px;
  background: var(--accent);
  opacity: 0;
  transition: opacity .15s;
}
.side-resize:hover::after { opacity: .75; }
body.resizing { cursor: col-resize; user-select: none; }
body.resizing .side-resize::after { opacity: 1; }
body.resizing iframe { pointer-events: none; }
body[data-layout="vertical"] .topbar { display: none; }

.side-top {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 26px 18px 18px;
  flex: none;
}
.side-top .brand { padding: 0; margin-bottom: 4px; }
.side-top .brand:hover { background: transparent; opacity: .82; }
.side-top .brand-logo { max-height: 34px; max-width: 190px; }

/* seletor de cliente discreto, no estilo da referência */
.side-top .client-btn {
  height: 26px;
  padding: 0 6px 0 0;
  border: 0;
  background: transparent;
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.side-top .client-btn:hover { background: transparent; color: var(--ink-2); }
.side-top .client-btn .caret { font-size: 8px; }

.side-share { padding: 10px 12px 12px; flex: none; }

.btn-share {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 34px;
  padding: 0 14px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.btn-share:hover { background: var(--surface-3); border-color: #2e333f; color: var(--ink); }
.btn-share.wide { width: 100%; overflow: hidden; }

/* Arquivos do cliente — mesmo formato, com destaque na cor da marca */
.btn-files {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 34px;
  padding: 0 14px;
  flex: none;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  border-radius: 9px;
  background: color-mix(in srgb, var(--accent) 13%, transparent);
  color: #fff;
  font-size: 12.5px;
  font-weight: 650;
  white-space: nowrap;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.btn-files:hover {
  background: color-mix(in srgb, var(--accent) 24%, transparent);
  border-color: color-mix(in srgb, var(--accent) 68%, transparent);
}
.btn-files.wide { width: 100%; margin-bottom: 8px; }
/* sem link definido ainda: fica discreto, só para você */
.btn-files.unset {
  border-style: dashed;
  border-color: #333947;
  background: transparent;
  color: var(--ink-3);
  font-weight: 550;
}
.btn-files.unset:hover { color: var(--ink); border-color: #454c5c; }
.btn-files .lb { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* o rótulo encurta com "…" em vez de estourar a barra estreita */
.btn-share .lb {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.side-foot {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 12px;
  flex: none;
  border-top: 1px solid #15171c;
}

/* árvore de páginas ------------------------------------------------------ */

.nav-list { flex: 1; overflow-y: auto; padding: 4px 12px 20px; }

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 2px;
  border-radius: 8px;
  color: #b9bec9;
  cursor: pointer;
  transition: background .12s, color .12s;
}
.nav-item:hover { background: rgba(255, 255, 255, .05); color: #fff; }
.nav-item.on { color: #fff; background: rgba(255, 255, 255, .07); }
.nav-item.on::before {
  content: "";
  position: absolute;
  left: -6px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 17px;
  border-radius: 3px;
  background: var(--accent);
}
.nav-item.on .nav-label { font-weight: 650; }

.nav-twisty {
  width: 18px; height: 34px;
  flex: none;
  display: grid; place-items: center;
  border: 0;
  background: transparent;
  color: var(--ink-3);
  font-size: 8px;
  cursor: pointer;
  transition: transform .16s;
}
.nav-twisty.open { transform: rotate(90deg); }
.nav-twisty.empty { visibility: hidden; }

.nav-label {
  flex: 1;
  min-width: 0;
  padding: 9px 4px;
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 14px;
  font-weight: 450;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.nav-add {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 9px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-3);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background .12s, color .12s;
}
.nav-add:hover { background: rgba(255, 255, 255, .05); color: var(--ink); }

/* Sempre um pouco visíveis, para as ações serem descobertas. */
.nav-actions { display: flex; gap: 1px; padding-right: 5px; flex: none; opacity: .42; transition: opacity .15s; }
.nav-item:hover .nav-actions, .nav-item.on .nav-actions { opacity: 1; }
.nav-actions .icon-btn:hover { background: rgba(255, 255, 255, .12); color: #fff; }

.nav-children { display: none; }
.nav-children.open { display: block; }

.nav-empty { padding: 10px 14px; color: var(--ink-3); font-size: 12.5px; line-height: 1.5; }

/* =================================================================== conteúdo */

.content { position: relative; flex: 1; min-width: 0; background: #000; }
/* fundo preto: nada de faixa branca aparecendo na borda ou no fim do conteúdo */
.stage { display: block; width: 100%; height: 100%; border: 0; background: #000; }

.empty { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; }
.empty-inner { max-width: 400px; text-align: center; }
.empty-mark {
  width: 58px; height: 58px;
  margin: 0 auto 20px;
  display: grid; place-items: center;
  border: 1px dashed #2e333f;
  border-radius: 16px;
  color: var(--ink-3);
  font-size: 24px;
  font-weight: 300;
}
.empty h2 { margin: 0 0 8px; font-size: 18px; font-weight: 700; letter-spacing: -.01em; }
.empty p { margin: 0 0 24px; color: var(--ink-2); font-size: 13.5px; line-height: 1.65; }

/* botão de menu no celular */
.drawer-btn {
  display: none;
  position: fixed;
  top: 12px; left: 12px;
  z-index: 25;
  width: 38px; height: 38px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(8px);
  color: var(--ink);
  font-size: 15px;
  cursor: pointer;
}

/* botão que traz o cabeçalho de volta */
.restore-btn {
  display: none;
  position: fixed;
  top: 12px; left: 12px;
  z-index: 26;
  width: 36px; height: 36px;
  place-items: center;
  border: 1px solid #2b3040;
  border-radius: 10px;
  background: rgba(12, 14, 19, .82);
  backdrop-filter: blur(8px);
  color: var(--ink-2);
  font-size: 14px;
  cursor: pointer;
  opacity: .45;
  transition: opacity .18s, color .18s;
}
.restore-btn:hover { opacity: 1; color: #fff; }

body.chrome-hidden .topbar,
body.chrome-hidden .sidebar,
body.chrome-hidden .drawer-btn { display: none !important; }
body.chrome-hidden .restore-btn { display: grid; }
body.presenting .restore-btn { display: none !important; }

/* ============================================== visão pública (somente leitura) */

/* O bloco .side-share fica: dentro dele o botão de arquivos continua valendo
   para o cliente. Só o botão de compartilhar sai. */
body.readonly [data-action="settings"],
body.readonly [data-action="profile"],
body.readonly [data-action="layout"],
body.readonly [data-action="add-page"],
body.readonly [data-action="share"],
body.readonly .client-btn { display: none !important; }

/* ====================================================== modo apresentação */

body.presenting .topbar,
body.presenting .sidebar,
body.presenting .drawer-btn { display: none !important; }
body.presenting { background: #000; }

.present-bar {
  display: none;
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 45;
  align-items: center;
  gap: 4px;
  padding: 7px 8px;
  border: 1px solid #2b3040;
  border-radius: 999px;
  background: rgba(12, 14, 19, .92);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow-lg);
  transition: opacity .3s, transform .3s;
}
body.presenting .present-bar { display: flex; }
.present-bar.idle { opacity: 0; transform: translate(-50%, 12px); pointer-events: none; }

.pb-btn {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-2);
  font-size: 18px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.pb-btn:hover { background: var(--surface-3); color: #fff; }
.pb-btn:disabled { opacity: .3; cursor: default; }
.pb-btn:disabled:hover { background: transparent; }

.pb-title {
  max-width: 260px;
  padding: 0 8px;
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pb-sep { width: 1px; height: 20px; margin: 0 4px; background: #2b3040; }

.pb-exit {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 13px;
  border: 0;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.pb-exit:hover { background: #262b36; }
.pb-exit kbd {
  padding: 1px 5px;
  border: 1px solid #333947;
  border-radius: 4px;
  background: #101319;
  color: var(--ink-3);
  font-family: var(--font);
  font-size: 10px;
}

/* ====================================================================== menus */

.menu {
  position: absolute;
  z-index: 40;
  min-width: 232px;
  max-height: min(70vh, 460px);
  overflow-y: auto;
  padding: 6px;
  border: 1px solid #2b3040;
  border-radius: 13px;
  background: rgba(16, 19, 25, .97);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow-lg);
}
.menu.ctx { position: fixed; top: 0; left: 0; min-width: 214px; }

.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  font-weight: 550;
  text-align: left;
  cursor: pointer;
}
.menu-item:hover { background: var(--surface-3); }
.menu-item.on { background: var(--accent-tint); color: #fff; font-weight: 700; }
.menu-item.danger { color: #ff8b84; }
.menu-item.danger:hover { background: color-mix(in srgb, var(--danger) 16%, transparent); }
.menu-item .ic { width: 16px; flex: none; text-align: center; color: var(--ink-3); font-size: 12px; }
.menu-item.danger .ic { color: var(--danger); }
.menu-item .sub { margin-left: auto; color: var(--ink-3); font-size: 11px; font-weight: 500; }
.menu-item.indent { padding-left: 28px; }

.menu-sep { height: 1px; margin: 6px 4px; background: var(--line); }
.menu-label {
  padding: 8px 10px 5px;
  color: var(--ink-3);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}

/* ===================================================================== modais */

.modal-root { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .68); backdrop-filter: blur(3px); }

.modal {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 540px;
  max-height: calc(100vh - 40px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}
.modal.wide { max-width: 1060px; }

.modal-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 14px 16px 22px;
  flex: none;
  border-bottom: 1px solid var(--line-soft);
}
.modal-head h2 { flex: 1; margin: 0; font-size: 15.5px; font-weight: 700; letter-spacing: -.01em; }

.modal-body { flex: 1; padding: 22px; overflow-y: auto; }
.modal-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  flex: none;
  border-top: 1px solid var(--line-soft);
  background: #0b0d12;
}

/* editor de HTML */
.editor-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.editor-grid > div { display: flex; flex-direction: column; min-width: 0; }
.editor-grid .textarea { flex: 1; min-height: 380px; }
.preview-frame {
  flex: 1;
  min-height: 380px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}
.editor-tools { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; min-height: 34px; flex-wrap: wrap; }
.editor-tools .cap { color: var(--ink-3); font-size: 10.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }

.file-drop {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 14px;
  flex: none;
  border: 1px dashed #333947;
  border-radius: var(--radius);
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
.file-drop:hover { border-color: color-mix(in srgb, var(--accent) 60%, transparent); color: var(--ink); background: var(--accent-tint); }
.file-drop input { display: none; }

.logo-row { display: flex; align-items: center; gap: 14px; }
.logo-box {
  display: grid; place-items: center;
  width: 132px; height: 62px;
  flex: none;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--ink-3);
  font-size: 11px;
  overflow: hidden;
}
.logo-box img { max-width: 100%; max-height: 100%; object-fit: contain; }

.color-input {
  width: 46px; height: 38px;
  padding: 3px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  cursor: pointer;
}

.list-manage { display: grid; gap: 6px; }
.list-manage .lm-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 8px 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.list-manage .lm-item .nm { flex: 1; font-size: 13.5px; font-weight: 600; }
.list-manage .lm-item .tag { color: var(--ink-3); font-size: 11px; font-weight: 650; white-space: nowrap; }

/* ============================================== telas de entrada (formulários) */

.gate-form-v { display: grid; gap: 10px; text-align: left; }
.gate-form-v .btn { width: 100%; margin-top: 4px; }
.gate-error {
  margin: 0 0 4px;
  padding: 9px 12px;
  border: 1px solid color-mix(in srgb, var(--danger) 40%, transparent);
  border-radius: 9px;
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  color: #ff8b84;
  font-size: 12.5px;
  text-align: left;
}

/* ==================================================== gerenciador de pastas */

.mgr-list { display: grid; gap: 12px; }

.mgr-card {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
  transition: border-color .15s;
}
.mgr-card.focus { border-color: color-mix(in srgb, var(--accent) 55%, transparent); }

.mgr-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.mgr-name {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 15.5px;
  font-weight: 700;
  letter-spacing: -.01em;
  cursor: pointer;
  text-align: left;
}
.mgr-name:hover { color: color-mix(in srgb, var(--accent) 70%, white); }
.mgr-tags { display: flex; align-items: center; gap: 6px; margin-left: auto; flex-wrap: wrap; }

.pill-tag {
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--ink-2);
  font-size: 10.5px;
  font-weight: 650;
  white-space: nowrap;
}
.pill-tag.on {
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: #fff;
}
.pill-tag.off { color: var(--ink-3); background: transparent; }

.mgr-stats { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.stat {
  flex: 1 1 88px;
  min-width: 84px;
  padding: 10px 12px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: #0c0e13;
}
.stat.wide { flex: 1 1 170px; }
.stat strong {
  display: block;
  color: var(--ink);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1.25;
}
.stat.wide strong { font-size: 13.5px; font-weight: 650; }
.stat span {
  display: block;
  margin-top: 2px;
  color: var(--ink-3);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.stat.hot strong { color: color-mix(in srgb, var(--accent) 75%, white); }

.mgr-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mgr-actions .btn { height: 34px; padding: 0 12px; font-size: 12.5px; }

/* tabela de pessoas */
.mgr-users { display: grid; gap: 4px; }
.mgr-users-head,
.mgr-user {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 130px 76px 132px 108px;
  align-items: center;
  gap: 10px;
}
.mgr-users-head {
  padding: 0 12px 6px;
  color: var(--ink-3);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.mgr-user {
  padding: 9px 12px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: var(--surface-2);
}
.mgr-user.off { opacity: .5; }
.mgr-user .u-name { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13.5px; font-weight: 600; }
.mgr-user .u-name > span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mgr-user .u-login { color: var(--ink-2); font-family: var(--mono); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; }
.mgr-user .u-count { color: var(--ink); font-size: 14px; font-weight: 700; }
.mgr-user .u-when { color: var(--ink-2); font-size: 11.5px; }
.mgr-user .u-acts { display: flex; gap: 2px; justify-content: flex-end; }

.av.sm {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  flex: none;
  border-radius: 50%;
  color: #fff;
  font-size: 9.5px;
  font-weight: 700;
}

/* histórico */
.mgr-hist { display: grid; gap: 2px; max-height: 260px; overflow-y: auto; }
.hist-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  border-radius: 8px;
  background: #0c0e13;
}
.hist-name { flex: 1; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-when { color: var(--ink-2); font-size: 11.5px; font-variant-numeric: tabular-nums; }

@media (max-width: 880px) {
  .mgr-users-head { display: none; }
  .mgr-user { grid-template-columns: 1fr auto; row-gap: 4px; }
  .mgr-user .u-login, .mgr-user .u-when { grid-column: 1 / -1; }
}

/* ====================================================================== toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  z-index: 70;
  max-width: 92vw;
  padding: 11px 18px;
  border: 1px solid #2b3040;
  border-radius: 999px;
  background: rgba(16, 19, 25, .96);
  backdrop-filter: blur(12px);
  color: var(--ink);
  font-size: 13px;
  font-weight: 550;
  box-shadow: var(--shadow-lg);
  animation: toast-in .2s ease-out;
}
.toast.err { border-color: color-mix(in srgb, var(--danger) 45%, transparent); color: #ff8b84; }
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* ===================================================================== mobile */

@media (max-width: 880px) {
  .brand-logo { max-width: 130px; max-height: 26px; }
  .brand-title { max-width: 110px; }
  .editor-grid { grid-template-columns: 1fr; }
  .editor-grid .textarea, .preview-frame { min-height: 220px; }
  .modal-body { padding: 18px; }
  .logo-row { flex-direction: column; align-items: stretch; }

  body[data-layout="vertical"] .drawer-btn { display: grid; }
  body[data-layout="vertical"] .content { padding-top: 0; }

  body[data-layout="vertical"] .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 30;
    width: min(300px, 86vw);
    box-shadow: var(--shadow-lg);
    transform: translateX(-100%);
    transition: transform .22s ease;
  }
  body[data-layout="vertical"] .sidebar.open { transform: none; }

  body[data-layout="horizontal"] .topbar { gap: 6px; padding: 0 8px; }
  body[data-layout="horizontal"] .sep-v { display: none; }
  body[data-layout="horizontal"] .client-btn { max-width: 120px; }
  body[data-layout="horizontal"] .chip span:last-child { display: none; }
  body[data-layout="horizontal"] .chip { padding: 0 4px; }
}
