/* =====================================================================
   SupplierFlow · Design system
   Identidade Green4T: verde e azul da logo sobre grafite esverdeado.
   ===================================================================== */

:root {
  /* Marca (Green4T) */
  --brand: #39a935;
  --brand-vivo: #55dd6b;
  --pri: #2a8227;
  --pri-600: #216a1f;
  --pri-50: #eef8ee;
  --pri-100: #d6f1d7;
  --acc: #0077a3;
  --acc-50: #e5f4fa;
  --ring: rgba(57, 169, 53, .24);

  /* Superfícies e texto */
  --bg: #f4f6f5;
  --surface: #ffffff;
  --surface-2: #f9fbfa;
  --border: #e3e8e5;
  --border-strong: #d0d8d3;
  --text: #19211e;
  --text-2: #38423e;
  --muted: #66716c;
  --subtle: #96a09b;

  /* Semânticas */
  --danger: #c93a32;
  --danger-50: #fdf0ef;
  --warn: #a15c07;
  --warn-50: #fff6e8;
  --info: #3b5bdb;
  --info-50: #eef2ff;
  --ok: #1d8a4f;
  --ok-50: #eaf7ef;

  /* Menu */
  --side: #1a201e;
  --side-2: #252c29;
  --side-text: #a9b4ae;

  /* Forma */
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --sh-1: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .05);
  --sh-2: 0 10px 30px rgba(16, 24, 40, .10);
  --sh-3: 0 24px 60px rgba(16, 24, 40, .18);
  --t: .16s ease;

  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;

  /* Escala geral da interface (1 = 100%). Alturas de tela usam calc(100vh / var(--zoom)). */
  --zoom: 1;
}
@media (min-width: 861px) {
  :root { --zoom: .9; }
  html { zoom: var(--zoom); }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 13px/1.5 var(--font); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
/* Os navegadores não herdam a fonte em controles de formulário */
button, input, select, textarea, optgroup { font-family: inherit; }
a { color: var(--pri); text-decoration: none; transition: color var(--t); }
a:hover { color: var(--pri-600); }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 20px; font-weight: 700; }
h2 { font-size: 14px; font-weight: 700; }
h3 { font-size: 13.5px; font-weight: 600; }
p { margin: 0 0 8px; }
[hidden] { display: none !important; }
code { font-family: Consolas, "Courier New", monospace; font-size: 12px; background: #f0f2f5; color: var(--text-2); padding: 1px 6px; border-radius: 6px; }
svg.i { width: 17px; height: 17px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }
::selection { background: var(--pri-100); }

/* ---------- Boot / loading ---------- */
.boot { min-height: calc(100vh / var(--zoom)); display: grid; place-items: center; }
.spinner { width: 26px; height: 26px; border: 3px solid var(--border); border-top-color: var(--brand); border-radius: 50%; animation: spin .7s linear infinite; }
.spinner.sm { width: 15px; height: 15px; border-width: 2px; display: inline-block; vertical-align: middle; border-color: rgba(255,255,255,.35); border-top-color: currentColor; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { padding: 8px 0; display: grid; gap: 16px; }
.sk { background: linear-gradient(90deg, #eceef2 0%, #f6f7f9 50%, #eceef2 100%); background-size: 200% 100%; animation: shimmer 1.2s ease-in-out infinite; border-radius: var(--r-sm); }
.sk-title { height: 26px; width: 260px; }
.sk-line { height: 14px; width: 420px; max-width: 70%; }
.sk-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.sk-card { height: 84px; border-radius: var(--r); }
.sk-block { height: 280px; border-radius: var(--r); }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Layout (equipe interna) ---------- */
.layout { display: grid; grid-template-columns: 216px 1fr; min-height: calc(100vh / var(--zoom)); transition: grid-template-columns .2s ease; }
.layout.recolhido { grid-template-columns: 64px 1fr; }
.sidebar { background: var(--side); color: var(--side-text); padding: 12px 8px 10px; display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; height: calc(100vh / var(--zoom)); overflow-y: auto; overflow-x: hidden; }
.brand { display: flex; align-items: center; gap: 9px; color: #fff; font-weight: 700; font-size: 15px; padding: 4px 8px 14px; min-width: 0; }
.brand:hover { color: #fff; }
.logo { display: block; height: 24px; width: auto; max-width: 140px; object-fit: contain; object-position: left center; }
.logo-placa { display: inline-flex; flex: none; background: #fff; border-radius: 8px; padding: 5px 8px; }
.logo-placa.escura { background: var(--side); }
.logo-placa .logo { height: 20px; }
.brand-sep { width: 1px; height: 18px; background: currentColor; opacity: .22; flex: none; }
.brand-produto { font-size: 12.5px; font-weight: 600; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.brand-icone { display: none; width: 34px; height: 34px; border-radius: 10px; object-fit: contain; flex: none; }
.brand-inicial { place-items: center; background: var(--brand); color: #fff; font-size: 13px; font-weight: 700; }
.nav { display: grid; gap: 2px; }
.nav-sec { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: #6f7c76; padding: 14px 10px 5px; white-space: nowrap; }
.nav a { position: relative; display: flex; align-items: center; gap: 10px; color: var(--side-text); padding: 7px 10px; border-radius: 8px; font-size: 12.5px; font-weight: 500; white-space: nowrap; transition: background var(--t), color var(--t); }
.nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav a.active { background: rgba(85, 221, 107, .12); color: #fff; }
.nav a.active svg.i { color: var(--brand-vivo); }
.nav a.active::before { content: ""; position: absolute; left: -8px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--brand-vivo); }
.nav .count { margin-left: auto; min-width: 20px; text-align: center; background: var(--brand-vivo); color: #0b2410; font-size: 11px; font-weight: 700; border-radius: 10px; padding: 1px 6px; }
.side-bottom { margin-top: auto; display: grid; gap: 6px; padding-top: 12px; }
.nav-toggle { font: inherit; display: flex; align-items: center; gap: 12px; background: transparent; border: 0; color: #7c8883; padding: 7px 10px; border-radius: 8px; cursor: pointer; font-size: 12px; white-space: nowrap; }
.nav-toggle:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.side-user { display: flex; align-items: center; gap: 9px; padding: 8px; border-radius: 10px; background: var(--side-2); min-width: 0; }
.side-user .who { min-width: 0; flex: 1; line-height: 1.3; }
.side-user strong { color: #fff; display: block; font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user .who span { font-size: 11px; color: var(--side-text); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user .btn-icon { color: var(--side-text); }
.side-user .btn-icon:hover { background: rgba(255,255,255,.08); color: #fff; }

/* Consumo do espaço no Supabase (gestor) */
.side-uso { display: grid; gap: 7px; padding: 9px 10px 10px; border-radius: 10px; background: var(--side-2); cursor: default; }
.uso-tit { position: relative; display: flex; align-items: center; gap: 7px; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: #7c8883; white-space: nowrap; }
.uso-tit svg.i { width: 14px; height: 14px; flex: none; }
.uso-ponto { display: none; width: 8px; height: 8px; border-radius: 50%; }
.uso-item { display: grid; gap: 3px; min-width: 0; }
.uso-linha { display: flex; justify-content: space-between; gap: 6px; font-size: 11.5px; color: var(--side-text); white-space: nowrap; }
.uso-linha strong { color: #fff; font-weight: 600; }
.uso-barra { height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .09); overflow: hidden; }
.uso-barra span { display: block; height: 100%; border-radius: 4px; }
.uso-det { font-size: 10.5px; color: #7c8883; white-space: nowrap; }
.uso-barra .ok, .uso-ponto.ok { background: var(--brand-vivo); }
.uso-barra .alerta, .uso-ponto.alerta { background: #f0a53a; }
.uso-barra .critico, .uso-ponto.critico { background: #f0625a; }
@media (min-width: 861px) {
  .layout.recolhido .side-uso { padding: 9px 0; justify-items: center; }
  .layout.recolhido .uso-item, .layout.recolhido .uso-tit span { display: none; }
  .layout.recolhido .uso-ponto { display: block; position: absolute; top: -3px; right: -5px; box-shadow: 0 0 0 2px var(--side-2); }
}

/* Menu recolhido */
.layout.recolhido .nav-label, .layout.recolhido .nav .count, .layout.recolhido .nav-sec, .layout.recolhido .side-user .who, .layout.recolhido .nav-toggle span { display: none; }
.layout.recolhido .sidebar .brand { justify-content: center; padding-inline: 0; }
.layout.recolhido .sidebar .brand .logo, .layout.recolhido .sidebar .brand .logo-placa, .layout.recolhido .sidebar .brand-sep, .layout.recolhido .sidebar .brand-produto { display: none; }
.layout.recolhido .sidebar .brand-icone { display: block; }
.layout.recolhido .sidebar .brand-inicial { display: grid; }
.layout.recolhido .nav a, .layout.recolhido .nav-toggle { justify-content: center; padding-inline: 0; }
.layout.recolhido .nav-toggle svg { transform: scaleX(-1); }
.layout.recolhido .side-user { flex-direction: column; padding: 8px 4px; }
.layout.recolhido .nav a[data-rotulo]:hover::after {
  content: attr(data-rotulo); position: fixed; left: 72px; transform: translateY(-2px);
  background: #111614; color: #fff; font-size: 12.5px; font-weight: 500; padding: 6px 10px; border-radius: 8px; box-shadow: var(--sh-2); z-index: 60; pointer-events: none;
}
.layout.recolhido .nav a .count-dot { display: block; }
.count-dot { display: none; position: absolute; top: 6px; right: 14px; width: 8px; height: 8px; border-radius: 50%; background: var(--brand-vivo); box-shadow: 0 0 0 2px var(--side); }

.main { min-width: 0; }
.topbar-mobile { display: none; }
.content { padding: 20px 28px 48px; max-width: 1280px; animation: fade .22s ease-out; }
@keyframes fade { from { transform: translateY(6px); } }
.auth-form .brand { display: none; color: var(--text); padding: 0 0 28px; }
@media (max-width: 960px) { .auth-form .brand { display: flex; } }

/* ---------- Cabeçalho de página ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head > div:first-child { min-width: 0; }
.page-head p { color: var(--muted); margin: 6px 0 0; max-width: 760px; }
.eyebrow { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--pri); margin-bottom: 6px; }
.crumb { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 8px; }
.crumb:hover { color: var(--text); }
.crumb svg.i { width: 16px; height: 16px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.frase { font-size: 12.5px; font-style: italic; color: var(--subtle); margin-top: 2px; }

/* ---------- Fornecedor (layout simples) ---------- */
.shell-simple { min-height: calc(100vh / var(--zoom)); }
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); padding: 10px 28px; display: flex; align-items: center; gap: 14px; position: sticky; top: 0; z-index: 20; }
.topbar .brand { color: var(--text); padding: 0; }
.topbar .spacer { flex: 1; }
.content-narrow { max-width: 960px; margin: 0 auto; padding: 26px 20px 56px; animation: fade .22s ease-out; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--sh-1); }
.card-body { padding: 16px 18px; }
.card-head { padding: 10px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; min-height: 44px; }
.card-head h2 { display: flex; align-items: center; gap: 9px; }
.card-head h2 svg.i { color: var(--subtle); }
.card + .card, .stack > * + * { margin-top: 16px; }
.grid { display: grid; gap: 16px; }
.grid > .card + .card { margin-top: 0; }
.grid > *, .detail-grid > *, .stack > * { min-width: 0; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-stats { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }

.stat { display: flex; align-items: center; gap: 11px; padding: 12px 14px; color: var(--text); transition: border-color var(--t), box-shadow var(--t), transform var(--t); }
a.stat:hover { color: var(--text); border-color: var(--border-strong); box-shadow: var(--sh-2); transform: translateY(-1px); }
.stat .n { font-size: 19px; font-weight: 700; line-height: 1.1; letter-spacing: -.02em; }
.stat .l { color: var(--muted); font-size: 12px; font-weight: 500; }
.tile { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.tile svg.i { width: 18px; height: 18px; }
.t-amber { background: #fff4e5; color: #b36a0b; }
.t-blue { background: #eef1ff; color: #4457d6; }
.t-violet { background: #f3effe; color: #7a55e6; }
.t-green { background: #e8f6ee; color: #1d8a4f; }
.t-red { background: #fdeeee; color: #c93a32; }
.t-teal { background: #e6f5f3; color: #0f7f74; }
.t-slate { background: #f0f2f5; color: #5b6472; }
.t-rose { background: #fdeef4; color: #c2366f; }
.t-cyan { background: #e3f4fa; color: #0077a3; }

.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 350px; gap: 20px; align-items: start; }

/* ---------- Banner de situação ---------- */
.banner { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: var(--r); border: 1px solid var(--border); background: var(--surface); box-shadow: var(--sh-1); margin-bottom: 20px; }
.banner .tile { width: 38px; height: 38px; }
.banner .txt { flex: 1; min-width: 0; }
.banner .txt strong { display: block; font-size: 14px; font-weight: 700; }
.banner .txt span { color: var(--muted); font-size: 13px; }
.banner.b-amber { background: linear-gradient(90deg, #fff8ee, #fff); border-color: #f1ddbd; }
.banner.b-green { background: linear-gradient(90deg, #eef9f2, #fff); border-color: #cdebd9; }
.banner.b-red { background: linear-gradient(90deg, #fdf2f1, #fff); border-color: #f4d3d0; }
.banner.b-blue { background: linear-gradient(90deg, #f1f4ff, #fff); border-color: #d9e0fb; }

/* ---------- Key/value ---------- */
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 8px 18px; margin: 0; }
.kv dt { color: var(--muted); font-size: 12.5px; }
.kv dd { margin: 0; word-break: break-word; color: var(--text); }

/* ---------- Abas e busca ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); padding: 0 16px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { font: inherit; display: inline-flex; align-items: center; gap: 8px; background: none; border: 0; border-bottom: 2px solid transparent; padding: 10px 10px 9px; color: var(--muted); font-weight: 600; font-size: 12.5px; cursor: pointer; white-space: nowrap; transition: color var(--t), border-color var(--t); }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--brand); }
.pill { font-size: 11px; font-weight: 700; min-width: 20px; padding: 1px 7px; border-radius: 999px; background: #eef0f3; color: var(--muted); text-align: center; }
.tab.active .pill { background: var(--pri-100); color: var(--pri-600); }
.pill.red { background: #fde4e2; color: var(--danger); }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.search { position: relative; flex: 1 1 280px; max-width: 420px; }
.search svg.i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--subtle); width: 17px; height: 17px; pointer-events: none; }
.search input { padding-left: 38px !important; background: var(--surface-2) !important; }
.toolbar .spacer { flex: 1; }

/* ---------- Tabelas ---------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 11px; font-weight: 700; color: var(--subtle); text-transform: uppercase; letter-spacing: .06em; padding: 9px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; color: var(--text-2); }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.click { cursor: pointer; transition: background var(--t); }
.tbl tr.click:hover td { background: var(--surface-2); }
.tbl td strong { color: var(--text); font-weight: 600; }
.tbl .sub { color: var(--muted); font-size: 12.5px; }
.ident { display: flex; align-items: center; gap: 12px; min-width: 0; }
.ident > div { min-width: 0; }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 11.5px; font-weight: 700; flex: none; background: #eef0f3; color: var(--text-2); letter-spacing: .02em; }
.avatar.sq { border-radius: 9px; width: 36px; height: 36px; font-size: 12px; }
.avatar.sm { width: 26px; height: 26px; font-size: 10.5px; }
.pessoa { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.row-go { color: var(--subtle); transition: transform var(--t), color var(--t); }
tr.click:hover .row-go { color: var(--pri); transform: translateX(2px); }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: #eff1f4; color: #4b5360; white-space: nowrap; line-height: 1.4; }
.badge.dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge svg.i { width: 13px; height: 13px; stroke-width: 2.2; }
.tag-int svg.i { width: 11px; height: 11px; stroke-width: 2.4; }
.label svg.i, .field > label svg.i { width: 15px; height: 15px; vertical-align: -3px; }
.badge.ok { background: var(--ok-50); color: var(--ok); }
.badge.danger { background: var(--danger-50); color: var(--danger); }
.badge.warn { background: var(--warn-50); color: var(--warn); }
.badge.info { background: var(--info-50); color: var(--info); }
.badge.pri { background: var(--pri-50); color: var(--pri-600); }
.badge.acc { background: var(--acc-50); color: var(--acc); }
.badge.muted { background: #f1f3f5; color: #767e89; }

/* ---------- Botões ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 600; font-size: 12.5px; line-height: 1; height: 34px; border-radius: 8px; padding: 0 13px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); cursor: pointer; white-space: nowrap; transition: background var(--t), border-color var(--t), color var(--t), box-shadow var(--t), transform .08s; }
.btn svg.i { width: 16px; height: 16px; }
.btn:hover { background: var(--surface-2); border-color: #c3c8d0; color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-pri { background: var(--pri); border-color: var(--pri); color: #fff; box-shadow: 0 1px 2px rgba(42, 130, 39, .25); }
.btn-pri:hover { background: var(--pri-600); border-color: var(--pri-600); color: #fff; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #ad2f28; border-color: #ad2f28; color: #fff; }
.btn-danger-ghost { border-color: transparent; background: #fdecea; color: var(--danger); }
.btn-danger-ghost:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-warn { background: #fff; border-color: #eac48a; color: var(--warn); }
.btn-warn:hover { background: var(--warn-50); border-color: #dcae68; color: var(--warn); }
.btn-soft { background: var(--pri-50); border-color: transparent; color: var(--pri-600); }
.btn-soft:hover { background: var(--pri-100); border-color: transparent; color: var(--pri-600); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: #eff1f4; border-color: transparent; }
.btn-sm { height: 30px; padding: 0 11px; font-size: 12px; border-radius: 8px; }
.btn-sm svg.i { width: 15px; height: 15px; }
.btn-lg { height: 38px; padding: 0 18px; font-size: 13.5px; }
.btn-block { width: 100%; }
.btn-icon { width: 34px; height: 34px; padding: 0; border: 0; background: transparent; border-radius: 10px; display: inline-grid; place-items: center; color: var(--muted); cursor: pointer; transition: background var(--t), color var(--t); }
.btn-icon:hover { background: #eff1f4; color: var(--text); }
.btn-icon.sm { width: 28px; height: 28px; border-radius: 8px; }

/* ---------- Formulários ---------- */
.form { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; align-content: start; }
.field > label, .label { font-weight: 600; font-size: 12.5px; color: var(--text-2); }
.field .hint, .hint { color: var(--muted); font-size: 12px; line-height: 1.45; }
.req::after { content: " *"; color: var(--danger); }
input:not([type]), input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=url], input[type=tel], input[type=search], select, textarea {
  font: inherit; width: 100%; height: 35px; padding: 0 11px; border: 1px solid var(--border-strong); border-radius: 8px; background: #fff; color: var(--text);
  transition: border-color var(--t), box-shadow var(--t), background var(--t);
}
textarea { resize: vertical; min-height: 84px; height: auto; padding: 9px 11px; }
select { appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239aa1ac' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; }
input[type=file] { font: inherit; font-size: 13px; color: var(--muted); max-width: 100%; }
input[type=file]::file-selector-button { font: inherit; font-weight: 600; font-size: 12.5px; border: 1px solid var(--border-strong); background: #fff; color: var(--text); border-radius: 8px; padding: 7px 12px; margin-right: 10px; cursor: pointer; }
input::placeholder, textarea::placeholder { color: #a9afb8; }
input:hover, select:hover, textarea:hover { border-color: #bfc5cd; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }
input:disabled, select:disabled, textarea:disabled { background: #f3f4f6; color: var(--muted); cursor: not-allowed; }
.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; color: var(--text-2); }
.check input { width: 17px; height: 17px; margin: 2px 0 0; accent-color: var(--pri); flex: none; cursor: pointer; }
.checks { display: grid; gap: 8px; }
.checks.cols { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.row { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; }
.row > .field { flex: 1 1 180px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; padding-top: 6px; }
.form-sec { display: grid; gap: 14px; padding-bottom: 20px; border-bottom: 1px dashed var(--border); }
.form-sec:last-of-type { border-bottom: 0; padding-bottom: 0; }
.form-sec-title { display: flex; align-items: center; gap: 10px; font-size: 13.5px; font-weight: 700; }
.form-sec-title .num { width: 24px; height: 24px; border-radius: 50%; background: var(--pri-50); color: var(--pri-600); font-size: 12px; font-weight: 700; display: grid; place-items: center; }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 10px; overflow: hidden; background: #fff; padding: 3px; gap: 3px; }
.seg label { padding: 5px 12px; cursor: pointer; font-weight: 600; font-size: 12.5px; border-radius: 7px; color: var(--muted); transition: background var(--t), color var(--t); }
.seg input { display: none; }
.seg label:has(input:checked) { background: var(--side); color: #fff; }
.opcao { display: flex; align-items: center; gap: 10px; border: 1px solid var(--border-strong); border-radius: 9px; padding: 9px 12px; cursor: pointer; font-weight: 600; transition: border-color var(--t), background var(--t); }
.opcao:hover { border-color: #bfc5cd; }
.opcao:has(input:checked) { border-color: var(--brand); background: var(--pri-50); }

/* ---------- Alertas (ícone automático) ---------- */
.alert { position: relative; border-radius: var(--r); padding: 11px 14px 11px 42px; border: 1px solid; font-size: 13px; line-height: 1.5; }
.alert::before { content: ""; position: absolute; left: 14px; top: 11px; width: 18px; height: 18px; background: currentColor; -webkit-mask: var(--ico) no-repeat center / contain; mask: var(--ico) no-repeat center / contain; }
.alert > strong { display: block; margin-bottom: 2px; font-weight: 700; }
.alert ul { margin: 6px 0 0; padding-left: 18px; }
.alert-info { background: var(--info-50); border-color: #d9e0fb; color: #2a3f99; --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 16v-4M12 8h.01'/%3E%3C/svg%3E"); }
.alert-warn { background: var(--warn-50); border-color: #f3ddb6; color: #7a4506; --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10.3 3.9 1.8 18a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0z'/%3E%3Cpath d='M12 9v4M12 17h.01'/%3E%3C/svg%3E"); }
.alert-danger { background: var(--danger-50); border-color: #f4d3d0; color: #8f241e; --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='m15 9-6 6M9 9l6 6'/%3E%3C/svg%3E"); }
.alert-ok { background: var(--ok-50); border-color: #cdebd9; color: #176b3e; --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='m8 12 3 3 5-6'/%3E%3C/svg%3E"); }
.pre { white-space: pre-line; }

/* ---------- Chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font: inherit; font-size: 12.5px; font-weight: 500; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); border-radius: 999px; padding: 4px 12px; cursor: pointer; transition: all var(--t); }
.chip:hover { border-color: var(--brand); color: var(--pri-600); background: var(--pri-50); }
.chip svg.i { width: 13px; height: 13px; vertical-align: -2px; margin-right: 3px; }

/* ---------- Busca de categorias e CNPJ (convite) ---------- */
.combo { position: relative; }
.combo-caixa { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 35px; padding: 4px 6px; border: 1px solid var(--border-strong); border-radius: 8px; background: #fff; cursor: text; transition: border-color var(--t), box-shadow var(--t); }
.combo-caixa:hover { border-color: #bfc5cd; }
.combo-caixa:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }
.combo-itens { display: contents; }
.combo-caixa input[type=text] { flex: 1 1 180px; min-width: 140px; height: 25px; padding: 0 4px; border: 0; box-shadow: none; background: transparent; }
.combo-item { display: inline-flex; align-items: center; gap: 2px; max-width: 100%; background: var(--pri-50); color: var(--pri-600); border-radius: 6px; padding: 2px 3px 2px 8px; font-size: 12px; font-weight: 600; line-height: 1.4; }
.combo-item button { display: grid; place-items: center; border: 0; background: transparent; color: inherit; cursor: pointer; padding: 2px; border-radius: 4px; }
.combo-item button:hover { background: var(--pri-100); }
.combo-item svg.i { width: 12px; height: 12px; stroke-width: 2.4; }
.combo-lista { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30; margin: 0; padding: 4px; list-style: none; background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--sh-2); max-height: 280px; overflow-y: auto; }
.combo-lista li { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 7px 10px; border-radius: 7px; cursor: pointer; color: var(--text); }
.combo-lista li.ativo { background: var(--pri-50); }
.combo-lista li small { color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.combo-lista li.vazio { color: var(--muted); cursor: default; }
.combo-lista li.grupo { display: block; padding: 9px 10px 4px; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--subtle); cursor: default; border-top: 1px solid var(--border); margin-top: 4px; }
.combo-lista li.grupo:first-child { border-top: 0; margin-top: 0; }
.combo-lista li.bloqueada { color: var(--muted); }
.tag-nova { display: inline-block; margin-left: 6px; padding: 0 5px; border-radius: 4px; background: var(--acc-50); color: var(--acc); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; vertical-align: 1px; }
.sugestao-cat { display: grid; gap: 6px; margin-top: 4px; }
.sugestao-cat .small svg.i { width: 14px; height: 14px; vertical-align: -3px; margin-right: 4px; color: var(--pri); }
.cnpj-resumo { display: flex; align-items: center; gap: 12px; margin-top: 8px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.cnpj-resumo .txt { flex: 1; min-width: 0; }
.cnpj-resumo .sub { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.cnpj-resumo .spinner.sm { border-color: var(--border); border-top-color: var(--pri); }

/* ---------- Rota de aprovação ---------- */
.rota { display: grid; gap: 0; }
.rota-etapa { position: relative; padding: 0 0 18px 34px; }
.rota-etapa::before { content: ""; position: absolute; left: 11px; top: 26px; bottom: 0; width: 2px; background: var(--border); }
.rota-etapa:last-child { padding-bottom: 0; }
.rota-etapa:last-child::before { display: none; }
.rota-etapa-head { display: flex; gap: 8px; align-items: center; font-size: 11px; font-weight: 700; color: var(--subtle); text-transform: uppercase; letter-spacing: .07em; min-height: 24px; margin-bottom: 8px; }
.rota-etapa-head::before { content: ""; position: absolute; left: 4px; top: 4px; width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 2px solid var(--border-strong); }
.rota-etapa.atual .rota-etapa-head { color: var(--pri-600); }
.rota-etapa.atual .rota-etapa-head::before { border-color: var(--brand); box-shadow: 0 0 0 4px var(--ring); background: var(--brand); }
.rota-etapa.feita .rota-etapa-head::before { border-color: var(--ok); background: var(--ok); }
.rota-area { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 11px 13px; }
.rota-area + .rota-area { margin-top: 8px; }
.rota-area .top { display: flex; justify-content: space-between; gap: 8px; align-items: center; flex-wrap: wrap; }
.rota-area .top strong { font-weight: 600; }
.motivos { margin: 6px 0 0; padding-left: 18px; color: var(--muted); font-size: 12.5px; }
.flow { display: flex; align-items: stretch; gap: 10px; flex-wrap: wrap; }
.flow-step { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; min-width: 170px; }
.flow-step .n { font-size: 10.5px; color: var(--pri); text-transform: uppercase; letter-spacing: .08em; font-weight: 700; margin-bottom: 4px; }
.flow-arrow { align-self: center; color: var(--subtle); display: grid; }

/* ---------- Fluxo de aprovação (configuração) ---------- */
.fluxo { list-style: none; margin: 0; padding: 0; display: grid; }
.fluxo-etapa { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 12px; position: relative; padding-bottom: 14px; }
.fluxo-etapa::before { content: ""; position: absolute; left: 14px; top: 30px; bottom: 0; width: 2px; background: var(--border); }
.fluxo-etapa.fim { padding-bottom: 0; }
.fluxo-etapa.fim::before { display: none; }
.fluxo-num { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--pri-50); color: var(--pri-600); font-weight: 700; font-size: 13px; border: 2px solid var(--pri-100); position: relative; }
.fluxo-etapa.fim .fluxo-num { background: var(--ok-50); color: var(--ok); border-color: #cdebd9; }
.fluxo-num svg.i { width: 15px; height: 15px; stroke-width: 2.4; }
.fluxo-corpo { display: grid; gap: 8px; min-width: 0; }
.fluxo-cab { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 30px; font-size: 11px; font-weight: 700; color: var(--subtle); text-transform: uppercase; letter-spacing: .07em; }
.fluxo-setas { display: inline-flex; gap: 2px; }
.fluxo-setas .btn-icon[disabled] { opacity: .35; cursor: default; background: transparent; }
.fluxo-item { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.fluxo-info { min-width: 0; flex: 1 1 320px; display: grid; gap: 6px; }
.fluxo-titulo { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fluxo-titulo strong { font-weight: 600; font-size: 13.5px; }
.fluxo-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--muted); font-size: 12.5px; }
.fluxo-meta > span { display: inline-flex; align-items: center; gap: 6px; }
.fluxo-meta svg.i { width: 14px; height: 14px; color: var(--subtle); }
.fluxo-pessoas { display: inline-flex; flex-wrap: wrap; gap: 4px 10px; }
.fluxo-acoes { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fluxo-mover select { height: 30px; font-size: 12px; padding-block: 0; max-width: 270px; }
.escolha-pessoas { max-height: 240px; overflow: auto; border: 1px solid var(--border); border-radius: 8px; padding: 10px; }
.kv.papeis { grid-template-columns: 150px 1fr; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Indicadores ---------- */
.banner .txt span strong { display: inline; font-size: inherit; font-weight: 600; color: var(--text); }
.stat .d { color: var(--subtle); font-size: 11.5px; margin-top: 2px; line-height: 1.35; }
.barras { display: grid; gap: 12px; }
.barras-linha { display: grid; grid-template-columns: minmax(130px, 40%) minmax(0, 1fr); gap: 12px; align-items: center; }
.barras-rotulo { display: grid; line-height: 1.3; min-width: 0; }
.barras-rotulo strong { font-weight: 600; color: var(--text); font-size: 12.5px; }
.barras-rotulo span { color: var(--muted); font-size: 11.5px; }
.barra { display: flex; align-items: center; gap: 8px; width: 100%; min-width: 0; min-height: 22px; border-left: 1px solid var(--border-strong); }
.barra-valor { flex: none; height: 12px; background: var(--acc); border-radius: 0 4px 4px 0; }
.barra-num { flex: none; font-size: 12.5px; font-weight: 600; color: var(--text-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.ind-resumo { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.ind-resumo .l { color: var(--muted); font-size: 12px; }
.ind-resumo .n { font-size: 18px; font-weight: 700; letter-spacing: -.02em; }
.ind-gargalo { display: flex; gap: 8px; align-items: flex-start; margin: 14px 0 0; padding-top: 12px; border-top: 1px solid var(--border); color: var(--text-2); }
.ind-gargalo svg.i { color: var(--warn); width: 16px; height: 16px; margin-top: 1px; }
@media (max-width: 860px) {
  .ind-resumo { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kv.papeis { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .barras-linha { grid-template-columns: 1fr; gap: 4px; }
}

/* ---------- Linha do tempo ---------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 16px 22px; color: var(--text-2); }
.timeline li::before { content: ""; position: absolute; left: 3px; top: 7px; width: 9px; height: 9px; border-radius: 50%; background: #fff; border: 2px solid var(--brand); }
.timeline li::after { content: ""; position: absolute; left: 7.5px; top: 20px; bottom: 2px; width: 1px; background: var(--border); }
.timeline li:last-child { padding-bottom: 0; }
.timeline li:last-child::after { display: none; }
.timeline .when { color: var(--subtle); font-size: 12px; margin-top: 1px; }

/* ---------- Stepper (fornecedor) ---------- */
.stepper { display: flex; gap: 0; margin-bottom: 22px; overflow-x: auto; padding: 4px 2px; scrollbar-width: none; }
.stepper::-webkit-scrollbar { display: none; }
.stepper button { font: inherit; flex: 1 1 0; min-width: 120px; display: flex; flex-direction: column; align-items: center; gap: 8px; border: 0; background: none; cursor: pointer; color: var(--muted); font-weight: 600; font-size: 12px; position: relative; padding: 0 6px; }
.stepper button::after { content: ""; position: absolute; top: 13px; left: calc(50% + 19px); right: calc(-50% + 19px); height: 2px; background: var(--border); border-radius: 2px; }
.stepper button:last-child::after { display: none; }
.stepper button.done::after { background: #bfe3cd; }
.stepper .num { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: #fff; border: 2px solid var(--border-strong); font-size: 12px; font-weight: 700; color: var(--muted); transition: all var(--t); }
.stepper button:hover .num { border-color: var(--brand); }
.stepper button.done { color: var(--text-2); }
.stepper button.done .num { background: var(--ok-50); border-color: #9fd6b4; color: var(--ok); }
.stepper button.active { color: var(--text); }
.stepper button.active .num { background: var(--side); border-color: var(--side); color: #fff; box-shadow: 0 0 0 5px rgba(57, 169, 53, .2); }

.doc-item { display: grid; grid-template-columns: 1fr; gap: 10px; padding: 14px 0; border-top: 1px solid var(--border); }
.doc-item:first-child { border-top: 0; padding-top: 0; }
.doc-upload { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-top: 10px; padding: 12px; background: var(--surface-2); border: 1px dashed var(--border-strong); border-radius: 10px; }
.doc-upload .field { min-width: 170px; }

/* Modelos de documento para preencher e assinar */
.modelo-assinar { margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: var(--pri-50, #eef7ee); border: 1px solid var(--pri-100, #d6ecd5); display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.modelo-assinar ol { margin: 0; padding-left: 18px; font-size: 12.5px; color: var(--text-2); display: grid; gap: 2px; flex: 1 1 320px; }
.modelo-bloco { padding-top: 14px; border-top: 1px dashed var(--border); }
.modelo-arquivo { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; margin-top: 4px; }
.modelo-nome { display: inline-flex; align-items: center; gap: 8px; min-width: 0; overflow-wrap: anywhere; }
.modelo-arquivo .actions, .modelo-topo .actions { display: flex; gap: 6px; flex-wrap: wrap; }
.modelo-topo { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin: 12px 0 8px; }
.modelo-campos { border: 1px solid var(--border); border-radius: 8px; max-height: 340px; overflow: auto; }
.modelo-campos td:last-child { width: 55%; }
.doc-status { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- Construtor de regras ---------- */
.cond { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; }
.cond + .cond { margin-top: 6px; }
.cond-join { font-size: 11px; font-weight: 700; color: var(--pri-600); padding: 4px 12px; letter-spacing: .06em; }

/* ---------- Configurações (hub) ---------- */
.cfg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.cfg-card { display: flex; gap: 12px; padding: 14px 16px; color: var(--text); transition: border-color var(--t), box-shadow var(--t), transform var(--t); }
.cfg-card:hover { color: var(--text); border-color: var(--border-strong); box-shadow: var(--sh-2); transform: translateY(-2px); }
.cfg-card .tile { width: 40px; height: 40px; border-radius: 12px; }
.cfg-card .tile svg.i { width: 21px; height: 21px; }
.cfg-card h3 { font-size: 14px; font-weight: 700; margin-bottom: 4px; }
.cfg-card p { color: var(--muted); font-size: 12.5px; margin: 0; line-height: 1.45; }
.cfg-card .meta { margin-top: 10px; font-size: 12px; font-weight: 600; color: var(--subtle); }

/* ---------- Identidade visual ---------- */
.marca-slot { overflow: hidden; display: flex; flex-direction: column; }
.marca-previa { height: 116px; display: grid; place-items: center; padding: 20px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.marca-previa.p-claro { background: repeating-conic-gradient(#f1f4f2 0 25%, #fff 0 50%) 0 0 / 16px 16px; }
.marca-previa.p-escuro { background: var(--side); border-bottom-color: var(--side); }
.marca-previa .logo { height: 44px; max-width: 100%; object-position: center; }
.marca-previa .logo-placa .logo { height: 32px; }
.marca-previa .brand-icone { display: block; width: 64px; height: 64px; border-radius: 16px; }
.marca-previa .brand-inicial { display: grid; font-size: 22px; }
.marca-slot .card-body { flex: 1; display: grid; gap: 6px; align-content: start; }
.marca-slot-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.marca-slot .actions { margin-top: 8px; }
.marca-exemplos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.marca-exemplos figure { margin: 0; display: grid; gap: 8px; }
.marca-exemplos figcaption { font-size: 12.5px; font-weight: 600; color: var(--muted); text-align: center; }
.ex { height: 150px; border-radius: 10px; border: 1px solid var(--border); overflow: hidden; background: var(--bg); padding: 12px; }
.ex i, .ex b { display: block; height: 6px; border-radius: 3px; background: #e6ebe8; }
.ex i:nth-child(odd) { width: 80%; }
.ex b { width: 90px; height: 16px; border-radius: 5px; background: var(--pri); margin-top: 4px; }
.ex-menu { background: var(--side); border-color: var(--side); padding: 14px 12px; display: grid; align-content: start; gap: 10px; }
.ex-menu .brand { padding: 0 0 6px; }
.ex-menu i { height: 8px; background: rgba(255, 255, 255, .09); }
.ex-folha { background: #fff; border-radius: 6px; height: 100%; box-shadow: var(--sh-1); overflow: hidden; }
.ex-topo { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px 8px; }
.ex-topo img { height: 20px; width: auto; max-width: 60%; object-fit: contain; }
.ex-topo span { font-size: 9px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ex-topo-email { border-bottom: 3px solid var(--brand); }
.ex-topo-pdf { border-bottom: 1px solid var(--brand); margin: 0 8px; padding-inline: 4px; }
.ex-linhas { padding: 10px 12px; display: grid; gap: 7px; }
.ex-linhas strong { font-size: 10px; }

/* ---------- Modal ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(17, 19, 23, .45); backdrop-filter: blur(3px); display: grid; place-items: start center; padding: 7vh 16px; overflow-y: auto; z-index: 50; animation: fadein .15s ease-out; }
.modal { background: #fff; border-radius: var(--r-lg); width: 100%; max-width: 580px; box-shadow: var(--sh-3); animation: pop .18s ease-out; }
.modal.lg { max-width: 880px; }
.modal-head { padding: 18px 22px 6px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.modal-head h2 { font-size: 16px; }
.modal-body { padding: 10px 22px 20px; }
.modal-foot { padding: 12px 22px; border-top: 1px solid var(--border); background: var(--surface-2); display: flex; justify-content: flex-end; gap: 10px; border-radius: 0 0 var(--r-lg) var(--r-lg); }
@keyframes fadein { from { background: rgba(17, 19, 23, 0); } }
@keyframes pop { from { transform: translateY(8px) scale(.98); } }

/* ---------- Toasts ---------- */
#toasts { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 10px; z-index: 100; max-width: min(420px, calc(100vw - 40px)); }
.toast { position: relative; background: #1a201e; color: #fff; padding: 13px 16px 13px 46px; border-radius: 12px; box-shadow: var(--sh-3); font-size: 13px; line-height: 1.45; animation: up .22s ease-out; }
.toast::before { content: ""; position: absolute; left: 14px; top: 12px; width: 20px; height: 20px; border-radius: 50%; background: var(--brand) var(--ico-t) no-repeat center / 12px; }
.toast.ok::before { background-color: #28a862; --ico-t: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E"); }
.toast.erro::before { background-color: #e5484d; --ico-t: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round'%3E%3Cpath d='M12 7v6M12 17h.01'/%3E%3C/svg%3E"); }
.toast:not(.ok):not(.erro)::before { --ico-t: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round'%3E%3Cpath d='M12 11v6M12 7h.01'/%3E%3C/svg%3E"); }
.toast.saindo { animation: out .2s ease-in forwards; }
@keyframes up { from { transform: translateY(10px); opacity: 0; } }
@keyframes out { to { transform: translateY(6px); opacity: 0; } }

/* ---------- Tooltip ---------- */
[data-tip] { position: relative; }
[data-tip]:hover::after, [data-tip]:focus-visible::after {
  content: attr(data-tip); position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  background: #111614; color: #fff; font-size: 12px; font-weight: 500; line-height: 1.35; padding: 6px 9px; border-radius: 7px; white-space: nowrap; box-shadow: var(--sh-2); z-index: 70; pointer-events: none;
}

/* ---------- Entrada (login) ---------- */
.auth { min-height: calc(100vh / var(--zoom)); display: grid; place-items: center; padding: 32px 16px; background: radial-gradient(1200px 600px at 10% -10%, #1f3b28 0%, transparent 60%), linear-gradient(160deg, #0f1412 0%, #212725 100%); }
.auth .card { width: 100%; max-width: 400px; border: 0; box-shadow: var(--sh-3); border-radius: 20px; }
.auth .card-body { padding: 24px; }
.auth .brand { color: var(--text); padding: 0 0 22px; }
.auth h1 { font-size: 20px; }
.auth-split { display: grid; grid-template-columns: 1.1fr 1fr; min-height: calc(100vh / var(--zoom)); background: var(--surface); }
.auth-aside { position: relative; overflow: hidden; background: radial-gradient(900px 500px at 0% 0%, #1f3d29 0%, transparent 60%), linear-gradient(160deg, #0f1412 0%, #212725 100%); color: #fff; padding: 32px 40px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-aside .brand { padding: 0; font-size: 18px; }
.auth-aside .logo { height: 30px; max-width: 190px; }
.auth-aside .brand-produto { font-size: 14px; }
.auth-aside h2 { font-size: clamp(20px, 2vw, 26px); line-height: 1.15; font-weight: 700; letter-spacing: -.02em; max-width: 460px; }
.auth-aside h2 em { font-style: normal; color: var(--brand-vivo); }
.auth-aside p { color: #b7c2bc; font-size: 13.5px; max-width: 440px; margin-top: 14px; }
.beneficios { list-style: none; padding: 0; margin: 24px 0 0; display: grid; gap: 12px; }
.beneficios li { display: flex; gap: 12px; align-items: center; color: #dfe6e2; font-size: 13px; }
.beneficios .tile { width: 36px; height: 36px; border-radius: 10px; background: rgba(85,221,107,.12); color: var(--brand-vivo); }
.beneficios .tile svg.i { width: 18px; height: 18px; }
.auth-aside .deco { position: absolute; right: -90px; bottom: -70px; width: 380px; opacity: .05; pointer-events: none; z-index: 0; }
.auth-aside .deco svg { width: 100%; height: auto; display: block; }
.auth-aside > :not(.deco) { position: relative; z-index: 1; }
.auth-aside small { color: #7c8883; font-size: 12px; }
.auth-main { display: grid; place-items: center; padding: 32px 24px; }
.auth-form { width: 100%; max-width: 340px; }
.auth-form h1 { font-size: 21px; margin-bottom: 6px; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--subtle); font-size: 12px; margin: 18px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* ---------- Estados vazios / sucesso ---------- */
.empty { padding: 36px 24px; text-align: center; color: var(--muted); display: grid; justify-items: center; gap: 6px; }
.empty .tile { width: 50px; height: 50px; border-radius: 16px; margin-bottom: 8px; }
.empty .tile svg.i { width: 26px; height: 26px; }
.empty h3 { color: var(--text); font-size: 14px; font-weight: 700; }
.empty p { margin: 0; max-width: 420px; }
.empty .btn { margin-top: 12px; }
.sucesso { text-align: center; padding: 12px 8px; display: grid; justify-items: center; gap: 8px; }
.sucesso .tile { width: 64px; height: 64px; border-radius: 50%; margin-bottom: 6px; animation: pop .3s ease-out; }
.sucesso .tile svg.i { width: 30px; height: 30px; stroke-width: 2.4; }

/* ---------- Utilidades ---------- */
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mt { margin-top: 16px; }
.mb { margin-bottom: 16px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.tag-int { display: inline-flex; align-items: center; gap: 4px; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--warn); background: var(--warn-50); border-radius: 6px; padding: 1px 7px; vertical-align: middle; }
details.box { border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; background: var(--surface-2); }
details.box summary { cursor: pointer; font-weight: 600; color: var(--text-2); }
.link-box { display: flex; gap: 8px; }
.link-box input { font-family: Consolas, monospace; font-size: 12px; background: var(--surface-2); }
.lista-docs { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.lista-docs li { display: flex; justify-content: space-between; gap: 10px; align-items: center; font-size: 13px; color: var(--text-2); }

/* Convite: o que será pedido ao fornecedor */
.painel-pedido { align-self: start; position: sticky; top: calc(16px + env(safe-area-inset-top, 0px)); }
@media (max-width: 1180px) { .painel-pedido { position: static; } }
.pedido-sec + .pedido-sec { margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--border); }
.pedido-titulo { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 12.5px; color: var(--text); margin-bottom: 10px; }
.painel-pedido .lista-docs li > span:first-child { display: grid; gap: 1px; }
.painel-pedido .lista-docs .sub { color: var(--muted); font-size: 11.5px; line-height: 1.35; }
.painel-pedido .lista-docs .badge { flex-shrink: 0; }

/* Exclusão definitiva de processos */
.tbl .col-sel { width: 36px; padding-right: 0; }
.tbl .col-sel input { cursor: pointer; }
.apagar-lista { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 6px; max-height: 200px; overflow: auto; }
.apagar-lista li { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }

/* Áreas de aprovação no cadastro do usuário */
.areas-usuario { list-style: none; margin: 0 0 10px; padding: 4px 0; border: 1px solid var(--border); border-radius: 8px; max-height: 260px; overflow: auto; }
.areas-usuario li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 3px 6px 3px 10px; min-height: 36px; }
.areas-usuario li + li { border-top: 1px solid var(--border); }
.areas-usuario li .check { align-items: center; flex: 1; }
.areas-usuario li > input { flex: 1; }
.areas-usuario .actions { display: flex; gap: 4px; flex-shrink: 0; }
.areas-nova { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.areas-nova input { flex: 1; }

/* ---------- Responsivo ---------- */
@media (max-width: 1180px) {
  .detail-grid { grid-template-columns: 1fr; }
  .content { padding: 20px 24px 48px; }
}
@media (max-width: 960px) {
  .auth-split { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
}
@media (max-width: 860px) {
  .layout, .layout.recolhido { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 272px; z-index: 40; transform: translateX(-100%); transition: transform .22s ease; }
  .layout.recolhido .nav-label, .layout.recolhido .nav .count, .layout.recolhido .nav-sec, .layout.recolhido .side-user .who, .layout.recolhido .sidebar .brand-sep, .layout.recolhido .sidebar .brand-produto { display: initial; }
  .layout.recolhido .sidebar .brand { justify-content: flex-start; padding-inline: 8px; }
  .layout.recolhido .sidebar .brand .logo { display: block; }
  .layout.recolhido .sidebar .brand .logo-placa { display: inline-flex; }
  .layout.recolhido .sidebar .brand-icone { display: none; }
  .layout.menu-aberto .sidebar { transform: none; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .4); }
  .nav-toggle { display: none; }
  .topbar-mobile { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--side); color: #fff; font-weight: 700; position: sticky; top: 0; z-index: 30; }
  .topbar-mobile .brand { padding: 0; font-size: 14px; }
  .topbar-mobile .logo { height: 22px; }
  .topbar-mobile button { background: transparent; border: 0; color: #fff; cursor: pointer; padding: 6px; border-radius: 8px; display: grid; }
  .content { padding: 18px 16px 40px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dd { margin-bottom: 10px; }
  .cond { grid-template-columns: 1fr; }
  .marca-exemplos { grid-template-columns: 1fr; }
  .page-head { align-items: flex-start; }
  h1 { font-size: 19px; }
  .topbar { padding: 10px 16px; }
  .topbar .muted { display: none; }
  .banner { flex-wrap: wrap; }
}
.cfg-grid > .card + .card { margin-top: 0; }
.banner .txt { flex: 1 1 240px; }
.grid-stats { grid-template-columns: repeat(5, minmax(0, 1fr)); }

@media (max-width: 1280px) {
  .tbl .col-opc { display: none; }
}
@media (max-width: 1199px) and (min-width: 521px) {
  .stat { flex-direction: column; align-items: flex-start; gap: 10px; padding: 14px 16px; }
  .stat .tile { width: 38px; height: 38px; border-radius: 10px; }
}
/* Em uma coluna, a decisão do aprovador sobe para o topo e a rota/histórico vão para o fim */
@media (max-width: 1180px) {
  .detail-grid > .stack { display: contents; }
  .detail-grid > .stack > * { margin-top: 0 !important; }
  .detail-grid .ordem-topo { order: -1; }
  .detail-grid .ordem-fim { order: 1; }
}
@media (max-width: 520px) {
  .grid-stats > :last-child:nth-child(odd) { grid-column: span 2; }
}

@media (max-width: 520px) {
  .grid-4 { grid-template-columns: 1fr; }
  .grid-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { flex-direction: column; align-items: flex-start; gap: 10px; padding: 14px; }
  .stat .tile { width: 36px; height: 36px; border-radius: 10px; }
  .stat .n { font-size: 22px; }
  .banner .btn { width: 100%; }
  .cfg-card { padding: 16px; }
  .card-body { padding: 16px; }
  .card-head { padding: 14px 16px; }
  .modal-head, .modal-body, .modal-foot { padding-inline: 16px; }
  .auth .card-body { padding: 24px; }
  .page-head .actions, .page-head .actions .btn { width: 100%; }
}

/* ---------- Escala por tamanho de tela ---------- */
@media (min-width: 1600px) {
  body { font-size: 13.5px; }
  .content { max-width: 1440px; padding: 24px 36px 56px; }
  h1 { font-size: 22px; }
}
@media (max-width: 1366px) and (min-width: 861px) {
  .content { padding: 18px 22px 40px; }
  .kv { grid-template-columns: 140px 1fr; }
}
@media (max-height: 760px) and (min-width: 961px) {
  .auth-aside { padding: 28px 40px; }
  .beneficios { margin-top: 18px; gap: 10px; }
  .auth-main { padding: 24px; }
}
/* ---------- Papel do usuário ---------- */
.papeis { display: grid; gap: 8px; }
.papel-opcao { align-items: flex-start; font-weight: 400; }
.papel-opcao input { margin: 3px 0 0; accent-color: var(--pri); flex: none; }
.papel-opcao strong { display: block; font-weight: 600; color: var(--text); }
.papel-opcao .hint { display: block; margin-top: 2px; }
.papel-opcao:has(input:disabled) { cursor: default; }

/* ---------- Quadro de tarefas do aprovador ---------- */
.quadro { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; align-items: start; }
.quadro-col { --cor: var(--border-strong); background: var(--surface-2); border: 1px solid var(--border); border-top: 3px solid var(--cor); border-radius: var(--r); padding: 10px; min-width: 0; }
.quadro-col.c-amber { --cor: #e9a23b; }
.quadro-col.c-blue { --cor: #5b6ee1; }
.quadro-col.c-violet { --cor: #8b6ae8; }
.quadro-col.c-green { --cor: #2f9e62; }
.quadro-col > header { display: flex; align-items: center; gap: 8px; padding: 2px 4px 0; }
.quadro-col > header h2 { font-size: 13px; flex: 1; margin: 0; }
.quadro-ponto { width: 8px; height: 8px; border-radius: 50%; background: var(--cor); flex: none; }
.quadro-dica { margin: 2px 4px 10px; color: var(--muted); font-size: 11.5px; line-height: 1.35; }
.quadro-itens { display: grid; gap: 8px; }
.quadro-vazio { margin: 0; padding: 16px 8px; text-align: center; color: var(--subtle); font-size: 12px; border: 1px dashed var(--border-strong); border-radius: 10px; }
.tarefa { display: grid; gap: 3px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 9px 11px; color: var(--text); box-shadow: var(--sh-1); transition: border-color var(--t), box-shadow var(--t), transform var(--t); }
a.tarefa:hover { color: var(--text); border-color: var(--border-strong); box-shadow: var(--sh-2); transform: translateY(-1px); }
.tarefa.atrasada { border-left: 3px solid var(--danger); }
.tarefa-topo { display: flex; align-items: center; gap: 8px; min-width: 0; }
.tarefa-topo strong { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tarefa-rodape { display: flex; align-items: center; justify-content: space-between; gap: 6px; flex-wrap: wrap; margin-top: 3px; font-size: 12px; color: var(--muted); }
.tarefa-acao { display: inline-flex; align-items: center; gap: 2px; font-weight: 600; color: var(--pri-600); }
.tarefa-acao svg.i { width: 14px; height: 14px; }
@media (max-width: 1280px) { .quadro { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) { .quadro { grid-template-columns: 1fr; } }

/* ---------- Visão por etapa ---------- */
.visao-aviso { display: flex; align-items: flex-start; gap: 7px; margin: -8px 0 16px; }
.visao-aviso svg.i { width: 15px; height: 15px; flex: none; margin-top: 1px; }
.visao-bloco { border: 1px solid var(--border); border-radius: 10px; padding: 9px 11px; background: var(--surface); }
.visao-bloco + .visao-bloco { margin-top: 8px; }
.visao-lista { margin: 8px 0 0 27px; padding-left: 12px; border-left: 2px solid var(--border); display: grid; gap: 6px; }
.visao-lista .checks { max-height: 190px; overflow: auto; padding: 2px; }
.visao-presets { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; }
