/* ==========================================================================
   ANEXOR — Design System
   Branco predominante · bege suave · cinzas neutros · roxo elegante
   ========================================================================== */

:root {
  /* Cor */
  --accent: #057AFF;
  --accent-strong: #0064DB;
  --accent-soft: #E3F0FF;
  --accent-softer: #F0F7FF;
  --accent-text: #0A5BC4;

  --bg: #FAF9F7;            /* bege extremamente suave */
  --surface: #FFFFFF;
  --surface-2: #FCFBFA;
  --ink: #1C1A24;           /* texto principal */
  --ink-2: #6B6877;         /* texto secundário */
  --ink-3: #9A97A5;         /* texto terciário */
  --line: #ECEAE6;          /* bordas */
  --line-2: #F3F1ED;

  --green: #2E8F5B;  --green-soft: #EBF6EF;
  --red: #C8513F;    --red-soft: #FBEFEC;
  --amber: #A9762A;  --amber-soft: #FBF4E6;
  --blue: #3D6FA8;   --blue-soft: #EDF3FA;

  /* Tipografia */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 'Sora', var(--font);

  /* Forma */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;

  --shadow-sm: 0 1px 2px rgba(28, 26, 36, 0.05);
  --shadow-md: 0 2px 8px rgba(28, 26, 36, 0.06), 0 1px 2px rgba(28, 26, 36, 0.04);
  --shadow-lg: 0 12px 40px rgba(28, 26, 36, 0.12), 0 2px 8px rgba(28, 26, 36, 0.05);
  --shadow-pop: 0 24px 64px rgba(28, 26, 36, 0.18), 0 4px 16px rgba(28, 26, 36, 0.08);

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --sidebar-w: 248px;
}

[data-theme="dark"] {
  --accent: #3D93FF;
  --accent-strong: #5FA8FF;
  --accent-soft: #122A47;
  --accent-softer: #0F2238;
  --accent-text: #74B0FF;

  --bg: #141318;
  --surface: #1C1A22;
  --surface-2: #211F28;
  --ink: #F0EEF4;
  --ink-2: #A09DAC;
  --ink-3: #6E6B7A;
  --line: #2B2933;
  --line-2: #25232D;

  --green: #5BBE8A;  --green-soft: #1C2B23;
  --red: #E2806F;    --red-soft: #32211E;
  --amber: #D9A95C;  --amber-soft: #2F2819;
  --blue: #7AA5D8;   --blue-soft: #1D2733;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.3);
  --shadow-md: 0 2px 8px rgba(0,0,0,.35), 0 1px 2px rgba(0,0,0,.25);
  --shadow-lg: 0 12px 40px rgba(0,0,0,.5);
  --shadow-pop: 0 24px 64px rgba(0,0,0,.6);
}

/* ============ Reset ============ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
::selection { background: var(--accent-soft); color: var(--accent-text); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 8px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--ink-3); border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ============ Layout ============ */
.app { display: flex; height: 100vh; height: 100dvh; }

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.view {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden; /* pequenos vazamentos não geram scroll lateral da página */
  padding: 8px 40px 64px;
  scroll-behavior: smooth;
}
.view-inner { max-width: 1120px; margin: 0 auto; animation: viewIn .35s var(--ease) both; }
@keyframes viewIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

/* ============ Sidebar ============ */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: var(--surface);
  padding: 20px 12px 16px;
  z-index: 60;
  transition: transform .32s var(--ease);
}

.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 8px 22px;
}
.brand-logo {
  height: 40px; width: auto; max-width: 100%;
  filter: drop-shadow(0 3px 8px rgba(5, 122, 255, .30));
}
.sidebar-nav { flex: 1; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.nav-section {
  font-size: 10.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-3); padding: 16px 10px 6px;
}
.nav-section:first-child { padding-top: 0; }
/* Divisória entre os grupos (Geral / Vendas / Trabalho / Ferramentas) */
.nav-section.nav-sep { border-top: 1px solid var(--line-2); margin-top: 12px; }

.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 7.5px 10px;
  border-radius: var(--r-sm);
  font-weight: 500; font-size: 13.5px;
  color: var(--ink-2);
  cursor: pointer;
  transition: background .15s ease, color .15s ease, transform .15s ease;
  position: relative;
}
.nav-item:hover { background: var(--line-2); color: var(--ink); }
.nav-item:active { transform: scale(.985); }
.nav-item.active { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.nav-item.active .nav-icon svg { stroke: var(--accent-text); }
.nav-icon { display: grid; place-items: center; width: 18px; height: 18px; }
.nav-icon svg { width: 17px; height: 17px; stroke: var(--ink-3); transition: stroke .15s; }
.nav-item:hover .nav-icon svg { stroke: var(--ink); }

.sidebar-footer { padding-top: 10px; border-top: 1px solid var(--line-2); margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--r-md);
  cursor: pointer; transition: background .15s;
}
.sidebar-user:hover { background: var(--line-2); }
.sidebar-user .avatar { width: 30px; height: 30px; font-size: 12px; }
.sidebar-user-info { min-width: 0; }
.sidebar-user-info .name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-info .role { font-size: 11.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ============ Topbar ============ */
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 40px;
  background: transparent;
}
.topbar-context { flex: 1; min-width: 0; }
.topbar-context .crumb {
  font-size: 13px; color: var(--ink-3); font-weight: 500;
  display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar-actions { display: flex; align-items: center; gap: 10px; }

/* Busca global */
.searchbox {
  position: relative;
  display: flex; align-items: center; gap: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 10px;
  height: 36px; width: 280px;
  transition: border-color .2s, box-shadow .2s, width .25s var(--ease);
}
.searchbox:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); width: 340px; }
.searchbox svg { width: 15px; height: 15px; stroke: var(--ink-3); flex-shrink: 0; }
.searchbox input { border: 0; outline: 0; background: transparent; flex: 1; font-size: 13.5px; min-width: 0; }
.searchbox input::placeholder { color: var(--ink-3); }
.searchbox kbd {
  font-family: var(--font); font-size: 11px; color: var(--ink-3);
  border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; background: var(--surface-2);
}
.search-results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: var(--shadow-lg); padding: 6px; display: none; z-index: 80;
  max-height: 360px; overflow-y: auto;
}
.search-results.open { display: block; animation: popIn .18s var(--ease); }
.search-result {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border-radius: var(--r-sm); cursor: pointer; font-size: 13px;
}
.search-result:hover, .search-result.focused { background: var(--accent-softer); }
.search-result .sr-type { margin-left: auto; font-size: 11px; color: var(--ink-3); }
.search-empty { padding: 14px; text-align: center; color: var(--ink-3); font-size: 13px; }

/* ============ Botões ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 14px;
  border-radius: 10px; border: 1px solid transparent;
  font-weight: 600; font-size: 13.5px;
  cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, transform .12s ease, box-shadow .15s;
  user-select: none;
}
.btn:active { transform: scale(.97); }
.btn svg { width: 15px; height: 15px; }

.btn-primary {
  background: var(--accent); color: #fff;
  box-shadow: 0 1px 2px rgba(5, 122, 255, .4), inset 0 1px 0 rgba(255,255,255,.15);
}
.btn-primary:hover { background: var(--accent-strong); }
.btn-primary svg { stroke: #fff; }

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

/* Ação de aprovação — verde para se destacar das ações neutras (azul) */
.btn-success {
  background: var(--green); color: #fff;
  box-shadow: 0 1px 2px rgba(46, 143, 91, .35), inset 0 1px 0 rgba(255,255,255,.15);
}
.btn-success:hover { filter: brightness(1.06); }
.btn-success svg { stroke: #fff; }

.btn-outline { background: var(--surface); border-color: var(--line); color: var(--ink); box-shadow: var(--shadow-sm); }
.btn-outline:hover { border-color: var(--ink-3); }
.btn-outline svg { stroke: var(--ink-2); }

.btn-danger-ghost { background: transparent; color: var(--red); }
.btn-danger-ghost:hover { background: var(--red-soft); }

.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.btn-lg { height: 42px; padding: 0 20px; font-size: 14px; border-radius: 12px; }
.btn-block { width: 100%; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 8px;
  border: 0; background: transparent; cursor: pointer;
  color: var(--ink-2); transition: background .15s, transform .12s;
}
.icon-btn:hover { background: var(--line-2); }
.icon-btn:active { transform: scale(.92); }
.icon-btn svg { width: 16px; height: 16px; stroke: var(--ink-2); }

/* ============ Cabeçalho de página ============ */
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px;
  padding: 20px 0 18px; flex-wrap: wrap;
}
.page-head h1 {
  font-family: var(--font-display);
  font-size: 24px; font-weight: 600; letter-spacing: -.02em; line-height: 1.2;
}
.page-head .page-sub { color: var(--ink-2); font-size: 13.5px; margin-top: 4px; }
.page-head-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ============ Segmented control (filtro de período) ============
   Mesma família visual dos chips e botões: altura fixa, texto centrado
   verticalmente e ícones sempre limitados a 13px (um SVG sem tamanho
   herdava a altura intrínseca e inflava o botão — ex.: "Personalizado"). */
.segmented {
  display: inline-flex; align-items: center; gap: 2px;
  background: var(--line-2); border-radius: 10px; padding: 3px;
}
.segmented button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 30px; padding: 0 12px;
  border: 0; background: transparent; cursor: pointer;
  border-radius: 8px;
  font-size: 12.5px; font-weight: 600; line-height: 1; color: var(--ink-2);
  white-space: nowrap;
  transition: background .18s, color .18s, box-shadow .18s;
}
.segmented button svg { width: 13px; height: 13px; stroke: currentColor; flex-shrink: 0; }
.segmented button:hover { color: var(--ink); }
.segmented button.active {
  background: var(--surface); color: var(--ink);
  box-shadow: var(--shadow-sm);
}

/* ============ Cards & superfícies ============ */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.panel-pad { padding: 22px 24px; }
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 18px 24px 0;
}
.panel-head h3 { font-size: 14.5px; font-weight: 600; letter-spacing: -.01em; }
.panel-head .panel-link { font-size: 12.5px; font-weight: 600; color: var(--accent-text); cursor: pointer; border-radius: 6px; padding: 2px 6px; }
.panel-head .panel-link:hover { background: var(--accent-soft); }

/* ============ Dashboard: KPIs ============ */
.kpi-row {
  display: grid; grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--surface); box-shadow: var(--shadow-sm);
  overflow: hidden;
}
/* Variante de 3 colunas (ex.: Entradas/Saídas/Lucro no Financeiro) — usa
   classe em vez de inline style, assim os breakpoints abaixo conseguem
   sobrescrever (inline style sempre vence a folha de estilo e travava a
   grade em 3 colunas fixas mesmo em telas estreitas, cortando valores). */
.kpi-row.kpi-row-3 { grid-template-columns: repeat(3, 1fr); }
.kpi {
  padding: 22px 24px;
  border-right: 1px solid var(--line-2);
  transition: background .2s;
  cursor: default;
  position: relative;
}
.kpi:last-child { border-right: 0; }
.kpi:hover { background: var(--surface-2); }
.kpi-label { font-size: 12.5px; font-weight: 500; color: var(--ink-2); display: flex; align-items: center; gap: 7px; }
.kpi-label svg { width: 14px; height: 14px; stroke: var(--ink-3); }
.kpi-value {
  font-family: var(--font-display);
  font-size: 26px; font-weight: 600; letter-spacing: -.025em;
  margin-top: 8px; line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.kpi-delta { font-size: 12px; font-weight: 600; margin-top: 7px; display: inline-flex; align-items: center; gap: 4px; }
.kpi-delta.up { color: var(--green); }
.kpi-delta.down { color: var(--red); }
.kpi-delta.flat { color: var(--ink-3); font-weight: 500; }
.kpi-delta svg { width: 12px; height: 12px; }

/* ============ Listas (linhas) ============ */
.rowlist { display: flex; flex-direction: column; }
.rowitem {
  display: flex; align-items: center; gap: 14px;
  padding: 13px 24px;
  border-top: 1px solid var(--line-2);
  cursor: pointer;
  transition: background .14s;
}
.rowitem:hover { background: var(--accent-softer); }
.rowitem:first-child { border-top: 0; }
.rowitem .grow { flex: 1; min-width: 0; }
.rowitem .title { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rowitem .meta { font-size: 12.5px; color: var(--ink-3); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rowitem .end { text-align: right; flex-shrink: 0; }

/* Avatar */
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; flex-shrink: 0;
  font-size: 12.5px; font-weight: 600;
  color: var(--accent-text); background: var(--accent-soft);
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.av-2 { background: var(--blue-soft); color: var(--blue); }
.avatar.av-3 { background: var(--amber-soft); color: var(--amber); }
.avatar.av-4 { background: var(--green-soft); color: var(--green); }

/* ============ Badges de status ============ */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 600;
  padding: 3px 9px; border-radius: 99px;
  white-space: nowrap;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-gray   { background: var(--line-2); color: var(--ink-2); }
.badge-purple { background: var(--accent-soft); color: var(--accent-text); }
.badge-green  { background: var(--green-soft); color: var(--green); }
.badge-amber  { background: var(--amber-soft); color: var(--amber); }
.badge-red    { background: var(--red-soft); color: var(--red); }
.badge-blue   { background: var(--blue-soft); color: var(--blue); }

/* ============ Tabelas ============ */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  text-align: left; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em;
  color: var(--ink-3); padding: 12px 16px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table td { padding: 13px 16px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tbody tr { cursor: pointer; transition: background .12s; }
.table tbody tr:hover { background: var(--accent-softer); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .td-num { text-align: right; font-variant-numeric: tabular-nums; }
.table th.td-num { text-align: right; }

/* ============ Formulários ============ */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.field .hint { font-size: 11.5px; color: var(--ink-3); }
.input, .select, .textarea {
  width: 100%; height: 38px; padding: 0 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  font-size: 13.5px; outline: none;
  transition: border-color .18s, box-shadow .18s;
}
.textarea { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--ink-3); }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.input::placeholder, .textarea::placeholder { color: var(--ink-3); }
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%239A97A5' stroke-width='2.4' 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 10px center;
  padding-right: 32px; cursor: pointer;
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .span-2 { grid-column: span 2; }
.input-group { position: relative; }
.input-group .prefix {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  font-size: 13px; color: var(--ink-3); pointer-events: none;
}
.input-group .input { padding-left: 34px; }

/* ============ Modal ============ */
.modal-root { position: fixed; inset: 0; z-index: 100; pointer-events: none; }
.modal-layer { position: absolute; inset: 0; pointer-events: none; }
.modal-layer.open { pointer-events: auto; }
.modal-overlay {
  position: absolute; inset: 0;
  background: rgba(22, 20, 30, .45);
  backdrop-filter: blur(3px);
  opacity: 0; transition: opacity .25s;
}
.modal-layer.open .modal-overlay { opacity: 1; }
.modal {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -47%) scale(.97);
  width: min(620px, calc(100vw - 32px));
  max-height: min(82vh, 760px);
  background: var(--surface); border-radius: var(--r-xl);
  box-shadow: var(--shadow-pop);
  display: flex; flex-direction: column;
  opacity: 0;
  transition: opacity .25s var(--ease), transform .3s var(--ease);
}
.modal-layer.open .modal { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px 0;
}
.modal-head h2 { font-family: var(--font-display); font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
.modal-body { padding: 18px 24px; overflow-y: auto; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 14px 24px 20px;
  border-top: 1px solid var(--line-2);
}
.modal-foot .left { margin-right: auto; }
.modal.modal-lg { width: min(860px, calc(100vw - 32px)); }
.modal.modal-sm { width: min(420px, calc(100vw - 32px)); }

/* ============ Drawer ============ */
.drawer-root { position: fixed; inset: 0; z-index: 95; pointer-events: none; }
.drawer-root.open { pointer-events: auto; }
.drawer-overlay {
  position: absolute; inset: 0; background: rgba(22, 20, 30, .35);
  opacity: 0; transition: opacity .28s;
}
.drawer-root.open .drawer-overlay { opacity: 1; }
.drawer {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: min(560px, 100vw);
  background: var(--surface);
  box-shadow: var(--shadow-pop);
  transform: translateX(103%);
  transition: transform .38s var(--ease);
  display: flex; flex-direction: column;
}
.drawer-root.open .drawer { transform: none; }
.drawer-head {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 24px; border-bottom: 1px solid var(--line-2);
}
.drawer-body { flex: 1; overflow-y: auto; padding: 24px; }

/* ============ Toast ============ */
.toast-stack {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  z-index: 200; pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  background: var(--ink); color: var(--bg);
  padding: 10px 18px; border-radius: 12px;
  font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toastIn .35s var(--ease);
  pointer-events: auto;
}
[data-theme="dark"] .toast { background: #F0EEF4; color: #1C1A22; }
.toast svg { width: 15px; height: 15px; stroke: var(--green); }
.toast.error svg { stroke: var(--red); }
.toast.leaving { animation: toastOut .3s var(--ease) forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px) scale(.96); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(10px) scale(.96); } }

/* ============ Popover ============ */
.popover-root { position: fixed; inset: 0; z-index: 150; pointer-events: none; }
.popover {
  position: absolute; pointer-events: auto;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); box-shadow: var(--shadow-lg);
  padding: 5px; min-width: 180px;
  animation: popIn .16s var(--ease);
}
@keyframes popIn { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
.popover .pop-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 8px 10px; border: 0; background: transparent;
  border-radius: var(--r-sm); cursor: pointer;
  font-size: 13px; font-weight: 500; text-align: left; color: var(--ink);
  transition: background .12s;
}
.popover .pop-item:hover { background: var(--line-2); }
.popover .pop-item svg { width: 15px; height: 15px; stroke: var(--ink-2); }
.popover .pop-item.danger { color: var(--red); }
.popover .pop-item.danger svg { stroke: var(--red); }
.popover .pop-sep { height: 1px; background: var(--line-2); margin: 4px 6px; }

/* ============ Empty state ============ */
.empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 56px 24px; gap: 6px;
}
.empty .empty-icon {
  width: 48px; height: 48px; border-radius: 14px;
  display: grid; place-items: center;
  background: var(--accent-softer); margin-bottom: 8px;
}
.empty .empty-icon svg { width: 22px; height: 22px; stroke: var(--accent); }
.empty h4 { font-size: 14.5px; font-weight: 600; }
.empty p { font-size: 13px; color: var(--ink-3); max-width: 320px; }
.empty .btn { margin-top: 12px; }

/* ============ Tabs ============ */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); }
.tabs button {
  border: 0; background: transparent; cursor: pointer;
  padding: 9px 14px; font-size: 13.5px; font-weight: 600; color: var(--ink-3);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color .15s, border-color .2s;
}
.tabs button:hover { color: var(--ink); }
.tabs button.active { color: var(--accent-text); border-bottom-color: var(--accent); }

/* ============ Timeline ============ */
.timeline { position: relative; padding-left: 24px; }
.timeline::before {
  content: ''; position: absolute; left: 7px; top: 8px; bottom: 8px;
  width: 2px; background: var(--line);
  border-radius: 2px;
}
.tl-item { position: relative; padding: 0 0 22px; }
.tl-item:last-child { padding-bottom: 4px; }
.tl-dot {
  position: absolute; left: -24px; top: 4px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--accent);
  display: grid; place-items: center;
}
.tl-dot::after { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.tl-item.muted .tl-dot { border-color: var(--line); }
.tl-item.muted .tl-dot::after { background: var(--ink-3); }
.tl-title { font-size: 13.5px; font-weight: 600; }
.tl-meta { font-size: 12px; color: var(--ink-3); margin-top: 2px; }

/* ============ Kanban ============ */
.kanban-wrap { position: relative; }

/* Barra de rolagem horizontal sempre visível no topo do quadro.
   Só aparece quando há colunas além da largura da tela. */
.kanban-scroll-top {
  display: none;
  overflow-x: auto; overflow-y: hidden;
  height: 12px; margin-bottom: 8px;
}
.kanban-wrap.has-overflow .kanban-scroll-top { display: block; }
.kanban-scroll-top-inner { height: 1px; }

/* Fades/sombras suaves nas extremidades: avisam que há mais colunas. */
.kanban-wrap::before, .kanban-wrap::after {
  content: ""; position: absolute; top: 0; bottom: 8px; width: 44px;
  pointer-events: none; z-index: 3; opacity: 0; transition: opacity .25s;
}
.kanban-wrap::before { left: 0; background: linear-gradient(90deg, var(--bg), transparent); }
.kanban-wrap::after { right: 0; background: linear-gradient(270deg, var(--bg), transparent); }
.kanban-wrap.has-overflow:not(.at-start)::before { opacity: 1; }
.kanban-wrap.has-overflow:not(.at-end)::after { opacity: 1; }

.kanban {
  display: flex; gap: 16px;
  align-items: flex-start;
  overflow-x: auto;
  padding-bottom: 8px;
  -webkit-overflow-scrolling: touch;
}
.kanban-col {
  flex: 0 0 290px; width: 290px;
  background: var(--line-2);
  border-radius: var(--r-lg);
  padding: 10px;
  min-height: 200px;
  scroll-snap-align: start;
  transition: background .2s, outline .2s, box-shadow .2s, transform .2s;
  outline: 2px dashed transparent; outline-offset: -2px;
}
.kanban-col.drag-over { background: var(--accent-softer); outline-color: var(--accent); }
.kanban-col.col-dragging { opacity: .5; }
.kanban-col.col-drop-target { box-shadow: -3px 0 0 var(--accent); }
.kanban-col-head {
  display: flex; align-items: center; gap: 7px;
  padding: 6px 4px 12px;
  cursor: grab;
}
.kanban-col-head:active { cursor: grabbing; }
.kanban-col-head .col-grip { display: inline-flex; color: var(--ink-3); opacity: .55; }
.kanban-col-head .col-grip svg { width: 15px; height: 15px; }
.kanban-col-head:hover .col-grip { opacity: 1; }
.kanban-col-head .col-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.kanban-col-head h4 { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kanban-col-head .count {
  font-size: 11.5px; font-weight: 600; color: var(--ink-3);
  background: var(--surface); border-radius: 99px; padding: 1px 8px;
  border: 1px solid var(--line); flex: 0 0 auto;
}
.kanban-col-head h4 + .count { margin-left: 2px; }
.kanban-col-head .icon-btn { width: 26px; height: 26px; flex: 0 0 auto; }
.kanban-col-head .icon-btn[data-add-col] { margin-left: auto; }
.kanban-cards { display: flex; flex-direction: column; gap: 8px; min-height: 60px; }

.kanban-add-col { flex: 0 0 200px; width: 200px; padding-top: 4px; }
.kanban-add-col .btn { width: 100%; justify-content: center; border: 1.5px dashed var(--line); background: transparent; }
.kanban-add-col .btn:hover { border-color: var(--accent); color: var(--accent-text); }

.kcard {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 12px 14px;
  cursor: grab;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .18s, transform .18s var(--ease), border-color .18s, opacity .18s;
  animation: cardIn .25s var(--ease);
}
@keyframes cardIn { from { opacity: 0; transform: translateY(5px); } }
.kcard:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); border-color: var(--ink-3); }
.kcard.dragging { opacity: .35; transform: rotate(1.5deg) scale(.98); cursor: grabbing; }
.kcard .kcard-title { font-size: 13.5px; font-weight: 600; line-height: 1.4; }
.kcard .kcard-title.done-text { text-decoration: line-through; color: var(--ink-3); }
.kcard-meta { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.kcard-meta .due { font-size: 11.5px; color: var(--ink-3); display: inline-flex; align-items: center; gap: 4px; }
.kcard-meta .due svg { width: 12px; height: 12px; stroke: var(--ink-3); }
.kcard-meta .due.overdue { color: var(--red); }
.kcard-meta .due.overdue svg { stroke: var(--red); }
.kcard-sub { font-size: 11.5px; color: var(--ink-3); display: inline-flex; align-items: center; gap: 4px; }
.kcard-sub svg { width: 12px; height: 12px; stroke: var(--ink-3); }
.kcard-progress { height: 3px; background: var(--line-2); border-radius: 3px; margin-top: 10px; overflow: hidden; }
.kcard-progress span { display: block; height: 100%; background: var(--accent); border-radius: 3px; transition: width .3s var(--ease); }

.prio { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; }
.prio .pdot { width: 7px; height: 7px; border-radius: 2.5px; }
.prio-alta { color: var(--red); } .prio-alta .pdot { background: var(--red); }
.prio-media { color: var(--amber); } .prio-media .pdot { background: var(--amber); }
.prio-baixa { color: var(--blue); } .prio-baixa .pdot { background: var(--blue); }

/* ============ Checkbox ============ */
.check {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  padding: 6px 0; user-select: none;
}
.check input { display: none; }
.check .box {
  width: 18px; height: 18px; border-radius: 6px;
  border: 1.5px solid var(--line); background: var(--surface);
  display: grid; place-items: center; flex-shrink: 0;
  transition: background .15s, border-color .15s;
}
.check .box svg { width: 11px; height: 11px; stroke: #fff; stroke-width: 3.5; opacity: 0; transform: scale(.5); transition: all .18s var(--ease); }
.check input:checked + .box { background: var(--accent); border-color: var(--accent); }
.check input:checked + .box svg { opacity: 1; transform: scale(1); }
.check input:checked ~ .check-label { text-decoration: line-through; color: var(--ink-3); }
.check-label { font-size: 13.5px; }

/* ============ Pipeline (CRM) ============ */
.pipeline-bar {
  display: flex; gap: 6px; padding: 4px 0 0;
  overflow-x: auto;
}
.pipe-step {
  flex: 1; min-width: 110px;
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); padding: 10px 14px;
  cursor: pointer; transition: border-color .18s, background .18s, transform .15s;
}
.pipe-step:hover { border-color: var(--accent); transform: translateY(-1px); }
.pipe-step.active { border-color: var(--accent); background: var(--accent-softer); box-shadow: 0 0 0 3px var(--accent-soft); }
.pipe-step .pipe-n { font-family: var(--font-display); font-size: 18px; font-weight: 600; }
.pipe-step .pipe-l { font-size: 11px; font-weight: 600; color: var(--ink-3); white-space: nowrap; }

/* ============ Stat mini (metrics inline) ============ */
.stats-inline { display: flex; gap: 0; border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; background: var(--surface); }
.stat-cell { flex: 1; padding: 14px 18px; border-right: 1px solid var(--line-2); }
.stat-cell:last-child { border-right: 0; }
.stat-cell .s-label { font-size: 11.5px; color: var(--ink-3); font-weight: 500; }
.stat-cell .s-value { font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.01em; margin-top: 2px; font-family: var(--font-display); }

/* ============ Chart ============ */
.chart-wrap { padding: 8px 24px 20px; }
.chart-tooltip {
  position: fixed; pointer-events: none; z-index: 300;
  background: var(--ink); color: var(--bg);
  font-size: 12px; font-weight: 600; padding: 7px 11px; border-radius: 8px;
  box-shadow: var(--shadow-lg);
  transform: translate(-50%, calc(-100% - 10px));
  white-space: nowrap; opacity: 0; transition: opacity .15s;
}
[data-theme="dark"] .chart-tooltip { background: #F0EEF4; color: #1C1A22; }
.chart-tooltip.show { opacity: 1; }
.chart-tooltip .tt-label { font-weight: 500; opacity: .65; font-size: 11px; display: block; }

/* ============ Assinatura / Paywall ============ */
/* Ícone redondo (usado fora do .auth-success, como no paywall e na espera) */
.as-ic { width: 56px; height: 56px; border-radius: 50%; background: color-mix(in srgb, var(--accent) 13%, transparent); display: grid; place-items: center; }
.as-ic svg { width: 26px; height: 26px; stroke: var(--accent); }
.paywall-list { list-style: none; padding: 0; margin: 18px 0 22px; display: flex; flex-direction: column; gap: 10px; }
.paywall-list li { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: var(--ink-2); }
.paywall-list li svg { width: 16px; height: 16px; stroke: var(--green); flex: none; }
.trial-banner {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 18px; z-index: 4000;
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  padding: 8px 10px 8px 18px; box-shadow: var(--shadow-md); font-size: 13px; color: var(--ink);
  max-width: calc(100vw - 32px);
}
.trial-banner svg { width: 15px; height: 15px; vertical-align: -2px; }
.trial-banner .icon-btn { width: 28px; height: 28px; }
@media (max-width: 560px) { .trial-banner { font-size: 12px; padding: 7px 8px 7px 14px; } }

/* ============ Calculadora ============ */
.calc-layout { display: grid; grid-template-columns: 1fr 360px; gap: 20px; align-items: start; }
.calc-result {
  position: sticky; top: 12px;
  background: linear-gradient(160deg, #0F2747 0%, #143A6B 55%, #1957A6 100%);
  color: #fff; border-radius: var(--r-xl);
  padding: 28px;
  box-shadow: 0 20px 50px rgba(18, 48, 96, .35);
  overflow: hidden;
}
.calc-result::before {
  content: ''; position: absolute; top: -60px; right: -60px;
  width: 220px; height: 220px; border-radius: 50%;
  background: radial-gradient(circle, rgba(95, 176, 255, .35), transparent 70%);
}
.calc-result .cr-label { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; opacity: .65; }
.calc-result .cr-value {
  font-family: var(--font-display); font-size: 38px; font-weight: 700; letter-spacing: -.03em;
  margin: 6px 0 2px; font-variant-numeric: tabular-nums;
}
.calc-result .cr-sub { font-size: 12.5px; opacity: .65; }
.calc-break { margin-top: 22px; display: flex; flex-direction: column; gap: 9px; position: relative; }
.calc-break .cb-row { display: flex; justify-content: space-between; font-size: 13px; }
.calc-break .cb-row span:first-child { opacity: .7; }
.calc-break .cb-row strong { font-variant-numeric: tabular-nums; font-weight: 600; }
.calc-break .cb-sep { height: 1px; background: rgba(255,255,255,.14); margin: 4px 0; }
.calc-result .btn { margin-top: 24px; background: #fff; color: #13447F; width: 100%; height: 42px; border-radius: 12px; }
.calc-result .btn:hover { background: #E7F0FE; }
.calc-result .btn svg { stroke: #13447F; }

.range-row { display: flex; align-items: center; gap: 14px; }
.range-row input[type=range] { flex: 1; accent-color: var(--accent); height: 4px; cursor: pointer; }
.range-val { font-weight: 600; font-size: 13px; min-width: 44px; text-align: right; font-variant-numeric: tabular-nums; }

/* ============ Quote (orçamento) ============ */
.quote-items { display: flex; flex-direction: column; gap: 8px; }
.quote-item-row {
  display: grid; grid-template-columns: 1fr 70px 110px 110px 32px;
  gap: 8px; align-items: center;
}
.quote-item-row .line-total { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; font-size: 13px; }
.quote-totals { margin-top: 16px; border-top: 1px solid var(--line-2); padding-top: 14px; display: flex; flex-direction: column; gap: 6px; }
.quote-totals .qt-row { display: flex; justify-content: space-between; font-size: 13.5px; }
.quote-totals .qt-row.total { font-size: 16px; font-weight: 700; font-family: var(--font-display); padding-top: 6px; }

/* Lista de orçamentos (cartões — evita tabela cortando valor no mobile) */
.quote-list { display: flex; flex-direction: column; }
.q-row {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 18px; border-bottom: 1px solid var(--line-2);
  cursor: pointer; transition: background .12s;
}
.q-row:last-child { border-bottom: 0; }
.q-row:hover { background: var(--accent-softer); }
.q-main { display: flex; align-items: baseline; gap: 10px; min-width: 0; flex: 1 1 220px; }
.q-main .q-num { color: var(--ink-3); font-size: 12.5px; flex: 0 0 auto; }
.q-main .q-title-wrap { min-width: 0; }
.q-main .q-title { font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-main .q-client { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-meta { display: flex; align-items: center; gap: 16px; flex: 0 0 auto; }
.q-meta .q-value { font-variant-numeric: tabular-nums; font-size: 14px; min-width: 90px; text-align: right; }
.q-meta .q-valid { min-width: 92px; text-align: right; }
.q-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.q-actions .icon-btn { width: 36px; height: 36px; } /* área de toque confortável */

@media (max-width: 700px) {
  .q-row { flex-wrap: wrap; padding: 14px 16px; gap: 8px 12px; }
  .q-main { flex-basis: 100%; }
  .q-meta { flex-basis: 100%; justify-content: space-between; order: 2; }
  .q-meta .q-valid { display: none; } /* validade fica só no detalhe no mobile, evita poluir o cartão */
  .q-actions { order: 3; flex-basis: 100%; justify-content: flex-end; }
  /* Áreas de toque maiores no mobile (mínimo confortável ~44px) */
  .q-actions .btn { height: 40px; padding: 0 14px; }
  .q-actions .icon-btn { width: 40px; height: 40px; }
}

/* Preview do orçamento (estilo papel) */
.quote-paper {
  background: #fff; color: #1C1A24;
  border-radius: var(--r-md); border: 1px solid var(--line);
  padding: 40px 44px; box-shadow: var(--shadow-md);
  max-width: 760px; margin: 0 auto;
  font-size: 13px;
}

/* ============ Settings ============ */
.settings-layout { display: grid; grid-template-columns: 200px 1fr; gap: 28px; align-items: start; }
.settings-nav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 12px; }
.settings-nav button {
  text-align: left; border: 0; background: transparent; cursor: pointer;
  padding: 8px 12px; border-radius: var(--r-sm);
  font-size: 13.5px; font-weight: 500; color: var(--ink-2);
  transition: background .15s, color .15s;
}
.settings-nav button:hover { background: var(--line-2); color: var(--ink); }
.settings-nav button.active { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.settings-section { display: flex; flex-direction: column; gap: 20px; }
.settings-section h3 { font-size: 15px; font-weight: 600; }
.settings-row {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 14px 0; border-bottom: 1px solid var(--line-2);
}
.settings-row:last-child { border-bottom: 0; }
.settings-row .sr-info strong { display: block; font-size: 13.5px; font-weight: 600; }
.settings-row .sr-info span { font-size: 12.5px; color: var(--ink-3); }

.logo-upload {
  width: 88px; height: 88px; border-radius: var(--r-lg);
  border: 1.5px dashed var(--line); background: var(--surface-2);
  display: grid; place-items: center; cursor: pointer; overflow: hidden;
  transition: border-color .2s;
}
.logo-upload:hover { border-color: var(--accent); }
.logo-upload img { width: 100%; height: 100%; object-fit: contain; }
.logo-upload svg { width: 22px; height: 22px; stroke: var(--ink-3); }

/* ---- Upload da foto de perfil ---- */
.avatar-upload {
  position: relative;
  width: 76px; height: 76px; border-radius: 50%;
  border: 1.5px dashed var(--line); background: var(--surface-2);
  display: grid; place-items: center; cursor: pointer; overflow: hidden;
  transition: border-color .2s; flex: 0 0 auto;
}
.avatar-upload:hover { border-color: var(--accent); }
.avatar-upload img { width: 100%; height: 100%; object-fit: cover; }
.avatar-upload svg { width: 24px; height: 24px; stroke: var(--ink-3); }
.avatar-upload .au-initials { font-family: var(--font-display); font-weight: 700; font-size: 24px; color: var(--accent-text); }
.avatar-upload .au-edit {
  position: absolute; right: 0; bottom: 0;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent); display: grid; place-items: center;
  border: 2px solid var(--surface);
}
.avatar-upload .au-edit svg { width: 11px; height: 11px; stroke: #fff; }

/* ============ Item de menu "Em breve" (Contratos) ============ */
.nav-item.nav-soon { color: var(--ink-3); cursor: default; }
.nav-item.nav-soon:hover { background: transparent; color: var(--ink-3); }
.nav-item.nav-soon:active { transform: none; }
.nav-item.nav-soon .nav-icon svg { opacity: .75; }
.soon-badge {
  margin-left: auto; font-size: 9.5px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: var(--accent-text);
  background: var(--accent-soft); border-radius: 99px; padding: 2px 7px;
}

/* ============ Botão de ocultar valores ============ */
#hideValuesBtn.active { color: var(--accent-text); background: var(--accent-soft); }

/* ============ Saldo em caixa (faixa compacta do Dashboard) ============ */
.balance-strip {
  display: flex; align-items: center; gap: 16px;
  background: linear-gradient(135deg, var(--accent) 0%, #0a5fd6 100%);
  color: #fff; border-radius: var(--r-lg);
  padding: 13px 20px;
  box-shadow: var(--shadow-md);
  cursor: pointer;
  transition: transform .18s var(--ease), box-shadow .18s;
}
.balance-strip:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.balance-strip.negative { background: linear-gradient(135deg, #e0463a 0%, #b8281d 100%); }
.balance-strip .bs-label {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 600; opacity: .92; white-space: nowrap;
}
.balance-strip .bs-label svg { width: 15px; height: 15px; stroke: currentColor; }
.balance-strip .bs-value {
  font-family: var(--font-display); font-weight: 700;
  font-size: 22px; letter-spacing: -.01em; line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.balance-strip .bs-go {
  margin-left: auto;
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
  background: rgba(255,255,255,.16); padding: 6px 12px; border-radius: 99px;
}
.balance-strip .bs-go svg { width: 12px; height: 12px; stroke: currentColor; }

/* ============ Cards financeiros compactos ============ */
.fin-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.fin-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 14px 16px;
  box-shadow: var(--shadow-sm);
}
.fin-card .fc-label { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 500; color: var(--ink-2); }
.fin-card .fc-label svg { width: 13px; height: 13px; stroke: var(--ink-3); }
.fin-card .fc-value {
  font-family: var(--font-display); font-size: 20px; font-weight: 700;
  margin-top: 5px; letter-spacing: -.02em; line-height: 1.15;
  font-variant-numeric: tabular-nums;
}
.fin-card .fc-sub { font-size: 11.5px; color: var(--ink-3); margin-top: 3px; }
.fin-card.highlight { background: linear-gradient(135deg, var(--accent) 0%, #0a5fd6 100%); border-color: transparent; color: #fff; }
.fin-card.highlight.neg { background: linear-gradient(135deg, #e0463a 0%, #b8281d 100%); }
.fin-card.highlight .fc-label, .fin-card.highlight .fc-sub { color: rgba(255,255,255,.85); }
.fin-card.highlight .fc-label svg { stroke: rgba(255,255,255,.85); }

/* ============ Gráficos: legenda e distribuição (rosca) ============ */
.legend-dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex: 0 0 auto; }
.dist-wrap { display: flex; align-items: center; gap: 22px; padding: 14px 24px 20px; }
.dist-donut { flex: 0 0 176px; width: 176px; }
.dist-legend { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.dist-leg-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.dist-leg-row .dl-label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink-2); font-weight: 500; }
.dist-leg-row .dl-val { font-weight: 600; font-variant-numeric: tabular-nums; }
.dist-leg-row .dl-pct { color: var(--ink-3); width: 36px; text-align: right; font-variant-numeric: tabular-nums; }

/* ============ KPIs compactos (Dashboard) ============ */
.kpi-row.kpi-compact .kpi { padding: 15px 18px; }
.kpi-row.kpi-compact .kpi-value { font-size: 21px; }
.kpi-row.kpi-compact .kpi-delta { margin-top: 5px; font-size: 11.5px; }

/* ============ Marca personalizada na sidebar ============
   Layout horizontal (estilo Slack/Notion): logo pequena + nome ao lado. */
.sidebar-brand.custom { flex-direction: row; align-items: center; gap: 10px; min-width: 0; }
.brand-user-logo {
  max-height: 32px; max-width: 88px; width: auto;
  object-fit: contain; border-radius: 7px; flex: 0 0 auto;
}
.brand-user-name {
  font-family: var(--font-display); font-weight: 700; font-size: 14.5px;
  letter-spacing: -.01em; line-height: 1.25; min-width: 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* ============ Relatório financeiro ============ */
.report-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.report-cell {
  background: var(--surface-2); border: 1px solid var(--line-2);
  border-radius: var(--r-md); padding: 14px 16px;
}
.report-cell.highlight { background: var(--accent-soft); border-color: transparent; }
.report-cell .rc-label {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.5px; font-weight: 500; color: var(--ink-2);
}
.report-cell .rc-label svg { width: 14px; height: 14px; stroke: var(--ink-3); }
.report-cell .rc-value { font-family: var(--font-display); font-weight: 700; font-size: 22px; margin-top: 6px; }

.theme-pick { display: flex; gap: 10px; }
.theme-opt {
  width: 120px; border-radius: var(--r-md); border: 2px solid var(--line);
  overflow: hidden; cursor: pointer; transition: border-color .2s, transform .15s;
  background: var(--surface);
}
.theme-opt:hover { transform: translateY(-2px); }
.theme-opt.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.theme-opt .swatch { height: 64px; }
.theme-opt .t-label { font-size: 12px; font-weight: 600; text-align: center; padding: 7px 0; }

/* ============ Utilitários ============ */
/* O atributo hidden precisa vencer regras com display explícito (ex.:
   .field { display:flex } engolia o hidden dos campos de parcelamento) */
[hidden] { display: none !important; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; } .mt-4 { margin-top: 32px; }
.mb-2 { margin-bottom: 16px; }
.flex { display: flex; align-items: center; gap: 10px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.muted { color: var(--ink-3); }
.small { font-size: 12.5px; }
.bold { font-weight: 600; }
.money-pos { color: var(--green); font-weight: 600; }
.money-neg { color: var(--red); font-weight: 600; }
.clickable { cursor: pointer; }
.hide-mobile { display: inline; }

.filters-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }

.chip-row { display: flex; gap: 6px; flex-wrap: wrap; }
/* Chips seguem as mesmas medidas dos botões do segmented (altura 30px,
   mesma tipografia) — filtros rápidos e seletor de período viram uma
   família visual só. */
.chip {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 30px; padding: 0 13px;
  border: 1px solid var(--line); background: var(--surface);
  border-radius: 99px;
  font-size: 12.5px; font-weight: 600; line-height: 1; color: var(--ink-2);
  cursor: pointer; transition: all .15s;
  white-space: nowrap;
}
.chip:hover { border-color: var(--ink-3); color: var(--ink); }
.chip.active { background: var(--ink); border-color: var(--ink); color: var(--surface); }
[data-theme="dark"] .chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ============ Condições de pagamento (form do orçamento) ============ */
.pay-block {
  border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 16px; background: var(--surface-2);
}
.pay-block-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; font-weight: 700; color: var(--ink-2);
  margin-bottom: 12px;
}
.pay-block-title svg { width: 15px; height: 15px; stroke: var(--ink-3); }
.pay-summary { margin-top: 12px; border-top: 1px dashed var(--line); padding-top: 12px; }
.pay-sum-line { font-size: 13px; color: var(--ink-2); }
.pay-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.pay-chip {
  border: 1px solid var(--line); background: var(--surface);
  border-radius: 8px; padding: 4px 9px;
  font-size: 11.5px; color: var(--ink-2); white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ============ Valores a receber (Financeiro) ============ */
.recv-list { padding-bottom: 8px; }
/* Cabeçalho de mês recolhível: clique expande/recolhe as parcelas do mês */
.recv-month {
  display: flex; align-items: center; gap: 10px;
  width: 100%; text-align: left; border: 0; background: transparent; cursor: pointer;
  padding: 12px 24px;
  margin-top: 6px;
  border-top: 1px solid var(--line-2);
  font-size: 12.5px; color: var(--ink-2);
  font-variant-numeric: tabular-nums;
  transition: background .14s;
}
.recv-month:hover { background: var(--surface-2); }
.recv-month .rm-chev { display: inline-flex; color: var(--ink-3); transition: transform .2s var(--ease); }
.recv-month .rm-chev svg { width: 14px; height: 14px; }
.recv-month:not(.open) .rm-chev { transform: rotate(-90deg); }
.recv-month .rm-label { font-weight: 700; text-transform: capitalize; color: var(--ink); }
.recv-month .rm-count { color: var(--ink-3); font-size: 12px; }
.recv-month .rm-total { margin-left: auto; font-weight: 700; color: var(--ink); white-space: nowrap; }
.recv-row {
  display: flex; align-items: center; gap: 14px;
  padding: 11px 24px;
  border-top: 1px solid var(--line-2);
  cursor: pointer; transition: background .14s;
}
.recv-row:hover { background: var(--accent-softer); }
.recv-row .grow { flex: 1; min-width: 0; }
.recv-row .title { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recv-row .meta { font-size: 12.5px; color: var(--ink-3); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recv-amount { font-variant-numeric: tabular-nums; flex-shrink: 0; }

/* ============ Tarefas: visualização compacta ============ */
.table.task-compact th { padding: 10px 14px; }
.table.task-compact td { padding: 7px 14px; }
.table.task-compact tbody tr { cursor: pointer; }

/* ============ Tarefas: calendário ============ */
.cal-panel { overflow: hidden; }
.cal-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px 10px; }
.cal-head h3 { font-size: 15px; font-weight: 600; font-family: var(--font-display); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-dows { border-bottom: 1px solid var(--line-2); }
.cal-dow {
  text-align: center; padding: 6px 0 8px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--ink-3);
}
.cal-cell {
  min-height: 92px; padding: 6px;
  border-right: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2);
  display: flex; flex-direction: column; gap: 3px;
  overflow: hidden; min-width: 0;
}
.cal-grid .cal-cell:nth-child(7n) { border-right: 0; }
.cal-cell.empty { background: var(--surface-2); }
.cal-cell.today { background: var(--accent-softer); }
.cal-cell .cal-day { font-size: 11.5px; font-weight: 600; color: var(--ink-3); }
.cal-cell.today .cal-day { color: var(--accent-text); font-weight: 700; }
.cal-task {
  display: block; width: 100%; text-align: left;
  border: 0; background: var(--line-2); border-radius: 6px;
  padding: 3px 6px;
  font-size: 11px; font-weight: 600; color: var(--ink-2);
  cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: background .15s, color .15s;
}
.cal-task:hover { background: var(--accent-soft); color: var(--accent-text); }
.cal-task .cdot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 5px; vertical-align: 1px; }
.cal-task.done { text-decoration: line-through; opacity: .55; }
.cal-task.overdue { background: var(--red-soft); color: var(--red); }
.cal-more { font-size: 10.5px; color: var(--ink-3); padding-left: 2px; }

/* ============ CRM: Kanban comercial ============ */
.crm-kanban .kanban-col { flex-basis: 252px; width: 252px; }

/* ============ Recebimentos atrasados (Financeiro) ============ */
.recv-overdue {
  margin: 14px 16px 4px;
  border: 1px solid color-mix(in srgb, var(--red) 30%, var(--line));
  background: var(--red-soft);
  border-radius: var(--r-md);
  overflow: hidden;
}
.recv-overdue .ro-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 14px 8px; flex-wrap: wrap;
}
.recv-overdue .recv-row { padding: 10px 14px; border-top: 1px solid color-mix(in srgb, var(--red) 14%, transparent); }
.recv-overdue .recv-row:hover { background: color-mix(in srgb, var(--red) 7%, transparent); }
.ro-late { font-size: 11.5px; font-weight: 700; color: var(--red); white-space: nowrap; }

/* Calendário de recebimentos: estados dos chips */
.cal-task.paid { background: var(--green-soft); color: var(--green); }
.cal-cell.clickable { cursor: pointer; transition: background .15s; }
.cal-cell.clickable:hover { background: var(--surface-2); }
.cal-cell.today.clickable:hover { background: var(--accent-soft); }

/* ============ Centro de Pendências (Dashboard) ============ */
.pend-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: 0 0 auto; }
.today-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 24px 4px; }
.today-chip {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--line); background: var(--surface-2);
  border-radius: 99px; padding: 5px 12px;
  font-size: 12px; font-weight: 600; color: var(--ink-2);
  white-space: nowrap;
}
.pend-head {
  padding: 14px 24px 4px;
  font-size: 11px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--ink-3);
}
.pend-list { padding-bottom: 8px; }
.pend-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 24px;
  border-top: 1px solid var(--line-2);
}
.pend-row:first-child { border-top: 0; }
.pend-row .pend-text { font-size: 13.5px; font-weight: 600; }
.pend-row .btn { flex: 0 0 auto; }

/* ============ Tour guiado ============ */
.tour-panel {
  position: fixed; right: 24px; bottom: 24px; z-index: 92;
  width: min(360px, calc(100vw - 32px));
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-pop);
  padding: 18px 20px;
  animation: viewIn .3s var(--ease);
}
.tour-step-label {
  font-size: 11px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--accent-text); margin-bottom: 8px;
}
.tour-progress { height: 5px; background: var(--line-2); border-radius: 99px; overflow: hidden; margin-bottom: 14px; }
.tour-progress span { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .35s var(--ease); }
.tour-title { font-family: var(--font-display); font-size: 15.5px; font-weight: 700; letter-spacing: -.01em; }
.tour-text { font-size: 13px; color: var(--ink-2); margin-top: 6px; line-height: 1.6; }
.tour-list { list-style: none; padding: 0; margin: 12px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; }
.tour-list li { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink-2); }
.tour-list li svg { width: 13px; height: 13px; stroke: var(--green); flex: 0 0 auto; }
.tour-actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 16px; }

/* Destaque pulsante no item de menu do passo atual */
.nav-item.tour-glow, .sidebar-user.tour-glow {
  background: var(--accent-soft); color: var(--accent-text);
  animation: tourPulse 1.8s ease-in-out infinite;
}
.nav-item.tour-glow .nav-icon svg { stroke: var(--accent-text); }
@keyframes tourPulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 45%, transparent); }
  50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 0%, transparent); }
}

@media (max-width: 620px) {
  .tour-panel { right: 16px; left: 16px; bottom: calc(86px + env(safe-area-inset-bottom)); width: auto; }
  .tour-list { grid-template-columns: 1fr; }
}

/* ============ Navegação inferior (mobile) ============ */
.bottom-nav {
  display: none; /* aparece só em telas <= 900px */
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 80;
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 6px 6px calc(8px + env(safe-area-inset-bottom));
  justify-content: space-around; align-items: flex-start;
  box-shadow: 0 -6px 20px rgba(28, 26, 36, .06);
}
.bnav-item {
  flex: 1; max-width: 96px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  border: 0; background: none; cursor: pointer;
  padding: 5px 0 3px; border-radius: 12px;
  font-size: 10.5px; font-weight: 600; color: var(--ink-3);
  transition: color .15s;
}
.bnav-item svg { width: 21px; height: 21px; stroke: var(--ink-3); transition: stroke .15s; }
.bnav-item.active { color: var(--accent-text); }
.bnav-item.active svg { stroke: var(--accent-text); }
.bnav-item:active { background: var(--line-2); }
.bnav-item.tour-glow { color: var(--accent-text); animation: tourPulse 1.8s ease-in-out infinite; }
.bnav-item.tour-glow svg { stroke: var(--accent-text); }
.bnav-plus {
  flex: 0 0 54px; width: 54px; height: 54px; margin-top: -24px;
  border-radius: 50%; border: 4px solid var(--bg);
  background: linear-gradient(135deg, var(--accent), #0a5fd6);
  color: #fff; cursor: pointer;
  display: grid; place-items: center;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 45%, transparent);
  transition: transform .15s var(--ease);
}
.bnav-plus:active { transform: scale(.94); }
.bnav-plus svg { width: 24px; height: 24px; stroke: #fff; }

/* ============ Sheet (menu deslizante do mobile) ============ */
.sheet-root { position: fixed; inset: 0; z-index: 96; pointer-events: none; }
.sheet-root.open { pointer-events: auto; }
.sheet-overlay {
  position: absolute; inset: 0;
  background: rgba(20, 18, 28, .45); backdrop-filter: blur(2px);
  opacity: 0; transition: opacity .25s;
}
.sheet-root.open .sheet-overlay { opacity: 1; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0;
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  padding: 8px 14px calc(18px + env(safe-area-inset-bottom));
  max-height: 72vh; overflow-y: auto;
  transform: translateY(100%);
  transition: transform .3s var(--ease);
  box-shadow: var(--shadow-pop);
}
.sheet-root.open .sheet { transform: none; }
.sheet-grab { width: 42px; height: 4px; border-radius: 99px; background: var(--line); margin: 4px auto 10px; }
.sheet-title {
  padding: 4px 6px 8px;
  font-size: 11px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--ink-3);
}
.sheet-title.sheet-sep { border-top: 1px solid var(--line-2); margin-top: 8px; padding-top: 12px; }
.sheet-item {
  display: flex; align-items: center; gap: 13px;
  width: 100%; padding: 11px 8px;
  border: 0; background: none; border-radius: 12px;
  font-size: 14.5px; font-weight: 600; color: var(--ink);
  cursor: pointer; text-align: left;
  transition: background .15s;
}
.sheet-item:active, .sheet-item:hover { background: var(--line-2); }
.sheet-item.current { background: var(--accent-softer); color: var(--accent-text); }
.sheet-item .si-ic {
  width: 38px; height: 38px; border-radius: 11px;
  background: var(--accent-soft);
  display: grid; place-items: center; flex: 0 0 auto;
}
.sheet-item .si-ic svg { width: 18px; height: 18px; stroke: var(--accent-text); }
.sheet-item .si-check { width: 16px; height: 16px; stroke: var(--accent-text); margin-left: auto; flex: 0 0 auto; }

/* ============ Dashboard: grade de widgets ============ */
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.dash-widget { min-width: 0; }
.dash-widget.wide { grid-column: 1 / -1; }
@media (max-width: 1080px) { .dash-grid { grid-template-columns: 1fr; } }

/* Personalizar Dashboard (modal) */
.dw-row {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 4px;
  border-top: 1px solid var(--line-2);
}
.dw-row:first-child { border-top: 0; }
.dw-row .icon-btn { width: 28px; height: 28px; }
.dw-row .icon-btn svg { width: 14px; height: 14px; }

/* ============ Serviços: cards de categoria ============ */
.svc-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.svc-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 18px;
  cursor: pointer;
  transition: box-shadow .18s, transform .18s var(--ease), border-color .18s;
}
.svc-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: var(--accent); }
.svc-card .svc-ic {
  width: 40px; height: 40px; border-radius: 11px;
  background: var(--accent-soft);
  display: grid; place-items: center; margin-bottom: 12px;
}
.svc-card .svc-ic svg { width: 19px; height: 19px; stroke: var(--accent-text); }
.svc-card .svc-name { font-family: var(--font-display); font-weight: 700; font-size: 15px; letter-spacing: -.01em; }
.svc-card .svc-meta { font-size: 12.5px; color: var(--ink-3); margin-top: 3px; }
.svc-card .svc-avg { font-size: 12.5px; color: var(--ink-2); margin-top: 8px; }
.svc-crumb { cursor: pointer; }
.svc-crumb:hover { color: var(--accent); }

/* Entregáveis (formulário de serviço) */
.deliv-row { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.deliv-row .input { flex: 1; }
.deliv-row .icon-btn { width: 30px; height: 30px; flex: 0 0 auto; }
.deliv-row .icon-btn svg { width: 14px; height: 14px; }
.deliv-row .col-grip svg { width: 14px; height: 14px; stroke: var(--green); }

/* Entregáveis no editor de orçamento (linha informativa sob o item) */
.qi-deliv {
  display: flex; align-items: flex-start; gap: 6px;
  padding: 2px 4px 8px 8px; font-size: 12px;
}
.qi-deliv svg { width: 13px; height: 13px; stroke: var(--green); flex: 0 0 auto; margin-top: 2px; }

/* ============ Perfil ============ */
.profile-head { display: flex; align-items: center; gap: 16px; }
.profile-head .avatar { width: 64px; height: 64px; font-size: 22px; flex: 0 0 auto; }
.profile-name { font-family: var(--font-display); font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.profile-plan {
  margin-top: 18px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 13px 15px;
  background: var(--surface-2); border: 1px solid var(--line-2); border-radius: var(--r-md);
}
.profile-plan .pp-label {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3);
}
.profile-plan .pp-label svg { width: 13px; height: 13px; stroke: var(--accent); }
.profile-plan .pp-value { font-weight: 700; font-size: 14.5px; margin-top: 2px; }
.profile-menu { overflow: hidden; }
.pm-item {
  display: flex; align-items: center; gap: 13px;
  width: 100%; padding: 15px 20px;
  border: 0; background: none; border-top: 1px solid var(--line-2);
  font-size: 14px; font-weight: 600; color: var(--ink);
  cursor: pointer; text-align: left;
  transition: background .15s;
}
.pm-item:first-child { border-top: 0; }
.pm-item:hover { background: var(--surface-2); }
.pm-item svg { width: 17px; height: 17px; stroke: var(--ink-2); flex: 0 0 auto; }
.pm-item .pm-chev { margin-left: auto; stroke: var(--ink-3); width: 15px; height: 15px; }
.pm-item.danger { color: var(--red); }
.pm-item.danger svg { stroke: var(--red); }

/* ============ Contratos ============ */
.kpi-row.kpi-row-5 { grid-template-columns: repeat(5, 1fr); }

/* Novo contrato: escolha do caminho (orçamento aprovado × manual) */
.ct-choice {
  display: flex; align-items: flex-start; gap: 14px; width: 100%;
  padding: 16px; margin-bottom: 10px;
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); cursor: pointer; text-align: left;
  font: inherit; color: inherit;
  transition: border-color .15s, background .15s;
}
.ct-choice:hover { border-color: var(--accent); background: var(--accent-softer); }
.ct-choice-ic {
  display: grid; place-items: center; width: 38px; height: 38px; flex-shrink: 0;
  border-radius: 10px; background: var(--accent-soft);
}
.ct-choice-ic svg { width: 18px; height: 18px; stroke: var(--accent-text); }
.ct-choice-tx { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ct-choice-tx strong { font-size: 14px; }

/* Editor de contrato: texto à esquerda, prévia em tempo real à direita */
.ct-editor { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: stretch; }
.ct-editor .ct-body { min-height: 340px; font-size: 12.5px; line-height: 1.7; resize: vertical; }
.ct-preview {
  border: 1px solid var(--line-2); border-radius: var(--r-md);
  background: var(--surface-2);
  padding: 14px 16px;
  font-size: 12px; line-height: 1.8; color: var(--ink);
  max-height: 340px; overflow-y: auto;
  text-align: justify;
}
.var-chip {
  display: inline-block; padding: 1px 7px; border-radius: 6px;
  background: var(--accent-soft); color: var(--accent-text);
  font-size: 11px; font-weight: 600; white-space: nowrap;
}
.var-missing {
  background: var(--amber-soft); color: var(--amber);
  border-radius: 4px; padding: 0 4px; font-weight: 600;
}

/* ============ Responsivo ============ */
@media (max-width: 1080px) {
  .kpi-row { grid-template-columns: 1fr 1fr; }
  .kpi:nth-child(2) { border-right: 0; }
  .kpi:nth-child(1), .kpi:nth-child(2) { border-bottom: 1px solid var(--line-2); }
  .kpi-row.kpi-row-5 { grid-template-columns: repeat(3, 1fr); }
  .kpi-row.kpi-row-5 .kpi:nth-child(2) { border-right: 1px solid var(--line-2); }
  .kpi-row.kpi-row-5 .kpi:nth-child(3) { border-right: 0; border-bottom: 1px solid var(--line-2); }
  .calc-layout { grid-template-columns: 1fr; }
  .calc-result { position: static; }
  .grid-2 { grid-template-columns: 1fr; }
  .settings-layout { grid-template-columns: 1fr; }
  .settings-nav { flex-direction: row; overflow-x: auto; position: static; padding-bottom: 4px; }
  .settings-nav button { white-space: nowrap; }
}

@media (max-width: 900px) {
  /* Mobile: sem sidebar/hambúrguer — a navegação vive no rodapé (bottom nav) */
  .sidebar { display: none; }
  #quickAddBtn { display: none; } /* o "+" central da bottom nav assume a criação rápida */
  .topbar { padding: 12px 18px; gap: 10px; }
  .view { padding: 4px 18px calc(88px + env(safe-area-inset-bottom)); }
  .bottom-nav { display: flex; }
  .trial-banner { bottom: calc(78px + env(safe-area-inset-bottom)); }
  .tour-panel { bottom: calc(86px + env(safe-area-inset-bottom)); }
  /* Busca: nunca maior que o espaço disponível — o width fixo de foco
     (340px) estourava a tela e "cortava" o ícone da lupa. */
  .searchbox, .searchbox:focus-within { width: auto; flex: 1 1 130px; min-width: 0; max-width: 300px; }
  .searchbox kbd { display: none; }
  .kanban { margin: 0 -18px; padding-left: 18px; padding-right: 18px; scroll-snap-type: x proximity; }
  .kanban-col { flex-basis: 82vw; width: 82vw; max-width: 320px; }
  .fin-cards { grid-template-columns: 1fr 1fr; }
  .quote-item-row { grid-template-columns: 1fr 60px 90px 90px 30px; }
  /* Editor de contrato: prévia embaixo do texto em telas estreitas */
  .ct-editor { grid-template-columns: 1fr; }
  .ct-editor .ct-body { min-height: 220px; }
  .ct-preview { max-height: 240px; }
}

@media (max-width: 620px) {
  .kpi-row { grid-template-columns: 1fr 1fr; }
  .kpi-row.kpi-row-3 { grid-template-columns: 1fr; }
  .kpi-row.kpi-row-5 { grid-template-columns: 1fr 1fr; }
  .kpi-row.kpi-row-5 .kpi:nth-child(2) { border-right: 0; }
  .kpi-row.kpi-row-5 .kpi:nth-child(3) { border-right: 1px solid var(--line-2); }
  .kpi-row.kpi-row-5 .kpi:nth-child(4) { border-right: 0; border-bottom: 1px solid var(--line-2); }
  .kpi-row.kpi-row-3 .kpi { border-right: 0; border-bottom: 1px solid var(--line-2); }
  .kpi-row.kpi-row-3 .kpi:last-child { border-bottom: 0; }
  .kpi { padding: 16px 18px; }
  .kpi-value { font-size: 21px; }
  .page-head h1 { font-size: 20px; }
  .hide-mobile { display: none; }
  .panel-head { flex-wrap: wrap; row-gap: 4px; }

  /* Listas (Em andamento / Tarefas pendentes): layout vertical — o texto
     ocupa a linha toda (podendo quebrar) e o status/prazo desce para uma
     linha própria, em vez de espremer e cortar o título. */
  .rowitem { flex-wrap: wrap; padding: 12px 16px; row-gap: 6px; }
  .rowitem .grow { flex: 1 1 calc(100% - 50px); }
  .rowitem .title { white-space: normal; }
  .rowitem .meta { white-space: normal; }
  .rowitem > .badge, .rowitem > .end { margin-left: 48px; }
  .rowitem > .prio + .grow { flex-basis: calc(100% - 30px); }
  .rowitem > .prio ~ .end { margin-left: 26px; text-align: left; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: span 1; }
  .stats-inline { flex-wrap: wrap; }
  .stat-cell { min-width: 45%; border-bottom: 1px solid var(--line-2); }
  .quote-paper { padding: 24px 20px; }
  .modal-foot { flex-wrap: wrap; }
  .quote-item-row { grid-template-columns: 1fr 50px 80px 28px; }
  .quote-item-row .line-total { display: none; }

  /* Tabelas → cartões empilhados (evita corte/scroll horizontal em telas
     estreitas). A 1ª célula vira o "título" do cartão, as com [data-label]
     ganham um rótulo (ex.: "STATUS"), e a última célula (ações) flutua no
     canto superior direito. Colunas .hide-sm continuam ocultas. */
  .table-wrap { overflow-x: visible; }
  table.table thead { display: none; }
  table.table, table.table tbody, table.table tr, table.table td { display: block; width: auto; }
  table.table tr {
    padding: 13px 44px 13px 16px; border-bottom: 1px solid var(--line-2); position: relative;
  }
  table.table td { padding: 2px 0; border: 0; }
  table.table td[data-label] { display: flex; align-items: center; gap: 7px; font-size: 12.5px; }
  table.table td.hide-sm { display: none; }
  table.table td[data-label]::before {
    content: attr(data-label); flex: 0 0 auto; min-width: 64px;
    font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3);
  }
  table.table td:first-child { padding-bottom: 6px; }
  table.table td:last-child:not([data-label]) { position: absolute; top: 11px; right: 6px; padding: 0; }

  .balance-strip { flex-wrap: wrap; gap: 8px 14px; padding: 12px 16px; }
  .balance-strip .bs-value { font-size: 19px; }
  .balance-strip .bs-go { display: none; }
  .report-grid { grid-template-columns: 1fr; }
  .dist-wrap { flex-direction: column; gap: 14px; padding: 12px 16px 18px; }
  .dist-donut { flex-basis: auto; }
  .dist-legend { width: 100%; }
  .cal-cell { min-height: 64px; padding: 4px; }
  .cal-task { font-size: 10px; padding: 2px 4px; }
  .recv-month { padding: 12px 16px; }
  .recv-row { flex-wrap: wrap; padding: 12px 16px; row-gap: 6px; }
  .recv-row .grow { flex-basis: 100%; }
  .recv-row [data-charge], .recv-row [data-day-charge] { margin-left: auto; }
  .pend-row { flex-wrap: wrap; padding: 10px 16px; }
  .today-chips { padding: 12px 16px 4px; }
  .pend-head { padding: 12px 16px 4px; }
  .page-head-actions { width: 100%; }
  /* Seletor de período em linha própria (largura total) — dividir espaço com
     os botões de ação espremia o controle a ponto de mostrar um único item */
  .page-head-actions .segmented { flex: 1 1 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .page-head-actions .segmented::-webkit-scrollbar { display: none; }
  .page-head-actions .segmented button { white-space: nowrap; flex: 1; }
  .page-head-actions #taskClientFilter { flex: 1; width: auto !important; }

  /* Kanban vertical: colunas empilhadas em vez de rolagem horizontal —
     no touch (iOS/Android) arrastar uma lista larga pros lados é ruim, e
     o drag-and-drop HTML5 nem funciona em toque no Safari iOS. O usuário
     só rola a página pra baixo pra ver todas as etapas. */
  .kanban-wrap::before, .kanban-wrap::after { display: none; }
  .kanban-scroll-top { display: none !important; }
  .kanban {
    flex-direction: column;
    overflow-x: visible;
    margin: 0; padding: 0 0 4px;
  }
  .kanban-col { flex: 1 1 auto; width: 100%; max-width: none; scroll-snap-align: none; }
  .kanban-add-col { flex: 1 1 auto; width: 100%; padding-top: 0; }
}

/* Reduz movimento se o usuário preferir */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ============ Acessibilidade: foco visível no teclado ============ */
/* Navegação por Tab ganha um anel de foco claro; cliques de mouse não
   mostram o anel (por isso :focus-visible e não :focus). */
.btn:focus-visible, .icon-btn:focus-visible, .chip:focus-visible,
.nav-item:focus-visible, .auth-link:focus-visible, .panel-link:focus-visible,
.segmented button:focus-visible, .tabs button:focus-visible,
.settings-nav button:focus-visible, .pipe-step:focus-visible,
.pop-item:focus-visible, .search-result:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}


/* ============ Autenticação (tela de login) ============ */
.auth-screen {
  position: fixed; inset: 0; z-index: 500;
  background: var(--bg);
  display: grid; grid-template-columns: 1.04fr .96fr;
  animation: authFade .4s var(--ease);
}
@keyframes authFade { from { opacity: 0; } }

.auth-brand {
  position: relative; overflow: hidden; color: #fff;
  padding: 52px 48px;
  display: flex; flex-direction: column; justify-content: space-between;
  background: linear-gradient(160deg, #0F2747 0%, #143A6B 52%, #1957A6 100%);
}
.auth-brand::before {
  content: ''; position: absolute; top: -120px; right: -120px;
  width: 380px; height: 380px; border-radius: 50%;
  background: radial-gradient(circle, rgba(95, 176, 255, .35), transparent 70%);
}
.auth-brand::after {
  content: ''; position: absolute; bottom: -150px; left: -110px;
  width: 340px; height: 340px; border-radius: 50%;
  background: radial-gradient(circle, rgba(95, 176, 255, .16), transparent 70%);
}
.auth-wordmark { height: 40px; width: auto; position: relative; }
.auth-tagline {
  position: relative;
  font-family: var(--font-display);
  font-size: 30px; font-weight: 600; line-height: 1.22; letter-spacing: -.02em;
  max-width: 400px;
}
.auth-features { margin-top: 26px; display: flex; flex-direction: column; gap: 13px; }
.auth-feature { display: flex; align-items: center; gap: 12px; font-size: 14px; color: rgba(255,255,255,.86); }
.auth-feature .fi { width: 26px; height: 26px; border-radius: 8px; background: rgba(255,255,255,.14); display: grid; place-items: center; flex-shrink: 0; }
.auth-feature .fi svg { width: 14px; height: 14px; stroke: #fff; }
.auth-brand-foot { position: relative; font-size: 12.5px; color: rgba(255,255,255,.6); }

.auth-form-wrap { display: flex; align-items: center; justify-content: center; padding: 40px 28px; overflow-y: auto; }
.auth-card { width: min(384px, 100%); animation: viewIn .35s var(--ease) both; }
.auth-logo-mobile { display: none; margin-bottom: 22px; }
.auth-logo-mobile .brand-logo { height: 44px; }
.auth-card h1 { font-family: var(--font-display); font-size: 24px; font-weight: 600; letter-spacing: -.02em; }
.auth-sub { color: var(--ink-2); font-size: 13.5px; margin-top: 5px; margin-bottom: 24px; }
.auth-card .field { margin-bottom: 14px; }

.pwd-wrap { position: relative; }
.pwd-wrap .input { padding-right: 40px; }
.pwd-wrap .pwd-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); }

.auth-row { display: flex; justify-content: flex-end; margin: -2px 0 18px; }
.auth-link { border: 0; background: transparent; color: var(--accent-text); font-weight: 600; font-size: 13px; cursor: pointer; padding: 2px 4px; border-radius: 6px; }
.auth-link:hover { text-decoration: underline; }
.auth-foot { text-align: center; font-size: 13.5px; color: var(--ink-2); margin-top: 22px; }
.auth-demo {
  display: flex; align-items: flex-start; gap: 9px; margin-top: 22px;
  padding: 11px 13px; background: var(--accent-softer);
  border: 1px solid var(--line); border-radius: 11px;
  font-size: 12px; line-height: 1.5; color: var(--ink-2);
}
.auth-demo svg { width: 14px; height: 14px; stroke: var(--accent); flex-shrink: 0; margin-top: 1px; }

.auth-success { text-align: center; padding: 8px 0; }
.auth-success .as-ic { width: 56px; height: 56px; border-radius: 50%; background: var(--green-soft); display: grid; place-items: center; margin: 0 auto 16px; }
.auth-success .as-ic svg { width: 25px; height: 25px; stroke: var(--green); }

@media (max-width: 860px) {
  .auth-screen { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
  .auth-logo-mobile { display: block; }
}
