/* =====================================================================
   Painel BRCOM - design system
   Temas por data-theme no <html>: claro (padrao), escuro, carmesim, cyber.
   Toda cor vem dos tokens abaixo; componentes nunca usam cor fixa.
   ===================================================================== */

:root,
:root[data-theme="claro"] {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --border: #e3e6eb;
  --border-strong: #cdd2da;
  --text: #111827;
  --text-2: #4b5563;
  --muted: #8a93a3;
  --accent: #1f4fd1;
  --accent-text: #ffffff;
  --ok: #138a52;
  --warn: #b26a00;
  --danger: #c62839;
  --info: #1f6fd1;
  --neutral: #6b7280;
  --cat-empresa: #c62839;
  --cat-cliente: #1f6fd1;
  --cat-sem: #b9bec7;
  /* Evolucao do pipeline (Visao geral): validadas p/ daltonismo neste tema */
  --pipe-penit: #1f8fd1; --pipe-patio: #c98500; --pipe-corredor: #5b3fb8; --pipe-negat: #c62839;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .14);
  --overlay: rgba(17, 24, 39, .35);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-num: "Inter", system-ui, sans-serif;
  --radius: 10px;
  --radius-sm: 7px;
  color-scheme: light;
}

:root[data-theme="escuro"] {
  --bg: #0c0e12;
  --surface: #13161c;
  --surface-2: #1a1e26;
  --border: #252a34;
  --border-strong: #343b48;
  --text: #e7e9ee;
  --text-2: #b4bac6;
  --muted: #7d8595;
  --accent: #6d9cff;
  --accent-text: #0c0e12;
  --ok: #3ecf8e;
  --warn: #f0b44c;
  --danger: #ff6b7a;
  --info: #6d9cff;
  --neutral: #8b93a3;
  --cat-empresa: #ff6b7a;
  --cat-cliente: #6d9cff;
  --cat-sem: #4b515c;
  --pipe-penit: #3093db; --pipe-patio: #c38300; --pipe-corredor: #794db6; --pipe-negat: #cf4047;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, .55);
  --overlay: rgba(0, 0, 0, .55);
  color-scheme: dark;
}

:root[data-theme="carmesim"] {
  --bg: #120a0c;
  --surface: #1b0f13;
  --surface-2: #241419;
  --border: #3a1d24;
  --border-strong: #522832;
  --text: #f4e8ea;
  --text-2: #d2b7bc;
  --muted: #a07f86;
  --accent: #e0284a;
  --accent-text: #ffffff;
  --ok: #4fc98b;
  --warn: #f2a65a;
  --danger: #ff5c74;
  --info: #f08da0;
  --neutral: #a8878d;
  --cat-empresa: #ff5c74;
  --cat-cliente: #7fa8ff;
  --cat-sem: #5a4a4e;
  --pipe-penit: #3093db; --pipe-patio: #c38300; --pipe-corredor: #794db6; --pipe-negat: #cf4047;
  --shadow: 0 1px 2px rgba(0, 0, 0, .45);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, .6);
  --overlay: rgba(10, 2, 4, .6);
  color-scheme: dark;
}

:root[data-theme="cyber"] {
  --bg: #040806;
  --surface: #08100b;
  --surface-2: #0c1811;
  --border: #12301f;
  --border-strong: #1d4a31;
  --text: #c9f7d9;
  --text-2: #8fd9aa;
  --muted: #4f8f69;
  --accent: #00ff88;
  --accent-text: #021208;
  --ok: #00ff88;
  --warn: #f5e400;
  --danger: #ff3864;
  --info: #00e5ff;
  --neutral: #5f9f78;
  --cat-empresa: #ff3864;
  --cat-cliente: #00c8e0;
  --cat-sem: #2f4a3a;
  --pipe-penit: #3093db; --pipe-patio: #c38300; --pipe-corredor: #794db6; --pipe-negat: #cf4047;
  --shadow: 0 0 0 1px rgba(0, 255, 136, .04);
  --shadow-lg: 0 0 0 1px rgba(0, 255, 136, .12), 0 18px 48px rgba(0, 0, 0, .7);
  --overlay: rgba(0, 6, 3, .7);
  --font: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --font-num: "JetBrains Mono", ui-monospace, monospace;
  --radius: 4px;
  --radius-sm: 3px;
  color-scheme: dark;
}

/* --------------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.text-2 { color: var(--text-2); }
.hidden { display: none !important; }
::selection { background: color-mix(in srgb, var(--accent) 30%, transparent); }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; border: 2px solid transparent; background-clip: padding-box; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ------------------------------------------------------------------ shell */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 18px 12px 14px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 18px; }
.brand-mark {
  width: 30px; height: 30px; border-radius: var(--radius-sm);
  display: grid; place-items: center;
  background: var(--accent); color: var(--accent-text);
  font-weight: 700; font-size: 13px; letter-spacing: .02em;
}
.brand-name { font-weight: 600; font-size: 14px; line-height: 1.2; }
.brand-sub { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.nav { flex: 1; overflow-y: auto; }
.nav-group { margin-bottom: 18px; }
.nav-label {
  font-size: 10.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); padding: 0 10px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: var(--radius-sm);
  color: var(--text-2); font-weight: 500;
}
.nav-item svg { width: 16px; height: 16px; flex: none; opacity: .85; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.ativo { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); }
.nav-item .contador {
  margin-left: auto; font-size: 11px; font-weight: 600;
  padding: 0 7px; border-radius: 99px; line-height: 18px;
  background: var(--surface-2); color: var(--text-2);
}
.nav-item.ativo .contador { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }

.sidebar-foot { border-top: 1px solid var(--border); padding-top: 12px; display: grid; gap: 10px; }
.user-card { display: flex; align-items: center; gap: 10px; padding: 0 6px; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--border);
  font-size: 12px; font-weight: 600; color: var(--text-2);
}
.user-name { font-weight: 600; font-size: 13px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11.5px; color: var(--muted); }
.theme-row { display: flex; gap: 6px; padding: 0 6px; }
.theme-dot {
  width: 22px; height: 22px; border-radius: 50%; cursor: pointer;
  border: 2px solid var(--border); padding: 0;
}
.theme-dot[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); }
.theme-dot[data-tema="claro"] { background: linear-gradient(135deg, #ffffff 50%, #1f4fd1 50%); }
.theme-dot[data-tema="escuro"] { background: linear-gradient(135deg, #13161c 50%, #6d9cff 50%); }
.theme-dot[data-tema="carmesim"] { background: linear-gradient(135deg, #1b0f13 50%, #e0284a 50%); }
.theme-dot[data-tema="cyber"] { background: linear-gradient(135deg, #08100b 50%, #00ff88 50%); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 22px 32px 18px;
}
.topbar h1 { font-size: 20px; font-weight: 600; letter-spacing: -.01em; }
.topbar .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.topbar-acoes { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.content { padding: 0 32px 40px; }
.btn.menu-btn { display: none; }

/* ----------------------------------------------------------- componentes */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-pad { padding: 18px 20px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-title { font-size: 13.5px; font-weight: 600; }
.card-sub { font-size: 12.5px; color: var(--muted); }

.grid { display: grid; gap: 16px; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.kpi { padding: 16px 18px; }
.kpi-label { font-size: 12px; color: var(--muted); font-weight: 500; }
.kpi-valor { font-size: 24px; font-weight: 600; margin-top: 4px; letter-spacing: -.01em; }
.kpi-nota { font-size: 12px; color: var(--muted); margin-top: 2px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 34px; padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text);
  font-weight: 500; font-size: 13px; cursor: pointer; white-space: nowrap;
  transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn svg { width: 15px; height: 15px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, var(--text)); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn .badge-num {
  font-size: 11px; font-weight: 600; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 99px; display: inline-grid; place-items: center;
  background: var(--accent); color: var(--accent-text);
}

.input, .select, .textarea {
  width: 100%; height: 34px; padding: 0 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text);
  font-size: 13px;
}
.textarea { height: auto; min-height: 110px; padding: 9px 11px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.input::placeholder, .textarea::placeholder { color: var(--muted); }
.search { position: relative; }
.search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--muted); }
.search .input { padding-left: 32px; }
.field { display: grid; gap: 6px; }
.field > label, .field-label { font-size: 12px; font-weight: 600; color: var(--text-2); }
.field-hint { font-size: 12px; color: var(--muted); }
.form-grid { display: grid; gap: 14px; }
.form-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  height: 28px; padding: 0 11px; border-radius: 99px; cursor: pointer;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2);
  font-size: 12.5px; font-weight: 500;
}
.chip:hover { color: var(--text); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.chip-ativo {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 6px 0 10px; border-radius: 99px;
  background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent);
  font-size: 12px; font-weight: 500;
}
.chip-ativo button { border: 0; background: transparent; color: inherit; cursor: pointer; padding: 0 2px; font-size: 14px; line-height: 1; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 8px; border-radius: 99px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
  --c: var(--neutral);
  color: var(--c);
  background: color-mix(in srgb, var(--c) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--c) 25%, transparent);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--c); }
.badge.ok { --c: var(--ok); }
.badge.warn { --c: var(--warn); }
.badge.danger { --c: var(--danger); }
.badge.info { --c: var(--info); }
.badge.accent { --c: var(--accent); }
.badge.plain::before { display: none; }

.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar .search { width: 300px; max-width: 100%; }
.toolbar .spacer { flex: 1; }
.filtros-ativos { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.contagem { font-size: 12.5px; color: var(--muted); }

/* tabela */
.table-wrap { overflow-x: auto; }
table.tabela { width: 100%; border-collapse: collapse; font-size: 13px; }
.tabela th {
  text-align: left; font-size: 11.5px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .05em;
  padding: 10px 14px; border-bottom: 1px solid var(--border);
  background: var(--surface); position: sticky; top: 0; white-space: nowrap;
}
.tabela th.ordenavel { cursor: pointer; user-select: none; }
.tabela th.ordenavel:hover { color: var(--text); }
.tabela td { padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tabela tbody tr:last-child td { border-bottom: 0; }
.tabela tbody tr.clicavel { cursor: pointer; }
.tabela tbody tr.clicavel:hover td { background: var(--surface-2); }
.tabela tr.apagado td { opacity: .5; }
.tabela .direita { text-align: right; }
.cell-main { font-weight: 500; }
.cell-sub { font-size: 12px; color: var(--muted); }
.vazio { padding: 48px 16px; text-align: center; color: var(--muted); font-size: 13px; }

/* listas */
.lista { list-style: none; margin: 0; padding: 0; }
.lista li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.lista li:last-child { border-bottom: 0; }

/* funil */
.funil { display: grid; gap: 12px; }
.funil-linha { display: grid; gap: 6px; }
.funil-topo { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--text-2); }
.barra { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.barra > span { display: block; height: 100%; border-radius: 99px; background: var(--c, var(--accent)); }

/* kanban */
/* Colunas em flex: cada uma tem largura propria (--w, ajustavel arrastando a borda). */
.kanban { display: flex; gap: 14px; overflow-x: auto; align-items: flex-start; padding-bottom: 6px; }
.coluna { position: relative; flex: 1 1 var(--w, 200px); width: var(--w, 200px); min-width: 190px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; }
.coluna.largura-fixa { flex: 0 0 var(--w); max-width: none; }
.coluna-alca { position: absolute; top: 0; right: -8px; width: 12px; height: 100%; cursor: col-resize; z-index: 2; }
.coluna-alca::after { content: ""; position: absolute; top: 12px; bottom: 12px; left: 5px; width: 2px; border-radius: 2px; background: transparent; transition: background .12s; }
.coluna-alca:hover::after, .redimensionando .coluna-alca.ativa::after { background: var(--accent); }
.redimensionando, .redimensionando * { cursor: col-resize !important; user-select: none; }
.coluna-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.coluna-titulo { font-weight: 600; font-size: 13px; display: flex; align-items: center; gap: 8px; }
.coluna-titulo::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--neutral)); }
.coluna-sub { font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.coluna-total { font-size: 12px; color: var(--muted); }
.coluna-lista { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; max-height: calc(100vh - 260px); overflow-y: auto; padding-right: 2px; }
.cartao {
  display: block; text-align: left; width: 100%; min-width: 0; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 12px; transition: border-color .12s, box-shadow .12s;
}
.cartao:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.cartao-topo { display: flex; align-items: flex-start; gap: 8px; }
.cartao-nome { flex: 1; min-width: 0; font-weight: 500; line-height: 1.35; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cartao-linha > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cartao-linha { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 6px; font-size: 12px; color: var(--muted); }
.cartao-alerta { margin-top: 6px; font-size: 12px; font-weight: 600; color: var(--danger); }

/* drawer (gaveta) */
.drawer-overlay {
  position: fixed; inset: 0; background: var(--overlay); z-index: 40;
  opacity: 0; transition: opacity .18s;
}
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 50;
  width: min(480px, 100vw);
  background: var(--surface); border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform .2s ease;
}
.drawer.largo { width: min(640px, 100vw); }
.drawer.aberto { transform: none; }
.drawer-overlay.aberto { opacity: 1; }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.drawer-titulo { font-size: 16px; font-weight: 600; }
.drawer-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 22px; display: grid; gap: 18px; align-content: start; }
.drawer-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--border); }
.drawer-foot .esquerda { margin-right: auto; }
.secao-titulo { font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 8px; }
.dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; margin: 0; }
.dl dt { font-size: 11.5px; color: var(--muted); }
.dl dd { margin: 2px 0 0; font-weight: 500; overflow-wrap: anywhere; }
.aviso {
  border-radius: var(--radius-sm); padding: 10px 12px; font-size: 13px;
  --c: var(--info);
  background: color-mix(in srgb, var(--c) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--c) 28%, transparent);
  color: var(--text);
}
.aviso.warn { --c: var(--warn); }
.aviso.danger { --c: var(--danger); }
.aviso.ok { --c: var(--ok); }

/* timeline */
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.timeline li { display: grid; grid-template-columns: 12px 1fr; gap: 10px; }
.timeline .ponto { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; background: var(--c, var(--border-strong)); }
.timeline .meta { font-size: 12px; color: var(--muted); }
.timeline .texto { white-space: pre-wrap; overflow-wrap: anywhere; }

/* progresso */
.progresso { display: grid; gap: 6px; }
.progresso-barra { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.progresso-barra > span { display: block; height: 100%; background: var(--accent); transition: width .3s; }

/* toast */
.toasts { position: fixed; bottom: 20px; right: 20px; z-index: 60; display: grid; gap: 8px; }
.toast {
  background: var(--text); color: var(--bg);
  border-radius: var(--radius-sm); padding: 10px 14px; font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow-lg); max-width: 360px;
  animation: toast-in .18s ease;
}
.toast.erro { background: var(--danger); color: #fff; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

/* login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-box { width: 100%; max-width: 360px; }
.login-box .brand { justify-content: center; padding-bottom: 22px; }
.login-box .card { padding: 24px; }

/* segmented */
.segmented { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; }
.segmented button { border: 0; background: var(--surface); padding: 0 12px; height: 32px; cursor: pointer; color: var(--text-2); font-weight: 500; font-size: 13px; }
.segmented button + button { border-left: 1px solid var(--border-strong); }
.segmented button[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); }

/* layouts de pagina */
.grid-dash { grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr); align-items: start; }
.coluna-dash { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-content: start; min-width: 0; }
.grid-lateral { grid-template-columns: minmax(0, 1fr) 320px; align-items: start; }


/* matriz vencimento x boletos (Clientes) */
.matriz { width: auto; min-width: 520px; }
.matriz th, .matriz td { padding: 4px 8px; text-transform: none; letter-spacing: 0; }
.matriz tfoot td { border-top: 1px solid var(--border); border-bottom: 0; font-size: 12.5px; }
.celula {
  min-width: 52px; height: 30px; padding: 0 10px; border-radius: var(--radius-sm); cursor: pointer;
  border: 1px solid transparent; background: transparent; color: var(--text);
  font: 600 13px var(--font-num); font-variant-numeric: tabular-nums;
}
.celula:not(:disabled):hover { background: var(--surface-2); border-color: var(--border); }
.celula:disabled { color: var(--border-strong); cursor: default; }
.celula.ok { color: var(--ok); } .celula.warn { color: var(--warn); } .celula.danger { color: var(--danger); }
.celula.cab { font-family: var(--font); font-size: 12px; font-weight: 600; color: var(--text-2); }
.celula.cab.ok { color: var(--ok); } .celula.cab.warn { color: var(--warn); } .celula.cab.danger { color: var(--danger); }
.celula.ativa { background: var(--accent); border-color: var(--accent); color: var(--accent-text) !important; }

/* anexos e mensagens (Suporte) */
.composer { display: grid; gap: 8px; border: 1px dashed transparent; border-radius: var(--radius-sm); transition: border-color .12s, background .12s; }
.composer.arrastando { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, transparent); }
.composer-barra { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.composer-dica { font-size: 12px; color: var(--muted); }
.pendentes { display: flex; flex-wrap: wrap; gap: 8px; }
.pendente {
  display: flex; align-items: center; gap: 8px; max-width: 240px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2);
  padding: 4px 6px 4px 4px; font-size: 12px;
}
.pendente img, .pendente .tipo { width: 34px; height: 34px; border-radius: 4px; object-fit: cover; flex: none; }
.pendente .tipo { display: grid; place-items: center; background: var(--surface); border: 1px solid var(--border); font-size: 10px; font-weight: 700; color: var(--muted); text-transform: uppercase; }
.pendente .nome { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.pendente button { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 16px; line-height: 1; padding: 0 2px; }

.anexos { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.anexo-img { display: block; width: 132px; height: 100px; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border); background: var(--surface-2); }
.anexo-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.anexo-midia { max-width: 100%; width: 320px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: #000; }
audio.anexo-midia { background: transparent; border: 0; height: 40px; }
.anexo-arquivo {
  display: inline-flex; align-items: center; gap: 8px; max-width: 280px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 10px; font-size: 12.5px; background: var(--surface);
}
.anexo-arquivo:hover { border-color: var(--border-strong); }
.anexo-arquivo .tipo { font-size: 10px; font-weight: 700; color: var(--accent); text-transform: uppercase; }
.anexo-arquivo .nome { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.msg { position: relative; border-radius: var(--radius-sm); padding: 2px 4px 2px 0; }
.msg-acoes { position: absolute; top: 0; right: 0; display: flex; gap: 2px; opacity: 0; transition: opacity .12s; background: var(--surface); }
.msg:hover .msg-acoes, .msg:focus-within .msg-acoes { opacity: 1; }
@media (hover: none) { .msg-acoes { opacity: 1; position: static; margin-top: 4px; } }
.msg-acoes button { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 12px; padding: 2px 6px; border-radius: 4px; }
.msg-acoes button:hover { background: var(--surface-2); color: var(--text); }
.msg-acoes button.perigo:hover { color: var(--danger); }
.riscado .texto { text-decoration: line-through; color: var(--muted); }
.riscado .anexos { opacity: .55; }
.apagada { font-style: italic; color: var(--muted); }
.editada { font-size: 11.5px; color: var(--muted); }

/* ----------------------------------------------------------- responsivo */
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-dash, .grid-lateral { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; z-index: 45; left: 0; width: 260px;
    transform: translateX(-100%); transition: transform .2s ease;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.aberta { transform: none; }
  .btn.menu-btn { display: inline-flex; flex: none; }
  .topbar { padding: 16px 16px 14px; align-items: flex-start; }
  .topbar-titulo { display: flex; gap: 10px; align-items: flex-start; }
  .content { padding: 0 16px 32px; }
  .form-2 { grid-template-columns: 1fr; }
  .toolbar .search { width: 100%; }
}
@media (max-width: 520px) {
  .topbar .sub { display: none; }
  .topbar-acoes .contagem { display: none; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi-valor { font-size: 20px; }
  .dl { grid-template-columns: 1fr; }
}

/* ---- troca manual de etapa (Pipeline) ---- */
.aviso.info { --c: var(--info); }
.cartao[draggable="true"] { cursor: grab; }
.cartao.arrastando { opacity: .45; }
.coluna.soltar { outline: 2px dashed var(--c, var(--accent)); outline-offset: -3px; background: color-mix(in srgb, var(--c, var(--accent)) 7%, var(--surface-2)); }
.cartao-manual { display: inline-block; margin-top: 6px; font-size: 11px; font-weight: 600; color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); border-radius: 999px; padding: 1px 8px; }

/* ---- Configuracoes ---- */
.cfg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.cfg-card { display: flex; flex-direction: column; gap: 8px; text-decoration: none; color: inherit; }
.cfg-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.cfg-card .cfg-ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); }
.cfg-card .cfg-ic svg { width: 18px; height: 18px; }
.cfg-meta { font-size: 12.5px; color: var(--muted); margin-top: auto; }

/* ---- Atualizacoes (patch notes) ---- */
.posts { display: grid; gap: 16px; max-width: 860px; }
.post-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.post-titulo { font-size: 16px; font-weight: 600; line-height: 1.35; }
.post-meta { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.post-corpo { margin-top: 12px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.post-coms { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); display: grid; gap: 10px; }
.post-com { font-size: 13.5px; }
.post-com .meta { font-size: 12px; color: var(--muted); }
.post-nova { box-shadow: inset 3px 0 0 var(--accent); }

/* ---- marca de OS aberta ---- */
.marca-os { display: inline-flex; align-items: center; gap: 4px; flex-shrink: 0; margin-left: 6px; vertical-align: middle;
  font-size: 10px; font-weight: 600; letter-spacing: .04em; line-height: 1; color: var(--muted); white-space: nowrap; }
.marca-os::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--warn); }
.marca-os.cancel::before { background: var(--danger); }
.cartao-topo .marca-os { margin: 4px 0 0; }

/* cancelamentos */
.kpi-botao { text-align: left; font: inherit; color: inherit; cursor: pointer; }
.kpi-botao:hover { border-color: var(--accent); }
.legenda { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--muted); }
.legenda i { display: inline-block; width: 8px; height: 8px; border-radius: 99px; background: var(--c); margin-right: 6px; }
.motivos { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); column-gap: 28px; }
.motivo-linha { border: 0; background: transparent; padding: 4px 6px; margin: -4px -6px; border-radius: 6px; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.motivo-linha:hover { background: var(--surface-2); }
.motivo-linha.ativa { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.tabela td.texto-os { max-width: 240px; overflow: hidden; text-overflow: ellipsis; color: var(--text-2); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.texto-bloco { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; line-height: 1.55; padding: 10px 12px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; }
@media (max-width: 520px) { .rot-longo { display: none; } }

/* grafico de motivos de cancelamento (Visao geral). Cores validadas p/ daltonismo em cada tema. */
.cancel-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 32px; }
.cancel-grid h3 { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 0 0 12px; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; padding: 2px; gap: 2px; }
.seg button { border: 0; background: transparent; color: var(--text-2); font: inherit; font-size: 12.5px; padding: 4px 10px; border-radius: 6px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface-2); color: var(--text); font-weight: 600; }
.meses { display: flex; align-items: flex-end; gap: 6px; height: 340px; padding-top: 18px; border-bottom: 1px solid var(--border); }
.mes-col { flex: 1 1 0; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; cursor: default; border-radius: 6px 6px 0 0; }
.mes-col:hover { background: color-mix(in srgb, var(--text) 4%, transparent); }
.mes-total { font-size: 11px; color: var(--text-2); margin-bottom: 4px; font-variant-numeric: tabular-nums; }
.mes-pilha { width: min(34px, 70%); display: flex; flex-direction: column-reverse; gap: 2px; }
.mes-pilha span { display: block; background: var(--c); min-height: 0; }
.mes-pilha span:last-child { border-radius: 4px 4px 0 0; }
.mes-rotulos { display: flex; gap: 6px; margin-top: 6px; }
.mes-rotulos span { flex: 1 1 0; min-width: 0; text-align: center; font-size: 11px; color: var(--muted); }
.dv-tip { position: fixed; z-index: 60; pointer-events: none; background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--shadow-lg);
  border-radius: 8px; padding: 8px 10px; font-size: 12px; color: var(--text); min-width: 150px; }
.dv-tip .t { font-weight: 600; margin-bottom: 4px; }
.dv-tip .l { display: flex; justify-content: space-between; gap: 14px; color: var(--text-2); }
.dv-tip .l i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; background: var(--c); margin-right: 6px; }
.dv-tip .l b { color: var(--text); font-variant-numeric: tabular-nums; }
@media (max-width: 860px) { .cancel-grid { grid-template-columns: minmax(0, 1fr); } .meses { height: 230px; } }

/* cancelamentos: filtro em 3 etapas */
.etapas-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px; }
.etapas-grid h3 { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 0 0 12px; }
.etapa-num { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 99px; margin-right: 4px;
  background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); font-size: 11px; }
@media (max-width: 1100px) { .etapas-grid { grid-template-columns: minmax(0, 1fr); } }

/* Evolucao do pipeline (Visao geral): linhas por etapa ao longo do tempo */
.evo-series { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.evo-serie { display: flex; flex-direction: column; gap: 2px; text-align: left; font: inherit; color: inherit; cursor: pointer;
  background: transparent; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.evo-serie:hover { background: var(--surface-2); }
.evo-serie[aria-pressed="false"] { opacity: .45; }
.evo-serie[aria-pressed="false"] .evo-nome i { background: var(--muted); }
.evo-nome { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-2); }
.evo-nome i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; background: var(--c); flex-shrink: 0; }
.evo-valor { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text); line-height: 1.2; }
.evo-delta { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.evo-grafico { position: relative; height: 300px; transition: opacity .15s; }
.evo-grafico.carregando { opacity: .5; }
.evo-grafico svg { display: block; width: 100%; height: 100%; overflow: visible; }
.evo-grafico .grade line { stroke: var(--border); stroke-width: 1; }
.evo-grafico .grade line.base { stroke: var(--border-strong); }
.evo-grafico text { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.evo-grafico text.rot { fill: var(--text-2); font-size: 11.5px; font-weight: 600; }
.evo-grafico .linha { fill: none; stroke: var(--c); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.evo-grafico .mira { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.evo-grafico .ponto { fill: var(--c); stroke: var(--surface); stroke-width: 2; }
.dv-tip .l i.traco { width: 12px; height: 3px; border-radius: 2px; vertical-align: middle; }
@media (max-width: 860px) { .evo-series { grid-template-columns: repeat(2, minmax(0, 1fr)); } .evo-grafico { height: 230px; } }

/* Suporte: quadro de demandas e o Goro (assistente que atende pedidos) */
.kanban.demandas .coluna { min-width: 230px; }
.cartao .cartao-nome { font-size: 13.5px; }
.goro-marca { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 12px; color: var(--text-2); }
.goro-marca::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--c, var(--accent)); }
.goro { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; display: grid; gap: 12px; }
.goro-topo { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.goro-estado { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13.5px; }
.goro-estado::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--neutral)); }
.goro-estado.vivo::before { animation: goro-pulso 1.6s ease-in-out infinite; }
@keyframes goro-pulso { 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { .goro-estado.vivo::before { animation: none; } }
.goro-passos { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; font-size: 11.5px; color: var(--muted); }
.goro-passos li { flex: 1; padding-top: 6px; border-top: 3px solid var(--border); }
.goro-passos li.feito { border-color: var(--accent); color: var(--text-2); }
.goro-passos li.atual { border-color: var(--accent); color: var(--text); font-weight: 600; }
.goro-passos li.pulado { opacity: .45; text-decoration: line-through; }
.goro-detalhe { font-size: 12.5px; color: var(--text-2); }
.goro-detalhe ul { margin: 4px 0 0; padding-left: 18px; }
.goro-diff { max-height: 360px; overflow: auto; margin: 6px 0 0; padding: 10px; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; font: 11.5px/1.5 "JetBrains Mono", monospace; white-space: pre; }
.goro-diff .mais { color: var(--ok); }
.goro-diff .menos { color: var(--danger); }
.goro-acoes { display: flex; gap: 8px; flex-wrap: wrap; }
.timeline .autor-goro { font-weight: 600; color: var(--text); }
