/* Design system N4 Growth · Violeta e Lime (Blueprint 02, Identidade visual)
   Regras: Violeta marca o ativo/selecionado. Lime só em números, metas e botões principais.
   Nunca texto branco sobre lime. */

/* Tema: escuro é o padrão; o claro troca só os tokens (data-theme no <html>). */
:root {
  color-scheme: dark;
  --n4-black: #000000;
  --n4-surface: #111111;
  --n4-surface-2: #161616;
  --n4-surface-3: #1a1a1a;
  --n4-sidebar: #0a0a0a;
  --n4-violet: #7e3bed;
  --n4-violet-soft: rgba(126, 59, 237, 0.28);
  --n4-lime: #c6ff34;
  --n4-white: #ffffff;
  --n4-text: #ffffff;
  --n4-text-2: #d4d4d4;
  --n4-text-muted: #a3a3a3;
  --n4-text-faint: #8a8a8a;
  --n4-locked: #737373;
  --n4-border: rgba(255, 255, 255, 0.08);
  --n4-border-strong: rgba(255, 255, 255, 0.16);
  /* Tokens semânticos (o tema claro redefine estes; mesmos nomes do Flow) */
  --n4-bg: #000000;
  --n4-fg: #ffffff;              /* texto forte */
  --n4-on-violet: #ffffff;       /* texto sobre violeta */
  --n4-accent: #c6ff34;          /* números, metas e links (lime no escuro) */
  --n4-accent-hover: #d8ff73;
  --n4-lime-line: #c6ff34;       /* bordas e contornos lime */
  --n4-lime-fill: #c6ff34;       /* barras e pontos lime, sem texto */
  --n4-danger: #ff8a8a;
  --n4-warn: #ffd27a;
  --n4-hover: rgba(255, 255, 255, 0.06);
  --n4-tint: rgba(255, 255, 255, 0.03);
  --n4-line-soft: rgba(255, 255, 255, 0.06);
  --n4-line-mid: rgba(255, 255, 255, 0.25);
  --n4-line-heavy: rgba(255, 255, 255, 0.6);
  --n4-dim: #5c5c5c;
  --n4-col-bg: #0d0d0d;
  --n4-chip-bg: #242424;
  --n4-av-bg: #2a2a2a;
  --n4-track: #1a1a1a;
  --n4-inverse-bg: #ffffff;
  --n4-inverse-fg: #000000;
  --n4-radius: 10px;
  --n4-radius-lg: 14px;
  --n4-font: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--n4-bg);
  color: var(--n4-text);
  font-family: var(--n4-font);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--n4-accent); }
a:hover { color: var(--n4-accent-hover); }
:focus-visible { outline: 2px solid var(--n4-violet); outline-offset: 2px; }

.wm { font-stretch: 125%; font-weight: 800; text-transform: uppercase; letter-spacing: 0.02em; line-height: 1; }
.muted { color: var(--n4-text-muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Botões e campos ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: var(--n4-radius);
  font: inherit; font-size: 14px; font-weight: 600; text-decoration: none; cursor: pointer;
  border: 1px solid transparent;
}
.btn-primary { background: var(--n4-lime); color: #000; font-weight: 700; }
.btn-primary:hover { filter: brightness(1.06); color: #000; }
.btn-ghost { background: transparent; color: var(--n4-fg); border-color: var(--n4-line-mid); }
.btn-ghost:hover { background: var(--n4-line-soft); color: var(--n4-fg); }
.btn-danger { background: transparent; color: var(--n4-fg); border-color: var(--n4-line-mid); }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 13px; }

.field { display: flex; flex-direction: column; gap: 8px; }
.field label { font-size: 14px; font-weight: 600; }
.input, .select {
  height: 46px; padding: 0 14px; border-radius: var(--n4-radius);
  border: 1px solid var(--n4-border-strong); background: var(--n4-surface); color: var(--n4-fg);
  font: inherit; font-size: 15px; width: 100%;
}
.select-sm { height: 38px; font-size: 14px; padding: 0 10px; width: auto; }

/* ---------- Estrutura do app (Blueprint 03: 4 regiões) ---------- */
.app { display: flex; min-height: 100vh; }
.sidenav {
  width: 220px; flex: 0 0 220px; background: var(--n4-sidebar); border-right: 1px solid var(--n4-border);
  padding: 20px 12px; display: flex; flex-direction: column; gap: 2px;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 6px 10px 22px; text-decoration: none; color: var(--n4-fg); }
.brand img { height: 22px; width: auto; display: block; }
.brand .divider { width: 1px; height: 22px; background: var(--n4-line-mid); }
.nav { display: flex; align-items: center; justify-content: space-between; text-decoration: none; color: var(--n4-text-2);
       padding: 10px 12px; border-radius: 8px; font-size: 14px; min-height: 40px; }
.nav:hover { background: var(--n4-line-soft); color: var(--n4-fg); }
.nav[aria-current="page"] { background: var(--n4-violet); color: var(--n4-on-violet); font-weight: 600; }
.nav.locked { color: var(--n4-locked); }
.nav-group { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--n4-dim); padding: 16px 12px 6px; }
.nav-footer { margin-top: auto; border-top: 1px solid var(--n4-border); padding-top: 12px; }

.main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
          padding: 12px 28px; border-bottom: 1px solid var(--n4-border); }
.crumbs { font-size: 14px; color: var(--n4-text-muted); }
.crumbs a { color: var(--n4-text-muted); text-decoration: none; }
.crumbs .sep { color: var(--n4-dim); margin: 0 4px; }
.crumbs strong { color: var(--n4-fg); font-weight: 600; }
.topbar-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.org-switch { display: flex; align-items: center; gap: 8px; }
.org-switch label { font-size: 13px; color: var(--n4-text-muted); }
.user-chip { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.avatar { width: 32px; height: 32px; border-radius: 8px; background: var(--n4-violet); display: inline-flex;
          align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: var(--n4-on-violet); }

.content { padding: 24px 28px 48px; display: flex; flex-direction: column; gap: 18px; }
.page-title { margin: 0; font-size: 28px; font-weight: 800; }

/* ---------- Seletor de produtos (Blueprint 02) ---------- */
.rail { width: 92px; flex: 0 0 92px; background: var(--n4-sidebar); border-left: 1px solid var(--n4-border);
        padding: 18px 10px; display: flex; flex-direction: column; gap: 8px; }
.rail-home { align-self: center; width: 52px; height: 44px; display: flex; align-items: center; justify-content: center; margin-bottom: 14px; }
.rail-home img { height: 26px; width: auto; }
.rail-item { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px;
             padding: 12px 4px; border-radius: 12px; text-decoration: none; color: var(--n4-fg);
             border: 0; background: transparent; font: inherit; font-size: 12px; font-weight: 600; }
a.rail-item:hover { background: rgba(126, 59, 237, 0.2); color: var(--n4-fg); }
.rail-item.is-current { background: var(--n4-violet); font-weight: 700; color: var(--n4-on-violet); }
.rail-item.is-current::after { content: ""; position: absolute; right: -10px; top: 14px; bottom: 14px; width: 3px;
                               border-radius: 3px; background: var(--n4-lime-fill); }
.rail-item.is-off { opacity: 0.35; cursor: not-allowed; color: var(--n4-text-muted); }
.rail-item svg { width: 26px; height: 26px; }

/* ---------- Cartões, tabelas, avisos ---------- */
.card { background: var(--n4-surface); border: 1px solid var(--n4-border); border-radius: var(--n4-radius-lg); padding: 20px; }
.notice { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; padding: 14px 18px;
          border-radius: 12px; background: var(--n4-surface); border: 1px solid var(--n4-line-mid); }
.notice strong { font-weight: 700; }
.flash { padding: 12px 16px; border-radius: 10px; font-size: 14px; border: 1px solid var(--n4-border-strong); background: var(--n4-surface); }
.flash.success { border-color: var(--n4-violet); }
.flash.error { border-color: var(--n4-line-heavy); }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--n4-text-muted); text-transform: uppercase;
            letter-spacing: 0.06em; padding: 10px 12px; border-bottom: 1px solid var(--n4-border); }
.table td { padding: 12px; border-bottom: 1px solid var(--n4-border); vertical-align: middle; }
.chip { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--n4-chip-bg); color: var(--n4-text-2); }
.chip-violet { background: var(--n4-violet); color: var(--n4-on-violet); }
.chip-off { background: transparent; border: 1px solid var(--n4-border-strong); color: var(--n4-text-muted); }
.inline-form { display: inline-flex; align-items: center; gap: 6px; margin: 0; }

.grid-form { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; align-items: end; }

.empty { text-align: center; padding: 56px 24px; }
.empty h2 { margin: 0 0 8px; font-size: 22px; font-weight: 800; }
.empty p { margin: 0 auto; max-width: 520px; color: var(--n4-text-2); }

/* ---------- Tela de login ---------- */
.login { display: flex; flex-wrap: wrap; min-height: 100vh; }
.login-side { flex: 1 1 560px; min-width: 0; background: var(--n4-violet); padding: 56px; display: flex; flex-direction: column; justify-content: space-between; gap: 40px; color: var(--n4-on-violet); }
.login-side h1 { margin: 0 0 18px; font-size: 48px; line-height: 1.04; font-weight: 800; letter-spacing: -0.02em; max-width: 540px; }
.login-side p { margin: 0; font-size: 18px; font-weight: 500; max-width: 480px; }
.login-tagline { font-size: 20px; font-weight: 700; color: var(--n4-accent); }
.login-form-wrap { flex: 1 1 480px; min-width: 0; display: flex; align-items: center; justify-content: center; padding: 48px 24px; }
.login-form { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 20px; }
.form-error { padding: 12px 14px; border-radius: 10px; border: 1px solid var(--n4-line-heavy); font-size: 14px; }


/* ---------- Pipeline (Kanban agrupado pelas 4 etapas) ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.page-head-left { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.board-scroll { overflow-x: auto; padding-bottom: 12px; }
.board { display: flex; gap: 16px; align-items: flex-start; width: max-content; }
.step { display: flex; flex-direction: column; gap: 10px; }
.step-head { border-top: 3px solid var(--n4-violet); padding-top: 10px; display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; font-weight: 700; }
.step-head .num { color: var(--n4-text-muted); margin-right: 4px; }
.step-cols { display: flex; gap: 10px; }
.col { width: 248px; flex: 0 0 248px; background: var(--n4-col-bg); border: 1px solid var(--n4-line-soft); border-radius: 12px;
       padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.colh { display: flex; justify-content: space-between; align-items: center; padding: 4px 4px 6px; font-size: 13px; font-weight: 600; gap: 6px; }
.colh .req { font-size: 11px; font-weight: 600; color: var(--n4-text-muted); }
.col-cards { display: flex; flex-direction: column; gap: 8px; min-height: 60px; }
.kc { display: block; text-decoration: none; color: var(--n4-fg); background: var(--n4-surface-2); border: 1px solid var(--n4-border);
      border-radius: 10px; padding: 12px; cursor: grab; transition: border-color .15s ease; }
.kc:hover { border-color: var(--n4-violet); color: var(--n4-fg); }
.kc.is-won { border-color: rgba(198, 255, 52, 0.35); }
.kc-top { display: flex; justify-content: space-between; gap: 8px; }
.kc-name { font-size: 14px; font-weight: 700; }
.kc-value { font-size: 13px; font-weight: 700; color: var(--n4-accent); white-space: nowrap; }
.kc-meta { font-size: 12px; color: var(--n4-text-muted); margin: 4px 0 10px; }
.kc-meta.is-stale { color: var(--n4-fg); }
.kc-foot { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.av { width: 24px; height: 24px; border-radius: 6px; background: var(--n4-av-bg); display: inline-flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; color: var(--n4-fg); }
.av.is-me { background: var(--n4-violet); color: var(--n4-on-violet); }
.sortable-ghost { opacity: 0.35; }
.sortable-drag { cursor: grabbing; }
.lost-lane { display: flex; flex-direction: column; gap: 6px; padding-left: 14px; margin-left: 4px; border-left: 1px dashed var(--n4-border-strong); }
.lost-head { display: flex; justify-content: space-between; font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--n4-text-muted); padding: 0 4px; }
.col-lost { width: 210px; flex: 0 0 210px; background: var(--n4-sidebar); border-style: dashed; }
.col-lost .colh { color: var(--n4-text-muted); }
.kc.is-lost { background: #121212; color: var(--n4-text-2); }
.kc.is-lost .kc-value { color: var(--n4-text-muted); }
.col-empty { font-size: 12px; color: var(--n4-dim); text-align: center; padding: 12px 4px; }
.hint { margin: 0; font-size: 13px; color: var(--n4-text-faint); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50; max-width: min(560px, calc(100vw - 32px));
         background: var(--n4-surface); border: 1px solid var(--n4-line-heavy); border-radius: 12px; padding: 12px 16px; font-size: 14px; }

/* ---------- Diálogos ---------- */
dialog.modal { background: var(--n4-surface); color: var(--n4-fg); border: 1px solid var(--n4-border-strong); border-radius: 16px;
               padding: 24px; width: min(560px, calc(100vw - 32px)); }
dialog.modal::backdrop { background: rgba(0, 0, 0, 0.7); }
.modal h2 { margin: 0 0 6px; font-size: 20px; font-weight: 800; }
.modal-form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 16px; }
.modal-form .full { grid-column: 1 / -1; }
.modal-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.textarea { min-height: 84px; padding: 12px 14px; border-radius: var(--n4-radius); border: 1px solid var(--n4-border-strong);
            background: var(--n4-surface); color: var(--n4-fg); font: inherit; font-size: 15px; width: 100%; resize: vertical; }

/* ---------- Lead 360° ---------- */
.lead-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 16px; }
.lead-id { display: flex; align-items: center; gap: 16px; }
.lead-av { width: 56px; height: 56px; border-radius: 14px; background: var(--n4-violet); display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 800; color: var(--n4-on-violet); }
.lead-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip-white { background: var(--n4-inverse-bg); color: var(--n4-inverse-fg); }
.steps-bar { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.steps-bar li { padding: 10px 12px; border-radius: 8px; background: var(--n4-surface-2); color: var(--n4-text-faint); font-size: 13px; }
.steps-bar li.done { background: var(--n4-violet-soft); color: var(--n4-fg); }
.steps-bar li[aria-current="step"] { background: var(--n4-violet); color: var(--n4-on-violet); font-weight: 700; }
.lead-cols { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr) minmax(0, 320px); gap: 16px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.card h2 { margin: 0 0 12px; font-size: 15px; font-weight: 700; }
.lbl { font-size: 12px; color: var(--n4-text-muted); margin-bottom: 2px; }
.val { font-size: 14px; }
.lead-form { display: flex; flex-direction: column; gap: 12px; }
.lead-form .input { height: 40px; font-size: 14px; }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; min-height: 44px; }
.check input { width: 20px; height: 20px; accent-color: var(--n4-violet); }
.lock-note { font-size: 11px; color: var(--n4-text-faint); }
.fchips { display: flex; flex-wrap: wrap; gap: 6px; }
.fchip { font-size: 12px; padding: 6px 10px; border-radius: 999px; border: 1px solid var(--n4-border-strong); color: var(--n4-text-2); text-decoration: none; }
.fchip[aria-current="true"] { background: var(--n4-inverse-bg); color: var(--n4-inverse-fg); border-color: var(--n4-fg); font-weight: 600; }
.ev { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--n4-border); }
.ev:first-child { border-top: 0; }
.ev .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--n4-dim); margin-top: 7px; flex: 0 0 8px; }
.ev .dot.violet { background: var(--n4-violet); color: var(--n4-on-violet); }
.ev .dot.white { background: var(--n4-inverse-bg); }
.ev .dot.lime { background: var(--n4-lime-fill); }
.ev-title { font-size: 14px; font-weight: 600; }
.ev-body { font-size: 14px; color: var(--n4-text-2); margin-top: 4px; line-height: 1.5; white-space: pre-wrap; }
.ev-meta { font-size: 12px; color: var(--n4-text-muted); margin-top: 3px; }
.row-between { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.opp-row { display: flex; justify-content: space-between; align-items: baseline; padding: 10px 0; border-top: 1px solid var(--n4-border); gap: 10px; }
.opp-row:first-of-type { border-top: 0; }
.big-number { font-size: 16px; font-weight: 800; color: var(--n4-accent); }
.dup-banner { border-color: var(--n4-line-mid); }

/* ---------- Configurações ---------- */
.tabs { display: flex; flex-wrap: wrap; gap: 6px; border-bottom: 1px solid var(--n4-border); padding-bottom: 10px; }
.tab { padding: 8px 14px; border-radius: 8px; color: var(--n4-text-2); text-decoration: none; font-size: 14px; min-height: 40px; display: inline-flex; align-items: center; }
.tab:hover { background: var(--n4-line-soft); color: var(--n4-fg); }
.tab[aria-current="page"] { background: var(--n4-violet); color: var(--n4-on-violet); font-weight: 600; }
.stage-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 0; border-top: 1px solid var(--n4-border); }
.stage-row:first-child { border-top: 0; }
.stage-row .input { height: 40px; font-size: 14px; flex: 1 1 200px; width: auto; }
.icon-btn { min-width: 40px; min-height: 40px; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px;
            border: 1px solid var(--n4-border-strong); background: transparent; color: var(--n4-fg); cursor: pointer; font: inherit; }
.icon-btn:disabled { opacity: 0.3; cursor: default; }
.steps-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.product-checks { display: flex; flex-wrap: wrap; gap: 4px 18px; }

@media (max-width: 1250px) {
  .lead-cols { grid-template-columns: minmax(0, 300px) minmax(0, 1fr); }
  .lead-cols > .stack:last-child { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
}
@media (max-width: 900px) {
  .lead-cols { grid-template-columns: 1fr; }
  .steps-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .steps-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .modal-form { grid-template-columns: 1fr; }
}

/* ---------- Conversas ---------- */
.content.is-inbox { padding: 0; gap: 0; height: calc(100vh - 63px); min-height: 520px; }
.content.is-inbox > .flash, .content.is-inbox > .notice { margin: 12px 20px 0; }
.inbox { flex: 1; min-height: 0; display: flex; }
.clist { width: 310px; flex: 0 0 310px; border-right: 1px solid var(--n4-border); display: flex; flex-direction: column; min-height: 0; }
.clist-top { padding: 14px 16px 10px; display: flex; flex-direction: column; gap: 10px; }
.wa-status { font-size: 12px; color: var(--n4-text-muted); display: flex; align-items: center; gap: 6px; }
.wa-status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--n4-dim); }
.wa-status.ok .dot { background: var(--n4-lime-fill); }
.ctabs { display: flex; flex-wrap: wrap; gap: 2px; padding: 0 12px 10px; border-bottom: 1px solid var(--n4-border); }
.ctab { color: var(--n4-text-muted); text-decoration: none; font-size: 13px; padding: 8px 10px; border-radius: 7px; white-space: nowrap; min-height: 36px; display: inline-flex; align-items: center; }
.ctab:hover { color: var(--n4-fg); }
.ctab[aria-current="page"] { background: var(--n4-violet); color: var(--n4-on-violet); font-weight: 600; }
.citems { flex: 1; overflow-y: auto; }
.ci { display: block; text-decoration: none; color: var(--n4-fg); padding: 14px 16px; border-bottom: 1px solid var(--n4-line-soft); }
.ci:hover { background: var(--n4-surface); color: var(--n4-fg); }
.ci[aria-current="true"] { background: var(--n4-surface-2); box-shadow: inset 3px 0 0 var(--n4-violet); }
.ci-top { display: flex; justify-content: space-between; gap: 8px; }
.ci-name { font-size: 14px; font-weight: 700; }
.ci-time { font-size: 12px; color: var(--n4-text-muted); }
.ci-preview { font-size: 13px; color: var(--n4-text-2); margin: 4px 0 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip-soft { background: var(--n4-violet-soft); color: var(--n4-fg); }
.thread { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; min-height: 0; }
.thread-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 20px; border-bottom: 1px solid var(--n4-border); }
.thread-msgs { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 10px; }
.bubble { max-width: 72%; padding: 10px 14px; font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; }
.bubble .txt { display: block; white-space: pre-wrap; }
.bubble .kind { display: block; font-weight: 600; }
.bubble.in { align-self: flex-start; background: var(--n4-surface-3); border-radius: 14px 14px 14px 4px; }
.bubble.out { align-self: flex-end; background: var(--n4-violet-soft); border: 1px solid rgba(126, 59, 237, 0.6); border-radius: 14px 14px 4px 14px; }
.bubble.out.is-failed { border-color: var(--n4-line-heavy); }
.bubble .who { display: block; font-size: 11px; font-weight: 700; margin-bottom: 2px; }
.bubble .meta { display: block; font-size: 11px; color: var(--n4-text-muted); margin-top: 4px; white-space: normal; }
.bubble.out .meta { color: var(--n4-text-2); }
.bubble a { color: var(--n4-accent); }
.sys-note { align-self: center; font-size: 12px; color: var(--n4-text-muted); background: var(--n4-surface); border-radius: 999px; padding: 6px 12px; text-align: center; }
.composer { border-top: 1px solid var(--n4-border); padding: 14px 20px; }
.composer-take { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; background: var(--n4-surface); border-radius: 12px; padding: 14px 16px; }
.composer-row { display: flex; gap: 10px; align-items: flex-end; }
.composer-row textarea { flex: 1; min-width: 0; min-height: 46px; max-height: 160px; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--n4-border-strong); background: var(--n4-surface); color: var(--n4-fg); font: inherit; font-size: 14px; resize: vertical; }
.leadpanel { width: 290px; flex: 0 0 290px; border-left: 1px solid var(--n4-border); padding: 18px; display: flex; flex-direction: column; gap: 16px; overflow-y: auto; }
.inbox-empty { flex: 1; display: flex; align-items: center; justify-content: center; text-align: center; padding: 40px; color: var(--n4-text-2); }
.back-link { display: none; }
@media (max-width: 1100px) { .leadpanel { display: none; } }
@media (max-width: 760px) {
  .content.is-inbox { height: calc(100vh - 110px); }
  .clist { width: 100%; flex-basis: 100%; border-right: 0; }
  .inbox.has-thread .clist { display: none; }
  .inbox:not(.has-thread) .thread { display: none; }
  .back-link { display: inline-flex; }
  .bubble { max-width: 88%; }
}

/* ---------- Responsivo ---------- */
@media (max-width: 1100px) {
  .sidenav { display: none; }
  .grid-form { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .rail { display: none; }
  .grid-form { grid-template-columns: 1fr; }
  .login-side { display: none; }
  .content, .topbar { padding-left: 16px; padding-right: 16px; }
}


/* ---------- Tema claro (mesma paleta do Flow, módulo 6.1) ---------- */
:root[data-theme="light"] {
  color-scheme: light;
  --n4-bg: #f7f7f8;
  --n4-black: #f7f7f8;
  --n4-surface: #ffffff;
  --n4-surface-2: #f3f3f5;
  --n4-surface-3: #ececef;
  --n4-sidebar: #ffffff;
  --n4-violet-soft: rgba(126, 59, 237, 0.12);
  --n4-fg: #111111;
  --n4-text: #111111;
  --n4-text-2: #3f3f46;
  --n4-text-muted: #5f5f6b;
  --n4-text-faint: #6b6b76;
  --n4-locked: #8a8a94;
  --n4-accent: #5b21b6;
  --n4-accent-hover: #4c1d95;
  --n4-lime-line: #65a30d;
  --n4-lime-fill: #65a30d;
  --n4-danger: #b91c1c;
  --n4-warn: #a16207;
  --n4-border: rgba(17, 17, 17, 0.09);
  --n4-border-strong: rgba(17, 17, 17, 0.16);
  --n4-hover: rgba(17, 17, 17, 0.05);
  --n4-tint: rgba(17, 17, 17, 0.03);
  --n4-line-soft: rgba(17, 17, 17, 0.06);
  --n4-line-mid: rgba(17, 17, 17, 0.22);
  --n4-line-heavy: rgba(17, 17, 17, 0.55);
  --n4-dim: #8a8a94;
  --n4-col-bg: #efeff2;
  --n4-chip-bg: #ececef;
  --n4-av-bg: #e4e4e8;
  --n4-track: #ececef;
  --n4-inverse-bg: #111111;
  --n4-inverse-fg: #ffffff;
}
:root[data-theme="light"] .n4-logo { filter: invert(1); }

/* Menu de tema no cabeçalho (igual ao Flow) */
.theme-menu { position: relative; }
.theme-menu > summary { list-style: none; cursor: pointer; min-width: 44px; min-height: 44px; color: var(--n4-text-2); }
.theme-menu > summary::-webkit-details-marker { display: none; }
.theme-menu > summary:hover, .theme-menu[open] > summary { background: var(--n4-hover); color: var(--n4-fg); }
.theme-form { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; width: 290px; margin: 0; padding: 8px;
              background: var(--n4-surface); border: 1px solid var(--n4-border-strong); border-radius: 12px;
              box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28); display: flex; flex-direction: column; gap: 2px; }
.theme-menu-title { margin: 4px 8px 6px; font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--n4-text-muted); }
.theme-opt { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 0 10px; border: 0; border-radius: 8px;
             background: transparent; color: var(--n4-fg); font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
.theme-opt:hover { background: var(--n4-hover); }
.theme-opt[aria-pressed="true"] { background: var(--n4-violet); color: var(--n4-on-violet); font-weight: 600; }
.theme-opt[aria-pressed="true"] .muted { color: inherit; opacity: 0.8; }
