/* ============================================================
   VR Projetos — Sistema Interno
   Design pareado 100% com pre_venda/design/prototipo/
   ShellA · ERP corporativo denso · Paleta VR orange + warm gray
   ============================================================ */

/* ── Fonts ── */
/* IBM Plex self-hospedado em public/vendor/ibm-plex/ (subsets latin + latin-ext).
   Nao usar @import do Google Fonts: o CSP (src/core/SecurityHeaders.php) so
   permite style-src/font-src 'self'. Peso 800 do Sans nao existe no Google
   Fonts — o browser sintetiza a partir do 700, mesmo comportamento de antes.
   Caminho RELATIVO (../vendor/) e obrigatorio: em producao o sistema roda numa
   subpasta (/adm), entao um /vendor/... absoluto apontaria para a raiz do
   dominio e as fontes dariam 404. */
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../vendor/ibm-plex/ibm-plex-mono-400-latin-ext.woff2') format('woff2');
  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;
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../vendor/ibm-plex/ibm-plex-mono-400-latin.woff2') format('woff2');
  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: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../vendor/ibm-plex/ibm-plex-mono-500-latin-ext.woff2') format('woff2');
  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;
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../vendor/ibm-plex/ibm-plex-mono-500-latin.woff2') format('woff2');
  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: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../vendor/ibm-plex/ibm-plex-mono-600-latin-ext.woff2') format('woff2');
  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;
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../vendor/ibm-plex/ibm-plex-mono-600-latin.woff2') format('woff2');
  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: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url('../vendor/ibm-plex/ibm-plex-sans-300-latin-ext.woff2') format('woff2');
  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;
}
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url('../vendor/ibm-plex/ibm-plex-sans-300-latin.woff2') format('woff2');
  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: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../vendor/ibm-plex/ibm-plex-sans-400-latin-ext.woff2') format('woff2');
  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;
}
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../vendor/ibm-plex/ibm-plex-sans-400-latin.woff2') format('woff2');
  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: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../vendor/ibm-plex/ibm-plex-sans-500-latin-ext.woff2') format('woff2');
  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;
}
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../vendor/ibm-plex/ibm-plex-sans-500-latin.woff2') format('woff2');
  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: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../vendor/ibm-plex/ibm-plex-sans-600-latin-ext.woff2') format('woff2');
  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;
}
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../vendor/ibm-plex/ibm-plex-sans-600-latin.woff2') format('woff2');
  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: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../vendor/ibm-plex/ibm-plex-sans-700-latin-ext.woff2') format('woff2');
  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;
}
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../vendor/ibm-plex/ibm-plex-sans-700-latin.woff2') format('woff2');
  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;
}

/* ── Design Tokens (VR) ── */
:root {
  --bg-page: #f6f4ef;
  --bg-surface: #ffffff;
  --bg-muted: #f3f1ec;
  --bg-subtle: #faf8f3;
  --bg-dark: #1f1c17;
  --line: #e5e0d6;
  --line-mid: #d4cfc4;
  --line-strong: #9a948a;
  --ink: #29251f;
  --ink-mid: #6f6a62;
  --ink-faint: #a8a39a;
  --ink-ghost: #cfcabf;
  --orange: #f37021;
  --orange-deep: #c45413;
  --orange-tint: #fdeadb;
  --blue: #1b6bb0;
  --blue-deep: #13507f;
  --blue-tint: #e1ecf7;
  --green: #2d8a4a;
  --green-tint: #e2efe5;
  --yellow: #caa325;
  --yellow-tint: #f6eecf;
  --red: #c14a3a;
  --red-tint: #f5e1dc;
  --purple: #7e4ec1;
  --purple-tint: #ece3f5;
  --sidebar-w: 240px;
  --radius: 6px;
  --radius-lg: 8px;
  --radius-full: 999px;
  --font: 'IBM Plex Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
  --bg-hover: #f0ede6;
  --shadow-sm: 0 2px 6px rgba(0, 0, 0, .06), 0 1px 2px rgba(0, 0, 0, .04);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, .08), 0 2px 6px rgba(0, 0, 0, .04);
  --shadow-lg: 0 30px 60px rgba(0, 0, 0, .10), 0 4px 16px rgba(0, 0, 0, .06);
  --focus-ring: rgba(243, 112, 33, .18);
  --focus-ring-error: rgba(193, 74, 58, .18);
}

/* ── Reset ── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 15px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg-page);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--blue);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

input,
select,
textarea,
button {
  font: inherit;
}

img,
svg {
  display: block;
  max-width: 100%;
}

/* ── Acessibilidade ── */
.pular-conteudo {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 9999;
}

.pular-conteudo:focus {
  left: 8px;
  top: 8px;
  background: var(--orange);
  color: #fff;
  padding: 7px 14px;
  border-radius: var(--radius);
}

/* ── Badge de ambiente ── */
.badge-ambiente {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  padding: 4px 12px;
  margin: 6px 14px 4px;
  border-radius: 30px;
}

.badge-ambiente-hml {
  background: var(--yellow-tint);
  color: var(--yellow);
}

/* ── Layout App (ShellA) ── */
.aplicacao {
  display: flex;
  min-height: 100vh;
}

/* ── Desktop TopBar (ShellA — always visible, matching vr-primitives.jsx TopBar) ── */
.topbar-desktop {
  display: flex;
  align-items: center;
  height: 56px;
  padding: 0 24px;
  gap: 16px;
  background: var(--bg-surface);
  color: var(--ink);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.tb-search {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 36px;
  padding: 0 12px;
  background: var(--bg-muted);
  border-radius: var(--radius);
  flex: 1;
  max-width: 480px;
  color: var(--ink-mid);
  font-size: 13px;
  position: relative;
}

.tb-search kbd {
  margin-left: auto;
  font-size: 11px;
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-family: var(--font);
  color: var(--ink-faint);
}

.tb-spacer {
  flex: 1;
}

.tb-bell {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--ink-mid);
  position: relative;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tb-bell:hover {
  background: var(--bg-muted);
}



.tb-user-wrap {
  position: relative;
}

.tb-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 12px 4px 4px;
  border-radius: 22px;
  background: var(--bg-muted);
  border: 1px solid transparent;
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: border-color .14s, background .14s;
}

.tb-user:hover {
  border-color: var(--line-mid);
}

.tb-user[aria-expanded="true"] {
  border-color: var(--line-strong);
  background: var(--bg-subtle);
}

.tb-user[aria-expanded="true"] .tb-chev {
  transform: rotate(180deg);
}

.tb-chev {
  transition: transform .18s;
  font-size: 10px;
}

.tb-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--red-tint);
  color: var(--ink-mid);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  flex: 0 0 auto;
}

.tb-avatar-img {
  object-fit: cover;
}

.tb-user-info {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
  align-items: flex-start;
}

.tb-user-nome {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
}

.tb-user-role {
  font-size: 11px;
  color: var(--ink-faint);
}

/* ── TopBar User Dropdown ── */
.tb-user-dropdown {
  position: absolute;
  top: calc(100% + 2px);
  right: 0;
  min-width: 210px;
  background: var(--bg-surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  z-index: 400;
  overflow: hidden;
}

.tbd-header {
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tbd-nome {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.tbd-role {
  font-size: 12px;
  color: var(--ink-mid);
}

.tbd-divider {
  height: 1px;
  background: var(--line);
}

.tbd-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  font-size: 13px;
  color: var(--ink);
  background: none;
  border: none;
  width: 100%;
  cursor: pointer;
  font: inherit;
  text-align: left;
  text-decoration: none;
  transition: background .1s;
}

.tbd-item:hover {
  background: var(--bg-muted);
  text-decoration: none;
}

.tbd-item svg,
.tbd-item i {
  flex: 0 0 auto;
  color: var(--ink-mid);
  font-size: 14px;
}

.tbd-sair {
  color: var(--red);
}

.tbd-sair svg {
  color: var(--red);
}

.tbd-sair-form {
  margin: 0;
}

/* ── Search input dentro da topbar ── */
.tb-search-input {
  flex: 1;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  outline: none;
  min-width: 0;
}

.tb-search-input::placeholder {
  color: var(--ink-faint);
}

.tb-search-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--bg-surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 24px rgba(0,0,0,.08), 0 2px 6px rgba(0,0,0,.04);
  z-index: 500;
  max-height: 360px;
  overflow-y: auto;
}

.tb-search-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  transition: background .1s;
}

.tb-search-dropdown-item:hover,
.tb-search-dropdown-item.destaque {
  background: var(--bg-muted);
  text-decoration: none;
}

.tb-search-dropdown-item i {
  width: 16px;
  color: var(--ink-faint);
  font-size: 13px;
}

.tb-search-dropdown-item .sdi-info {
  color: var(--ink-mid);
  font-size: 11px;
  margin-left: auto;
}

.tb-search-dropdown-vazio {
  padding: 20px 14px;
  text-align: center;
  color: var(--ink-faint);
  font-size: 13px;
}

/* Main area wrapper (TopBar + Content) */
.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Topbar mobile — only visible on small screens */
.topbar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 200;
  background: var(--bg-surface);
  color: var(--ink);
  border-bottom: 1px solid var(--line);
  height: 56px;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
}

.topbar-menu {
  background: none;
  border: none;
  color: var(--ink-mid);
  font-size: 22px;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  border-radius: var(--radius);
}

.topbar-menu:hover {
  background: var(--bg-muted);
}

.topbar-marca {
  font-weight: 700;
  font-size: 15px;
  color: var(--orange);
}

.topbar-marca em {
  font-style: normal;
  font-weight: 400;
  opacity: .65;
  font-size: .85em;
}

/* ── Sidebar (ShellA variant — light, 240px, classic ERP) ── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg-surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--line-mid) transparent;
}

.sidebar-marca {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 18px 10px;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  cursor: pointer;
}
.sidebar-marca:hover {
  background: var(--bg-hover);
  text-decoration: none;
}

.marca-bloco {
  background: var(--orange);
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  flex-shrink: 0;
}

.marca-texto {
  color: var(--ink);
  font-weight: 700;
  font-size: 13px;
  line-height: 1.15;
  letter-spacing: .02em;
}

.marca-texto small {
  display: block;
  font-weight: 400;
  font-size: 10px;
  color: var(--ink-faint);
  letter-spacing: .04em;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
}

.nav-grupo {
  color: var(--ink-faint);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  padding: 16px 10px 6px;
}

.nav-pai {
  display: flex; align-items: center; gap: 10px;
  width: 100%; height: 34px; padding: 0 10px 0 8px; border-radius: 5px;
  color: var(--ink); font-size: 13px; font-family: var(--font);
  border: none; border-left: 2px solid transparent; margin-bottom: 2px;
  background: none; cursor: pointer;
  transition: background .12s, color .12s;
}
.nav-pai:hover { background: var(--bg-muted); color: var(--ink); }
.nav-pai-chev { transition: transform .18s; flex: 0 0 auto; color: var(--ink-faint); font-size: 11px; }
.nav-pai[aria-expanded="true"] .nav-pai-chev { transform: rotate(180deg); }
.nav-pai .nav-icon { min-width: 20px; text-align: center; color: var(--ink-mid); opacity: 0.8; font-size: 15px; }

.nav-filhos {
  display: flex;
  flex-direction: column;
  max-height: 300px; opacity: 1;
  overflow: hidden;
  transition: none;
}
.nav-filhos.recolhido { max-height: 0; opacity: 0; }
.nav-filhos.animado {
  transition: max-height .3s ease, opacity .2s ease;
}
.nav-filhos a:not(.ativo) { border-left-color: transparent; }
.nav-filhos a { margin-left: 26px; }

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 34px;
  padding: 0 10px 0 8px;
  border-radius: 5px;
  color: var(--ink);
  font-size: 13px;
  border-left: 2px solid transparent;
  transition: background .12s, color .12s;
}

.sidebar-nav a:hover {
  background: var(--bg-muted);
  color: var(--ink);
  text-decoration: none;
}

.sidebar-nav a.ativo {
  background: var(--orange-tint);
  color: var(--orange-deep);
  font-weight: 500;
  border-left-color: var(--orange);
}

.nav-icon {
  font-size: 15px;
  min-width: 20px;
  text-align: center;
  color: var(--ink-mid);
  opacity: 0.8;
}

.sidebar-nav a.ativo .nav-icon {
  color: var(--orange-deep);
  opacity: 1;
}

.nav-count {
  margin-left: auto;
  font-size: 11px;
  color: var(--ink-faint);
  background: var(--bg-muted);
  padding: 1px 6px;
  border-radius: 4px;
}

.sidebar-nav a.ativo .nav-count {
  background: transparent;
}

.nav-link-sec {
  display: flex; align-items: center; gap: 10px;
  height: 32px; padding: 0 10px; border-radius: 5px;
  color: var(--ink-mid); font-size: 13px; text-decoration: none;
  transition: background .12s, color .12s;
}
.nav-link-sec:hover { background: var(--bg-muted); color: var(--ink); text-decoration: none; }
.nav-link-sec.ativo { background: var(--bg-muted); color: var(--ink); font-weight: 500; }
.nav-link-sec .nav-icon { color: var(--ink-faint); }
.nav-link-sec.ativo .nav-icon { color: var(--ink); }

.sidebar-usuario {
  border-top: 1px solid var(--line);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-usuario .avatar-placeholder {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-muted);
  color: var(--ink-mid);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  flex: 0 0 auto;
}

.usuario-info {
  flex: 1;
  line-height: 1.15;
  min-width: 0;
}

.usuario-nome {
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.usuario-login {
  color: var(--ink-faint);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.usuario-acoes {
  margin-top: 8px;
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.usuario-acoes a,
.ligacao-logout {
  color: var(--ink-mid);
  font-size: 12px;
}

.usuario-acoes a:hover,
.ligacao-logout:hover {
  color: var(--ink);
  text-decoration: none;
}

.sidebar-fundo {
  display: none;
}

/* ── Sidebar Collapse (desktop only) ── */
@media (min-width: 901px) {
  .sidebar {
    transition: width .22s ease;
  }
  .sidebar-collapse-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 34px;
    border: none; background: none;
    color: var(--ink-faint);
    cursor: pointer;
    border-top: 1px solid var(--line);
    transition: color .12s;
    flex-shrink: 0;
  }
  .sidebar-collapse-btn:hover { color: var(--ink); }

  .sidebar--collapsed { --sidebar-w: 60px; }
  .sidebar--collapsed .marca-texto,
  .sidebar--collapsed .badge-ambiente,
  .sidebar--collapsed .nav-grupo,
  .sidebar--collapsed .nav-pai-chev,
  .sidebar--collapsed .nav-count { display: none !important; }

  /* Submenu items viram ícones no modo recolhido */
  .sidebar--collapsed .nav-filhos {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    max-height: none !important;
    opacity: 1 !important;
    overflow: visible;
  }
  .sidebar--collapsed .nav-filhos.recolhido {
    display: flex !important;
    max-height: none !important;
    opacity: 1 !important;
    overflow: visible !important;
  }
  .sidebar--collapsed .nav-filhos a { margin-left: 0; }

  .sidebar--collapsed .sidebar-marca { justify-content: center; padding: 10px 0; }

  .sidebar--collapsed .sidebar-nav {
    padding: 10px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
  }

  .sidebar--collapsed .sidebar-nav a,
  .sidebar--collapsed .nav-pai,
  .sidebar--collapsed .nav-link-sec {
    width: 42px;
    height: 36px;
    padding: 0 !important;
    justify-content: center;
    border-radius: 8px;
    border-left: none !important;
    font-size: 0;
  }

  .sidebar--collapsed .nav-pai { gap: 0; }

  .sidebar--collapsed .sidebar-nav a .nav-icon,
  .sidebar--collapsed .nav-pai .nav-icon,
  .sidebar--collapsed .nav-link-sec .nav-icon {
    font-size: 18px;
    min-width: unset;
    margin: 0;
  }

  .sidebar--collapsed .sidebar-nav a.ativo {
    background: var(--orange-tint);
    border-left: none !important;
  }

  .sidebar--collapsed .sidebar-nav a.ativo .nav-icon {
    color: var(--orange-deep);
    opacity: 1;
  }

  .sidebar--collapsed .sidebar-nav a:hover,
  .sidebar--collapsed .nav-pai:hover,
  .sidebar--collapsed .nav-link-sec:hover {
    background: var(--bg-muted);
  }
}

/* ── Page Header (vr-primitives.jsx PageHeader component) ── */
.pg-header {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--line);
  padding: 20px 28px;
  display: flex;
  align-items: flex-end;
  gap: 16;
}

.pg-header-body {
  flex: 1;
}

.pg-header-crumbs {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-mid);
  margin-bottom: 6px;
}

.pg-header-crumbs .crumb {
  color: var(--ink-mid);
}

.pg-header-crumbs .crumb-curr {
  color: var(--ink);
}

.pg-header-title {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.3px;
}

.pg-header-sub {
  margin-top: 4px;
  font-size: 13px;
  color: var(--ink-mid);
}

.pg-header-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* ── Content ── */
.conteudo {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.conteudo-inner {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px 60px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ── Stat Card (vr-primitives.jsx Stat component) ── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.stat-grid-5 {
  grid-template-columns: repeat(5, 1fr);
}

/* Ficha de detalhe (_ficha-financeira.php): número de stats varia por módulo
   (Entradas tem 2, Saídas/Histórico têm 3). Coluna fixa por contagem cortava
   o valor em dinheiro quando cabiam 3+ na linha — deixa cada stat com largura
   mínima de leitura e empurra o que não cabe pra próxima linha. */
.stat-grid-fluido {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.stat {
  background: var(--bg-surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stat-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stat-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.stat-icon svg {
  width: 15px;
  height: 15px;
}

.stat-icon i {
  font-size: 15px;
}

.stat-icon-default {
  background: var(--bg-muted);
  color: var(--ink-mid);
}

.stat-icon-orange {
  background: var(--orange);
  color: #fff;
}

.stat-icon-blue {
  background: var(--blue);
  color: #fff;
}

.stat-icon-green {
  background: var(--green);
  color: #fff;
}

.stat-icon-red {
  background: var(--red);
  color: #fff;
}

.stat-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-mid);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--ink);
  white-space: nowrap;
}

.stat-delta {
  font-size: 12px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.stat-delta-up {
  color: var(--green);
}

.stat-delta-down {
  color: var(--red);
}

.stat-sub {
  font-size: 12px;
  color: var(--ink-faint);
}

/* ── Card (vr-primitives.jsx Card component) ── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 12px;
}

.card-header-body {
  flex: 1;
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.card-sub {
  font-size: 12px;
  color: var(--ink-mid);
  margin-top: 2px;
}

.card-actions {
  flex-shrink: 0;
}

.card-body {
  padding: 20px;
}

.card-body-pad-0 {
  padding: 0;
}

.card-body-pad-14 {
  padding: 14px;
}

.card-body-pad-16 {
  padding: 16px;
}

.card-destaque {
  border-color: var(--orange);
}

/* ── Content grid layouts ── */
.grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.grid-1-1 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.chart-container canvas {
  width: 100% !important;
  height: 280px !important;
}

.grid-3col {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.grid-4col {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

/* ── Layout de detalhe: conteúdo principal + sidebar de metadados ── */
.grid-detalhe {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
  align-items: start;
}

@media (max-width: 900px) {
  .grid-detalhe {
    grid-template-columns: 1fr;
  }
}

.flex-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ── Status / Tags (vr-primitives.jsx Tag component) ── */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
}

.tag-dot {
  width: 6px;
  height: 6px;
  border-radius: 3px;
  flex: 0 0 auto;
}

.tag-rascunho {
  background: var(--bg-muted);
  color: var(--ink-mid);
}

.tag-rascunho .tag-dot {
  background: var(--ink-mid);
}

.tag-analise {
  background: var(--blue-tint);
  color: var(--blue);
}

.tag-analise .tag-dot {
  background: var(--blue);
}

.tag-aprovado {
  background: var(--green-tint);
  color: var(--green);
}

.tag-aprovado .tag-dot {
  background: var(--green);
}

.tag-captacao {
  background: var(--orange-tint);
  color: var(--orange-deep);
}

.tag-captacao .tag-dot {
  background: var(--orange);
}

.tag-execucao {
  background: var(--purple-tint);
  color: var(--purple);
}

.tag-execucao .tag-dot {
  background: var(--purple);
}

.tag-concluido {
  background: var(--bg-muted);
  color: var(--ink-mid);
}

.tag-concluido .tag-dot {
  background: var(--ink-mid);
}

.tag-pendente {
  background: var(--yellow-tint);
  color: var(--yellow);
}

.tag-pendente .tag-dot {
  background: var(--yellow);
}

.tag-reprovado {
  background: var(--red-tint);
  color: var(--red);
}

.tag-reprovado .tag-dot {
  background: var(--red);
}

.tag-ok {
  background: var(--green-tint);
  color: var(--green);
}

.tag-ok .tag-dot {
  background: var(--green);
}

.tag-enviada {
  background: var(--blue-tint);
  color: var(--blue);
}

.tag-enviada .tag-dot {
  background: var(--blue);
}

.tag-diligencia {
  background: var(--yellow-tint);
  color: var(--yellow);
}

.tag-diligencia .tag-dot {
  background: var(--yellow);
}

.tag-recusada {
  background: var(--red-tint);
  color: var(--red);
}

.tag-recusada .tag-dot {
  background: var(--red);
}

.tag-recebido {
  background: var(--green-tint);
  color: var(--green);
}

.tag-recebido .tag-dot {
  background: var(--green);
}

.tag-atrasado {
  background: var(--red-tint);
  color: var(--red);
}

.tag-atrasado .tag-dot {
  background: var(--red);
}

/* ── Chip (vr-primitives.jsx Chip component) ── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: var(--bg-muted);
  color: var(--ink-mid);
  font-size: 12px;
  border: 1px solid var(--line);
}

.chip-dot {
  width: 6px;
  height: 6px;
  border-radius: 3px;
  flex: 0 0 auto;
}

.chip-orange {
  background: var(--orange-tint);
  color: var(--orange-deep);
  border-color: var(--orange-tint);
}

.chip-blue {
  background: var(--blue-tint);
  color: var(--blue);
  border-color: var(--blue-tint);
}

.chip-green {
  background: var(--green-tint);
  color: var(--green);
  border-color: var(--green-tint);
}

.chip-red {
  background: var(--red-tint);
  color: var(--red);
  border-color: var(--red-tint);
}

.chip-purple {
  background: var(--purple-tint);
  color: var(--purple);
  border-color: var(--purple-tint);
}

.chip-yellow {
  background: var(--yellow-tint);
  color: var(--yellow);
  border-color: var(--yellow-tint);
}

/* ── Buttons (vr-primitives.jsx Btn component) ── */
.btn[hidden] {
  display: none;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius);
  font-family: var(--font);
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background .14s, color .14s, border-color .14s;
  text-decoration: none;
  line-height: 1;
  padding: 0 12px;
}

.btn:hover {
  text-decoration: none;
}

.btn:disabled {
  opacity: .6;
  cursor: not-allowed;
}

.btn-sm {
  height: 30px;
  padding: 0 12px;
  font-size: 13px;
}

.btn-icon {
  width: 30px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-sm.btn-icon {
  width: 30px;
}

.btn-md.btn-icon {
  width: 38px;
}

.btn-md {
  height: 38px;
  padding: 0 16px;
  font-size: 14px;
}

.btn-lg {
  height: 46px;
  padding: 0 22px;
  font-size: 15px;
}

.btn-primary {
  background: var(--orange);
  color: #fff;
  border: 1px solid var(--orange);
}

.btn-primary:hover {
  background: var(--orange-deep);
  border-color: var(--orange-deep);
  color: #fff;
}

.btn-secondary {
  background: var(--bg-surface);
  color: var(--ink);
  border: 1px solid var(--line-strong);
}

.btn-secondary:hover {
  background: var(--bg-muted);
}

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid transparent;
}

.btn-ghost:hover {
  background: var(--bg-muted);
}

.btn-outline {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line-mid);
}

.btn-outline:hover {
  background: var(--bg-muted);
}

.btn-danger {
  background: var(--red);
  color: #fff;
  border: 1px solid var(--red);
}

.btn-danger:hover {
  background: #7a2116;
  border-color: #7a2116;
}

.btn-dark {
  background: var(--ink);
  color: #fff;
  border: 1px solid var(--ink);
}

.btn-xlsx {
  background: var(--green);
  color: #fff;
  border: 1px solid var(--green);
}

.btn-xlsx:hover {
  background: #1f6b38;
  border-color: #1f6b38;
}

.btn-pdf {
  background: var(--red);
  color: #fff;
  border: 1px solid var(--red);
}

.btn-pdf:hover {
  background: #7a2116;
  border-color: #7a2116;
}

.btn-dark:hover {
  background: #000;
  border-color: #000;
  color: #fff;
}

.btn-blue {
  background: var(--blue);
  color: #fff;
  border: 1px solid var(--blue);
}

.btn-blue:hover {
  background: var(--blue-deep);
  border-color: var(--blue-deep);
}

.btn-full {
  width: 100%;
  justify-content: center;
}

/* ── Tables (vr-primitives.jsx TH/TD) ── */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table thead th {
  background: var(--bg-subtle);
  color: var(--ink-mid);
  padding: 10px 14px;
  text-align: left;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--line);
}

.table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  color: var(--ink);
}

.table tbody tr:last-child td {
  border-bottom: none;
}

.table tbody tr:hover td {
  background: var(--bg-subtle);
}

.table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
  font-size: 12.5px;
}

.table .mono {
  font-family: var(--font-mono);
  font-size: 12.5px;
}

.table .muted {
  color: var(--ink-mid);
}

.table .titulo-link {
  color: inherit;
  text-decoration: none;
}

.table .titulo-link:hover {
  color: var(--orange);
  text-decoration: underline;
}

.table .actions {
  white-space: nowrap;
  width: 1%;
  text-align: right;
}

.table .w-check {
  width: 30px;
  text-align: center;
}

.table .w-anexos {
  width: 40px;
  text-align: center;
}

.table .w-info {
  width: 40px;
  text-align: center;
}

.table .icone-descricao.obs {
  display: inline-block;
  width: auto;
  height: auto;
  border-radius: 0;
  background: none;
  margin-left: 0;
  color: var(--ink-mid);
  cursor: help;
}

.table .w-check input[type="checkbox"] {
  accent-color: var(--orange);
  width: 15px;
  height: 15px;
  cursor: pointer;
}

/* ── Barra flutuante de ações em lote ── */
.barra-lote[hidden] {
  display: none;
}

.barra-lote {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 400;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: var(--bg-surface);
  border: 1px solid var(--line-mid);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 10px 16px;
}

.barra-lote-contador {
  font-size: 13px;
  color: var(--ink);
  white-space: nowrap;
}

.barra-lote-acoes {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Filters Bar ── */
.filters-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 0;
  flex-wrap: wrap;
}

.filter-search {
  display: flex;
  align-items: center;
  height: 34px;
  padding: 0 12px;
  background: var(--bg-muted);
  border-radius: var(--radius);
  gap: 8px;
  color: var(--ink-mid);
  font-size: 13px;
  flex: 1;
  max-width: 320px;
}

/* ── Progress Bar (vr-primitives.jsx Bar component) ── */
.bar {
  width: 100%;
  height: 6px;
  background: var(--bg-muted);
  border-radius: 6px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 6px;
  transition: width .3s;
}

.bar-fill-orange {
  background: var(--orange);
}

.bar-fill-green {
  background: var(--green);
}

.bar-fill-blue {
  background: var(--blue);
}

.bar-fill-red {
  background: var(--red);
}

.bar-fill-yellow {
  background: var(--yellow);
}

.bar-sm {
  height: 4px;
}

/* ── Totals pills (legacy support) ── */
.grade-totais {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.grade-totais-pills {
  display: flex;
  flex-wrap: nowrap;
  flex: 1 1 auto;
  min-width: 0;
  gap: 8px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
  scrollbar-color: var(--ink-faint) transparent;
}

.grade-totais-pills::-webkit-scrollbar {
  height: 6px;
}

.grade-totais-pills::-webkit-scrollbar-thumb {
  background: var(--ink-faint);
  border-radius: var(--radius-full);
}

.grade-totais-pills .total-pill {
  scroll-snap-align: start;
}

.grade-totais-seta {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  background: var(--bg-surface);
  color: var(--ink-mid);
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.grade-totais-seta:hover {
  background: var(--bg-subtle);
}

.grade-totais-seta:disabled {
  opacity: .35;
  cursor: default;
  pointer-events: none;
}

.grade-totais-seta[hidden] {
  display: none;
}

.grade-totais-acoes {
  display: flex;
  flex-shrink: 0;
  gap: 8px;
}

.total-pill {
  background: var(--bg-surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  padding: 5px 16px;
  font-size: 13px;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
  white-space: nowrap;
}

.total-pill span {
  color: var(--ink-mid);
}

.total-pill strong {
  font-variant-numeric: tabular-nums;
}

.total-geral {
  border-color: var(--orange);
  background: var(--orange);
}

.total-geral span,
.total-geral strong {
  color: #fff;
}

.total-pendente {
  border-color: var(--yellow);
  background: var(--yellow-tint);
}

.total-pendente strong {
  color: var(--yellow);
}

.total-recebido {
  border-color: var(--green);
  background: var(--green-tint);
}

.total-recebido strong {
  color: var(--green);
}

/* ── Pills de total que funcionam como filtro ── */
a.total-pill {
  text-decoration: none;
  color: inherit;
}

.total-pill-filtro {
  cursor: pointer;
  transition: border-color .12s, background .12s, box-shadow .12s;
}

.total-pill-filtro:hover {
  border-color: var(--orange);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .08);
}

.total-pill-ativa {
  border-color: var(--orange);
  box-shadow: 0 0 0 2px var(--orange-tint, rgba(243, 112, 33, .18));
}

/* Realça o rótulo da pill ativa — exceto na total-geral, que é laranja cheio
   e mantém texto branco (senão o span fica escuro sobre fundo laranja). */
.total-pill-ativa:not(.total-geral) span {
  color: var(--ink-strong, var(--ink-mid));
}

/* Total geral já é laranja cheio; realce o anel quando ele for a pill ativa. */
.total-geral.total-pill-ativa {
  box-shadow: 0 0 0 2px rgba(255, 255, 255, .6) inset;
}

/* ── Filters form ── */
.filtros {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  background: var(--bg-surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
}

.filtros .campo {
  flex: 1;
  min-width: 130px;
  margin: 0;
}

/* ── Tabs / Abas ── */
.abas {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.abas a {
  padding: 6px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  font-size: 13px;
  color: var(--ink-mid);
  background: var(--bg-surface);
  transition: all .13s;
}

.abas a:hover {
  background: var(--bg-muted);
  text-decoration: none;
}

.abas a.ativa {
  background: var(--orange);
  border-color: var(--orange);
  color: #fff;
  font-weight: 500;
}

/* ── Badges (legacy, mapped to tags) ── */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  background: var(--orange-tint);
  color: var(--orange-deep);
}

.badge-pendente {
  background: var(--yellow-tint);
  color: var(--yellow);
}

.badge-recebido {
  background: var(--green-tint);
  color: var(--green);
}

/* ── Empty state ── */
.vazio {
  text-align: center;
  color: var(--ink-mid);
  padding: 52px 20px;
  font-size: 14px;
}

/* ── Forms ── */
.campo {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 16px;
}

.campo label {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-mid);
  letter-spacing: .02em;
}

.campo input,
.campo select,
.campo textarea {
  border: 1px solid var(--line-mid);
  border-radius: var(--radius);
  padding: 8px 12px;
  background: var(--bg-surface);
  color: var(--ink);
  transition: border-color .14s, box-shadow .14s;
  width: 100%;
  height: 40px;
  font-size: 14px;
}

.campo textarea {
  height: auto;
  min-height: 80px;
  resize: vertical;
  padding: 10px 12px;
}

.campo input:focus,
.campo select:focus,
.campo textarea:focus {
  outline: none;
  border-color: var(--orange);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.campo-erro input,
.campo-erro select,
.campo-erro textarea {
  border-color: var(--red);
}

.campo-erro input:focus,
.campo-erro select:focus,
.campo-erro textarea:focus {
  box-shadow: 0 0 0 3px var(--focus-ring-error);
}

.campo-mensagem {
  font-size: 12px;
  color: var(--red);
  margin-top: 2px;
}

.campo-dica {
  font-size: 11px;
  color: var(--ink-faint);
  margin-top: 2px;
}

.form-linha {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-acoes {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
  padding-top: 18px;
}

/* ── Form card (cartao) ── */
.cartao {
  background: var(--bg-surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.cartao-form {
  max-width: 720px;
}

/* ── Quick action links ── */
.ligacao,
.ligacao-logout {
  font-size: 13px;
  color: var(--blue);
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  text-decoration: none;
}

.ligacao:hover,
.ligacao-logout:hover {
  text-decoration: underline;
}

.ligacao-perigo {
  color: var(--red);
}

.ligacao-forte {
  font-weight: 600;
}

.ligacao-suave {
  font-size: 14px;
  color: var(--ink-mid);
  cursor: pointer;
}

.ligacao-suave:hover {
  color: var(--ink);
  text-decoration: none;
}

.form-inline {
  display: inline;
}

/* ── Icon-only action links ── */
.actions .ligacao {
  vertical-align: middle;
  padding: 4px;
  border-radius: 50%;
  transition: background 0.15s;
  color: var(--orange);
}

.tema-cl .actions .ligacao {
  color: var(--blue);
}

.actions .ligacao i {
  font-size: 13px;
}

.actions .ligacao:hover {
  text-decoration: none;
  background: var(--orange-tint);
}

.tema-cl .actions .ligacao:hover {
  background: var(--blue-tint);
}

.actions .ligacao-perigo {
  color: var(--red);
}

.actions .ligacao-perigo:hover {
  background: var(--red-tint);
}

.texto-suave {
  color: var(--ink-mid);
  font-size: 13px;
}

/* ── SweetAlert2: customização ── */
.swal2-popup.swal-modal-form {
  font-family: var(--font);
  font-size: 14px;
  color: var(--ink);
  background: var(--bg-surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 30px 60px rgba(0,0,0,.15);
  padding: 0;
  max-width: 680px;
  width: 100%;
}

.swal-modal-form .swal2-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
  padding: 18px 22px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  margin: 0;
}

.swal-modal-form .swal2-html-container {
  padding: 20px 22px 22px;
  overflow-y: auto;
  max-height: calc(90vh - 80px);
  margin: 0;
  text-align: left;
  color: var(--ink);
}

.swal-modal-form .swal2-close {
  position: absolute;
  color: var(--ink-mid);
  font-size: 22px;
  top: 14px;
  right: 16px;
}

.swal-modal-form .swal2-close:hover {
  color: var(--ink);
  background: var(--bg-muted);
  border-radius: var(--radius);
}

/* Toast customizado */
.swal2-toast.swal2-popup {
  font-family: var(--font);
  font-size: 14px;
}

.app-swal-popup {
  background: var(--bg-surface) !important;
  border-radius: var(--radius-lg) !important;
  border: 1px solid var(--line) !important;
  box-shadow: var(--shadow-md) !important;
  padding: 24px !important;
}

.swal2-popup.app-swal-popup .swal2-title {
  font-family: var(--font);
  font-size: 17px;
  font-weight: 600;
  color: var(--ink);
  padding: 0 0 4px;
  text-align: left;
}

.swal2-popup.app-swal-popup .swal2-html-container {
  font-size: 14px;
  color: var(--ink-mid);
  text-align: left;
  padding: 0;
  margin: 0 0 4px;
}

.swal2-popup.app-swal-popup .swal2-actions {
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.swal2-popup.app-swal-popup .swal2-icon {
  margin: 0 0 8px;
}

.swal2-toast.app-swal-popup {
  background: var(--bg-surface) !important;
  border-radius: var(--radius-lg) !important;
  border: 1px solid var(--line) !important;
  box-shadow: var(--shadow-md) !important;
  padding: 20px 24px !important;
}

.app-swal-title {
  font-family: var(--font);
  font-size: 18px;
  color: var(--ink);
  margin-bottom: 12px;
}

.app-swal-html {
  font-size: 14px;
  color: var(--ink-mid);
  margin-bottom: 16px;
}

.app-swal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.app-swal-confirm {
  background: var(--red) !important;
  color: #fff !important;
  border: none !important;
  padding: 8px 16px !important;
  border-radius: var(--radius) !important;
}

.app-swal-cancel {
  background: var(--bg-muted) !important;
  color: var(--ink) !important;
  border: none !important;
  padding: 8px 16px !important;
  border-radius: var(--radius) !important;
}

.periodo-atual {
  font-size: 14px;
  color: var(--ink-mid);
}

.periodo-atual strong {
  color: var(--ink);
}

/* ── Observação dot ── */
.obs {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--orange);
  cursor: help;
  margin-left: 4px;
  vertical-align: middle;
}

/* ── Tooltip (gerado via JS em #vr-tooltip, escapa overflow) ── */

/* ── Pagination ── */
.paginacao {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  align-items: center;
}

.paginacao a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--ink-mid);
  background: var(--bg-surface);
  transition: background .13s;
}

.paginacao a:hover {
  background: var(--bg-muted);
  text-decoration: none;
}

.paginacao a.ativa {
  background: var(--orange);
  border-color: var(--orange);
  color: #fff;
  font-weight: 600;
}

.pag-reticencias {
  color: var(--ink-faint);
  padding: 0 4px;
  font-size: 14px;
  user-select: none;
}

.tabela-rodape {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

/* ── Seletor de itens por página (integrado à barra de ações da listagem) ── */
.seletor-por-pagina {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-right: 4px;
}

.seletor-por-pagina label {
  font-size: 12px;
  color: var(--ink-mid);
  white-space: nowrap;
}

.seletor-por-pagina select {
  border: 1px solid var(--line-mid);
  border-radius: var(--radius);
  padding: 5px 8px;
  background: var(--bg-surface);
  color: var(--ink);
  font-size: 13px;
}

/* Sem campo de busca (é só um seletor de número) — o input do TomSelect fica
   escondido, mas sem isso ele herda a largura padrão do browser e estica o
   wrapper inteiro ao focar/clicar. */
.seletor-por-pagina .ts-control > input {
  width: 0 !important;
  max-width: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  border: 0 !important;
  height: 0 !important;
  opacity: 0 !important;
  position: absolute !important;
}

/* ── Resumo baixa ── */
.resumo-baixa {
  background: var(--bg-subtle);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
}

.resumo-titulo {
  font-size: 16px;
  font-weight: 600;
  margin: 4px 0 12px;
  color: var(--ink);
}

.resumo-lista {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13.5px;
}

.resumo-lista li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.resumo-lista span {
  color: var(--ink-mid);
}

.aviso-info {
  background: var(--orange-tint);
  color: var(--orange-deep);
  border-left: 4px solid var(--orange);
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13.5px;
}

/* ── Quick action shortcuts ── */
.atalhos {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ── Negativo / Positivo ── */
.negativo {
  color: var(--red);
}

.positivo {
  color: var(--green);
}

/* ── Fieldset ── */
.fieldset {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px 20px 6px;
  margin-bottom: 18px;
}

.fieldset legend {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  padding: 0 8px;
  letter-spacing: .03em;
}

/* ── Resultado calculado (CL — cálculo live no formulário) ── */
.fieldset-calc {
  background: var(--bg-subtle);
}

.grade-resultado {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.resultado-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.resultado-item span {
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-mid);
  text-transform: uppercase;
  letter-spacing: .03em;
}

.resultado-item strong {
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.resultado-destaque strong {
  color: var(--orange);
  font-size: 17px;
}

/* ── Icons inline (matching VR ICO system) ── */
.ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.ico svg {
  display: block;
}

/* ── Barra de ações ── */
.barra-acoes {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.barra-espaco {
  flex: 1;
  min-width: 8px;
}

/* ── Banner de status (página de detalhes: entrada/saída/previsto) ── */
.banner-status {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border: 1px solid;
  border-radius: var(--radius-lg);
  font-size: 13.5px;
  margin-bottom: 16px;
}

.banner-status i {
  flex-shrink: 0;
  font-size: 15px;
}

.banner-status span {
  flex: 1;
  color: var(--ink);
}

/* ── Alerta de previstos vencidos ── */
.alerta-vencidos {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--red-tint);
  border: 1px solid var(--red);
  border-radius: var(--radius-lg);
  font-size: 13.5px;
  color: var(--red);
  margin-bottom: 16px;
}

.alerta-vencidos svg {
  flex-shrink: 0;
}

.alerta-vencidos span {
  flex: 1;
}

/* ── Linha de previsto vencido ── */
.tr-vencido td {
  background: color-mix(in srgb, var(--red-tint) 40%, transparent);
}

.tr-vencido:hover td {
  background: var(--red-tint);
}

/* ── Tema CL (Centralink / Azul) ── */
.tema-cl {
  --orange: var(--blue);
  --orange-deep: var(--blue-deep);
  --orange-tint: var(--blue-tint);
}

/* ── Login page ── */
.login-page {
  position: relative;
  min-height: 100vh;
  background: var(--bg-page);
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle at 1px 1px, var(--line-mid) 1px, transparent 0);
  background-size: 24px 24px;
  opacity: 0.4;
  pointer-events: none;
}

.login-blob-1 {
  position: absolute;
  top: -180px;
  right: -120px;
  width: 480px;
  height: 480px;
  border-radius: 50%;
  background: var(--orange-tint);
  opacity: 0.5;
  pointer-events: none;
}

.login-blob-2 {
  position: absolute;
  bottom: -200px;
  left: -160px;
  width: 540px;
  height: 540px;
  border-radius: 50%;
  background: var(--blue-tint);
  opacity: 0.4;
  pointer-events: none;
}

.login-wrapper {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.login-card {
  width: 100%;
  max-width: 480px;
  background: var(--bg-surface);
  border-radius: 14px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  padding: 40px;
}

.login-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 24px;
}

.login-logo-mark {
  display: flex;
  align-items: center;
  gap: 12px;
}

.login-logo-box {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--orange);
  color: #fff;
  font-weight: 800;
  font-size: 17px;
  letter-spacing: .02em;
  transition: background .2s;
}

#login-card[data-sistema="ctlk"] .login-logo-box {
  background: var(--blue);
}

.login-logo-text {
  line-height: 1.2;
}

.login-logo-text strong {
  display: block;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}

.login-logo-text small {
  display: block;
  font-size: 11px;
  color: var(--ink-mid);
}

.login-title {
  font-size: 22px;
  font-weight: 600;
  text-align: center;
  letter-spacing: -0.3px;
  margin: 0 0 6px;
}

.login-sub {
  font-size: 13px;
  color: var(--ink-mid);
  text-align: center;
  margin: 0 0 24px;
}

.login-erro[hidden] {
  display: none;
}

.login-erro {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--red-tint);
  color: var(--red);
  font-size: 13px;
  font-weight: 500;
  border-radius: 8px;
  padding: 10px 14px;
  margin: -12px 0 20px;
}

.login-card .campo {
  margin-top: 0;
}

[data-env-switch] {
  margin-bottom: 16px;
}

[data-env-switch] .campo {
  margin-bottom: 0;
}

.pagina-centrada {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cartao-central {
  width: 100%;
  max-width: 420px;
  background: var(--bg-surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 36px 32px;
  box-shadow: var(--shadow-lg);
}

.erro-codigo {
  font-size: 72px;
  font-weight: 700;
  color: var(--line);
  text-align: center;
  line-height: 1;
  margin-bottom: 8px;
}

/* ── Print ── */
@media print {

  .topbar-desktop,
  .topbar,
  .sidebar,
  .sidebar-fundo,
  .barra-acoes,
  .filtros,
  .abas,
  .paginacao,
  .form-acoes,
  .acoes,
  .atalhos,
  .btn,
  .badge-ambiente,
  .login-blob-1,
  .login-blob-2,
  .login-page::before,
  .pg-header-actions,
  .stat-delta,
  .table .actions {
    display: none !important;
  }

  body {
    background: #fff !important;
    color: #000;
  }

  .conteudo-inner {
    padding: 0;
  }

  .table-wrap {
    border: none;
    overflow: visible;
  }

  .table {
    font-size: 11px;
  }

  .table thead th {
    background: #faf8f3 !important;
    color: #000 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .table tbody tr:hover td {
    background: transparent !important;
  }

}

/* ── Responsive ── */
@media (max-width: 900px) {
  .topbar-desktop {
    display: none;
  }

  .topbar {
    display: flex;
  }

  .aplicacao {
    flex-direction: column;
  }

  .sidebar {
    position: fixed;
    left: -100%;
    top: 0;
    height: 100%;
    z-index: 300;
    transition: left .24s ease;
    box-shadow: 4px 0 20px rgba(0, 0, 0, .08);
  }

  .sidebar.aberta {
    left: 0;
  }

  .sidebar-fundo {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .35);
    z-index: 250;
    display: block;
  }

  .sidebar-fundo[hidden] {
    display: none !important;
  }

  .conteudo-inner {
    padding: 18px 16px 48px;
  }

  .pg-header {
    padding: 16px 20px;
    flex-direction: column;
    align-items: flex-start;
  }

  .pg-header-actions {
    align-self: flex-start;
  }

  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .grid-2col {
    grid-template-columns: 1fr;
  }

  .grid-1-1 {
    grid-template-columns: 1fr;
  }

  .grid-3col {
    grid-template-columns: 1fr;
  }

  .form-linha {
    grid-template-columns: 1fr;
  }

  .filtros .campo {
    min-width: 110px;
  }
}

@media (max-width: 480px) {
  .stat-grid {
    grid-template-columns: 1fr;
  }

  .cartao-central {
    margin: 16px;
    padding: 28px 20px;
  }

  .login-card {
    margin: 16px;
    padding: 28px 20px;
  }

  .barra-acoes {
    flex-direction: column;
    align-items: flex-start;
  }

  .barra-acoes .barra-espaco {
    display: none;
  }
}

.flatpickr-input.flatpickr-mobile,
.flatpickr-input[readonly] {
  width: 100%;
}

/* ── Flatpickr: calendário mais compacto ── */
.flatpickr-calendar {
  font-size: 13px;
}

.flatpickr-calendar .flatpickr-months {
  padding: 4px 0;
}

.flatpickr-calendar .flatpickr-months .flatpickr-month {
  height: 32px;
}

.flatpickr-calendar .flatpickr-current-month {
  font-size: 15px;
  padding: 0;
}

.flatpickr-calendar .flatpickr-current-month input.cur-year {
  font-size: 15px;
}

.flatpickr-calendar .flatpickr-weekday {
  font-size: 11px;
  height: 28px;
}

.flatpickr-calendar .flatpickr-day {
  height: 32px;
  line-height: 32px;
  max-width: 32px;
  font-size: 13px;
}

.flatpickr-calendar .flatpickr-day.today {
  font-weight: 600;
}

.flatpickr-calendar .flatpickr-day.selected {
  font-size: 13px;
}

.flatpickr-calendar .flatpickr-prev-month,
.flatpickr-calendar .flatpickr-next-month {
  padding: 6px 8px;
}

/* ── Tom Select (tema VR — alinhado aos inputs nativos) ── */
:root {
  --ts-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239a948a' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
}

.ts-wrapper {
  width: 100%;
}

.ts-wrapper .ts-control,
.ts-wrapper.single .ts-control {
  border: 1px solid var(--line-mid);
  border-radius: var(--radius);
  background: var(--bg-surface);
  background-image: none;
  box-shadow: none;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.4;
  color: var(--ink);
  min-height: 40px;
  padding: 8px 36px 8px 12px;
  transition: border-color .14s, box-shadow .14s;
}

.ts-wrapper.single .ts-control {
  --ts-pr-caret: 28px;
}

.ts-wrapper.plugin-remove_button.single .ts-control {
  --ts-pr-caret: 44px;
}

.ts-wrapper.single .ts-control::after {
  border: none;
  width: 12px;
  height: 12px;
  margin: 0;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--ts-chevron) no-repeat center / 12px;
  content: "";
  display: block;
  position: absolute;
}

.ts-wrapper.single.dropdown-active .ts-control::after {
  transform: translateY(-50%) rotate(180deg);
}

.ts-wrapper.focus .ts-control,
.ts-wrapper.dropdown-active .ts-control {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.ts-wrapper.disabled .ts-control {
  background: var(--bg-muted);
  opacity: .65;
  cursor: not-allowed;
}

.ts-control > input {
  color: var(--ink);
  font-size: 14px;
}

.ts-control > input::placeholder {
  color: var(--ink-faint);
}

.ts-dropdown {
  border: 1px solid var(--line-mid);
  border-radius: var(--radius);
  background: var(--bg-surface);
  font-family: var(--font);
  font-size: 14px;
  color: var(--ink);
  box-shadow: var(--shadow-md);
  margin-top: 4px;
  z-index: 50;
}

/* Select dentro de modal SweetAlert2: dropdownParent:'body' escapa do
   overflow do formulário, mas precisa ficar acima do overlay do modal. */
body > .ts-dropdown {
  z-index: 2000;
}

.ts-dropdown .option,
.ts-dropdown .no-results,
.ts-dropdown .create {
  padding: 8px 12px;
}

.ts-dropdown .option.active,
.ts-dropdown .create.active {
  background: var(--orange-tint);
  color: var(--orange-deep);
}

.ts-dropdown .option:hover,
.ts-dropdown .option[data-selectable]:hover,
.ts-dropdown .create:hover,
.ts-dropdown .create[data-selectable]:hover {
  background: var(--bg-muted);
}

.ts-dropdown .no-results {
  color: var(--ink-faint);
  font-size: 13px;
}

/* Botão limpar (plugin remove_button) */
.ts-wrapper.plugin-remove_button .remove-single {
  font-size: 18px;
  line-height: 1;
  color: var(--ink-faint);
  right: 28px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  transition: color .14s, background .14s;
}

.ts-wrapper.plugin-remove_button .remove-single:hover {
  color: var(--ink);
  background: var(--bg-muted);
}

/* Dentro de .campo — mesma altura dos inputs */
.campo .ts-wrapper .ts-control {
  width: 100%;
}

.campo-erro .ts-wrapper .ts-control {
  border-color: var(--red);
}

.campo-erro .ts-wrapper.focus .ts-control {
  box-shadow: 0 0 0 3px var(--focus-ring-error);
}

/* Modais SweetAlert2 — mesma altura compacta do filtro */
.swal-modal-form .ts-wrapper .ts-control {
  height: 40px;
  min-height: 40px;
  padding: 0 36px 0 12px;
  font-size: 14px;
  flex-wrap: nowrap;
  align-items: center;
}

.swal-modal-form .ts-wrapper.dropdown-active .ts-control {
  border-radius: var(--radius);
}

.swal-modal-form .ts-control .item {
  white-space: nowrap;
}

.swal-modal-form .ts-wrapper.single.dropdown-active .ts-control .item {
  display: none !important;
}

.swal-modal-form .ts-control > input {
  min-width: 0 !important;
  flex: 1 1 auto;
}

/* Inline / filtros horizontais (dashboards) */
.filtros .ts-wrapper {
  width: 100%;
}

.filtros .ts-wrapper .ts-control {
  height: 40px;
  min-height: 40px;
  padding: 0 36px 0 12px;
  font-size: 14px;
  flex-wrap: nowrap;
  align-items: center;
}

.filtros .ts-wrapper.dropdown-active .ts-control {
  border-radius: var(--radius);
}

/* Selected item: no line break */
.filtros .ts-control .item {
  white-space: nowrap;
}

/* When open: hide the selected-item tag so only the search input shows */
.filtros .ts-wrapper.single.dropdown-active .ts-control .item {
  display: none !important;
}

/* Search input fills the available space in the control */
.filtros .ts-control > input {
  min-width: 0 !important;
  flex: 1 1 auto;
}

/* Compact variant for dashboard header filters */
.filtros-compact .ts-wrapper {
  display: inline-flex;
  width: auto;
  vertical-align: middle;
}

.filtros-compact .ts-wrapper .ts-control {
  min-height: 30px;
  height: auto;
  padding: 2px 28px 2px 8px;
  font-size: 12px;
  justify-content: center;
}

.filtros-compact .ts-wrapper.single .ts-control::after {
  right: 8px;
}

.filtros-compact .ts-control > input {
  width: 0 !important;
  max-width: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  border: 0 !important;
  height: 0 !important;
  opacity: 0 !important;
  position: absolute !important;
}

.filtros-compact .ts-dropdown {
  font-size: 12px;
  min-width: 130px;
}

.filtros-compact .ts-dropdown .option,
.filtros-compact .ts-dropdown .no-results,
.filtros-compact .ts-dropdown .create {
  padding: 6px 10px;
}

.campo-hint { font-size: 12px; color: var(--ink-faint); margin-top: 4px; }

/* Preference selects (config page) — compact, no search input */
.pref-item-acao .ts-wrapper {
  display: inline-flex;
  width: auto;
  vertical-align: middle;
}

.pref-item-acao .ts-wrapper .ts-control {
  min-height: 32px;
  padding: 2px 28px 2px 10px;
  font-size: 13px;
  height: auto;
  display: flex;
  align-items: center;
}

.pref-item-acao .ts-control > input {
  width: 0 !important;
  max-width: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  border: 0 !important;
  height: 0 !important;
  opacity: 0 !important;
  position: absolute !important;
}
.campo-hint--aviso { color: var(--orange); font-weight: 500; }

/* ══════════════════════════════════════════════════════════════
   Dark theme (tema-escuro)
   ══════════════════════════════════════════════════════════════ */
.tema-escuro {
  color-scheme: dark;
  --bg-page: #161310;
  --bg-surface: #221f1b;
  --bg-muted: #2c2823;
  --bg-subtle: #37332d;
  --bg-dark: #0c0a08;
  --bg-hover: #322e28;
  --line: #353027;
  --line-mid: #4a443b;
  --line-strong: #6b655b;
  --ink: #e6e0d6;
  --ink-mid: #a8a39a;
  --ink-faint: #7a756d;
  --ink-ghost: #4a443b;
  --orange-tint: #3d2a16;
  --blue-tint: #142c42;
  --green-tint: #142e1d;
  --yellow-tint: #3a2f10;
  --red-tint: #3d1f1a;
  --purple-tint: #2d1d42;
  --ts-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%237a756d' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  --shadow-sm: 0 2px 6px rgba(0, 0, 0, .25), 0 1px 2px rgba(0, 0, 0, .18);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, .35), 0 2px 6px rgba(0, 0, 0, .22);
  --shadow-lg: 0 30px 60px rgba(0, 0, 0, .45), 0 4px 16px rgba(0, 0, 0, .28);
  --focus-ring: rgba(243, 112, 33, .32);
  --focus-ring-error: rgba(193, 74, 58, .32);
}

/* Flatpickr dark overrides */
.tema-escuro .flatpickr-calendar {
  background: var(--bg-surface);
  border: 1px solid var(--line-mid);
  box-shadow: var(--shadow-md);
  color: var(--ink);
}
.tema-escuro .flatpickr-months,
.tema-escuro .flatpickr-month {
  background: var(--bg-muted);
  color: var(--ink);
  fill: var(--ink);
}
.tema-escuro .flatpickr-current-month,
.tema-escuro .flatpickr-current-month input.cur-year,
.tema-escuro .flatpickr-current-month .flatpickr-monthDropdown-months {
  color: var(--ink);
  background: transparent;
}
.tema-escuro .flatpickr-prev-month,
.tema-escuro .flatpickr-next-month {
  color: var(--ink-mid);
  fill: var(--ink-mid);
}
.tema-escuro .flatpickr-prev-month:hover,
.tema-escuro .flatpickr-next-month:hover {
  color: var(--ink);
  fill: var(--ink);
}
.tema-escuro .flatpickr-weekdays,
.tema-escuro .flatpickr-weekday {
  background: var(--bg-muted);
  color: var(--ink-faint);
}
.tema-escuro .flatpickr-day {
  color: var(--ink);
}
.tema-escuro .flatpickr-day:hover,
.tema-escuro .flatpickr-day:focus {
  background: var(--bg-subtle);
  border-color: var(--bg-subtle);
  color: var(--ink);
}
.tema-escuro .flatpickr-day.today {
  border-color: var(--orange);
  color: var(--orange);
}
.tema-escuro .flatpickr-day.today:hover {
  background: var(--orange-tint);
  border-color: var(--orange);
  color: var(--orange);
}
.tema-escuro .flatpickr-day.selected,
.tema-escuro .flatpickr-day.selected:hover {
  background: var(--orange);
  border-color: var(--orange);
  color: #fff;
}
.tema-escuro .flatpickr-day.flatpickr-disabled,
.tema-escuro .flatpickr-day.flatpickr-disabled:hover {
  color: var(--ink-ghost);
}
.tema-escuro .flatpickr-day.prevMonthDay,
.tema-escuro .flatpickr-day.nextMonthDay {
  color: var(--ink-ghost);
}

/* Quill editor dark overrides */
.tema-escuro .ql-toolbar.ql-snow,
.tema-escuro .ql-container.ql-snow {
  border-color: var(--line-mid);
  background: var(--bg-surface);
}
.tema-escuro .ql-toolbar.ql-snow {
  background: var(--bg-muted);
}
.tema-escuro .ql-toolbar .ql-stroke {
  stroke: var(--ink-mid);
}
.tema-escuro .ql-toolbar .ql-fill {
  fill: var(--ink-mid);
}
.tema-escuro .ql-toolbar button:hover .ql-stroke,
.tema-escuro .ql-toolbar .ql-active .ql-stroke {
  stroke: var(--orange);
}
.tema-escuro .ql-toolbar button:hover .ql-fill,
.tema-escuro .ql-toolbar .ql-active .ql-fill {
  fill: var(--orange);
}
.tema-escuro .ql-editor {
  color: var(--ink);
  background: var(--bg-surface);
}
.tema-escuro .ql-editor.ql-blank::before {
  color: var(--ink-faint);
}

.tema-escuro.tema-cl {
  --orange: var(--blue);
  --orange-deep: var(--blue-deep);
  --orange-tint: var(--blue-tint);
}

@media (prefers-color-scheme: dark) {
  body[data-tema="sistema"] {
    color-scheme: dark;
    --bg-page: #161310;
    --bg-surface: #221f1b;
    --bg-muted: #2c2823;
    --bg-subtle: #37332d;
    --bg-dark: #0c0a08;
    --bg-hover: #322e28;
    --line: #353027;
    --line-mid: #4a443b;
    --line-strong: #6b655b;
    --ink: #e6e0d6;
    --ink-mid: #a8a39a;
    --ink-faint: #7a756d;
    --ink-ghost: #4a443b;
    --orange-tint: #3d2a16;
    --blue-tint: #142c42;
    --green-tint: #142e1d;
    --yellow-tint: #3a2f10;
    --red-tint: #3d1f1a;
    --purple-tint: #2d1d42;
    --ts-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%237a756d' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    --shadow-sm: 0 2px 6px rgba(0, 0, 0, .25), 0 1px 2px rgba(0, 0, 0, .18);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, .35), 0 2px 6px rgba(0, 0, 0, .22);
    --shadow-lg: 0 30px 60px rgba(0, 0, 0, .45), 0 4px 16px rgba(0, 0, 0, .28);
    --focus-ring: rgba(243, 112, 33, .32);
    --focus-ring-error: rgba(193, 74, 58, .32);
  }
  body[data-tema="sistema"].tema-cl {
    --orange: var(--blue);
    --orange-deep: var(--blue-deep);
    --orange-tint: var(--blue-tint);
  }
  body[data-tema="sistema"] .flatpickr-calendar {
    background: var(--bg-surface);
    border: 1px solid var(--line-mid);
    box-shadow: var(--shadow-md);
    color: var(--ink);
  }
  body[data-tema="sistema"] .flatpickr-months,
  body[data-tema="sistema"] .flatpickr-month {
    background: var(--bg-muted);
    color: var(--ink);
    fill: var(--ink);
  }
  body[data-tema="sistema"] .flatpickr-current-month,
  body[data-tema="sistema"] .flatpickr-current-month input.cur-year,
  body[data-tema="sistema"] .flatpickr-current-month .flatpickr-monthDropdown-months {
    color: var(--ink);
    background: transparent;
  }
  body[data-tema="sistema"] .flatpickr-prev-month,
  body[data-tema="sistema"] .flatpickr-next-month {
    color: var(--ink-mid);
    fill: var(--ink-mid);
  }
  body[data-tema="sistema"] .flatpickr-weekdays,
  body[data-tema="sistema"] .flatpickr-weekday {
    background: var(--bg-muted);
    color: var(--ink-faint);
  }
  body[data-tema="sistema"] .flatpickr-day {
    color: var(--ink);
  }
  body[data-tema="sistema"] .flatpickr-day:hover,
  body[data-tema="sistema"] .flatpickr-day:focus {
    background: var(--bg-subtle);
    border-color: var(--bg-subtle);
    color: var(--ink);
  }
  body[data-tema="sistema"] .flatpickr-day.today {
    border-color: var(--orange);
    color: var(--orange);
  }
  body[data-tema="sistema"] .flatpickr-day.today:hover {
    background: var(--orange-tint);
    border-color: var(--orange);
    color: var(--orange);
  }
  body[data-tema="sistema"] .flatpickr-day.selected,
  body[data-tema="sistema"] .flatpickr-day.selected:hover {
    background: var(--orange);
    border-color: var(--orange);
    color: #fff;
  }
  body[data-tema="sistema"] .flatpickr-day.flatpickr-disabled,
  body[data-tema="sistema"] .flatpickr-day.flatpickr-disabled:hover {
    color: var(--ink-ghost);
  }
  body[data-tema="sistema"] .flatpickr-day.prevMonthDay,
  body[data-tema="sistema"] .flatpickr-day.nextMonthDay {
    color: var(--ink-ghost);
  }
  body[data-tema="sistema"] .ql-toolbar.ql-snow,
  body[data-tema="sistema"] .ql-container.ql-snow {
    border-color: var(--line-mid);
    background: var(--bg-surface);
  }
  body[data-tema="sistema"] .ql-toolbar.ql-snow {
    background: var(--bg-muted);
  }
  body[data-tema="sistema"] .ql-toolbar .ql-stroke {
    stroke: var(--ink-mid);
  }
  body[data-tema="sistema"] .ql-toolbar .ql-fill {
    fill: var(--ink-mid);
  }
  body[data-tema="sistema"] .ql-toolbar button:hover .ql-stroke,
  body[data-tema="sistema"] .ql-toolbar .ql-active .ql-stroke {
    stroke: var(--orange);
  }
  body[data-tema="sistema"] .ql-toolbar button:hover .ql-fill,
  body[data-tema="sistema"] .ql-toolbar .ql-active .ql-fill {
    fill: var(--orange);
  }
  body[data-tema="sistema"] .ql-editor {
    color: var(--ink);
    background: var(--bg-surface);
  }
  body[data-tema="sistema"] .ql-editor.ql-blank::before {
    color: var(--ink-faint);
  }
}

/* ── Tema segmented control ── */
.tema-opcoes {
  display: flex;
  gap: 0;
  border: 1px solid var(--line-mid);
  border-radius: 8px;
  overflow: hidden;
}

.tema-opcao {
  flex: 1;
  cursor: pointer;
}

.tema-opcao input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.tema-opcao span {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  font-size: .825rem;
  font-weight: 500;
  color: var(--ink-mid);
  background: var(--bg-surface);
  border-right: 1px solid var(--line-mid);
  transition: background .15s, color .15s;
  white-space: nowrap;
}

.tema-opcao:last-child span {
  border-right: none;
}

.tema-opcao input:checked + span {
  background: var(--orange);
  color: #fff;
}

.tema-opcao:hover input:not(:checked) + span {
  background: var(--bg-muted);
  color: var(--ink);
}

/* ── Toggle Switch ── */
.toggle-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
  vertical-align: middle;
}

.toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--line-mid);
  border-radius: 24px;
  cursor: pointer;
  transition: background .2s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: var(--bg-surface);
  border-radius: 50%;
  transition: transform .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.15);
}

.toggle input:checked + .toggle-slider {
  background: var(--orange);
}

.toggle input:checked + .toggle-slider::before {
  transform: translateX(20px);
}

.toggle-label {
  font-size: 14px;
  color: var(--ink);
  font-weight: 500;
}

.toggle-desc {
  font-size: 12px;
  color: var(--ink-faint);
}

/* ── Password strength meter ── */
.senha-forca {
  margin-top: 6px;
  display: none;
  flex-direction: column;
  gap: 4px;
}

.senha-forca.visivel {
  display: flex;
}

.senha-forca-barra {
  height: 4px;
  border-radius: 4px;
  background: var(--bg-muted);
  overflow: hidden;
}

.senha-forca-preenchimento {
  height: 100%;
  border-radius: 4px;
  transition: width .2s, background .2s;
  width: 0;
}

.senha-forca-texto {
  font-size: 11px;
  color: var(--ink-faint);
}

.senha-forca-texto.fraco { color: var(--red); }
.senha-forca-texto.media { color: var(--yellow); }
.senha-forca-texto.forte { color: var(--green); }

/* ── Password show/hide ── */
.campo-senha-wrap {
  position: relative;
}

.campo-senha-wrap input {
  width: 100%;
  padding-right: 36px;
}

.btn-olho {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--ink-mid);
  cursor: pointer;
  padding: 4px;
  font-size: 16px;
  line-height: 1;
}

.btn-olho:hover {
  color: var(--ink);
}

/* ── Avatar grande (perfil) ── */
.avatar-grande {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--orange-tint);
  color: var(--orange-deep);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 700;
  flex-shrink: 0;
  border: 2px solid var(--line);
}

.tema-cl .avatar-grande {
  background: var(--blue-tint);
  color: var(--blue);
}

/* ── Info row (perfil) ── */
.info-linha {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.info-rotulo {
  font-size: 11px;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.info-valor {
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
}

.info-valor-mono {
  font-family: var(--font-mono);
  font-size: 14px;
}

/* ── Ficha financeira: título editável no pg-header (mesma métrica do h1) ── */
input.pg-header-title {
  display: block;
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  padding: 2px 6px;
  margin: 0 0 0 -6px;
  border-radius: var(--radius);
  font-family: var(--font);
  transition: border-color .14s, background .14s, box-shadow .14s;
}

input.pg-header-title:hover {
  background: var(--bg-hover);
}

input.pg-header-title:focus {
  outline: none;
  border-color: var(--orange);
  background: var(--bg-surface);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.stat-value-money {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.stat-value-prefixo {
  font-size: 20px;
  font-weight: 700;
  color: var(--ink-mid);
}

.stat-value-input {
  display: block;
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  padding: 0;
  border-radius: var(--radius);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--ink);
  transition: border-color .14s, background .14s, box-shadow .14s;
}

.stat-value-input:hover {
  background: var(--bg-hover);
}

.stat-value-input:focus {
  outline: none;
  border-color: var(--orange);
  background: var(--bg-surface);
  padding: 0 6px;
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.stat-value-input-select {
  font-size: 16px;
  font-weight: 600;
  height: 34px;
}

/* Tom Select dentro de um stat: parece texto até focar, não um input de formulário. */
.stat .ts-wrapper .ts-control,
.stat .ts-wrapper.single .ts-control {
  border: 1px solid transparent;
  background: transparent;
  min-height: auto;
  padding: 2px 22px 2px 4px;
  margin-left: -4px;
  font-size: 18px;
  font-weight: 600;
}

.stat .ts-wrapper .ts-control > input {
  font-size: 18px;
  font-weight: 600;
}

.stat .ts-wrapper .ts-control:hover {
  background: var(--bg-hover);
}

.stat .ts-wrapper.focus .ts-control,
.stat .ts-wrapper.dropdown-active .ts-control {
  border-color: var(--orange);
  background: var(--bg-surface);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.stat .ts-control .item {
  padding: 0;
}

.campo-inline {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.campo-inline input {
  border: 1px solid transparent;
  background: transparent;
  padding: 2px 4px;
  margin: -2px -4px;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
  height: auto;
  width: 100%;
  transition: border-color .14s, background .14s, box-shadow .14s;
}

.campo-inline input:hover {
  background: var(--bg-hover);
}

.campo-inline input:focus {
  outline: none;
  border-color: var(--orange);
  background: var(--bg-surface);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

/* "Outros campos" da ficha inclui select criável (Tom Select) — mesmo
   tratamento "parece texto até focar" que os inputs acima, espelhando
   .stat .ts-wrapper .ts-control (que faz o mesmo dentro dos cards de stat). */
.campo-inline .ts-wrapper .ts-control,
.campo-inline .ts-wrapper.single .ts-control {
  border: 1px solid transparent;
  background: transparent;
  min-height: auto;
  padding: 2px 22px 2px 4px;
  margin: -2px -4px;
  font-size: 15px;
  font-weight: 500;
}

.campo-inline .ts-wrapper .ts-control:hover {
  background: var(--bg-hover);
}

.campo-inline .ts-wrapper.focus .ts-control,
.campo-inline .ts-wrapper.dropdown-active .ts-control {
  border-color: var(--orange);
  background: var(--bg-surface);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.editor-inline .ql-toolbar.ql-snow {
  border-radius: var(--radius) var(--radius) 0 0;
}

.editor-inline .ql-container.ql-snow {
  border-radius: 0 0 var(--radius) var(--radius);
  font-size: 14px;
}

.editor-inline .ql-editor {
  min-height: 10em;
}

/* ── Histórico: botão "ver tudo" (card body) ── */
.btn-ver-historico {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  margin-top: 12px;
  padding: 6px 12px;
  border: none;
  border-radius: var(--radius);
  background: var(--bg-muted);
  color: var(--ink-mid);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background .14s, color .14s;
}

.btn-ver-historico:hover {
  background: var(--orange-tint);
  color: var(--orange-deep);
}

.btn-ver-historico i {
  font-size: 11px;
  opacity: .7;
  transition: opacity .14s;
}

.btn-ver-historico:hover i {
  opacity: 1;
}

/* ── Histórico: lista completa (modal) ── */
.historico-lista-completa {
  max-height: 60vh;
  overflow-y: auto;
  text-align: left;
  padding-right: 4px;
}

/* ── Anexos: lista + dropzone (modal) ── */
.texto-vazio {
  padding: 20px;
  margin: 0;
  font-size: 13px;
  color: var(--ink-faint);
  text-align: center;
}

.anexos-lista {
  display: flex;
  flex-direction: column;
}

.anexo-linha {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
}

.anexo-linha:last-child {
  border-bottom: none;
}

.anexo-linha-icone {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-mid);
  font-size: 16px;
  flex: 0 0 auto;
}

.anexo-linha-icone-red { color: var(--red); }
.anexo-linha-icone-blue { color: var(--blue); }
.anexo-linha-icone-green { color: var(--green); }

.anexo-linha-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.anexo-linha-titulo {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.anexo-linha-meta {
  font-size: 11px;
  color: var(--ink-faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.anexo-linha-acoes {
  display: flex;
  gap: 12px;
  flex: 0 0 auto;
}

.anexo-upload-body {
  padding: 4px 0 8px;
}

.anexo-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 28px 24px 24px;
  border: 2px dashed var(--line-mid);
  border-radius: var(--radius-lg);
  color: var(--ink-mid);
  font-size: 13px;
  text-align: center;
  cursor: pointer;
  transition: border-color .18s, background .18s;
  margin-bottom: 16px;
}

.anexo-dropzone.anexo-dropzone-tem-arquivo {
  border-style: solid;
  border-color: var(--green);
  background: var(--green-tint);
  padding: 20px 24px;
}

.anexo-dropzone.anexo-dropzone-tem-arquivo .anexo-dropzone-icone i {
  color: var(--green);
}

.anexo-dropzone.anexo-dropzone-tem-arquivo .anexo-dropzone-texto {
  color: var(--ink);
  font-weight: 600;
}

.anexo-dropzone.anexo-dropzone-tem-arquivo .anexo-dropzone-hint {
  color: var(--green);
}

.anexo-dropzone-icone {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  background: var(--bg-muted);
  transition: background .18s;
}

.anexo-dropzone:hover .anexo-dropzone-icone,
.anexo-dropzone.anexo-dropzone-arrastando .anexo-dropzone-icone {
  background: var(--orange-tint);
}

.anexo-dropzone-icone i {
  font-size: 18px;
  color: var(--ink-faint);
  transition: color .18s;
}

.anexo-dropzone:hover .anexo-dropzone-icone i,
.anexo-dropzone.anexo-dropzone-arrastando .anexo-dropzone-icone i {
  color: var(--orange);
}

.anexo-dropzone-texto {
  font-weight: 500;
  transition: color .18s;
}

.anexo-dropzone-hint {
  font-size: 11px;
  color: var(--ink-faint);
  transition: color .18s;
}

.anexo-dropzone:hover,
.anexo-dropzone.anexo-dropzone-arrastando {
  border-color: var(--orange);
  background: var(--focus-ring);
}

.anexo-dropzone:hover .anexo-dropzone-texto,
.anexo-dropzone.anexo-dropzone-arrastando .anexo-dropzone-texto {
  color: var(--ink);
}

/* ── Perfil layout ── */
.perfil-topo {
  display: flex;
  align-items: center;
  gap: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 20px;
}

.perfil-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ── Config preferences section ── */
.pref-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.pref-item:last-child {
  border-bottom: none;
}

.pref-item-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pref-item-titulo {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
}

.pref-item-desc {
  font-size: 12px;
  color: var(--ink-faint);
}

.pref-item-acao {
  flex-shrink: 0;
}

/* ── Select small ── */
.select-sm {
  height: 32px;
  padding: 0 28px 0 10px;
  font-size: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-surface);
  color: var(--ink);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239a948a' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}

.select-sm:focus {
  border-color: var(--orange);
  outline: none;
  box-shadow: 0 0 0 3px var(--orange-tint);
}

/* ── Sortable tables ───────────────────────────────────────── */
.table thead th.sortable {
  cursor: pointer;
  user-select: none;
  position: relative;
  padding-right: 22px;
}

.table thead th.sortable:hover {
  color: var(--ink);
  background: var(--bg-muted);
}

.table thead th.sortable::after {
  content: '';
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.25;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
}

.table thead th.sortable.th-sort-asc::after {
  opacity: 1;
  border-top: none;
  border-bottom: 5px solid currentColor;
}

.table thead th.sortable.th-sort-desc::after {
  opacity: 1;
  border-top: 5px solid currentColor;
}

/* ── Permission items (toggle list) ── */
.perm-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.perm-item:last-child {
  border-bottom: none;
}

.perm-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.perm-item-nome {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
}

/* ══════════════════════════════════════════════════════════
   Notificações — Painel Lateral
   ══════════════════════════════════════════════════════════ */

/* Overlay escuro */
.notif-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}
.notif-overlay.notif--aberto {
    opacity: 1;
    pointer-events: auto;
}

/* Painel lateral */
.notif-painel {
    position: fixed;
    top: 0;
    right: -400px;
    width: 380px;
    height: 100vh;
    background: var(--bg-surface);
    z-index: 1000;
    box-shadow: -4px 0 24px rgba(0,0,0,0.12);
    transition: right 0.25s ease;
    display: flex;
    flex-direction: column;
}
.notif-painel.notif--aberto {
    right: 0;
}

.notif-painel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--line);
    flex-shrink: 0;
}
.notif-painel-header h2 {
    font-size: 15px;
    font-weight: 600;
    margin: 0;
}
.notif-painel-actions {
    display: flex;
    gap: 6px;
}

.notif-painel-corpo {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.notif-carregando {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 20px;
    color: var(--ink-mid);
    gap: 8px;
    font-size: 14px;
}

.notif-vazio {
    padding: 48px 20px;
    text-align: center;
    color: var(--ink-mid);
    font-size: 14px;
}
.notif-vazio i {
    font-size: 28px;
    margin-bottom: 12px;
    opacity: 0.4;
}

/* Mini tabela */
.notif-tabela {
    width: 100%;
    border-collapse: collapse;
}
.notif-tabela tr {
    border-bottom: 1px solid var(--line);
    cursor: default;
}
.notif-tabela tr.notif--nova {
    background: rgba(243, 112, 33, 0.04);
}
.notif-tabela tr:hover {
    background: var(--bg-hover);
}
.notif-tabela td {
    padding: 12px 14px;
    vertical-align: top;
    font-size: 13px;
    line-height: 1.4;
}
.notif-tabela .notif-icone {
    width: 32px;
    text-align: center;
    font-size: 16px;
    padding-right: 4px;
    padding-top: 14px;
}
.notif-tabela .notif-icone .fa-circle-check { color: var(--green); }
.notif-tabela .notif-icone .fa-circle-xmark { color: var(--red); }
.notif-tabela .notif-icone .fa-triangle-exclamation { color: var(--orange); }
.notif-tabela .notif-icone .fa-circle-info { color: var(--blue); }

.notif-tabela .notif-conteudo strong {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 2px;
}
.notif-tabela .notif-conteudo p {
    margin: 0;
    color: var(--ink-mid);
    font-size: 12px;
}
.notif-tabela .notif-detalhes {
    margin-top: 5px;
    background: var(--bg-muted);
    border-radius: 4px;
    padding: 4px 7px;
    display: flex;
    flex-wrap: wrap;
    gap: 2px 12px;
}
.notif-tabela .notif-det-linha {
    display: inline-block;
    font-size: 11px;
    color: var(--ink-mid);
    white-space: nowrap;
}
.notif-tabela .notif-det-linha b {
    color: var(--ink);
    font-weight: 600;
}
.notif-tabela .notif-tempo {
    display: block;
    font-size: 11px;
    color: var(--ink-mid);
    margin-top: 4px;
    opacity: 0.7;
}

.notif-tabela .notif-status {
    width: 14px;
    text-align: center;
    padding: 12px 8px;
}
.notif-tabela .notif-bolinha {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--orange);
}
.notif-tabela .notif-bolinha.notif--lida {
    background: var(--line-mid);
}

/* Badge no sino */
.tb-bell {
    position: relative;
}
.tb-bell-badge {
    display: none;
    position: absolute;
    top: -2px;
    right: -4px;
    min-width: 17px;
    height: 17px;
    border-radius: 9px;
    background: var(--orange);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 17px;
    text-align: center;
    padding: 0 5px;
    box-shadow: 0 0 0 2px var(--bg-surface);
}
.tb-bell-badge.notif--visivel {
    display: inline-block;
}

/* Toast refinamentos */
.swal2-toast {
    font-family: 'IBM Plex Sans', sans-serif !important;
    border-radius: 10px !important;
    padding: 14px 20px 14px 14px !important;
    box-shadow: 0 6px 24px rgba(0,0,0,0.13) !important;
    cursor: pointer !important;
    border-left: 4px solid transparent !important;
    transition: transform .15s, box-shadow .15s;
    touch-action: pan-y;
    user-select: none;
}
.swal2-toast:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 28px rgba(0,0,0,0.16) !important;
}
.swal2-toast .swal2-title {
    font-size: 14px !important;
    font-weight: 500 !important;
    line-height: 1.4 !important;
    color: var(--ink) !important;
}
.swal2-toast .swal2-icon {
    margin-right: 10px !important;
}
.swal2-toast .swal2-timer-progress-bar {
    background: var(--line) !important;
    height: 3px !important;
}
.swal2-toast:has(.swal2-icon-success) {
    border-left-color: var(--green) !important;
}
.swal2-toast:has(.swal2-icon-error) {
    border-left-color: var(--red) !important;
}
.swal2-toast:has(.swal2-icon-warning) {
    border-left-color: var(--orange) !important;
}
.swal2-toast:has(.swal2-icon-info) {
    border-left-color: var(--blue) !important;
}
/* ── Notificação modal (SweetAlert2) ── */
.notif-modal-popup {
    font-family: var(--font) !important;
    font-size: 14px !important;
    color: var(--ink) !important;
    background: var(--bg-surface) !important;
    border: 1px solid var(--line) !important;
    border-radius: 14px !important;
    box-shadow: 0 30px 60px rgba(0,0,0,.15) !important;
    padding: 0 !important;
    max-width: 480px;
    width: 100%;
}
.notif-modal-popup .swal2-html-container {
    margin: 0 !important;
    padding: 0 !important;
    text-align: left !important;
    color: var(--ink) !important;
    overflow-y: auto;
    max-height: calc(90vh - 60px);
}
.notif-modal-popup .swal2-close {
    position: absolute !important;
    color: var(--ink-mid) !important;
    font-size: 22px !important;
    top: 14px !important;
    right: 16px !important;
    width: 32px !important;
    height: 32px !important;
    border-radius: var(--radius) !important;
}
.notif-modal-popup .swal2-close:hover {
    color: var(--ink) !important;
    background: var(--bg-muted) !important;
}
.notif-modal-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 56px 16px 22px;
    border-bottom: 1px solid var(--line);
}
.notif-modal-icone {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
}
.notif-modal-titulo-wrap {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.notif-modal-titulo {
    font-size: 16px;
    font-weight: 600;
    color: var(--ink);
    line-height: 1.3;
}
.notif-modal-msg {
    font-size: 13px;
    color: var(--ink-mid);
    line-height: 1.4;
}
.notif-modal-tabela {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
}
.notif-modal-tabela .notif-modal-row {
    border-bottom: 1px solid var(--line);
}
.notif-modal-tabela .notif-modal-row:last-child {
    border-bottom: none;
}
.notif-modal-label {
    padding: 11px 12px 11px 22px;
    font-size: 12px;
    color: var(--ink-mid);
    white-space: nowrap;
    width: 1%;
    font-weight: 500;
}
.notif-modal-val {
    padding: 11px 22px 11px 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
    word-break: break-word;
}
.notif-modal-tempo {
    margin: 0;
    padding: 10px 22px;
    font-size: 11px;
    color: var(--ink-mid);
    opacity: 0.6;
    text-align: right;
    border-top: 1px solid var(--line);
}

/* ══════════════════════════════════════════════════════════
   ESTILOS DE TOAST — usados via customClass no SweetAlert2
   ══════════════════════════════════════════════════════════ */

/* ── Estilo 1: Clássico ─────────────────────────────────── */
.swal2-toast.toast-classico {
    background: #fff !important;
    border-left: 4px solid var(--green) !important;
}
.swal2-toast.toast-classico:has(.swal2-icon-error) { border-left-color: var(--red) !important; }
.swal2-toast.toast-classico:has(.swal2-icon-warning) { border-left-color: var(--orange) !important; }
.swal2-toast.toast-classico:has(.swal2-icon-info) { border-left-color: var(--blue) !important; }
.swal2-toast.toast-classico .swal2-icon.swal2-icon-success { border-color: var(--green) !important; color: var(--green) !important; }
.swal2-toast.toast-classico .swal2-icon.swal2-icon-error { border-color: var(--red) !important; color: var(--red) !important; }
.swal2-toast.toast-classico .swal2-icon.swal2-icon-warning { border-color: var(--orange) !important; color: var(--orange) !important; }
.swal2-toast.toast-classico .swal2-icon.swal2-icon-info { border-color: var(--blue) !important; color: var(--blue) !important; }

/* ── Estilo 2: Preenchido ───────────────────────────────── */
.swal2-toast.toast-preenchido {
    background: var(--green-tint) !important;
    border-left: 4px solid var(--green) !important;
}
.swal2-toast.toast-preenchido:has(.swal2-icon-error) { background: var(--red-tint) !important; border-left-color: var(--red) !important; }
.swal2-toast.toast-preenchido:has(.swal2-icon-warning) { background: var(--orange-tint) !important; border-left-color: var(--orange) !important; }
.swal2-toast.toast-preenchido:has(.swal2-icon-info) { background: var(--blue-tint) !important; border-left-color: var(--blue) !important; }
.swal2-toast.toast-preenchido .swal2-icon.swal2-icon-success { border-color: var(--green) !important; color: var(--green) !important; }
.swal2-toast.toast-preenchido .swal2-icon.swal2-icon-error { border-color: var(--red) !important; color: var(--red) !important; }
.swal2-toast.toast-preenchido .swal2-icon.swal2-icon-warning { border-color: var(--orange) !important; color: var(--orange) !important; }
.swal2-toast.toast-preenchido .swal2-icon.swal2-icon-info { border-color: var(--blue) !important; color: var(--blue) !important; }

/* ── Estilo 3: Sombra ───────────────────────────────────── */
.swal2-toast.toast-sombra {
    background: #fff !important;
    box-shadow: 0 12px 40px rgba(0,0,0,0.15) !important;
    border-radius: 12px !important;
    border: none !important;
    padding: 10px 16px !important;
}
.swal2-toast.toast-sombra .swal2-title {
    font-size: 14px !important;
    font-weight: 500 !important;
    margin: 0 !important;
    padding: 0 !important;
    color: var(--ink) !important;
    grid-row: 1/99 !important;
    align-self: center !important;
}
.swal2-toast.toast-sombra .swal2-icon {
    font-size: 13px !important;
}
.swal2-toast.toast-sombra .swal2-timer-progress-bar {
    height: 3px !important;
    background: var(--line) !important;
}
.swal2-container:has(.toast-sombra) {
    overflow: visible !important;
}

/* ── Estilo 4: Minimalista ──────────────────────────────── */
.swal2-toast.toast-minimalista {
    background: rgba(255,255,255,0.95) !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06) !important;
    border: 1px solid var(--green) !important;
    border-radius: 6px !important;
    padding: 8px 14px !important;
}
.swal2-toast.toast-minimalista:has(.swal2-icon-error) { border-color: var(--red) !important; }
.swal2-toast.toast-minimalista:has(.swal2-icon-warning) { border-color: var(--orange) !important; }
.swal2-toast.toast-minimalista:has(.swal2-icon-info) { border-color: var(--blue) !important; }
.swal2-toast.toast-minimalista .swal2-title { font-size: 12px !important; }
.swal2-toast.toast-minimalista .swal2-icon { width: 18px !important; height: 18px !important; font-size: 10px !important; border-width: 1.5px !important; margin-right: 8px !important; }
.swal2-toast.toast-minimalista .swal2-icon.swal2-icon-success { border-color: var(--green) !important; color: var(--green) !important; }
.swal2-toast.toast-minimalista .swal2-icon.swal2-icon-error { border-color: var(--red) !important; color: var(--red) !important; }
.swal2-toast.toast-minimalista .swal2-icon.swal2-icon-warning { border-color: var(--orange) !important; color: var(--orange) !important; }
.swal2-toast.toast-minimalista .swal2-icon.swal2-icon-info { border-color: var(--blue) !important; color: var(--blue) !important; }

/* ── Estilo 5: Moderno ──────────────────────────────────── */
.swal2-toast.toast-moderno {
    background: var(--green) !important;
    border: none !important;
    border-radius: 100px !important;
    padding: 10px 22px !important;
    color: #fff !important;
    box-shadow: 0 6px 24px rgba(0,0,0,0.2) !important;
}
.swal2-toast.toast-moderno:has(.swal2-icon-error) { background: var(--red) !important; }
.swal2-toast.toast-moderno:has(.swal2-icon-warning) { background: var(--orange) !important; }
.swal2-toast.toast-moderno:has(.swal2-icon-info) { background: var(--blue) !important; }
.swal2-toast.toast-moderno .swal2-title { color: #fff !important; }
.swal2-toast.toast-moderno .swal2-icon { border-color: rgba(255,255,255,0.5) !important; color: #fff !important; }
