/* =====================================================================
   Gestor Patrimônio — visual alinhado ao Painel de Clientes (Gestor SCPI)
   Mesmos tokens de cor, fonte Inter, JetBrains Mono, raios, botões e
   campos. Bootstrap 5 continua por baixo; aqui só os estilos.
   ===================================================================== */
:root, [data-bs-theme="light"] {
  --bg: #f4f7f5; --surface: #ffffff; --surface-2: #eef3f0; --hover: #e6eeea;
  --ink: #0f1d18; --muted: #52635c; --faint: #66756f; --line: #dbe4df;
  --accent-soft: #e1f2e9; --accent-text: #076640;
  --ok: #08744a; --ok-bg: #e1f2e9; --bad: #b4302a; --bad-bg: #fbe9e7; --warn: #8f4c00; --warn-bg: #fdf0dc;
  --info: #1f5fae; --info-bg: #e5effb; --off: #5d6b66; --off-bg: #eceff0;
  --shadow: 0 1px 2px rgba(15,29,24,.06), 0 1px 1px rgba(15,29,24,.04);
  --shadow-lg: 0 12px 32px rgba(15,29,24,.16);
  --code: #0f1d18; --code-ink: #d9f2e6;
  --radius: 12px;

  /* variáveis antigas do sistema, agora apontando para os tokens */
  --gp-bg: var(--bg); --gp-border: var(--line); --gp-muted: var(--muted); --gp-heading: var(--ink);
  --sidebar-w: 248px;
  --gp-navy: #ffffff; --gp-navy-2: #e1f2e9; --gp-teal: #08744a; --gp-menu-txt: #52635c;
  --gp-login-1: #0f5a40; --gp-login-2: #0b3a2b;

  /* Bootstrap */
  --bs-primary: #08744a; --bs-primary-rgb: 8, 116, 74;
  --bs-link-color: var(--accent-text); --bs-link-hover-color: #065f3c;
  --bs-body-font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --bs-font-monospace: 'JetBrains Mono', ui-monospace, SFMono-Regular, Consolas, monospace;
  --bs-body-font-size: 14px; --bs-body-line-height: 1.45;
  --bs-body-bg: var(--bg); --bs-body-color: var(--ink);
  --bs-emphasis-color: var(--ink); --bs-secondary-color: var(--muted); --bs-tertiary-color: var(--faint);
  --bs-secondary-bg: var(--surface-2); --bs-tertiary-bg: var(--surface-2);
  --bs-border-color: var(--line); --bs-border-radius: 8px; --bs-border-radius-sm: 6px; --bs-border-radius-lg: 12px;
  --bs-success: #08744a; --bs-success-rgb: 8, 116, 74; --bs-danger: #b4302a; --bs-danger-rgb: 180, 48, 42;
  --bs-warning-rgb: 143, 76, 0; --bs-info-rgb: 31, 95, 174;
  color-scheme: light;
}
[data-bs-theme="dark"] {
  --bg: #0a1310; --surface: #101c18; --surface-2: #15241f; --hover: #1b2d27;
  --ink: #e6f0ec; --muted: #9fb4ab; --faint: #8aa197; --line: #233630;
  --accent-soft: #12342a; --accent-text: #5ad7a6;
  --ok: #4fd8a1; --ok-bg: #0f3327; --bad: #ff8a7e; --bad-bg: #3a1714; --warn: #f5b04f; --warn-bg: #382709;
  --info: #8db9f5; --info-bg: #132640; --off: #a3b3ad; --off-bg: #1d2b27;
  --shadow: 0 1px 2px rgba(0,0,0,.4); --shadow-lg: 0 12px 32px rgba(0,0,0,.5);
  --code: #06100d; --code-ink: #cdeee0;
  --bs-body-bg: var(--bg); --bs-body-color: var(--ink); --bs-emphasis-color: var(--ink);
  --bs-secondary-color: var(--muted); --bs-tertiary-color: var(--faint);
  --bs-secondary-bg: var(--surface-2); --bs-tertiary-bg: var(--surface-2); --bs-border-color: var(--line);
  --bs-link-color: var(--accent-text); --bs-link-hover-color: #8be4c1;
  color-scheme: dark;
}

html, body { background: var(--bg); color: var(--ink); }
body { font-family: var(--bs-body-font-family); font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--bs-primary); outline-offset: 2px; }
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { color: var(--ink); letter-spacing: -.01em; }
.text-muted, .form-text { color: var(--muted) !important; }
.font-monospace, code, kbd { font-family: var(--bs-font-monospace) !important; font-variant-numeric: tabular-nums; }
.min-w-0 { min-width: 0; }
hr { border-color: var(--line); opacity: 1; }

/* ---------- botões (iguais ao painel) */
.btn { --bs-btn-font-weight: 600; --bs-btn-border-radius: 8px; --bs-btn-padding-x: 14px; --bs-btn-font-size: 14px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .1s; }
.btn:active { transform: scale(.97); }
.btn i { line-height: 1; }
.btn-sm { --bs-btn-padding-x: 10px; --bs-btn-font-size: 13px; min-height: 34px; }
.btn-lg { min-height: 44px; --bs-btn-font-size: 15px; }
.btn-link { min-height: 0; padding: 0; --bs-btn-font-weight: 600; --bs-btn-color: var(--accent-text); --bs-btn-hover-color: var(--bs-link-hover-color); text-decoration: none; }
.btn-primary { --bs-btn-bg: var(--bs-primary); --bs-btn-border-color: var(--bs-primary); --bs-btn-color: #fff; --bs-btn-hover-color: #fff; --bs-btn-active-color: #fff;
  --bs-btn-hover-bg: #065f3c; --bs-btn-hover-border-color: #065f3c; --bs-btn-active-bg: #054d31; --bs-btn-active-border-color: #054d31; }
[data-bs-theme="dark"] .btn-primary { --bs-btn-color: #04150e; --bs-btn-hover-color: #04150e; --bs-btn-active-color: #04150e; }
.btn-outline-secondary, .btn-light, .btn-outline-dark {
  --bs-btn-color: var(--ink); --bs-btn-bg: var(--surface); --bs-btn-border-color: var(--line);
  --bs-btn-hover-color: var(--ink); --bs-btn-hover-bg: var(--hover); --bs-btn-hover-border-color: var(--line);
  --bs-btn-active-color: var(--ink); --bs-btn-active-bg: var(--hover); --bs-btn-active-border-color: var(--line);
  --bs-btn-disabled-color: var(--faint); --bs-btn-disabled-bg: var(--surface); --bs-btn-disabled-border-color: var(--line); }
.btn-outline-primary { --bs-btn-color: var(--accent-text); --bs-btn-border-color: var(--line); --bs-btn-bg: var(--surface);
  --bs-btn-hover-color: var(--accent-text); --bs-btn-hover-bg: var(--accent-soft); --bs-btn-hover-border-color: var(--bs-primary);
  --bs-btn-active-color: var(--accent-text); --bs-btn-active-bg: var(--accent-soft); --bs-btn-active-border-color: var(--bs-primary); }
.btn-outline-danger { --bs-btn-color: var(--bad); --bs-btn-border-color: var(--line); --bs-btn-bg: var(--surface);
  --bs-btn-hover-color: var(--bad); --bs-btn-hover-bg: var(--bad-bg); --bs-btn-hover-border-color: var(--bad); --bs-btn-active-bg: var(--bad-bg); --bs-btn-active-color: var(--bad); }
.btn-outline-success { --bs-btn-color: var(--ok); --bs-btn-border-color: var(--line); --bs-btn-bg: var(--surface); --bs-btn-hover-color: var(--ok); --bs-btn-hover-bg: var(--ok-bg); --bs-btn-hover-border-color: var(--ok); }
.btn-outline-warning { --bs-btn-color: var(--warn); --bs-btn-border-color: var(--warn); --bs-btn-hover-color: var(--warn); --bs-btn-hover-bg: var(--warn-bg); --bs-btn-hover-border-color: var(--warn); }
.btn-danger { --bs-btn-bg: var(--bad); --bs-btn-border-color: var(--bad); --bs-btn-hover-bg: #962723; --bs-btn-hover-border-color: #962723; }
.btn-success { --bs-btn-bg: var(--bs-primary); --bs-btn-border-color: var(--bs-primary); --bs-btn-hover-bg: #065f3c; --bs-btn-hover-border-color: #065f3c; }
.btn-teal { background: var(--gp-teal); color: #fff; border-color: var(--gp-teal); }
.btn-teal:hover { background: #065f3c; border-color: #065f3c; color: #fff; }
.btn-close { min-height: 0; }

/* ---------- layout */
.gp-sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); background: var(--gp-navy); color: var(--gp-menu-txt);
  display: flex; flex-direction: column; z-index: 1030; }
.gp-brand { padding: 18px 20px 14px; display: flex; gap: 10px; align-items: center; color: #fff; }
.gp-brand img { width: 38px; height: 38px; }
.gp-brand .fw-semibold { font-weight: 700 !important; font-size: 15px; }
.gp-brand small { display: block; color: #8fa6c4; font-size: 12.5px; line-height: 1.2; }
.gp-nav { padding: 4px 14px 14px; flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.gp-nav .nav-section { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: #6f88a8; padding: 14px 10px 6px; }
.gp-nav a { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 8px 10px; border-radius: 8px; color: var(--gp-menu-txt);
  text-decoration: none; font-weight: 500; transition: background .15s, color .15s; }
.gp-nav a i { font-size: 17px; width: 18px; text-align: center; }
.gp-nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.gp-nav a.active { background: var(--gp-navy-2); color: #fff; font-weight: 600; box-shadow: inset 3px 0 0 var(--gp-teal); }
.gp-user { padding: 12px 18px; border-top: 1px solid rgba(255,255,255,.08); font-size: 13px; }
.gp-user-nome { color: #fff; font-weight: 600; }
.gp-user-perfil { color: #8fa6c4; }
.gp-btn-side { --bs-btn-color: #fff; --bs-btn-border-color: rgba(255,255,255,.35); --bs-btn-hover-bg: rgba(255,255,255,.1); --bs-btn-hover-color: #fff; --bs-btn-hover-border-color: rgba(255,255,255,.5); width: 34px; padding: 0; }

/* menu claro = visual do Painel de Clientes */
body.gp-menu-claro .gp-sidebar { background: var(--surface); border-right: 1px solid var(--line); color: var(--muted); }
body.gp-menu-claro .gp-brand { color: var(--ink); }
body.gp-menu-claro .gp-brand small, body.gp-menu-claro .gp-user-perfil { color: var(--faint); }
body.gp-menu-claro .gp-nav .nav-section { color: var(--faint); }
body.gp-menu-claro .gp-nav a { color: var(--muted); }
body.gp-menu-claro .gp-nav a:hover { background: var(--hover); color: var(--ink); }
body.gp-menu-claro .gp-nav a.active { background: var(--accent-soft); color: var(--accent-text); box-shadow: none; }
body.gp-menu-claro .gp-user { border-top-color: var(--line); }
body.gp-menu-claro .gp-user-nome { color: var(--ink); }
body.gp-menu-claro .gp-btn-side { --bs-btn-color: var(--muted); --bs-btn-border-color: transparent; --bs-btn-bg: transparent;
  --bs-btn-hover-bg: var(--hover); --bs-btn-hover-color: var(--ink); --bs-btn-hover-border-color: transparent; --bs-btn-active-bg: var(--hover); --bs-btn-active-color: var(--ink); }

.gp-main { margin-left: var(--sidebar-w); min-height: 100vh; }
.gp-topbar { background: var(--surface); border-bottom: 1px solid var(--line); padding: 12px 28px; position: sticky; top: 0; z-index: 1020;
  display: flex; align-items: center; gap: 12px; min-height: 64px; }
.gp-topbar h1 { font-size: 20px; margin: 0; font-weight: 700; color: var(--ink); letter-spacing: -.01em; }
.gp-topbar .btn-tema { border: 0; background: transparent; color: var(--muted); width: 40px; height: 40px; border-radius: 8px; font-size: 18px;
  display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.gp-topbar .btn-tema:hover { background: var(--hover); color: var(--ink); }
.gp-content { padding: 26px 28px 56px; max-width: 1440px; }
.gp-bottomnav { display: none; }

@media (max-width: 991.98px) {
  .gp-sidebar { display: none; }
  .gp-main { margin-left: 0; padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
  .gp-topbar { padding: 10px 16px; min-height: 56px; background: var(--gp-navy); border: 0; color: #fff; }
  .gp-topbar h1 { color: #fff; font-size: 17px; }
  .gp-topbar .btn-tema { color: #fff; }
  body.gp-menu-claro .gp-topbar { background: var(--surface); border-bottom: 1px solid var(--line); color: var(--ink); }
  body.gp-menu-claro .gp-topbar h1 { color: var(--ink); }
  body.gp-menu-claro .gp-topbar .btn-tema { color: var(--muted); }
  .gp-topbar .btn-light-outline { color: #fff; border-color: rgba(255,255,255,.3); }
  #b-recolher { display: none; }
  .gp-content { padding: 16px; }
  .gp-bottomnav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 1030; background: var(--surface);
    border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    justify-content: space-around; align-items: flex-end; box-shadow: 0 -4px 18px rgba(15,29,24,.06); }
  .gp-bottomnav a { flex: 1; text-align: center; color: var(--faint); text-decoration: none; font-size: 11px; font-weight: 600; padding: 2px 0; }
  .gp-bottomnav a i { display: block; font-size: 21px; line-height: 1.3; }
  .gp-bottomnav a.active { color: var(--accent-text); }
  .gp-bottomnav a.fab i { width: 54px; height: 54px; margin: -22px auto 2px; border-radius: 50%; background: var(--gp-teal); color: #fff;
    display: flex; align-items: center; justify-content: center; font-size: 26px; box-shadow: 0 6px 16px rgba(8,116,74,.4); }
}

/* menu recolhido no computador */
@media (min-width: 992px) {
  body.gp-recolhido { --sidebar-w: 72px; }
  body.gp-recolhido .gp-brand > div, body.gp-recolhido .gp-nav .nav-section, body.gp-recolhido .gp-nav a span,
  body.gp-recolhido .gp-user > div, body.gp-recolhido .gp-user #b-perfil { display: none; }
  body.gp-recolhido .gp-brand { justify-content: center; padding: 18px 8px; }
  body.gp-recolhido .gp-nav { padding: 4px 10px; }
  body.gp-recolhido .gp-nav a { justify-content: center; padding: 10px 6px; }
  body.gp-recolhido .gp-nav .nav-section { display: block; height: 1px; padding: 0; margin: 10px 8px; background: var(--line); font-size: 0; }
  body.gp-recolhido .gp-user { justify-content: center; padding: 12px 6px; }
  .gp-sidebar, .gp-main { transition: width .18s ease, margin-left .18s ease; }
}

/* ---------- cartões */
.card { --bs-card-bg: var(--surface); --bs-card-border-color: var(--line); --bs-card-border-radius: var(--radius); --bs-card-inner-border-radius: calc(var(--radius) - 1px);
  --bs-card-cap-bg: var(--surface); --bs-card-spacer-x: 18px; --bs-card-spacer-y: 16px; --bs-card-cap-padding-x: 18px; --bs-card-cap-padding-y: 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); color: var(--ink); }
.card-header { background: var(--surface); border-bottom: 1px solid var(--line); font-weight: 600; font-size: 15px; color: var(--ink); }
.card-header:first-child { border-radius: calc(var(--radius) - 1px) calc(var(--radius) - 1px) 0 0; }
.card-header i { color: var(--accent-text); margin-right: 6px; }
.card-footer { background: var(--surface); border-top: 1px solid var(--line); }
.stat { display: flex; gap: 14px; align-items: center; }
.stat .ic { width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.stat .v { font-size: 28px; font-weight: 700; color: var(--ink); line-height: 1.1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat .l { font-size: 13px; color: var(--muted); font-weight: 500; }
.display-6 { font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.bg-soft-primary { background: var(--accent-soft); color: var(--accent-text); }
.bg-soft-teal { background: var(--ok-bg); color: var(--ok); }
.bg-soft-warning { background: var(--warn-bg); color: var(--warn); }
.bg-soft-purple { background: #efe8fd; color: #6024c4; }
.bg-soft-danger { background: var(--bad-bg); color: var(--bad); }
[data-bs-theme="dark"] .bg-soft-purple { background: #2a1f45; color: #cbb9fa; }
.bg-light { background-color: var(--surface-2) !important; }
.bg-white { background-color: var(--surface) !important; }
.border, .border-top, .border-bottom, .border-start, .border-end { border-color: var(--line) !important; }

/* ---------- formulários */
.form-label { font-weight: 600; font-size: 13px; color: var(--ink); margin-bottom: 6px; }
.form-control, .form-select { min-height: 40px; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px;
  background-color: var(--surface); color: var(--ink); font-size: 14px; }
.form-control::placeholder { color: var(--faint); }
.form-control-sm, .form-select-sm { min-height: 34px; padding: 5px 10px; font-size: 13px; border-radius: 6px; }
.form-control-lg { min-height: 44px; font-size: 15px; }
textarea.form-control { min-height: 90px; }
.form-control:focus, .form-select:focus { border-color: transparent; box-shadow: none; outline: 2px solid var(--bs-primary); outline-offset: -1px; background-color: var(--surface); color: var(--ink); }
.form-control:disabled, .form-control[readonly], .form-select:disabled { background-color: var(--surface-2); }
@media (max-width: 991.98px) { .form-control, .form-select { font-size: 16px; } } /* evita zoom no iOS */
.input-group-text { background: var(--surface-2); border-color: var(--line); color: var(--muted); }
.input-group .btn { border-color: var(--line); min-height: 0; }
.form-check-input { border-color: var(--line); background-color: var(--surface); }
.form-check-input:checked { background-color: var(--bs-primary); border-color: var(--bs-primary); }
.form-check-input:focus { box-shadow: 0 0 0 3px var(--accent-soft); border-color: var(--bs-primary); }
.form-switch .form-check-input { width: 2.4em; height: 1.3em; margin-top: .1em; }
.form-check-label { font-weight: 500; }
.was-validated .form-control:invalid, .form-control.is-invalid { border-color: var(--bad); }

/* ---------- abas (nav-pills/nav-tabs viram as abas do painel) */
.nav-pills, .nav-tabs { gap: 4px; border-bottom: 1px solid var(--line); flex-wrap: nowrap; }
.nav-pills .nav-link, .nav-tabs .nav-link { border: 0; border-radius: 0; background: transparent !important; color: var(--muted); font-weight: 600;
  padding: 10px 14px; min-height: 44px; display: inline-flex; align-items: center; gap: 4px; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.nav-pills .nav-link:hover, .nav-tabs .nav-link:hover { color: var(--ink); }
.nav-pills .nav-link.active, .nav-tabs .nav-link.active { color: var(--accent-text) !important; border-bottom-color: var(--bs-primary); background: transparent !important; }
.nav-pills .badge { font-size: 11px; }

/* ---------- tabelas */
.table { --bs-table-bg: transparent; --bs-table-color: var(--ink); --bs-table-border-color: var(--line); --bs-table-hover-bg: var(--hover); --bs-table-hover-color: var(--ink);
  --bs-table-striped-bg: var(--surface-2); font-size: 13.5px; margin-bottom: 0; }
.table > :not(caption) > * > * { padding: 10px 14px; border-bottom-color: var(--line); vertical-align: middle; }
.table-sm > :not(caption) > * > * { padding: 7px 12px; }
.table thead th, .table-light th { font-size: 12px; font-weight: 600; color: var(--faint); white-space: nowrap; }
.table-light, .table > thead.table-light > tr > * { --bs-table-bg: var(--surface-2); --bs-table-color: var(--faint); --bs-table-border-color: var(--line); }
.table-responsive { border-radius: inherit; }

/* ---------- badges, alertas, listas, modais, toasts */
.badge { font-weight: 600; font-size: 12px; border-radius: 999px; padding: 4px 9px; }
.text-bg-success { background: var(--ok-bg) !important; color: var(--ok) !important; }
.text-bg-danger { background: var(--bad-bg) !important; color: var(--bad) !important; }
.text-bg-warning { background: var(--warn-bg) !important; color: var(--warn) !important; }
.text-bg-info, .text-bg-primary { background: var(--info-bg) !important; color: var(--info) !important; }
.text-bg-secondary, .text-bg-light { background: var(--off-bg) !important; color: var(--off) !important; }
.text-bg-dark { background: var(--ink) !important; color: var(--surface) !important; }
.text-primary { color: var(--accent-text) !important; }
.text-success { color: var(--ok) !important; } .text-danger { color: var(--bad) !important; } .text-warning { color: var(--warn) !important; } .text-info { color: var(--info) !important; }
.alert { border: 0; border-radius: 10px; padding: 12px 14px; font-size: 13.5px; }
.alert-info, .alert-primary { background: var(--info-bg); color: var(--info); }
.alert-success { background: var(--ok-bg); color: var(--ok); }
.alert-warning { background: var(--warn-bg); color: var(--warn); }
.alert-danger { background: var(--bad-bg); color: var(--bad); }
.alert-secondary, .alert-light { background: var(--surface-2); color: var(--muted); }
.alert a { color: inherit; font-weight: 600; }
.list-group { --bs-list-group-bg: var(--surface); --bs-list-group-color: var(--ink); --bs-list-group-border-color: var(--line);
  --bs-list-group-action-hover-bg: var(--hover); --bs-list-group-action-hover-color: var(--ink); --bs-list-group-active-bg: var(--accent-soft);
  --bs-list-group-active-color: var(--accent-text); --bs-list-group-active-border-color: var(--line); }
.progress { --bs-progress-bg: var(--surface-2); --bs-progress-bar-bg: var(--bs-primary); --bs-progress-border-radius: 999px; height: 8px; }
.modal { --bs-modal-bg: var(--surface); --bs-modal-border-color: var(--line); --bs-modal-border-radius: 14px; --bs-modal-header-border-color: var(--line);
  --bs-modal-footer-border-color: var(--line); --bs-modal-padding: 18px 20px; --bs-modal-header-padding: 18px 20px; --bs-modal-color: var(--ink); }
.modal-content { box-shadow: var(--shadow-lg); }
.modal-title { font-size: 18px; font-weight: 700; }
.modal-backdrop { --bs-backdrop-bg: #0a1410; --bs-backdrop-opacity: .38; }
.dropdown-menu { --bs-dropdown-bg: var(--surface); --bs-dropdown-border-color: var(--line); --bs-dropdown-link-hover-bg: var(--hover); --bs-dropdown-link-color: var(--ink); border-radius: 10px; box-shadow: var(--shadow-lg); }
.toast-container { top: auto !important; bottom: 0; }
@media (max-width: 991.98px) { .toast-container { bottom: calc(70px + env(safe-area-inset-bottom)); } }
.toast { border-radius: 10px; box-shadow: var(--shadow-lg); font-weight: 500; }
.toast.text-bg-success { background: var(--ink) !important; color: var(--surface) !important; }
.toast.text-bg-success .btn-close { filter: none; }
[data-bs-theme="light"] .toast.text-bg-success .btn-close { filter: invert(1) grayscale(100%) brightness(200%); }
.toast.text-bg-danger { background: var(--bad) !important; color: #fff !important; }
.toast.text-bg-warning { background: var(--warn) !important; color: #fff !important; }
.toast.text-bg-info { background: var(--info) !important; color: #fff !important; }
.spinner-border.text-primary { color: var(--bs-primary) !important; }
pre.sql { background: var(--code); color: var(--code-ink); border-radius: 10px; padding: 14px 16px; max-height: 380px; font-family: var(--bs-font-monospace); font-size: 12.5px; line-height: 1.6; }

/* ---------- telas específicas */
.busca-placa { background: linear-gradient(135deg, var(--gp-login-2), var(--gp-login-1)); color: #fff; border: 0; }
.busca-placa .form-label { color: rgba(255,255,255,.75) !important; }
.busca-placa .form-control { font-family: var(--bs-font-monospace); font-size: 22px; font-weight: 600; letter-spacing: .06em; text-align: center;
  min-height: 52px; background: #fff; color: #0f1d18; border: 0; }
.busca-placa .card-body { padding: 18px; }
.busca-placa a { color: #fff; }

.anterior-box { background: var(--warn-bg); border: 1px dashed var(--warn); border-radius: 10px; padding: 12px 16px; }
.anterior-box dt { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--warn); font-weight: 600; }
.anterior-box dd { margin-bottom: 8px; font-weight: 500; }

.foto-slot { position: relative; aspect-ratio: 1; border: 2px dashed var(--line); border-radius: 10px; background: var(--surface-2);
  display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--faint); cursor: pointer; overflow: hidden; font-size: 12px; text-align: center; }
.foto-slot:hover { border-color: var(--bs-primary); color: var(--accent-text); }
.foto-slot i { font-size: 28px; color: var(--faint); }
.foto-slot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.foto-slot .rm { position: absolute; top: 4px; right: 4px; z-index: 2; border-radius: 50%; width: 28px; height: 28px; min-height: 0; padding: 0; line-height: 1; }
.foto-slot .ld { position: absolute; inset: 0; background: rgba(255,255,255,.75); display: flex; align-items: center; justify-content: center; z-index: 3; }
.foto-slot.is-invalid { border-color: var(--bad); background: var(--bad-bg); }

.pin { border: 0; background: none; color: var(--faint); padding: 0 3px; font-size: 14px; }
.pin.on { color: var(--accent-text); }
.label-row { display: flex; justify-content: space-between; align-items: center; }

.bem-item { display: flex; gap: 12px; align-items: center; padding: 12px 18px; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; transition: background .15s; }
.bem-item:hover { background: var(--hover); color: inherit; }
.bem-item:last-child { border-bottom: 0; }
.bem-thumb { width: 48px; height: 48px; border-radius: 10px; object-fit: cover; background: var(--surface-2); flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: var(--faint); font-size: 20px; }
.bem-item .t { font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bem-item .s { font-size: 12.5px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chapa-badge { font-family: var(--bs-font-monospace); font-variant-numeric: tabular-nums; background: var(--accent-soft); color: var(--accent-text); font-weight: 600; border-radius: 6px; padding: 2px 7px; font-size: 12.5px; }

.sticky-actions { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--bg) 30%); padding: 16px 0 8px; z-index: 5; }
@media (max-width: 991.98px) { .sticky-actions { bottom: calc(68px + env(safe-area-inset-bottom)); } }

.ia-sugestao { background: var(--ok-bg); border: 1px solid transparent; border-radius: 10px; padding: 12px 16px; }
.log-det { max-width: 420px; font-size: 12px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#scanner-video { width: 100%; border-radius: 10px; background: #000; }
.cot-item { cursor: pointer; }
.cot-item.sel { background: var(--accent-soft); }
.cot-resumo { position: sticky; top: 76px; z-index: 4; }
.perm-grupo .form-check { margin-bottom: 4px; }
.cor-campo { display: flex; gap: 8px; align-items: center; }
.cor-campo input[type=color] { width: 44px; height: 40px; padding: 2px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); }

/* ---------- login (mesmo layout dividido do painel) */
.gp-login { min-height: 100vh; display: flex; flex-wrap: wrap; background: var(--bg); }
.gp-login-art { flex: 1 1 420px; background: radial-gradient(circle at 20% 10%, var(--gp-login-1) 0, var(--gp-login-2) 60%); color: #e7f5ee;
  padding: 48px; display: flex; flex-direction: column; justify-content: space-between; gap: 32px; }
.gp-login-art h1 { margin: 0 0 18px; font-size: 38px; line-height: 1.12; letter-spacing: -.02em; font-weight: 700; color: #fff; }
.gp-login-art p { margin: 0; font-size: 16px; color: #c6e2d5; max-width: 520px; }
.gp-login-sub { font-size: 13px; color: #b9d8ca; }
.gp-login-form { flex: 1 1 420px; display: flex; align-items: center; justify-content: center; padding: 48px 24px; }
.login-card { width: 100%; max-width: 400px; }
.login-card .card-body { padding: 28px; }
.login-card h2 { font-size: 22px; font-weight: 700; }
@media (max-width: 820px) { .gp-login-art { padding: 28px 20px; flex-basis: 100%; } .gp-login-art h1 { font-size: 26px; } .gp-login-art p { display: none; } }
/* identidade visual configurável (Personalização › Aparência) */
.gp-login-logo { width: auto; max-width: 180px; object-fit: contain; flex: 0 0 auto; }
.gp-logo-moldura { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; box-sizing: border-box; max-width: 220px; }
.gp-logo-moldura img { height: 100%; width: auto; max-width: 100%; object-fit: contain; display: block; }
.gp-logo-moldura.branco { background: #fff; border-radius: 12px; padding: 5px; box-shadow: 0 1px 4px rgba(0,0,0,.18); }
.gp-logo-moldura.circulo { background: #fff; border-radius: 50%; padding: 7px; aspect-ratio: 1; box-shadow: 0 1px 4px rgba(0,0,0,.18); }
.gp-logo-moldura.menu.branco, .gp-logo-moldura.menu.circulo { box-shadow: 0 0 0 1px rgba(0,0,0,.08); padding: 3px; }
.gp-brand .gp-logo-moldura img { width: auto; height: 100%; }
.gp-login-art.com-imagem h1, .gp-login-art.com-imagem p, .gp-login-art.com-imagem .gp-login-sub, .gp-login-art.com-imagem .fw-bold { text-shadow: 0 1px 3px rgba(0,0,0,.45); }
.ap-img-prev { height: 96px; border-radius: 8px; background: repeating-conic-gradient(#e9ecef 0 25%, #fff 0 50%) 0 0 / 14px 14px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.ap-img-prev img { width: 100%; height: 100%; object-fit: cover; }
.ap-img-prev.logo img { width: auto; max-width: 100%; height: 64px; object-fit: contain; }
.ap-prev-login { display: flex; height: 230px; }
.ap-prev-esq { flex: 1; color: #fff; padding: 14px; display: flex; flex-direction: column; justify-content: space-between; }
.ap-prev-esq .gp-login-logo { max-width: 90px; }
.ap-prev-dir { flex: 1; display: flex; align-items: center; justify-content: center; }
.ap-prev-card { width: 62%; background: #fff; border-radius: 8px; padding: 10px; display: flex; flex-direction: column; gap: 6px; box-shadow: 0 2px 8px rgba(0,0,0,.12); font-size: 11px; color: #111; }
.ap-prev-card span { height: 12px; border: 1px solid #dee2e6; border-radius: 4px; }
.ap-prev-card i { height: 14px; border-radius: 4px; background: var(--bs-primary); }
/* imagem de fundo em tamanho original (nunca amplia) */
.gp-login-art, .gp-login-form, .ap-prev-esq, .ap-prev-dir { position: relative; overflow: hidden; }
.gp-login-bgimg { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); max-width: 90%; max-height: 90%; width: auto; height: auto; pointer-events: none; }
.gp-login-bgimg.mini { transform: translate(-50%, -50%) scale(.33); max-width: 270%; max-height: 270%; }
/* camada da imagem de fundo (permite intensidade/transparência) */
.gp-login-bgcamada { position: absolute; inset: 0; pointer-events: none; }
.gp-login-art > :not(.gp-login-bgimg):not(.gp-login-bgcamada), .gp-login-form > :not(.gp-login-bgimg):not(.gp-login-bgcamada):not(.gp-login-marca),
.ap-prev-esq > :not(.gp-login-bgimg):not(.gp-login-bgcamada), .ap-prev-dir > :not(.gp-login-bgimg):not(.gp-login-bgcamada):not(.gp-login-marca) { position: relative; z-index: 1; }
/* marca no canto inferior direito */
.gp-login-form > .gp-login-marca, .ap-prev-dir > .gp-login-marca { position: absolute; right: 20px; bottom: 14px; z-index: 2; }
.gp-login-marca, .gp-login-marca a { display: flex; align-items: center; gap: 8px; color: var(--muted, #6b7a72); font-size: 12px; text-decoration: none; }
.gp-login-marca a:hover span { text-decoration: underline; }
.gp-login-marca img { width: auto; max-width: 200px; object-fit: contain; display: block; }
.ap-prev-dir > .gp-login-marca.mini { right: 8px; bottom: 6px; gap: 4px; font-size: 7px; }
.gp-login-marca.mini img { max-width: 90px; }
@media (max-width: 991.98px) { .gp-login-form { padding-bottom: 64px; } }
/* tela de login antiga (mantida para compatibilidade) */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; background: radial-gradient(circle at 20% 10%, var(--gp-login-1) 0, var(--gp-login-2) 55%); }

/* ---------- animações (iguais ao painel) */
@keyframes gpFadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
#conteudo > * { animation: gpFadeUp .32s cubic-bezier(.2,.7,.2,1) both; }
#conteudo > *:nth-child(2) { animation-delay: .03s; } #conteudo > *:nth-child(3) { animation-delay: .06s; } #conteudo > *:nth-child(n+4) { animation-delay: .09s; }
.login-card { animation: gpFadeUp .4s cubic-bezier(.2,.8,.2,1) both; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* modais cujo conteúdo é um <form>: o form não pode quebrar o layout rolável do Bootstrap */
.modal-content > form { display: contents; }
.btn { background-image: none; }
.busca-placa .form-control::placeholder { font-family: var(--bs-body-font-family); font-size: 16px; font-weight: 500; letter-spacing: 0; color: #66756f; }

/* ===================== termo de responsabilidade (folhas A4) ===================== */
#termo-print { position: fixed; inset: 0; z-index: 2000; background: #525659; overflow: auto; }
body.termo-aberto { overflow: hidden; }
.termo-barra { position: sticky; top: 0; z-index: 2; display: flex; gap: 8px; align-items: center; padding: 10px 16px; background: #fff; border-bottom: 1px solid #ddd; color: #111; }
.termo-folhas { padding: 24px 0; display: flex; flex-direction: column; align-items: center; gap: 24px; }
.termo-folha { width: 210mm; height: 297mm; padding: 10mm 24mm 12mm 27mm; background: #fff; color: #000; box-shadow: 0 2px 12px rgba(0,0,0,.4); overflow: hidden; box-sizing: border-box; flex: 0 0 auto;
  font-family: Arial, Helvetica, "Liberation Sans", sans-serif; font-size: 8pt; line-height: 1.25; }
.termo-folha * { box-sizing: border-box; }
.tr-cab { display: flex; align-items: flex-start; height: 25mm; }
.tr-logo { width: 28mm; padding-left: 3mm; flex: 0 0 auto; }
.tr-logo img { max-height: 23mm; max-width: 24mm; display: block; }
.tr-org { flex: 1; padding-top: 3.4mm; }
.tr-nome { font-size: 12.5pt; font-weight: bold; letter-spacing: -.1pt; }
.tr-cnpj { font-size: 10pt; font-weight: bold; margin-top: 1.6mm; }
.tr-end { font-size: 10pt; margin-top: 2.1mm; }
.tr-dir { width: 30mm; text-align: right; padding-right: 7mm; padding-top: 3.4mm; font-size: 10pt; }
.tr-dir > div:nth-child(1) { font-size: 12.5pt; }
.tr-dir > div:nth-child(2) { margin-top: 1.6mm; }
.tr-dir > div:nth-child(3) { margin-top: 2.1mm; }
.tr-titulo { text-align: center; font-weight: bold; font-size: 10.5pt; margin-top: 0; }
.tr-texto { font-size: 10.2pt; line-height: 1.12; text-align: justify; margin: 1.6mm 0 0 2mm; }
.tr-local { margin-top: 8mm; border-collapse: collapse; font-size: 8pt; }
.termo-folha .tr-local td { padding: 0 0 1.6mm 0; border: 0; background: none; }
.tr-local .tr-rot { width: 24mm; }
.tr-dupla { border-top: 1.4px solid #000; border-bottom: .6px solid #000; height: 1.1mm; margin-top: 2mm; }
.tr-tab { width: 100%; border-collapse: collapse; font-size: 8pt; margin-top: .6mm; }
.termo-folha .tr-tab th { font-weight: normal; text-align: left; padding: .6mm 0 1.6mm; border: 0; background: none; }
.termo-folha .tr-tab td { vertical-align: top; padding: .25mm 0 .55mm; border: 0; background: none; line-height: 1.2; }
.termo-folha .tr-tab td:nth-child(2) { padding-right: 9mm; }
.termo-folha .tr-tab td.tr-c1 { width: 24mm; padding-left: 4.5mm; white-space: nowrap; }
.termo-folha .tr-tab th.tr-c1 { width: 24mm; padding-left: 0; }
.termo-folha .tr-tab .tr-c3 { width: 25mm; text-align: right; padding-right: 1mm; white-space: nowrap; }
.tr-tab tr { page-break-inside: avoid; break-inside: avoid; }
.tr-fim { break-inside: avoid; }
.tr-total { display: flex; justify-content: space-between; align-items: flex-end; margin-top: 1.5mm; }
.tr-total span { padding-bottom: .4mm; }
.tr-total b { font-size: 10pt; border-top: .8px solid #000; min-width: 35mm; text-align: right; padding: 1.6mm 1mm 0 0; }
.tr-fim .tr-dupla { margin-top: .6mm; }
.tr-data { text-align: right; margin: 2.4mm -3mm 0 0; font-size: 8pt; }
.tr-ass { display: flex; justify-content: flex-start; gap: 13mm; margin: 37mm 0 0 7mm; font-size: 8pt; text-align: center; line-height: 1.45; }
.tr-ass > div { width: 60mm; }
.tr-linha { border-top: 1.4px solid #000; margin-bottom: 2.4mm; }
@media print {
  @page { size: A4; margin: 0; }
  body.termo-aberto > *:not(#termo-print) { display: none !important; }
  body.termo-aberto { overflow: visible; background: #fff; }
  #termo-print { position: static; overflow: visible; background: #fff; }
  .termo-barra { display: none !important; }
  .termo-folhas { padding: 0; gap: 0; display: block; }
  .termo-folha { box-shadow: none; margin: 0; page-break-after: always; break-after: page; }
  .termo-folha:last-child { page-break-after: auto; break-after: auto; }
}
@media screen and (max-width: 860px) { .termo-folhas { zoom: .45; } }
