/* ════════════════════════════════════════════════════════════════════
   Protótipo de telas — identidade C · Encaixe (Orça na Obra)
   Os tokens vêm de docs/design/identidade/tokens.css (areia + ameixa, cantos 12/20/28),
   a fonte é a Manrope de identidade/fontes/. Este arquivo só dá nome aos componentes.
   Nomes seguem o shadcn/ui (background, card, muted, border, input, ring, primary...).

   Regra de cor: ameixa (--primary) nas ações e no item ativo; verde, âmbar e vermelho só em status,
   sempre com ícone e texto. A logo e a cor da EMPRESA (--empresa-cor) aparecem só no cabeçalho dela
   e no PDF; elas nunca trocam --primary.
   ════════════════════════════════════════════════════════════════════ */
@import url("../identidade/tokens.css");
@font-face { font-family: "Manrope"; font-weight: 200 800; font-style: normal; font-display: swap; src: url("../identidade/fontes/manrope-latin-wght-normal.woff2") format("woff2"); }

:root {
  --primary-soft: color-mix(in oklch, var(--ring) 14%, transparent); /* fundo do item ativo e do chip marcado */
  --marca-texto: var(--marca-600);
  --surface-2: var(--background);        /* fundo da área de trabalho atrás dos cards (areia) */
  --empresa-cor: #0e8a0b;                /* cor da empresa cliente (NH Forros): só logo e PDF. O painel ⚙ troca */
  --empresa-cor-fg: #ffffff;

  --radius-control: var(--radius);                 /* 12px: botão, campo */
  --radius-card: calc(var(--radius) + 8px);        /* 20px: card */
  --radius-sheet: calc(var(--radius) + 16px);      /* 28px: sheet, dialog */
  --shadow-1: var(--elevacao-1);
  --shadow-2: var(--elevacao-2);
  --shadow-3: var(--elevacao-3);

  --fs-13: 13px; --fs-14: 14px; --fs-16: 16px; --fs-20: 20px; --fs-24: 24px; --fs-32: 32px;
  --touch: 44px;

  --sidebar-w: 260px;
  --rail-w: 76px;
  --bottomnav-h: 68px;
  --topbar-h: 60px;
  color-scheme: light;
}
.dark { color-scheme: dark; --marca-texto: var(--marca-400); }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--surface-2); color: var(--foreground);
  font: 500 var(--fs-14)/1.5 "Manrope", ui-sans-serif, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -0.02em; }
h1 { font-size: var(--fs-24); font-weight: 800; }
h2 { font-size: var(--fs-20); font-weight: 800; }
h3 { font-size: var(--fs-16); font-weight: 700; }
p { margin: 0; }
a { color: inherit; }
.num, td.num, .tabular, .hero-num { font-variant-numeric: tabular-nums; }
button, input, select, textarea { font-family: inherit; }
.muted { color: var(--muted-foreground); }
.small { font-size: var(--fs-13); }
.strong { font-weight: 700; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
svg.i.sm { width: 16px; height: 16px; }
svg.i.lg { width: 24px; height: 24px; }

/* ── Layout utilitário ─────────────────────────────────────────── */
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.stack-lg { display: flex; flex-direction: column; gap: 24px; }
.row { display: flex; align-items: center; gap: 12px; }
.row-sm { display: flex; align-items: center; gap: 8px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.grid { display: grid; gap: 16px; }
.grid-2, .grid-3, .grid-4 { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid-2, .grid-4 { grid-template-columns: repeat(2, minmax(0,1fr)); } .grid-3 { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (min-width: 1024px) { .grid-3 { grid-template-columns: repeat(3, minmax(0,1fr)); } .grid-4 { grid-template-columns: repeat(4, minmax(0,1fr)); } }
.mt-0 { margin-top: 0 } .mt-8 { margin-top: 8px } .mt-16 { margin-top: 16px } .mt-24 { margin-top: 24px }
@media (max-width: 639px) { .hide-mobile { display: none !important; } }
@media (min-width: 640px) { .only-mobile { display: none !important; } }
@media (max-width: 1023px) { .only-desktop { display: none !important; } }

/* ── Shell: celular (<640) bottom nav · tablet retrato (640–1023) rail · ≥1024 sidebar ── */
.app { min-height: 100dvh; }
.sidebar, .rail, .bottomnav { display: none; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar-h);
  display: flex; align-items: center; gap: 8px; padding: 0 12px 0 16px;
  background: var(--card); border-bottom: 1px solid var(--border);
}
.topbar .titulo { font-size: var(--fs-16); font-weight: 800; letter-spacing: -.01em; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .voltar { margin-left: -8px; }
.topbar .empresa-topo { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; text-align: left; }
.topbar .empresa-topo strong { font-size: var(--fs-16); font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 639px) { .topbar .empresa-topo ~ .titulo { display: none; } }
.conteudo { padding: 16px 16px calc(var(--bottomnav-h) + 32px + env(safe-area-inset-bottom)); max-width: 100%; }
.conteudo.sem-padding { padding: 0; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.page-head .sub { color: var(--muted-foreground); margin-top: 4px; }
.page-head .acoes { display: flex; gap: 8px; flex-wrap: wrap; }

.bottomnav {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  height: calc(var(--bottomnav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--card); border-top: 1px solid var(--border);
}
.bottomnav a, .bottomnav button {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 12px; /* rótulo de ícone de navegação: única exceção ao piso de 13px, sempre junto do ícone */
  color: var(--muted-foreground); text-decoration: none; background: none; border: 0; min-height: var(--touch); cursor: pointer; font-family: inherit; font-weight: 500;
}
.bottomnav [aria-current="page"] { color: var(--marca-texto); font-weight: 800; }
.bottomnav .fab-slot { position: relative; }
.bottomnav .fab {
  width: 54px; height: 54px; border-radius: 18px; margin-top: -20px;
  background: var(--primary); color: var(--primary-foreground); display: grid; place-items: center; box-shadow: var(--shadow-2);
}

@media (min-width: 640px) {
  .bottomnav { display: none; }
  .rail {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    position: fixed; inset: 0 auto 0 0; width: var(--rail-w); z-index: 40; padding: 14px 0;
    background: var(--card); border-right: 1px solid var(--border);
  }
  .rail .marca-mini { width: 44px; height: 44px; min-height: 0; margin-bottom: 12px; border-radius: 12px; }
  .rail .marca-mini.logo-img { border: 1px solid var(--border); }
  .rail a, .rail button {
    width: 60px; min-height: 54px; border-radius: var(--radius-control); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    color: var(--muted-foreground); text-decoration: none; font-size: 12px; font-weight: 500; background: none; border: 0; cursor: pointer; font-family: inherit;
  }
  .rail a { width: 72px; }
  .rail a span { font-size: 11px; letter-spacing: -.02em; white-space: nowrap; } /* "Configurações" cabe no rail de 76px */
  .rail a:hover, .rail button:hover { background: var(--accent); color: var(--foreground); }
  .rail [aria-current="page"] { background: var(--primary-soft); color: var(--marca-texto); font-weight: 800; }
  .rail .rail-fim { margin-top: auto; }
  .app { padding-left: var(--rail-w); }
  .conteudo { padding: 24px 24px 48px; }
}
@media (min-width: 1024px) {
  .rail { display: none; }
  .app { padding-left: var(--sidebar-w); }
  .sidebar {
    display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 40;
    background: var(--card); border-right: 1px solid var(--border); padding: 18px 12px 14px;
  }
  .conteudo { padding: 28px 36px 56px; }
}
@media (min-width: 1280px) { .conteudo { padding: 32px 44px 64px; } }

.sidebar .empresa {
  display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--radius-control); border: 1px solid var(--border);
  background: var(--card); cursor: pointer; text-align: left; width: 100%; font: inherit; color: inherit;
}
.sidebar .empresa:hover { background: var(--accent); }
.sidebar .empresa .strong { font-weight: 800; }
.sidebar nav { margin-top: 16px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.sidebar .grupo { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted-foreground); padding: 16px 12px 6px; }
.sidebar nav a {
  display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: var(--radius-control);
  color: var(--muted-foreground); text-decoration: none; font-weight: 600;
}
.sidebar nav a:hover { background: var(--accent); color: var(--foreground); }
.sidebar nav a[aria-current="page"] { background: var(--primary-soft); color: var(--marca-texto); font-weight: 800; }
.sidebar nav a .cont { margin-left: auto; font-size: 12px; color: var(--muted-foreground); }
.sidebar .rodape { margin-top: auto; border-top: 1px solid var(--border); padding-top: 12px; display: flex; align-items: center; gap: 10px; }
.feito-com { display: flex; align-items: center; gap: 6px; margin-top: 12px; padding: 0 4px; font-size: 12px; color: var(--muted-foreground); }
.feito-com img { width: 18px; height: 18px; flex: none; }
.feito-com b { font-weight: 700; color: var(--muted-foreground); }

/* Marca do produto (símbolo e logotipo "orça na obra"). Vêm de identidade/direcao-c-encaixe/. */
.logo-produto { display: block; height: 40px; width: auto; }
.logo-produto.claro-so, .logo-produto.escuro-so { display: none; }
:root:not(.dark) .logo-produto.claro-so { display: block; }
.dark .logo-produto.escuro-so { display: block; }
.simbolo-produto { width: 36px; height: 36px; flex: none; }
/* Marca da EMPRESA cliente: só no cabeçalho dela e no PDF. Cor própria (--empresa-cor), nunca troca o --primary. */
.marca-mini { width: 36px; height: 36px; border-radius: 10px; background: var(--empresa-cor); color: var(--empresa-cor-fg); display: grid; place-items: center; font-weight: 800; font-size: 13px; flex: none; overflow: hidden; }
.marca-mini.logo-img { background: #fff; border: 1px solid var(--border); }
.marca-mini img { width: 100%; height: 100%; object-fit: contain; }
.marca-mini.produto { background: none; }

/* Rail recolhido em 1024–1279 para telas largas de conteúdo (agenda): body[data-nav-compacta].
   Mesma navegação, só sem os rótulos longos da sidebar; devolve 184px ao conteúdo. */
.rail { overflow-y: auto; scrollbar-width: none; }
@media (min-width: 1024px) and (max-width: 1279px) {
  body[data-nav-compacta] .sidebar { display: none; }
  body[data-nav-compacta] .rail { display: flex; }
  body[data-nav-compacta] .app { padding-left: var(--rail-w); }
  body[data-nav-compacta] .conteudo { padding: 24px 20px 48px; }
}

/* ── Faixa do modo suporte e offline ─────────────────────────── */
.faixa {
  position: sticky; top: 0; z-index: 35; display: flex; align-items: center; gap: 10px; padding: 10px 16px;
  font-size: var(--fs-13); border-bottom: 1px solid var(--border);
}
.faixa-suporte { background: repeating-linear-gradient(135deg, var(--concreto-900) 0 12px, var(--concreto-800) 12px 24px); color: var(--concreto-50); }
.faixa-suporte .btn { color: var(--concreto-50); border-color: var(--concreto-500); background: transparent; }
.faixa-offline { background: var(--muted); color: var(--foreground); }

/* ── Botões (shadcn Button) ───────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--touch); padding: 0 18px;
  border-radius: var(--radius-control); border: 1px solid transparent; font-weight: 700; font-size: var(--fs-14); line-height: 1; font-family: inherit;
  cursor: pointer; text-decoration: none; white-space: nowrap; background: var(--secondary); color: var(--secondary-foreground);
  transition: background .12s, border-color .12s, box-shadow .12s;
}
.btn:hover { background: color-mix(in oklch, var(--secondary) 85%, var(--foreground)); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--background), 0 0 0 4px var(--ring); }
.btn-primary { background: var(--primary); color: var(--primary-foreground); }
.btn-primary:hover { background: color-mix(in oklch, var(--primary) 88%, black); }
.btn-outline { background: var(--card); border-color: var(--input); color: var(--foreground); }
.btn-outline:hover { background: var(--accent); }
.btn-ghost { background: transparent; color: var(--foreground); }
.btn-ghost:hover { background: var(--accent); }
.btn-link { background: none; border: 0; color: var(--marca-texto); padding: 0; min-height: auto; font: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; text-align: left; }
.btn-link:hover { background: none; text-decoration-thickness: 2px; }
.btn-destructive { background: var(--destructive); color: var(--destructive-foreground); }
.btn-destructive:hover { background: color-mix(in oklch, var(--destructive) 88%, black); }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: var(--fs-13); }
.btn-lg { min-height: 48px; padding: 0 22px; font-size: var(--fs-16); }
.btn-icon { width: var(--touch); padding: 0; }
.btn-icon.btn-sm { width: 36px; }
.btn-block { width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .45; pointer-events: none; }

/* ── Campos (Input, Select, Textarea, Label) ─────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.label { font-size: var(--fs-13); font-weight: 700; }
.hint { font-size: var(--fs-13); color: var(--muted-foreground); }
.erro-campo { font-size: var(--fs-13); font-weight: 600; display: flex; gap: 6px; align-items: center; color: var(--perigo-texto); }
.input, .select, .textarea {
  width: 100%; min-height: var(--touch); padding: 0 14px; border-radius: var(--radius-control);
  border: 1px solid var(--input); background: var(--card); color: var(--foreground); font: inherit; font-size: 16px; /* 16px evita zoom no iOS */
}
@media (min-width: 1024px) { .input, .select, .textarea { font-size: var(--fs-14); } }
.textarea { padding: 12px 14px; min-height: 96px; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: var(--muted-foreground); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--ring); box-shadow: 0 0 0 3px color-mix(in oklch, var(--ring) 28%, transparent); }
.input[aria-invalid="true"] { border-color: var(--perigo-texto); border-width: 2px; }
.input-group { position: relative; display: flex; align-items: center; }
.input-group > .i { position: absolute; left: 14px; color: var(--muted-foreground); pointer-events: none; }
.input-group > .i + .input { padding-left: 42px; }
.input-group .sufixo { position: absolute; right: 14px; color: var(--muted-foreground); font-size: var(--fs-13); }
.input.num { text-align: right; }
.fieldset-2 { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .fieldset-2 { grid-template-columns: 1fr 1fr; } }

.check { display: flex; align-items: center; gap: 10px; min-height: var(--touch); cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--primary); }
.switch { position: relative; width: 44px; height: 26px; flex: none; }
.switch input { appearance: none; width: 44px; height: 26px; border-radius: 99px; background: var(--input); cursor: pointer; margin: 0; transition: background .15s; }
.switch input:checked { background: var(--primary); }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-1); transition: transform .15s; }
.switch input:checked::after { transform: translateX(18px); }
.switch input:focus-visible { outline: none; box-shadow: 0 0 0 3px color-mix(in oklch, var(--ring) 40%, transparent); }

/* ── Card ─────────────────────────────────────────────────────── */
.card { background: var(--card); color: var(--card-foreground); border: 1px solid color-mix(in oklch, var(--border) 65%, transparent); border-radius: var(--radius-card); box-shadow: var(--shadow-1); }
.card-header { padding: 18px 18px 0; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.card-title { font-size: var(--fs-16); font-weight: 800; letter-spacing: -.01em; }
.card-desc { color: var(--muted-foreground); font-size: var(--fs-13); margin-top: 2px; }
.card-content { padding: 18px; }
.card-footer { padding: 14px 18px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
@media (min-width: 1024px) { .card-header { padding: 22px 24px 0; } .card-content { padding: 22px 24px; } .card-footer { padding: 16px 24px; } }
.card-link { text-decoration: none; display: block; }
.card-link:hover { border-color: color-mix(in oklch, var(--ring) 45%, var(--border)); box-shadow: var(--shadow-2); }

/* Card de orçamento (referência: direcao-c-encaixe/telas/card-orcamento). Cabeçalho com número e status,
   cliente, três medidas, total grande e ações. */
.orc { display: flex; flex-direction: column; gap: 14px; padding: 20px; }
.orc-topo { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.orc-num { font-size: var(--fs-13); font-weight: 800; color: var(--marca-texto); font-variant-numeric: tabular-nums; }
.orc h3 { font-size: 19px; font-weight: 800; }
.orc-meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 12px 0; border-block: 1px solid var(--border); margin: 0; }
.orc-meta dt { font-size: 12px; color: var(--muted-foreground); }
.orc-meta dd { margin: 0; font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.orc-total { display: flex; flex-direction: column; gap: 2px; }
.orc-total strong { font-size: 30px; line-height: 1.1; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.orc-total span { font-size: 13px; color: var(--muted-foreground); }
.orc-acoes { display: flex; gap: 8px; flex-wrap: wrap; }
.orc-acoes .btn-primary { flex: 1 1 180px; }

/* ── KPI (stat tile) ──────────────────────────────────────────── */
.kpi { padding: 18px 20px; display: flex; flex-direction: column; gap: 4px; }
.kpi .rotulo { font-size: var(--fs-13); color: var(--muted-foreground); display: flex; align-items: center; gap: 6px; }
.kpi .valor { font-size: 28px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; line-height: 1.2; }
.kpi .delta { font-size: var(--fs-13); color: var(--muted-foreground); display: flex; align-items: center; gap: 4px; }
.kpi .delta .up { color: var(--sucesso); font-weight: 700; }
.hero-num { font-size: 40px; font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; line-height: 1.1; }
@media (min-width: 1024px) { .hero-num { font-size: 48px; } }

/* ── Selo de status: ícone + texto, nunca só cor. Verde, âmbar e vermelho só aqui ── */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 8px; border-radius: 99px; line-height: 20px;
  font-size: var(--fs-13); font-weight: 700; background: var(--muted); color: var(--muted-foreground); white-space: nowrap; border: 0;
}
.badge svg.i { width: 15px; height: 15px; }
.badge-outline { background: transparent; box-shadow: inset 0 0 0 1px var(--input); color: var(--foreground); }
.badge-solid { background: var(--foreground); color: var(--background); }
.badge-primary { background: var(--primary-soft); color: var(--marca-texto); }
.badge-tracejado { background: transparent; box-shadow: inset 0 0 0 1px var(--input); color: var(--muted-foreground); }
/* status de orçamento → cor do selo */
.st-rascunho, .st-novo, .st-expirado { background: var(--muted); color: var(--muted-foreground); }
.st-enviado { background: var(--alerta-suave); color: var(--alerta); }
.st-aprovado, .st-concluido { background: var(--sucesso-suave); color: var(--sucesso); }
.st-execucao { background: var(--primary-soft); color: var(--marca-texto); }
.st-cancelado { background: var(--perigo-suave); color: var(--perigo-texto); }
.st-sucesso { background: var(--sucesso-suave); color: var(--sucesso); }
.st-alerta { background: var(--alerta-suave); color: var(--alerta); }
.st-perigo { background: var(--perigo-suave); color: var(--perigo-texto); }

/* ── Chip (filtro e atalho) ───────────────────────────────────── */
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px 2px 4px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 16px; border-radius: 99px; flex: none;
  border: 1px solid var(--input); background: var(--card); color: var(--foreground); font-weight: 600; font-size: var(--fs-13); font-family: inherit; cursor: pointer; white-space: nowrap;
}
.chip:hover { background: var(--accent); }
.chip[aria-pressed="true"] { background: var(--primary-soft); color: var(--marca-texto); border-color: transparent; font-weight: 800; }
.chip .cont { color: inherit; opacity: .7; font-variant-numeric: tabular-nums; }
.chip-lg { min-height: var(--touch); padding: 0 18px; font-size: var(--fs-14); }

/* ── Tabs ─────────────────────────────────────────────────────── */
.tabs-list { display: inline-flex; gap: 2px; padding: 4px; background: var(--muted); border-radius: var(--radius-control); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.tabs-list [role="tab"] {
  min-height: 38px; padding: 0 16px; border-radius: 9px; border: 0; background: none; color: var(--muted-foreground);
  font-weight: 600; font-size: var(--fs-14); font-family: inherit; cursor: pointer; white-space: nowrap;
}
.tabs-list [role="tab"][aria-selected="true"] { background: var(--card); color: var(--marca-texto); font-weight: 800; box-shadow: var(--shadow-1); }
.tabs-linha { display: flex; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs-linha [role="tab"] { min-height: var(--touch); padding: 0 14px; border: 0; background: none; color: var(--muted-foreground); font-weight: 600; font-size: var(--fs-14); font-family: inherit; cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs-linha [role="tab"][aria-selected="true"] { color: var(--marca-texto); font-weight: 800; border-bottom-color: var(--primary); }
[role="tabpanel"][hidden] { display: none; }

/* ── Tabela que vira lista de cards no celular ───────────────── */
.tabela-wrap { overflow-x: auto; }
.tabela { width: 100%; border-collapse: collapse; font-size: var(--fs-14); }
.tabela th { text-align: left; font-weight: 700; font-size: var(--fs-13); color: var(--muted-foreground); padding: 14px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tabela td { padding: 14px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
@media (min-width: 1024px) { .tabela th { padding-inline: 16px; } .tabela td { padding: 16px; } }
.tabela tbody tr:last-child td { border-bottom: 0; }
.tabela tbody tr:hover { background: var(--muted); }
.tabela tr[data-href] { cursor: pointer; }
.tabela .num { text-align: right; font-variant-numeric: tabular-nums; }
.tabela td.num, .tabela td[data-col="valor"] { font-weight: 700; white-space: nowrap; }
@media (max-width: 639px) {
  .tabela.responsiva thead { display: none; }
  .tabela.responsiva, .tabela.responsiva tbody { display: block; }
  .tabela.responsiva tr { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
  .tabela.responsiva td { display: block; padding: 0; border: 0; }
  .tabela.responsiva td[data-col="principal"] { grid-column: 1; font-weight: 700; }
  .tabela.responsiva td[data-col="valor"] { grid-column: 2; grid-row: 1; text-align: right; font-weight: 800; }
  .tabela.responsiva td[data-col="meta"] { grid-column: 1; color: var(--muted-foreground); font-size: var(--fs-13); }
  .tabela.responsiva td[data-col="status"] { grid-column: 2; grid-row: 2; text-align: right; }
  .tabela.responsiva td[data-col="oculto-mobile"] { display: none; }
  .tabela.responsiva td[data-col="acoes"] { grid-column: 1 / -1; }
}

/* ── Lista simples ────────────────────────────────────────────── */
.lista { list-style: none; margin: 0; padding: 0; }
.lista > li { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--border); min-height: 56px; }
.lista > li:last-child { border-bottom: 0; }
.lista > li > a.cobre { position: absolute; inset: 0; }
.lista-item { text-decoration: none; display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--border); min-height: 56px; }
.lista-item:hover { background: var(--muted); }

/* ── Avatar ───────────────────────────────────────────────────── */
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--secondary); color: var(--foreground); display: grid; place-items: center; font-weight: 800; font-size: 13px; flex: none; }
.avatar.sm { width: 30px; height: 30px; font-size: 12px; }
.avatar.lg { width: 56px; height: 56px; font-size: 18px; }

/* ── Separator, Alert, Skeleton, Empty, Progress ─────────────── */
.sep { height: 1px; background: var(--border); border: 0; margin: 16px 0; }
.alert { display: flex; gap: 12px; padding: 12px 14px; border: 0; border-radius: var(--radius-control); background: var(--muted); color: var(--foreground); font-size: var(--fs-14); }
.alert .i { margin-top: 2px; }
.alert-title { font-weight: 800; }
.alert-primary { background: var(--primary-soft); }
.alert-primary .i { color: var(--marca-texto); }
.alert-escuro { background: var(--concreto-800); color: var(--concreto-50); }
.skeleton { background: linear-gradient(90deg, var(--muted) 25%, color-mix(in oklch, var(--muted) 70%, var(--background)) 50%, var(--muted) 75%); background-size: 200% 100%; animation: brilho 1.4s infinite; border-radius: 8px; }
@keyframes brilho { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; padding: 40px 20px; }
.empty .icone { width: 56px; height: 56px; border-radius: 18px; background: var(--primary-soft); display: grid; place-items: center; color: var(--marca-texto); }
.empty p { max-width: 380px; color: var(--muted-foreground); }
.progress { height: 8px; background: var(--muted); border-radius: 99px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--primary); border-radius: 99px; }

/* ── Sheet (bottom no celular, lateral ≥1024) e Dialog ───────── */
.overlay { position: fixed; inset: 0; z-index: 60; background: rgb(25 21 18 / .5); display: none; }
.overlay.aberto { display: block; }
.sheet {
  position: fixed; z-index: 61; left: 0; right: 0; bottom: 0; max-height: 92dvh; display: none; flex-direction: column;
  background: var(--popover); color: var(--popover-foreground); border-radius: var(--radius-sheet) var(--radius-sheet) 0 0; box-shadow: var(--shadow-3);
}
.sheet.aberto { display: flex; }
.sheet::before { content: ""; width: 40px; height: 4px; border-radius: 99px; background: var(--input); margin: 10px auto 0; flex: none; }
.sheet-header { padding: 12px 20px 8px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sheet-body { padding: 8px 20px 20px; overflow-y: auto; }
.sheet-footer { padding: 12px 20px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); display: flex; gap: 8px; }
.sheet-footer .btn { flex: 1; }
@media (min-width: 1024px) {
  .sheet { left: auto; top: 0; width: 460px; max-height: none; border-radius: var(--radius-sheet) 0 0 var(--radius-sheet); }
  .sheet::before { display: none; }
  .sheet-header { padding-top: 22px; }
  .sheet-footer .btn { flex: none; }
  .sheet-footer { justify-content: flex-end; }
}
.dialog {
  position: fixed; z-index: 61; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(460px, calc(100vw - 32px));
  display: none; flex-direction: column; gap: 12px; padding: 24px; border-radius: var(--radius-sheet); background: var(--popover); box-shadow: var(--shadow-3);
}
.dialog.aberto { display: flex; }
.dialog .acoes { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; flex-wrap: wrap; }

/* ── Dropdown (details/summary) ───────────────────────────────── */
.dropdown { position: relative; }
.dropdown > summary { list-style: none; }
.dropdown > summary::-webkit-details-marker { display: none; }
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 50; min-width: 220px; padding: 6px;
  background: var(--popover); border: 1px solid var(--border); border-radius: calc(var(--radius) + 4px); box-shadow: var(--shadow-2);
}
.menu a, .menu button { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 0 12px; border-radius: var(--radius-control); border: 0; background: none; color: inherit; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; text-align: left; }
.menu a:hover, .menu button:hover { background: var(--accent); }
.menu .sep { margin: 6px 0; }
.menu .rotulo-menu { font-size: 12px; color: var(--muted-foreground); padding: 6px 10px 4px; }

/* ── Toast (sonner) ───────────────────────────────────────────── */
.toaster { position: fixed; z-index: 80; left: 16px; right: 16px; bottom: calc(var(--bottomnav-h) + 16px); display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
@media (min-width: 640px) { .toaster { left: auto; right: 24px; bottom: 24px; width: 380px; } }
.toast { pointer-events: auto; display: flex; gap: 10px; align-items: center; padding: 14px 16px; border-radius: var(--radius-control); background: var(--concreto-800); color: var(--concreto-50); box-shadow: var(--shadow-2); font-weight: 600; animation: entra .2s; }
.toast .i { color: var(--concreto-50); }
@keyframes entra { from { transform: translateY(8px); opacity: 0; } }

/* ── Stepper (onboarding) ─────────────────────────────────────── */
.stepper { display: flex; gap: 6px; }
.stepper > span { flex: 1; height: 6px; border-radius: 99px; background: var(--muted); }
.stepper > span.feito, .stepper > span.atual { background: var(--primary); }
.stepper > span.atual { background: color-mix(in oklch, var(--primary) 55%, var(--muted)); }
.passos-lista { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.passos-lista li { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: var(--radius-control); color: var(--muted-foreground); font-weight: 600; }
.passos-lista li.atual { background: var(--primary-soft); color: var(--marca-texto); font-weight: 800; }
.passos-lista li.feito { color: var(--foreground); }
.passos-lista .bola { width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid currentColor; display: grid; place-items: center; font-size: 12px; flex: none; }
.passos-lista li.feito .bola { background: var(--primary); color: var(--primary-foreground); border-color: var(--primary); }

/* ── Kanban (funil) ───────────────────────────────────────────── */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(280px, 86vw); gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 8px; }
.kanban > .coluna { scroll-snap-align: start; background: var(--muted); border-radius: var(--radius-card); padding: 10px; display: flex; flex-direction: column; gap: 8px; min-height: 200px; }
@media (min-width: 640px) { .kanban { grid-auto-columns: minmax(280px, 1fr); } }
.coluna-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 6px; }
.coluna-head .soma { font-size: var(--fs-13); color: var(--muted-foreground); font-variant-numeric: tabular-nums; }

/* ── Charts (SVG simples, um tom) ─────────────────────────────── */
.chart { width: 100%; height: auto; display: block; }
.chart .grade { stroke: var(--border); stroke-width: 1; }
.chart .eixo { fill: var(--muted-foreground); font-size: 12px; }
.chart .barra { fill: var(--primary); }
.chart .barra.fraca { fill: color-mix(in oklab, var(--primary) 35%, var(--background)); }
.chart .linha { stroke: var(--primary); stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.chart .area { fill: var(--primary); opacity: .1; }
.chart .ponto { fill: var(--primary); stroke: var(--card); stroke-width: 2; }
.chart .rotulo-dado { fill: var(--foreground); font-size: 12px; font-weight: 600; }
.chart [data-tip] { cursor: default; }
.tip { position: fixed; z-index: 90; pointer-events: none; padding: 6px 10px; border-radius: 8px; background: var(--foreground); color: var(--background); font-size: var(--fs-13); font-variant-numeric: tabular-nums; box-shadow: var(--shadow-2); }

/* ── Painel do protótipo (não faz parte do produto) ───────────── */
.proto-btn {
  position: fixed; z-index: 100; right: 12px; bottom: calc(var(--bottomnav-h) + 12px); height: 36px; padding: 0 12px; border-radius: 99px;
  border: 1px dashed #a1a1aa; background: #fafafa; color: #27272a; font: 600 12px/1 ui-monospace, monospace; cursor: pointer; box-shadow: var(--shadow-2);
}
@media (min-width: 640px) { .proto-btn { bottom: 12px; } }
.proto-painel {
  position: fixed; z-index: 101; right: 12px; bottom: calc(var(--bottomnav-h) + 56px); width: 280px; padding: 14px; border-radius: 14px;
  background: #fafafa; color: #18181b; border: 1px dashed #a1a1aa; box-shadow: var(--shadow-3); font: 13px/1.4 ui-monospace, monospace; display: none;
}
@media (min-width: 640px) { .proto-painel { bottom: 56px; } }
.proto-painel.aberto { display: grid; gap: 10px; }
.proto-painel label { display: grid; gap: 4px; }
.proto-painel select, .proto-painel input { font: inherit; padding: 6px; border-radius: 6px; border: 1px solid #d4d4d8; background: #fff; color: #18181b; }
.proto-painel a { color: #18181b; }
body.limpo .proto-btn, body.limpo .proto-painel, body.limpo .so-dev, body.limpo .nota-proto { display: none !important; }

/* Estado do protótipo: [data-estado] mostra só os blocos do estado atual.
   Offline mostra os blocos "normal" e os "offline" (o conteúdo em cache continua na tela). */
body[data-estado-atual="normal"] [data-estado]:not([data-estado~="normal"]),
body[data-estado-atual="vazio"] [data-estado]:not([data-estado~="vazio"]),
body[data-estado-atual="carregando"] [data-estado]:not([data-estado~="carregando"]),
body[data-estado-atual="erro"] [data-estado]:not([data-estado~="erro"]),
body[data-estado-atual="offline"] [data-estado]:not([data-estado~="normal"]):not([data-estado~="offline"]) { display: none !important; }
body[data-estado-atual="offline"] [data-requer-rede] { opacity: .45; pointer-events: none; }
[data-papel-oculto] { display: none !important; }

/* ── Peças de orçamento (Parte B do spec 2026-09-20) ──────────── */
.barra-total {
  position: fixed; z-index: 45; left: 0; right: 0; bottom: 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: var(--card); border-top: 1px solid var(--border); box-shadow: 0 -4px 16px rgb(26 21 15 / .06);
  display: flex; align-items: center; gap: 12px;
}
@media (min-width: 640px) { .barra-total { left: var(--rail-w); } }
@media (min-width: 1024px) { .barra-total { display: none; } }
[hidden] { display: none !important; }
.room { border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--card); }
.room-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; }
.room-idx { width: 30px; height: 30px; border-radius: 10px; background: var(--primary-soft); color: var(--marca-texto); display: grid; place-items: center; font-weight: 800; font-size: 13px; flex: none; }
.medidas { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-items: end; }
@media (min-width: 640px) { .medidas { grid-template-columns: 1fr 1fr 1fr; } }
.item-linha { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 10px 14px; border-top: 1px solid var(--border); }
.pag-linha { display: grid; grid-template-columns: 1fr auto; gap: 0 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.pag-linha:last-child { border-bottom: 0; }
.pag-linha .det { grid-column: 1 / -1; display: flex; justify-content: space-between; font-size: var(--fs-13); color: var(--muted-foreground); }

/* ── PDF (A4 na tela): a cor e a logo são da empresa (--empresa-cor), o resto é neutro ───────── */
.a4 { width: 100%; max-width: 794px; aspect-ratio: 210 / 297; margin: 0 auto; background: #fff; color: #191512; box-shadow: var(--shadow-3); border-radius: 4px; padding: 6%; font-size: 12.5px; overflow: hidden; }

/* ── Auth (login, convite, onboarding): formulário na areia, painel ameixa com a marca ────────── */
.auth { min-height: 100dvh; display: grid; grid-template-columns: 1fr; background: var(--background); }
.auth-form { display: flex; flex-direction: column; justify-content: center; padding: 32px 24px; width: 100%; max-width: 448px; margin: 0 auto; gap: 20px; }
.auth-form .input, .auth-form .select { min-height: 48px; }
.auth-form h1 { font-size: 30px; font-weight: 800; letter-spacing: -.02em; }
.auth-form .btn-primary.btn-lg, .auth-form .btn-primary.btn-block { min-height: 48px; }
.auth-lado { display: none; }
@media (min-width: 1024px) {
  .auth { grid-template-columns: 1fr 1fr; }
  .auth-form { padding: 56px; }
  .auth-lado {
    position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: 48px 56px;
    background: var(--marca-600); color: #fff;
  }
  .auth-lado::after {
    content: ""; position: absolute; right: -150px; bottom: -170px; width: 640px; height: 640px; opacity: .10; pointer-events: none;
    background: url("../identidade/direcao-c-encaixe/simbolo-mono.svg") center / contain no-repeat; filter: brightness(0) invert(1);
  }
  .auth-lado > * { position: relative; z-index: 1; }
  .auth-lado h1 { color: #fff; font-weight: 800; letter-spacing: -.02em; }
  .auth-lado > p, .auth-lado .stack > p { color: rgb(255 255 255 / .86); }
  .auth-lado a { color: #fff; }
  .auth-lado .orc { background: var(--card); color: var(--card-foreground); border-radius: var(--radius-card); box-shadow: var(--shadow-3); transform: rotate(-1.5deg); max-width: 440px; }
}
.ou { display: flex; align-items: center; gap: 12px; color: var(--muted-foreground); font-size: var(--fs-13); }
.ou::before, .ou::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* ── Layouts de página em colunas ─────────────────────────────── */
.duas-col { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 1024px) { .duas-col { grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; } }
@media (min-width: 1280px) { .duas-col { grid-template-columns: minmax(0, 1fr) 400px; } }
.lado-sticky { position: sticky; top: calc(var(--topbar-h) + 16px); align-self: start; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.toolbar .busca { flex: 1 1 220px; }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 0; }
.dl dt { color: var(--muted-foreground); font-size: var(--fs-13); }
.dl dd { margin: 0; }
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline li { position: relative; padding: 0 0 16px 24px; }
.timeline li::before { content: ""; position: absolute; left: 6px; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); }
.timeline li::after { content: ""; position: absolute; left: 9.5px; top: 18px; bottom: 0; width: 1px; background: var(--border); }
.timeline li:last-child::after { display: none; }
.timeline .quando { font-size: var(--fs-13); color: var(--muted-foreground); }
