/* ============================================================================
   Portal de Contabilidade · Intense Consultoria
   Design System dark premium — navy + grafite + ouro oficial Intense.
   Tokens em :root são a ÚNICA fonte de cor. Nenhum hex fora deste bloco.
   ========================================================================== */

:root {
  /* ── seis tokens base ───────────────────────────────────────────────── */
  --bg:      #0A1018;   /* navy quase preto */
  --surface: #111825;   /* grafite azulado — cards, sidebar */
  --fg:      #E9EDF4;
  --muted:   #97A3B8;
  --border:  #232C3B;
  --accent:  #F9BE00;   /* ouro oficial Intense — preenchimentos */

  /* ── marca: os três ouros do logo oficial ───────────────────────────── */
  --ambar:  #E29600;
  --bronze: #BB6B02;
  /* ouro luminoso para texto e ícone sobre escuro — o ouro de preenchimento
     perde vida quando vira letra; este sobe L de 0.83 para 0.88. */
  --gold-lit: #FFD34D;

  /* ── elevação derivada ──────────────────────────────────────────────── */
  --surface-2: #17202D;
  --surface-3: #1E2837;
  --surface-4: #263243;
  --border-soft: #1A222E;
  --border-gold: #3A3324;   /* hairline quente para superfície em destaque */

  /* ── semântica — status/alerta, nunca acento ─────────────────────────
     Versão luminosa: o conjunto anterior ficava abaixo de L 0.72 e chapava
     contra o fundo escuro. Agora L 0.72–0.85 com croma 0.12–0.18. */
  --ok:     #3FEFA4;
  --warn:   #FF9A45;
  --danger: #FF6E66;
  --info:   #7FBBFF;
  --idle:   #96A2B8;
  /* o verde vivo é ótimo em pílula e número, mas vira parede de neon quando
     preenche barra larga — esta é a versão para áreas grandes. */
  --ok-fill: #2BB57C;

  /* ── derivados ──────────────────────────────────────────────────────── */
  --accent-soft:  color-mix(in oklch, var(--accent) 17%, transparent);
  --accent-line:  color-mix(in oklch, var(--accent) 46%, transparent);
  --gold-wash:    color-mix(in oklch, var(--accent) 11%, var(--surface-3));
  --ok-soft:      color-mix(in oklch, var(--ok) 18%, transparent);
  --warn-soft:    color-mix(in oklch, var(--warn) 18%, transparent);
  --danger-soft:  color-mix(in oklch, var(--danger) 18%, transparent);
  --info-soft:    color-mix(in oklch, var(--info) 18%, transparent);
  --idle-soft:    color-mix(in oklch, var(--idle) 18%, transparent);
  --fg-soft:      color-mix(in oklch, var(--fg) 7%, transparent);
  --scrim:        color-mix(in oklch, var(--bg) 78%, transparent);

  /* ── tipografia ─────────────────────────────────────────────────────── */
  --font-display: 'Barlow', 'Segoe UI', system-ui, sans-serif;
  --font-body:    'Inter', -apple-system, 'Segoe UI', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --fs-h1: 28px;
  --fs-h2: 21px;
  --fs-h3: 16px;
  --fs-body: 14px;
  --fs-sm: 13px;
  --fs-meta: 12px;

  /* ── métrica ────────────────────────────────────────────────────────── */
  --gap-xs: 6px;  --gap-sm: 10px; --gap-md: 16px;
  --gap-lg: 24px; --gap-xl: 36px; --gap-2xl: 56px;
  --radius-sm: 6px; --radius: 10px; --radius-lg: 14px;
  --sidebar-w: 252px;
  --topbar-h: 60px;
  --shadow-pop: 0 18px 44px -18px rgba(0, 0, 0, .72);
}

/* ── reset ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font-family: var(--font-body); font-size: var(--fs-body); line-height: 1.5;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
p { margin: 0; text-wrap: pretty; }
h1, h2, h3, h4 { margin: 0; font-family: var(--font-display); text-wrap: balance; letter-spacing: -.015em; }
h1 { font-size: var(--fs-h1); font-weight: 700; line-height: 1.15; }
h2 { font-size: var(--fs-h2); font-weight: 600; line-height: 1.25; }
h3 { font-size: var(--fs-h3); font-weight: 600; line-height: 1.35; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--radius-sm); }

/* rolagem discreta */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 99px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--surface-4); }

/* ── utilitários ────────────────────────────────────────────────────────── */
.row { display: flex; align-items: center; gap: var(--gap-md); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--gap-md); }
.stack { display: flex; flex-direction: column; gap: var(--gap-md); }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap-md); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap-md); }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gap-md); }
.grid-2-1 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: var(--gap-md); align-items: start; }
.grid-1-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: var(--gap-md); align-items: start; }
.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.meta { font-size: var(--fs-meta); color: var(--muted); }
.muted { color: var(--muted); }
.eyebrow {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--gold-lit); margin: 0;
}
.rule { border: 0; border-top: 1px solid var(--border); margin: 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.right { text-align: right; }

/* ============================================================================
   SHELL — sidebar + topbar + conteúdo
   ========================================================================== */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar-head { padding: 18px var(--gap-md) var(--gap-md); border-bottom: 1px solid var(--border-soft); }
.sidebar-head .brand { display: flex; align-items: center; gap: 10px; }
.sidebar-head .brand img { height: 22px; width: auto; }
/* assinatura do produto em âmbar — mesma relação do "Consultoria" no logo */
.sidebar-head .product {
  margin-top: 10px; font-family: var(--font-mono); font-size: 10px;
  letter-spacing: .13em; text-transform: uppercase; color: var(--ambar);
}
.sidebar-nav { padding: var(--gap-md) var(--gap-sm); flex: 1; }
.nav-group + .nav-group { margin-top: var(--gap-lg); }
.nav-group-label {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--muted); padding: 0 10px 8px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 10px; border-radius: var(--radius-sm); color: var(--muted);
  font-size: var(--fs-sm); font-weight: 500; min-height: 38px;
  border-left: 2px solid transparent; transition: background .14s, color .14s;
}
.nav-item svg { width: 16px; height: 16px; flex: none; }
.nav-item:hover { background: var(--surface-3); color: var(--fg); }
.nav-item.is-active {
  background: var(--gold-wash); color: var(--gold-lit);
  border-left-color: var(--accent); font-weight: 600;
}
.nav-item.is-active svg { color: var(--gold-lit); }
.nav-item .nav-count {
  margin-left: auto; font-family: var(--font-mono); font-size: 11px;
  background: var(--surface-4); color: var(--fg);
  padding: 1px 7px; border-radius: 99px;
}
.nav-item.is-active .nav-count {
  background: color-mix(in oklch, var(--accent) 22%, var(--surface-4));
  color: var(--gold-lit);
}
.nav-item.is-soon { opacity: .5; cursor: default; }
.nav-item.is-soon:hover { background: none; color: var(--muted); }
.nav-item.is-soon .nav-count {
  background: transparent; color: var(--muted); border: 1px solid var(--border);
  font-size: 9px; letter-spacing: .08em; text-transform: uppercase;
}
.sidebar-foot { padding: var(--gap-md); border-top: 1px solid var(--border-soft); }
.user-chip { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px; border-radius: var(--radius-sm); }
.user-chip:hover { background: var(--surface-3); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  display: grid; place-items: center; background: var(--surface-4);
  color: var(--fg); font-family: var(--font-mono); font-size: 11px; font-weight: 500;
}
/* só o usuário logado carrega o ouro — nas tabelas o avatar fica neutro
   para não competir com os badges de status */
.sidebar-foot .avatar {
  background: color-mix(in oklch, var(--accent) 16%, var(--surface-4));
  color: var(--gold-lit); font-weight: 600;
}

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: var(--topbar-h); flex: none; position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: var(--gap-md);
  padding: 0 var(--gap-lg); border-bottom: 1px solid var(--border);
  background: color-mix(in oklch, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px);
}
.topbar .crumb { font-size: var(--fs-sm); color: var(--muted); }
.topbar .crumb b { color: var(--fg); font-weight: 600; }
.content { padding: var(--gap-lg); max-width: 1560px; width: 100%; }
.page-head { margin-bottom: var(--gap-lg); }
.page-head .lead { color: var(--muted); font-size: var(--fs-sm); margin-top: 5px; max-width: 76ch; }

/* busca global */
.search {
  display: flex; align-items: center; gap: 8px; min-width: 260px; max-width: 380px; flex: 1;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0 12px; height: 36px;
}
.search:focus-within { border-color: var(--accent-line); }
.search svg { width: 15px; height: 15px; color: var(--muted); flex: none; }
.search input { border: 0; background: none; color: var(--fg); font: inherit; font-size: var(--fs-sm); width: 100%; outline: none; }
.search input::placeholder { color: var(--muted); }
.search kbd {
  font-family: var(--font-mono); font-size: 10px; color: var(--muted);
  border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px; flex: none;
}

.demo-flag {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--warn); border: 1px solid color-mix(in oklch, var(--warn) 40%, transparent);
  background: var(--warn-soft); padding: 3px 8px; border-radius: 99px; flex: none;
}

/* ============================================================================
   BOTÕES — um único primário sólido por tela
   ========================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 14px; border-radius: var(--radius);
  border: 1px solid transparent; font-size: var(--fs-sm); font-weight: 500;
  white-space: nowrap; transition: background .14s, border-color .14s, color .14s;
}
.btn svg { width: 15px; height: 15px; flex: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: var(--bg); border-color: var(--accent); font-weight: 600; }
.btn-primary:hover { background: var(--ambar); border-color: var(--ambar); color: var(--bg); }
.btn-secondary { background: var(--surface-2); color: var(--fg); border-color: var(--border); }
.btn-secondary:hover { background: var(--surface-3); border-color: var(--surface-4); color: var(--fg); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-3); color: var(--fg); }
.btn-danger { background: var(--surface-2); color: var(--danger); border-color: color-mix(in oklch, var(--danger) 34%, transparent); }
.btn-danger:hover { background: var(--danger-soft); color: var(--danger); }
.btn[disabled] { opacity: .42; cursor: not-allowed; }
.btn[disabled]:active { transform: none; }
.btn-sm { height: 30px; padding: 0 10px; font-size: var(--fs-meta); }
.btn-icon { width: 32px; height: 32px; padding: 0; border-radius: var(--radius-sm); color: var(--muted); }
.btn-icon:hover { background: var(--surface-3); color: var(--fg); }
.btn-block { width: 100%; height: 42px; font-size: var(--fs-body); }

/* ============================================================================
   CARD / PAINEL
   ========================================================================== */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: var(--gap-md);
}
.card-lg { padding: var(--gap-lg); }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--gap-md);
  margin-bottom: var(--gap-md);
}
.card-head h2, .card-head h3 { margin: 0; }
.card-flush { padding: 0; overflow: hidden; }
.card-flush .card-head { padding: var(--gap-md); margin: 0; border-bottom: 1px solid var(--border); }
.panel-title {
  font-family: var(--font-display); font-size: var(--fs-h3); font-weight: 600;
}

/* ── KPI ────────────────────────────────────────────────────────────────── */
.kpi {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: var(--gap-md);
  display: flex; flex-direction: column; gap: 4px; text-align: left; width: 100%;
  transition: background .14s, border-color .14s;
}
a.kpi:hover, button.kpi:hover { background: var(--surface-2); border-color: var(--surface-4); }
.kpi-label {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted);
}
.kpi-value {
  font-family: var(--font-display); font-size: 34px; font-weight: 700;
  line-height: 1.05; letter-spacing: -.03em; font-variant-numeric: tabular-nums;
}
.kpi-value .unit { font-size: 15px; font-weight: 500; color: var(--muted); margin-left: 3px; letter-spacing: 0; }
.kpi-foot { font-size: var(--fs-meta); color: var(--muted); margin-top: 2px; }
.kpi-foot .sig { font-weight: 600; }
/* identidade de cor por métrica: valor + rótulo + filete superior.
   O filete usa a borda que já existe, então nada muda de tamanho. */
.kpi.is-danger .kpi-value { color: var(--danger); }
.kpi.is-warn   .kpi-value { color: var(--warn); }
.kpi.is-ok     .kpi-value { color: var(--ok); }
.kpi.is-info   .kpi-value { color: var(--info); }
.kpi.is-danger { border-top-color: var(--danger); background: linear-gradient(var(--danger-soft), transparent 42%), var(--surface); }
.kpi.is-warn   { border-top-color: var(--warn);   background: linear-gradient(var(--warn-soft),   transparent 42%), var(--surface); }
.kpi.is-ok     { border-top-color: var(--ok);     background: linear-gradient(var(--ok-soft),     transparent 42%), var(--surface); }
.kpi.is-info   { border-top-color: var(--info);   background: linear-gradient(var(--info-soft),   transparent 42%), var(--surface); }
.kpi.is-danger .kpi-label { color: color-mix(in oklch, var(--danger) 72%, var(--fg)); }
.kpi.is-warn   .kpi-label { color: color-mix(in oklch, var(--warn)   72%, var(--fg)); }
.kpi.is-ok     .kpi-label { color: color-mix(in oklch, var(--ok)     72%, var(--fg)); }
.kpi.is-info   .kpi-label { color: color-mix(in oklch, var(--info)   72%, var(--fg)); }
/* o primeiro KPI da linha carrega a marca, como no Portal de Controladoria */
.kpi:not([class*="is-"]):first-child {
  border-top-color: var(--accent);
  background: linear-gradient(var(--accent-soft), transparent 42%), var(--surface);
}
.kpi:not([class*="is-"]):first-child .kpi-label { color: var(--gold-lit); }

/* ============================================================================
   BADGE / PILL / TAG
   ========================================================================== */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 99px;
  font-size: 11px; font-weight: 600; line-height: 1.5; white-space: nowrap;
  border: 1px solid transparent;
}
.badge::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; flex: none; }
.badge-ok     { color: var(--ok);     background: var(--ok-soft);     border-color: color-mix(in oklch, var(--ok) 38%, transparent); }
.badge-warn   { color: var(--warn);   background: var(--warn-soft);   border-color: color-mix(in oklch, var(--warn) 38%, transparent); }
.badge-danger { color: var(--danger); background: var(--danger-soft); border-color: color-mix(in oklch, var(--danger) 38%, transparent); }
.badge-info   { color: var(--info);   background: var(--info-soft);   border-color: color-mix(in oklch, var(--info) 38%, transparent); }
.badge-idle   { color: var(--idle);   background: var(--idle-soft);   border-color: color-mix(in oklch, var(--idle) 38%, transparent); }
.badge-gold   { color: var(--gold-lit); background: var(--accent-soft); border-color: var(--accent-line); }
.badge-plain  { color: var(--muted);  background: var(--surface-2);   border-color: var(--border); }
.badge-plain::before { display: none; }

.tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: var(--radius-sm);
  background: color-mix(in oklch, var(--accent) 5%, var(--surface-2));
  border: 1px solid var(--border-gold);
  color: color-mix(in oklch, var(--gold-lit) 34%, var(--muted));
  font-size: 11px; white-space: nowrap;
}
.tag-mono { font-family: var(--font-mono); letter-spacing: .02em; }

.prio { font-family: var(--font-mono); font-size: 11px; font-weight: 500; display: inline-flex; align-items: center; gap: 5px; }
.prio::before { content: ''; width: 3px; height: 12px; border-radius: 2px; background: currentColor; }
.prio-alta   { color: var(--danger); }
.prio-media  { color: var(--warn); }
.prio-baixa  { color: var(--idle); }

/* ============================================================================
   FILTROS
   ========================================================================== */
.filterbar {
  display: flex; align-items: center; gap: var(--gap-sm); flex-wrap: wrap;
  padding: var(--gap-sm) var(--gap-md); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  margin-bottom: var(--gap-md);
}
.filterbar .sep { width: 1px; height: 22px; background: var(--border); flex: none; }
.chipset { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 2px; gap: 2px; }
.chip {
  padding: 5px 11px; border-radius: var(--radius-sm); font-size: var(--fs-meta);
  font-weight: 500; color: var(--muted); min-height: 28px;
  display: inline-flex; align-items: center; gap: 6px; transition: background .14s, color .14s;
}
.chip:hover { background: var(--surface-3); color: var(--fg); }
.chip.is-on {
  background: color-mix(in oklch, var(--accent) 14%, var(--surface-4));
  color: var(--fg); font-weight: 600;
  box-shadow: inset 0 0 0 1px var(--accent-line);
}
.chip .n { font-family: var(--font-mono); font-size: 10px; color: var(--muted); }
.chip.is-on .n { color: var(--gold-lit); }

.select {
  height: 32px; padding: 0 28px 0 10px; border-radius: var(--radius-sm);
  background: var(--surface-2) ; border: 1px solid var(--border); color: var(--fg);
  font: inherit; font-size: var(--fs-meta); cursor: pointer;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 15px) 14px, calc(100% - 10px) 14px;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
.select:hover { border-color: var(--surface-4); }

/* ============================================================================
   TABELA OPERACIONAL
   ========================================================================== */
.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.tbl th {
  position: sticky; top: 0; z-index: 2; text-align: left; font-weight: 500;
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .09em; text-transform: uppercase;
  color: var(--muted); background: var(--surface-2);
  padding: 10px var(--gap-md); border-bottom: 1px solid var(--border); white-space: nowrap;
}
.tbl td { padding: 11px var(--gap-md); border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
.tbl tbody tr { transition: background .12s; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl .n { font-family: var(--font-mono); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.tbl th.n { text-align: right; }
.tbl .w-act { width: 1%; white-space: nowrap; }
.tbl .strong { font-weight: 600; color: var(--fg); }
.tbl a.strong:hover { color: var(--gold-lit); }
.tbl tr.is-late td { box-shadow: inset 2px 0 0 var(--danger); }
.tbl tr.is-flag td { box-shadow: inset 2px 0 0 var(--warn); }
.tbl tbody tr.is-sel { background: var(--surface-3); }
.tbl tbody tr.is-sel td { box-shadow: inset 2px 0 0 var(--accent); }
.tbl tbody tr.is-sel:hover { background: var(--surface-4); }
.cell-2 { display: flex; flex-direction: column; gap: 1px; }
.cell-2 .sub { font-size: 11px; color: var(--muted); font-family: var(--font-mono); }

.table-foot {
  display: flex; align-items: center; justify-content: space-between; gap: var(--gap-md);
  padding: var(--gap-sm) var(--gap-md); border-top: 1px solid var(--border); color: var(--muted); font-size: var(--fs-meta);
}

/* agrupamento recolhível (tarefas por obrigação / por cliente) */
details > summary { list-style: none; transition: background .12s; }
details > summary::-webkit-details-marker { display: none; }
details > summary::marker { content: ''; }
details > summary:hover { background: var(--surface-2); }
details > summary svg { width: 15px; height: 15px; transition: transform .15s ease; }
details[open] > summary svg { transform: rotate(90deg); }
details:last-child { border-bottom: 0 !important; }

/* senha mascarada */
.secret { display: inline-flex; align-items: center; gap: 6px; }
.secret code {
  font-family: var(--font-mono); font-size: var(--fs-meta); color: var(--fg);
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 3px 8px; min-width: 104px; display: inline-block;
  letter-spacing: .06em;
}

/* ============================================================================
   FORMULÁRIO
   ========================================================================== */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label { font-size: var(--fs-meta); color: var(--muted); font-weight: 500; }
.field .hint { font-size: 11px; color: var(--muted); }
.field .req { color: var(--danger); }
.input, .textarea, select.input {
  width: 100%; height: 40px; padding: 0 12px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--fg); font: inherit; font-size: var(--fs-body);
  transition: border-color .14s, background .14s;
}
select.input { appearance: none; cursor: pointer; padding-right: 32px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 18px, calc(100% - 12px) 18px;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; }
.textarea { height: auto; min-height: 88px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.input::placeholder, .textarea::placeholder { color: var(--muted); }
.input:hover, .textarea:hover { border-color: var(--surface-4); }
.input:focus, .textarea:focus { outline: none; border-color: var(--accent); background: var(--surface-3); }
.input.is-mono { font-family: var(--font-mono); letter-spacing: .02em; }
.input.is-invalid { border-color: var(--danger); }
.field .err { font-size: 11px; color: var(--danger); display: none; }
.field.is-invalid .err { display: block; }

.switchrow { display: flex; align-items: center; justify-content: space-between; gap: var(--gap-md); padding: 10px 0; }
.switch { position: relative; width: 38px; height: 22px; border-radius: 99px; background: var(--surface-4); flex: none; transition: background .16s; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--muted); transition: transform .16s, background .16s; }
.switch.is-on { background: color-mix(in oklch, var(--accent) 34%, var(--surface-4)); }
.switch.is-on::after { transform: translateX(16px); background: var(--accent); }

.checkbox { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; padding: 3px 0; }
.checkbox .box {
  width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid var(--border);
  background: var(--surface-2); flex: none; margin-top: 1px;
  display: grid; place-items: center; transition: background .14s, border-color .14s;
}
.checkbox .box svg { width: 11px; height: 11px; color: var(--bg); opacity: 0; }
.checkbox:hover .box { border-color: var(--surface-4); }
.checkbox.is-on .box { background: var(--accent); border-color: var(--accent); }
.checkbox.is-on .box svg { opacity: 1; }

/* ============================================================================
   STEPPER + CARTÃO DE OPÇÃO (cadastro de cliente)
   ========================================================================== */
.stepper { display: flex; gap: var(--gap-xs); align-items: stretch; flex-wrap: wrap; }
.step {
  flex: 1; min-width: 150px; text-align: left; padding: 11px 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  border-top: 2px solid var(--border); display: flex; gap: 10px; align-items: center;
  transition: background .14s, border-color .14s;
}
.step:hover { background: var(--surface-2); }
.step .idx {
  width: 22px; height: 22px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--surface-4); color: var(--muted);
  font-family: var(--font-mono); font-size: 11px; font-weight: 500;
}
.step .lb { font-size: var(--fs-sm); font-weight: 500; color: var(--muted); }
.step .sb { font-size: 11px; color: var(--muted); }
.step.is-on { border-top-color: var(--accent); background: var(--surface-2); }
.step.is-on .lb { color: var(--fg); font-weight: 600; }
.step.is-on .idx { background: var(--accent); color: var(--bg); font-weight: 700; }
.step.is-done .idx { background: var(--ok-soft); color: var(--ok); }
.step.is-done .lb { color: var(--fg); }
.step svg { width: 12px; height: 12px; }

.optcard {
  text-align: left; width: 100%; padding: 13px 15px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius);
  display: flex; gap: 11px; align-items: flex-start; transition: background .14s, border-color .14s;
}
.optcard:hover { background: var(--surface-3); border-color: var(--surface-4); }
.optcard .radio {
  width: 17px; height: 17px; border-radius: 50%; border: 1.5px solid var(--border);
  flex: none; margin-top: 2px; display: grid; place-items: center; transition: border-color .14s;
}
.optcard .radio::after { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); transform: scale(0); transition: transform .14s; }
.optcard.is-on { border-color: var(--accent-line); background: var(--surface-3); }
.optcard.is-on .radio { border-color: var(--accent); }
.optcard.is-on .radio::after { transform: scale(1); }
.optcard .t { font-size: var(--fs-sm); font-weight: 600; }
.optcard .d { font-size: var(--fs-meta); color: var(--muted); margin-top: 2px; }

.chip-input { display: flex; flex-wrap: wrap; gap: 7px; }
.chip-del {
  display: inline-flex; align-items: center; gap: 7px; padding: 5px 9px;
  background: var(--surface-3); border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: var(--fs-meta); max-width: 100%;
}
.chip-del .rm { color: var(--muted); display: flex; padding: 1px; border-radius: 3px; }
.chip-del .rm:hover { color: var(--danger); background: var(--danger-soft); }
.chip-del .rm svg { width: 11px; height: 11px; }

.sticky-side { position: sticky; top: calc(var(--topbar-h) + var(--gap-lg)); }
@media (max-width: 1080px) { .sticky-side { position: static; } }

/* ============================================================================
   ABAS
   ========================================================================== */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tab {
  padding: 10px 14px; font-size: var(--fs-sm); font-weight: 500; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
  min-height: 40px; display: inline-flex; align-items: center; gap: 7px; transition: color .14s, border-color .14s;
}
.tab:hover { color: var(--fg); border-bottom-color: var(--border); }
.tab.is-on { color: var(--gold-lit); font-weight: 600; border-bottom-color: var(--accent); }
.tab .n { font-family: var(--font-mono); font-size: 10px; background: var(--surface-3); color: var(--muted); padding: 1px 6px; border-radius: 99px; }
.tab.is-on .n { color: var(--gold-lit); background: color-mix(in oklch, var(--accent) 18%, var(--surface-3)); }
.tabpanel { display: none; padding-top: var(--gap-lg); }
.tabpanel.is-on { display: block; }

/* ============================================================================
   PROGRESSO / MEDIDOR
   ========================================================================== */
.bar { height: 6px; border-radius: 99px; background: var(--surface-4); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 99px; background: var(--fg); }
.bar.is-ok > i     { background: var(--ok-fill); }
.bar.is-warn > i   { background: var(--warn); }
.bar.is-danger > i { background: var(--danger); }
.bar.is-info > i   { background: var(--info); }
.bar.is-accent > i { background: var(--accent); }
.bar-row { display: flex; align-items: center; gap: 10px; }
.bar-row .bar { flex: 1; min-width: 60px; }
.bar-row .pct { font-family: var(--font-mono); font-size: 11px; color: var(--muted); width: 38px; text-align: right; flex: none; }

/* barra horizontal categórica (tarefas por tipo) */
.hbar { display: grid; grid-template-columns: 1fr; gap: 9px; }
.hbar-row { display: grid; grid-template-columns: 132px 1fr 42px; gap: 10px; align-items: center; font-size: var(--fs-meta); }
.hbar-row .lb { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-row .track { height: 16px; background: var(--surface-2); border-radius: 4px; overflow: hidden; display: flex; }
.hbar-row .track i { display: block; height: 100%; }
.hbar-row .track i.s-late { background: var(--danger); }
.hbar-row .track i.s-open { background: var(--info); }
.hbar-row .track i.s-done { background: var(--ok-fill); }
.hbar-row .vl { font-family: var(--font-mono); text-align: right; color: var(--fg); }
.legend { display: flex; gap: var(--gap-md); flex-wrap: wrap; font-size: 11px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 9px; height: 9px; border-radius: 2px; display: block; }

/* donut de regime */
.donut-wrap { display: flex; align-items: center; gap: var(--gap-lg); }
.donut { width: 116px; height: 116px; flex: none; transform: rotate(-90deg); }
.donut circle { fill: none; stroke-width: 14; }

/* ============================================================================
   LISTA DE ALERTA / ATIVIDADE
   ========================================================================== */
.alist { display: flex; flex-direction: column; }
.aitem {
  display: flex; align-items: flex-start; gap: 11px; padding: 11px var(--gap-md);
  border-bottom: 1px solid var(--border-soft); transition: background .12s; text-align: left; width: 100%;
}
.aitem:last-child { border-bottom: 0; }
.aitem:hover { background: var(--surface-2); }
.aitem .dot { width: 7px; height: 7px; border-radius: 50%; flex: none; margin-top: 6px; }
.aitem .dot.d-danger { background: var(--danger); }
.aitem .dot.d-warn   { background: var(--warn); }
.aitem .dot.d-info   { background: var(--info); }
.aitem .dot.d-ok     { background: var(--ok); }
.aitem .body { flex: 1; min-width: 0; }
.aitem .t { display: block; font-size: var(--fs-sm); font-weight: 500; }
.aitem .s { display: block; font-size: var(--fs-meta); color: var(--muted); margin-top: 2px; }
.aitem .when { font-family: var(--font-mono); font-size: 11px; color: var(--muted); flex: none; }

/* checklist de onboarding */
.ck-group + .ck-group { margin-top: var(--gap-lg); }
.ck-group-head { display: flex; align-items: center; justify-content: space-between; gap: var(--gap-md); padding-bottom: 9px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.ck-item { display: flex; align-items: flex-start; gap: 11px; padding: 11px 4px; border-bottom: 1px solid var(--border-soft); }
.ck-item:last-child { border-bottom: 0; }
.ck-item .body { flex: 1; min-width: 0; }
.ck-item .t { display: block; font-size: var(--fs-sm); font-weight: 500; }
.ck-item.is-done .t { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--border); }
.ck-item .s { display: block; font-size: var(--fs-meta); color: var(--muted); margin-top: 2px; }

/* linha do tempo */
.tl { position: relative; padding-left: 22px; }
.tl::before { content: ''; position: absolute; left: 4px; top: 6px; bottom: 6px; width: 1px; background: var(--border); }
.tl-item { position: relative; padding: 0 0 var(--gap-md); }
.tl-item::before { content: ''; position: absolute; left: -22px; top: 5px; width: 9px; height: 9px; border-radius: 50%; background: var(--surface-4); border: 2px solid var(--bg); }
.tl-item.is-mark::before { background: var(--accent); }
.tl-item .t { font-size: var(--fs-sm); font-weight: 500; }
.tl-item .s { font-size: var(--fs-meta); color: var(--muted); margin-top: 2px; }

/* ============================================================================
   AGENDA — calendário semanal com colunas-dia em kanban
   ========================================================================== */
.cal-wrap { display: grid; grid-template-columns: 236px minmax(0, 1fr); gap: var(--gap-md); align-items: start; }
.cal-wrap.is-rail-off { grid-template-columns: minmax(0, 1fr); }
.cal-wrap.is-rail-off .cal-rail { display: none; }
.cal-rail { position: sticky; top: calc(var(--topbar-h) + var(--gap-md)); }

/* mini calendário do mês */
.minical-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--gap-sm); }
.minical-head .mc-mes { font-family: var(--font-display); font-size: 14px; font-weight: 600; text-transform: capitalize; }
.minical { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.minical .mc-wd {
  font-family: var(--font-mono); font-size: 9px; color: var(--muted);
  text-align: center; padding-bottom: 4px; text-transform: uppercase;
}
.mc-day {
  aspect-ratio: 1; display: grid; place-items: center; border-radius: var(--radius-sm);
  font-family: var(--font-mono); font-size: 11px; color: var(--fg);
  position: relative; transition: background .12s, color .12s;
}
.mc-day:hover { background: var(--surface-3); }
.mc-day.is-out { color: var(--muted); opacity: .45; }
.mc-day.is-week { background: var(--surface-3); }
.mc-day.is-today { background: var(--accent); color: var(--bg); font-weight: 700; }
.mc-day.is-week.is-today { background: var(--accent); }
.mc-day .mc-dot {
  position: absolute; bottom: 3px; width: 3px; height: 3px; border-radius: 50%;
  background: var(--muted);
}
.mc-day.is-today .mc-dot { background: var(--bg); }
.mc-day.has-late .mc-dot { background: var(--danger); }

/* barra de ferramentas estilo Teams */
.cal-toolbar {
  display: flex; align-items: center; gap: var(--gap-sm); flex-wrap: wrap;
  padding: var(--gap-sm) var(--gap-md); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-lg); margin-bottom: var(--gap-md);
}
.cal-nav { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.cal-nav button { width: 32px; height: 32px; display: grid; place-items: center; color: var(--muted); }
.cal-nav button:hover { background: var(--surface-3); color: var(--fg); }
.cal-nav button + button { border-left: 1px solid var(--border); }
.cal-nav svg { width: 15px; height: 15px; }
.cal-range { font-family: var(--font-display); font-size: 16px; font-weight: 600; white-space: nowrap; }

/* tabuleiro */
.cal-board { display: grid; gap: var(--gap-sm); align-items: start; }
.cal-col {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); display: flex; flex-direction: column;
  min-width: 0; transition: background .14s, border-color .14s;
}
.cal-col.is-today { border-color: var(--accent-line); }
.cal-col.is-over { border-color: var(--accent); background: var(--gold-wash); }
.cal-col-head {
  padding: 10px var(--gap-sm); border-bottom: 1px solid var(--border);
  display: flex; align-items: baseline; gap: 8px;
}
.cal-col-head .d-num { font-family: var(--font-display); font-size: 21px; font-weight: 700; line-height: 1; }
.cal-col-head .d-wd { font-size: 11px; color: var(--muted); text-transform: capitalize; }
.cal-col-head .d-n {
  margin-left: auto; font-family: var(--font-mono); font-size: 10px;
  background: var(--surface-3); color: var(--muted); padding: 1px 6px; border-radius: 99px;
}
.cal-col.is-today .d-num { color: var(--gold-lit); }
.cal-col.is-today .d-wd  { color: var(--ambar); }
.cal-col.is-today .d-n   { background: color-mix(in oklch, var(--accent) 20%, var(--surface-3)); color: var(--gold-lit); }
.cal-col-body {
  padding: 8px; display: flex; flex-direction: column; gap: 7px;
  overflow-y: auto; max-height: calc(100vh - 290px); min-height: 180px;
}
.cal-col-empty {
  border: 1px dashed var(--border); border-radius: var(--radius);
  padding: 18px 10px; text-align: center; color: var(--muted); font-size: 11px;
}

/* card de tarefa */
.tcard {
  position: relative; width: 100%; text-align: left;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 8px 9px 8px 13px;
  cursor: grab; transition: background .12s, border-color .12s, transform .06s;
}
.tcard::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  border-radius: var(--radius) 0 0 var(--radius); background: var(--idle);
}
.tcard.s-atrasada::before     { background: var(--danger); }
.tcard.s-em_andamento::before { background: var(--info); }
.tcard.s-pendente::before     { background: var(--idle); }
.tcard.s-concluida::before    { background: var(--ok-fill); }
.tcard:hover { background: var(--surface-3); border-color: var(--surface-4); }
.tcard:active { cursor: grabbing; }
.tcard.is-drag { opacity: .35; }
.tcard .tc-t {
  font-size: 12px; font-weight: 600; line-height: 1.3; color: var(--fg);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.tcard .tc-c { font-size: 11px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tcard .tc-f { display: flex; align-items: center; gap: 6px; margin-top: 7px; }
.tcard .tc-av {
  width: 18px; height: 18px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--surface-4); color: var(--fg); font-family: var(--font-mono); font-size: 8px; font-weight: 600;
}
.tcard .tc-p { width: 5px; height: 5px; border-radius: 50%; flex: none; }
.tcard .tc-p.p-alta { background: var(--danger); }
.tcard .tc-p.p-media { background: var(--warn); }
.tcard .tc-p.p-baixa { background: var(--idle); }
.tcard .tc-d { margin-left: auto; font-family: var(--font-mono); font-size: 9.5px; color: var(--muted); }
.tcard .tc-d.is-late { color: var(--danger); }
.tcard.s-concluida .tc-t { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--border); }

/* gaveta lateral de detalhe */
.drawer-scrim {
  position: fixed; inset: 0; z-index: 88; background: var(--scrim);
  backdrop-filter: blur(2px); display: none;
}
.drawer-scrim.is-open { display: block; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 89;
  width: min(430px, 100%); background: var(--surface);
  border-left: 1px solid var(--border); box-shadow: var(--shadow-pop);
  display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform .22s cubic-bezier(.32,.72,0,1);
}
.drawer.is-open { transform: none; }
.drawer-head { padding: var(--gap-md) var(--gap-lg); border-bottom: 1px solid var(--border); }
.drawer-body { padding: var(--gap-lg); overflow-y: auto; flex: 1; }
.drawer-foot { padding: var(--gap-md) var(--gap-lg); border-top: 1px solid var(--border); display: flex; gap: var(--gap-sm); flex-wrap: wrap; }

@media (max-width: 1180px) {
  .cal-wrap { grid-template-columns: minmax(0, 1fr); }
  .cal-rail { position: static; }
}
@media (max-width: 900px) {
  .cal-board { grid-template-columns: minmax(0, 1fr) !important; }
  .cal-col-body { max-height: none; }
}

/* ============================================================================
   ESTADO VAZIO / MODAL / TOAST
   ========================================================================== */
.empty { text-align: center; padding: var(--gap-2xl) var(--gap-lg); color: var(--muted); }
.empty svg { width: 32px; height: 32px; margin: 0 auto var(--gap-sm); color: var(--surface-4); }
.empty h3 { color: var(--fg); margin-bottom: 5px; }
.empty p { font-size: var(--fs-sm); max-width: 44ch; margin-inline: auto; }

.modal-scrim {
  position: fixed; inset: 0; z-index: 90; background: var(--scrim);
  backdrop-filter: blur(3px); display: none; place-items: center; padding: var(--gap-lg);
}
.modal-scrim.is-open { display: grid; }
.modal {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop); width: min(560px, 100%); max-height: 86vh; overflow: auto;
}
.modal-head { padding: var(--gap-md) var(--gap-lg); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: var(--gap-md); }
.modal-body { padding: var(--gap-lg); }
.modal-foot { padding: var(--gap-md) var(--gap-lg); border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: var(--gap-sm); }

.toast-host { position: fixed; right: var(--gap-lg); bottom: var(--gap-lg); z-index: 95; display: flex; flex-direction: column; gap: var(--gap-sm); }
.toast {
  display: flex; align-items: center; gap: 9px; padding: 11px 15px;
  background: var(--surface-3); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-pop); font-size: var(--fs-sm);
  animation: toast-in .2s ease;
}
.toast svg { width: 15px; height: 15px; color: var(--ok); flex: none; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ============================================================================
   LOGIN
   ========================================================================== */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.auth-aside {
  background: var(--surface); border-right: 1px solid var(--border);
  padding: var(--gap-2xl); display: flex; flex-direction: column; justify-content: space-between;
  position: relative; overflow: hidden;
}
.auth-aside::after {
  content: ''; position: absolute; right: -180px; bottom: -180px; width: 460px; height: 460px;
  border-radius: 50%; background: var(--accent-soft); filter: blur(90px); pointer-events: none;
}
.auth-aside > * { position: relative; z-index: 1; }
.auth-aside .logo-full { width: 220px; height: auto; }
.auth-claim { font-family: var(--font-display); font-size: 34px; font-weight: 600; line-height: 1.2; letter-spacing: -.025em; max-width: 17ch; }
.auth-claim em { font-style: normal; color: var(--accent); }
.auth-points { display: flex; flex-direction: column; gap: 13px; margin-top: var(--gap-lg); }
.auth-points li { display: flex; align-items: flex-start; gap: 10px; font-size: var(--fs-sm); color: var(--muted); }
.auth-points svg { width: 15px; height: 15px; color: var(--muted); flex: none; margin-top: 3px; }
.auth-main { display: grid; place-items: center; padding: var(--gap-lg); }
.auth-form { width: min(372px, 100%); }

/* ============================================================================
   RESPONSIVO — desktop-first, degrada sem rolagem horizontal
   ========================================================================== */
@media (max-width: 1240px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1080px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--border); }
  .sidebar-head { border-bottom: 0; border-right: 1px solid var(--border-soft); flex: none; padding: 12px var(--gap-md); }
  .sidebar-head .product { display: none; }
  .sidebar-nav { display: flex; gap: 4px; padding: 8px; flex: 1; }
  .nav-group + .nav-group { margin-top: 0; }
  .nav-group { display: flex; gap: 4px; }
  .nav-group-label { display: none; }
  .nav-item { border-left: 0; border-bottom: 2px solid transparent; }
  .nav-item.is-active { border-left: 0; border-bottom-color: var(--accent); }
  .nav-item.is-soon { display: none; }
  .sidebar-foot { border-top: 0; border-left: 1px solid var(--border-soft); flex: none; }
  .auth { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
}
@media (max-width: 900px) {
  .grid-2, .grid-3, .grid-4, .grid-2-1, .grid-1-2 { grid-template-columns: minmax(0, 1fr); }
  .content { padding: var(--gap-md); }
  .donut-wrap { flex-direction: column; align-items: flex-start; }
  .hbar-row { grid-template-columns: 96px 1fr 38px; }
  .search { min-width: 140px; }
  .search kbd { display: none; }
}
