/* ==========================================================================
   Contas TI — Design System (Fase 1: tema dark premium)
   Todas as cores vêm de tokens em :root. Evite hexadecimais soltos fora
   desta seção — isso é o que torna o tema consistente e fácil de ajustar.
   ========================================================================== */
:root {
  /* Superfícies (do mais escuro/fundo para o mais claro/elevado) */
  --bg: #0a0e1a;
  --bg-elevated: #0d1220;
  --surface: #111827;
  --surface-2: #161f33;
  --surface-hover: #1b263f;
  --line: #24314a;
  --line-soft: #1a2439;

  /* Texto */
  --text: #e8edf7;
  --text-strong: #ffffff;
  --muted: #8d9bb8;
  --muted-soft: #6b7794;

  /* Cor de marca: azul (principal) + ciano (destaque) */
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --primary-light: #60a5fa;
  --primary-soft: rgba(59, 130, 246, .16);
  --cyan: #22d3ee;
  --cyan-soft: rgba(34, 211, 238, .16);

  /* Roxo — uso secundário, esporádico (ex.: um tipo de badge, um destaque) */
  --purple: #a78bfa;
  --purple-soft: rgba(167, 139, 250, .16);

  /* Estados */
  --success: #34d399;
  --success-soft: rgba(52, 211, 153, .14);
  --warning: #fb923c;
  --warning-soft: rgba(251, 146, 60, .14);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, .14);
  --neutral: #94a3b8;
  --neutral-soft: rgba(148, 163, 184, .12);

  /* Profundidade */
  --shadow: 0 24px 60px rgba(0, 0, 0, .55);
  --shadow-soft: 0 10px 28px rgba(0, 0, 0, .35);
  --shadow-inset: inset 0 1px 0 rgba(255, 255, 255, .03);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 22px;

  /* Foco (acessibilidade — sempre visível pelo teclado) */
  --focus-ring: 0 0 0 3px rgba(59, 130, 246, .45);

  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body[data-theme="nidhium-cyan"] {
  --bg: #03121b;
  --bg-elevated: #071a25;
  --surface: #0a2130;
  --surface-2: #0d2738;
  --surface-hover: #123345;
  --line: #16465d;
  --line-soft: #12384c;
  --text: #e7fdff;
  --text-strong: #ffffff;
  --muted: #88b8c2;
  --muted-soft: #6fa0aa;
  --primary: #13e7f2;
  --primary-dark: #00c8df;
  --primary-light: #7ef8ff;
  --primary-soft: rgba(19, 231, 242, .18);
  --cyan: #13e7f2;
  --cyan-soft: rgba(19, 231, 242, .18);
  --shadow: 0 24px 60px rgba(0, 9, 14, .62);
  --focus-ring: 0 0 0 3px rgba(19, 231, 242, .32);
}

body[data-theme="onyx-gold"] {
  --bg: #090806;
  --bg-elevated: #12100c;
  --surface: #17140f;
  --surface-2: #1d1912;
  --surface-hover: #262018;
  --line: #3a2d17;
  --line-soft: #2c2417;
  --text: #f5f2ea;
  --text-strong: #ffffff;
  --muted: #d1c2a0;
  --muted-soft: #a99873;
  --primary: #d4af37;
  --primary-dark: #b9931f;
  --primary-light: #f0cf6a;
  --primary-soft: rgba(212, 175, 55, .18);
  --cyan: #f0cf6a;
  --cyan-soft: rgba(212, 175, 55, .18);
  --warning: #f0b74b;
  --shadow: 0 24px 60px rgba(0, 0, 0, .62);
  --focus-ring: 0 0 0 3px rgba(212, 175, 55, .30);
}

/* ---------- Reset e base ---------- */
* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: var(--primary-light); }
h1, h2, h3 { color: var(--text-strong); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.mobile-only { display: none; }
code { font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace; }

/* Foco visível pelo teclado em qualquer elemento interativo */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, [tabindex]:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--radius-sm);
}

/* Rolagem discreta e coerente com o tema escuro */
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 999px; border: 3px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--muted-soft); }
* { scrollbar-color: var(--line) transparent; scrollbar-width: thin; }

/* ---------- Tela de login ---------- */
.login-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 1.05fr) minmax(360px, .95fr);
  align-items: center;
  padding: clamp(24px, 6vw, 88px);
  gap: 8vw;
  background:
    radial-gradient(circle at 18% 18%, rgba(59, 130, 246, .22), transparent 30%),
    radial-gradient(circle at 78% 80%, rgba(34, 211, 238, .14), transparent 32%),
    linear-gradient(160deg, #060a13 0%, #0a1428 55%, #060a13 100%);
  color: var(--text-strong);
}
.login-brand { display: flex; align-items: center; gap: 24px; max-width: 650px; }
.login-brand h1 { font-size: clamp(42px, 6vw, 76px); margin: 0 0 10px; letter-spacing: -.055em; color: var(--text-strong); }
.login-brand p { color: #b9c6e0; font-size: clamp(17px, 2vw, 22px); line-height: 1.55; margin: 0; }
.brand-mark { width: 82px; height: 82px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 24px; background: linear-gradient(145deg, var(--cyan), var(--primary)); color: #04101f; font-weight: 900; font-size: 28px; box-shadow: 0 22px 46px rgba(0,0,0,.45); }
.brand-mark.small { width: 42px; height: 42px; border-radius: 13px; font-size: 16px; box-shadow: none; }
.img-mark { background: none !important; border-radius: 0; box-shadow: none; }
.login-card { background: rgba(17, 24, 39, .82); backdrop-filter: blur(22px); color: var(--text); padding: clamp(28px, 4vw, 46px); border-radius: var(--radius-lg); box-shadow: var(--shadow); display: grid; gap: 20px; border: 1px solid rgba(255,255,255,.09); }
.login-card h2 { margin: 6px 0; font-size: 30px; letter-spacing: -.03em; }
.login-card small { color: var(--muted); text-align: center; }

/* ---------- Estrutura do app ---------- */
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 264px 1fr; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 264px; padding: 22px 14px; background: var(--bg-elevated); color: var(--text); display: flex; flex-direction: column; z-index: 20; border-right: 1px solid var(--line-soft); }
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 0 10px 22px; }
.sidebar-brand strong, .sidebar-brand span { display: block; }
.sidebar-brand strong { font-size: 14px; color: var(--text-strong); }
.sidebar-brand span { color: var(--muted); font-size: 11px; margin-top: 3px; }

.nav-list { display: grid; gap: 4px; overflow-y: auto; padding-right: 2px; }
.nav-group { margin-top: 14px; }
.nav-group:first-child { margin-top: 0; }
.nav-group-label { padding: 0 13px 7px; font-size: 10px; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; color: var(--muted-soft); }
.nav-item { border: 0; width: 100%; background: transparent; color: #a9b7d1; text-align: left; display: flex; align-items: center; gap: 11px; padding: 10px 13px; border-radius: var(--radius-sm); transition: background .16s ease, color .16s ease; font-size: 13.5px; font-weight: 600; }
.nav-item:hover { color: var(--text-strong); background: var(--surface-hover); }
.nav-item.active { color: var(--text-strong); background: var(--primary-soft); box-shadow: inset 3px 0 0 var(--cyan); }
.nav-item span:first-child { width: 20px; text-align: center; opacity: .85; }
.count-badge { margin-left: auto; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; display: grid; place-items: center; background: var(--danger); color: #1a0505; font-size: 11px; font-weight: 800; }
.sidebar-footer { margin-top: auto; display: grid; gap: 12px; padding-top: 14px; }
.user-card { display: flex; gap: 11px; align-items: center; padding: 11px; background: var(--surface); border: 1px solid var(--line-soft); border-radius: 14px; }
.avatar { width: 38px; height: 38px; display: grid; place-items: center; background: linear-gradient(145deg, var(--cyan), var(--primary)); color: #04101f; font-weight: 800; border-radius: 12px; }
.user-card-text { min-width: 0; }
.user-card-text strong, .user-card-text span { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.user-card-text strong { color: var(--text-strong); font-size: 13px; }
.user-card-text span { color: var(--muted); font-size: 11px; margin-top: 2px; }

.main-area { grid-column: 2; min-width: 0; }
.topbar { min-height: var(--topbar-height); padding: 12px 26px; background: rgba(10, 14, 26, .82); border-bottom: 1px solid var(--line-soft); display: flex; align-items: center; gap: 18px; justify-content: space-between; position: sticky; top: 0; z-index: 30; backdrop-filter: blur(18px); transition: box-shadow .15s ease; }
.topbar.is-scrolled { box-shadow: 0 8px 24px rgba(0,0,0,.35); }
.topbar-heading { min-width: 0; }
.topbar h1 { font-size: 22px; margin: 3px 0 0; letter-spacing: -.025em; color: var(--text-strong); }
.topbar-actions { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.eyebrow { text-transform: uppercase; letter-spacing: .13em; font-weight: 800; font-size: 10px; color: var(--cyan); margin: 0; }
.content { padding: 26px 30px 48px; max-width: 1560px; margin: 0 auto; }

/* Breadcrumb */
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted-soft); margin: 0 0 4px; flex-wrap: wrap; }
.breadcrumb .breadcrumb-sep { color: var(--line); }
.breadcrumb .breadcrumb-current { color: var(--muted); font-weight: 650; }

/* ---------- Botões ---------- */
.btn { border: 1px solid transparent; border-radius: var(--radius-sm); padding: 10px 15px; font-weight: 700; font-size: 13px; transition: transform .12s ease, background .16s ease, border-color .16s ease, box-shadow .16s ease; display: inline-flex; align-items: center; justify-content: center; gap: 7px; white-space: nowrap; }
.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn.primary { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; box-shadow: 0 10px 22px rgba(37, 99, 235, .35); }
.btn.primary:hover { box-shadow: 0 12px 26px rgba(37, 99, 235, .45); }
.btn.secondary { background: var(--surface-2); border-color: var(--line); color: var(--text); }
.btn.secondary:hover { background: var(--surface-hover); border-color: var(--muted-soft); }
.btn.danger { background: var(--danger-soft); color: var(--danger); border-color: rgba(248, 113, 113, .35); }
.btn.danger:hover { background: rgba(248, 113, 113, .22); }
.btn.success { background: linear-gradient(135deg, var(--success), #10a877); color: #04150e; box-shadow: 0 10px 22px rgba(52, 211, 153, .25); }
.btn.ghost { color: var(--muted); background: transparent; border-color: var(--line); }
.btn.ghost:hover { color: var(--text); border-color: var(--muted-soft); background: var(--surface-hover); }
.btn.small { padding: 7px 10px; border-radius: 9px; font-size: 12px; }
.btn.full { width: 100%; }
.icon-button { width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); display: inline-grid; place-items: center; position: relative; font-size: 17px; transition: background .16s ease, border-color .16s ease; }
.icon-button:hover { background: var(--surface-hover); border-color: var(--muted-soft); }
.floating-badge { position: absolute; top: -6px; right: -6px; background: var(--danger); color: #1a0505; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px; font-size: 10px; font-weight: 800; display: grid; place-items: center; }

/* ---------- Dashboard / KPIs ---------- */
.dashboard-intro { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.dashboard-intro h2 { margin: 5px 0 4px; font-size: clamp(23px, 3vw, 34px); letter-spacing: -.04em; color: var(--text-strong); }
.dashboard-intro p { margin: 0; color: var(--muted); max-width: 720px; }
.cards-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; margin-bottom: 20px; }
.metric-card { background: linear-gradient(165deg, var(--surface) 0%, var(--surface) 60%, var(--surface-2) 100%); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 19px; box-shadow: var(--shadow-soft), var(--shadow-inset); position: relative; overflow: hidden; }
.metric-card::after { content: ""; position: absolute; inset: auto -22px -35px auto; width: 100px; height: 100px; border-radius: 50%; background: var(--primary-soft); opacity: .55; filter: blur(2px); }
.metric-card.danger::after { background: var(--danger-soft); }
.metric-card.warning::after { background: var(--warning-soft); }
.metric-card.neutral::after { background: var(--neutral-soft); }
.metric-card.success::after { background: var(--success-soft); }
.metric-card.info::after { background: var(--cyan-soft); }
.metric-card.neutral .metric-icon { background: var(--neutral-soft); color: var(--neutral); }
.metric-card.success .metric-icon { background: var(--success-soft); color: var(--success); }
.metric-card.info .metric-icon { background: var(--cyan-soft); color: var(--cyan); }
.metric-card.clickable { cursor: pointer; transition: transform .14s ease, border-color .14s ease; }
.metric-card.clickable:hover { transform: translateY(-2px); border-color: var(--muted-soft); }
.metric-card .metric-delta { font-size: 11px; font-weight: 750; margin-top: 4px; display: inline-flex; }
.metric-card .metric-delta.up { color: var(--danger); }
.metric-card .metric-delta.down { color: var(--success); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.charts-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 15px; margin-bottom: 18px; }
.chart-card .panel-body { padding-top: 6px; }
.chart-svg { width: 100%; height: auto; display: block; }
.chart-svg rect { transition: opacity .12s ease; }
.chart-svg rect:hover { opacity: .8; }
.chart-legend { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 6px; font-size: 11px; color: var(--muted); }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.dashboard-limitations { font-size: 11px; margin: -6px 0 14px; line-height: 1.5; padding: 9px 12px; background: var(--surface-2); border: 1px solid var(--line-soft); border-radius: 10px; }
.metric-card-top { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 12.5px; position: relative; z-index: 1; }
.metric-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; background: var(--primary-soft); color: var(--primary-light); font-weight: 850; }
.metric-card.danger .metric-icon { background: var(--danger-soft); color: var(--danger); }
.metric-card.warning .metric-icon { background: var(--warning-soft); color: var(--warning); }
.metric-card.neutral .metric-icon { background: var(--neutral-soft); color: var(--neutral); }
.metric-card strong { display: block; margin-top: 14px; font-size: clamp(24px, 3vw, 31px); letter-spacing: -.045em; position: relative; z-index: 1; color: var(--text-strong); }
.metric-card small { display: block; color: var(--muted); margin-top: 6px; position: relative; z-index: 1; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(300px, .55fr); gap: 18px; }
.stack { display: grid; gap: 18px; align-content: start; }

/* ---------- Cards / painéis ---------- */
.panel { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); box-shadow: var(--shadow-soft); overflow: hidden; }
.panel-header { min-height: 66px; padding: 15px 19px; border-bottom: 1px solid var(--line-soft); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.panel-header h2 { font-size: 16px; margin: 0; letter-spacing: -.015em; color: var(--text-strong); }
.panel-header p { color: var(--muted); font-size: 12px; margin: 4px 0 0; }
.panel-body { padding: 19px; }
.panel-body.no-padding { padding: 0; }

/* ---------- Filtros / formulários ---------- */
.filters { display: grid; grid-template-columns: 1.35fr repeat(4, minmax(130px, .7fr)) auto; gap: 10px; align-items: end; padding: 16px; background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); margin-bottom: 17px; box-shadow: var(--shadow-soft); }
label { display: grid; gap: 7px; font-size: 12px; font-weight: 700; color: var(--muted); }
.form-label { display: block; font-size: 12px; font-weight: 750; color: var(--muted); margin-bottom: 8px; }
input, select, textarea {
  width: 100%; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text); padding: 10px 11px; outline: none; transition: border-color .15s ease, box-shadow .15s ease;
}
input::placeholder, textarea::placeholder { color: var(--muted-soft); }
input:focus, select:focus, textarea:focus { border-color: var(--primary-light); box-shadow: 0 0 0 4px var(--primary-soft); }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%238d9bb8' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 30px; }
textarea { resize: vertical; min-height: 82px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.form-grid .span-2 { grid-column: span 2; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; padding-top: 9px; flex-wrap: wrap; }
.form-error { color: var(--danger); background: var(--danger-soft); border: 1px solid rgba(248,113,113,.3); padding: 10px 12px; border-radius: var(--radius-sm); margin: 0; font-size: 13px; }
.type-selector { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.type-option { position: relative; cursor: pointer; }
.type-option input { position: absolute; opacity: 0; pointer-events: none; }
.type-option span { display: block; height: 100%; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); transition: .16s ease; }
.type-option strong, .type-option small { display: block; }
.type-option strong { color: var(--text); font-size: 14px; }
.type-option small { color: var(--muted); font-weight: 500; line-height: 1.4; margin-top: 5px; }
.type-option:has(input:checked) span { border-color: var(--primary-light); background: var(--primary-soft); box-shadow: 0 0 0 3px rgba(59,130,246,.18); }
.schedule-help { display: flex; gap: 10px; align-items: center; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 11px 13px; }
.schedule-help > span { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; background: var(--primary); color: #fff; font-weight: 800; font-size: 12px; flex: 0 0 auto; }
.schedule-help p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.account-type-readonly { display: flex; align-items: center; gap: 12px; padding: 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 13px; }
.account-type-readonly strong, .account-type-readonly small { display: block; }
.account-type-readonly small { color: var(--muted); margin-top: 3px; }
.payment-summary { display: grid; gap: 3px; padding: 14px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 13px; }
.payment-summary span, .payment-summary small { color: var(--muted); }
.payment-summary strong { font-size: 24px; letter-spacing: -.03em; color: var(--text-strong); }

/* ---------- Tabelas ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 15px; border-bottom: 1px solid var(--line-soft); text-align: left; vertical-align: middle; }
th { background: var(--surface-2); color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .07em; font-weight: 750; }
td { font-size: 13px; color: var(--text); }
tbody tr { transition: background .12s ease; }
tbody tr:hover { background: var(--surface-hover); }
.overdue-row { background: rgba(248, 113, 113, .07); }
.overdue-row:hover { background: rgba(248, 113, 113, .13); }
.table-title { font-weight: 750; color: var(--text-strong); }
.table-link { border: 0; padding: 0; background: transparent; color: var(--text); font-weight: 800; text-align: left; }
.table-link:hover { color: var(--primary-light); }
.table-subtitle { color: var(--muted); font-size: 11px; display: block; margin-top: 3px; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- Badges / status ---------- */
.status, .type-badge, .badge { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 5px 9px; font-size: 10px; font-weight: 850; letter-spacing: .035em; white-space: nowrap; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status.PENDENTE { color: var(--warning); background: var(--warning-soft); }
.status.PAGO { color: var(--success); background: var(--success-soft); }
.status.VENCIDO { color: var(--danger); background: var(--danger-soft); }
.status.CANCELADO { color: var(--neutral); background: var(--neutral-soft); }
.badge.success { color: var(--success); background: var(--success-soft); }
.badge.danger { color: var(--danger); background: var(--danger-soft); }
.badge.warning { color: var(--warning); background: var(--warning-soft); }
.badge.info { color: var(--cyan); background: var(--cyan-soft); }
.badge.purple { color: var(--purple); background: var(--purple-soft); }
.badge.neutral { color: var(--neutral); background: var(--neutral-soft); }
.list-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 13px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; }
.list-row small { color: var(--muted); }
.org-structure-block { padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.org-structure-block:last-child { border-bottom: none; }
.org-structure-block > strong { display: block; margin-bottom: 8px; font-size: 13px; color: var(--text-strong); }
.chip-row { margin-top: 8px; display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); font-size: 11px; font-weight: 650; color: var(--text); }
.chip-muted { opacity: .55; }
.type-badge.FIXA { color: var(--primary-light); background: var(--primary-soft); }
.type-badge.TEMPORARIA { color: var(--purple); background: var(--purple-soft); }
.type-badge.AVULSA { color: var(--neutral); background: var(--neutral-soft); }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; }
.pagination-controls { display: flex; gap: 7px; }

/* ---------- Abas (tabs) — pronto para o seletor de contexto do dashboard ---------- */
.tabs { display: flex; gap: 4px; padding: 4px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 13px; width: fit-content; overflow-x: auto; }
.tab { border: 0; background: transparent; color: var(--muted); padding: 8px 14px; border-radius: 9px; font-size: 12.5px; font-weight: 700; white-space: nowrap; transition: .15s ease; }
.tab:hover { color: var(--text); }
.tab.active { background: var(--surface); color: var(--text-strong); box-shadow: var(--shadow-soft); }

/* ---------- Estados vazios ---------- */
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty-icon { width: 44px; height: 44px; margin: 0 auto 12px; display: grid; place-items: center; border-radius: 14px; background: var(--success-soft); color: var(--success); font-weight: 900; font-size: 17px; }
.empty strong, .empty span { display: block; }
.empty strong { color: var(--text); margin-bottom: 5px; font-size: 14px; }

/* ---------- Alertas ---------- */
.alert-list { display: grid; gap: 10px; }
.alert-item { display: grid; grid-template-columns: auto 1fr auto; gap: 11px; align-items: start; padding: 13px; border: 1px solid var(--line-soft); border-radius: 13px; background: var(--surface-2); }
.alert-item.unread { border-color: rgba(59,130,246,.35); background: var(--primary-soft); }
.alert-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--primary-light); margin-top: 5px; }
.alert-item p { margin: 0; line-height: 1.45; font-size: 13px; color: var(--text); }
.alert-item time { color: var(--muted); font-size: 10px; display: block; margin-top: 5px; }

/* ---------- Modais ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(3, 6, 14, .72); display: grid; place-items: center; padding: 22px; z-index: 100; backdrop-filter: blur(5px); }
.modal { width: min(760px, 100%); max-height: calc(100vh - 44px); overflow: auto; background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.modal.wide { width: min(980px, 100%); }
.modal-header { position: sticky; top: 0; background: rgba(17, 24, 39, .94); backdrop-filter: blur(14px); padding: 18px 22px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line-soft); z-index: 2; }
.modal-header h2 { margin: 3px 0 0; font-size: 22px; letter-spacing: -.025em; color: var(--text-strong); }
.modal-content { padding: 22px; }
.detail-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 20px; }
.detail-item { padding: 13px; border: 1px solid var(--line-soft); border-radius: 12px; background: var(--surface-2); }
.detail-item span { display: block; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .07em; margin-bottom: 5px; }
.detail-item strong { font-size: 13px; color: var(--text); }
.history { display: grid; gap: 0; }
.history-item { position: relative; padding: 0 0 18px 25px; border-left: 1px solid var(--line); margin-left: 5px; }
.history-item::before { content: ""; position: absolute; left: -5px; top: 2px; width: 9px; height: 9px; border-radius: 50%; background: var(--primary-light); }
.history-item:last-child { padding-bottom: 0; }
.history-item p { margin: 0; font-size: 13px; color: var(--text); }
.history-item small { color: var(--muted); }

/* ---------- Configurações ---------- */
.settings-grid { display: grid; grid-template-columns: minmax(280px, .7fr) minmax(500px, 1.3fr); gap: 18px; }
.inline-form { display: flex; gap: 8px; align-items: end; flex-wrap: wrap; }
.inline-form > label { flex: 1 1 150px; }

/* ---------- Toasts ---------- */
.toast-container { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 10px; z-index: 200; }
.toast { min-width: 280px; max-width: 430px; background: var(--surface-2); color: var(--text); padding: 13px 15px; border-radius: 12px; border: 1px solid var(--line); border-left: 4px solid var(--primary); box-shadow: var(--shadow); animation: toast-in .2s ease; font-size: 13px; }
.toast.error { border-left-color: var(--danger); }
.toast.success { border-left-color: var(--success); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Carregamento (skeleton) ---------- */
.loading { min-height: 240px; display: grid; place-items: center; color: var(--muted); }
.spinner { width: 30px; height: 30px; border: 3px solid var(--line); border-top-color: var(--primary); border-radius: 50%; animation: spin .75s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton-block { display: grid; gap: 18px; }
.skeleton-cards { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 15px; }
.skeleton-card { height: 108px; border-radius: var(--radius); }
.skeleton-panel { height: 320px; border-radius: var(--radius); }
.skeleton-line { height: 14px; border-radius: 7px; }
.skeleton {
  background: linear-gradient(100deg, var(--surface) 30%, var(--surface-hover) 50%, var(--surface) 70%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
  border: 1px solid var(--line-soft);
}
@keyframes skeleton-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) {
  .skeleton, .spinner, .toast { animation: none !important; }
}

/* ---------- Responsividade (desktop → tablet → mobile) ---------- */
@media (max-width: 1180px) {
  .cards-grid, .skeleton-cards { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid, .settings-grid { grid-template-columns: 1fr; }
  .filters { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 760px) {
  .mobile-only { display: inline-grid; }
  .app-shell { display: block; }
  .sidebar { width: 264px; transform: translateX(-100%); transition: .2s ease; box-shadow: var(--shadow); }
  .sidebar.open { transform: translateX(0); }
  .main-area { grid-column: auto; }
  .topbar { padding: 14px; min-height: 74px; }
  .content { padding: 16px 13px 36px; }
  .topbar-actions .btn { display: none; }
  .cards-grid, .skeleton-cards, .filters, .type-selector { grid-template-columns: 1fr; }
  .dashboard-intro { align-items: flex-start; flex-direction: column; }
  .form-grid, .detail-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .modal-backdrop { padding: 0; align-items: end; }
  .modal, .modal.wide { width: 100%; max-height: 94vh; border-radius: 19px 19px 0 0; }
  .login-screen { grid-template-columns: 1fr; padding: 24px; }
  .login-brand { display: none; }
  .alert-item { grid-template-columns: auto 1fr; }
  .alert-item > button { grid-column: 2; justify-self: start; }
}

/* ---------- Configuração de e-mail ---------- */
.settings-grid-wide { grid-template-columns: minmax(620px, 1.45fr) minmax(420px, .85fr); }
.users-panel { align-self: start; position: sticky; top: 106px; }
.field-help { color: var(--muted); font-size: 10px; font-weight: 500; line-height: 1.4; }
.switch-line { display: inline-flex; grid-template-columns: auto auto; align-items: center; gap: 9px; color: var(--text); cursor: pointer; }
.switch-line input { width: 42px; height: 23px; accent-color: var(--primary); }
.checkbox-card { display: flex; flex-direction: row; align-items: flex-start; gap: 11px; padding: 12px 13px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.checkbox-card.compact { padding: 10px 12px; }
.checkbox-card input { width: 18px; height: 18px; margin-top: 1px; flex: 0 0 auto; accent-color: var(--primary); }
.checkbox-card span, .checkbox-card strong, .checkbox-card small { display: block; }
.checkbox-card strong { color: var(--text); font-size: 12px; }
.checkbox-card small { margin-top: 3px; color: var(--muted); font-weight: 500; line-height: 1.4; }
.config-status { display: block; margin-top: 1px; font-size: 10px; font-weight: 650; }
.config-status.success { color: var(--success); }
.config-status.danger { color: var(--danger); }
.config-status.neutral { color: var(--muted); }
.smtp-test-box { margin-top: 17px; padding: 15px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); display: grid; gap: 12px; }
.smtp-test-box strong { font-size: 13px; color: var(--text-strong); }
.smtp-test-box p { margin: 4px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.smtp-test-actions { display: grid; grid-template-columns: minmax(220px, 1fr) auto; gap: 9px; }
.inline-result { margin: 0 !important; padding: 10px 11px; border-radius: 10px; background: var(--primary-soft); color: var(--primary-light) !important; font-size: 11px !important; }
.inline-result.success { background: var(--success-soft); color: var(--success) !important; }
.inline-result.error { background: var(--danger-soft); color: var(--danger) !important; }
.template-help { padding: 13px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.template-help > strong { display: block; font-size: 12px; margin-bottom: 9px; color: var(--text-strong); }
.template-help p { margin: 10px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.template-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.template-chips code { padding: 4px 7px; border-radius: 7px; background: var(--surface); border: 1px solid var(--line); color: var(--cyan); font-size: 10px; }

@media (max-width: 1280px) {
  .settings-grid-wide { grid-template-columns: 1fr; }
  .users-panel { position: static; }
}
@media (max-width: 760px) {
  .smtp-test-actions { grid-template-columns: 1fr; }
  .switch-line { width: 100%; justify-content: space-between; }
}

/* ---------- Módulos operacionais v4 ---------- */
.knowledge-content { margin: 18px 0; padding: 18px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; line-height: 1.7; white-space: normal; overflow-wrap: anywhere; color: var(--text); }
.tall-textarea { min-height: 280px; }
table td small { color: var(--muted); }
@media (max-width: 760px) { .tall-textarea { min-height: 220px; } }

/* ---------- Tela de login premium (Nidhium) ---------- */
.login-slogan { font-size: 15px; color: var(--text); font-weight: 650; margin: 4px 0 10px; }
.login-value-prop { color: #b9c6e0; }
.login-benefits { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 9px; }
.login-benefits li { padding-left: 22px; position: relative; color: #cbd5f0; font-size: 13.5px; }
.login-benefits li::before { content: "✓"; position: absolute; left: 0; color: var(--cyan); font-weight: 800; }
.login-screen.simple { display: grid; place-items: center; grid-template-columns: 1fr; }
.not-found-card { max-width: 420px; text-align: center; background: rgba(17,24,39,.82); backdrop-filter: blur(20px); border: 1px solid rgba(255,255,255,.09); border-radius: var(--radius-lg); padding: 40px 32px; color: var(--text); }
.not-found-card img { margin-bottom: 16px; }
.not-found-card h2 { font-size: 19px; margin: 0 0 8px; }
.password-field { position: relative; display: block; }
.password-field input { padding-right: 42px; }
.password-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: transparent; border: 0; color: var(--muted); font-size: 15px; padding: 6px; border-radius: 8px; }
.password-toggle:hover { color: var(--text); }
.login-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 12.5px; }
.checkbox-inline { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; color: var(--muted); font-size: 12.5px; }
.checkbox-inline input { width: 16px; height: 16px; accent-color: var(--primary); }
.link-button { background: transparent; border: 0; color: var(--primary-light); font-weight: 700; font-size: 12.5px; padding: 0; }
.link-button:hover { text-decoration: underline; }
.login-footer-links { display: flex; gap: 16px; justify-content: center; font-size: 11.5px; margin: 6px 0 0; }
.login-footer-links a { color: var(--muted); text-decoration: none; }
.login-footer-links a:hover { color: var(--text); }
.login-copyright { text-align: center; color: var(--muted-soft); }
.form-hint { font-size: 12.5px; padding: 10px 12px; border-radius: 10px; margin: 0; }
.form-hint.success { background: var(--success-soft); color: var(--success); }
.password-requirements { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 12px; color: var(--muted); }
.password-requirements li { padding-left: 20px; position: relative; }
.password-requirements li::before { content: "○"; position: absolute; left: 0; }
.password-requirements li.met { color: var(--success); }
.password-requirements li.met::before { content: "✓"; color: var(--success); }
@media (prefers-reduced-motion: no-preference) {
  .login-card, .login-brand { animation: login-fade-in .35s ease both; }
}
@keyframes login-fade-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Menu de perfil (avatar no topo direito) ---------- */
.profile-menu-wrap { position: relative; }
.profile-avatar-button { border: 1px solid var(--line); cursor: pointer; padding: 0; overflow: hidden; }
.profile-avatar-button img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.profile-menu { position: absolute; top: calc(100% + 10px); right: 0; width: 260px; background: var(--surface); border: 1px solid var(--line-soft); border-radius: 16px; box-shadow: var(--shadow); z-index: 40; padding: 8px; }
.profile-menu-header { display: flex; gap: 11px; align-items: center; padding: 10px 8px 12px; border-bottom: 1px solid var(--line-soft); margin-bottom: 6px; }
.profile-menu-header strong, .profile-menu-header span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-menu-header strong { color: var(--text-strong); font-size: 13px; }
.profile-menu-header span { color: var(--muted); font-size: 11px; }
.profile-menu-org { color: var(--cyan) !important; font-size: 10px !important; margin-top: 2px; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }
.profile-menu hr { border: none; border-top: 1px solid var(--line-soft); margin: 6px 0; }
.profile-menu-item { width: 100%; display: flex; align-items: center; gap: 10px; text-align: left; background: transparent; border: 0; color: var(--text); font-size: 13px; font-weight: 600; padding: 9px 8px; border-radius: 10px; }
.profile-menu-item:hover { background: var(--surface-hover); }
@media (max-width: 760px) {
  .profile-menu { position: fixed; right: 12px; left: 12px; width: auto; top: auto; bottom: 16px; }
}

/* ---------- Tela Meu perfil ---------- */
.profile-grid { display: grid; grid-template-columns: minmax(240px, .8fr) minmax(0, 1.2fr); gap: 16px; grid-template-areas: "avatar form" "avatar security"; }
.profile-grid > section:nth-child(1) { grid-area: avatar; }
.profile-grid > section:nth-child(2) { grid-area: form; }
.profile-grid > section:nth-child(3) { grid-area: security; }
.profile-avatar-panel { display: grid; place-items: center; gap: 12px; text-align: center; }
.profile-avatar-preview { width: 120px; height: 120px; border-radius: 50%; overflow: hidden; background: var(--primary-soft); display: grid; place-items: center; border: 1px solid var(--line); }
.profile-avatar-preview img { width: 100%; height: 100%; object-fit: cover; }
.profile-avatar-preview span { font-size: 40px; font-weight: 800; color: var(--primary-light); }
.profile-avatar-actions { display: flex; gap: 8px; }
@media (max-width: 900px) {
  .profile-grid { grid-template-columns: 1fr; grid-template-areas: "avatar" "form" "security"; }
}

/* ---------- Cabeçalho compacto + seletor de dashboard sticky ---------- */
:root { --topbar-height: 68px; }
.tabs[role="tablist"] { position: sticky; top: var(--topbar-height); z-index: 25; background: rgba(10,14,26,.92); backdrop-filter: blur(16px); border: 1px solid var(--line-soft); margin: -4px -4px 18px; padding: 10px; border-radius: 0 0 16px 16px; overflow-x: auto; -ms-overflow-style: none; scrollbar-width: none; }
.tabs[role="tablist"]::-webkit-scrollbar { display: none; }
.tabs[role="tablist"].is-scrolled { box-shadow: 0 10px 26px rgba(0,0,0,.4); border-top-color: transparent; }
.tabs .tab { flex: 0 0 auto; }
@media (max-width: 760px) {
  .tabs[role="tablist"] { top: var(--topbar-height); border-radius: 0; margin: -16px -13px 16px; }
}

/* --------------------------------------------------------------------------
   Nidhium SaaS — criação pública de contas e provisionamento
   -------------------------------------------------------------------------- */
.account-field,
.slug-composer {
  display: flex;
  align-items: stretch;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2, #111c33);
  transition: border-color .18s ease, box-shadow .18s ease;
}
.account-field:focus-within,
.slug-composer:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent);
}
.account-prefix,
.slug-composer > span {
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  color: var(--text-muted);
  background: color-mix(in srgb, var(--surface) 88%, #000);
  border-right: 1px solid var(--border);
  white-space: nowrap;
  font-size: .85rem;
}
.account-field input,
.slug-composer input {
  min-width: 0;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
}
.login-create-link {
  margin: 0;
  text-align: center;
  color: var(--text-muted);
  font-size: .88rem;
}

.signup-screen {
  min-height: 100vh;
  padding: clamp(24px, 4vw, 64px);
  background:
    radial-gradient(circle at 14% 15%, rgba(47, 107, 255, .19), transparent 34%),
    radial-gradient(circle at 84% 83%, rgba(6, 182, 212, .09), transparent 31%),
    #050816;
  color: var(--text);
}
.signup-shell {
  width: min(1180px, 100%);
  min-height: calc(100vh - clamp(48px, 8vw, 128px));
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(280px, .8fr) minmax(520px, 1.2fr);
  gap: clamp(28px, 5vw, 72px);
  align-items: center;
}
.signup-aside {
  max-width: 480px;
}
.signup-logo {
  width: min(240px, 72%);
  height: auto;
  margin-bottom: 48px;
}
.signup-aside h1 {
  margin: 10px 0 16px;
  font-size: clamp(2rem, 4vw, 3.55rem);
  line-height: 1.02;
  letter-spacing: -.045em;
}
.signup-aside > p {
  max-width: 42ch;
  color: var(--text-muted);
  font-size: 1.06rem;
  line-height: 1.75;
}
.signup-card {
  position: relative;
  padding: clamp(24px, 4vw, 44px);
  border: 1px solid rgba(148, 163, 184, .2);
  border-radius: 24px;
  background: rgba(13, 23, 43, .88);
  box-shadow: 0 28px 80px rgba(0, 0, 0, .32);
  backdrop-filter: blur(18px);
  display: grid;
  gap: 20px;
}
.signup-card h2 {
  margin: 5px 0 8px;
  font-size: 1.75rem;
}
.signup-honeypot {
  position: fixed !important;
  left: -9999px !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
}
.field-help.checking { color: var(--info, #06b6d4); }
.field-help.success { color: var(--success, #10b981); }
.field-help.error { color: var(--danger, #ef4444); }

.provisioning-card {
  width: min(460px, calc(100vw - 32px));
  text-align: center;
  justify-items: center;
}
.provisioning-orbit {
  position: relative;
  width: 76px;
  height: 76px;
  border: 1px solid color-mix(in srgb, var(--primary) 42%, transparent);
  border-radius: 50%;
  margin-bottom: 8px;
  animation: provisioning-spin 2.5s linear infinite;
}
.provisioning-orbit::before,
.provisioning-orbit::after,
.provisioning-orbit span {
  content: "";
  position: absolute;
  border-radius: 50%;
}
.provisioning-orbit::before {
  inset: 13px;
  border: 1px solid rgba(6, 182, 212, .42);
}
.provisioning-orbit::after {
  width: 12px;
  height: 12px;
  top: -6px;
  left: calc(50% - 6px);
  background: var(--primary);
  box-shadow: 0 0 24px var(--primary);
}
.provisioning-orbit span {
  inset: 27px;
  background: linear-gradient(135deg, var(--primary), var(--info, #06b6d4));
}
.progress-track {
  width: 100%;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(148, 163, 184, .14);
}
.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--info, #06b6d4));
  box-shadow: 0 0 20px rgba(47, 107, 255, .4);
  transition: width .35s ease;
}
@keyframes provisioning-spin { to { transform: rotate(360deg); } }

@media (max-width: 900px) {
  .signup-shell { grid-template-columns: 1fr; align-items: start; }
  .signup-aside { max-width: none; text-align: center; }
  .signup-aside > p { margin-inline: auto; }
  .signup-aside .login-benefits { display: none; }
  .signup-logo { margin-bottom: 20px; }
}
@media (max-width: 620px) {
  .signup-screen { padding: 18px; }
  .signup-card { padding: 22px 18px; border-radius: 18px; }
  .form-grid.two { grid-template-columns: 1fr; }
  .account-prefix,
  .slug-composer > span { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .provisioning-orbit { animation: none; }
  .progress-track span { transition: none; }
}


.brand-icon { object-fit: contain; }
.link-button.subtle { align-self: flex-start; margin-top: -8px; color: var(--cyan); opacity: .92; }
.link-button.subtle:hover { opacity: 1; }
.theme-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-top: 12px; }
.theme-card { position: relative; border: 1px solid var(--line); background: var(--surface-2); border-radius: 14px; padding: 14px; cursor: pointer; display: grid; gap: 10px; }
.theme-card input { position: absolute; opacity: 0; pointer-events: none; }
.theme-card strong { color: var(--text-strong); font-size: 14px; }
.theme-card span { color: var(--muted); font-size: 12px; }
.theme-card .theme-swatches { display: flex; gap: 8px; }
.theme-card .theme-swatches i { width: 24px; height: 24px; border-radius: 999px; display: inline-block; border: 1px solid rgba(255,255,255,.08); }
.theme-card:has(input:checked) { border-color: var(--primary); box-shadow: var(--focus-ring); }
.theme-card:hover { background: var(--surface-hover); }
.theme-inline-note { margin-top: 10px; color: var(--muted); font-size: 12px; }

.collab-shell { display: grid; grid-template-columns: minmax(280px, 340px) minmax(0, 1fr); gap: 18px; }
.collab-sidebar, .collab-main { display: grid; gap: 14px; }
.channel-list { display: grid; gap: 10px; }
.channel-item { width: 100%; display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 12px; text-align: left; padding: 12px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface); color: inherit; }
.channel-item:hover, .channel-item.active { border-color: rgba(74, 144, 226, .55); background: var(--surface-2); }
.channel-item strong, .channel-item small { display: block; }
.channel-item small { color: var(--muted); margin-top: 4px; }
.channel-avatar, .message-avatar { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; border-radius: 14px; background: linear-gradient(135deg, rgba(91, 81, 255, .35), rgba(0, 209, 255, .25)); color: var(--text-strong); font-weight: 700; }
.messages-stream { display: grid; gap: 12px; max-height: 62vh; overflow: auto; padding-right: 6px; }
.message-item { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 12px; align-items: flex-start; }
.message-body { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px; }
.message-body header { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 8px; color: var(--muted); font-size: 12px; }
.message-body p { margin: 0; line-height: 1.55; }
.message-composer { display: grid; gap: 10px; }
.message-composer textarea, .comment-composer textarea { min-height: 108px; }
.member-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin-top: 10px; }
.workflow-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.workflow-board-head { display: flex; justify-content: space-between; gap: 14px; align-items: flex-end; margin-bottom: 18px; }
.kanban-board { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; align-items: start; }
.kanban-column { background: var(--surface-2); border: 1px solid var(--line); border-radius: 18px; padding: 12px; display: grid; gap: 12px; }
.kanban-column > header { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.kanban-column > header small { display: block; color: var(--muted); margin-top: 4px; }
.kanban-cards { display: grid; gap: 12px; }
.kanban-card { border: 1px solid var(--line); border-radius: 16px; background: var(--surface); padding: 14px; display: grid; gap: 10px; cursor: pointer; }
.kanban-card:hover { transform: translateY(-1px); box-shadow: 0 10px 20px rgba(0,0,0,.08); }
.kanban-card-top { display: flex; gap: 8px; flex-wrap: wrap; }
.kanban-card h4 { margin: 0; font-size: 15px; }
.kanban-card p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.kanban-meta, .kanban-card footer { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; color: var(--muted); font-size: 12px; }
.mini-btn { border: 1px solid var(--line); background: var(--surface-2); color: var(--text); border-radius: 10px; min-width: 30px; height: 30px; }
.mini-btn:hover { background: var(--surface-hover); }
.comment-item { border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 12px; margin-bottom: 10px; }
.comment-item strong, .comment-item small { display: block; }
.comment-item small { color: var(--muted); margin-top: 2px; margin-bottom: 8px; }
.comment-item p { margin: 0; line-height: 1.5; }
.comment-composer { display: grid; gap: 10px; margin-top: 12px; }
@media (max-width: 1100px) { .collab-shell { grid-template-columns: 1fr; } }

/* ==========================================================
   Nidhium 6.1 — colaboração, espaço útil e personalização
   ========================================================== */
.account-preview { display: block; margin-top: 7px; color: var(--cyan); overflow-wrap: anywhere; }
.slug-composer.solo { grid-template-columns: 1fr; }
.slug-composer.solo input { width: 100%; }
.email-confirmation-panel { display: grid; gap: 9px; padding: 16px; border: 1px solid rgba(18, 214, 232, .3); border-radius: 14px; background: rgba(18, 214, 232, .06); text-align: left; }
.email-confirmation-panel p { margin: 0; color: var(--muted); font-size: 13px; }

.sidebar-toggle { position: absolute; top: 18px; right: -15px; z-index: 3; width: 30px; height: 30px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg-elevated); color: var(--text-strong); box-shadow: var(--shadow); cursor: pointer; font-size: 20px; line-height: 1; }
.sidebar, .main-area, .app-shell { transition: width .18s ease, margin .18s ease, grid-template-columns .18s ease; }
body.sidebar-collapsed .app-shell { grid-template-columns: 78px minmax(0, 1fr); }
body.sidebar-collapsed .sidebar { width: 78px; padding-inline: 10px; }
body.sidebar-collapsed .main-area { grid-column: 2; }
body.sidebar-collapsed .sidebar-brand { justify-content: center; padding-inline: 0; }
body.sidebar-collapsed .sidebar-brand > div,
body.sidebar-collapsed .nav-group-label,
body.sidebar-collapsed .nav-item > span:nth-child(2),
body.sidebar-collapsed .sidebar-footer .user-card-text,
body.sidebar-collapsed .sidebar-footer .btn span { display: none; }
body.sidebar-collapsed .nav-item { justify-content: center; padding-inline: 8px; position: relative; }
body.sidebar-collapsed .nav-item > span:first-child { width: auto; font-size: 18px; }
body.sidebar-collapsed .nav-item[title]::after { content: attr(title); }
body.sidebar-collapsed .sidebar-footer .user-card { justify-content: center; }
body.sidebar-collapsed .sidebar-footer .btn { min-width: 44px; padding-inline: 8px; }
body.sidebar-collapsed .count-badge { position: absolute; right: 4px; top: 3px; }

.messenger-shell { min-height: calc(100vh - 145px); grid-template-columns: minmax(270px, 330px) minmax(0, 1fr); }
.messenger-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 4px; border-radius: 12px; background: var(--surface-2); }
.messenger-tabs button { border: 0; border-radius: 9px; padding: 9px; background: transparent; color: var(--muted); font-weight: 700; cursor: pointer; }
.messenger-tabs button.active { background: var(--surface); color: var(--text-strong); box-shadow: 0 4px 12px rgba(0,0,0,.08); }
.channel-item { grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; }
.channel-item > span:nth-child(2) { min-width: 0; }
.channel-item small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.channel-avatar img, .message-avatar img, .member-avatar img, .task-avatar img, .notification-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.messenger-contact { display: flex; align-items: center; gap: 12px; min-width: 0; }
.messenger-contact h2, .messenger-contact p { margin: 0; }
.whatsapp-stream { display: block; min-height: 360px; max-height: calc(100vh - 310px); padding: 18px; border-radius: 16px; background: radial-gradient(circle at 10% 15%, rgba(18,214,232,.05), transparent 30%), var(--surface-2); }
.message-date-separator { display: flex; justify-content: center; margin: 14px 0; }
.message-date-separator span { padding: 5px 10px; border-radius: 999px; background: var(--surface); color: var(--muted); font-size: 11px; border: 1px solid var(--line); }
.message-item.bubble { display: flex; align-items: flex-end; gap: 8px; margin: 5px 0; }
.message-item.bubble.own { justify-content: flex-end; }
.message-item.bubble.received { justify-content: flex-start; }
.message-item.bubble .message-body { width: fit-content; max-width: min(72%, 720px); padding: 9px 12px; border-radius: 16px; }
.message-item.bubble.own .message-body { background: linear-gradient(135deg, rgba(18,214,232,.18), rgba(49,100,255,.16)); border-bottom-right-radius: 5px; }
.message-item.bubble.received .message-body { border-bottom-left-radius: 5px; }
.message-item.bubble.grouped { margin-top: -2px; }
.message-item.bubble.grouped .message-body { border-radius: 12px; }
.message-avatar-spacer { width: 44px; flex: 0 0 44px; }
.message-body header { gap: 16px; justify-content: flex-start; margin-bottom: 4px; }
.message-body header span { margin-left: auto; white-space: nowrap; }
.message-composer { grid-template-columns: minmax(0, 1fr) auto; align-items: end; position: sticky; bottom: 0; padding-top: 8px; background: var(--panel); }
.message-composer textarea { min-height: 58px; max-height: 160px; resize: vertical; }

.entity-with-color { display: flex; align-items: flex-start; gap: 10px; }
.color-dot { width: 10px; height: 10px; margin-top: 5px; flex: 0 0 10px; border-radius: 999px; background: var(--project-color, var(--cyan)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--project-color, var(--cyan)) 18%, transparent); }
.color-dot.auto { background: linear-gradient(135deg, var(--cyan), var(--primary)); }

/* Tokens de cor via classe (evita style inline bloqueado pela CSP style-src 'self'). */
.color-token-blue { --project-color: #3B82F6; }
.color-token-green { --project-color: #10B981; }
.color-token-purple { --project-color: #8B5CF6; }
.color-token-orange { --project-color: #F59E0B; }
.color-token-red { --project-color: #EF4444; }
.choice-token-auto { --choice-color: transparent; }
.choice-token-blue { --choice-color: #3B82F6; }
.choice-token-green { --choice-color: #10B981; }
.choice-token-purple { --choice-color: #8B5CF6; }
.choice-token-orange { --choice-color: #F59E0B; }
.choice-token-red { --choice-color: #EF4444; }
.color-picker { border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: flex; flex-wrap: wrap; gap: 10px; }
.color-picker legend { padding: 0 6px; color: var(--muted); font-size: 12px; }
.color-picker label { position: relative; display: grid; justify-items: center; gap: 5px; min-width: 66px; cursor: pointer; }
.color-picker input { position: absolute; opacity: 0; }
.color-choice { width: 28px; height: 28px; border-radius: 999px; background: var(--choice-color); border: 2px solid rgba(255,255,255,.25); }
.color-choice.auto { background: conic-gradient(#3B82F6, #10B981, #8B5CF6, #F59E0B, #EF4444, #3B82F6); }
.color-picker input:checked + .color-choice { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--cyan); }
.color-picker small { font-size: 10px; color: var(--muted); }
.member-grid .checkbox-card > span { display: flex; align-items: center; gap: 9px; }
.member-avatar { width: 30px; height: 30px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 30px; background: var(--primary-soft); color: var(--text-strong); font-size: 10px; font-weight: 800; }

.workflow-shell { min-height: calc(100vh - 142px); }
.workflow-top { padding-bottom: 12px; }
.workflow-summary.compact { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.workflow-summary.compact > div { display: inline-flex; align-items: baseline; gap: 7px; min-width: 105px; padding: 7px 11px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-2); }
.workflow-summary.compact strong { font-size: 16px; }
.workflow-summary.compact span { color: var(--muted); font-size: 11px; }
.workflow-board-head { margin-bottom: 12px; align-items: center; }
.kanban-board { display: flex; gap: 12px; align-items: stretch; overflow-x: auto; padding: 2px 2px 14px; min-height: calc(100vh - 320px); scroll-snap-type: x proximity; }
.kanban-column { flex: 0 0 clamp(250px, 25vw, 330px); min-height: calc(100vh - 340px); padding: 10px; border-radius: 14px; scroll-snap-align: start; }
.kanban-column > header { position: sticky; top: 0; z-index: 2; padding: 2px 2px 8px; background: var(--surface-2); }
.kanban-column.drag-target { border-color: var(--cyan); box-shadow: inset 0 0 0 1px var(--cyan); }
.kanban-cards { min-height: 120px; align-content: start; }
.kanban-empty { display: grid; place-items: center; min-height: 95px; border: 1px dashed var(--line); border-radius: 12px; color: var(--muted); font-size: 12px; }
.kanban-card { position: relative; padding: 11px; gap: 8px; border-radius: 13px; touch-action: pan-y; overflow: hidden; }
.kanban-card.color-accent::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--project-color, var(--cyan)); }
.kanban-card.dragging { opacity: .72; transform: rotate(1.2deg) scale(1.015); box-shadow: 0 20px 44px rgba(0,0,0,.28); z-index: 20; }
.kanban-card h4 { line-height: 1.35; }
.kanban-card-context { display: flex; flex-wrap: wrap; gap: 6px; }
.kanban-card-context > span { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; padding: 3px 6px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: 10px; }
.kanban-card-context .color-dot { width: 6px; height: 6px; min-width: 6px; margin: 0; box-shadow: none; }
.kanban-card-top { align-items: center; }
.drag-handle { margin-left: auto; border: 0; background: transparent; color: var(--muted); cursor: grab; font-size: 18px; padding: 0 3px; touch-action: none; }
.drag-handle:active { cursor: grabbing; }
.avatar-stack { display: inline-flex; align-items: center; padding-left: 4px; }
.task-avatar { width: 25px; height: 25px; margin-left: -5px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; border: 2px solid var(--surface); background: var(--primary-soft); color: var(--text-strong); font-size: 9px; font-weight: 800; }
.task-avatar.more { background: var(--surface-2); }
.relation-section { border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; }
.relation-section summary, .transition-history summary { cursor: pointer; font-weight: 700; color: var(--text-strong); }
.task-discussion .comment-item { display: grid; grid-template-columns: 44px 1fr; gap: 10px; }
.transition-history { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.transition-history p { color: var(--muted); font-size: 12px; }

.notification-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 360px); gap: 16px; align-items: start; }
.notification-preferences-panel { position: sticky; top: 88px; }
.preference-list { display: grid; gap: 10px; }
.notification-card { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; align-items: center; cursor: pointer; }
.notification-avatar { width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center; border-radius: 12px; background: var(--primary-soft); font-weight: 800; overflow: hidden; }
.notification-card strong { color: var(--text-strong); }
.audit-summary { min-width: 230px; white-space: normal; }
.label-actions { display: flex; gap: 5px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 1100px) {
  .messenger-shell { grid-template-columns: 1fr; }
  .notification-layout { grid-template-columns: 1fr; }
  .notification-preferences-panel { position: static; }
}
@media (max-width: 760px) {
  .sidebar-toggle { display: none; }
  body.sidebar-collapsed .app-shell { grid-template-columns: 1fr; }
  .message-item.bubble .message-body { max-width: 86%; }
  .whatsapp-stream { max-height: 58vh; }
  .workflow-top, .workflow-board-head { align-items: stretch; flex-direction: column; }
  .kanban-column { flex-basis: min(84vw, 310px); }
  .notification-card { grid-template-columns: 38px minmax(0, 1fr); }
  .notification-card > button { grid-column: 2; justify-self: start; }
}
@media (prefers-reduced-motion: reduce) {
  .sidebar, .main-area, .app-shell, .kanban-card { transition: none !important; }
  .kanban-card.dragging { transform: none; }
}

/* ========================================================================== 
   Nidhium 6.2 — Dashboard responsivo, menu inteligente e relatórios
   ========================================================================== */

/* O mesmo botão de menu recolhe a sidebar no desktop e abre o drawer no móvel. */
.sidebar-command { flex: 0 0 auto; }
.sidebar-toggle { display: none; }
.sidebar-backdrop { display: none; }
body.sidebar-drawer-open { overflow: hidden; }

body.sidebar-collapsed .sidebar-brand .brand-icon { width: 38px; height: 38px; }
body.sidebar-collapsed .nav-list { overflow-x: visible; }
body.sidebar-collapsed .nav-item::after {
  content: attr(title);
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%) translateX(-4px);
  padding: 7px 10px;
  border-radius: 9px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text-strong);
  box-shadow: var(--shadow-soft);
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 700;
  transition: opacity .14s ease, transform .14s ease;
  z-index: 80;
}
body.sidebar-collapsed .nav-item:hover::after,
body.sidebar-collapsed .nav-item:focus-visible::after {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

/* Topbar compacta, sem esconder as ações de relatório no celular. */
.topbar-heading { flex: 1 1 auto; }
.topbar-actions { min-width: 0; }
.btn.compact { padding: 9px 12px; }
#top-report-action,
#top-print-action { border-color: var(--line); }

/* Dashboard com hierarquia visual semelhante a painéis SaaS modernos. */
#dashboard-panel { min-width: 0; }
.cards-grid {
  grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
  gap: 12px;
}
.metric-card {
  min-height: 116px;
  padding: 16px;
  border-radius: 15px;
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
}
.metric-card::after { width: 74px; height: 74px; right: -20px; bottom: -30px; opacity: .38; }
.metric-card > strong { font-size: clamp(22px, 2.2vw, 31px); }
.metric-delta { font-size: 10px; }

.charts-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 14px;
  align-items: stretch;
}
.chart-card { grid-column: span 6; min-width: 0; }
.chart-card-wide { grid-column: span 12; }
.chart-card-header { min-height: 64px; }
.chart-card-header > div { min-width: 0; }
.chart-card-header p { margin-top: 3px; }
.chart-print-button,
.panel-print-button { width: 34px; height: 34px; flex: 0 0 34px; font-size: 15px; }
.chart-panel-body { padding: 14px 16px 16px; }
.chart-canvas { width: 100%; min-width: 0; overflow: hidden; }
.modern-chart { min-height: 220px; }
.chart-grid-line { stroke: var(--line-soft); stroke-width: 1; stroke-dasharray: 4 5; }
.chart-axis-text { fill: var(--muted); font-size: 10px; }
.chart-point,
.chart-column { transition: opacity .14s ease, filter .14s ease; }
.chart-point:hover,
.chart-column:hover { opacity: .78; filter: brightness(1.12); }
.chart-legend.modern { margin: 0 0 10px; }
.chart-legend.modern span {
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
}

.donut-layout {
  min-height: 250px;
  display: grid;
  grid-template-columns: minmax(150px, .8fr) minmax(180px, 1.2fr);
  gap: 20px;
  align-items: center;
}
.donut-ring {
  width: min(190px, 100%);
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  margin: auto;
  position: relative;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.04);
}
.donut-ring::after {
  content: "";
  position: absolute;
  inset: 20%;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  box-shadow: 0 12px 26px rgba(0,0,0,.2);
}
.donut-ring > div { position: relative; z-index: 1; display: grid; text-align: center; }
.donut-ring strong { color: var(--text-strong); font-size: clamp(18px, 2vw, 26px); }
.donut-ring span { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .12em; }
.donut-legend { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.donut-legend li {
  display: grid;
  grid-template-columns: 9px minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  padding: 7px 9px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: var(--surface-2);
  min-width: 0;
}
.donut-legend i { width: 9px; height: 9px; border-radius: 3px; }
.donut-legend span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); font-size: 11px; }
.donut-legend strong { color: var(--text-strong); font-size: 11px; }
.donut-legend small { color: var(--muted); font-size: 9px; }

.horizontal-chart { display: grid; gap: 13px; min-height: 225px; align-content: center; }
.horizontal-bar-row { display: grid; gap: 6px; }
.horizontal-bar-label { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-width: 0; }
.horizontal-bar-label span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); font-size: 11px; }
.horizontal-bar-label strong { color: var(--text-strong); font-size: 11px; white-space: nowrap; }
.horizontal-bar-track { height: 9px; overflow: hidden; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line-soft); }
.horizontal-bar-track span { display: block; height: 100%; border-radius: inherit; box-shadow: 0 0 18px rgba(96,165,250,.18); }

.dashboard-grid { min-width: 0; }
.dashboard-grid > * { min-width: 0; }
.filters { min-width: 0; }
.table-wrap { max-width: 100%; }

/* Central de relatórios e construtor personalizado. */
.reports-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 26px;
  margin-bottom: 18px;
  border: 1px solid var(--line-soft);
  border-radius: 20px;
  background:
    radial-gradient(circle at 90% 20%, var(--cyan-soft), transparent 32%),
    linear-gradient(135deg, var(--surface), var(--surface-2));
  box-shadow: var(--shadow-soft);
}
.reports-hero h1 { margin: 6px 0 7px; font-size: clamp(26px, 4vw, 42px); letter-spacing: -.045em; color: var(--text-strong); }
.reports-hero p { margin: 0; max-width: 720px; color: var(--muted); line-height: 1.6; }
.reports-hero-badge {
  min-width: 150px;
  aspect-ratio: 1.15;
  display: grid;
  place-items: center;
  align-content: center;
  border-radius: 18px;
  background: var(--primary-soft);
  border: 1px solid color-mix(in srgb, var(--primary) 32%, var(--line));
}
.reports-hero-badge strong { font-size: 36px; color: var(--text-strong); }
.reports-hero-badge span { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .12em; }
.report-template-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 13px; margin-bottom: 18px; }
.report-template-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 16px;
  border: 1px solid var(--line-soft);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}
.report-template-card h2 { margin: 1px 0 5px; font-size: 15px; color: var(--text-strong); }
.report-template-card p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.report-template-card .actions { grid-column: 1 / -1; justify-content: flex-end; margin-top: 3px; }
.report-template-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; background: var(--primary-soft); color: var(--primary-light); font-size: 20px; }
.report-guidance-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.report-guidance-grid > div { display: grid; gap: 5px; padding: 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line-soft); }
.report-guidance-grid strong { color: var(--text-strong); }
.report-guidance-grid span { color: var(--muted); font-size: 11px; }
.report-summary-input { min-height: 130px; }
.report-options-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
.report-options-grid legend { padding: 0 7px; color: var(--muted); font-size: 11px; }
.report-privacy-note { padding: 16px; border: 1px dashed var(--line); border-radius: 12px; color: var(--muted); }

/* O conteúdo de impressão fica fora da tela e só aparece no modo print. */
.report-print-root { display: none; }

@media (max-width: 1180px) {
  .chart-card { grid-column: span 12; }
  .report-options-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  .cards-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .donut-layout { grid-template-columns: 1fr; }
  .donut-ring { width: 170px; }
  .report-guidance-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .app-shell { display: block; width: 100%; overflow-x: hidden; }
  .main-area { width: 100%; min-width: 0; }
  .sidebar {
    width: min(86vw, 296px);
    transform: translateX(-105%);
    transition: transform .2s ease;
    box-shadow: 24px 0 60px rgba(0,0,0,.48);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 19;
    border: 0;
    background: rgba(0,0,0,.58);
    backdrop-filter: blur(3px);
  }
  .topbar {
    min-height: 62px;
    padding: 9px 10px;
    gap: 8px;
  }
  .topbar-actions { gap: 6px; }
  .topbar-actions .btn { display: none; }
  #top-report-action,
  #top-print-action { display: inline-flex !important; width: 38px; height: 38px; padding: 0; font-size: 0; }
  #top-report-action::before { content: "▤"; font-size: 16px; }
  #top-print-action::before { content: "⎙"; font-size: 17px; }
  .topbar .icon-button { width: 38px; height: 38px; }
  .breadcrumb { max-width: 28vw; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .content { width: 100%; padding: 12px 10px 30px; overflow-x: hidden; }
  .tabs[role="tablist"] { margin-inline: -10px; padding-inline: 10px; }
  .cards-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .metric-card { min-height: 104px; padding: 13px; }
  .metric-card > strong { font-size: 21px; }
  .charts-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .chart-card,
  .chart-card-wide { grid-column: 1; width: 100%; }
  .chart-panel-body { padding: 10px; }
  .modern-chart { min-height: 190px; }
  .chart-card-header { padding: 12px 13px; }
  .chart-card-header h2 { font-size: 14px; }
  .donut-layout { min-height: 0; gap: 13px; }
  .donut-legend { grid-template-columns: 1fr; }
  .horizontal-chart { min-height: 0; }
  .filters { grid-template-columns: 1fr; padding: 12px; }
  .filters .actions { width: 100%; }
  .filters .actions .btn { flex: 1; }
  .panel { border-radius: 13px; }
  .panel-header { min-height: 56px; padding: 12px 13px; flex-wrap: wrap; }
  .panel-body { padding: 13px; }
  .table-wrap { margin-inline: -1px; }
  table { min-width: 620px; }
  .reports-hero { align-items: flex-start; flex-direction: column; padding: 18px; }
  .reports-hero-badge { min-width: 0; width: 100%; aspect-ratio: auto; padding: 14px; grid-template-columns: auto auto; gap: 8px; }
  .reports-hero-badge strong { font-size: 26px; }
  .report-template-grid { grid-template-columns: 1fr; }
  .report-options-grid { grid-template-columns: 1fr; }
  .report-builder-form { grid-template-columns: 1fr; }
  .report-builder-form .span-2 { grid-column: 1; }
}

@media (max-width: 430px) {
  .cards-grid { grid-template-columns: 1fr; }
  .profile-menu-wrap { display: none; }
  .topbar-heading { min-width: 0; }
  #top-notifications { display: none; }
  .chart-axis-text { font-size: 9px; }
}

@media (prefers-reduced-motion: reduce) {
  body.sidebar-collapsed .nav-item::after,
  .sidebar { transition: none !important; }
}

@media print {
  html, body { background: #fff !important; color: #172033 !important; }
  body > *:not(#report-print-root) { display: none !important; }
  #report-print-root,
  body.printing-report #report-print-root { display: block !important; }
  .printed-report { font-family: Arial, Helvetica, sans-serif; color: #172033; font-size: 10pt; }
  .printed-report-header { display: grid; grid-template-columns: 150px 1fr; gap: 18px; align-items: center; padding-bottom: 12px; border-bottom: 2px solid #1f4e78; }
  .printed-report-header img { width: 140px; max-height: 42px; object-fit: contain; object-position: left center; }
  .printed-report-header span { color: #52708c; font-size: 8pt; text-transform: uppercase; letter-spacing: .08em; }
  .printed-report-header h1 { margin: 2px 0 4px; color: #10263a; font-size: 20pt; }
  .printed-report-header p { margin: 0; color: #52708c; }
  .report-executive-summary,
  .report-filter-summary,
  .report-notes { margin: 12px 0; padding: 10px 12px; border: 1px solid #c8d6e2; border-radius: 8px; background: #f4f8fb; break-inside: avoid; }
  .report-executive-summary > span,
  .report-filter-summary > strong { color: #1f4e78; font-size: 8pt; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
  .report-executive-summary p,
  .report-filter-summary p,
  .report-notes p { margin: 5px 0 0; line-height: 1.45; }
  .printed-report-content { display: block; }
  .printed-report-content .panel,
  .printed-report-content .metric-card,
  .printed-report-content .report-template-card { background: #fff !important; color: #172033 !important; border: 1px solid #cbd8e3 !important; box-shadow: none !important; break-inside: avoid; margin-bottom: 10px; }
  .printed-report-content .panel-header { border-color: #d7e1e9 !important; min-height: 0; padding: 9px 11px; }
  .printed-report-content .panel-body { padding: 10px; }
  .printed-report-content h1,
  .printed-report-content h2,
  .printed-report-content h3,
  .printed-report-content strong { color: #10263a !important; }
  .printed-report-content p,
  .printed-report-content span,
  .printed-report-content small,
  .printed-report-content td,
  .printed-report-content th { color: #314b61 !important; }
  .printed-report-content .cards-grid { display: grid !important; grid-template-columns: repeat(4, 1fr) !important; gap: 7px !important; }
  .printed-report-content .metric-card { min-height: 0 !important; padding: 10px !important; }
  .printed-report-content .metric-card::after { display: none !important; }
  .printed-report-content .charts-grid { display: grid !important; grid-template-columns: repeat(2, 1fr) !important; gap: 8px !important; }
  .printed-report-content .chart-card-wide { grid-column: span 2 !important; }
  .printed-report-content .chart-svg { width: 100% !important; max-height: 225px !important; }
  .printed-report-content .donut-ring::after { background: #fff !important; }
  .printed-report-content .donut-legend li,
  .printed-report-content .horizontal-bar-track,
  .printed-report-content .chart-legend span { background: #f5f8fa !important; border-color: #dbe4eb !important; }
  .printed-report-content table { width: 100% !important; min-width: 0 !important; border-collapse: collapse; font-size: 8pt; }
  .printed-report-content th,
  .printed-report-content td { padding: 6px; border-bottom: 1px solid #d9e2e9; }
  .printed-report-content .table-wrap { overflow: visible !important; }
  .printed-report-content .tabs,
  .printed-report-content .empty-icon,
  .printed-report-content .sidebar,
  .printed-report-content .topbar { display: none !important; }
  .report-signature { margin-top: 18px; padding-top: 10px; border-top: 1px solid #cbd8e3; display: flex; justify-content: space-between; gap: 18px; color: #52708c; font-size: 8pt; }
  .printed-report.compact .printed-report-content .panel-body { padding: 7px; }
  .printed-report.compact .printed-report-content .metric-card { padding: 7px !important; }
}

/* Ajustes finais do menu em modo compacto e drawer móvel. */
body.sidebar-collapsed .sidebar-footer .btn .button-icon { display: inline-flex; font-size: 17px; }
body.sidebar-collapsed .sidebar-footer .btn .button-label { display: none; }
@media (max-width: 760px) {
  body.sidebar-collapsed .sidebar { width: min(86vw, 296px); padding: 22px 14px; }
  body.sidebar-collapsed .sidebar-brand { justify-content: flex-start; padding: 0 10px 22px; }
  body.sidebar-collapsed .sidebar-brand > div,
  body.sidebar-collapsed .nav-group-label,
  body.sidebar-collapsed .nav-item > span:nth-child(2),
  body.sidebar-collapsed .sidebar-footer .user-card-text,
  body.sidebar-collapsed .sidebar-footer .btn .button-label { display: block; }
  body.sidebar-collapsed .nav-item { justify-content: flex-start; padding-inline: 12px; }
  body.sidebar-collapsed .nav-item::after { display: none; }
  body.sidebar-collapsed .sidebar-footer .user-card { justify-content: flex-start; }
  body.sidebar-collapsed .sidebar-footer .btn { min-width: 0; padding-inline: 15px; }
}

/* ========================================================================== 
   Nidhium 6.3 — navegação minimalista, perfil no topo e pesquisa contextual
   ========================================================================== */

/* O perfil e as ações de sessão vivem somente no cabeçalho. */
.sidebar-footer[aria-hidden="true"] { display: none !important; }
.sidebar { padding-bottom: 16px; }
.nav-list { padding-bottom: 12px; }

/* Barra superior mais limpa, inspirada em produtos SaaS de alta densidade. */
.topbar {
  min-height: 64px;
  padding: 8px 18px;
  gap: 12px;
}
.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
}
.topbar-icon {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}
.topbar-icon:hover,
.topbar-icon:focus-visible {
  color: var(--text-strong);
  background: var(--surface-hover);
  border-color: var(--line);
}
.topbar-icon svg,
.profile-trigger svg,
.top-search-input-wrap svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#top-print-action { padding: 0; }
#top-print-action::before { content: none !important; }

/* Perfil completo no canto superior direito. */
.profile-menu-wrap { position: relative; display: block; }
.profile-trigger {
  min-width: 190px;
  max-width: 260px;
  height: 46px;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 16px;
  align-items: center;
  gap: 9px;
  padding: 4px 8px 4px 5px;
  border: 1px solid transparent;
  border-radius: 13px;
  color: var(--text);
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: background .15s ease, border-color .15s ease;
}
.profile-trigger:hover,
.profile-trigger[aria-expanded="true"] {
  background: var(--surface-hover);
  border-color: var(--line-soft);
}
.profile-trigger-avatar {
  width: 36px;
  height: 36px;
  font-size: 12px;
  overflow: hidden;
}
.profile-trigger-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}
.profile-trigger-copy {
  min-width: 0;
  display: grid;
  line-height: 1.15;
}
.profile-trigger-copy strong,
.profile-trigger-copy small {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.profile-trigger-copy strong {
  color: var(--text-strong);
  font-size: 12px;
  font-weight: 750;
}
.profile-trigger-copy small {
  color: var(--primary-light);
  font-size: 10px;
  margin-top: 3px;
}
.profile-trigger-chevron {
  width: 16px !important;
  height: 16px !important;
  color: var(--muted);
  transition: transform .15s ease;
}
.profile-trigger[aria-expanded="true"] .profile-trigger-chevron { transform: rotate(180deg); }
.profile-menu { width: 286px; top: calc(100% + 8px); }
.profile-menu-item.danger { color: var(--danger); }
.profile-menu-item.danger:hover { background: var(--danger-soft); }

/* Pesquisa contextual: não altera filtros nem dados; localiza o conteúdo da aba. */
.top-search-wrap { position: relative; }
.top-search-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(430px, calc(100vw - 28px));
  max-height: min(520px, calc(100vh - 90px));
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 24px 70px rgba(0,0,0,.42);
  z-index: 90;
}
.top-search-input-wrap {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) 30px;
  align-items: center;
  gap: 8px;
  padding: 11px 12px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--muted);
}
.top-search-input-wrap input {
  width: 100%;
  border: 0;
  outline: 0;
  padding: 4px 0;
  background: transparent;
  color: var(--text-strong);
  box-shadow: none;
  font-size: 13px;
}
.top-search-input-wrap input:focus { border: 0; box-shadow: none; }
.search-clear {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 19px;
}
.search-clear:hover { color: var(--text-strong); background: var(--surface-hover); }
.top-search-results {
  max-height: 410px;
  overflow-y: auto;
  padding: 7px;
}
.top-search-empty {
  margin: 0;
  padding: 24px 16px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
  text-align: center;
}
.top-search-result {
  width: 100%;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 9px;
  align-items: start;
  padding: 10px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--text);
  text-align: left;
}
.top-search-result:hover,
.top-search-result:focus-visible { background: var(--surface-hover); }
.top-search-result-icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  color: var(--primary-light);
  background: var(--primary-soft);
}
.top-search-result strong,
.top-search-result small { display: block; }
.top-search-result strong {
  color: var(--text-strong);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.top-search-result small {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
  margin-top: 3px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.context-search-hit {
  animation: context-search-pulse 1.7s ease;
  outline: 2px solid var(--primary) !important;
  outline-offset: 4px;
}
@keyframes context-search-pulse {
  0%, 100% { box-shadow: none; }
  35% { box-shadow: 0 0 0 8px var(--primary-soft); }
}

/* A ação Nova conta existe somente em Contas e no contexto Contas a pagar. */
#top-primary-action { white-space: nowrap; min-height: 38px; padding: 9px 13px; }

/* Menu lateral com comportamento de painel expansível semelhante ao vídeo. */
.nav-item {
  min-height: 40px;
  border-radius: 10px;
}
.nav-item.active {
  box-shadow: inset 3px 0 0 var(--primary);
  background: linear-gradient(90deg, var(--primary-soft), var(--surface-hover));
}
body.sidebar-collapsed .sidebar { box-shadow: 10px 0 28px rgba(0,0,0,.16); }

@media (max-width: 1120px) {
  .profile-trigger { min-width: 0; width: 46px; grid-template-columns: 36px; padding: 4px; }
  .profile-trigger-copy,
  .profile-trigger-chevron { display: none; }
}

@media (max-width: 760px) {
  .topbar { padding: 8px; min-height: 58px; }
  .topbar-heading { flex: 1 1 auto; min-width: 0; }
  .topbar-actions { gap: 3px; }
  .topbar-icon { width: 36px; height: 36px; }
  #top-report-action:not(.hidden) {
    display: inline-grid !important;
    place-items: center;
    width: 36px;
    height: 36px;
    padding: 0;
    font-size: 0;
  }
  #top-report-action::before { content: "▤"; font-size: 15px; }
  #top-print-action:not(.hidden) { display: inline-grid !important; }
  #top-primary-action:not(.hidden) {
    display: inline-flex !important;
    min-height: 36px;
    padding: 8px 10px;
    font-size: 11px;
  }
  .profile-menu-wrap { display: block !important; }
  .profile-trigger { width: 38px; height: 38px; padding: 1px; border-radius: 11px; }
  .profile-trigger-avatar { width: 34px; height: 34px; }
  .profile-menu { position: fixed; top: 62px; right: 8px; left: auto; bottom: auto; width: min(286px, calc(100vw - 16px)); }
  .top-search-panel {
    position: fixed;
    top: 62px;
    right: 8px;
    left: 8px;
    width: auto;
    max-height: calc(100vh - 72px);
  }
}

@media (max-width: 520px) {
  .breadcrumb { max-width: 20vw; }
  .breadcrumb > span:not(.breadcrumb-current) { display: none; }
  #top-help { display: none; }
  #top-notifications { display: inline-grid !important; }
  #top-primary-action:not(.hidden) { font-size: 0; width: 36px; padding: 0; justify-content: center; }
  #top-primary-action:not(.hidden)::before { content: "+"; font-size: 19px; }
}

@media (max-width: 390px) {
  .topbar-heading { display: none; }
  .topbar-actions { margin-left: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .context-search-hit { animation: none; }
  .profile-trigger-chevron { transition: none; }
}

/* Nidhium 6.4 — Messenger em três áreas e monitor financeiro */
.messenger-tabs.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.broadcast-readonly {
  display: flex; gap: 10px; align-items: center; justify-content: center;
  padding: 12px 16px; border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface-2) 86%, transparent); color: var(--muted);
}
.broadcast-readonly strong { color: var(--text-strong); }
.form-hint { margin: 4px 0 10px; font-size: .83rem; }
.whatsapp-stream {
  background-image:
    radial-gradient(circle at 15% 18%, rgba(18,214,232,.05), transparent 28%),
    linear-gradient(135deg, rgba(255,255,255,.015) 25%, transparent 25%),
    linear-gradient(315deg, rgba(255,255,255,.015) 25%, transparent 25%);
  background-size: auto, 28px 28px, 28px 28px;
}
.message-item.bubble.own .message-body {
  margin-left: auto;
  background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 24%, var(--surface)), color-mix(in srgb, #3164ff 20%, var(--surface)));
  border: 1px solid color-mix(in srgb, var(--primary) 34%, var(--border));
}
.message-item.bubble.received .message-body {
  margin-right: auto;
  background: var(--surface);
  border: 1px solid var(--border);
}
.message-item.bubble.own .message-body header { justify-content: flex-end; }
.message-item.bubble .message-body p { overflow-wrap: anywhere; }

.payables-monitor { margin-bottom: 20px; overflow: hidden; }
.payables-monitor .monitor-header { background: linear-gradient(120deg, color-mix(in srgb, var(--primary) 9%, var(--surface)), var(--surface)); }
.monitor-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; padding: 18px; }
.monitor-kpis article {
  min-width: 0; padding: 16px; border-radius: 16px; border: 1px solid var(--border);
  background: var(--surface-2); display: grid; gap: 6px;
}
.monitor-kpis article span { color: var(--muted); font-size: .82rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.monitor-kpis article strong { color: var(--text-strong); font-size: clamp(1.35rem, 2vw, 2.1rem); line-height: 1.05; }
.monitor-kpis article small { color: var(--muted); }
.monitor-kpis article.warning { border-color: color-mix(in srgb, #f59e0b 42%, var(--border)); }
.monitor-kpis article.danger { border-color: color-mix(in srgb, #ef4444 45%, var(--border)); }
.monitor-list-header { display: flex; justify-content: space-between; gap: 16px; align-items: center; padding: 14px 18px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.monitor-list-header h3 { margin: 0 0 3px; }
.monitor-list-header p { margin: 0; color: var(--muted); }
.monitor-accounts-list { display: grid; padding: 0 18px; }
.monitor-account { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 14px; align-items: center; padding: 13px 0; border-bottom: 1px solid var(--border); }
.monitor-account:last-child { border-bottom: 0; }
.monitor-account > div:first-child { min-width: 0; display: grid; gap: 4px; }
.monitor-account > div:first-child small { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.monitor-account-value { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.monitor-account.overdue { box-shadow: inset 3px 0 0 #ef4444; padding-left: 12px; }
.monitor-footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; padding: 11px 18px; background: var(--surface-2); border-top: 1px solid var(--border); color: var(--muted); font-size: .84rem; }
.payables-monitor.compact .monitor-kpis { padding-block: 12px; }
.payables-monitor.compact .monitor-kpis article { padding: 12px 14px; }
.payables-monitor.compact .monitor-account { padding-block: 9px; }
.payables-monitor:fullscreen,
.payables-monitor.fullscreen-fallback {
  background: var(--bg); padding: 20px; width: 100vw; height: 100vh; overflow: auto; border-radius: 0;
}
.payables-monitor:fullscreen .monitor-kpis,
.payables-monitor.fullscreen-fallback .monitor-kpis { grid-template-columns: repeat(4, minmax(180px, 1fr)); }
.payables-monitor:fullscreen .monitor-account,
.payables-monitor.fullscreen-fallback .monitor-account { font-size: 1.08rem; padding-block: 16px; }

@media (max-width: 980px) {
  .monitor-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .messenger-tabs.three { grid-template-columns: repeat(3, minmax(78px, 1fr)); overflow-x: auto; }
  .messenger-tabs.three button { padding-inline: 7px; font-size: .78rem; }
  .broadcast-readonly { align-items: flex-start; flex-direction: column; }
  .monitor-kpis { grid-template-columns: 1fr 1fr; padding: 10px; gap: 8px; }
  .monitor-kpis article { padding: 12px; border-radius: 13px; }
  .monitor-account { grid-template-columns: minmax(0, 1fr) auto; }
  .monitor-account > .btn { grid-column: 1 / -1; justify-self: stretch; }
  .monitor-account-value { align-items: flex-end; flex-direction: column; gap: 5px; }
  .monitor-header { align-items: flex-start; }
  .monitor-header .toolbar-actions { width: 100%; }
  .monitor-header .toolbar-actions .btn { flex: 1; }
}
@media (max-width: 440px) {
  .monitor-kpis { grid-template-columns: 1fr; }
  .monitor-list-header { align-items: flex-start; flex-direction: column; }
}

/* v6.5 — identidade da empresa, anexos e relatórios executivos */
.signup-brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 34px;
}
.signup-brand-lockup strong {
  color: var(--text-strong);
  font-size: clamp(22px, 2vw, 32px);
  letter-spacing: .09em;
}
.signup-company-logo-preview {
  width: 76px;
  height: 76px;
  border-radius: 20px;
  object-fit: contain;
  padding: 8px;
  background: rgba(8, 29, 54, .72);
  border: 1px solid var(--line);
  box-shadow: 0 12px 32px rgba(0, 0, 0, .24);
}
.company-logo-picker,
.file-picker {
  border: 1px dashed var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  background: var(--surface-2);
}
.file-picker input,
.company-logo-picker input { margin-top: 8px; }
.company-brand-settings { display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.company-brand-preview { display: flex; align-items: center; gap: 14px; min-width: 260px; }
.company-brand-preview img {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  object-fit: contain;
  padding: 7px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.company-brand-preview div { display: grid; gap: 4px; }
.company-brand-preview span { color: var(--muted); font-size: 11px; }
.audit-summary { min-width: 300px; line-height: 1.45; }
.audit-summary small { display: inline-block; margin-top: 5px; color: var(--muted); }

@media (max-width: 760px) {
  .signup-brand-lockup { justify-content: center; margin-bottom: 18px; }
  .signup-company-logo-preview { width: 62px; height: 62px; border-radius: 16px; }
  .company-brand-settings { align-items: stretch; }
  .company-brand-settings .actions { width: 100%; }
}

@media print {
  .printed-report {
    --report-navy: #0f2742;
    --report-blue: #1d5f91;
    --report-cyan: #00a8c6;
    --report-ink: #152235;
    --report-muted: #5b6b7b;
    font-family: "Arial", "Helvetica", sans-serif;
    color: var(--report-ink);
    font-size: 9.5pt;
  }
  .printed-report-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    padding: 0 0 13px;
    border-bottom: 3px solid var(--report-navy);
  }
  .report-brand-block { display: flex; align-items: center; gap: 12px; }
  .report-company-logo,
  .report-company-monogram {
    width: 54px !important;
    height: 54px !important;
    max-height: 54px !important;
    border-radius: 12px;
    object-fit: contain;
    object-position: center;
    background: #f2f6f9;
    border: 1px solid #d5e0e8;
  }
  .report-company-monogram {
    display: grid;
    place-items: center;
    color: #fff;
    background: var(--report-navy);
    font-size: 16pt;
    font-weight: 800;
  }
  .report-brand-block > div:last-child { display: grid; gap: 2px; }
  .report-brand-block strong { color: var(--report-navy); font-size: 12pt; }
  .report-brand-block span { color: var(--report-muted); font-size: 7.5pt; text-transform: uppercase; letter-spacing: .12em; }
  .report-document-meta { display: grid; justify-items: end; gap: 2px; text-align: right; }
  .report-document-meta span { color: var(--report-cyan); font-size: 7pt; font-weight: 700; letter-spacing: .12em; }
  .report-document-meta strong { color: var(--report-navy); font-size: 9pt; }
  .report-document-meta small { color: var(--report-muted); font-size: 7pt; }
  .report-title-block {
    margin: 18px 0 14px;
    padding: 18px 20px;
    border-radius: 10px;
    color: #fff;
    background: linear-gradient(120deg, var(--report-navy), var(--report-blue));
    break-inside: avoid;
  }
  .report-title-block > span { font-size: 7.5pt; text-transform: uppercase; letter-spacing: .16em; color: #bfeaf2; }
  .report-title-block h1 { margin: 4px 0 5px; color: #fff; font-size: 22pt; line-height: 1.05; }
  .report-title-block p { margin: 0; color: #dceaf4; }
  .report-section-heading { display: flex; align-items: center; gap: 9px; margin-bottom: 7px; }
  .report-section-heading > span {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border-radius: 7px;
    background: var(--report-navy);
    color: #fff;
    font-size: 7pt;
    font-weight: 800;
  }
  .report-section-heading h2 { margin: 0; color: var(--report-navy); font-size: 11pt; }
  .report-executive-summary,
  .report-filter-summary,
  .report-notes,
  .report-data-section {
    margin: 11px 0;
    padding: 11px 13px;
    border: 1px solid #d3dee7;
    border-radius: 9px;
    background: #fff;
    break-inside: avoid;
  }
  .report-executive-summary { border-left: 4px solid var(--report-cyan); background: #f6fafc; }
  .report-executive-summary p,
  .report-filter-summary p,
  .report-notes p { margin: 4px 0 0; line-height: 1.55; color: #34495d; }
  .report-filter-summary { background: #f8fafc; }
  .report-filter-summary > strong { color: var(--report-blue); font-size: 7.5pt; text-transform: uppercase; letter-spacing: .08em; }
  .report-kpi-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 7px;
    margin: 10px 0;
    break-inside: avoid;
  }
  .report-kpi-strip article {
    padding: 9px 10px;
    border: 1px solid #d5e0e8;
    border-top: 3px solid var(--report-blue);
    border-radius: 8px;
    background: #fff;
  }
  .report-kpi-strip span { display: block; color: var(--report-muted); font-size: 7pt; text-transform: uppercase; letter-spacing: .06em; }
  .report-kpi-strip strong { display: block; margin-top: 4px; color: var(--report-navy); font-size: 13pt; }
  .report-data-section { break-inside: auto; }
  .printed-report-content .panel,
  .printed-report-content .metric-card,
  .printed-report-content .report-template-card {
    border: 1px solid #d5e0e8 !important;
    border-radius: 8px !important;
  }
  .printed-report-content table { font-size: 7.6pt; }
  .printed-report-content th {
    background: #eef4f8 !important;
    color: var(--report-navy) !important;
    text-transform: uppercase;
    font-size: 6.8pt;
    letter-spacing: .05em;
  }
  .printed-report-content tr:nth-child(even) td { background: #f9fbfc !important; }
  .report-signature {
    margin-top: 16px;
    padding-top: 10px;
    border-top: 1px solid #cbd7df;
    display: grid;
    grid-template-columns: 1.3fr 1fr .7fr;
    gap: 18px;
  }
  .report-signature div { display: grid; gap: 3px; }
  .report-signature span { color: var(--report-muted); font-size: 6.8pt; text-transform: uppercase; letter-spacing: .06em; }
  .report-signature strong { color: var(--report-navy); font-size: 8pt; }
}
.signup-company-logo-placeholder {
  width: 76px;
  height: 76px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: linear-gradient(145deg, color-mix(in srgb, var(--accent) 28%, var(--panel)), var(--panel));
  border: 1px solid color-mix(in srgb, var(--accent) 55%, var(--border));
  color: var(--text-strong);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: .06em;
  box-shadow: 0 12px 32px rgba(0,0,0,.18);
}
@media (max-width: 760px) {
  .signup-company-logo-placeholder { width: 62px; height: 62px; border-radius: 16px; font-size: 19px; }
}

/* ============================================================
   v6.6 — Totais da listagem, Setor/Categoria e gestão de anexos
   ============================================================ */

/* Faixa de totais: valores agregados no backend sobre todo o conjunto filtrado. */
.accounts-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--surface-2);
}

.accounts-summary article {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.accounts-summary article span {
  font-size: .78rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.accounts-summary article strong {
  font-size: 1.15rem;
  color: var(--text-strong);
  font-variant-numeric: tabular-nums;
}

.accounts-summary .tone-success strong { color: var(--success); }
.accounts-summary .tone-warning strong { color: var(--warning); }
.accounts-summary .tone-danger strong { color: var(--danger); }
.accounts-summary .tone-muted strong { color: var(--muted); }

.accounts-summary-note {
  grid-column: 1 / -1;
  margin: 0;
  font-size: .8rem;
  color: var(--muted);
}

/* Marca de campo obrigatório (Setor e Categoria). */
.required-mark {
  color: var(--danger);
  margin-left: 2px;
}

/* Seleção de arquivos antes do envio. */
.file-picker-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.attachment-selected-list,
.attachment-existing-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.attachment-selected-item,
.attachment-existing-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.attachment-selected-item strong,
.attachment-existing-list strong {
  display: block;
  font-size: .92rem;
  color: var(--text);
  word-break: break-word;
}

.attachment-selected-item small,
.attachment-existing-list small {
  display: block;
  font-size: .78rem;
  color: var(--muted);
}

.attachment-selected-item .actions,
.attachment-existing-list .actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.attachment-upload-status {
  padding: 12px 14px;
  border: 1px solid var(--danger);
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-start;
}

.attachment-upload-status p { margin: 0; }

.existing-attachments {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

@media (max-width: 640px) {
  .attachment-selected-item,
  .attachment-existing-list li {
    flex-direction: column;
    align-items: flex-start;
  }
  .accounts-summary { padding: 14px; }
}

/* ============================================================
   v6.6.2 — Dashboard de Contas a Pagar
   Ordem: cabeçalho → 4 indicadores → gráfico → pendentes → pagas.
   Reutiliza os tokens de tema existentes (nenhuma cor nova fora da paleta).
   ============================================================ */

.payables-dashboard {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* --- Cabeçalho --- */
.payables-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 4px 2px 0;
}

.payables-header .eyebrow {
  font-size: .74rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--cyan);
  font-weight: 600;
}

.payables-header h1 {
  margin: 0;
  font-size: 1.5rem;
  line-height: 1.25;
  color: var(--text-strong);
}

.payables-header p {
  margin: 0;
  font-size: .88rem;
  color: var(--muted);
  max-width: 68ch;
}

/* --- Quatro indicadores lado a lado --- */
.payables-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.payables-kpi {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  min-height: 118px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-inset);
}

.payables-kpi-label {
  font-size: .74rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

/* Cor semântica apenas no valor — o card não é pintado por inteiro. */
.payables-kpi-value {
  font-size: 1.6rem;
  line-height: 1.15;
  color: var(--cyan);
  font-variant-numeric: tabular-nums;
  word-break: break-word;
}

.payables-kpi-count {
  font-size: .78rem;
  color: var(--muted-soft);
}

.payables-kpi.tone-success .payables-kpi-value { color: var(--success); }
.payables-kpi.tone-warning .payables-kpi-value { color: var(--warning); }
.payables-kpi.tone-danger .payables-kpi-value { color: var(--danger); }

.payables-kpi.tone-success { border-left: 3px solid var(--success); }
.payables-kpi.tone-warning { border-left: 3px solid var(--warning); }
.payables-kpi.tone-danger { border-left: 3px solid var(--danger); }

/* Dívida anterior: informada em faixa própria, fora do total do mês. */
.payables-previous-due {
  margin: 0;
  padding: 10px 14px;
  border: 1px solid var(--danger);
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  font-size: .86rem;
  color: var(--text);
}

.payables-previous-due span {
  color: var(--muted);
  margin-left: 4px;
}

/* --- Gráfico de largura total --- */
.payables-chart-panel .payables-chart-body {
  padding: 8px 18px 18px;
}

.payables-chart-panel .chart-canvas {
  max-height: 280px;
}

.payables-chart-panel .chart-legend.modern {
  justify-content: flex-end;
}

/* --- Listas de pendentes e pagas (mesma estrutura e largura) --- */
.payables-list-panel {
  display: flex;
  flex-direction: column;
}

.payables-list-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 18px;
}

.payables-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto auto;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

/* Contas pagas não têm ação "Pagar", então uma coluna a menos. */
.payables-row.paid {
  grid-template-columns: minmax(0, 1fr) auto auto auto;
}

/* Destaque contido: marca a lateral em vez de tingir a linha inteira. */
.payables-row.overdue {
  border-left: 3px solid var(--danger);
  background: var(--danger-soft);
}

.payables-row-main {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.payables-row-main small {
  font-size: .78rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.payables-date {
  font-size: .84rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.payables-value {
  font-variant-numeric: tabular-nums;
  color: var(--text-strong);
  white-space: nowrap;
}

.payables-list-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  border-top: 1px solid var(--line-soft);
  font-size: .82rem;
  color: var(--muted);
}

.badge.tiny {
  font-size: .68rem;
  padding: 1px 6px;
  align-self: flex-start;
}

.badge.attention {
  background: var(--warning-soft);
  color: var(--warning);
  border: 1px solid var(--warning);
}

.payables-error-actions {
  display: flex;
  justify-content: center;
  padding: 4px 0 16px;
}

/* --- Skeletons: preservam as dimensões do conteúdo final --- */
.payables-dashboard[aria-busy="true"] .skeleton {
  display: block;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-hover) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: payables-shimmer 1.4s ease-in-out infinite;
}

.payables-dashboard[aria-busy="true"] .skeleton-title { height: 26px; width: 60%; }
.payables-dashboard[aria-busy="true"] .skeleton-text { height: 14px; width: 90%; }
.payables-dashboard[aria-busy="true"] .skeleton-text.short { height: 12px; width: 40%; }
.payables-dashboard[aria-busy="true"] .skeleton-chart { height: 260px; width: 100%; }
.payables-dashboard[aria-busy="true"] .skeleton-row { height: 52px; width: 100%; }

@keyframes payables-shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .payables-dashboard[aria-busy="true"] .skeleton { animation: none; }
}

/* Tabela equivalente do gráfico: disponível a leitores de tela. */
.chart-data-table.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* --- Responsividade: 4 → 2 → 1 coluna, sem rolagem horizontal --- */
@media (max-width: 1180px) {
  .payables-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
  .payables-row,
  .payables-row.paid {
    grid-template-columns: minmax(0, 1fr) auto;
    row-gap: 8px;
  }
  .payables-row .payables-date { grid-column: 1; }
  .payables-row .payables-value { grid-column: 2; text-align: right; }
  .payables-row-main { grid-column: 1 / -1; }
  .payables-row-main small { white-space: normal; }
}

@media (max-width: 560px) {
  .payables-kpis { grid-template-columns: 1fr; }
  .payables-kpi { min-height: 0; }
  .payables-header h1 { font-size: 1.3rem; }
  .payables-list-body { padding: 12px; }
  .payables-list-footer { flex-direction: column; align-items: stretch; }
  .payables-chart-panel .chart-legend.modern { justify-content: flex-start; }
}

/* ==========================================================================
   Nidhium 6.9 — Kanban workspace fluido
   Escopo restrito a .content--workspace (aplicada apenas na tela Kanban &
   workflow). Nenhuma regra global existente é alterada.
   ========================================================================== */

:root {
  --kanban-col-min: 300px;
  --kanban-col-max: 380px;
  --kanban-gap: 14px;
  --kanban-vp-height: 60vh;
}

/* 1. Workspace ocupa toda a largura útil (elimina o max-width centralizado) */
.content.content--workspace {
  max-width: none;
  margin: 0;
  width: 100%;
  min-width: 0;
  padding: 20px 24px 0;
}
/* .panel tem overflow:hidden; o board precisa de overflow próprio */
.content--workspace .workflow-shell {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: visible;
}
.content--workspace .workflow-shell > .panel-header,
.content--workspace .workflow-summary,
.content--workspace .workflow-board-head { flex: 0 0 auto; }

/* 2. Viewport: dono exclusivo do scroll horizontal */
.kanban-viewport {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 320px;
  height: var(--kanban-vp-height);
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scroll-snap-type: none;
  cursor: grab;
  padding: 2px 2px 10px;
  scrollbar-color: var(--line) transparent;
}
.kanban-viewport::-webkit-scrollbar { height: 12px; }
.kanban-viewport::-webkit-scrollbar-track { background: transparent; }
.kanban-viewport::-webkit-scrollbar-thumb { background: var(--line); border-radius: 999px; border: 3px solid transparent; background-clip: content-box; }
.kanban-viewport::-webkit-scrollbar-thumb:hover { background: var(--muted-soft); background-clip: content-box; }
.kanban-viewport.is-panning { cursor: grabbing; user-select: none; scroll-behavior: auto; }
.kanban-viewport.is-panning * { cursor: grabbing !important; }

/* 3. Track horizontal: pode ser maior que o viewport, nunca menor */
.kanban-track {
  display: flex;
  gap: var(--kanban-gap);
  width: max-content;
  min-width: 100%;
  height: 100%;
  align-items: stretch;
}

/* 4. Colunas: crescem para preencher, jamais encolhem para caber */
.content--workspace .kanban-column {
  flex: 1 0 var(--kanban-col-min);
  min-width: var(--kanban-col-min);
  max-width: var(--kanban-col-max);
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-snap-align: none;
}
.content--workspace .kanban-column > header {
  position: static;
  flex: 0 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  padding: 2px 2px 8px;
  border-bottom: 1px solid var(--line-soft);
  cursor: default;
}
.content--workspace .kanban-cards {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  display: grid;
  gap: 12px;
  align-content: start;
  padding-right: 5px;
}
.content--workspace .kanban-cards::-webkit-scrollbar { width: 9px; }
.content--workspace .kanban-cards::-webkit-scrollbar-thumb { background: var(--line); border-radius: 999px; border: 2px solid transparent; background-clip: content-box; }

/* 5. Drag de card: overlay flutuante + placeholder */
.kanban-card { cursor: grab; }
.kanban-card:active { cursor: grabbing; }
.kanban-card.is-drag-source { display: none; }
.kanban-drag-overlay {
  position: fixed;
  top: 0; left: 0;
  z-index: 1200;
  pointer-events: none;
  will-change: transform;
  transform: translate3d(0, 0, 0);
  opacity: .95;
  box-shadow: 0 22px 48px rgba(0, 0, 0, .45);
  border-color: var(--cyan);
  rotate: 1.5deg;
}
.kanban-drag-overlay.is-dropping { transition: transform .16s cubic-bezier(.2, .8, .3, 1); rotate: 0deg; }
.kanban-placeholder {
  border: 1px dashed var(--cyan);
  border-radius: 13px;
  background: var(--cyan-soft);
  opacity: .55;
  transition: height .12s ease;
}
.content--workspace .kanban-column.drag-target { box-shadow: inset 0 0 0 1px var(--cyan); border-color: var(--cyan); }
body.kanban-dragging { user-select: none; cursor: grabbing; }
body.kanban-dragging .kanban-viewport { cursor: grabbing; }

/* 6. Menu acessível "Mover para" */
.kanban-move-menu { position: relative; display: inline-flex; }
.kanban-move-menu > .mini-btn[aria-expanded="true"] { border-color: var(--cyan); color: var(--cyan); }
.kanban-move-list {
  position: absolute;
  right: 0;
  bottom: calc(100% + 6px);
  z-index: 60;
  min-width: 178px;
  padding: 6px;
  display: grid;
  gap: 2px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 16px 34px rgba(0, 0, 0, .42);
}
.kanban-move-list[hidden] { display: none; }
.kanban-move-list strong { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted-soft); padding: 4px 8px; }
.kanban-move-list button {
  border: 0; background: transparent; color: var(--text);
  text-align: left; padding: 7px 9px; border-radius: 8px; font-size: 12.5px; font-weight: 600;
}
.kanban-move-list button:hover:not(:disabled) { background: var(--surface-hover); color: var(--text-strong); }
.kanban-move-list button:disabled { color: var(--muted-soft); opacity: .6; }

/* 7. Responsividade */
@media (max-width: 1280px) {
  :root { --kanban-col-min: 284px; --kanban-col-max: 344px; }
  .content.content--workspace { padding: 16px 16px 0; }
}
@media (max-width: 760px) {
  :root { --kanban-col-min: min(84vw, 300px); --kanban-col-max: min(88vw, 320px); }
  .content.content--workspace { padding: 12px 10px 0; }
  .kanban-viewport { height: auto; min-height: 0; max-height: none; overflow-y: visible; }
  .kanban-track { height: auto; }
  .content--workspace .kanban-column { height: auto; max-height: 74vh; }
}
@media (prefers-reduced-motion: reduce) {
  .kanban-drag-overlay { rotate: 0deg; }
  .kanban-drag-overlay.is-dropping { transition: none; }
}

/* ==========================================================================
   Nidhium 6.10 — Messenger
   Todas as regras estão escopadas em .content--messenger / .messenger-layout.
   Nada aqui redefine .content, .panel, button, input ou .card globalmente.
   ========================================================================== */

.content.content--messenger {
  max-width: none;
  margin: 0;
  width: 100%;
  min-width: 0;
  padding: 18px 22px;
}

.messenger-layout {
  display: grid;
  grid-template-columns: clamp(320px, 23vw, 370px) minmax(0, 1fr);
  height: var(--messenger-height, 68vh);
  min-height: 420px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}


/* Paleta determinística de avatares — evita style inline (CSP style-src 'self') */
.conv-hue-0 { --conv-color: hsl(188 72% 62%); }
.conv-hue-1 { --conv-color: hsl(210 72% 62%); }
.conv-hue-2 { --conv-color: hsl(262 72% 62%); }
.conv-hue-3 { --conv-color: hsl(330 72% 62%); }
.conv-hue-4 { --conv-color: hsl(12 72% 62%); }
.conv-hue-5 { --conv-color: hsl(40 72% 62%); }
.conv-hue-6 { --conv-color: hsl(96 72% 62%); }
.conv-hue-7 { --conv-color: hsl(160 72% 62%); }

/* ---------- Coluna de conversas ---------- */
.messenger-sidebar {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--surface-2);
  border-right: 1px solid var(--line-soft);
}
.messenger-toolbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid var(--line-soft);
}
.messenger-search { position: relative; flex: 1 1 auto; min-width: 0; }
.messenger-search input {
  height: 38px;
  padding: 0 30px 0 32px;
  border-radius: 10px;
  font-size: 12.5px;
}
.messenger-search input::-webkit-search-cancel-button { display: none; }
.messenger-search-icon {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  color: var(--muted-soft); pointer-events: none; line-height: 1;
}
.messenger-search-clear {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 20px; height: 20px; border: 0; border-radius: 6px;
  background: transparent; color: var(--muted-soft); display: grid; place-items: center;
  font-size: 13px; line-height: 1;
}
.messenger-search-clear:hover { color: var(--text); background: var(--surface-hover); }
.messenger-search-clear[hidden] { display: none; }
.messenger-new-btn {
  flex: 0 0 38px; width: 38px; height: 38px;
  border: 0; border-radius: 10px;
  background: linear-gradient(135deg, var(--cyan), var(--primary));
  color: #04101f; font-size: 15px; font-weight: 800;
  display: grid; place-items: center;
  transition: transform .12s ease, box-shadow .16s ease;
}
.messenger-new-btn:hover { transform: translateY(-1px); box-shadow: 0 8px 18px rgba(18, 214, 232, .28); }

.messenger-filters {
  flex: 0 0 auto;
  display: flex; gap: 6px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-soft);
  overflow-x: auto;
  scrollbar-width: none;
}
.messenger-filters::-webkit-scrollbar { display: none; }
.messenger-filter {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 11.5px;
  font-weight: 700;
  display: inline-flex; align-items: center; gap: 5px;
  transition: color .14s ease, border-color .14s ease, background .14s ease;
}
.messenger-filter:hover { color: var(--text); border-color: var(--muted-soft); }
.messenger-filter.is-active { background: var(--cyan-soft); border-color: var(--cyan); color: var(--cyan); }
.messenger-filter b {
  min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px;
  background: var(--cyan); color: #04101f; font-size: 9.5px; font-weight: 800;
  display: inline-grid; place-items: center;
}

.conversation-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.conversation-list::-webkit-scrollbar { width: 9px; }
.conversation-list::-webkit-scrollbar-thumb { background: var(--line); border-radius: 999px; border: 2px solid transparent; background-clip: content-box; }
.conversation-list-group {
  padding: 10px 13px 5px;
  font-size: 9.5px; font-weight: 800; letter-spacing: .11em; text-transform: uppercase;
  color: var(--muted-soft);
}
.conversation-item {
  width: 100%;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 11px;
  align-items: center;
  text-align: left;
  min-height: 68px;
  padding: 11px 13px;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  border-left: 3px solid transparent;
  background: transparent;
  color: inherit;
  transition: background .14s ease;
}
.conversation-item:hover { background: var(--surface-hover); }
.conversation-item:focus-visible { outline: 2px solid var(--cyan); outline-offset: -2px; }
.conversation-item--active { background: var(--primary-soft); border-left-color: var(--cyan); }
.conversation-avatar {
  width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 12.5px; font-weight: 800; color: #05121f;
  background: var(--conv-color, var(--cyan));
  overflow: hidden;
}
.conversation-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.conversation-avatar.is-channel {
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--cyan);
  font-size: 15px;
}
.conversation-avatar.is-group { border-radius: 13px; }
.conversation-body { min-width: 0; display: grid; gap: 3px; }
.conversation-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.conversation-name {
  flex: 1 1 auto; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 13.5px; font-weight: 700; color: var(--text-strong);
}
.conversation-time { flex: 0 0 auto; font-size: 10.5px; color: var(--muted-soft); }
.conversation-preview {
  flex: 1 1 auto; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 12px; color: var(--muted);
}
.conversation-unread {
  flex: 0 0 auto;
  min-width: 19px; height: 19px; padding: 0 5px;
  border-radius: 10px; background: var(--cyan); color: #04101f;
  font-size: 10px; font-weight: 800;
  display: grid; place-items: center;
}
.conversation-item.is-unread .conversation-preview { color: var(--text); font-weight: 650; }
.conversation-muted-icon { flex: 0 0 auto; color: var(--muted-soft); font-size: 11px; }
.conversation-list-empty { padding: 30px 18px; text-align: center; color: var(--muted); font-size: 12.5px; }

/* ---------- Área da conversa ---------- */
.conversation-main {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--surface);
}
.conversation-header {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 12px;
  padding: 11px 18px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--surface);
}
.conversation-back {
  display: none;
  width: 32px; height: 32px; flex: 0 0 32px;
  border: 1px solid var(--line); border-radius: 9px;
  background: var(--surface-2); color: var(--text);
  place-items: center;
}
.conversation-header-text { flex: 1 1 auto; min-width: 0; }
.conversation-header-text strong {
  display: block; font-size: 14.5px; color: var(--text-strong);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.conversation-header-text span { display: block; font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.conversation-status-dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--success); margin-right: 5px; vertical-align: middle;
}
.conversation-header-actions { flex: 0 0 auto; display: flex; gap: 6px; align-items: center; }

.message-history {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px 20px 20px;
  display: flex; flex-direction: column;
  background:
    radial-gradient(circle at 12% 12%, rgba(18, 214, 232, .045), transparent 34%),
    var(--surface-2);
}
.message-history::-webkit-scrollbar { width: 10px; }
.message-history::-webkit-scrollbar-thumb { background: var(--line); border-radius: 999px; border: 3px solid transparent; background-clip: content-box; }

.message-daysep {
  display: flex; align-items: center; gap: 12px;
  margin: 14px 0 8px;
  color: var(--muted-soft);
  font-size: 10px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase;
}
.message-daysep::before, .message-daysep::after { content: ""; flex: 1 1 auto; height: 1px; background: var(--line-soft); }

.message-row { display: flex; gap: 8px; align-items: flex-end; margin-top: 9px; }
.message-row--mine { flex-direction: row-reverse; }
.message-row--grouped { margin-top: 2px; }
.message-avatar-slot {
  flex: 0 0 28px; width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 10px; font-weight: 800; color: #05121f;
  background: var(--conv-color, var(--cyan));
  overflow: hidden;
}
.message-avatar-slot img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.message-avatar-slot.is-spacer { background: transparent; }
.message-bubble {
  max-width: min(68%, 620px);
  padding: 8px 12px 6px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-bottom-left-radius: 5px;
  font-size: 13.5px;
}
.message-row--mine .message-bubble {
  background: linear-gradient(135deg, rgba(18, 214, 232, .16), rgba(49, 100, 255, .14));
  border-color: rgba(18, 214, 232, .3);
  border-bottom-left-radius: 14px;
  border-bottom-right-radius: 5px;
}
.message-author { display: block; font-size: 11px; font-weight: 750; color: var(--cyan); margin-bottom: 3px; }
.message-text { margin: 0; line-height: 1.5; color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere; }
.message-text a { color: var(--cyan); text-decoration: underline; }
.message-time { display: block; text-align: right; margin-top: 3px; font-size: 10px; color: var(--muted-soft); }
.message-time .message-edited { font-style: italic; margin-right: 5px; }
.message-bubble.is-sending { opacity: .62; }
.message-bubble.is-failed { border-color: rgba(248, 113, 113, .55); background: var(--danger-soft); }
.message-failed-note { display: flex; align-items: center; gap: 8px; margin-top: 5px; font-size: 10.5px; color: var(--danger); }
.message-retry {
  border: 1px solid rgba(248, 113, 113, .45); background: transparent; color: var(--danger);
  border-radius: 7px; padding: 2px 7px; font-size: 10.5px; font-weight: 700;
}
.message-retry:hover { background: rgba(248, 113, 113, .16); }

.message-jump {
  position: absolute;
  left: 50%; bottom: 84px; transform: translateX(-50%);
  z-index: 5;
  border: 1px solid var(--cyan);
  background: var(--surface-2);
  color: var(--cyan);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 11.5px; font-weight: 750;
  box-shadow: 0 10px 24px rgba(0, 0, 0, .38);
  animation: messenger-jump-in .18s ease;
}
.message-jump[hidden] { display: none; }
@keyframes messenger-jump-in { from { opacity: 0; transform: translate(-50%, 6px); } to { opacity: 1; transform: translate(-50%, 0); } }

.messenger-layout .message-composer {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--line-soft);
  background: var(--surface);
  position: static;
}
.message-composer-input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 40px;
  max-height: 132px;
  padding: 10px 12px;
  border-radius: 12px;
  line-height: 1.45;
  resize: none;
  font-size: 13.5px;
}
.messenger-layout .message-composer .btn { flex: 0 0 auto; height: 40px; }
.message-composer-hint { flex: 0 0 100%; font-size: 10px; color: var(--muted-soft); margin: 2px 0 0 2px; }
.messenger-readonly {
  flex: 0 0 auto;
  display: grid; gap: 3px;
  padding: 12px 18px;
  border-top: 1px solid var(--line-soft);
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
}
.messenger-readonly strong { color: var(--text-strong); font-size: 12.5px; }

/* ---------- Empty state único ---------- */
.conversation-empty-state {
  flex: 1 1 auto;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 8px;
  padding: 40px 24px;
  text-align: center;
  background:
    radial-gradient(circle at 50% 38%, rgba(18, 214, 232, .06), transparent 46%),
    var(--surface-2);
}
.conversation-empty-state svg { width: 92px; height: 92px; margin-bottom: 6px; }
.conversation-empty-state strong { font-size: 16px; color: var(--text-strong); }
.conversation-empty-state p { margin: 0; max-width: 34ch; color: var(--muted); font-size: 13px; line-height: 1.55; }
.conversation-empty-state .btn { margin-top: 10px; }

/* ---------- Responsividade ---------- */
@media (max-width: 1200px) {
  .messenger-layout { grid-template-columns: 300px minmax(0, 1fr); }
  .content.content--messenger { padding: 14px 14px; }
}
@media (max-width: 768px) {
  .content.content--messenger { padding: 10px 10px; }
  .messenger-layout { grid-template-columns: minmax(0, 1fr); border-radius: 14px; }
  .messenger-layout .conversation-main { display: none; }
  .messenger-layout.is-conversation-open .messenger-sidebar { display: none; }
  .messenger-layout.is-conversation-open .conversation-main { display: flex; }
  .conversation-back { display: grid; }
  .message-bubble { max-width: 84%; }
  .message-jump { bottom: 78px; }
}
@media (prefers-reduced-motion: reduce) {
  .messenger-new-btn, .conversation-item { transition: none; }
  .message-jump { animation: none; }
}
.conversation-empty-state.is-inline { background: transparent; }

/* ===== Nidhium 6.11 — Portal de cobrança do cliente ===== */
.billing-portal { display: flex; flex-direction: column; gap: 16px; }
.billing-cards-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.billing-metric { font-size: 15px; color: var(--text); margin: 0 0 6px; }
.billing-metric strong { font-size: 22px; color: var(--text-strong); }
.billing-status-line { margin: 0 0 10px; }
.billing-highlight { background: var(--cyan-soft); border: 1px solid var(--cyan); border-radius: 10px; padding: 8px 12px; margin: 6px 0; font-size: 13px; }
.billing-highlight strong { color: var(--cyan); }
.billing-bar { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin: 8px 0; }
.billing-bar-fill { height: 100%; background: var(--cyan); border-radius: 999px; transition: width .3s ease; }
.billing-bar-fill.warn { background: #f5a623; }
.billing-bar-fill.over { background: var(--danger); }

/* ===== Financeiro v6.13 — KPIs de fluxo de caixa e bancos ===== */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.kpi { background: var(--surface-2, rgba(255,255,255,0.03)); border: 1px solid var(--border, rgba(255,255,255,0.08)); border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; }
.kpi-label { font-size: 12px; color: var(--text-muted, #8b9bb4); text-transform: uppercase; letter-spacing: 0.04em; }
.kpi-value { font-size: 20px; font-weight: 700; color: var(--text-strong, #eaf2ff); }
.kpi-value.danger { color: var(--danger, #ef4444); }
.field-help { font-size: 12px; color: var(--text-muted, #8b9bb4); margin-top: 6px; }
/* utilitários de espaçamento (CSP-safe, substituem style inline) */
.mt-12 { margin-top: 12px; } .mt-14 { margin-top: 14px; } .mt-16 { margin-top: 16px; } .mt-20 { margin-top: 20px; }
.row-ignored { opacity: 0.4; }
.attach-label { cursor: pointer; } .hidden-input { display: none; }
/* utilitários adicionais (CSP-safe) */
.skeleton-hero { width: 320px; height: 40px; border-radius: 13px; }
.mb-16 { margin-bottom: 16px; } .pt-16 { padding-top: 16px; }
.settings-subhead { display: block; margin-bottom: 8px; color: var(--text-strong); }

/* ===== Autenticação por código + documentos legais (escopo isolado) ===== */
.legal-acceptance-row { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:10px 0; }
.legal-acceptance-row .checkbox-inline { flex:1; }
.legal-acceptance-row .checkbox-inline input:disabled { opacity:.85; cursor:not-allowed; }
.link-button { border:0; background:transparent; color:var(--primary); padding:4px 0; font:inherit; font-weight:700; text-decoration:underline; text-underline-offset:3px; cursor:pointer; }
.verification-code-field input, #reset-code { letter-spacing:.32em; text-align:center; font-size:1.2rem; font-weight:800; }
.legal-dialog { width:min(760px,calc(100vw - 28px)); max-height:90vh; padding:0; border:1px solid var(--border); border-radius:20px; background:var(--surface); color:var(--text); box-shadow:0 28px 90px rgba(0,0,0,.45); }
.legal-dialog::backdrop { background:rgba(0,8,18,.78); backdrop-filter:blur(4px); }
.legal-dialog-header,.legal-dialog-footer { display:flex; align-items:center; justify-content:space-between; gap:16px; padding:18px 20px; background:var(--surface); }
.legal-dialog-header { border-bottom:1px solid var(--border); }
.legal-dialog-header h2 { margin:2px 0 0; }
.legal-dialog-footer { border-top:1px solid var(--border); }
.legal-dialog-footer small { color:var(--muted); line-height:1.4; }
.legal-scroll { height:min(58vh,560px); overflow-y:auto; padding:22px 24px; overscroll-behavior:contain; scroll-behavior:smooth; }
.legal-scroll:focus { outline:2px solid color-mix(in srgb,var(--primary) 55%,transparent); outline-offset:-2px; }
.legal-document { color:var(--text); line-height:1.68; }
.legal-document h3 { margin:24px 0 8px; color:var(--text-strong); font-size:1rem; }
.legal-document p { margin:0 0 12px; color:var(--muted); }
.legal-document strong { color:var(--text-strong); }
@media(max-width:620px){.legal-acceptance-row{align-items:flex-start;flex-direction:column}.legal-dialog-footer{align-items:stretch;flex-direction:column}.legal-dialog-footer .btn{width:100%}.legal-scroll{padding:18px 16px}}
