/* ============================================================
   Rating 2.0 (Uélicon) — Componentes do frontend
   Construído SOBRE tokens.css (@dev-designer). Nenhum valor mágico:
   toda cor/raio/sombra/espaço referencia um token.
   Stack: Alpine.js + HTML servido pela API. Sem build Tailwind (custom
   props direto). @dev-frontend · 2026-07-06
   ============================================================ */

/* ---- Fontes self-host (woff2 variável, subset latin, swap) ---- */
@font-face {
  font-family: 'Sora'; font-style: normal; font-weight: 400 700;
  font-display: swap; src: url('/static/fonts/sora.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter'; font-style: normal; font-weight: 400 600;
  font-display: swap; src: url('/static/fonts/inter.woff2') format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono'; font-style: normal; font-weight: 400 500;
  font-display: swap; src: url('/static/fonts/jetbrainsmono.woff2') format('woff2');
}

/* ---- Reset enxuto ---- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  color: var(--text-primary);
  background: var(--surface-page);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { margin: 0; }
button { font-family: inherit; }
a { color: var(--text-link); }
:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }

.display { font-family: var(--font-display); letter-spacing: var(--tracking-tight); }
.mono, .doc-mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.num-tabular { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
[x-cloak] { display: none !important; }

.label-tag {
  font-size: var(--text-xs); font-weight: var(--weight-medium);
  text-transform: uppercase; letter-spacing: var(--tracking-wide);
  color: var(--text-secondary);
}

/* ============================================================
   Ícones Lucide (via <i data-lucide>) — dimensão padrão
   ============================================================ */
[data-lucide] { width: 18px; height: 18px; stroke-width: 2; vertical-align: middle; }
.ico-sm [data-lucide], [data-lucide].sm { width: 15px; height: 15px; }

/* ============================================================
   Botões
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid transparent; border-radius: var(--radius-md);
  font-weight: var(--weight-semibold); font-size: var(--text-base);
  padding: 0 16px; min-height: var(--tap-min); height: 40px;
  cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background var(--motion-fast) var(--ease-out),
              box-shadow var(--motion-fast) var(--ease-out),
              border-color var(--motion-fast) var(--ease-out);
}
.btn:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }
.btn:disabled { color: var(--text-disabled); background: var(--surface-subtle); cursor: not-allowed; box-shadow: none; }

.btn-primary { background: var(--brand); color: var(--text-on-brand); box-shadow: var(--shadow-sm); }
.btn-primary:hover:not(:disabled) { background: var(--brand-hover); }
.btn-primary:active { background: var(--brand-active); }

.btn-sec { background: var(--surface-card); color: var(--text-primary); border-color: var(--border-default); }
.btn-sec:hover:not(:disabled) { background: var(--surface-subtle); }

.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-subtle); color: var(--text-primary); }

.btn-danger { background: var(--surface-card); color: var(--red-700); border-color: var(--border-default); }
.btn-danger:hover:not(:disabled) { background: var(--red-50); border-color: var(--red-500); }

.btn-wa { background: var(--whatsapp); color: #fff; }
.btn-wa:hover:not(:disabled) { background: var(--whatsapp-hover); }

.btn-sm { height: 32px; min-height: 32px; padding: 0 11px; font-size: var(--text-xs); border-radius: var(--radius); }
.btn-full { width: 100%; }
.btn-icon { width: 40px; height: 40px; padding: 0; }

/* ============================================================
   Badge de estado (badge_status) + badge "Doc"
   ============================================================ */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: var(--radius-pill);
  font-size: var(--text-xs); font-weight: var(--weight-semibold); white-space: nowrap;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; flex: 0 0 auto; }
.badge--em_andamento { background: var(--status-andamento-bg); color: var(--status-andamento-fg); }
.badge--em_andamento .dot { background: var(--status-andamento-dot); }
.badge--finalizado { background: var(--status-final-bg); color: var(--status-final-fg); }
.badge--finalizado .dot { background: var(--status-final-dot); }
.badge--pendencia { background: var(--status-pendencia-bg); color: var(--status-pendencia-fg); }
.badge--pendencia .dot { background: var(--status-pendencia-dot); }

.badge-doc {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 8px; border-radius: var(--radius-pill);
  background: var(--badge-doc-bg); color: var(--badge-doc-fg);
  font-size: var(--text-xs); font-weight: var(--weight-semibold);
}
.badge-doc [data-lucide] { width: 12px; height: 12px; }

/* ---- Chip de fase (dot cor da fase + nome neutro) ---- */
.chip-fase { display: inline-flex; align-items: center; gap: 7px; font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--text-primary); }
.chip-fase .dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
/* quando a chip é um <button> (célula editável da Tabela) reseta o chrome default
   do browser — spec: dot = único elemento colorido, texto neutro, sem caixa cinza.
   Margem negativa cancela o padding → alinhamento da célula intacto. */
button.chip-fase { font-family: inherit; background: transparent; border: 0; padding: 3px 5px; margin: -3px -5px; border-radius: var(--radius-sm); cursor: pointer; text-align: left; line-height: 1.25; }
button.chip-fase:hover { background: var(--surface-subtle); }
button.chip-fase [data-lucide] { color: var(--text-tertiary); }

/* ============================================================
   Barra de progresso ("Fase X de N")
   ============================================================ */
.prog-lbl { display: flex; justify-content: space-between; align-items: baseline; font-size: var(--text-sm); margin-bottom: 6px; color: var(--text-secondary); }
.prog-lbl .pct { color: var(--accent); font-weight: var(--weight-semibold); }
.progress { height: 8px; border-radius: var(--radius-pill); background: var(--progress-track); overflow: hidden; }
.progress > i {
  display: block; height: 100%; border-radius: inherit;
  background: var(--progress-fill);
  transition: width var(--motion-slow) var(--ease-out);
}
.progress > i.is-final { background: var(--progress-fill-final); }
@media (prefers-reduced-motion: reduce) { .progress > i { transition: none !important; } }

/* ============================================================
   Inputs / selects
   ============================================================ */
label.field { display: block; margin-bottom: var(--space-4); }
label.field > .lbl { display: block; font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--text-secondary); margin-bottom: 5px; }
.input, .select, textarea.input {
  width: 100%; height: 40px; padding: 0 12px;
  border: 1px solid var(--border-default); border-radius: var(--radius);
  font-family: var(--font-sans); font-size: var(--text-md); color: var(--text-primary);
  background: var(--surface-card);
  transition: border-color var(--motion-fast) var(--ease-out), box-shadow var(--motion-fast) var(--ease-out);
}
textarea.input { height: auto; min-height: 78px; padding: 9px 12px; resize: vertical; line-height: var(--leading-snug); }
.input:focus, .select:focus, textarea.input:focus { outline: none; border-color: var(--border-focus); box-shadow: var(--shadow-focus); }
.input.mono { font-family: var(--font-mono); }
.input::placeholder { color: var(--text-tertiary); }
.field-error { display: block; margin-top: 5px; font-size: var(--text-xs); color: var(--red-700); }
.input.has-error, .select.has-error { border-color: var(--red-500); }

.search-wrap { position: relative; display: inline-flex; align-items: center; }
.search-wrap [data-lucide] { position: absolute; left: 11px; color: var(--text-tertiary); pointer-events: none; }
.search-wrap .input { padding-left: 34px; }

/* ============================================================
   Faixas de alerta inline
   ============================================================ */
.alerta { display: flex; align-items: flex-start; gap: 8px; padding: 10px 12px; border-radius: var(--radius); font-size: var(--text-sm); border-left: 3px solid; margin-bottom: var(--space-4); }
.alerta--critico { background: var(--alerta-critico-bg); border-color: var(--alerta-critico-border); color: var(--alerta-critico-fg); }
.alerta--warn { background: var(--alerta-warn-bg); border-color: var(--alerta-warn-border); color: var(--alerta-warn-fg); }
.alerta--ok { background: var(--alerta-ok-bg); border-color: var(--alerta-ok-border); color: var(--alerta-ok-fg); }

/* ============================================================
   KPI cards
   ============================================================ */
.kpis { display: grid; gap: 12px; margin-bottom: var(--space-5); }
.kpi { background: var(--surface-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); padding: 14px 16px; }
.kpi .k-lbl { display: flex; align-items: center; gap: 6px; font-size: var(--text-xs); text-transform: uppercase; letter-spacing: var(--tracking-wide); color: var(--kpi-label-fg); font-weight: var(--weight-medium); }
.kpi .k-lbl .dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.kpi .k-num { font-family: var(--font-display); font-size: var(--text-3xl); font-weight: var(--weight-bold); color: var(--kpi-fg); margin-top: 4px; line-height: 1.1; }
.kpi .k-sub { font-size: var(--text-sm); color: var(--accent); font-weight: var(--weight-semibold); margin-top: 2px; }
.kpi.money { background: var(--kpi-money-bg); border-color: transparent; }
.kpi.money .k-num { color: var(--kpi-money-fg); }
.kpi.alert { background: var(--kpi-alert-bg); border-color: transparent; }
.kpi.alert .k-num { color: var(--kpi-alert-fg); }

/* ============================================================
   Skeleton + empty state
   ============================================================ */
.sk { background: var(--surface-subtle); border-radius: var(--radius); position: relative; overflow: hidden; }
.sk::after { content: ''; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, oklch(100% 0 0 / 0.5), transparent); animation: shimmer 1.3s infinite; }
@keyframes shimmer { 100% { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) { .sk::after { animation: none; } }
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: var(--space-8) var(--space-4); text-align: center; color: var(--text-tertiary); }
.empty [data-lucide] { width: 30px; height: 30px; stroke-width: 1.5; }
.empty p { font-size: var(--text-sm); color: var(--text-secondary); max-width: 32ch; }

/* ============================================================
   Toast
   ============================================================ */
.toast-stack { position: fixed; right: var(--space-6); bottom: var(--space-6); z-index: var(--z-toast); display: flex; flex-direction: column; gap: 8px; max-width: 360px; }
.toast { display: flex; align-items: center; gap: 9px; padding: 11px 14px; border-radius: var(--radius-md); background: var(--surface-card); box-shadow: var(--shadow-lg); font-size: var(--text-sm); font-weight: var(--weight-medium); border-left: 3px solid var(--border-default); animation: toastin var(--motion-base) var(--ease-out); }
.toast--ok { border-color: var(--green-500); color: var(--green-700); }
.toast--erro { border-color: var(--red-500); color: var(--red-700); }
.toast [data-lucide] { width: 17px; height: 17px; flex: 0 0 auto; }
@keyframes toastin { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } }
@media (max-width: 640px) { .toast-stack { left: var(--space-4); right: var(--space-4); bottom: var(--space-4); max-width: none; } }

/* ============================================================
   Shell do admin (header + sidebar)
   ============================================================ */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.appbar { position: sticky; top: 0; z-index: var(--z-header); height: var(--header-height); background: var(--brand); color: var(--text-on-brand); display: flex; align-items: center; gap: 14px; padding: 0 var(--space-5); overflow: hidden; }
.appbar .brand { font-family: var(--font-display); font-weight: var(--weight-semibold); font-size: var(--text-md); white-space: nowrap; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.appbar .brand b { font-weight: var(--weight-bold); }
.appbar .spacer { flex: 1; }
.appbar .burger { display: none; background: transparent; border: 0; color: #fff; cursor: pointer; padding: 6px; border-radius: var(--radius-sm); }
.usermenu { position: relative; }
.usermenu .trigger { display: flex; align-items: center; gap: 8px; background: transparent; border: 0; color: #fff; cursor: pointer; font-size: var(--text-sm); padding: 6px 8px; border-radius: var(--radius); }
.usermenu .trigger:hover { background: oklch(100% 0 0 / 0.1); }
.usermenu .trigger .who { text-align: right; line-height: 1.15; }
.usermenu .trigger .who .p { font-size: var(--text-xs); opacity: 0.75; text-transform: capitalize; }
.usermenu .trigger .who { max-width: 34vw; overflow: hidden; }
.usermenu .trigger .who span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 400px) { .appbar { gap: 8px; padding: 0 var(--space-3); } .usermenu .trigger .who .p { display: none; } }
.usermenu .pop { position: absolute; right: 0; top: calc(100% + 6px); background: var(--surface-card); color: var(--text-primary); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); box-shadow: var(--shadow-lg); min-width: 180px; padding: 6px; }
.usermenu .pop button { width: 100%; display: flex; align-items: center; gap: 8px; background: transparent; border: 0; text-align: left; padding: 9px 10px; border-radius: var(--radius); font-size: var(--text-sm); color: var(--text-primary); cursor: pointer; }
.usermenu .pop button:hover { background: var(--surface-subtle); }

.shell-body { flex: 1; display: grid; grid-template-columns: var(--sidebar-width) 1fr; }
.sidebar { background: var(--surface-card); border-right: 1px solid var(--border-subtle); padding: 16px 10px; }
.side-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border-radius: var(--radius); font-size: var(--text-base); color: var(--text-secondary); font-weight: var(--weight-medium); margin-bottom: 4px; background: transparent; border: 0; cursor: pointer; text-align: left; }
.side-item:hover { background: var(--surface-subtle); color: var(--text-primary); }
.side-item.active { background: var(--brand-soft); color: var(--brand); box-shadow: inset 3px 0 0 var(--brand); font-weight: var(--weight-semibold); }
.side-sep { height: 1px; background: var(--border-subtle); margin: 10px 6px; }
.side-group-lbl { padding: 6px 12px 2px; }

.content { background: var(--surface-page); padding: var(--container-padding); max-width: var(--container-max); width: 100%; margin: 0 auto; }
.content h1 { font-family: var(--font-display); font-size: var(--text-2xl); color: var(--navy-700); margin-bottom: 14px; }

/* Off-canvas sidebar (mobile) */
.sidebar-scrim { display: none; }
@media (max-width: 1023px) {
  .shell-body { grid-template-columns: 1fr; }
  .appbar .burger { display: inline-flex; }
  .sidebar { position: fixed; top: var(--header-height); bottom: 0; left: 0; width: var(--sidebar-width); z-index: var(--z-drawer); transform: translateX(-100%); transition: transform var(--motion-drawer) var(--ease-standard); box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .sidebar-scrim.open { display: block; position: fixed; inset: var(--header-height) 0 0 0; background: var(--surface-scrim); z-index: var(--z-scrim); }
}
@media (prefers-reduced-motion: reduce) { .sidebar { transition: none; } }

/* ============================================================
   Abas de serviço (pills) + segmented control
   ============================================================ */
.tabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.tab { padding: 7px 16px; border-radius: var(--radius-pill); font-size: var(--text-sm); font-weight: var(--weight-semibold); background: var(--surface-card); border: 1px solid var(--border-default); color: var(--text-secondary); cursor: pointer; }
.tab:hover { background: var(--surface-subtle); }
.tab.active { background: var(--brand); color: #fff; border-color: var(--brand); }

.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar .grow { flex: 1 1 220px; }
.seg { display: inline-flex; border: 1px solid var(--border-default); border-radius: var(--radius); overflow: hidden; }
.seg button { display: inline-flex; align-items: center; gap: 6px; padding: 8px 13px; font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--text-secondary); background: var(--surface-card); border: 0; cursor: pointer; }
.seg button.on { background: var(--brand); color: #fff; }
.push-right { margin-left: auto; }

/* ============================================================
   Tabela de processos
   ============================================================ */
.tbl-wrap { background: var(--surface-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); overflow: hidden; box-shadow: var(--shadow-sm); }
table.tbl { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
table.tbl thead th { text-align: left; font-weight: var(--weight-semibold); color: var(--text-secondary); background: var(--surface-subtle); padding: 10px 14px; border-bottom: 1px solid var(--border-subtle); white-space: nowrap; font-size: var(--text-xs); text-transform: uppercase; letter-spacing: var(--tracking-wide); }
table.tbl tbody td { padding: 0 14px; height: var(--table-row-height); border-bottom: 1px solid var(--border-subtle); color: var(--text-body); vertical-align: middle; }
table.tbl tbody tr { cursor: pointer; }
table.tbl tbody tr:hover { background: var(--surface-subtle); }
table.tbl tbody tr:last-child td { border-bottom: 0; }
.td-name { font-weight: var(--weight-semibold); color: var(--text-primary); }
.td-dias.warn { color: var(--red-700); font-weight: var(--weight-semibold); }
.td-fase-cell { position: relative; }

/* dropdown de fase inline (ancorado, não modal) */
.fase-dd { position: absolute; z-index: var(--z-sticky); top: calc(100% - 4px); left: 8px; background: var(--surface-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); box-shadow: var(--shadow-lg); padding: 5px; min-width: 210px; max-height: 280px; overflow: auto; animation: ddin var(--motion-fast) var(--ease-out); }
.fase-dd button { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; background: transparent; border: 0; padding: 8px 9px; border-radius: var(--radius); font-size: var(--text-sm); color: var(--text-primary); cursor: pointer; }
.fase-dd button:hover { background: var(--surface-subtle); }
.fase-dd button.cur { font-weight: var(--weight-semibold); }
.fase-dd button .dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
@keyframes ddin { from { opacity: 0; transform: scale(0.97); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .fase-dd, .drawer, .sheet { animation: none !important; } }

/* cards mobile da lista */
.proc-cards { display: none; flex-direction: column; gap: 10px; }
.proc-card { background: var(--surface-card); border: 1px solid var(--border-subtle); border-left: 3px solid var(--border-default); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 12px 14px; cursor: pointer; }
.proc-card .cn { font-weight: var(--weight-semibold); color: var(--text-primary); }
.proc-card .meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; font-size: var(--text-xs); color: var(--text-secondary); }

@media (max-width: 767px) {
  .tbl-wrap { display: none; }
  .proc-cards { display: flex; }
}

/* ============================================================
   Kanban
   ============================================================ */
.kanban { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 10px; scroll-snap-type: x proximity; }
.kcol { flex: 0 0 var(--kanban-col-width); background: var(--surface-subtle); border-radius: var(--radius-md); padding: 10px; scroll-snap-align: start; display: flex; flex-direction: column; max-height: 72vh; }
.kcol-head { display: flex; align-items: center; gap: 8px; font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--text-primary); padding: 4px 6px 10px; position: sticky; top: 0; }
.kcol-head .dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
.kcol-head .cnt { margin-left: auto; color: var(--text-secondary); font-weight: var(--weight-semibold); }
.kcol-body { overflow-y: auto; flex: 1; min-height: 40px; display: flex; flex-direction: column; gap: 8px; padding: 2px; }
.kcard { background: var(--surface-card); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 10px 12px; border-left: 3px solid var(--border-default); cursor: grab; }
.kcard:hover { box-shadow: var(--shadow); }
.kcard .cname { font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kcard .cmeta { font-size: var(--text-xs); color: var(--text-secondary); margin-top: 5px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.kcard .cmeta .fin { color: var(--green-700); display: inline-flex; }
.kcard .cmeta .fin [data-lucide] { width: 14px; height: 14px; }
/* SortableJS states */
.sortable-ghost { opacity: 0.4; }
.sortable-drag { box-shadow: var(--shadow-drag); transform: scale(1.02); }
.kcol-body.drag-over { outline: 2px dashed var(--border-focus); outline-offset: -2px; border-radius: var(--radius); }
.kload { align-self: center; margin: 6px 0; }

@media (max-width: 767px) { .kcol { flex-basis: 85vw; scroll-snap-align: center; scroll-snap-type: x mandatory; } }

/* ============================================================
   Drawer master-detail (lateral desktop / bottom-sheet mobile)
   ============================================================ */
.scrim { position: fixed; inset: 0; background: var(--surface-scrim); z-index: var(--z-scrim); animation: fade var(--motion-drawer) var(--ease-standard); }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: var(--drawer-w); max-width: 92vw;
  background: var(--surface-drawer); box-shadow: var(--shadow-drawer);
  z-index: var(--z-drawer); display: flex; flex-direction: column;
  animation: drawerin var(--motion-drawer) var(--ease-standard);
}
@keyframes drawerin { from { transform: translateX(100%); } to { transform: none; } }
.dw-head { padding: 16px 18px; border-bottom: 1px solid var(--border-subtle); position: sticky; top: 0; background: var(--surface-drawer); z-index: 1; }
.dw-head .row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.dw-head .nm { font-family: var(--font-display); font-weight: var(--weight-semibold); font-size: var(--text-lg); color: var(--text-primary); line-height: 1.2; }
.dw-head .doc { font-family: var(--font-mono); font-size: var(--text-sm); color: var(--text-secondary); margin-top: 3px; }
.dw-close { background: transparent; border: 0; color: var(--text-tertiary); cursor: pointer; padding: 4px; border-radius: var(--radius-sm); }
.dw-close:hover { background: var(--surface-subtle); color: var(--text-primary); }
.dw-tabs { display: flex; gap: 4px; padding: 12px 18px 0; border-bottom: 1px solid var(--border-subtle); background: var(--surface-drawer); }
.dw-tabs button { padding: 8px 14px; font-size: var(--text-sm); font-weight: var(--weight-semibold); border: 0; background: transparent; color: var(--text-secondary); cursor: pointer; border-bottom: 2px solid transparent; }
.dw-tabs button.on { color: var(--brand); border-bottom-color: var(--brand); }
.dw-body { padding: 16px 18px 28px; overflow-y: auto; flex: 1; }
.dw-sec { margin-bottom: 20px; }
.dw-sec > .h { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: var(--tracking-wide); color: var(--text-secondary); font-weight: var(--weight-semibold); margin-bottom: 9px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dw-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 0; }
.autosave-hint { font-size: var(--text-xs); color: var(--text-tertiary); }
.autosave-hint.ok { color: var(--green-700); }

.anota { border-radius: var(--radius); padding: 9px 12px; margin-bottom: 7px; font-size: var(--text-sm); border-left: 3px solid; }
.anota .who { display: block; margin-top: 4px; font-size: var(--text-xs); opacity: 0.85; }
.anota--pendencia { background: var(--anota-pendencia-bg); border-color: var(--anota-pendencia-border); color: var(--anota-pendencia-fg); }
.anota--correto { background: var(--anota-correto-bg); border-color: var(--anota-correto-border); color: var(--anota-correto-fg); }

.comentario { padding: 8px 0; border-bottom: 1px solid var(--border-subtle); font-size: var(--text-sm); color: var(--text-body); }
.comentario .who { font-size: var(--text-xs); color: var(--text-tertiary); margin-top: 3px; }
.cmt-form { display: flex; gap: 8px; margin-top: 10px; align-items: flex-start; }

.anexo { display: flex; align-items: center; gap: 9px; padding: 8px 0; border-bottom: 1px solid var(--border-subtle); font-size: var(--text-sm); }
.anexo [data-lucide] { color: var(--text-tertiary); }
.anexo .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.anexo .sz { color: var(--text-tertiary); font-size: var(--text-xs); }

.tl { border-left: 2px solid var(--border-default); padding-left: 15px; margin-left: 4px; }
.tl .ev { font-size: var(--text-sm); color: var(--text-body); margin-bottom: 11px; position: relative; }
.tl .ev:last-child { margin-bottom: 0; }
.tl .ev::before { content: ''; position: absolute; left: -20px; top: 5px; width: 8px; height: 8px; border-radius: 50%; background: var(--navy-500); }
.tl .ev .when { display: block; font-size: var(--text-xs); color: var(--text-tertiary); margin-top: 2px; }

.fin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.fin-grid .full { grid-column: 1 / -1; }

/* Bottom-sheet no mobile */
@media (max-width: 767px) {
  .drawer { top: auto; left: 0; right: 0; bottom: 0; width: 100%; max-width: 100%; height: 92vh; border-radius: var(--radius-lg) var(--radius-lg) 0 0; animation: sheetin var(--motion-drawer) var(--ease-standard); }
  .drawer .grabber { width: 40px; height: 4px; border-radius: var(--radius-pill); background: var(--border-strong); margin: 8px auto 0; }
  @keyframes sheetin { from { transform: translateY(100%); } to { transform: none; } }
  .fin-grid { grid-template-columns: 1fr; }
}
.drawer .grabber { display: none; }
@media (max-width: 767px) { .drawer .grabber { display: block; } }
@media (prefers-reduced-motion: reduce) { .drawer, .scrim { animation: none !important; } }

/* Drawer usado como form (novo/editar processo) */
.dw-footer { position: sticky; bottom: 0; background: var(--surface-drawer); border-top: 1px solid var(--border-subtle); padding: 12px 18px; display: flex; gap: 10px; justify-content: flex-end; }

/* ============================================================
   Consulta pública + Vendedor (client-facing, fundo suave)
   ============================================================ */
.client-bg { min-height: 100vh; background: var(--bg-consulta); }
.consulta-page { display: flex; flex-direction: column; align-items: center; padding: 48px 20px 64px; }
.wm { text-align: center; font-family: var(--font-display); font-weight: var(--weight-bold); color: var(--navy-700); font-size: var(--text-lg); margin-bottom: 26px; letter-spacing: var(--tracking-tight); }
.card-pub { width: 100%; max-width: var(--consulta-max); background: var(--surface-card); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 28px; }
.card-pub h1 { font-family: var(--font-display); font-size: var(--text-5xl); color: var(--navy-700); line-height: 1.12; letter-spacing: var(--tracking-tight); }
.card-pub .sub { color: var(--text-secondary); margin: 10px 0 20px; font-size: var(--text-md); }
.pub-search { display: flex; gap: 8px; }
.pub-search .input { height: 48px; }
.pub-hint { font-size: var(--text-xs); color: var(--text-secondary); margin-top: 10px; }

.result { width: 100%; max-width: var(--consulta-max); margin-top: 16px; background: var(--surface-card); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); padding: 24px; animation: reveal var(--motion-slow) var(--ease-out); }
@keyframes reveal { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .result, .vcard, .result-nf { animation: none !important; } }
.result-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.result-head .who { display: flex; gap: 12px; align-items: center; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--navy-50); color: var(--navy-600); display: grid; place-items: center; flex: 0 0 auto; }
.result-head .nm { font-family: var(--font-display); font-weight: var(--weight-semibold); font-size: var(--text-md); color: var(--text-primary); }
.result-head .dm { font-family: var(--font-mono); font-size: var(--text-sm); color: var(--text-secondary); margin-top: 2px; }
.fase-block { background: var(--surface-subtle); border-left: 3px solid var(--border-default); border-radius: var(--radius); padding: 13px 15px; margin: 18px 0 16px; }
.fase-block .lbl { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: var(--tracking-wide); color: var(--text-secondary); }
.fase-block .nm { font-family: var(--font-display); font-size: var(--text-xl); color: var(--text-primary); margin: 3px 0 5px; }
.fase-block .ds { font-size: var(--text-sm); color: var(--text-body); }
.result .meta { color: var(--text-tertiary); font-size: var(--text-sm); margin-top: 14px; display: flex; align-items: center; gap: 6px; }
.result .meta [data-lucide] { width: 15px; height: 15px; }
.link-back { display: inline-flex; align-items: center; gap: 6px; margin-top: 16px; background: transparent; border: 0; color: var(--text-link); font-size: var(--text-sm); font-weight: var(--weight-medium); cursor: pointer; }
.result-nf { text-align: center; padding: 8px; animation: reveal var(--motion-slow) var(--ease-out); }
.result-nf [data-lucide] { width: 34px; height: 34px; color: var(--text-tertiary); stroke-width: 1.5; }
.result-nf p { color: var(--text-secondary); margin: 10px auto 4px; max-width: 34ch; }

@media (max-width: 640px) { .card-pub h1 { font-size: var(--text-4xl); } .card-pub, .result { padding: 20px; } .consulta-page { padding: 32px 16px 48px; } }

/* ---- Vendedor ---- */
.vend-page { max-width: 760px; margin: 0 auto; padding: 24px 20px 64px; }
.vend-hi { font-family: var(--font-display); font-size: var(--text-2xl); color: var(--navy-700); margin-bottom: 16px; letter-spacing: var(--tracking-tight); }
.vkpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 12px; }
.vkpi { background: var(--surface-card); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); padding: 12px 14px; }
.vkpi .n { font-family: var(--font-display); font-size: var(--text-3xl); font-weight: var(--weight-bold); color: var(--navy-700); line-height: 1.1; }
.vkpi .l { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: var(--tracking-wide); color: var(--text-secondary); margin-top: 2px; }
.vfases { display: flex; gap: 16px; flex-wrap: wrap; margin: 4px 0 18px; font-size: var(--text-sm); color: var(--text-body); }
.vfases span { display: inline-flex; align-items: center; gap: 6px; }
.vfases .dot { width: 9px; height: 9px; border-radius: 50%; }
.vcard { background: var(--surface-card); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); padding: 16px 18px; margin-bottom: 10px; animation: reveal var(--motion-slow) var(--ease-out); }
.vcard .top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.vcard .cn { font-family: var(--font-display); font-weight: var(--weight-semibold); font-size: var(--text-md); color: var(--text-primary); }
.vcard .sv { font-size: var(--text-sm); color: var(--text-secondary); margin-top: 2px; }
.vcard .fl { display: flex; justify-content: space-between; align-items: baseline; font-size: var(--text-sm); margin: 14px 0 6px; color: var(--text-secondary); }
.vcard .fl .r { color: var(--accent); font-weight: var(--weight-semibold); }
.vcard .meta { color: var(--text-tertiary); font-size: var(--text-sm); margin-top: 10px; display: flex; align-items: center; gap: 6px; }
.vcard .meta [data-lucide] { width: 15px; height: 15px; }

@media (max-width: 560px) { .vkpis { grid-template-columns: repeat(2, 1fr); } }

/* ---- Login ---- */
.login-page { min-height: 100vh; background: var(--bg-consulta); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; }
.login-card { width: 100%; max-width: 400px; background: var(--surface-card); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 30px; }
.login-card .brandline { text-align: center; font-family: var(--font-display); font-weight: var(--weight-semibold); color: var(--navy-700); margin-bottom: 18px; }
.login-card h1 { font-family: var(--font-display); font-size: var(--text-2xl); color: var(--navy-700); margin-bottom: 18px; }

/* KPI responsivo painel */
@media (min-width: 640px) { .kpis { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1024px) { .kpis.kpis-wide { grid-template-columns: repeat(4, 1fr); } }
