/* ============================================================
   Precisum CRM — Design System
   Flat Design 2.0 · SaaS corporativo clean
   Paleta: navy #0D1B3D · cinza #5B6670 · laranja #FF8A00 · base #F2F4F7
   ============================================================ */

/* Manrope — a tipografia da marca Precisum (o logotipo usa ExtraBold 800) */
@font-face {
  font-family: 'Manrope';
  src: url('/assets/fonts/Manrope-latin.woff2') format('woff2-variations');
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
                 U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
                 U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Manrope';
  src: url('/assets/fonts/Manrope-latin-ext.woff2') format('woff2-variations');
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304,
                 U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB,
                 U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --navy: #0D1B3D;
  --navy-700: #16294F;
  --navy-600: #1F3563;
  --navy-100: #E8ECF5;
  --orange: #FF8A00;
  --orange-600: #E67C00;
  --orange-50: #FFF4E5;
  --gray: #5B6670;
  --bg: #F2F4F7;
  --card: #FFFFFF;
  --border: #E4E8EF;
  --border-2: #D3DAE5;
  --text: #212B42;
  /* --muted precisa passar em AA tanto sobre #FFF quanto sobre o fundo #F2F4F7 */
  --muted: #5F6A78;
  --link: #2456A6;
  --green: #188A54;
  --green-50: #E7F5EE;
  --red: #C93B3B;
  --red-50: #FBEAEA;
  --blue: #2563EB;
  --blue-50: #E9EFFC;
  --purple: #6D4AC9;
  --purple-50: #F0EBFB;
  --teal: #0E8C8C;
  --teal-50: #E5F4F4;
  --shadow-1: 0 1px 2px rgba(13, 27, 61, .05);
  --shadow-2: 0 2px 8px rgba(13, 27, 61, .07);
  --shadow-3: 0 10px 34px rgba(13, 27, 61, .16);
  --radius: 10px;
  --radius-sm: 7px;
  --side-w: 236px;
  --font: 'Manrope', -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  font-size: 14px;
  font-weight: 450;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
b, strong { font-weight: 600; }
.ic { flex: none; vertical-align: -3px; }
.num { font-variant-numeric: tabular-nums; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #C6CEDA; border-radius: 6px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background-color: #A9B4C5; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- Shell ---------- */
.shell { display: flex; min-height: 100vh; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.content { flex: 1; padding: 22px 26px 60px; max-width: 1560px; width: 100%; margin: 0 auto; }

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--side-w); flex: none;
  background: var(--navy);
  color: #C7D0E2;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  z-index: 40;
}
.side-brand { padding: 18px 18px 12px; }
.brand-link { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none !important; }
.brand-name { font-size: 17px; font-weight: 650; letter-spacing: .2px; color: #fff; }
.brand-name b { color: #8E99AF; font-weight: 500; font-size: 11px; margin-left: 5px; letter-spacing: 1.5px; }
.side-tenant {
  margin: 2px 14px 10px; padding: 7px 10px;
  background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .08);
  border-radius: var(--radius-sm);
  font-size: 12px; color: #AEB9CE;
  display: flex; align-items: center; gap: 7px;
  white-space: nowrap; overflow: hidden;
}
.side-tenant span { overflow: hidden; text-overflow: ellipsis; }
/* Logo do cliente. Por padrão vai sobre placa clara, porque logo costuma ser escura e o
   menu é navy. Se o sistema mediu que ela tem contraste próprio, dispensa a placa. */
.side-cliente {
  margin: 4px 14px 12px; padding: 11px 12px;
  background: #fff; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 0 rgba(0, 0, 0, .12);
}
.side-cliente img { max-width: 100%; max-height: 44px; display: block; }
.side-cliente.sem-placa {
  background: none; box-shadow: none;
  padding: 6px 12px 10px; margin-bottom: 6px;
}
.side-cliente.sem-placa img { max-height: 66px; }

.side-nav { flex: 1; padding: 4px 10px; overflow-y: auto; }
.side-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; margin: 2px 0;
  border-radius: var(--radius-sm);
  color: #B7C1D6; font-size: 13.5px; font-weight: 480;
  text-decoration: none !important;
  border: none; background: none; width: 100%; cursor: pointer;
  font-family: var(--font);
  transition: background .12s, color .12s;
}
.side-item:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.side-item.on { background: rgba(255, 138, 0, .14); color: #fff; }
.side-item.on .ic { color: var(--orange); }
.side-sep { height: 1px; background: rgba(255, 255, 255, .09); margin: 10px 4px; }
.side-foot { padding: 10px; border-top: 1px solid rgba(255, 255, 255, .09); }
.side-foot .ai-open { color: #FFC57E; }
.side-foot .ai-open:hover { background: rgba(255, 138, 0, .15); color: #FFD9A8; }
.side-version { font-size: 10.5px; color: #6B7690; padding: 8px 12px 2px; letter-spacing: .3px; }

/* ---------- Topbar ---------- */
.topbar {
  height: 58px; flex: none;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 14px;
  padding: 0 20px;
  position: sticky; top: 0; z-index: 30;
}
.menu-toggle { display: none; }
.top-search {
  flex: 1; max-width: 460px; position: relative;
  display: flex; align-items: center; gap: 8px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; padding: 0 12px; height: 36px;
  color: var(--muted);
}
.top-search:focus-within { border-color: var(--navy-600); background: #fff; box-shadow: 0 0 0 3px var(--navy-100); }
.top-search input { flex: 1; border: none; outline: none; background: none; font: inherit; color: var(--text); }
.search-results {
  display: none; position: absolute; top: 42px; left: 0; right: 0;
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-3); max-height: 380px; overflow: auto; z-index: 60;
}
.search-results.open { display: block; }
.search-results a { display: flex; align-items: center; gap: 10px; padding: 9px 13px; color: var(--text); border-bottom: 1px solid var(--bg); }
.search-results a:hover { background: var(--bg); text-decoration: none; }
.search-results .sr-type { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin-left: auto; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }

.icon-btn {
  width: 36px; height: 36px; border-radius: 8px;
  border: none; background: none; color: var(--gray);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; position: relative;
  transition: background .12s, color .12s;
}
.icon-btn:hover { background: var(--bg); color: var(--navy); }
.notif-dot {
  position: absolute; top: 4px; right: 3px;
  background: var(--orange); color: #fff;
  font-size: 9.5px; font-weight: 700;
  min-width: 15px; height: 15px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center; padding: 0 3px;
}
.notif-wrap, .user-wrap { position: relative; }
.user-btn {
  display: flex; align-items: center; gap: 9px;
  border: none; background: none; cursor: pointer; font-family: var(--font);
  padding: 5px 8px; border-radius: 8px; color: var(--text);
}
.user-btn:hover { background: var(--bg); }
.user-meta { text-align: left; line-height: 1.15; }
.user-meta b { display: block; font-size: 13px; }
.user-meta small { color: var(--muted); font-size: 11px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--navy); color: #fff;
  font-size: 12px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; flex: none;
}
.avatar.sm { width: 24px; height: 24px; font-size: 10px; }
.avatar.md { width: 44px; height: 44px; font-size: 15px; }
.avatar-foto { background-size: cover; background-position: center; color: transparent; }
/* o valor no resumo abre a edicao: quem quer muda-lo olha para ele, nao para um menu */
.valor-editavel {
  background: none; border: 0; padding: 0; cursor: pointer;
  font: inherit; color: inherit; display: inline-flex; align-items: center; gap: 5px;
  border-bottom: 1px dashed var(--border-2);
}
.valor-editavel:hover { color: var(--orange-600); border-bottom-color: var(--orange); }
.valor-editavel .ic { opacity: .55; }

/* seletor de empresa com cadastro embutido */
.campo-empresa-linha { display: flex; gap: 7px; align-items: center; }
.campo-empresa-linha .select { flex: 1; min-width: 0; }
.campo-empresa-linha .btn { flex: none; }
.nova-empresa {
  margin-top: 9px; padding: 11px; border-radius: 9px;
  background: var(--bg); border: 1px dashed var(--border-2);
}
.nova-empresa .field { margin-bottom: 9px; }
.ne-status { min-height: 17px; margin-bottom: 7px; color: var(--muted); }
.ne-status.erro { color: var(--red); }
.ne-status.ok { color: var(--green-600, #17794a); }

/* marca da empresa: quadrado, para nao se confundir com o circulo das pessoas */
.logo-emp {
  position: relative; overflow: hidden; flex: none;
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--navy-100); color: var(--navy);
  font-size: 11px; font-weight: 700; letter-spacing: -.02em;
  display: inline-flex; align-items: center; justify-content: center;
}
.logo-emp.sm { width: 26px; height: 26px; border-radius: 7px; font-size: 10px; }
.logo-emp.md { width: 46px; height: 46px; border-radius: 11px; font-size: 15px; }
.logo-emp > img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: contain; background: #fff; border-radius: inherit;
}

/* a foto cobre as iniciais; sumindo a imagem, o nome volta a aparecer sozinho */
.avatar { position: relative; overflow: hidden; }
.avatar > img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; border-radius: 50%;
}

/* retorno da consulta de CNPJ, logo abaixo do campo */
.cnpj-status { font-size: 12px; margin-top: 4px; line-height: 1.45; }
.cnpj-status b { display: block; font-weight: 600; }
.cnpj-status span { color: var(--muted); }
.cnpj-status.buscando { color: var(--muted); }
.cnpj-status.ok b { color: var(--green); }
.cnpj-status.alerta b { color: var(--orange); }
.cnpj-status.erro { color: var(--red); }

/* campo de foto: retrato grande à esquerda, ações à direita.
   O <input type=file> nativo destoa do resto da interface, então ele fica escondido
   dentro de um <label> com cara de botão — o clique no label abre o seletor igual. */
.foto-campo {
  display: flex; flex-direction: row; align-items: center; gap: 16px;
  margin-bottom: 15px; padding-bottom: 15px; border-bottom: 1px solid var(--line);
}
.foto-preview {
  width: 86px; height: 86px; border-radius: 50%; flex: none;
  background: var(--navy-100); color: var(--navy);
  display: inline-flex; align-items: center; justify-content: center;
  background-size: cover; background-position: center;
  border: 1px solid var(--border-2); overflow: hidden;
}
.foto-preview.avatar-foto { color: transparent; }
/* o preview de logo acompanha a forma da marca: quadrado, e a imagem inteira a vista */
.foto-preview.quadrada { border-radius: 14px; background-size: contain; background-repeat: no-repeat; }
.foto-preview.avatar-foto svg { display: none; }
.foto-campo .foto-acoes { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.foto-campo .foto-label { font-size: 12.5px; font-weight: 550; color: var(--text); }
.foto-campo .foto-botoes { display: flex; gap: 7px; flex-wrap: wrap; }
.foto-campo .foto-botoes .btn { cursor: pointer; }
.foto-campo .foto-arquivo {
  font-size: 11.5px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* rótulo que separa blocos dentro de um formulário longo */
.sep-label {
  font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); border-top: 1px solid var(--line); padding-top: 10px; margin-bottom: 8px;
}
.avatar.orange { background: var(--orange); }

.pop {
  display: none; position: absolute; right: 0; top: 44px;
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-3); min-width: 230px; z-index: 70; overflow: hidden;
}
.pop.open { display: block; }
.user-pop a { display: flex; align-items: center; gap: 10px; padding: 10px 14px; color: var(--text); font-size: 13.5px; }
.user-pop a:hover { background: var(--bg); text-decoration: none; }
.user-pop a.danger { color: var(--red); border-top: 1px solid var(--border); }
.notif-pop { width: 340px; }
.pop-head { padding: 10px 14px; font-weight: 600; font-size: 13px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.notif-list { max-height: 350px; overflow: auto; }
.notif-item { padding: 10px 14px; border-bottom: 1px solid var(--bg); display: block; color: var(--text); }
.notif-item:hover { background: var(--bg); text-decoration: none; }
.notif-item.unread { background: var(--orange-50); }
.notif-item b { display: block; font-size: 13px; }
.notif-item small { color: var(--muted); font-size: 11.5px; }
.empty-mini { padding: 18px; text-align: center; color: var(--muted); font-size: 13px; }

.impersonate-bar {
  background: var(--navy); color: #E8ECF5;
  padding: 7px 20px; font-size: 12.5px;
  display: flex; align-items: center; gap: 8px;
}
.impersonate-bar a { color: var(--orange); font-weight: 600; margin-left: 6px; }

/* ---------- Page head ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 20px; font-weight: 650; color: var(--navy); letter-spacing: -.2px; }
.page-sub { color: var(--muted); font-size: 13px; margin-top: 3px; }
.page-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  border-radius: 8px; border: 1px solid transparent;
  font: 500 13.5px var(--font);
  padding: 0 14px; height: 36px;
  cursor: pointer; text-decoration: none !important;
  transition: background .12s, border-color .12s, color .12s, box-shadow .12s;
  white-space: nowrap;
}
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-700); }
.btn-accent { background: var(--orange); color: #fff; }
.btn-accent:hover { background: var(--orange-600); }
.btn-ghost { background: #fff; color: var(--text); border-color: var(--border-2); }
.btn-ghost:hover { border-color: var(--gray); background: var(--bg); }
.btn-danger { background: #fff; color: var(--red); border-color: #EBC9C9; }
.btn-danger:hover { background: var(--red-50); border-color: var(--red); }
.btn-soft { background: var(--navy-100); color: var(--navy); }
.btn-soft:hover { background: #DAE1F0; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 7px; }
.btn-lg { height: 42px; padding: 0 20px; font-size: 14.5px; }
.btn-ic { padding: 0; width: 36px; justify-content: center; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.link-btn { border: none; background: none; color: var(--link); font: 500 12.5px var(--font); cursor: pointer; padding: 2px 4px; }
.link-btn:hover { text-decoration: underline; }

/* ---------- Cards ---------- */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-1);
}
.card-pad { padding: 18px; }
.card-head {
  padding: 13px 18px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  font-weight: 600; font-size: 14px; color: var(--navy);
}
.card-head .ic { color: var(--gray); }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.span-2 { grid-column: span 2; }

/* ---------- KPI ---------- */
.kpi { padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; position: relative; overflow: hidden; }
.kpi-label { font-size: 12px; color: var(--muted); font-weight: 500; display: flex; align-items: center; gap: 7px; }
.kpi-label .ic { color: var(--gray); }
.kpi-value { font-size: 23px; font-weight: 650; color: var(--navy); letter-spacing: -.4px; font-variant-numeric: tabular-nums; }
.kpi-hint { font-size: 12px; color: var(--muted); }
.kpi-hint .up { color: var(--green); font-weight: 600; }
.kpi-hint .down { color: var(--red); font-weight: 600; }
.kpi-accent { position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--navy); border-radius: 0 3px 3px 0; }
.kpi-accent.orange { background: var(--orange); } .kpi-accent.green { background: var(--green); }
.kpi-accent.red { background: var(--red); } .kpi-accent.blue { background: var(--blue); }

/* ---------- Badges & chips ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 600;
  padding: 2.5px 9px; border-radius: 20px;
  white-space: nowrap;
}
.tone-gray { background: #EDF0F4; color: #4C5666; }
.tone-navy { background: var(--navy-100); color: var(--navy); }
.tone-blue { background: var(--blue-50); color: #1D4FB8; }
.tone-green { background: var(--green-50); color: var(--green); }
.tone-orange { background: var(--orange-50); color: #B4640A; }
.tone-red { background: var(--red-50); color: var(--red); }
.tone-purple { background: var(--purple-50); color: var(--purple); }
.tone-teal { background: var(--teal-50); color: var(--teal); }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--border-2); border-radius: 20px;
  padding: 3px 10px; font-size: 12px; color: var(--gray); background: #fff;
}

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .5px;
  color: var(--muted); font-weight: 600;
  padding: 10px 14px; border-bottom: 1px solid var(--border);
  background: #FAFBFD; white-space: nowrap;
}
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--bg); vertical-align: middle; }
.tbl tbody tr { transition: background .1s; }
.tbl tbody tr:hover { background: #F7F9FC; }
.tbl tr.row-link { cursor: pointer; }
.tbl .td-actions { text-align: right; white-space: nowrap; }
.tbl .td-actions .icon-btn { width: 30px; height: 30px; }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .cell-main { font-weight: 550; color: var(--navy); }
.tbl .cell-sub { font-size: 12px; color: var(--muted); display: block; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 13px; }
.field label { font-size: 12.5px; font-weight: 550; color: var(--text); }
.field label .req { color: var(--red); }
.field small.help { color: var(--muted); font-size: 11.5px; }
.input, .select, textarea.input {
  width: 100%; height: 37px;
  border: 1px solid var(--border-2); border-radius: 8px;
  padding: 0 11px; font: 400 13.5px var(--font); color: var(--text);
  background: #fff; outline: none;
  transition: border-color .12s, box-shadow .12s;
}
textarea.input { height: auto; padding: 9px 11px; resize: vertical; line-height: 1.5; }
.input::placeholder, textarea.input::placeholder { color: #6F7782; }
.input:focus, .select:focus, textarea.input:focus { border-color: var(--navy-600); box-shadow: 0 0 0 3px var(--navy-100); }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%235B6670' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 32px; cursor: pointer; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-grid .full { grid-column: 1 / -1; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; user-select: none; }
.check input { width: 16px; height: 16px; accent-color: var(--navy); cursor: pointer; }
.radio-row { display: flex; gap: 14px; flex-wrap: wrap; }
.seg {
  display: inline-flex; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 3px; gap: 2px;
}
.seg button, .seg a {
  border: none; background: none; border-radius: 6px;
  font: 500 12.5px var(--font); color: var(--gray);
  padding: 6px 13px; cursor: pointer; text-decoration: none !important;
}
.seg .on { background: #fff; color: var(--navy); box-shadow: var(--shadow-1); border: 1px solid var(--border); }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 18px; flex-wrap: wrap; }
.tabs a, .tabs button {
  border: none; background: none; cursor: pointer; text-decoration: none !important;
  font: 500 13.5px var(--font); color: var(--muted);
  padding: 9px 15px; border-bottom: 2px solid transparent; margin-bottom: -1px;
  display: inline-flex; align-items: center; gap: 7px;
}
.tabs a:hover, .tabs button:hover { color: var(--navy); }
.tabs .on { color: var(--navy); border-bottom-color: var(--orange); font-weight: 600; }
.tabs .count { background: var(--bg); border-radius: 10px; font-size: 11px; padding: 1px 7px; color: var(--gray); }

/* ---------- Kanban ---------- */
.kanban { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 14px; align-items: flex-start; }
.kb-col { flex: 0 0 290px; max-width: 290px; }
.kb-head {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 6px 10px; font-size: 13px; font-weight: 600; color: var(--navy);
}
.kb-head .count { color: var(--muted); font-weight: 500; font-size: 12px; }
.kb-head .kb-total { margin-left: auto; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.kb-cards { display: flex; flex-direction: column; gap: 9px; min-height: 60px; border-radius: var(--radius); transition: background .15s; padding: 2px; }
.kb-cards.drag-over { background: var(--navy-100); outline: 2px dashed var(--navy-600); outline-offset: -2px; }
.kb-card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 11px 12px; cursor: grab; box-shadow: var(--shadow-1);
  transition: box-shadow .12s, border-color .12s, transform .12s;
  display: block; color: var(--text); text-decoration: none !important;
}
.kb-card:hover { border-color: var(--border-2); box-shadow: var(--shadow-2); }
.kb-card.dragging { opacity: .45; transform: rotate(1.5deg); }
.kb-title { font-weight: 550; font-size: 13.5px; color: var(--navy); margin-bottom: 3px; }
.kb-sub { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.kb-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 9px; }
.kb-value { font-weight: 600; font-size: 12.5px; color: var(--text); font-variant-numeric: tabular-nums; }
.kb-flags { display: flex; gap: 5px; align-items: center; }
.kb-late { color: var(--red); display: inline-flex; align-items: center; gap: 3px; font-size: 11px; font-weight: 600; }
.kb-add {
  border: 1px dashed var(--border-2); background: none; border-radius: var(--radius-sm);
  color: var(--muted); font: 500 12.5px var(--font);
  padding: 8px; cursor: pointer; width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.kb-add:hover { border-color: var(--navy-600); color: var(--navy); background: #fff; }

/* ---------- Modal ---------- */
.overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(13, 27, 61, .45); z-index: 90;
  backdrop-filter: blur(1.5px);
}
.overlay.open { display: block; }
.modal-root { position: fixed; inset: 0; z-index: 100; display: none; align-items: flex-start; justify-content: center; overflow-y: auto; padding: 5vh 16px 40px; }
.modal-root.open { display: flex; }
.modal {
  background: #fff; border-radius: 14px; box-shadow: var(--shadow-3);
  width: 100%; max-width: 560px; animation: pop .18s ease;
}
.modal.wide { max-width: 780px; }
@keyframes pop { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-head h3 { font-size: 15.5px; font-weight: 650; color: var(--navy); display: flex; align-items: center; gap: 9px; }
.modal-body { padding: 18px 20px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 9px; background: #FAFBFD; border-radius: 0 0 14px 14px; }

/* ---------- Toast ---------- */
.toast-root { position: fixed; bottom: 22px; right: 22px; z-index: 200; display: flex; flex-direction: column; gap: 9px; }
.toast {
  background: var(--navy); color: #fff;
  border-radius: 10px; padding: 12px 16px;
  font-size: 13.5px; box-shadow: var(--shadow-3);
  display: flex; align-items: center; gap: 9px;
  animation: slidein .2s ease; max-width: 380px;
}
.toast.err { background: var(--red); }
.toast.ok .ic { color: #6EE7A8; }
@keyframes slidein { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- AI drawer ---------- */
.ai-drawer {
  position: fixed; top: 0; right: -430px; bottom: 0;
  width: 420px; max-width: 96vw;
  background: #fff; border-left: 1px solid var(--border);
  box-shadow: -12px 0 40px rgba(13, 27, 61, .12);
  z-index: 120; display: flex; flex-direction: column;
  transition: right .22s ease;
}
.ai-drawer.open { right: 0; }
.ai-head {
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  background: var(--navy); color: #fff;
}
.ai-title { font-weight: 600; font-size: 14.5px; display: flex; align-items: center; gap: 9px; }
.ai-title .ic { color: var(--orange); }
.ai-head-actions { display: flex; align-items: center; gap: 4px; }
.ai-head .icon-btn, .ai-head .link-btn { color: #C7D0E2; }
.ai-head .icon-btn:hover { background: rgba(255,255,255,.1); color: #fff; }
.ai-body { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; background: #F7F9FC; }
.ai-hello { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; font-size: 13px; color: var(--text); }
.ai-suggestions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.ai-suggestions button {
  border: 1px solid var(--border-2); background: #fff; border-radius: 16px;
  font: 500 12px var(--font); color: var(--navy);
  padding: 5px 11px; cursor: pointer;
}
.ai-suggestions button:hover { border-color: var(--orange); color: var(--orange-600); background: var(--orange-50); }
.ai-msg { max-width: 92%; border-radius: 12px; padding: 10px 13px; font-size: 13.5px; line-height: 1.5; }
.ai-msg.user { align-self: flex-end; background: var(--navy); color: #fff; border-bottom-right-radius: 4px; }
.ai-msg.bot { align-self: flex-start; background: #fff; border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.ai-msg.bot .md p { margin: 0 0 8px; } .ai-msg.bot .md p:last-child { margin: 0; }
.ai-msg.bot .md ul, .ai-msg.bot .md ol { margin: 4px 0 8px 18px; }
.ai-msg.bot .md li { margin: 2px 0; }
.ai-msg.bot .md code { background: var(--bg); border-radius: 4px; padding: 1px 5px; font-size: 12px; }
.ai-msg.bot .md h1, .ai-msg.bot .md h2, .ai-msg.bot .md h3 { font-size: 13.5px; margin: 8px 0 4px; color: var(--navy); }
.ai-typing { align-self: flex-start; color: var(--muted); font-size: 12.5px; display: flex; align-items: center; gap: 8px; padding: 4px 2px; }
.ai-typing .dots span { display: inline-block; width: 5px; height: 5px; margin: 0 1.5px; border-radius: 50%; background: var(--gray); animation: blink 1.2s infinite; }
.ai-typing .dots span:nth-child(2) { animation-delay: .2s; } .ai-typing .dots span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 60%, 100% { opacity: .25; } 30% { opacity: 1; } }
.ai-input { display: flex; gap: 9px; padding: 13px 14px; border-top: 1px solid var(--border); background: #fff; align-items: flex-end; }
.ai-input textarea {
  flex: 1; border: 1px solid var(--border-2); border-radius: 10px;
  font: 400 13.5px var(--font); padding: 9px 12px; resize: none; outline: none;
  max-height: 130px; line-height: 1.4;
}
.ai-input textarea:focus { border-color: var(--navy-600); box-shadow: 0 0 0 3px var(--navy-100); }

/* ============================================================
   Login / autenticação
   ============================================================ */
.auth-body { background: var(--bg); }
.auth {
  min-height: 100vh; min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1.06fr) minmax(0, 1fr);
}
/* sem isto, o mínimo automático do grid impede as colunas de encolher e a página transborda */
.auth > * { min-width: 0; }

/* ---- painel de marca ---- */
.auth-brand {
  position: relative; overflow: hidden;
  background: var(--navy);
  background-image: radial-gradient(115% 85% at 12% 8%, #1B2F58 0%, #0D1B3D 58%);
  color: #fff;
  display: flex; flex-direction: column;
  padding: clamp(30px, 4vw, 52px) clamp(28px, 5vw, 76px);
  isolation: isolate;
}
.auth-topo {
  position: absolute; inset: -6% -6% -6% -6%;
  width: 112%; height: 112%;
  color: #fff; z-index: -2;
}
.auth-brand-grid {
  position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .035) 1px, transparent 1px);
  background-size: 46px 46px;
  -webkit-mask-image: radial-gradient(120% 90% at 20% 15%, #000 0%, transparent 78%);
  mask-image: radial-gradient(120% 90% at 20% 15%, #000 0%, transparent 78%);
}
.auth-brand-top { flex: none; }
.auth-logo { display: block; height: 34px; width: auto; }
.auth-brand-mid { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 36px 0; max-width: 520px; }

.auth-headline {
  font-size: clamp(32px, 3.5vw, 46px);
  font-weight: 800;
  line-height: 1.06;
  letter-spacing: -.035em;
  margin-bottom: 16px;
}
.auth-headline em { font-style: normal; color: var(--orange); }
.auth-lead {
  color: #AAB5CC; font-size: clamp(14px, 1.1vw, 15.5px);
  line-height: 1.55; max-width: 44ch;
}

.auth-list { list-style: none; margin-top: clamp(26px, 3.4vw, 40px); display: flex; flex-direction: column; gap: 2px; }
.auth-list li {
  display: flex; gap: 13px; align-items: flex-start;
  padding: 11px 0; border-top: 1px solid rgba(255, 255, 255, .085);
}
.auth-list li:last-child { border-bottom: 1px solid rgba(255, 255, 255, .085); }
.auth-list-ic {
  flex: none; width: 32px; height: 32px; border-radius: 8px;
  display: grid; place-items: center;
  background: rgba(255, 138, 0, .13); color: var(--orange);
  border: 1px solid rgba(255, 138, 0, .2);
}
.auth-list-txt { min-width: 0; }
.auth-list-txt b { display: block; font-size: 13.5px; font-weight: 650; color: #EAEEF6; letter-spacing: -.005em; }
.auth-list-txt small { display: block; font-size: 12.5px; color: #93A0BA; line-height: 1.45; margin-top: 1px; }

.auth-trust {
  flex: none; display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  font-size: 11px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase;
  color: #8B99B6;
}
.auth-trust span:not(.auth-trust-mark) { display: inline-flex; align-items: center; gap: 8px; }
.auth-trust span:not(.auth-trust-mark)::before {
  content: ''; width: 4px; height: 4px; background: #4C5A78; flex: none;
}
.auth-trust-mark { display: inline-flex; gap: 4px; }
.auth-trust-mark i { width: 9px; height: 9px; display: block; }
.auth-trust-mark i:first-child { background: var(--gray); }
.auth-trust-mark i:last-child { background: var(--orange); }

/* ---- painel do formulário ---- */
.auth-panel {
  position: relative;
  display: grid; place-items: center;
  padding: clamp(28px, 5vw, 56px) clamp(20px, 4vw, 40px);
  background: var(--bg);
}
.auth-panel::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(13, 27, 61, .04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(13, 27, 61, .04) 1px, transparent 1px);
  background-size: 30px 30px;
  -webkit-mask-image: radial-gradient(78% 62% at 50% 45%, #000 0%, transparent 76%);
  mask-image: radial-gradient(78% 62% at 50% 45%, #000 0%, transparent 76%);
}
.auth-panel-inner { position: relative; width: 100%; max-width: 418px; }

.auth-card {
  position: relative;
  background-color: var(--card);
  /* filete de acento assentado na própria borda superior do card */
  background-image: linear-gradient(90deg, transparent 0 28px, var(--orange) 28px 70px, transparent 70px);
  background-repeat: no-repeat;
  background-size: 100% 3px;
  background-position: 0 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 34px clamp(22px, 3.4vw, 34px) 30px;
  box-shadow: 0 1px 2px rgba(13, 27, 61, .04), 0 18px 40px -20px rgba(13, 27, 61, .22);
}
.auth-card-head { margin-bottom: 22px; }
.auth-card-head h2 { font-size: 21px; font-weight: 750; color: var(--navy); letter-spacing: -.028em; }
.auth-card-head p { font-size: 13.5px; color: var(--muted); margin-top: 5px; }

.auth-erro {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--red-50); border: 1px solid #F0D2D2; border-left: 3px solid var(--red);
  border-radius: 9px; padding: 11px 13px; margin-bottom: 18px;
  font-size: 13px; color: #8E2C2C; line-height: 1.45;
}
.auth-erro .ic { color: var(--red); flex: none; margin-top: 1px; }

.label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.micro-link {
  border: none; background: none; padding: 0; cursor: pointer;
  font: 500 12px var(--font); color: var(--link);
}
.micro-link:hover { text-decoration: underline; }

.control { position: relative; display: flex; align-items: center; }
.control-ic {
  position: absolute; left: 12px; display: grid; place-items: center;
  color: var(--gray); pointer-events: none; transition: color .14s;
}
.control .input { height: 45px; padding-left: 39px; border-radius: 9px; font-size: 14px; }
.control .input::placeholder { color: #9AA5B5; }
.control:focus-within .control-ic { color: var(--navy); }
#senha { padding-right: 44px; }
.control-btn {
  position: absolute; right: 5px;
  width: 34px; height: 34px; border-radius: 7px;
  border: none; background: none; color: var(--gray);
  display: grid; place-items: center; cursor: pointer;
}
.control-btn:hover { background: var(--bg); color: var(--navy); }
.control-btn:focus-visible { outline: 2px solid var(--navy-600); outline-offset: 1px; }
.control-btn .ic-off { display: none; }
.control-btn.on .ic-on { display: none; }
.control-btn.on .ic-off { display: block; }

.field-warn {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: #A85C08; margin-top: 7px;
}
.field-warn .ic { color: var(--orange-600); }

.btn-auth {
  position: relative; width: 100%; height: 47px; margin-top: 6px;
  border: none; border-radius: 9px; cursor: pointer;
  background: var(--navy); color: #fff;
  font: 650 14.5px var(--font); letter-spacing: -.01em;
  display: flex; align-items: center; justify-content: center; gap: 9px;
  transition: background .14s, transform .1s, box-shadow .14s;
}
.btn-auth:hover { background: var(--navy-700); box-shadow: 0 6px 18px -8px rgba(13, 27, 61, .6); }
.btn-auth:active { transform: translateY(1px); }
.btn-auth:focus-visible { outline: 3px solid rgba(13, 27, 61, .25); outline-offset: 2px; }
.btn-auth .btn-auth-ic { display: grid; place-items: center; transition: transform .16s; }
.btn-auth:hover .btn-auth-ic { transform: translateX(3px); }
.btn-auth-spin {
  display: none; width: 17px; height: 17px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .32); border-top-color: #fff;
  animation: auth-spin .7s linear infinite;
}
.btn-auth.carregando { background: var(--navy-600); cursor: progress; }
.btn-auth.carregando .btn-auth-txt, .btn-auth.carregando .btn-auth-ic { display: none; }
.btn-auth.carregando .btn-auth-spin { display: block; }
@keyframes auth-spin { to { transform: rotate(360deg); } }

.auth-ajuda {
  display: flex; gap: 9px; align-items: flex-start;
  margin-top: 18px; padding: 12px 13px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 9px;
  font-size: 12.5px; color: var(--gray); line-height: 1.5;
}
.auth-ajuda .ic { color: var(--gray); flex: none; margin-top: 1px; }
.auth-ajuda b { color: var(--text); }

.auth-foot {
  text-align: center; margin-top: 20px;
  font-size: 12px; color: var(--muted);
}
.auth-foot b { color: var(--gray); font-weight: 650; }
.auth-foot-v { display: block; margin-top: 3px; font-size: 11px; color: var(--muted); }

@media (max-width: 1040px) {
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-brand { padding: 26px clamp(22px, 6vw, 40px) 30px; }
  .auth-brand-mid { padding: 22px 0 0; max-width: none; }
  .auth-headline { font-size: clamp(26px, 6.4vw, 34px); }
  .auth-headline br { display: none; }
  .auth-lead { font-size: 14px; max-width: none; }
  .auth-list, .auth-trust { display: none; }
  .auth-panel { padding: 30px 20px 40px; }
  .auth-panel-inner { max-width: 440px; }
}
@media (max-width: 420px) {
  .auth-card { padding: 28px 20px 24px; border-radius: 12px; }
  .auth-card::before { left: 20px; }
  .auth-brand { padding: 22px 20px 26px; }
  .auth-logo { height: 30px; }
}
@media (prefers-reduced-motion: reduce) {
  .btn-auth, .btn-auth .btn-auth-ic { transition: none; }
  .btn-auth-spin { animation-duration: 1.6s; }
}

/* ---------- Timeline ---------- */
.timeline { display: flex; flex-direction: column; }
.tl-item { display: flex; gap: 13px; padding: 11px 0; border-bottom: 1px solid var(--bg); }
.tl-item:last-child { border-bottom: none; }
.tl-ic {
  width: 32px; height: 32px; border-radius: 50%; flex: none;
  background: var(--bg); color: var(--gray);
  display: flex; align-items: center; justify-content: center;
}
.tl-ic.orange { background: var(--orange-50); color: var(--orange-600); }
.tl-ic.green { background: var(--green-50); color: var(--green); }
.tl-ic.blue { background: var(--blue-50); color: var(--blue); }
.tl-body { flex: 1; min-width: 0; }
.tl-title { font-size: 13.5px; font-weight: 550; }
.tl-desc { font-size: 13px; color: var(--muted); white-space: pre-wrap; word-break: break-word; }
.tl-meta { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.tl-item.task-open .tl-ic { background: var(--orange-50); color: var(--orange-600); }
.tl-item.done .tl-title { text-decoration: line-through; color: var(--muted); }

/* ---------- Checklist ---------- */
.chk-group { margin-bottom: 16px; }
.chk-group-title { font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .6px; color: var(--gray); margin-bottom: 7px; display: flex; align-items: center; gap: 8px; }
.chk-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  margin-bottom: 6px; background: #fff; font-size: 13px;
}
.chk-row .grow { flex: 1 1 200px; min-width: 0; }
.chk-row > .ic, .chk-row .icon-btn, .chk-row .badge { flex: none; }
/* o .select base é width:100%; dentro da linha ele precisa ceder espaço ao texto do item */
.chk-row select, .chk-row .select { width: auto; flex: 0 0 auto; min-width: 168px; height: 30px; font-size: 12.5px; padding: 0 26px 0 9px; }

/* ---------- Progress ---------- */
.prog { height: 7px; background: var(--bg); border-radius: 5px; overflow: hidden; }
.prog > div { height: 100%; background: var(--navy); border-radius: 5px; transition: width .3s; }
.prog.orange > div { background: var(--orange); }
.prog.green > div { background: var(--green); }

/* ---------- Funnel viz ---------- */
.funnel-viz { display: flex; flex-direction: column; gap: 7px; }
.fv-row { display: grid; grid-template-columns: 130px 1fr 90px; align-items: center; gap: 12px; font-size: 12.5px; }
.fv-label { color: var(--text); font-weight: 500; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fv-bar-wrap { background: var(--bg); border-radius: 5px; height: 22px; }
.fv-bar { height: 100%; border-radius: 5px; background: linear-gradient(90deg, var(--navy-600), var(--navy)); min-width: 3px; display: flex; align-items: center; justify-content: flex-end; padding-right: 7px; color: #fff; font-size: 11px; font-weight: 600; }
.fv-val { color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- Bars chart (fluxo de caixa) ---------- */
.bars { display: flex; gap: 10px; align-items: flex-end; height: 190px; padding: 10px 4px 0; }
.bar-g { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.bar-pair { display: flex; gap: 4px; align-items: flex-end; height: 150px; }
.bar-pair i { display: block; width: 16px; border-radius: 4px 4px 0 0; min-height: 2px; }
.bar-pair .in { background: var(--navy); }
.bar-pair .out { background: var(--orange); }
.bar-lbl { font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); align-items: center; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* ---------- Empty state ---------- */
.empty {
  text-align: center; padding: 46px 20px; color: var(--muted);
}
.empty .ic { color: #B9C2D0; margin-bottom: 10px; }
.empty h4 { color: var(--text); font-size: 14.5px; font-weight: 600; margin-bottom: 4px; }
.empty p { font-size: 13px; max-width: 340px; margin: 0 auto 14px; }

/* ---------- Dropdown menu (per-row) ---------- */
.dd { position: relative; display: inline-block; }
.dd-menu {
  display: none; position: absolute; right: 0; top: 34px; z-index: 50;
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-3); min-width: 190px; overflow: hidden;
}
.dd.open .dd-menu { display: block; }
.dd-menu button, .dd-menu a {
  display: flex; align-items: center; gap: 9px; width: 100%;
  border: none; background: none; cursor: pointer; text-align: left;
  font: 450 13px var(--font); color: var(--text);
  padding: 9px 13px; text-decoration: none !important;
}
.dd-menu button:hover, .dd-menu a:hover { background: var(--bg); }
.dd-menu .danger { color: var(--red); }
.dd-menu .sep { height: 1px; background: var(--border); margin: 3px 0; }

/* ---------- Filters bar ---------- */
.filters { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; margin-bottom: 15px; }
.filters .input, .filters .select { width: auto; min-width: 150px; height: 34px; font-size: 13px; }
.filters .top-search { max-width: 260px; height: 34px; background: #fff; }

/* ---------- Alerts ---------- */
.alert-row {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 13px; border: 1px solid var(--border); border-left: 3px solid var(--orange);
  border-radius: var(--radius-sm); background: #fff; margin-bottom: 8px; font-size: 13px;
}
.alert-row.red { border-left-color: var(--red); }
.alert-row.blue { border-left-color: var(--blue); }
.alert-row .ic { color: var(--gray); flex: none; }
.alert-row .grow { flex: 1; min-width: 0; }
.alert-row small { color: var(--muted); display: block; }

/* ---------- Perms matrix ---------- */
.perm-grid { display: grid; grid-template-columns: 1fr repeat(3, 74px); gap: 4px 8px; align-items: center; font-size: 13px; }
.perm-grid .ph { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); text-align: center; font-weight: 600; }
.perm-grid .pm { padding: 6px 0; border-bottom: 1px solid var(--bg); }
.perm-grid label.pc { display: flex; justify-content: center; border-bottom: 1px solid var(--bg); padding: 6px 0; cursor: pointer; }
.perm-grid input { accent-color: var(--navy); width: 15px; height: 15px; }

/* ---------- Detail 2-col ---------- */
.detail-grid { display: grid; grid-template-columns: 1fr 360px; gap: 16px; align-items: start; }
.info-list { display: flex; flex-direction: column; }
.info-list > div { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--bg); font-size: 13px; }
.info-list > div:last-child { border-bottom: none; }
.info-list dt { color: var(--muted); flex: none; }
.info-list dd { text-align: right; font-weight: 500; min-width: 0; word-break: break-word; }

/* ---------- Utility ---------- */
.mt-1 { margin-top: 6px; } .mt-2 { margin-top: 12px; } .mt-3 { margin-top: 18px; } .mt-4 { margin-top: 26px; }
.mb-1 { margin-bottom: 6px; } .mb-2 { margin-bottom: 12px; } .mb-3 { margin-bottom: 18px; }
.muted { color: var(--muted); } .small { font-size: 12.5px; }
.flex { display: flex; align-items: center; gap: 9px; } .grow { flex: 1; min-width: 0; }
.right { margin-left: auto; } .center { text-align: center; }
.nowrap { white-space: nowrap; }
.hide { display: none !important; }
.text-green { color: var(--green); } .text-red { color: var(--red); } .text-orange { color: var(--orange-600); } .text-navy { color: var(--navy); }
.w-100 { width: 100%; }
.clickable { cursor: pointer; }

/* ---------- Financeiro: empresas emitentes e medições ---------- */
.emp-seg a { text-transform: none; }
.med-barra {
  border-top: 1px solid var(--border); background: #FAFBFD;
  padding: 12px 16px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  border-radius: 0 0 var(--radius) var(--radius);
}
.med-resumo { display: flex; flex-direction: column; gap: 1px; flex: none; }
.med-resumo b { font-size: 13px; color: var(--navy); }
.med-resumo span { font-size: 17px; font-weight: 750; color: var(--navy); letter-spacing: -.02em; }
.med-campos { display: flex; gap: 8px; align-items: center; flex: 1; flex-wrap: wrap; justify-content: flex-end; }
.med-campos .input, .med-campos .select { width: auto; min-width: 140px; height: 36px; }
.med-campos .input[name="descricao"] { min-width: 220px; flex: 1; max-width: 340px; }
.med-check { width: 17px; height: 17px; accent-color: var(--navy); cursor: pointer; }
@media (max-width: 760px) {
  .med-campos { justify-content: stretch; }
  .med-campos .input, .med-campos .select, .med-campos .btn { width: 100%; max-width: none; }
}

/* ---------- Trilha de auditoria ---------- */
.tbl.aud td { vertical-align: top; padding-top: 12px; padding-bottom: 12px; }
.aud-dia td {
  background: #FAFBFD; font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--muted); padding: 7px 14px !important;
  border-bottom: 1px solid var(--border);
}
.aud-hora { font-size: 13.5px; font-weight: 650; color: var(--navy); font-variant-numeric: tabular-nums; }
.aud-frase { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; font-size: 13.5px; }
.aud-frase b { color: var(--navy); font-weight: 650; }
.aud-alvo {
  color: var(--text); background: var(--bg); border-radius: 5px;
  padding: 1px 7px; font-size: 12.5px;
}
.aud-campos {
  margin-top: 7px; display: flex; flex-direction: column; gap: 3px;
  border-left: 2px solid var(--border); padding-left: 11px;
}
.aud-campo { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; font-size: 12.5px; }
.aud-nome { color: var(--muted); min-width: 108px; }
.aud-velho { color: var(--gray); text-decoration: line-through; text-decoration-color: #C3CBD8; }
.aud-novo { color: var(--navy); font-weight: 600; }
.aud-campo .ic { color: var(--gray); flex: none; }
.aud-oculto { color: var(--muted); font-style: italic; display: inline-flex; align-items: center; gap: 5px; }

/* Criação: o registro nasceu inteiro de uma vez, então vira uma linha de chips
   em vez de uma lista vertical que empurraria as demais ações para fora da tela. */
.aud-resumo { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 5px; }
.aud-chip {
  font-size: 12px; color: var(--text); background: var(--bg);
  border: 1px solid var(--border); border-radius: 5px; padding: 2px 8px;
}
.aud-mais { color: var(--muted); cursor: help; font-weight: 600; }
.aud-sessao {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px;
  color: var(--muted); cursor: pointer; white-space: nowrap;
}
.aud-sessao input { accent-color: var(--orange); cursor: pointer; }
.cron-url {
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 10.5px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 6px;
  padding: 6px 8px; margin-bottom: 6px; word-break: break-all; color: var(--muted);
  user-select: all;
}

/* No celular três colunas cortariam o texto do meio. Cada registro vira um cartão:
   hora e autor na primeira linha, o que aconteceu embaixo, ocupando a largura toda. */
@media (max-width: 760px) {
  .aud-nome { min-width: 0; }
  .tbl.aud thead { display: none; }
  .tbl.aud, .tbl.aud tbody, .tbl.aud tr { display: block; width: 100%; }
  .tbl.aud tr { border-bottom: 1px solid var(--border); padding: 11px 14px; }
  .tbl.aud td { display: block; padding: 0 !important; border: 0 !important; max-width: none; }
  .tbl.aud td:nth-child(1), .tbl.aud td:nth-child(2) { display: inline-block; vertical-align: middle; }
  .tbl.aud td:nth-child(1) { margin-right: 12px; }
  .tbl.aud td:nth-child(1) .aud-hora, .tbl.aud td:nth-child(1) .cell-sub { display: inline; margin-right: 5px; }
  .tbl.aud td:nth-child(2) .cell-main, .tbl.aud td:nth-child(2) .cell-sub { display: inline; }
  .tbl.aud td:nth-child(2) .avatar { display: none; }
  .tbl.aud td:nth-child(2) .badge { margin-left: 6px; }
  .tbl.aud td:nth-child(3) { margin-top: 7px; }
  .aud-dia { padding: 0 !important; }
  .aud-dia td { padding: 7px 14px !important; }
}

/* ---------- Anexos ---------- */
.anx-lista { display: flex; flex-direction: column; gap: 7px; }
.anx-lista:empty { display: none; }
.anx-item {
  display: flex; align-items: center; gap: 11px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 8px 10px; background: #fff;
}
.anx-item:hover { border-color: var(--border-2); }
.anx-thumb {
  width: 42px; height: 42px; flex: none; border-radius: 6px;
  background: var(--bg) center/cover no-repeat;
  border: 1px solid var(--border);
  display: block;
}
.anx-thumb-ic { display: grid; place-items: center; color: var(--gray); }
.anx-thumb-ic:hover { color: var(--navy); }
.anx-info { flex: 1; min-width: 0; }
.anx-nome {
  display: block; font-size: 13.5px; font-weight: 550; color: var(--navy);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.anx-desc { display: block; font-size: 12px; color: var(--text); }
.anx-meta { display: block; font-size: 11.5px; color: var(--muted); }
.anx-acoes { display: flex; gap: 2px; flex: none; }
.anx-vazio {
  display: flex; align-items: center; gap: 9px; justify-content: center;
  padding: 14px; color: var(--muted); font-size: 13px;
}
.anx-vazio .ic { color: #B9C2D0; }

.anx-zona {
  margin-top: 9px; border: 1px dashed var(--border-2); border-radius: var(--radius-sm);
  padding: 14px; text-align: center; cursor: pointer;
  transition: border-color .12s, background .12s;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.anx-zona:hover, .anx-zona.sobre { border-color: var(--navy-600); background: #FAFBFD; }
.anx-zona.sobre { border-style: solid; background: var(--navy-100); }
.anx-zona-txt { display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--muted); }
.anx-zona-txt .ic { color: var(--gray); }
.anx-zona-txt span { font-size: 13px; color: var(--text); font-weight: 450; }
.anx-zona-txt small { font-size: 11.5px; color: var(--muted); }
.anx-camera { pointer-events: auto; }

.anx-progresso { height: 5px; background: var(--bg); border-radius: 4px; margin-top: 8px; overflow: hidden; }
.anx-progresso > div { height: 100%; width: 0; background: var(--orange); border-radius: 4px; transition: width .15s; }

.anx-btn { position: relative; }
.anx-btn.tem { color: var(--navy); }
.anx-btn-n {
  position: absolute; top: 2px; right: 0;
  background: var(--orange); color: #fff;
  font-size: 9.5px; font-weight: 700; line-height: 1;
  min-width: 14px; height: 14px; border-radius: 7px;
  display: flex; align-items: center; justify-content: center; padding: 0 3px;
}

@media (max-width: 560px) {
  .anx-zona-txt span { font-size: 12.5px; }
  .anx-item { padding: 7px 8px; gap: 9px; }
}

/* ---------- Identidade do cliente e documentos ---------- */
.marca-preview {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: #fff; min-height: 120px; padding: 16px;
  display: flex; align-items: center; justify-content: center;
}
.marca-preview img { max-width: 100%; max-height: 110px; display: block; }
.marca-preview.vazio { flex-direction: column; gap: 8px; color: var(--muted); font-size: 12.5px; border-style: dashed; }
.marca-preview.vazio .ic { color: #B9C2D0; }
.doc-preview { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 20px; background: #fff; }

/* escolha de como a logo se apoia no menu escuro, com prévia real */
.logo-opcoes { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.logo-opcao {
  position: relative; display: block; cursor: pointer;
  border: 1px solid var(--border-2); border-radius: var(--radius-sm);
  padding: 9px; text-align: center; background: #fff;
}
.logo-opcao:hover { border-color: var(--gray); }
.logo-opcao.on { border-color: var(--navy); box-shadow: 0 0 0 2px var(--navy-100); }
.logo-opcao input { position: absolute; opacity: 0; pointer-events: none; }
.logo-opcao b { display: block; font-size: 12px; color: var(--navy); margin-top: 7px; font-weight: 650; }
.logo-opcao small { display: block; font-size: 10.5px; color: var(--muted); line-height: 1.35; margin-top: 2px; }
.logo-amostra {
  display: flex; align-items: center; justify-content: center;
  background: var(--navy); border-radius: 6px; padding: 10px; min-height: 62px;
}
.logo-amostra.placa { background: var(--navy); }
.logo-amostra.placa img { background: #fff; border-radius: 4px; padding: 5px 7px; }
.logo-amostra img { max-width: 100%; max-height: 40px; display: block; }

.doc-timbre {
  display: flex; align-items: center; gap: 20px;
  padding-bottom: 14px; border-bottom: 2px solid var(--navy);
}
.doc-timbre-marca { flex: none; max-width: 240px; }
.doc-timbre-marca img { max-width: 240px; max-height: 74px; display: block; }
.doc-timbre-nome { font-size: 21px; font-weight: 800; color: var(--navy); letter-spacing: -.02em; }
.doc-timbre-dados { display: flex; flex-direction: column; gap: 1px; font-size: 11.5px; color: var(--gray); line-height: 1.5; }
.doc-timbre-dados b { font-size: 13.5px; color: var(--navy); font-weight: 700; }

/* ---------- Documento imprimível ---------- */
.doc {
  max-width: 210mm; margin: 0 auto; background: #fff;
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 26px 30px 34px;
}
.doc-titulo { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 20px 0 16px; }
.doc-titulo h1 { font-size: 19px; font-weight: 750; color: var(--navy); letter-spacing: -.02em; }
.doc-titulo .doc-num { font-size: 26px; font-weight: 800; color: var(--navy); letter-spacing: -.03em; }
.doc-secao { margin-top: 20px; }
.doc-secao > h2 {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  color: var(--gray); padding-bottom: 5px; border-bottom: 1px solid var(--border); margin-bottom: 9px;
}
.doc-campos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px 18px; }
.doc-campos.duas { grid-template-columns: repeat(2, 1fr); }
.doc-campo { font-size: 12.5px; }
.doc-campo dt { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.doc-campo dd { color: var(--text); font-weight: 550; }
.doc-texto { font-size: 12.5px; line-height: 1.6; white-space: pre-wrap; }
table.doc-tbl { width: 100%; border-collapse: collapse; font-size: 12px; }
.doc-tbl th {
  text-align: left; font-size: 10px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); border-bottom: 1px solid var(--border-2); padding: 6px 8px;
}
.doc-tbl td { padding: 6px 8px; border-bottom: 1px solid var(--bg); }
.doc-tbl .num, .doc-tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.doc-tbl tfoot td { border-top: 1px solid var(--border-2); border-bottom: none; font-weight: 700; color: var(--navy); }
.doc-chk { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 18px; font-size: 12px; }
.doc-chk div { display: flex; align-items: center; gap: 7px; padding: 3px 0; }
.doc-chk i {
  width: 11px; height: 11px; border: 1.4px solid var(--gray); border-radius: 2px;
  flex: none; display: inline-block;
}
.doc-chk i.ok { background: var(--navy); border-color: var(--navy); position: relative; }
.doc-chk i.ok::after {
  content: ''; position: absolute; left: 3px; top: 0.5px; width: 3px; height: 6px;
  border: solid #fff; border-width: 0 1.6px 1.6px 0; transform: rotate(42deg);
}
.doc-assinaturas { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 46px; }
.doc-assinatura { border-top: 1px solid var(--text); padding-top: 6px; text-align: center; font-size: 11.5px; }
.doc-assinatura b { display: block; font-size: 12.5px; color: var(--navy); }
.doc-rodape {
  margin-top: 26px; padding-top: 10px; border-top: 1px solid var(--border);
  font-size: 10.5px; color: var(--muted); display: flex; justify-content: space-between; gap: 12px;
}

/* ============================================================
   Aplicativo de campo
   Alvos grandes para dedo com luva, contraste alto para sol.
   ============================================================ */
.campo-body {
  background: var(--bg);
  padding-bottom: calc(66px + env(safe-area-inset-bottom));
  -webkit-tap-highlight-color: rgba(13, 27, 61, .08);
}
.campo-top {
  position: sticky; top: 0; z-index: 30;
  background: var(--navy);
  padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
  display: flex; align-items: center; gap: 12px; min-height: 58px;
}
.campo-voltar {
  width: 40px; height: 40px; flex: none; border-radius: 10px;
  display: grid; place-items: center; color: #fff;
  background: rgba(255, 255, 255, .1); text-decoration: none !important;
}
.campo-marca { flex: 1; min-width: 0; display: flex; align-items: center; }
.campo-marca img {
  max-height: 36px; max-width: 200px; display: block;
  background: #fff; border-radius: 6px; padding: 4px 7px;
}
.campo-marca.sem-placa img { background: none; padding: 0; max-height: 40px; }
.campo-marca span { color: #fff; font-weight: 700; font-size: 15px; letter-spacing: -.01em; }
.campo-status {
  display: flex; align-items: center; gap: 6px;
  font-size: 11.5px; color: #C7D0E2; flex: none;
}

.campo-main { padding: 16px 14px 20px; max-width: 720px; margin: 0 auto; }
.campo-titulo { font-size: 22px; font-weight: 750; color: var(--navy); letter-spacing: -.025em; }
.campo-sub { color: var(--muted); font-size: 13.5px; margin-top: 2px; }
.campo-secao {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
  color: var(--muted); margin: 22px 0 9px;
}
.campo-lista { display: flex; flex-direction: column; gap: 10px; }

.campo-os {
  display: block; background: #fff; border: 1px solid var(--border);
  border-radius: 12px; padding: 13px 14px; text-decoration: none !important;
  color: var(--text); box-shadow: var(--shadow-1);
}
.campo-os:active { background: #F7F9FC; }
.campo-os-topo { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.campo-os-cod { font-size: 12px; font-weight: 750; color: var(--navy); letter-spacing: .02em; }
.campo-os-titulo { font-size: 15px; font-weight: 650; color: var(--navy); line-height: 1.3; }
.campo-os-cliente { font-size: 13px; color: var(--gray); margin-top: 4px; display: flex; align-items: center; gap: 6px; }
.campo-os-rodape {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: 10px; padding-top: 9px; border-top: 1px solid var(--bg); font-size: 12.5px;
}

.campo-tag {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11.5px; font-weight: 650; padding: 3px 9px; border-radius: 14px;
}
.campo-tag.ok { background: var(--green-50); color: var(--green); }
.campo-tag.alerta { background: var(--orange-50); color: #A85C08; }

.campo-os-cabeca { margin-bottom: 16px; }
.campo-os-num { font-size: 12.5px; font-weight: 750; color: var(--orange-600); letter-spacing: .03em; }
.campo-os-cabeca h1 { font-size: 21px; font-weight: 750; color: var(--navy); line-height: 1.22; letter-spacing: -.02em; margin: 2px 0 8px; }
.campo-os-badges { display: flex; gap: 6px; flex-wrap: wrap; }

.campo-card {
  background: #fff; border: 1px solid var(--border); border-radius: 12px;
  padding: 14px; margin-bottom: 12px;
}
.campo-card > h2 {
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--gray); display: flex; align-items: center; gap: 7px; margin-bottom: 11px;
}
.campo-card > h2 .ic { color: var(--gray); }
.campo-card > h2 .campo-tag { margin-left: auto; text-transform: none; letter-spacing: 0; }

.campo-dados { display: flex; flex-direction: column; }
.campo-dados > div { display: flex; justify-content: space-between; gap: 14px; padding: 8px 0; border-bottom: 1px solid var(--bg); font-size: 14px; }
.campo-dados > div:last-child { border-bottom: none; }
.campo-dados dt { color: var(--muted); flex: none; font-size: 13px; }
.campo-dados dd { font-weight: 600; text-align: right; color: var(--text); }
.campo-texto { font-size: 14px; line-height: 1.6; white-space: pre-wrap; color: var(--text); }

.campo-itens { list-style: none; }
.campo-itens li {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 9px 0; border-bottom: 1px solid var(--bg); font-size: 14px;
}
.campo-itens li:last-child { border-bottom: none; }
.campo-itens li span { min-width: 0; }
.campo-itens li small { display: block; font-size: 12px; color: var(--muted); }
.campo-itens li b { flex: none; font-size: 13px; color: var(--navy); }

.campo-aviso {
  display: flex; gap: 8px; align-items: flex-start;
  background: var(--orange-50); border: 1px solid #F3DCBC; border-radius: 9px;
  padding: 10px 12px; font-size: 13px; color: #A85C08; margin-bottom: 10px; line-height: 1.45;
}
.campo-aviso .ic { flex: none; margin-top: 1px; }

.campo-arquivos { display: grid; grid-template-columns: repeat(auto-fill, minmax(94px, 1fr)); gap: 9px; }
.campo-arquivo { text-decoration: none !important; color: var(--text); }
.campo-arq-thumb {
  display: block; width: 100%; aspect-ratio: 1; border-radius: 9px;
  background: var(--bg) center/cover no-repeat; border: 1px solid var(--border);
}
.campo-arq-thumb.ic { display: grid; place-items: center; color: var(--gray); }
.campo-arq-nome {
  display: block; font-size: 11.5px; margin-top: 5px; color: var(--gray);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.campo-form .field { margin-bottom: 15px; }
.campo-form label { font-size: 13.5px; font-weight: 600; color: var(--text); }
.campo-form .input { height: 50px; font-size: 16px; border-radius: 10px; }
.campo-form textarea.input { height: auto; padding: 12px; }
.campo-form select.input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235B6670' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
.campo-duplo { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.campo-form .btn-lg { height: 54px; font-size: 16px; border-radius: 11px; margin-top: 4px; }

.campo-fotos { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; margin-bottom: 9px; }
.campo-fotos:empty { display: none; }
.campo-foto {
  position: relative; aspect-ratio: 1; border-radius: 9px;
  background: var(--bg) center/cover no-repeat; border: 1px solid var(--border);
}
.campo-foto-x {
  position: absolute; top: -6px; right: -6px; width: 24px; height: 24px;
  border-radius: 50%; border: none; background: var(--red); color: #fff;
  font-size: 15px; line-height: 1; cursor: pointer;
}
.campo-offline-aviso {
  display: flex; gap: 8px; align-items: flex-start;
  margin-top: 12px; font-size: 12.5px; color: #A85C08; line-height: 1.45;
}

.campo-vazio {
  text-align: center; padding: 46px 20px; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.campo-vazio .ic { color: #B9C2D0; }
.campo-vazio p { font-size: 14px; max-width: 300px; }
.campo-rodape { text-align: center; font-size: 12px; color: var(--muted); margin: 18px 0 4px; }

.campo-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  background: #fff; border-top: 1px solid var(--border);
  display: flex; padding-bottom: env(safe-area-inset-bottom);
}
.campo-nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 9px 4px 8px; color: var(--muted); text-decoration: none !important;
  font-size: 11px; font-weight: 600;
}
.campo-nav a.on { color: var(--navy); }
.campo-nav a.on .ic { color: var(--orange); }

@media (min-width: 720px) {
  .campo-nav { position: sticky; border-radius: 0; }
}

/* ---------- Print ---------- */
@media print {
  .sidebar, .topbar, .ai-drawer, .toast-root, .page-actions, .impersonate-bar,
  .modal-root, .overlay, .doc-acoes { display: none !important; }
  .content { padding: 0; max-width: none; }
  .card { box-shadow: none; }
  body { background: #fff; font-size: 12px; }
  .doc { max-width: none; border: none; border-radius: 0; padding: 0; }
  .doc-secao { break-inside: avoid; }
  .doc-assinaturas { break-inside: avoid; }
  @page { size: A4; margin: 14mm 12mm; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .grid-4 { grid-template-columns: 1fr 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .sidebar { position: fixed; left: calc(-1 * var(--side-w) - 10px); transition: left .2s ease; box-shadow: var(--shadow-3); }
  .sidebar.open { left: 0; }
  .menu-toggle { display: inline-flex; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
  .form-grid { grid-template-columns: 1fr; }
  .content { padding: 16px 14px 60px; }
  .user-meta { display: none; }
  .top-search { max-width: none; }
}

/* Página de descadastro: fica fora do sistema, sem menu nem sessão. */
.descad-wrap {
  max-width: 460px; margin: 0 auto; padding: 56px 18px;
  display: flex; flex-direction: column; justify-content: center; min-height: 100vh;
}

/* Preferências de aviso por e-mail (Meu perfil) */
.pref-grupo {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); margin: 14px 0 6px; padding-bottom: 5px;
  border-bottom: 1px solid var(--border);
}
.pref-grupo:first-of-type { margin-top: 4px; }
.pref-item {
  display: flex; gap: 10px; align-items: flex-start; padding: 9px 0;
  border-bottom: 1px solid var(--border); cursor: pointer;
}
.pref-item:last-child { border-bottom: 0; }
.pref-item input { margin-top: 3px; accent-color: var(--orange); cursor: pointer; flex: none; }
.pref-item input:disabled { cursor: default; }
.pref-item b { display: inline; font-size: 13.5px; color: var(--navy); font-weight: 600; }
.pref-item small { display: block; font-size: 12px; color: var(--muted); line-height: 1.5; margin-top: 2px; }

/* ---------- Contas a receber / a pagar ---------- */
.ct-grid { grid-template-columns: 1fr 320px; gap: 16px; align-items: start; }
@media (max-width: 1100px) { .ct-grid { grid-template-columns: 1fr; } }

.ct-faixa td {
  background: #FAFBFD; font-size: 11.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: var(--muted); padding: 7px 14px !important;
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.ct-faixa td b { color: var(--navy); }
.ct-sel { accent-color: var(--orange); cursor: pointer; }

/* Concentração: mostra de relance quem responde pela maior parte do saldo em aberto. */
.ct-barra { margin-bottom: 11px; }
.ct-barra:last-child { margin-bottom: 0; }
.ct-barra-topo {
  display: flex; justify-content: space-between; gap: 10px; align-items: baseline;
  font-size: 12.5px; margin-bottom: 4px;
}
.ct-barra-topo span {
  color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ct-barra-topo b { color: var(--navy); font-variant-numeric: tabular-nums; flex: none; }
.ct-barra-trilho { height: 5px; background: var(--bg); border-radius: 3px; overflow: hidden; }
.ct-barra-trilho span { display: block; height: 100%; background: var(--navy); border-radius: 3px; }

/* ---------- Conciliação bancária ---------- */
.conc-frase { font-size: 12px; color: var(--muted); line-height: 1.5; margin-top: 4px; }
.conc-cand { margin-top: 6px; }
.conc-cand label {
  display: flex; gap: 8px; align-items: flex-start; cursor: pointer;
  background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 6px 9px;
}
.conc-cand input { margin-top: 3px; accent-color: var(--orange); flex: none; cursor: pointer; }
.conc-cand b { display: block; font-size: 12.5px; color: var(--navy); font-weight: 600; }
.conc-cand small { display: block; font-size: 11.5px; color: var(--muted); margin-top: 1px; }

/* ---------- Esteira de produção ---------- */
.est-barra { display: flex; flex-direction: column; gap: 6px; }
.est-barra-trilho { height: 7px; background: var(--bg); border-radius: 4px; overflow: hidden; }
.est-barra-trilho span { display: block; height: 100%; background: var(--navy); border-radius: 4px; }
.est-barra-txt { font-size: 12.5px; color: var(--muted); }

.est-produto {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); margin: 14px 0 6px; padding-bottom: 4px; border-bottom: 1px solid var(--border);
}
.est-produto:first-of-type { margin-top: 0; }

/* Cada etapa é uma linha com um marcador que conta a situação sem depender de cor sozinha. */
.est-item { display: flex; gap: 10px; align-items: center; padding: 7px 0; }
.est-marca {
  width: 11px; height: 11px; border-radius: 50%; flex: none;
  border: 2px solid var(--border-2); background: #FFF;
}
.est-andamento .est-marca { border-color: var(--orange); background: var(--orange); box-shadow: 0 0 0 3px var(--orange-50); }
.est-concluida .est-marca { border-color: var(--green); background: var(--green); }
.est-dispensada .est-marca { border-style: dashed; }
.est-corpo { flex: 1; min-width: 0; }
.est-nome { display: block; font-size: 13.5px; color: var(--text); }
.est-concluida .est-nome { color: var(--muted); }
.est-andamento .est-nome { font-weight: 650; color: var(--navy); }
.est-dispensada .est-nome { color: var(--gray); text-decoration: line-through; }
.est-meta { display: block; font-size: 11.5px; color: var(--muted); margin-top: 1px; }

/* Painel da esteira: colunas por etapa, para ver onde o trabalho acumula. */
.est-painel {
  display: flex; gap: 14px; overflow-x: auto; padding-bottom: 8px; align-items: flex-start;
}
.est-coluna { flex: 0 0 268px; min-width: 268px; }
.est-coluna-topo {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); padding: 0 2px 8px; border-bottom: 2px solid var(--border);
  margin-bottom: 10px;
}
.est-cartao {
  display: block; background: #FFF; border: 1px solid var(--border); border-radius: 9px;
  padding: 11px 12px; margin-bottom: 9px; text-decoration: none; color: inherit;
  transition: border-color .12s, box-shadow .12s;
}
.est-cartao:hover { border-color: var(--border-2); box-shadow: 0 2px 8px rgba(13,27,61,.07); }
.est-cartao-topo { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.est-cartao-topo b { font-size: 12.5px; color: var(--navy); }
.est-cartao-titulo {
  font-size: 13px; color: var(--text); margin: 6px 0 2px; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.est-cartao-sub { font-size: 11.5px; color: var(--muted); margin-bottom: 8px; }
.est-cartao-pe {
  display: flex; justify-content: space-between; gap: 8px;
  font-size: 11.5px; color: var(--muted); margin-top: 6px;
}
.est-cartao-alerta {
  display: flex; align-items: center; gap: 5px; margin-top: 7px;
  font-size: 11.5px; color: var(--red); font-weight: 600;
}

/* Editor da esteira de um produto */
.est-edit {
  display: flex; gap: 8px; align-items: center; padding: 6px 0;
  border-bottom: 1px solid var(--border);
}
.est-edit:last-child { border-bottom: 0; }
.est-edit-num {
  width: 22px; height: 22px; flex: none; border-radius: 50%; background: var(--bg);
  color: var(--muted); font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.est-nome-in { flex: 1; }
.est-dias-in { width: 82px; flex: none; }

/* ---------- Férias e alocações ---------- */
.fer-item, .aloc-item {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  font-size: 12.5px; padding: 4px 0;
}
.fer-item + .fer-item, .aloc-item + .aloc-item { border-top: 1px solid var(--border); }
.aloc-item .ic { color: var(--muted); flex: none; }
.aloc-ferias { color: var(--orange-600); }
.aloc-ferias .ic { color: var(--orange); }

/* ---------- Conferência e inspeção ---------- */
.ck-lista { display: flex; flex-direction: column; gap: 5px; }
.ck-item {
  display: flex; gap: 10px; align-items: center; justify-content: space-between;
  padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 13px;
}
.ck-item:last-child { border-bottom: 0; }
.ck-item span { flex: 1; color: var(--text); }
.ck-item .ck-sit { width: 150px; flex: none; }

/* ---------- cronograma de medição no fechamento da venda ---------- */
.crono {
  margin-top: 14px; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px; background: #FAFBFD;
}
.crono[hidden] { display: none; }
.crono-topo { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.crono-topo b { font-size: 13px; color: var(--navy); display: flex; align-items: center; gap: 6px; flex: 1; }
.crono-topo .select { width: auto; height: 34px; font-size: 13px; }
/* Cada parcela e um cartaozinho: a descricao precisa de largura, e numa unica linha
   ela ficava cortada em "Entrada — as". Descricao em cima, numeros embaixo. */
.crono-linha {
  display: grid; gap: 6px; align-items: center; margin-bottom: 6px;
  grid-template-columns: 92px 1fr auto 28px;
  grid-template-areas: "desc desc desc del" "pct data valor valor";
  padding: 8px; border: 1px solid var(--border); border-radius: 8px; background: #fff;
}
.crono-linha .input[name="crono_desc[]"] { grid-area: desc; }
.crono-linha .crono-pct { grid-area: pct; }
.crono-linha .input[type="date"] { grid-area: data; }
.crono-linha .crono-valor { grid-area: valor; }
.crono-linha [data-crono-del] { grid-area: del; }
.crono-linha .input { height: 34px; font-size: 13px; }
.crono-pct { position: relative; }
.crono-pct .input { padding-right: 22px; text-align: right; }
.crono-pct span { position: absolute; right: 8px; top: 8px; font-size: 12px; color: var(--muted); }
.crono-valor { font-size: 13px; font-weight: 700; color: var(--navy); text-align: right; }
.crono-resumo { margin-top: 8px; font-size: 12px; font-weight: 650; }
.crono-resumo.ok { color: var(--green, #1B7F4C); }
.crono-resumo.alerta { color: var(--red, #C0392B); }
@media (max-width: 560px) {
  .crono-linha { grid-template-columns: 80px 1fr 28px; grid-template-areas: 'desc desc del' 'pct data data' 'valor valor valor'; }
  .crono-linha .crono-valor { text-align: left; }
}
.crono-prazo { display: flex; align-items: center; gap: 8px; }
.crono-prazo .input { width: 96px; text-align: right; }
.crono-prazo span { font-size: 13px; color: var(--muted); }

/* ---------- páginas legais públicas (termos e privacidade) ---------- */
.legal-wrap { max-width: 780px; margin: 0 auto; padding: 28px 20px 60px; }
.legal-head { display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; padding-bottom: 18px; border-bottom: 1px solid var(--border); }
.legal-logo { display: inline-flex; text-decoration: none; }
.legal-nav { display: flex; gap: 16px; }
.legal-nav a { font-size: 13px; color: var(--muted); text-decoration: none; }
.legal-nav a:hover { color: var(--navy); text-decoration: underline; }
.legal-doc { padding-top: 26px; color: var(--txt); }
.legal-doc h1 { font-size: 26px; line-height: 1.25; margin: 0 0 6px; color: var(--navy); }
.legal-sub { font-size: 14px; color: var(--muted); margin: 0 0 28px; }
.legal-doc h2 { font-size: 15px; margin: 30px 0 8px; color: var(--navy); }
.legal-doc p, .legal-doc li { font-size: 14px; line-height: 1.65; }
.legal-doc p { margin: 0 0 10px; }
.legal-doc ul { margin: 0 0 12px; padding-left: 20px; }
.legal-doc li { margin-bottom: 5px; }
.legal-doc a { color: var(--navy); }
.legal-hr { border: 0; border-top: 1px solid var(--border); margin: 34px 0 16px; }
.legal-foot { font-size: 13px; color: var(--muted); }
.legal-foot p { margin: 0 0 4px; }
.legal-data { font-size: 12px; }
@media (max-width: 560px) { .legal-doc h1 { font-size: 22px; } }
.auth-legal { margin: 10px 0 0; font-size: 12px; display: flex; gap: 8px;
  justify-content: center; color: var(--muted); }
.auth-legal a { color: var(--muted); text-decoration: none; }
.auth-legal a:hover { color: var(--navy); text-decoration: underline; }
.auth-legal-ent { margin: 6px 0 0; font-size: 11px; line-height: 1.5;
  text-align: center; color: var(--muted); opacity: .85; }
.side-legal { display: flex; gap: 6px; font-size: 11px; margin-top: 4px; opacity: .7; }
.side-legal a { color: inherit; text-decoration: none; }
.side-legal a:hover { text-decoration: underline; }
