/* ==================== App shell (cabeçalho global + painel) ==================== */
:root {
  --shell-bg: #e8edf3;
  --shell-panel-bg: #ffffff;
  --shell-border: #dde3ec;
  --shell-fg: #0f1b3d;
  --shell-primary: #0f1b3d;
  --shell-primary-dark: #0a1329;
  --shell-muted: #eef1f6;
  --shell-muted-fg: #6c757d;
  --shell-footer-bg: #fafbfc;
  --shell-kicker: #4a7ab8;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

body.app-shell-body {
  background: var(--shell-bg);
  font-family: 'Manrope', sans-serif;
  color: var(--shell-fg);
  margin: 0;
}

/* ---- Layout: sidebar fixa + coluna principal (topbar + conteúdo) ---- */
.app-shell-layout {
  --sidebar-w: 13.25rem;
  min-height: 100vh;
}
html.sidebar-collapsed .app-shell-layout { --sidebar-w: 4.5rem; }

.app-sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--shell-primary);
  color: #fff;
  display: flex;
  flex-direction: column;
  z-index: 20;
  transition: width .18s ease;
  overflow: hidden;
}

.app-sidebar-brand {
  display: flex; align-items: center; gap: .75rem;
  padding: 1.15rem 1.4rem; text-decoration: none; color: #fff;
  flex: 0 0 auto; white-space: nowrap;
}
.app-sidebar-brand-icon {
  width: 2.25rem; height: 2.25rem; border-radius: 50%;
  background: #fff;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; overflow: hidden;
}
.app-sidebar-brand-icon img { width: 100%; height: 100%; object-fit: cover; }
.app-sidebar-brand-text { font-family: 'Sora', sans-serif; font-weight: 700; font-size: 1.05rem; }

.app-sidebar-nav { flex: 1 1 auto; overflow-y: auto; overflow-x: hidden; padding: .5rem .75rem; display: flex; flex-direction: column; gap: .15rem; }
.app-sidebar-link {
  display: flex; align-items: center; gap: .55rem;
  padding: .6rem .65rem; border-radius: .55rem;
  color: rgba(255,255,255,.72); text-decoration: none;
  font-size: .8rem; font-weight: 600; white-space: nowrap;
}
.app-sidebar-link i { font-size: .98rem; width: 1.05rem; text-align: center; flex-shrink: 0; }
.app-sidebar-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.app-sidebar-link.is-active { background: rgba(255,255,255,.15); color: #fff; }

/* ---- Grupos de navegação (módulo > unidade > funcionalidade) ---- */
.app-sidebar-group-toggle {
  width: 100%; display: flex; align-items: center; gap: .55rem;
  padding: .6rem .65rem; border-radius: .55rem; border: none; background: none;
  color: rgba(255,255,255,.72); font-size: .8rem; font-weight: 600; white-space: nowrap;
  cursor: pointer; text-align: left;
}
.app-sidebar-group-toggle i:first-child { font-size: .98rem; width: 1.05rem; text-align: center; flex-shrink: 0; }
.app-sidebar-group-toggle:hover { background: rgba(255,255,255,.08); color: #fff; }
.app-sidebar-group-toggle.has-active { color: #fff; }

.app-sidebar-group-caret { margin-left: auto; font-size: .7rem; transition: transform .15s ease; flex-shrink: 0; }
.app-sidebar-group.is-open > .app-sidebar-group-toggle .app-sidebar-group-caret,
.app-sidebar-subgroup.is-open > .app-sidebar-subgroup-toggle .app-sidebar-group-caret { transform: rotate(90deg); }

.app-sidebar-group-body { max-height: 0; overflow: hidden; transition: max-height .2s ease; }
.app-sidebar-group.is-open > .app-sidebar-group-body,
.app-sidebar-subgroup.is-open > .app-sidebar-group-body { max-height: 800px; }

.app-sidebar-subgroup-toggle {
  width: 100%; display: flex; align-items: center; gap: .5rem;
  padding: .4rem .65rem .4rem 1.2rem; border: none; background: none;
  color: rgba(255,255,255,.55); font-size: .62rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  white-space: nowrap; cursor: pointer; text-align: left; border-radius: .55rem;
}
.app-sidebar-subgroup-toggle:hover { background: rgba(255,255,255,.08); color: #fff; }
.app-sidebar-subgroup-toggle.has-active { color: rgba(255,255,255,.9); }

.app-sidebar-sublink {
  display: flex; align-items: center; gap: .5rem;
  padding: .45rem .65rem .45rem 1.2rem; border-radius: .55rem;
  color: rgba(255,255,255,.72); text-decoration: none;
  font-size: .7rem; font-weight: 600; white-space: nowrap;
}
.app-sidebar-sublink i { font-size: .78rem; width: .95rem; text-align: center; flex-shrink: 0; }
.app-sidebar-sublink:hover { background: rgba(255,255,255,.08); color: #fff; }
.app-sidebar-sublink.is-active { background: rgba(255,255,255,.15); color: #fff; }

.app-sidebar-toggle {
  flex: 0 0 auto; display: flex; align-items: center; gap: .7rem;
  margin: .5rem .75rem 1rem; padding: .65rem .8rem;
  border: none; border-radius: .55rem; background: rgba(255,255,255,.08); color: rgba(255,255,255,.75);
  font-size: .8rem; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.app-sidebar-toggle:hover { background: rgba(255,255,255,.14); color: #fff; }
.app-sidebar-toggle i { transition: transform .18s ease; flex-shrink: 0; }
html.sidebar-collapsed .app-sidebar-toggle i { transform: rotate(180deg); }

html.sidebar-collapsed .app-sidebar-brand-text,
html.sidebar-collapsed .app-sidebar-toggle-text { display: none; }
html.sidebar-collapsed .app-sidebar-toggle { justify-content: center; }

/* Recolhida, a coluna de 4.5rem não cabe uma árvore de 3 níveis nem em modo
   ícone (com múltiplos módulos ela vira uma lista longa e confusa). Em vez de
   tentar encaixar os ícones, a navegação some inteira -- fica só a logo e a
   setinha pra voltar ao estado expandido. visibility (não display) mantém o
   espaço reservado, então a setinha continua ancorada embaixo como sempre. */
@media (min-width: 992px) {
  html.sidebar-collapsed .app-sidebar-nav { visibility: hidden; }
}

.app-shell-main-col {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left .18s ease;
  min-width: 0;
}

.app-topbar {
  flex: 0 0 auto;
  min-height: 3.75rem;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: .65rem 1.25rem;
  background: var(--shell-panel-bg);
  border-bottom: 1px solid var(--shell-border);
  position: sticky; top: 0; z-index: 10;
}

.app-shell-icon-btn {
  width: 2.5rem; height: 2.5rem; border-radius: .6rem;
  display: flex; align-items: center; justify-content: center;
  color: var(--shell-muted-fg); text-decoration: none; flex-shrink: 0; border: none; background: none;
}
.app-shell-icon-btn:hover { background: var(--shell-muted); color: var(--shell-fg); }
.app-shell-back-btn { background: var(--shell-muted); }

.app-shell-kicker {
  font-family: var(--font-mono); font-size: .68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--shell-kicker); margin: 0 0 .2rem;
}
.app-shell-title { font-family: 'Sora', sans-serif; font-weight: 700; font-size: 1.15rem; margin: 0; color: var(--shell-fg); }
.app-shell-subtitle {
  display: flex; align-items: center; gap: .4rem;
  font-size: .8rem; color: var(--shell-muted-fg); margin: .3rem 0 0;
}
.app-shell-subtitle i { font-size: .85rem; }

.app-shell-user-block { flex-direction: column; align-items: flex-end; line-height: 1.25; }
.app-shell-user-label { font-size: .68rem; color: var(--shell-muted-fg); white-space: nowrap; }
.app-shell-user-name { font-size: .85rem; font-weight: 700; color: var(--shell-fg); white-space: nowrap; }
.app-shell-avatar {
  width: 2.35rem; height: 2.35rem; border-radius: 50%; flex-shrink: 0;
  background: var(--shell-primary); color: #fff; box-shadow: 0 0 0 3px var(--shell-muted);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: .74rem; font-weight: 700;
}

.app-shell-content { flex: 1 1 auto; min-height: 0; }
.app-shell-content.is-fixed {
  height: calc(100vh - 3.75rem);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.app-sidebar-mobile-toggle { display: none; }
.app-sidebar-backdrop { display: none; }

@media (max-width: 991.98px) {
  .app-sidebar { transform: translateX(-100%); transition: transform .2s ease; box-shadow: 0 0 40px rgba(0,0,0,.3); width: 15.5rem; }
  html.sidebar-mobile-open .app-sidebar { transform: translateX(0); }
  .app-shell-main-col { margin-left: 0; }
  .app-sidebar-mobile-toggle { display: inline-flex; }
  .app-sidebar-backdrop {
    display: block; position: fixed; inset: 0; background: rgba(15,20,30,.45); z-index: 15;
    opacity: 0; pointer-events: none; transition: opacity .18s ease;
  }
  html.sidebar-mobile-open .app-sidebar-backdrop { opacity: 1; pointer-events: auto; }
  html.sidebar-collapsed .app-sidebar-brand-text,
  html.sidebar-collapsed .app-sidebar-toggle-text { display: inline; }
  html.sidebar-collapsed .app-sidebar-toggle { justify-content: flex-start; }
}

.auth-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--shell-bg);
  padding: 1.5rem;
  font-family: 'Manrope', sans-serif;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--shell-panel-bg);
  border: 1px solid var(--shell-border);
  border-radius: 1rem;
  box-shadow: 0 24px 70px rgba(31, 37, 54, .12);
  padding: 2.25rem 2rem;
}

.auth-icon {
  width: 3.5rem; height: 3.5rem; border-radius: 50%;
  background: #fff; border: 1px solid var(--shell-border);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; margin: 0 auto 1.1rem;
}
.auth-icon img { width: 100%; height: 100%; object-fit: cover; }
.auth-title { font-family: 'Sora', sans-serif; font-weight: 700; font-size: 1.3rem; text-align: center; color: var(--shell-fg); margin: 0 0 .35rem; }
.auth-subtitle { font-size: .85rem; color: var(--shell-muted-fg); text-align: center; margin: 0 0 1.5rem; }

.auth-label { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--shell-muted-fg); margin-bottom: .35rem; display: block; }
.auth-input { width: 100%; border: 1px solid var(--shell-border); border-radius: .55rem; padding: .7rem .9rem; font-size: .88rem; background: #fff; color: var(--shell-fg); font-family: inherit; }
.auth-input:focus { outline: none; border-color: var(--shell-primary); box-shadow: 0 0 0 3px rgba(15, 27, 61, .15); }

.auth-btn { width: 100%; min-height: 2.8rem; border: none; border-radius: .55rem; background: var(--shell-primary); color: #fff; font-weight: 700; font-size: .88rem; transition: background 140ms ease; }
.auth-btn:hover { background: var(--shell-primary-dark); color: #fff; }

.auth-error { background: #fde8e8; color: #9b2226; border-radius: .5rem; padding: .65rem .9rem; font-size: .82rem; margin-bottom: 1.1rem; }

.auth-coligada-search { margin-bottom: 1rem; }
.auth-coligada-list { max-height: 360px; overflow-y: auto; border: 1px solid var(--shell-border); border-radius: .6rem; }
.auth-coligada-item {
  display: flex; justify-content: space-between; align-items: center; gap: .75rem;
  width: 100%; text-align: left; border: none; border-top: 1px solid var(--shell-border);
  background: #fff; padding: .85rem 1rem; font-family: inherit;
}
.auth-coligada-item:first-child { border-top: none; }
.auth-coligada-item:hover { background: var(--shell-muted); }
.auth-coligada-nome { font-weight: 700; font-size: .88rem; color: var(--shell-fg); }
.auth-coligada-cgc { font-size: .74rem; color: var(--shell-muted-fg); margin-top: .1rem; }
.auth-coligada-badge { flex-shrink: 0; background: var(--shell-muted); color: var(--shell-primary); font-weight: 700; font-size: .76rem; border-radius: 999px; padding: .3rem .65rem; }

.app-body {
  min-height: 100vh;
  background-color: #f4f6f9;
}

.app-body.app-body-fixed {
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.app-body.app-body-fixed .navbar {
  flex: 0 0 auto;
}

.app-main-flex {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0.6rem 1rem;
  overflow: hidden;
}

.navbar-breadcrumb .breadcrumb-item a {
  color: rgba(255, 255, 255, 0.75);
}

.navbar-breadcrumb .breadcrumb-item a:hover {
  color: #fff;
}

.navbar-breadcrumb .breadcrumb-item.active {
  color: #fff;
}

.navbar-breadcrumb .breadcrumb-item + .breadcrumb-item::before {
  color: rgba(255, 255, 255, 0.5);
}

.status-dot {
  display: inline-block;
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 50%;
}

.status-dot-verde {
  background-color: #198754;
  box-shadow: 0 0 0 0.2rem rgba(25, 135, 84, 0.2);
}

.status-dot-vermelho {
  background-color: #dc3545;
  box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.2);
}

.status-dot-cinza {
  background-color: #adb5bd;
}

.func-card {
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.func-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.1) !important;
}

/* ---- Hero de boas-vindas (home.php) ---- */
.home-hero {
  position: relative;
  overflow: hidden;
  border-radius: 1rem;
  padding: 2.25rem 2.5rem;
  margin-bottom: 2rem;
  color: #fff;
  background: linear-gradient(135deg, #060c1c 0%, #0f1b3d 55%, #1c2f5c 100%);
  box-shadow: 0 12px 30px rgba(15, 27, 61, 0.25);
}

.home-hero::before,
.home-hero::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  pointer-events: none;
}

.home-hero::before {
  width: 320px;
  height: 320px;
  top: -140px;
  right: -80px;
}

.home-hero::after {
  width: 180px;
  height: 180px;
  bottom: -90px;
  right: 160px;
  background: rgba(255, 255, 255, 0.06);
}

.home-hero-eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-size: 0.72rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.75);
  margin-bottom: 0.5rem;
  position: relative;
}

.home-hero-title {
  font-size: 1.85rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
  position: relative;
}

.home-hero-subtitle {
  font-size: 0.925rem;
  color: rgba(255, 255, 255, 0.85);
  margin-bottom: 0;
  position: relative;
}

/* ---- Rótulo de seção ---- */
.section-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #8a94a3;
  font-weight: 700;
  margin: 0 0 1rem;
}

/* ---- Grade de módulos / cards de navegação ---- */
.menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.menu-card {
  --menu-card-accent: #1976d2;
  --menu-card-accent-2: #1e88e5;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  background: #fff;
  border: 1px solid #edf0f3;
  border-radius: 0.9rem;
  padding: 1.15rem 1.25rem;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.menu-card:hover,
.menu-card:focus-visible {
  transform: translateY(-3px);
  box-shadow: 0 14px 26px rgba(16, 24, 40, 0.1);
  border-color: var(--menu-card-accent);
  color: inherit;
}

.menu-card-icon {
  flex: 0 0 auto;
  width: 3rem;
  height: 3rem;
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  color: #fff;
  background: linear-gradient(135deg, var(--menu-card-accent) 0%, var(--menu-card-accent-2) 100%);
  box-shadow: 0 6px 14px -4px var(--menu-card-accent);
}

.menu-card-body {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.menu-card-title {
  font-weight: 600;
  color: #1c2b39;
  line-height: 1.25;
}

.menu-card-desc {
  font-size: 0.8rem;
  color: #6c757d;
  line-height: 1.3;
}

.menu-card-arrow {
  flex: 0 0 auto;
  color: #c3cad3;
  font-size: 1rem;
  margin-top: .85rem;
  transition: transform 0.18s ease, color 0.18s ease;
}

.menu-card:hover .menu-card-arrow {
  transform: translateX(3px);
  color: var(--menu-card-accent);
}

.menu-card-blue {
  --menu-card-accent: #1976d2;
  --menu-card-accent-2: #29b6f6;
}

.menu-card-teal {
  --menu-card-accent: #0d9488;
  --menu-card-accent-2: #2dd4bf;
}

.menu-card-amber {
  --menu-card-accent: #c9891a;
  --menu-card-accent-2: #f0b429;
}

.menu-card-indigo {
  --menu-card-accent: #4f46e5;
  --menu-card-accent-2: #818cf8;
}

.menu-card-rose {
  --menu-card-accent: #e11d48;
  --menu-card-accent-2: #fb7185;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(244, 246, 249, 0.9);
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 1rem;
  z-index: 2000;
}

.loading-overlay.is-active {
  display: flex;
}

.status-badge-verde {
  background-color: #d1e7dd;
  color: #0f5132;
}

.status-badge-azul {
  background-color: #cfe2ff;
  color: #084298;
}

.status-badge-amarelo {
  background-color: #fff3cd;
  color: #664d03;
}

.status-badge-vermelho {
  background-color: #f8d7da;
  color: #842029;
}

.status-badge-cinza {
  background-color: #e2e3e5;
  color: #41464b;
}

.func-actions .btn {
  min-width: 130px;
}

/* ---- Lista de resultados de busca com autocomplete (ex.: tipo de veículo) ---- */
.tipo-lista {
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid #dee2e6;
  border-radius: 0.375rem;
}

.tipo-lista:empty {
  border: none;
}

.tipo-lista .list-group-item {
  font-size: 0.85rem;
  padding: 0.4rem 0.75rem;
  border-left: none;
  border-right: none;
}

.tipo-lista .list-group-item:first-child {
  border-top: none;
}

.tipo-lista .list-group-item:last-child {
  border-bottom: none;
}

/* ---- Telas de grade (Tabulator) em layout fixo, ex.: Importação de XML ---- */
.movimentos-content {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.movimentos-toolbar {
  background-color: #fff;
  border: 1px solid #dee2e6;
  border-radius: 0.5rem;
  padding: 0.5rem 0.75rem;
}

.movimentos-tabela-card {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.movimentos-tabela-card .card-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0.5rem;
}

.tabela-compacta {
  flex: 1 1 auto;
  min-height: 0;
}

.tabela-compacta.tabulator {
  border-top: none;
}

.tabela-compacta .tabulator-header {
  border-top: none;
}

.tabela-compacta .tabulator-cell {
  font-size: 0.8rem;
  padding: 3px 8px;
}

.tabela-compacta .tabulator-col-title {
  font-size: 0.78rem;
}

.tabela-compacta .tabulator-header-filter input {
  height: auto !important;
  padding: 2px 4px !important;
  font-size: 0.78rem !important;
}

.tabela-compacta .badge {
  font-size: 0.7rem;
  padding: 0.3em 0.55em;
}

.selecao-resumo {
  background-color: #212529;
  color: #fff;
  border-radius: 0.5rem;
  padding: 0.6rem 1.25rem;
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  flex: 0 0 auto;
}

.selecao-resumo .selecao-item .label {
  font-size: 0.7rem;
  color: #adb5bd;
  text-transform: uppercase;
  margin-bottom: 0.1rem;
}

.selecao-resumo .selecao-item .valor {
  font-weight: 600;
  font-size: 0.9rem;
}

/* ---- Modal de importação de XML para movimento ---- */
.info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.9rem 2rem;
}

.info-grid .label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #8a94a3;
  margin-bottom: 0.15rem;
}

.info-grid .valor {
  font-size: 0.92rem;
  font-weight: 600;
  color: #1c2b39;
}

.tabela-modal {
  font-size: 0.84rem;
}

.tabela-modal th {
  font-size: 0.72rem;
  text-transform: uppercase;
  color: #8a94a3;
  font-weight: 600;
  border-bottom: 1px solid #edf0f3;
}

.tabela-modal td {
  vertical-align: middle;
}

/* ---- Diálogo de vínculo de produto (aba Itens do modal de importação de XML) ---- */
.vincular-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(15, 20, 30, .45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.vincular-dialog {
  background: #fff;
  border-radius: .9rem;
  width: 100%;
  max-width: 560px;
  max-height: min(640px, 100%);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .3);
  font-family: 'Manrope', sans-serif;
}

.vincular-dialog-header {
  padding: 1.1rem 1.3rem;
  border-bottom: 1px solid #e3e7ee;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-shrink: 0;
}
.vincular-dialog-kicker { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: #6c757d; margin: 0 0 .3rem; }
.vincular-dialog-title { font-family: 'Sora', sans-serif; font-weight: 700; font-size: .98rem; color: #1f2536; margin: 0; }

.vincular-item-ref {
  margin: 1rem 1.3rem 0;
  background: #f4f6f9;
  border-radius: .6rem;
  padding: .8rem 1rem;
  flex-shrink: 0;
}
.vincular-item-ref .meta { display: flex; flex-wrap: wrap; gap: .3rem 1.1rem; font-size: .78rem; color: #6c757d; }
.vincular-item-ref .meta b { color: #1f2536; }

.vincular-list-label { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: #8a94a3; margin: 1.1rem 1.3rem .5rem; flex-shrink: 0; }

.vincular-list { overflow-y: auto; flex: 1 1 auto; padding: 0 1.3rem 1.3rem; display: flex; flex-direction: column; gap: .55rem; min-height: 0; }

.vincular-option {
  border: 1px solid #e3e7ee;
  border-radius: .6rem;
  padding: .8rem .95rem;
  cursor: pointer;
  text-align: left;
  background: #fff;
  transition: border-color .15s ease, background .15s ease;
}
.vincular-option:hover { border-color: var(--shell-primary); background: #f8fafc; }
.vincular-option .idprd { font-size: .66rem; font-weight: 700; color: var(--shell-primary); text-transform: uppercase; letter-spacing: .03em; }
.vincular-option .desc { font-weight: 600; font-size: .88rem; color: #1f2536; margin-top: .2rem; }
.vincular-option .qtd { font-size: .76rem; color: #6c757d; margin-top: .25rem; }

/* ==================== Gestão de Cartas (Substituição / Apresentação / Retorno a Vaga) ==================== */
/* Classes compartilhadas pelas 3 telas de Cartas -- cada uma só define o grid-template-columns
   (.ct-grid-substituicao ou .ct-grid-simples) e o conteúdo específico das colunas/modal. */
.ct-subheader { flex: 0 0 auto; border-bottom: 1px solid var(--shell-border); background: var(--shell-footer-bg); padding: 1rem 1.5rem; }
.ct-heading { font-family: 'Sora', sans-serif; font-weight: 700; font-size: 1.25rem; margin: 0; color: var(--shell-fg); }
.ct-desc { font-size: .82rem; color: var(--shell-muted-fg); margin: .2rem 0 0; }

.ct-filters { flex: 0 0 auto; border-bottom: 1px solid var(--shell-border); padding: 1rem 1.5rem; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; }
.ct-count { font-size: .82rem; color: var(--shell-muted-fg); white-space: nowrap; }
.ct-filtro-tipo.is-active { background: var(--shell-primary); border-color: var(--shell-primary); color: #fff; }
.ct-cta { display: inline-flex; align-items: center; gap: .5rem; height: 2.6rem; box-sizing: border-box; border-radius: .5rem; padding: 0 1.1rem; font-size: .83rem; font-weight: 700; border: none; background: var(--shell-primary); color: #fff; white-space: nowrap; }
.ct-cta:hover { background: var(--shell-primary-dark); color: #fff; }

.ct-table-wrap { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 1.25rem 1.5rem; }
/* min-width vem inline no .ct-table-shell de cada página (mesmo valor do grid usado),
   já que o overflow:hidden aqui impede que o filho .ct-grid force a largura do pai. */
.ct-table-shell { border: 1px solid var(--shell-border); border-radius: .6rem; overflow: hidden; }
.ct-grid { display: grid; align-items: center; column-gap: .9rem; padding: .7rem 1rem; }
.ct-grid-substituicao { grid-template-columns: 3.5rem 9rem 8rem 6rem 1fr 1fr 6.5rem 7rem 3rem; }
.ct-grid-simples { grid-template-columns: 3.5rem 8rem 6rem 1fr 6.5rem 7rem; }
.ct-grid-head { background: var(--shell-muted); font-size: .64rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--shell-muted-fg); }
.ct-row { border-top: 1px solid var(--shell-border); font-size: .84rem; }
.ct-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ct-id { font-family: var(--font-mono); color: var(--shell-muted-fg); }
.ct-contrato { font-family: var(--font-mono); font-weight: 700; color: var(--shell-fg); }
.ct-data { font-family: var(--font-mono); }
.ct-veiculo-cel { display: flex; flex-direction: column; line-height: 1.25; }
.ct-veiculo-cel .placa { font-family: var(--font-mono); font-weight: 700; color: var(--shell-fg); font-size: .8rem; }
.ct-veiculo-cel .cooperado { font-size: .72rem; color: var(--shell-muted-fg); }
.ct-criado { font-size: .72rem; color: var(--shell-muted-fg); }
.ct-print-btn { border: 1px solid var(--shell-border); border-radius: .4rem; background: #fff; color: var(--shell-muted-fg); width: 2rem; height: 2rem; display: inline-flex; align-items: center; justify-content: center; font-size: .9rem; }
.ct-print-btn:hover { border-color: var(--shell-kicker); color: var(--shell-kicker); background: #e3edfa; }
.ct-print-btn.disabled { pointer-events: none; opacity: .4; }

.ct-badge { font-family: var(--font-mono); font-size: .66rem; font-weight: 700; padding: .3rem .55rem; border-radius: .35rem; white-space: nowrap; display: inline-block; }
.ct-badge-subst-temp { background: #fff2df; color: #93590a; }
.ct-badge-subst-def { background: #e3edfa; color: var(--shell-kicker); }
.ct-badge-apresentacao { background: #e2f5ea; color: #1c7a44; }
.ct-badge-retorno { background: #f1e9fb; color: #6a3fa0; }

.ct-empty { text-align: center; padding: 3rem 1rem; color: var(--shell-muted-fg); }
.ct-empty i { font-size: 1.8rem; }
.ct-empty h3 { font-family: 'Sora', sans-serif; font-size: 1rem; font-weight: 700; color: var(--shell-fg); margin: .75rem 0 .25rem; }

/* Modal Nova Carta */
.ct-modal-placeholder { text-align: center; padding: 2.5rem 1rem; color: var(--shell-muted-fg); }
.ct-modal-placeholder i { font-size: 1.6rem; }
.ct-modal-placeholder p { margin: .6rem 0 0; font-size: .85rem; }

.ct-veiculos-grid { display: grid; grid-template-columns: 1fr auto 1fr; align-items: stretch; gap: .75rem; margin-top: .25rem; }
.ct-veiculos-grid.ct-veiculo-solo { grid-template-columns: 1fr; max-width: 26rem; }
.ct-veiculo-card { background: var(--shell-footer-bg); border: 1px solid var(--shell-border); border-radius: .6rem; padding: .9rem; }
.ct-veiculo-titulo { font-family: var(--font-mono); font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--shell-kicker); margin: 0 0 .7rem; display: flex; align-items: center; gap: .4rem; }
.ct-veiculos-divisor { display: flex; align-items: center; justify-content: center; color: var(--shell-muted-fg); font-size: 1.1rem; }
.ct-input-clear { position: relative; }
.ct-input-clear input { padding-right: 2.1rem; }
.ct-clear-btn { position: absolute; right: .35rem; top: 50%; transform: translateY(-50%); border: none; background: none; color: var(--shell-muted-fg); width: 1.6rem; height: 1.6rem; border-radius: .35rem; display: flex; align-items: center; justify-content: center; }
.ct-clear-btn:hover { background: var(--shell-border); color: var(--shell-fg); }
.ct-veiculo-detalhe { font-size: .72rem; color: var(--shell-muted-fg); margin: .5rem 0 0; min-height: 1em; }
input[readonly].ct-locked { background: #fff; font-weight: 600; color: var(--shell-fg); }

@media (max-width: 640px) {
  .ct-veiculos-grid { grid-template-columns: 1fr; }
  .ct-veiculos-divisor { transform: rotate(90deg); padding: .2rem 0; }
}

.vincular-empty { margin: 1rem 1.3rem 1.3rem; }
