/* ==========================================================================
   Oneby Platform · painel administrativo, portal do cliente e telas de acesso
   Linguagem: vidro claro (glassmorphism), fundo lavanda acetinado, tinta escura,
   badges pastel, botões em pílula preta/branca. Denso o bastante para trabalhar.
   ========================================================================== */
:root {
  /* Tinta e texto */
  --ink: #0B1020;
  --text: #1F2437;
  --text-2: #5B6275;
  --text-3: #636A7F;          /* sutil com contraste AA sobre vidro */
  --subtle: #8A91A6;          /* apenas decorativo / ícones */
  /* Marca */
  --violet: #7C5CFF;
  --violet-ink: #5A3FE0;      /* links e texto violeta (AA) */
  --lilac: #A78BFA;
  --blue: #1D52E5;
  --grad: linear-gradient(95deg, #8B5CF6 0%, #7C6CFF 45%, #5B8CFF 100%);
  --grad-soft: linear-gradient(135deg, #F1EDFF 0%, #EAF0FF 100%);
  /* Superfícies */
  --bg: #F3F2FA;
  --glass: rgba(255, 255, 255, .58);
  --glass-strong: rgba(255, 255, 255, .82);
  --glass-solid: rgba(255, 255, 255, .94);
  --glass-border: rgba(255, 255, 255, .78);
  --line: rgba(31, 36, 55, .08);
  --line-2: rgba(31, 36, 55, .12);
  --field: rgba(255, 255, 255, .86);
  --hover: rgba(124, 92, 255, .055);
  --shine: inset 0 1px 0 rgba(255, 255, 255, .9);
  --shadow-panel: 0 30px 80px -40px rgba(76, 62, 170, .28), inset 0 1px 0 rgba(255, 255, 255, .9);
  --shadow-card: 0 18px 48px -32px rgba(76, 62, 170, .34), inset 0 1px 0 rgba(255, 255, 255, .9);
  --shadow-pop: 0 28px 70px -24px rgba(40, 30, 110, .32), 0 2px 8px -2px rgba(40, 30, 110, .08);
  --ring: 0 0 0 4px rgba(124, 92, 255, .16);
  /* Pastéis (fundo / ícone) */
  --amber-bg: #FFF1D6; --amber: #B7791F; --amber-ink: #8A5A0B;
  --violet-bg: #EEE8FF; --violet-ic: #6D4AFF;
  --blue-bg: #E3ECFF; --blue-ic: #1D52E5;
  --teal-bg: #DDF7F2; --teal: #0F9F8E; --teal-ink: #0B7F72;
  --rose-bg: #FFE6F2; --rose: #DB2777;
  /* Estados */
  --success: #0F9F8E;
  --warning: #B7791F;
  --danger: #E11D48;
  /* Raios e medidas */
  --r-panel: 24px;
  --r-card: 20px;
  --r-md: 14px;
  --r-sm: 12px;
  --sidebar: 256px;
  --gap: 14px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  /* Compatibilidade com estilos inline antigos */
  --navy: var(--ink);
  --primary: var(--violet-ink);
  --accent: var(--violet-ink);
  --accent-2: var(--violet);
  --soft: var(--violet-bg);
  --muted: var(--text-3);
  --surface: #fff;
  --border: var(--line-2);
  --radius: var(--r-card);
  --radius-sm: var(--r-sm);
  --shadow: var(--shadow-pop);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; font-family: var(--font); font-size: 14px; line-height: 1.55;
  color: var(--text); background: var(--bg); position: relative; overflow-x: hidden;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11", "ss01";
}
/* Luzes desfocadas do fundo (lavanda, azul, rosa) */
body::before, body::after {
  content: ""; position: fixed; z-index: -1; pointer-events: none; border-radius: 50%; filter: blur(80px);
}
body::before {
  width: 72vw; height: 72vw; max-width: 980px; max-height: 980px; left: -18vw; top: -30vw;
  background: radial-gradient(closest-side, #E6E0FF 0%, #ECE7FF 45%, rgba(236, 231, 255, 0) 75%);
}
body::after {
  width: 64vw; height: 64vw; max-width: 860px; max-height: 860px; right: -20vw; bottom: -26vw;
  background: radial-gradient(closest-side, #DCE7FF 0%, #F6E8FF 50%, rgba(246, 232, 255, 0) 76%);
}
a { color: var(--violet-ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3, h4 { margin: 0 0 .45em; color: var(--ink); line-height: 1.15; font-weight: 700; letter-spacing: -.02em; }
h1 { font-size: 1.75rem; letter-spacing: -.03em; line-height: 1.1; }
h2 { font-size: 1.125rem; }
h3 { font-size: .98rem; letter-spacing: -.01em; }
p { margin: 0 0 .8em; }
img, svg { max-width: 100%; vertical-align: middle; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.icon { width: 1em; height: 1em; flex: none; }
::selection { background: rgba(124, 92, 255, .2); }
:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; }
/* Atalho de teclado: escondido até receber foco */
.skip-link {
  position: fixed; left: 16px; top: 12px; z-index: 500; padding: 10px 18px; border-radius: 999px;
  background: var(--ink); color: #fff; font-weight: 600; font-size: .86rem; text-decoration: none !important;
  box-shadow: 0 18px 40px -16px rgba(11, 16, 32, .6); transform: translateY(-160%); transition: transform .15s ease;
}
.skip-link:focus, .skip-link:focus-visible { transform: none; outline: 2px solid #fff; outline-offset: -4px; }
main.content:focus { outline: none; }

/* Barras de rolagem discretas */
.sidebar, .kanban, .table-wrap, .table-scroll, .tabs, .pill-tabs, .dropdown-menu, .modal-box, .icon-picker, pre.log {
  scrollbar-width: thin; scrollbar-color: rgba(91, 98, 117, .28) transparent;
}
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(91, 98, 117, .24); border-radius: 999px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- Utilitários ---------- */
.muted { color: var(--text-2); }
.small { font-size: .82rem; }
.mono { font-family: var(--mono); font-size: .84em; }
/* Identificadores de negócio (PROP-2026-006, FAT-2026-001, nomes de tabelas): Inter, sem monoespaçada.
   Sem "tnum" de propósito: na Inter ele alarga também o hífen ("FAT - 2026 - 001"). */
.code-id { font-family: var(--font); font-variant-numeric: lining-nums; font-weight: 600; letter-spacing: .01em; color: var(--text-2); white-space: nowrap; }
a.code-id, .row-link.code-id { color: var(--ink); }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; pointer-events: none; }
.ellipsis { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flex { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.col { flex-direction: column; align-items: stretch; }
.grow { flex: 1; min-width: 0; }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.text-right { text-align: right; } .text-center { text-align: center; }
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--amber-ink) !important; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px; margin-bottom: 8px;
  font-size: .72rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--violet-ic);
}
.grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.divider { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }
.list-plain { list-style: none; padding: 0; margin: 0; }
.list-bullets { padding-left: 18px; margin: 0; }
.list-bullets li { margin-bottom: 4px; }
.row-line { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: .85rem; }
.row-line:last-child { border-bottom: 0; }

/* ==========================================================================
   Estrutura: barra lateral de vidro flutuante + topo em vidro
   ========================================================================== */
.app {
  display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); gap: var(--gap);
  min-height: 100vh; padding: 12px;
}
.sidebar {
  position: sticky; top: 12px; height: calc(100vh - 24px); overflow-y: auto; overflow-x: hidden;
  display: flex; flex-direction: column; padding: 16px 12px 14px;
  background: var(--glass); border: 1px solid var(--glass-border); border-radius: var(--r-panel);
  box-shadow: var(--shadow-panel); backdrop-filter: blur(24px) saturate(140%); -webkit-backdrop-filter: blur(24px) saturate(140%);
  z-index: 100;
}
.sidebar .brand {
  display: flex; align-items: center; gap: 10px; padding: 6px 8px 16px; margin-bottom: 4px;
  color: var(--ink); text-decoration: none !important; border-bottom: 1px solid var(--line);
}
.sidebar .brand img, .sidebar .brand .logo { height: 26px; width: 106px; flex: none; }
.sidebar-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.sidebar-head .brand { flex: 1; min-width: 0; margin-bottom: 0; border-bottom: 0; }
.sidebar .sidebar-close { display: none; width: 36px; height: 36px; margin-top: 1px; }
.sidebar .brand span {
  font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: var(--violet-ink);
  background: var(--violet-bg); border-radius: 999px; padding: 3px 9px; white-space: nowrap;
}
.nav-group {
  padding: 16px 10px 6px; font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .13em; color: var(--text-3);
}
.sidebar nav a {
  display: flex; align-items: center; gap: 10px; padding: 5px 8px 5px 5px; margin: 1px 0; border-radius: 12px;
  color: var(--text); font-weight: 500; font-size: .875rem; text-decoration: none; position: relative;
  transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}
.sidebar nav a .icon {
  width: 30px; height: 30px; padding: 7px; border-radius: 9px; color: var(--text-2); flex: none;
  transition: background .15s ease, color .15s ease;
}
.sidebar nav a:hover { background: rgba(255, 255, 255, .72); color: var(--ink); text-decoration: none; }
.sidebar nav a:hover .icon { color: var(--violet-ic); }
.sidebar nav a.active {
  background: #fff; color: var(--ink); font-weight: 600;
  box-shadow: 0 10px 24px -14px rgba(76, 62, 170, .55), 0 0 0 1px rgba(124, 92, 255, .10);
}
.sidebar nav a.active .icon { background: var(--violet-bg); color: var(--violet-ic); }
.sidebar nav a.active::after {
  content: ""; position: absolute; left: -12px; top: 50%; width: 4px; height: 18px; margin-top: -9px;
  border-radius: 0 4px 4px 0; background: var(--grad);
}
.sidebar nav a .count {
  margin-left: auto; min-width: 22px; text-align: center; font-size: .7rem; font-weight: 700; line-height: 1;
  padding: 5px 7px; border-radius: 999px; background: var(--violet-bg); color: #4B2BD6;
}
.sidebar nav a.active .count { background: var(--ink); color: #fff; }
.sidebar-foot {
  margin-top: auto; padding: 14px 8px 2px; font-size: .74rem; line-height: 1.5; color: var(--text-3);
  border-top: 1px solid var(--line); margin-top: 18px;
}
.sidebar-foot a { color: var(--violet-ink); font-weight: 600; }
.sidebar-foot .foot-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.overlay {
  display: none; position: fixed; inset: 0; z-index: 90;
  background: rgba(30, 24, 70, .18); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
html.sb-lock, html.sb-lock body { overflow: hidden; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 12px; z-index: 50; display: flex; align-items: center; gap: 12px;
  min-height: 60px; padding: 9px 10px 9px 12px; border-radius: 20px;
  background: rgba(255, 255, 255, .62); border: 1px solid var(--glass-border); box-shadow: var(--shadow-card);
  backdrop-filter: blur(24px) saturate(140%); -webkit-backdrop-filter: blur(24px) saturate(140%);
}
.topbar .search { flex: 1; max-width: 440px; position: relative; margin: 0; }
.topbar .search input {
  width: 100%; height: 40px; padding: 0 14px 0 40px; border-radius: 999px; border: 1px solid var(--line);
  background: rgba(255, 255, 255, .78); box-shadow: none; font-size: .875rem;
}
.topbar .search input:focus { background: #fff; border-color: var(--violet); box-shadow: var(--ring); }
.topbar .search .icon { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.topbar .context { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar .context strong { color: var(--ink); font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; flex: none; position: relative;
  border: 1px solid var(--line); background: rgba(255, 255, 255, .8); color: var(--text); cursor: pointer; font: inherit;
  transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}
.icon-btn:hover { background: #fff; color: var(--violet-ic); box-shadow: 0 8px 20px -12px rgba(76, 62, 170, .5); }
.icon-btn .dot { position: absolute; top: 8px; right: 9px; width: 9px; height: 9px; border-radius: 50%; background: #F43F5E; border: 2px solid #fff; }
.user-menu {
  display: flex; align-items: center; gap: 8px; padding: 3px 12px 3px 3px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: rgba(255, 255, 255, .8); color: var(--ink); font: inherit;
  transition: background .15s ease, box-shadow .15s ease;
}
.user-menu:hover { background: #fff; box-shadow: 0 8px 20px -12px rgba(76, 62, 170, .5); }
.user-menu .avatar { width: 32px; height: 32px; font-size: .74rem; }
.user-menu span:not(.avatar) { font-weight: 600; font-size: .85rem; }
.user-menu .icon { color: var(--text-2); }
.menu-btn { display: none; }
.content { padding: 22px 6px 40px; width: 100%; max-width: 1480px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head > div:first-child { min-width: 0; }
.page-head h1 { margin-bottom: 0; display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; }
.page-head h1 .badge { font-size: .74rem; letter-spacing: 0; }
.page-head p { color: var(--text-2); margin: 6px 0 0; font-size: .9rem; }
.page-head .title-icon {
  width: 42px; height: 42px; border-radius: 14px; display: inline-grid; place-items: center; flex: none;
  background: linear-gradient(135deg, #FFFFFF, #EEE8FF); color: var(--violet-ic);
  border: 1px solid rgba(255, 255, 255, .95); box-shadow: 0 12px 26px -16px rgba(76, 62, 170, .6), inset 0 1px 0 #fff;
}
.page-head .title-icon .icon { width: 20px; height: 20px; }
.crumbs { font-size: .74rem; font-weight: 600; letter-spacing: .02em; color: var(--violet-ic); margin-bottom: 8px; }
.crumbs a { color: var(--violet-ic); }
.crumbs a:hover { color: var(--ink); }

/* ==========================================================================
   Cartões, grades e números
   ========================================================================== */
.card {
  background: var(--glass); border: 1px solid var(--glass-border); border-radius: var(--r-card); padding: 20px;
  box-shadow: var(--shadow-card); backdrop-filter: blur(18px) saturate(140%); -webkit-backdrop-filter: blur(18px) saturate(140%);
  min-width: 0; position: relative;
}
a.card { color: inherit; text-decoration: none; transition: transform .18s ease, box-shadow .18s ease, background .18s ease; }
a.card:not(.stat) { display: block; }
a.card:hover { transform: translateY(-2px); background: var(--glass-strong); box-shadow: 0 26px 56px -30px rgba(76, 62, 170, .45), var(--shine); }
.card > h3:first-of-type { margin-bottom: 12px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h2 { margin: 0; font-size: .98rem; letter-spacing: -.015em; }
.card-head > a.small { font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.card-danger { border-color: rgba(225, 29, 72, .18); background: rgba(255, 248, 250, .7); }
.card-danger h3 { color: #BE123C; }
.grid { display: grid; gap: var(--gap); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-side { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.grid.is-start { align-items: start; }
.stack { display: grid; gap: var(--gap); align-content: start; min-width: 0; }
.card-chart { display: flex; flex-direction: column; }
.card-chart .chart-wrap { flex: 1; min-height: 240px; }
.card-chart .chart { height: 100%; min-height: 240px; }
@media (max-width: 1200px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 980px) { .grid-2, .grid-3, .grid-side { grid-template-columns: minmax(0, 1fr); } }
.grid-3.grid-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (min-width: 981px) and (max-width: 1279px) {
  .grid-3.grid-dash-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3.grid-dash-3 > :last-child { grid-column: 1 / -1; }
}
/* Indicadores no celular: 2 colunas compactas (ou 3, na linha de 3 do portal) */
@media (max-width: 560px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .grid-3.grid-stats { gap: 8px; }
  .grid-4 > .stat, .grid-stats > .stat { flex-direction: column; align-items: flex-start; gap: 8px; padding: 14px; }
  .grid-4 > .stat .stat-icon, .grid-stats > .stat .stat-icon { width: 36px; height: 36px; border-radius: 12px; }
  .grid-4 > .stat .stat-icon .icon, .grid-stats > .stat .stat-icon .icon { width: 17px; height: 17px; }
  .grid-4 > .stat strong, .grid-stats > .stat strong { font-size: 1.18rem; }
  .grid-4 > .stat > div:last-child, .grid-stats > .stat > div:last-child { width: 100%; }
  .grid-4 > .stat span, .grid-stats > .stat span { font-size: .78rem; line-height: 1.35; }
  .grid-4 > .stat .stat-sub, .grid-stats > .stat .stat-sub { font-size: .72rem; margin-top: 3px; }
  .grid-4 > .stat .delta { margin-left: 2px; }
}
.form-narrow { max-width: 820px; }
.form-mid { max-width: 920px; }

/* Indicadores */
.stat { display: flex; gap: 14px; align-items: center; }
.stat .stat-icon {
  width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; flex: none;
  background: var(--violet-bg); color: var(--violet-ic); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .8);
}
.stat .stat-icon .icon { width: 21px; height: 21px; }
.stat-icon.is-blue, .tile-blue { background: var(--blue-bg) !important; color: var(--blue-ic) !important; }
.stat-icon.is-amber, .tile-amber { background: var(--amber-bg) !important; color: var(--amber) !important; }
.stat-icon.is-teal, .tile-teal { background: var(--teal-bg) !important; color: var(--teal) !important; }
.stat-icon.is-rose, .tile-rose { background: var(--rose-bg) !important; color: var(--rose) !important; }
.stat-icon.is-violet, .tile-violet { background: var(--violet-bg) !important; color: var(--violet-ic) !important; }
.stat > div:last-child { min-width: 0; }
.stat strong { display: block; font-size: 1.5rem; line-height: 1.1; font-weight: 700; letter-spacing: -.03em; color: var(--ink); margin-bottom: 3px; }
.stat span { color: var(--text-2); font-size: .82rem; }
.stat .stat-sub { display: block; font-size: .78rem; color: var(--text-3); margin-top: 2px; }
.stat .stat-sub.is-alert { color: #BE123C; font-weight: 600; }
.stat a.stat-sub { color: var(--violet-ink); font-weight: 600; }
.stat a.small { font-weight: 600; font-size: .78rem; }
.stat .delta { font-size: .72rem; font-weight: 700; padding: 1px 7px; border-radius: 999px; margin-left: 4px; }
.delta.up { color: #0A7366; background: var(--teal-bg); }
.delta.down { color: #BE123C; background: #FFE4E8; }
.stat-plain strong { font-size: 1.35rem; }
.stat-plain .stat-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; align-self: flex-start; margin-top: 8px; }

/* ==========================================================================
   Botões
   ========================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 18px; min-height: 38px;
  border-radius: 999px; border: 1px solid transparent; font-family: inherit; font-size: .86rem; font-weight: 600; line-height: 1.2;
  cursor: pointer; white-space: nowrap; text-decoration: none !important; user-select: none;
  transition: background .15s ease, color .15s ease, border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.btn .icon { width: 15px; height: 15px; }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled=true] { opacity: .55; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--ink); color: #fff; box-shadow: 0 10px 24px -14px rgba(11, 16, 32, .7), inset 0 1px 0 rgba(255, 255, 255, .12); }
.btn-primary:hover { background: #1C2336; color: #fff; box-shadow: 0 14px 28px -14px rgba(11, 16, 32, .75), inset 0 1px 0 rgba(255, 255, 255, .14); }
.btn-secondary { background: var(--violet-bg); color: #4B2BD6; border-color: rgba(124, 92, 255, .22); }
.btn-secondary:hover { background: #E5DCFF; color: #3D1FC4; }
.btn-outline { background: rgba(255, 255, 255, .8); color: var(--ink); border-color: var(--line-2); box-shadow: var(--shine); }
.btn-outline:hover { background: #fff; color: var(--ink); border-color: rgba(124, 92, 255, .38); box-shadow: 0 8px 20px -14px rgba(76, 62, 170, .5); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: rgba(255, 255, 255, .75); color: var(--ink); }
.btn-danger { background: #FFF1F3; color: #BE123C; border-color: #FBD0D9; }
.btn-danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-success { background: var(--teal-ink); color: #fff; }
.btn-success:hover { background: #096B60; color: #fff; }
.btn-sm { padding: 6px 13px; min-height: 32px; font-size: .8rem; gap: 6px; }
.btn-sm .icon { width: 14px; height: 14px; }
.btn-xs { padding: 4px 9px; min-height: 28px; min-width: 28px; font-size: .74rem; gap: 5px; }
.btn-xs .icon { width: 13px; height: 13px; }
.btn-block { width: 100%; }
.btn-icon { padding: 0; width: 34px; height: 34px; min-height: 0; }
label.btn { position: relative; }

/* ==========================================================================
   Tabelas
   ========================================================================== */
.table-wrap {
  overflow: auto; border-radius: var(--r-card); background: var(--glass); border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-card); backdrop-filter: blur(18px) saturate(140%); -webkit-backdrop-filter: blur(18px) saturate(140%);
}
.card .table-wrap { background: rgba(255, 255, 255, .55); box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; border-color: var(--line); border-radius: var(--r-md); }
.table-scroll { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
.table { width: 100%; border-collapse: collapse; font-size: .86rem; }
.table th, .table td { padding: 12px 14px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--line); }
.table th {
  font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; color: var(--text-2);
  background: rgba(247, 246, 252, .66); white-space: nowrap; padding-top: 11px; padding-bottom: 11px;
}
.table thead tr:first-child th:first-child { border-top-left-radius: inherit; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s ease; }
.table tbody tr:hover { background: var(--hover); }
.table td.actions { text-align: right; white-space: nowrap; }
.table td.actions > * { vertical-align: middle; }
.table td.actions .btn, .table td.actions form { margin-left: 4px; }
.table .thumb { width: 44px; height: 44px; border-radius: 11px; object-fit: cover; background: var(--violet-bg); color: var(--violet-ic); border: 1px solid rgba(255, 255, 255, .9); box-shadow: 0 6px 14px -10px rgba(76, 62, 170, .5); }
span.thumb { display: inline-grid; place-items: center; }
.table a.row-link, a.row-link { color: var(--ink); font-weight: 600; }
.table a.row-link:hover, a.row-link:hover { color: var(--violet-ink); }
.table .drag { cursor: grab; color: var(--subtle); width: 30px; }
.table .drag:hover { color: var(--violet-ic); }
.table tr.dragging { opacity: .45; background: var(--violet-bg); }
.table td.mono { white-space: nowrap; }
.table .cell-sub { display: block; color: var(--text-2); font-size: .8rem; margin-top: 1px; }
.table .cell-sub .sep { margin: 0 5px; color: var(--subtle); }
.table .clip { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table .stack-only, .table .stack-only-inline { display: none; }
.table .row-title { color: var(--ink); font-weight: 600; }
/* Colunas secundárias: somem em telas médias e voltam no modo empilhado do celular.
   .opt-alt / .opt-2-alt repetem o dado dentro da célula principal enquanto a coluna está oculta. */
.table .opt-alt, .table .opt-2-alt { display: none; }
@media (min-width: 721px) and (max-width: 1279px) { .table .col-opt { display: none; } .table .opt-alt { display: inline; } }
@media (min-width: 721px) and (max-width: 1199px) { .table .col-opt-2 { display: none; } .table .opt-2-alt { display: block; } }
/* Coluna de ação fixa à direita quando a tabela precisa rolar (classe aplicada pelo admin.js) */
.table-wrap.is-scrollable .table td.actions,
.table-wrap.is-scrollable .table th.actions,
.table-wrap.is-scrollable .table th:last-child:empty {
  position: sticky; right: 0; z-index: 1; background: rgba(251, 250, 255, .97);
  box-shadow: -14px 0 18px -16px rgba(60, 50, 150, .45);
}
.table-wrap.is-scrollable .table th.actions, .table-wrap.is-scrollable .table th:last-child:empty { background: #F7F6FC; }
/* CRM: lista de leads */
.table-leads td { padding-left: 12px; padding-right: 12px; }
.table-leads th { padding-left: 12px; padding-right: 12px; }
.table-leads td:first-child, .table-leads th:first-child { padding-left: 16px; }
.table-leads .lead-name { max-width: 230px; }
.table-leads .lead-contact { max-width: 220px; }
.table-leads .lead-interest { max-width: 220px; }
/* 1280–1359 px: colunas um pouco mais estreitas para "Recebido" caber sem rolagem */
@media (min-width: 1280px) and (max-width: 1359px) { .table-leads .lead-name, .table-leads .lead-contact, .table-leads .lead-interest { max-width: 196px; } }
.table-leads .svc-line { display: flex; align-items: center; gap: 6px; min-width: 0; }
.table-leads .svc-line .clip { min-width: 0; }
.table-leads .svc-line b { flex: none; font-size: .68rem; font-weight: 700; color: var(--violet-ink); background: var(--violet-bg); border-radius: 999px; padding: 1px 6px; }
.table-leads .cell-status { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; }
.table-leads .cell-status .score { font-size: .72rem; color: var(--text-2); font-weight: 600; }
.table-leads .cell-status .score i { width: 38px; height: 5px; }
/* Tabelas compactas dentro de cartões (dashboard) */
.card > .table, .card > .table-scroll > .table, .table-flush { font-size: .84rem; }
.card > .table td, .card > .table-scroll > .table td, .table-flush td { padding: 10px 10px; }
.card > .table td:first-child, .card > .table-scroll > .table td:first-child, .table-flush td:first-child { padding-left: 2px; }
.card > .table td:last-child, .card > .table-scroll > .table td:last-child, .table-flush td:last-child { padding-right: 2px; }
.card > .table tbody tr:hover, .card > .table-scroll > .table tbody tr:hover { background: transparent; }
.empty { text-align: center; padding: 34px 20px; color: var(--text-2); font-size: .88rem; }
.empty .icon {
  width: 48px; height: 48px; padding: 13px; margin-bottom: 10px; border-radius: 15px;
  background: var(--violet-bg); color: var(--violet-ic);
}
.empty.small { padding: 20px 10px; font-size: .82rem; }
.empty.small .icon { width: 40px; height: 40px; padding: 10px; }

/* Tabelas empilhadas no celular (.table-stack): cada linha vira um cartão compacto.
   Coluna 1: título, subtítulo e dados com data-label. Coluna 2 (.cell-end): badge e valor. */
@media (max-width: 720px) {
  .table-stack, .table-stack tbody { display: block; width: 100%; }
  .table-stack thead { display: none; }
  .table-stack tbody tr {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-auto-flow: row dense; align-items: center;
    column-gap: 12px; row-gap: 3px; padding: 12px 14px; border-bottom: 1px solid var(--line);
  }
  .table-stack tbody tr:last-child { border-bottom: 0; }
  .table-stack td { display: block; grid-column: 1; min-width: 0; padding: 1px 0 !important; border: 0 !important; text-align: left; white-space: normal; }
  .table-stack td.cell-main { order: -2; }
  .table-stack td.stack-first { order: -1; }
  .table-stack td.cell-end { grid-column: 2; justify-self: end; text-align: right; white-space: nowrap; }
  .table-stack td.cell-full, .table-stack td[colspan] { grid-column: 1 / -1; }
  .table-stack td.actions { grid-column: 1 / -1; text-align: left; padding-top: 8px !important; display: flex; flex-wrap: wrap; gap: 6px; }
  .table-stack td.actions .btn, .table-stack td.actions form { margin-left: 0; }
  .table-stack .stack-hide, .table-stack td.drag { display: none !important; }
  .table-stack .stack-only { display: block; }
  .table-stack .stack-only-inline { display: inline; }
  .table-stack td[data-label]:not(.cell-end):not(.actions)::before { content: attr(data-label) " · "; color: var(--text-3); font-weight: 500; font-size: .76rem; }
  .table-stack td.cell-main .row-link, .table-stack td.cell-main > strong { font-size: .9rem; }
  .table-stack td.cell-main .clip, .table-stack td .clip { white-space: normal; overflow: visible; }
  .table-stack td.money { font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
  .table-stack .cell-status { display: flex; flex-direction: column; align-items: flex-end; }
  .table-stack .lead-name, .table-stack .lead-contact, .table-stack .lead-interest { max-width: none; }
  .table-stack .lead-contact { font-size: .8rem; }
  .table-stack .empty { padding: 24px 8px; }
  .table-stack td.is-bool { display: flex; align-items: center; gap: 10px; }
  .table-stack td.is-bool::before { content: attr(data-label) !important; min-width: 74px; }
  .table-stack td[data-label] > .progress-row { display: inline-flex; vertical-align: middle; min-width: 150px !important; }
  .table-stack td.actions:empty { display: none; }
  .table .row-title { color: var(--ink); font-weight: 600; }
  .hide-sm { display: none; }
}

/* ==========================================================================
   Badges pastel
   ========================================================================== */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 8px; border-radius: 999px;
  font-size: .72rem; font-weight: 600; line-height: 1.45; white-space: nowrap; text-decoration: none !important;
  background: #EEF0F5; color: #4A5163; border: 1px solid rgba(255, 255, 255, .7);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .75; flex: none; }
.badge-gray { background: #EEF0F5; color: #4A5163; }
.badge-blue { background: #E3ECFF; color: #1840B8; }
.badge-indigo { background: #E7E8FF; color: #3B3FC4; }
.badge-purple { background: #EEE8FF; color: #5B33D6; }
.badge-amber { background: #FFF1D6; color: #8A5A0B; }
.badge-green { background: #DDF7EE; color: #08694F; }
.badge-red { background: #FFE4E8; color: #B4233C; }
.badge-orange { background: #FFEBD9; color: #A2410D; }
.badge-teal { background: #DDF7F2; color: #08695F; }
.badge-rose { background: #FFE6F2; color: #B0185F; }
a.badge:hover { filter: saturate(1.15) brightness(.98); box-shadow: 0 6px 14px -10px rgba(76, 62, 170, .6); }
.badge-filter { padding: 6px 12px 6px 10px; font-size: .78rem; }
.badge-filter b { font-weight: 700; margin-left: 2px; opacity: .85; }
.badge-filter.is-current { box-shadow: 0 0 0 2px rgba(11, 16, 32, .75); }
.badge-plain::before { display: none; }
.badge-plain { padding-left: 10px; }

/* ==========================================================================
   Alertas e toast
   ========================================================================== */
.alert {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; padding: 12px 14px 12px 16px;
  border-radius: var(--r-md); border: 1px solid; font-weight: 500; font-size: .875rem;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: 0 12px 30px -24px rgba(40, 30, 110, .5);
}
.alert a { color: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.alert-success { background: rgba(229, 249, 241, .9); color: #0A6B50; border-color: #BDEBD9; }
.alert-error { background: rgba(255, 240, 243, .92); color: #A61B33; border-color: #FBCDD5; }
.alert-warning { background: rgba(255, 247, 230, .92); color: #7A4E06; border-color: #F6DCA4; }
.alert-info { background: rgba(240, 238, 255, .92); color: #3D24B8; border-color: #DCD3FF; }
.alert button {
  background: rgba(255, 255, 255, .6); border: 0; cursor: pointer; color: inherit; font-size: 1.1rem; line-height: 1;
  width: 28px; height: 28px; border-radius: 50%; flex: none; display: grid; place-items: center;
}
.alert button:hover { background: #fff; }
#toast {
  position: fixed; right: 20px; bottom: 20px; z-index: 400; max-width: min(420px, calc(100vw - 40px));
  display: flex; align-items: center; gap: 10px; padding: 11px 18px 11px 14px; border-radius: 999px;
  background: var(--ink); color: #fff; font-weight: 600; font-size: .86rem;
  box-shadow: 0 18px 40px -16px rgba(11, 16, 32, .6); opacity: 0; transform: translateY(8px);
  transition: opacity .2s ease, transform .2s ease; pointer-events: none;
}
#toast::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #5EEAD4; flex: none; box-shadow: 0 0 0 4px rgba(94, 234, 212, .18); }
#toast.show { opacity: 1; transform: none; }
#toast.error { background: #BE123C; }
#toast.error::before { background: #FECDD3; box-shadow: 0 0 0 4px rgba(254, 205, 211, .25); }

/* ==========================================================================
   Formulários
   ========================================================================== */
:where(input:not([type=checkbox], [type=radio], [type=file], [type=color], [type=hidden], [type=range], [type=submit], [type=button])),
:where(select, textarea) {
  width: 100%; padding: 9px 13px; min-height: 40px; font: inherit; font-size: .875rem; color: var(--text);
  background: var(--field); border: 1px solid var(--line-2); border-radius: var(--r-sm);
  box-shadow: inset 0 1px 2px rgba(31, 36, 55, .04); transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
input::placeholder, textarea::placeholder { color: #8A91A6; opacity: 1; }
:where(input:not([type=checkbox], [type=radio], [type=file], [type=color]), select, textarea):hover { border-color: rgba(31, 36, 55, .2); }
:where(input:not([type=checkbox], [type=radio], [type=file]), select, textarea):focus { outline: none; border-color: var(--violet); background-color: #fff; box-shadow: var(--ring); }
:where(input:disabled, input[readonly], select:disabled, textarea:disabled) { background: rgba(243, 242, 250, .8); color: var(--text-2); cursor: not-allowed; }
:where(select) {
  appearance: none; -webkit-appearance: none; padding-right: 36px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235B6275' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 16px;
}
:where(textarea) { min-height: 110px; resize: vertical; line-height: 1.55; }
input[type=file] { font: inherit; font-size: .82rem; color: var(--text-2); max-width: 100%; }
input[type=file]::file-selector-button {
  font: inherit; font-weight: 600; font-size: .8rem; margin-right: 10px; padding: 7px 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line-2); background: rgba(255, 255, 255, .9); color: var(--ink);
}
input[type=file]::file-selector-button:hover { border-color: rgba(124, 92, 255, .4); }
input[type=checkbox], input[type=radio] { accent-color: var(--violet-ic); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 16px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 760px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }
.field { min-width: 0; }
.field + .field, .field + .btn-block, .field + button { margin-top: 14px; }
.form-grid > .field + .field { margin-top: 0; }
.field > label:not(.check):not(.btn), .field > .field-label { display: block; margin-bottom: 6px; font-size: .8rem; font-weight: 600; color: var(--ink); letter-spacing: -.003em; }
.field .hint { display: block; font-size: .76rem; color: var(--text-3); margin-top: 5px; }
.field .error { display: block; color: #BE123C; font-size: .76rem; font-weight: 500; margin-top: 5px; }
.field.has-error input, .field.has-error textarea, .field.has-error select { border-color: #F43F5E; box-shadow: 0 0 0 4px rgba(244, 63, 94, .1); }
.field input[type=color], input[type=color] {
  width: 56px; height: 40px; padding: 4px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: #fff; cursor: pointer;
}
.field-sep { padding-top: 6px; }
.field-sep h3 { margin: 8px 0 0; }
.check { display: inline-flex; gap: 10px; align-items: center; font-size: .86rem; color: var(--text); cursor: pointer; }
.check input { width: 17px; height: 17px; margin: 0; flex: none; }
.check-bool { padding-top: 26px; }
.check-list { display: flex; flex-wrap: wrap; gap: 8px; }
.check-list .check {
  padding: 7px 12px 7px 10px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255, 255, 255, .7);
  font-size: .82rem; transition: background .15s ease, border-color .15s ease;
}
.check-list .check:hover { border-color: rgba(124, 92, 255, .35); }
.check-list .check:has(input:checked) { background: var(--violet-bg); border-color: rgba(124, 92, 255, .35); color: #3D1FC4; font-weight: 600; }
.switch { position: relative; display: inline-block; width: 40px; height: 24px; flex: none; vertical-align: middle; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch i {
  position: absolute; inset: 0; border-radius: 999px; cursor: pointer; background: #D6D8E4;
  box-shadow: inset 0 1px 2px rgba(31, 36, 55, .12); transition: background .2s ease;
}
.switch i::before {
  content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; border-radius: 50%; background: #fff;
  box-shadow: 0 2px 6px rgba(31, 36, 55, .25); transition: transform .2s ease;
}
.switch input:checked + i { background: var(--grad); }
.switch input:checked + i::before { transform: translateX(16px); }
.switch input:focus-visible + i { box-shadow: var(--ring); }
/* Botões de etapa (lead / proposta): o atual fica marcado e não reenvia o mesmo status */
.status-switch .btn.is-current { opacity: 1; cursor: default; transform: none; box-shadow: inset 0 0 0 1px rgba(124, 92, 255, .35); }
.status-switch .btn.is-current .icon { width: 13px; height: 13px; }
.status-switch .btn.is-current:hover { background: var(--violet-bg); color: #4B2BD6; }
.status-switch .btn.is-current:active { transform: none; }
.input-group { display: flex; }
.input-group input { border-radius: var(--r-sm) 0 0 var(--r-sm); }
.input-group .btn { border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.input-inline { width: auto !important; }
.select-sm { width: auto !important; min-height: 34px !important; padding-top: 6px !important; padding-bottom: 6px !important; font-size: .82rem !important; border-radius: 999px !important; }
.form-actions {
  display: flex; gap: 10px; justify-content: space-between; align-items: center; flex-wrap: wrap;
  padding-top: 16px; margin-top: 20px; border-top: 1px solid var(--line);
}
.form-actions > .small { flex: 1; min-width: 200px; }
.sticky-actions { position: sticky; bottom: 12px; z-index: 5; padding: 12px; margin-top: 16px; border-radius: 18px; background: rgba(255, 255, 255, .78); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }

/* Abas em pílula (data-tabs e links) */
.tabs, .pill-tabs {
  display: inline-flex; gap: 2px; padding: 4px; max-width: 100%; overflow-x: auto; border-radius: 999px;
  background: rgba(31, 36, 55, .05); border: 1px solid rgba(255, 255, 255, .7); box-shadow: inset 0 1px 2px rgba(31, 36, 55, .05);
}
.tabs { margin-bottom: 20px; }
.tabs button, .tabs a, .pill-tabs a {
  flex: none; border: 0; background: transparent; padding: 7px 15px; border-radius: 999px; cursor: pointer;
  font: inherit; font-size: .82rem; font-weight: 600; color: var(--text-2); white-space: nowrap; text-decoration: none !important;
  transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}
.tabs button:hover, .tabs a:hover, .pill-tabs a:hover { color: var(--ink); background: rgba(255, 255, 255, .55); }
.tabs button.active, .tabs a.active, .pill-tabs a.active {
  background: #fff; color: var(--ink); box-shadow: 0 6px 16px -10px rgba(76, 62, 170, .55), 0 0 0 1px rgba(31, 36, 55, .04);
}
.tab-pane { display: none; }
.tab-pane.active { display: block; animation: fadeIn .18s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }

/* Campo de imagem */
.image-field { display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap; }
.image-field .preview {
  width: 128px; height: 92px; border-radius: var(--r-md); flex: none; display: grid; place-items: center;
  border: 1.5px dashed rgba(124, 92, 255, .35); background: var(--grad-soft) center / cover no-repeat; color: var(--violet-ic);
}
.image-field .preview[style*="background-image"] { border-style: solid; border-color: rgba(255, 255, 255, .9); box-shadow: 0 10px 24px -16px rgba(76, 62, 170, .55); }
.image-field .preview .icon { width: 24px; height: 24px; }
.image-field .controls { flex: 1; min-width: 220px; display: grid; gap: 8px; }
.lines-field textarea { font-family: inherit; }
.icon-picker {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 6px; max-height: 196px; overflow: auto;
  padding: 8px; border-radius: var(--r-md); border: 1px solid var(--line); background: rgba(247, 246, 252, .7);
}
.icon-picker label {
  position: relative; display: grid; place-items: center; height: 40px; margin: 0; border-radius: 10px; cursor: pointer;
  border: 1px solid transparent; background: rgba(255, 255, 255, .9); transition: border-color .12s ease, background .12s ease;
}
.icon-picker label:hover { border-color: rgba(124, 92, 255, .35); }
.icon-picker input { position: absolute; inset: 0; opacity: 0; cursor: pointer; margin: 0; }
.icon-picker .icon { width: 19px; height: 19px; color: var(--text-2); }
.icon-picker input:checked + .icon { color: var(--violet-ic); }
.icon-picker label:has(input:checked) { background: var(--violet-bg); border-color: rgba(124, 92, 255, .5); box-shadow: 0 6px 14px -10px rgba(109, 74, 255, .7); }
.icon-picker label:has(input:focus-visible) { box-shadow: var(--ring); }

/* Editor de texto rico */
.rte { border: 1px solid var(--line-2); border-radius: var(--r-md); overflow: hidden; background: var(--field); transition: border-color .15s ease, box-shadow .15s ease; }
.rte:focus-within { border-color: var(--violet); box-shadow: var(--ring); }
/* Barra do editor: grupos em pílula que quebram linha sem deixar separadores soltos */
/* Uma linha só: se faltar espaço, a barra rola na horizontal em vez de quebrar */
.rte-toolbar {
  display: flex; flex-wrap: nowrap; gap: 4px; padding: 5px; overflow-x: auto; overscroll-behavior-x: contain;
  border-bottom: 1px solid var(--line); background: rgba(247, 246, 252, .85); scrollbar-width: thin; scrollbar-color: rgba(91, 98, 117, .28) transparent;
}
.rte-toolbar .rte-group {
  display: inline-flex; flex: none; flex-wrap: nowrap; gap: 1px; padding: 2px; border-radius: 10px;
  background: rgba(255, 255, 255, .7); border: 1px solid var(--line);
}
.rte-toolbar button {
  border: 0; background: transparent; padding: 5px 6px; border-radius: 8px; cursor: pointer; min-height: 0;
  font: inherit; font-size: .76rem; font-weight: 600; color: var(--text); white-space: nowrap;
}
.rte-toolbar button:hover { background: #fff; color: var(--violet-ic); box-shadow: 0 4px 10px -8px rgba(76, 62, 170, .6); }
.rte-toolbar .sep { display: none; }
.rte-editor { min-height: 260px; padding: 16px 18px; outline: none; line-height: 1.7; font-size: .94rem; color: var(--text); background: #fff; }
.rte-editor h2 { font-size: 1.3rem; margin-top: 1em; }
.rte-editor h3 { font-size: 1.08rem; }
.rte-editor img { max-width: 100%; border-radius: 10px; }
.rte-editor blockquote { border-left: 3px solid var(--violet); padding-left: 14px; color: var(--text-2); margin: 1em 0; }
.rte .rte-source, textarea.rte-source {
  display: none; width: 100%; min-height: 260px; border: 0; border-radius: 0; box-shadow: none; padding: 14px 16px;
  font-family: var(--mono); font-size: .8rem; resize: vertical; background: #FBFAFE;
}
.rte.source .rte-editor { display: none; }
.rte.source .rte-source { display: block; }
.code-input { font-family: var(--mono) !important; font-size: .8rem !important; }

/* ==========================================================================
   Menus suspensos, modal e mídia
   ========================================================================== */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 10px); z-index: 60; display: none; min-width: 290px; max-width: min(380px, calc(100vw - 24px));
  max-height: min(520px, calc(100vh - 100px)); overflow: auto; padding: 6px;
  background: #FDFCFF; border: 1px solid rgba(124, 92, 255, .12); border-radius: 18px; box-shadow: var(--shadow-pop);
}
.dropdown-menu.is-compact { min-width: 220px; }
.dropdown.open .dropdown-menu { display: block; animation: pop .14s ease; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
.dropdown-menu a, .dropdown-menu .item {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 12px; color: var(--text); font-size: .85rem; text-decoration: none;
}
.dropdown-menu a .icon { color: var(--text-2); }
.dropdown-menu a:hover { background: rgba(124, 92, 255, .07); color: var(--ink); text-decoration: none; }
.dropdown-menu a:hover .icon { color: var(--violet-ic); }
.dropdown-menu .item.muted { color: var(--text-2); justify-content: center; padding: 18px 12px; }
.dropdown-menu .menu-title { padding: 8px 12px 6px; font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: var(--text-3); }
.dropdown-menu .menu-user { padding: 10px 12px 8px; display: flex; align-items: center; gap: 10px; min-width: 0; }
.dropdown-menu .menu-user .avatar { width: 34px; height: 34px; font-size: .74rem; }
.dropdown-menu .menu-user > div { min-width: 0; }
.dropdown-menu .menu-user strong { display: block; font-size: .86rem; font-weight: 600; color: var(--ink); line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropdown-menu .menu-user small { display: block; font-size: .76rem; color: var(--text-2); text-transform: none; letter-spacing: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropdown-menu .menu-sep { height: 1px; background: var(--line); margin: 6px 4px; }
.dropdown-menu .menu-foot { justify-content: center; font-weight: 600; color: var(--violet-ink); margin-top: 2px; border-top: 1px solid var(--line); border-radius: 0 0 12px 12px; }
/* Notificações: título e "Ver todas" sempre visíveis; só a lista rola */
.dropdown-menu.is-notif { overflow: hidden; flex-direction: column; }
.dropdown.open .dropdown-menu.is-notif { display: flex; }
.dropdown-menu.is-notif .menu-title, .dropdown-menu.is-notif .menu-foot { flex: none; }
.dropdown-menu.is-notif .menu-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: rgba(91, 98, 117, .28) transparent; }
.dropdown-menu.is-notif .menu-foot { background: #FDFCFF; padding-top: 11px; padding-bottom: 9px; }
.dropdown-menu form.item { padding: 0; }
.dropdown-menu form.item .btn { justify-content: flex-start; padding: 9px 12px; min-height: 0; border-radius: 12px; font-weight: 500; font-size: .85rem; color: var(--text); }
.dropdown-menu form.item .btn .icon { color: var(--text-2); width: 14px; height: 14px; }
.dropdown-menu form.item .btn:hover { background: #FFF1F3; color: #BE123C; }
.dropdown-menu form.item .btn:hover .icon { color: #BE123C; }
.notif { display: block !important; position: relative; padding-left: 26px !important; }
.notif::before { content: ""; position: absolute; left: 11px; top: 15px; width: 7px; height: 7px; border-radius: 50%; background: #D6D8E4; }
.notif.unread::before { background: var(--violet); box-shadow: 0 0 0 3px rgba(124, 92, 255, .16); }
.notif strong { display: block; font-size: .84rem; color: var(--ink); font-weight: 600; }
.notif span { display: block; color: var(--text-2); font-size: .76rem; margin-top: 1px; }
.notif.unread { background: rgba(124, 92, 255, .05); }
.modal {
  position: fixed; inset: 0; z-index: 200; display: none; place-items: center; padding: 20px;
  background: rgba(30, 24, 70, .22); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.modal.open { display: grid; }
.modal-box {
  width: min(980px, 100%); max-height: 88vh; overflow: auto; padding: 22px; border-radius: var(--r-panel);
  background: rgba(255, 255, 255, .9); border: 1px solid rgba(255, 255, 255, .95); box-shadow: var(--shadow-pop);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px); animation: pop .16s ease;
}
.modal-box .media-search { width: 220px; min-height: 34px; border-radius: 999px; padding: 6px 14px; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.media-item {
  position: relative; overflow: hidden; cursor: pointer; border-radius: 16px; background: var(--glass-strong);
  border: 1px solid var(--glass-border); box-shadow: var(--shadow-card); transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.media-item:hover { transform: translateY(-2px); border-color: rgba(124, 92, 255, .4); box-shadow: 0 20px 40px -26px rgba(76, 62, 170, .6); }
.media-item.is-static { cursor: default; }
.media-item .mt { aspect-ratio: 1; display: grid; place-items: center; color: var(--violet-ic); background: var(--grad-soft) center / cover no-repeat; font-size: 1.6rem; }
.media-item .mn { padding: 8px 10px 6px; font-size: .74rem; color: var(--text); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.media-item .mn small { display: block; font-size: .68rem; color: var(--text-3); font-weight: 400; }
.media-item .media-actions { display: flex; gap: 4px; padding: 0 8px 9px; }
.media-item .media-actions form { margin-left: auto; }
.media-item .del { position: absolute; top: 6px; right: 6px; display: none; width: 26px; height: 26px; border: 0; border-radius: 8px; cursor: pointer; background: rgba(255, 255, 255, .92); color: var(--danger); }
.media-item:hover .del { display: grid; place-items: center; }
.dropzone {
  padding: 26px 20px; text-align: center; color: var(--text-2); cursor: pointer; font-size: .86rem;
  border: 1.5px dashed rgba(124, 92, 255, .35); border-radius: var(--r-card); background: rgba(255, 255, 255, .5);
  transition: background .15s ease, border-color .15s ease;
}
.dropzone .icon { display: block; margin: 0 auto 8px; width: 40px; height: 40px; padding: 10px; border-radius: 13px; background: var(--violet-bg); color: var(--violet-ic); }
.dropzone:hover, .dropzone.over { border-color: var(--violet); background: rgba(238, 232, 255, .6); }

/* ==========================================================================
   Kanban
   ========================================================================== */
.kanban {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(268px, 1fr); gap: 12px; align-items: stretch;
  overflow-x: auto; padding: 2px 2px 14px; margin: 0 -2px;
}
.kanban-col {
  --col: #8A91A6; min-height: 420px; padding: 12px 10px 10px; border-radius: var(--r-card);
  background: rgba(255, 255, 255, .42); border: 1px solid var(--glass-border); box-shadow: var(--shadow-card);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); transition: background .15s ease, box-shadow .15s ease;
}
.kanban-col[data-status=novo] { --col: #1D52E5; }
.kanban-col[data-status=contatado] { --col: #4F46E5; }
.kanban-col[data-status=qualificado] { --col: #7C5CFF; }
.kanban-col[data-status=proposta] { --col: #D99A1E; }
.kanban-col[data-status=ganho] { --col: #0F9F8E; }
.kanban-col[data-status=perdido] { --col: #E11D48; }
.kanban-col h3 {
  display: flex; align-items: center; gap: 8px; margin: 0 4px 12px; padding: 2px 0;
  font-size: .8rem; font-weight: 700; letter-spacing: -.005em; text-transform: none; color: var(--ink);
}
.kanban-col h3::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--col); box-shadow: 0 0 0 4px color-mix(in srgb, var(--col) 16%, transparent); flex: none; }
.kanban-col h3 .count {
  margin-left: auto; min-width: 24px; padding: 3px 8px; border-radius: 999px; text-align: center;
  font-size: .72rem; font-weight: 700; color: var(--text-2); background: rgba(255, 255, 255, .85); border: 1px solid var(--line);
}
.kanban-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; min-height: 60px; align-content: start; }
/* Quadro limitado à altura da tela (também no celular): cada coluna rola por dentro e a barra horizontal fica sempre visível */
.kanban-col { display: flex; flex-direction: column; min-height: 320px; max-height: max(360px, calc(100vh - 272px)); }
.kanban-col h3 { flex: none; }
.kanban-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; margin: 0 -6px; padding: 2px 6px 6px; scrollbar-width: thin; scrollbar-color: rgba(91, 98, 117, .28) transparent; }
@media (max-width: 720px) { .kanban-col { min-height: 260px; max-height: max(340px, calc(100svh - 250px)); } }
/* A partir de 1280 px as 6 etapas cabem lado a lado, com cards compactos */
@media (min-width: 1280px) {
  .kanban { grid-auto-columns: minmax(148px, 1fr); gap: 10px; }
  .kanban-col { padding: 11px 8px 8px; }
  .kanban-col h3 { font-size: .76rem; margin: 0 3px 10px; gap: 7px; }
  .kanban-col h3 .count { min-width: 22px; padding: 2px 7px; font-size: .7rem; }
  .kanban-card { padding: 10px 10px 10px 12px; font-size: .8rem; border-radius: 13px; }
  .kanban-card strong { font-size: .82rem; line-height: 1.3; }
  .kanban-card .small.muted { font-size: .76rem; }
  .kanban-card .meta { gap: 4px; margin-top: 7px; font-size: .68rem; }
  .kanban-card .meta span { padding: 1px 7px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
}
.kanban-card {
  min-width: 0; overflow-wrap: anywhere; padding: 12px 13px; border-radius: 14px; cursor: grab; font-size: .84rem; position: relative;
  background: rgba(255, 255, 255, .92); border: 1px solid rgba(255, 255, 255, .95);
  box-shadow: 0 10px 26px -20px rgba(60, 50, 150, .55), 0 1px 2px rgba(31, 36, 55, .05);
  transition: transform .15s ease, box-shadow .15s ease;
}
.kanban-card::before { content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 3px; border-radius: 0 3px 3px 0; background: var(--col); opacity: .8; }
.kanban-card:hover { transform: translateY(-2px); box-shadow: 0 18px 34px -22px rgba(60, 50, 150, .7), 0 1px 2px rgba(31, 36, 55, .05); }
.kanban-card:active { cursor: grabbing; }
.kanban-card strong { display: block; color: var(--ink); font-weight: 600; font-size: .86rem; padding-right: 26px; }
/* Mudar etapa sem arrastar (toque e teclado): select nativo com cara de botão de ícone no canto do card */
.kanban-card .kanban-move {
  position: absolute; top: 7px; right: 7px; width: 26px; height: 26px; min-height: 0; padding: 0; border-radius: 8px; cursor: pointer;
  color: transparent; font-size: .8rem; border: 1px solid transparent; background-color: transparent; box-shadow: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235B6275' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='16 3 21 3 21 8'/%3E%3Cline x1='4' y1='20' x2='21' y2='3'/%3E%3Cpolyline points='21 16 21 21 16 21'/%3E%3Cline x1='15' y1='15' x2='21' y2='21'/%3E%3Cline x1='4' y1='4' x2='9' y2='9'/%3E%3C/svg%3E");
  background-position: center; background-size: 14px; background-repeat: no-repeat;
}
.kanban-card .kanban-move option { color: var(--text); background: #fff; }
.kanban-card .kanban-move:hover, .kanban-card .kanban-move:focus { border-color: var(--line-2); background-color: #fff; }
.kanban-card .kanban-move:focus-visible { box-shadow: var(--ring); border-color: var(--violet); }
@media (hover: none) { .kanban-card .kanban-move { width: 34px; height: 34px; top: 4px; right: 4px; background-size: 16px; } .kanban-card strong { padding-right: 32px; } }
@media (hover: hover) and (pointer: fine) {
  .kanban-card .kanban-move { opacity: .45; }
  .kanban-card:hover .kanban-move, .kanban-card .kanban-move:focus { opacity: 1; }
}
.hint-touch { display: none; }
@media (hover: none), (max-width: 720px) { .hint-pointer { display: none; } .hint-touch { display: inline; } }
.kanban-card .small.muted { margin-top: 1px; }
.kanban-card .meta { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 8px; color: var(--text-2); font-size: .7rem; }
.kanban-card .meta span { padding: 2px 8px; border-radius: 999px; background: rgba(31, 36, 55, .05); white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.kanban-col.over { background: rgba(238, 232, 255, .7); box-shadow: 0 0 0 2px rgba(124, 92, 255, .5), var(--shadow-card); }

/* ==========================================================================
   Linha do tempo, conversas, progresso, gráficos
   ========================================================================== */
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.timeline li:last-child { border-bottom: 0; padding-bottom: 2px; }
.timeline .avatar { width: 34px; height: 34px; font-size: .72rem; }
.timeline .body { flex: 1; min-width: 0; font-size: .86rem; }
.timeline .body strong { font-size: .86rem; color: var(--ink); font-weight: 600; }
.timeline .body time { color: var(--text-3); font-size: .74rem; margin-left: 6px; }
.timeline .body p { margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.timeline .body .badge { margin-left: 4px; }
/* Feed de atividade (dashboard): frases em português e ícone pastel por tipo */
.feed { list-style: none; padding: 0; margin: 0; }
.feed li { display: flex; align-items: flex-start; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.feed li:first-child { padding-top: 2px; }
.feed li:last-child { border-bottom: 0; padding-bottom: 0; }
.feed .feed-icon {
  width: 34px; height: 34px; border-radius: 11px; flex: none; display: grid; place-items: center;
  background: var(--violet-bg); color: var(--violet-ic); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .8);
}
.feed .feed-icon .icon { width: 16px; height: 16px; }
.feed .feed-body { flex: 1; min-width: 0; min-height: 34px; display: flex; flex-direction: column; justify-content: center; font-size: .86rem; }
.feed .feed-line { display: flex; align-items: baseline; gap: 4px 10px; justify-content: space-between; }
.feed .feed-line > span { min-width: 0; color: var(--text); }
.feed .feed-line strong { color: var(--ink); font-weight: 600; }
.feed .feed-line time { flex: none; color: var(--text-3); font-size: .74rem; white-space: nowrap; }
.feed .feed-detail { display: block; margin-top: 1px; color: var(--text-2); font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed .feed-detail a { color: var(--text-2); font-weight: 500; }
.feed .feed-detail a:hover { color: var(--violet-ink); }
.feed .feed-count { display: inline-block; margin-left: 4px; padding: 0 7px; border-radius: 999px; background: rgba(31, 36, 55, .06); color: var(--text-2); font-size: .72rem; font-weight: 600; }
.avatar.is-done { background: var(--teal-bg) !important; color: var(--teal) !important; }
.is-done-text { text-decoration: line-through; color: var(--text-2) !important; }
.msg {
  max-width: 85%; margin-bottom: 12px; padding: 13px 16px; border-radius: 18px 18px 18px 6px;
  background: rgba(255, 255, 255, .9); border: 1px solid rgba(31, 36, 55, .06); box-shadow: 0 10px 24px -20px rgba(60, 50, 150, .5);
}
.msg.mine { margin-left: auto; border-radius: 18px 18px 6px 18px; background: linear-gradient(135deg, #F2EEFF, #EAF0FF); border-color: #E0D8FF; }
.msg.internal { background: #FFF8E8; border-color: #F8E2AE; }
.msg.wide { max-width: none; }
.msg .who { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; font-size: .76rem; color: var(--text-2); }
.msg .who strong { color: var(--ink); }
.msg p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%; flex: none; display: grid; place-items: center; overflow: hidden;
  font-weight: 700; font-size: .82rem; color: #4B2BD6; background: linear-gradient(135deg, #EDE7FF, #DFE8FF);
  border: 1px solid rgba(255, 255, 255, .9);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar .icon { width: 16px; height: 16px; }
.progress { height: 8px; border-radius: 999px; overflow: hidden; background: rgba(31, 36, 55, .07); box-shadow: inset 0 1px 2px rgba(31, 36, 55, .06); }
.progress i { display: block; height: 100%; border-radius: 999px; background: var(--grad); }
.progress-row { display: flex; align-items: center; gap: 10px; }
.progress-row .progress { flex: 1; }
.progress-row .small { min-width: 34px; text-align: right; font-weight: 600; color: var(--text-2); }
.project-line { padding: 10px 0; border-bottom: 1px solid var(--line); }
.project-line:first-child { padding-top: 0; }
.project-line:last-child { border-bottom: 0; padding-bottom: 0; }
.project-line .flex.between { margin-bottom: 6px; }
.score { display: inline-flex; align-items: center; gap: 8px; font-size: .78rem; font-weight: 700; color: var(--ink); }
.score i { display: inline-block; width: 44px; height: 6px; border-radius: 999px; overflow: hidden; background: rgba(31, 36, 55, .08); }
.score i::after { content: ""; display: block; height: 100%; width: var(--w); border-radius: 999px; background: var(--grad); }
.chart-wrap { position: relative; }
.chart { display: block; width: 100%; height: 240px; }
.chart-legend { display: inline-flex; gap: 14px; flex-wrap: wrap; font-size: .76rem; color: var(--text-2); font-weight: 500; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.chart-tip {
  position: absolute; z-index: 5; pointer-events: none; min-width: 170px; white-space: nowrap; padding: 8px 12px; border-radius: 12px;
  background: rgba(11, 16, 32, .92); color: #fff; font-size: .74rem; line-height: 1.5; box-shadow: 0 12px 30px -12px rgba(11, 16, 32, .6);
  opacity: 0; transform: translate(-50%, -6px); transition: opacity .12s ease;
}
.chart-tip.show { opacity: 1; }
.chart-tip b { display: block; font-weight: 700; margin-bottom: 2px; }
.chart-tip span { display: flex; align-items: center; gap: 14px; justify-content: space-between; }
.chart-tip span span { gap: 0; }
.chart-tip span i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 4px; }
.bar-list { list-style: none; padding: 0; margin: 0; }
.bar-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; align-items: center; padding: 6px 0; font-size: .84rem; }
.bar-list li > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.bar-list li strong { color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums; }
.bar-list li .bar { grid-column: 1 / -1; height: 6px; border-radius: 999px; overflow: hidden; background: rgba(31, 36, 55, .06); }
.bar-list li .bar i { display: block; height: 100%; min-width: 4px; border-radius: 999px; background: var(--grad); }
.bar-list li .bar i.is-zero, .bar-list li .bar i[style*="width:0%"] { min-width: 0; width: 0 !important; }
.bar-list li.is-zero > span:first-child, .bar-list li.is-zero strong { color: var(--text-3); font-weight: 500; }
.bar-list .path { font-size: .82rem; color: var(--text); }
.kv-list { display: grid; gap: 2px; }
.kv-list > div { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; font-size: .84rem; border-bottom: 1px dashed var(--line); }
.kv-list > div:last-child { border-bottom: 0; }
.kv-list span { color: var(--text-2); }
.kv-list strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.items-table td { padding: 8px 8px; vertical-align: top; }
.items-table td:first-child { padding-left: 12px; }
.items-table input { min-height: 36px !important; padding: 7px 10px !important; }
.items-table input[name="details[]"] { margin-top: 5px; font-size: .78rem !important; min-height: 32px !important; }
.items-table input[name="qty[]"] { width: 72px; }
.items-table input[name="unit_price[]"] { width: 130px; }
.items-table .line-total { white-space: nowrap; font-weight: 600; color: var(--ink); padding-top: 16px; font-variant-numeric: tabular-nums; }
.items-table td:last-child { padding-top: 12px; }
/* Itens da proposta no celular: descrição em largura total; qtd., valor, total e remover numa linha abaixo */
@media (max-width: 720px) {
  .items-table, .items-table tbody { display: block; width: 100%; }
  .items-table thead { display: none; }
  .items-table tbody tr {
    display: grid; grid-template-columns: 64px minmax(0, 1fr) auto auto; gap: 8px; align-items: end;
    padding: 12px; border-bottom: 1px solid var(--line);
  }
  .items-table tbody tr:last-child { border-bottom: 0; }
  .items-table td { display: block; padding: 0 !important; border: 0 !important; min-width: 0; }
  .items-table td:first-child { grid-column: 1 / -1; }
  .items-table td[data-label]::before { content: attr(data-label); display: block; margin: 0 0 4px 2px; font-size: .68rem; font-weight: 600; letter-spacing: .02em; color: var(--text-3); }
  .items-table input[name="qty[]"], .items-table input[name="unit_price[]"] { width: 100%; }
  .items-table .line-total { padding: 0 0 9px !important; text-align: right; font-size: .84rem; }
  .items-table td:last-child { padding-bottom: 2px !important; }
  .items-table td:last-child .btn { width: 32px; height: 32px; padding: 0; }
  .items-table tbody tr:hover { background: transparent; }
}
.totals {
  display: grid; gap: 8px; width: min(340px, 100%); margin-left: auto; font-size: .9rem; padding: 14px 16px; border-radius: var(--r-md);
  background: rgba(255, 255, 255, .6); border: 1px solid var(--line);
}
.totals > div { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.totals span { color: var(--text-2); }
.totals strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.totals #discount { width: 130px !important; min-height: 34px; padding: 6px 10px; text-align: right; }
.totals .grand { padding-top: 10px; border-top: 1px solid var(--line); font-size: 1.15rem; }
.totals .grand span { color: var(--ink); font-weight: 600; }
.totals .grand strong { font-size: 1.3rem; font-weight: 700; letter-spacing: -.02em; }
.filters-bar {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; padding: 8px;
  border-radius: 18px; background: rgba(255, 255, 255, .42); border: 1px solid var(--glass-border);
}
.filters-bar input, .filters-bar select { width: auto; flex: 1 1 160px; max-width: 280px; min-height: 36px; padding-top: 7px; padding-bottom: 7px; border-radius: 999px; font-size: .84rem; }
.filters-bar input[type=search] { flex: 2 1 220px; max-width: 340px; padding-left: 36px;
  background: var(--field) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23636A7F' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 13px center / 15px;
}
.filters-bar select { padding-left: 14px; flex: 1 1 140px; max-width: 240px; min-width: 0; text-overflow: ellipsis; }
.filters-bar input[type=search] { min-width: 0; }
.filters-bar .filters-actions { display: flex; align-items: center; gap: 4px; flex: none; margin-left: auto; }
.status-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.search-inline { width: 240px !important; min-height: 38px !important; border-radius: 999px !important; padding-left: 36px !important;
  background: var(--field) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23636A7F' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 13px center / 15px !important;
}
.pagination { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; margin-top: 16px; }
.page-link {
  display: inline-flex; align-items: center; justify-content: center; min-width: 34px; height: 34px; padding: 0 12px; border-radius: 999px;
  font-size: .8rem; font-weight: 600; color: var(--text); background: rgba(255, 255, 255, .72); border: 1px solid var(--line);
}
a.page-link:hover { background: #fff; border-color: rgba(124, 92, 255, .4); text-decoration: none; color: var(--ink); }
.page-link.current { background: var(--ink); color: #fff; border-color: var(--ink); }
.page-dots { padding: 7px 4px; color: var(--text-3); }
.kv { display: grid; grid-template-columns: minmax(110px, 140px) minmax(0, 1fr); gap: 8px 14px; margin: 0; font-size: .86rem; }
.kv dt { color: var(--text-2); }
.kv dd { margin: 0; font-weight: 500; color: var(--ink); overflow-wrap: anywhere; }
.kv-cols { list-style: none; margin: 0; padding: 0; columns: 4 190px; column-gap: 32px; }
.kv-cols li { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--line); break-inside: avoid; }
.kv-cols li .code-id { font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; }
.kv-cols li strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.kv.kv-auto { grid-template-columns: minmax(0, 1fr) auto; }
.kv.kv-auto dd { text-align: right; font-variant-numeric: tabular-nums; }
pre.log {
  margin: 0; padding: 14px 16px; max-height: 480px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere;
  font-family: var(--mono); font-size: .74rem; line-height: 1.6; color: #2A3045;
  background: rgba(247, 246, 252, .9); border: 1px solid var(--line); border-radius: var(--r-md);
}
pre.log.short { max-height: 90px; }
pre.log .log-entry { display: block; padding: 6px 0; border-bottom: 1px dashed var(--line-2); }
pre.log .log-entry:first-child { padding-top: 0; }
pre.log .log-entry:last-child { border-bottom: 0; padding-bottom: 0; }
pre.log .log-head { color: var(--ink); }
pre.log .has-trace .log-head { font-weight: 600; }
.search-results li { padding: 9px 0; border-bottom: 1px solid var(--line); }
.search-results li:last-child { border-bottom: 0; }
.task-list { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 4px; }
.task-list li { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 4px 6px; border-radius: 10px; }
.task-list li:hover { background: rgba(255, 255, 255, .6); }
.task-list form.grow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: .85rem; }

/* ==========================================================================
   Login, recuperação e instalador
   ========================================================================== */
.auth-body {
  min-height: 100vh; display: grid; place-items: center; padding: 32px 16px; position: relative; overflow: hidden;
  background:
    radial-gradient(1200px 700px at 12% -10%, #E6E0FF 0%, rgba(230, 224, 255, 0) 60%),
    radial-gradient(900px 600px at 100% 100%, #DCE7FF 0%, rgba(220, 231, 255, 0) 60%),
    radial-gradient(700px 500px at 85% 10%, #F6E8FF 0%, rgba(246, 232, 255, 0) 60%),
    #F3F2FA;
}
.auth-body::before, .auth-body::after { display: none; }
.auth-bg { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.auth-orb { position: absolute; pointer-events: none; border-radius: 50%; }
.auth-orb.o1 {
  width: 260px; height: 260px; left: max(4vw, calc(50% - 560px)); top: 12vh;
  background:
    radial-gradient(circle at 32% 28%, rgba(255, 255, 255, .95) 0 8%, rgba(255, 255, 255, 0) 22%),
    radial-gradient(circle at 70% 75%, rgba(167, 139, 250, .55), rgba(167, 139, 250, 0) 55%),
    radial-gradient(circle at 30% 80%, rgba(91, 140, 255, .40), rgba(91, 140, 255, 0) 50%),
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, .35), rgba(230, 224, 255, .55) 70%, rgba(255, 255, 255, .8) 100%);
  box-shadow: inset -18px -24px 60px rgba(124, 92, 255, .25), inset 14px 18px 40px rgba(255, 255, 255, .9), 0 40px 80px -40px rgba(76, 62, 170, .45);
  border: 1px solid rgba(255, 255, 255, .8);
}
.auth-orb.o2 {
  width: 150px; height: 150px; right: max(5vw, calc(50% - 520px)); bottom: 14vh;
  background:
    radial-gradient(circle at 35% 30%, rgba(255, 255, 255, .95) 0 9%, rgba(255, 255, 255, 0) 24%),
    radial-gradient(circle at 65% 70%, rgba(246, 168, 220, .45), rgba(246, 168, 220, 0) 55%),
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, .3), rgba(220, 231, 255, .6) 70%, rgba(255, 255, 255, .85) 100%);
  box-shadow: inset -12px -16px 40px rgba(91, 140, 255, .25), inset 10px 12px 28px rgba(255, 255, 255, .9), 0 30px 60px -30px rgba(76, 62, 170, .4);
  border: 1px solid rgba(255, 255, 255, .8);
}
.auth-orb.o3 {
  width: 64px; height: 64px; right: max(12vw, calc(50% - 400px)); top: 16vh; border-radius: 22px; transform: rotate(18deg);
  background: linear-gradient(135deg, rgba(255, 255, 255, .9), rgba(214, 205, 255, .55) 55%, rgba(200, 220, 255, .7));
  box-shadow: inset -6px -8px 18px rgba(124, 92, 255, .22), inset 4px 6px 12px rgba(255, 255, 255, .95), 0 20px 40px -20px rgba(76, 62, 170, .45);
  border: 1px solid rgba(255, 255, 255, .85);
}
.auth-card {
  position: relative; z-index: 1; width: min(440px, 100%); padding: 34px 34px 28px;
  background: rgba(255, 255, 255, .6); border: 1px solid rgba(255, 255, 255, .85); border-radius: 28px;
  box-shadow: 0 40px 100px -40px rgba(76, 62, 170, .4), inset 0 1px 0 rgba(255, 255, 255, .95);
  backdrop-filter: blur(28px) saturate(150%); -webkit-backdrop-filter: blur(28px) saturate(150%);
}
.auth-card.wide { width: min(760px, 100%); }
.auth-logo { display: flex; justify-content: center; margin: 0 0 26px; }
.auth-logo a, .auth-logo { color: var(--ink); }
.auth-logo img, .auth-logo .logo { height: 34px; width: 138px; }
.auth-card h1 { font-size: 1.55rem; text-align: center; margin-bottom: 6px; }
.auth-card h1 + p, .auth-card .auth-sub { text-align: center; color: var(--text-2); font-size: .9rem; margin-bottom: 22px; }
.auth-card .field { margin-bottom: 14px; }
.auth-card .field + .field { margin-top: 0; }
.auth-card .form-grid .field { margin-bottom: 0; }
.auth-card input:not([type=checkbox]) { min-height: 44px; background: rgba(255, 255, 255, .85); }
.auth-card .btn-primary { min-height: 46px; font-size: .92rem; }
.auth-card .table { background: rgba(255, 255, 255, .55); border-radius: var(--r-md); overflow: hidden; }
.auth-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin: 6px 0 20px; }
.auth-foot { margin: 20px 0 0; text-align: center; font-size: .82rem; color: var(--text-2); }
.auth-foot a { color: var(--text-2); font-weight: 600; }
.auth-foot a:hover { color: var(--ink); }
.auth-eyebrow { display: flex; justify-content: center; margin-bottom: 10px; }
.auth-eyebrow span { font-size: .68rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--violet-ic); background: var(--violet-bg); padding: 4px 10px; border-radius: 999px; }
.mt-btn { margin-top: 16px; }

/* ==========================================================================
   Responsivo
   ========================================================================== */
@media (max-width: 1024px) {
  .app { grid-template-columns: minmax(0, 1fr); padding: 10px; }
  /* Gaveta off-canvas: fechada fica fora da tela E fora da ordem de tabulação (visibility) */
  .sidebar {
    position: fixed; left: 10px; top: 10px; bottom: 10px; height: auto; width: min(290px, calc(100vw - 48px));
    background: rgba(255, 255, 255, .94); transform: translateX(calc(-100% - 24px)); visibility: hidden;
    transition: transform .24s cubic-bezier(.2, .8, .2, 1), visibility 0s linear .24s;
    box-shadow: 0 40px 100px -30px rgba(40, 30, 110, .45); overscroll-behavior: contain;
  }
  .sidebar.open { transform: none; visibility: visible; transition: transform .24s cubic-bezier(.2, .8, .2, 1), visibility 0s; }
  .sidebar .sidebar-close { display: grid; }
  .overlay.show { display: block; }
  .menu-btn { display: grid; }
  .topbar { top: 10px; }
  .content { padding: 18px 2px 32px; }
}
@media (max-width: 720px) {
  body { font-size: 14px; }
  .topbar { gap: 8px; padding: 8px; min-height: 56px; border-radius: 18px; }
  .topbar .search input { height: 38px; }
  .topbar .actions { gap: 6px; }
  .topbar .actions .btn-site { display: none; }
  .topbar .actions .btn-cta span { display: none; }
  .topbar .actions .btn-cta { width: 38px; padding: 0; }
  .user-menu { padding: 3px; }
  .user-menu span:not(.avatar), .user-menu > .icon { display: none; }
  .icon-btn { width: 38px; height: 38px; }
  h1 { font-size: 1.45rem; }
  .page-head { align-items: flex-start; }
  .page-head > .flex, .page-head > form, .page-head > .btn { width: 100%; }
  /* CTA principal: mesmo comportamento em todas as telas (ocupa o espaço que sobra na linha) */
  .page-head > .flex > .btn-primary, .page-head > .flex > form > .btn-primary { flex: 1 1 auto; }
  .page-head > .flex > form:has(> .btn-primary) { flex: 1 1 auto; display: flex; }
  /* Tabela empilhada dentro de cartão: sem a segunda borda (cartão dentro de cartão) */
  .card .table-wrap:has(> .table-stack) { border: 0; border-radius: 0; background: transparent; margin: 0 -4px; }
  .card .table-wrap:has(> .table-stack) .table-stack tbody tr { padding-left: 4px; padding-right: 4px; }
  .card { padding: 16px; border-radius: 18px; }
  .stat strong { font-size: 1.3rem; }
  .table th, .table td { padding: 10px 12px; }
  .msg { max-width: 100%; }
  .kv { grid-template-columns: minmax(96px, 120px) minmax(0, 1fr); }
  .filters-bar input, .filters-bar select, .filters-bar input[type=search] { max-width: none; flex-basis: 100%; }
  .search-inline { width: 100% !important; }
  .page-head .flex form:has(.search-inline) { flex: 1 1 100%; }
  .kanban { grid-auto-columns: minmax(78vw, 1fr); }
  .dropdown-menu { position: fixed; left: 10px; right: 10px; top: 76px; max-width: none; min-width: 0; }
  .auth-card { padding: 28px 20px 22px; border-radius: 24px; }
  .auth-orb.o1 { width: 180px; height: 180px; left: -60px; top: 4vh; }
  .auth-orb.o2 { width: 110px; height: 110px; right: -30px; bottom: 4vh; }
  .auth-orb.o3 { display: none; }
  .totals { width: 100%; }
  .modal-box { padding: 16px; }
  .modal-box .media-search { width: 100%; }
  #toast { left: 16px; right: 16px; bottom: 16px; max-width: none; border-radius: 18px; }
}
@media (max-width: 560px) {
  .topbar .context .avatar, .topbar .context .badge { display: none; }
}
@media (max-width: 420px) {
  .topbar .search { min-width: 0; }
  .topbar .search input { padding-left: 34px; font-size: .82rem; }
  .topbar .search .icon { left: 12px; }
}

/* Movimento reduzido */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Impressão */
@media print {
  body { background: #fff; }
  body::before, body::after, .auth-orb { display: none; }
  .sidebar, .topbar, .no-print, .form-actions, .overlay { display: none !important; }
  .app { grid-template-columns: 1fr; padding: 0; }
  .content { padding: 0; }
  .card, .table-wrap { box-shadow: none; backdrop-filter: none; border-color: #ddd; background: #fff; }
}
