/* ==========================================================================
   ONEDEAL SST — IDENTIDADE VISUAL GLOBAL (:root, TEMA DARK & TEMA LIGHT)
   ========================================================================== */

:root {
  /* 1. Cores da Marca / Logo (OneDeal Brand Identity) */
  --brand-blue: #0459FA;       /* Azul Elétrico (Principal) */
  --brand-vibrant: #0384FC;    /* Azul Vibrante (Intermediário) */
  --brand-glow: #01BBFD;       /* Ciano / Brilho (Ponta do 1 e curva do D) */
  --brand-cyan: #00ADEF;       /* Ciano complementar */
  --brand-deep: #023273;       /* Azul Profundo (Dobra/sombra interna) */
  --brand: #0384FC;
  --brand-gradient: linear-gradient(135deg, var(--brand-blue) 0%, var(--brand-vibrant) 55%, var(--brand-glow) 100%);
  --brand-gradient-deep: linear-gradient(135deg, var(--brand-deep) 0%, var(--brand-blue) 60%, var(--brand-vibrant) 100%);

  /* Palavra "One" na Logo */
  --logo-one-dark: #F9FAFC;    /* Branco gelo no Dark */
  --logo-one-light: #020711;   /* Navy escuro quase preto no Light */
  --color-light-gray: #E9EEF7;
  --color-dark-text: #1C2434;

  /* 3. Identidade do Site — Tema LIGHT */
  --bg-main: #FFFFFF;
  --bg-alt: #E9EEF7;
  --bg-sec: #F8FAFC;
  --bg-card: #FFFFFF;
  --text-main: #000000;
  --text-sec: #1C2434;
  --border-brand: #CBD5E1;

  /* Variáveis da Sidebar e do Painel Interno (Light) */
  --sidebar-bg: #FFFFFF;
  --sidebar-box-bg: #F1F5F9;
  --sidebar-empresa-bg: #EFF6FF;
  --sidebar-input-bg: #FFFFFF;
  --sidebar-border: #CBD5E1;
  --sidebar-text: #0F172A;
  --sidebar-muted: #526077;

  /* Aliases de compatibilidade com todos os componentes do painel */
  --bg: var(--bg-sec);
  --white: var(--bg-card);
  --border: var(--border-brand);
  --text: var(--color-dark-text);
  --muted: #526077;
  --primary: var(--brand-blue);
  --text-secondary: #334155;
  --text-muted: #526077;

  --input-bg: #FFFFFF;
  --input-border: #94A3B8;
  --input-focus-bg: #FFFFFF;
  --surface-elevated: #F1F5F9;
  --table-head-bg: #F1F5F9;
  --table-hover-bg: rgba(4, 89, 250, 0.04);

  --blue: var(--brand-blue);
  --blue-hover: var(--brand-deep);
  --blue-light: #E9EEF7;

  /* Semáforo de SST */
  --green: #10b981;
  --green-bg: #ecfdf5;
  --green-text: #065f46;
  --status-green: #10b981;
  --status-green-text: #065f46;

  --yellow: #f59e0b;
  --yellow-bg: #fffbeb;
  --yellow-text: #92400e;
  --status-yellow: #f59e0b;

  --red: #ef4444;
  --red-bg: #fef2f2;
  --red-text: #991b1b;

  --radius: 12px;
  --radius-sm: 8px;
  --sidebar-w: 276px;

  /* Tokens de Espaçamento Sistemático (Múltiplos de 4px — Seção 3) */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 20px;
  --space-2xl: 24px;
  --space-3xl: 32px;
  --space-4xl: 40px;

  /* Tokens do Design System Premium Dark SaaS (Fallback Light) */
  --ds-bg-main: #F4F7FB;
  --ds-surface-primary: #FFFFFF;
  --ds-surface-secondary: #F1F5F9;
  --ds-surface-elevated: #E2E8F0;
  --ds-input-bg: #FFFFFF;
  --ds-hover-bg: #EFF6FF;
  --ds-border-default: #CBD5E1;
  --ds-border-card: #CBD5E1;
  --ds-border-focus: #087DFF;
  --ds-divider: #E2E8F0;
  --ds-blue-primary: #086CFF;
  --ds-blue-hover: #2585FF;
  --ds-blue-deep: #004DD6;
  --ds-cyan-accent: #086CFF;
  --ds-blue-alpha: rgba(8, 108, 255, 0.12);
  --ds-cyan-alpha: rgba(0, 194, 255, 0.10);
  --ds-text-primary: #0F172A;
  --ds-text-secondary: #475569;
  --ds-text-aux: #64748B;
  --ds-text-disabled: #94A3B8;
  --ds-success: #17C994;
  --ds-warning: #F5B84B;
  --ds-danger: #F16D83;
  --ds-info: #20BFFF;
}

/* 2. Identidade do Site — Tema DARK Nativo (Premium Dark SaaS Dashboard — Seção 2) */
[data-theme="dark"],
.theme-dark {
  color-scheme: dark;

  /* Cores Estruturais Oficiais (Seção 2) */
  --ds-bg-main: #07111F;
  --ds-surface-primary: #0D1D34;
  --ds-surface-secondary: #102541;
  --ds-surface-elevated: #142C4B;
  --ds-input-bg: #10213A;
  --ds-hover-bg: #183455;
  --ds-border-default: #263D5B;
  --ds-border-card: #294362;
  --ds-border-focus: #087DFF;
  --ds-divider: #233752;

  /* Cores de Marca e Ações (Seção 2) */
  --ds-blue-primary: #086CFF;
  --ds-blue-hover: #2585FF;
  --ds-blue-deep: #004DD6;
  --ds-cyan-accent: #00C2FF;
  --ds-blue-alpha: rgba(8, 108, 255, 0.12);
  --ds-cyan-alpha: rgba(0, 194, 255, 0.10);

  /* Tipografia e Estados Semânticos (Seção 2) */
  --ds-text-primary: #F5F8FF;
  --ds-text-secondary: #B5C4D9;
  --ds-text-aux: #849AB5;
  --ds-text-disabled: #60748E;
  --ds-success: #17C994;
  --ds-warning: #F5B84B;
  --ds-danger: #F16D83;
  --ds-info: #20BFFF;

  /* Mapeamento Global do Painel Interno para o Sistema de Cores Dark */
  --bg-main: #07111F;
  --bg-main-2: #07111F;
  --bg-alt: #0D1D34;
  --bg-alt-2: #102541;
  --bg-sec: #07111F;
  --bg-sec-2: #102541;
  --bg-card: #0D1D34;
  --bg-card-2: #102541;
  --text-main: #F5F8FF;
  --text-main-2: #F5F8FF;
  --text-sec: #B5C4D9;
  --border-brand: #263D5B;

  --color-light-gray: #102541;
  --color-dark-text: #F5F8FF;
  --bg: #07111F;
  --white: #0D1D34;
  --border: #263D5B;
  --text: #F5F8FF;
  --muted: #B5C4D9;
  --brand: #00C2FF;
  --brand-blue: #086CFF;
  --primary: #086CFF;
  --text-secondary: #B5C4D9;
  --text-muted: #849AB5;

  --input-bg: #10213A;
  --input-border: #304766;
  --input-focus-bg: #102541;
  --surface-elevated: #142C4B;
  --table-head-bg: #101F35;
  --table-hover-bg: #142C4B;

  --sidebar-bg: #07111F;
  --sidebar-box-bg: #0D1D34;
  --sidebar-empresa-bg: #102541;
  --sidebar-input-bg: #10213A;
  --sidebar-border: #233752;
  --sidebar-text: #F5F8FF;
  --sidebar-muted: #B5C4D9;

  --green: #17C994;
  --green-bg: rgba(23, 201, 148, 0.14);
  --green-text: #17C994;
  --status-green: #17C994;
  --status-green-text: #17C994;
  --yellow: #F5B84B;
  --yellow-bg: rgba(245, 184, 75, 0.14);
  --yellow-text: #F5B84B;
  --status-yellow: #F5B84B;
  --red: #F16D83;
  --red-bg: rgba(241, 109, 131, 0.14);
  --red-text: #F16D83;
}

/* 3. Identidade do Site — Tema LIGHT explícito (Sidebar + Conteúdo) */
[data-theme="light"],
.theme-light {
  color-scheme: light;
  --bg-main: #FFFFFF;
  --bg-alt: #E9EEF7;
  --bg-sec: #F4F7FB;
  --bg-card: #FFFFFF;
  --color-light-gray: #E9EEF7;
  --color-dark-text: #0F172A;
  --text-main: #0F172A;
  --text-sec: #1E293B;
  --border-brand: #CBD5E1;

  --bg: #F4F7FB;
  --white: #FFFFFF;
  --border: #CBD5E1;
  --text: #0F172A;
  --muted: #475569;
  --brand: #0459FA;
  --primary: #0459FA;
  --text-secondary: #334155;
  --text-muted: #475569;

  --input-bg: #FFFFFF;
  --input-border: #94A3B8;
  --input-focus-bg: #FFFFFF;
  --surface-elevated: #F1F5F9;
  --table-head-bg: #F1F5F9;
  --table-hover-bg: rgba(4, 89, 250, 0.04);

  --sidebar-bg: #FFFFFF;
  --sidebar-box-bg: #F1F5F9;
  --sidebar-empresa-bg: #EFF6FF;
  --sidebar-input-bg: #FFFFFF;
  --sidebar-border: #CBD5E1;
  --sidebar-text: #0F172A;
  --sidebar-muted: #475569;

  --green-bg: #dcfce7;
  --green-text: #065f46;
  --status-green: #10b981;
  --status-green-text: #065f46;
  --yellow-bg: #fef3c7;
  --yellow-text: #92400e;
  --status-yellow: #f59e0b;
  --red-bg: #fee2e2;
  --red-text: #991b1b;
}

/* Quando a Sidebar está ENCOLHIDA (Apenas Ícones) */
html.sidebar-is-collapsed {
  --sidebar-w: 78px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}


/* ==========================================================================
   PAINEL INTERNO DO SAAS (SIDEBAR + DASHBOARD)
   ========================================================================== */
.picker-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.picker-item {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  transition: all 0.15s;
}

.picker-item:hover,
.picker-item.active {
  border-color: var(--brand-blue);
  box-shadow: 0 6px 20px rgba(4, 89, 250, 0.1);
  transform: translateY(-1px);
}

.picker-item-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.picker-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
}

.picker-item h2 {
  font-size: 18px;
  font-weight: 700;
}

.picker-item span {
  font-size: 13.5px;
  color: var(--muted);
}

.picker-item-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.app {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  height: 100vh;
  height: 100dvh;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  border-right: 1px solid var(--sidebar-border);
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  padding: 16px 12px 16px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(3, 132, 252, 0.5) transparent;
  z-index: 100;
  transition: width 0.22s ease, padding 0.22s ease, background 0.2s ease, border-color 0.2s ease;
}

.sidebar-top {
  flex-shrink: 0;
}

.sidebar::-webkit-scrollbar,
.sidebar-search-results::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}

.sidebar::-webkit-scrollbar-track,
.sidebar-search-results::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 99px;
  margin: 6px 0;
}

[data-theme="light"] .sidebar::-webkit-scrollbar-track,
[data-theme="light"] .sidebar-search-results::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.05);
}

.sidebar::-webkit-scrollbar-thumb,
.sidebar-search-results::-webkit-scrollbar-thumb {
  background: rgba(3, 132, 252, 0.45);
  border-radius: 99px;
  border: 1.5px solid transparent;
  background-clip: padding-box;
}

.sidebar::-webkit-scrollbar-thumb:hover,
.sidebar-search-results::-webkit-scrollbar-thumb:hover {
  background: var(--brand);
  border: 1px solid transparent;
  background-clip: padding-box;
}

.svg-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: block;
}

.collapse-chevron {
  width: 16px;
  height: 16px;
  transition: transform 0.22s ease;
}

html.sidebar-is-collapsed .collapse-chevron {
  transform: rotate(180deg);
}

.sidebar-brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 2px 14px;
  border-bottom: 1px solid var(--sidebar-border);
  margin-bottom: 14px;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-width: 0;
}

.sidebar-brand .brand-logo-full {
  width: 100%;
  max-width: 196px;
  height: 60px;
  object-fit: contain;
  display: block;
}

.sidebar-brand .brand-logo-icon {
  width: 38px;
  height: 38px;
  object-fit: contain;
  display: none;
}

/* Botão (setinha) para expandir / encolher a Sidebar */
.sidebar-collapse-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--sidebar-border);
  background: var(--sidebar-box-bg);
  color: var(--sidebar-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  font-size: 11px;
  transition: all 0.15s ease;
}

.sidebar-collapse-btn:hover {
  border-color: var(--brand-vibrant);
  color: var(--brand-glow);
  transform: scale(1.05);
}

/* Caixa com os campos de Pesquisa e Dropdown da Empresa */
.company-selector-box {
  background: var(--sidebar-box-bg);
  border: 1px solid var(--sidebar-border);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 14px;
}

.selector-label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--sidebar-muted);
  margin-bottom: 8px;
}

.sidebar-search-wrap {
  position: relative;
  margin-bottom: 8px;
}

.sidebar-search-input {
  width: 100%;
  padding: 9px 11px;
  border-radius: 8px;
  border: 1px solid var(--sidebar-border);
  background: var(--sidebar-input-bg);
  color: var(--sidebar-text);
  font: inherit;
  font-size: 13.5px;
  outline: none;
}

.sidebar-search-input::placeholder {
  color: var(--sidebar-muted);
}

.sidebar-search-input:focus {
  border-color: var(--brand-glow);
  box-shadow: 0 0 0 3px rgba(1, 187, 253, 0.18);
}

.sidebar-search-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--sidebar-box-bg);
  border: 1px solid var(--sidebar-border);
  border-radius: 10px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
  max-height: 220px;
  overflow-y: auto;
  display: none;
  flex-direction: column;
  z-index: 200;
}

.sidebar-search-results.active {
  display: flex;
}

.sidebar-search-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--sidebar-border);
  font-size: 13px;
  color: var(--sidebar-text);
}

.sidebar-search-option:last-child {
  border-bottom: none;
}

.sidebar-search-option:hover {
  background: rgba(4, 89, 250, 0.18);
}

.sidebar-search-option strong {
  display: block;
  font-size: 13px;
}

.sidebar-search-option small {
  color: var(--sidebar-muted);
  font-size: 11.5px;
}

.sidebar-company-select {
  width: 100%;
  padding: 9px 10px;
  border-radius: 8px;
  border: 1px solid var(--sidebar-border);
  background: var(--sidebar-input-bg);
  color: var(--sidebar-text);
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
}

.sidebar-company-select:focus {
  border-color: var(--brand-glow);
}

/* Seção NESTA EMPRESA + Menus da Empresa que aparecem abaixo dos campos */
.nesta-empresa-box {
  background: var(--sidebar-empresa-bg);
  border: 1.5px solid rgba(3, 132, 252, 0.4);
  border-radius: 12px;
  padding: 12px 10px;
  margin-bottom: 14px;
}

.nesta-empresa-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 2px 6px 10px;
  border-bottom: 1px solid var(--sidebar-border);
  margin-bottom: 8px;
}

.nesta-empresa-collapsed-icon {
  display: none;
  font-size: 20px;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.nesta-empresa-label {
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--brand);
}

.nesta-empresa-name {
  font-size: 14.5px;
  font-weight: 800;
  color: var(--sidebar-text);
  margin-top: 2px;
}

.nesta-empresa-close {
  font-size: 13px;
  color: var(--sidebar-muted);
  padding: 2px 6px;
  border-radius: 6px;
}

.nesta-empresa-close:hover {
  background: rgba(239, 68, 68, 0.14);
  color: #ef4444;
}

.nesta-empresa-empty {
  border: 1.5px dashed var(--sidebar-border);
  border-radius: 12px;
  padding: 14px 12px;
  font-size: 12.5px;
  color: var(--sidebar-muted);
  text-align: center;
  margin-bottom: 14px;
}

.empty-icon-only {
  display: none;
  font-size: 18px;
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  border-radius: 9px;
  font-size: 13.8px;
  font-weight: 600;
  color: var(--sidebar-muted);
  transition: all 0.12s;
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
  cursor: pointer;
}

.nav-item:hover {
  background: rgba(3, 132, 252, 0.15);
  color: var(--sidebar-text);
}

.nav-item.active {
  background: var(--brand-gradient);
  color: #F9FAFC;
}

.nav-item-logout {
  color: #f87171;
}

.nav-item-add-company {
  color: var(--brand);
  border: 1px dashed rgba(3, 132, 252, 0.45);
  background: rgba(3, 132, 252, 0.08);
  margin-top: 2px;
}

.nav-item-add-company:hover {
  background: var(--brand-gradient);
  color: #F9FAFC;
  border-color: transparent;
}

.nav-item-left {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.nav-icon {
  font-size: 16px;
  line-height: 1;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
}

.nav-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-count {
  font-size: 11.5px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 99px;
  background: rgba(3, 132, 252, 0.16);
  color: var(--sidebar-text);
}

.nav-badge {
  font-size: 11.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--red-bg);
  color: var(--red-text);
}

.nav-item.active .nav-badge,
.nav-item.active .nav-count {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
}

.sidebar-bottom {
  border-top: 1px solid var(--sidebar-border);
  padding-top: 12px;
  padding-bottom: 4px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}

.sidebar-user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  margin-bottom: 4px;
  background: var(--sidebar-box-bg);
  border: 1px solid var(--sidebar-border);
  border-radius: 10px;
  font-size: 12.5px;
}

.sidebar-user-avatar {
  font-size: 17px;
  flex-shrink: 0;
}

.sidebar-user-info {
  min-width: 0;
  flex: 1;
}

.sidebar-user-layer {
  font-size: 10px;
  font-weight: 800;
  color: var(--brand);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.sidebar-user-name {
  display: block;
  color: var(--sidebar-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-email {
  display: block;
  color: var(--sidebar-muted);
  font-size: 11.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==========================================================================
   MODO SIDEBAR ENCOLHIDA (APENAS ÍCONES + ÍCONE DA LOGO)
   ========================================================================== */
html.sidebar-is-collapsed .sidebar {
  padding: 14px 8px;
}

html.sidebar-is-collapsed .sidebar-brand-row {
  flex-direction: column;
  gap: 10px;
  padding: 4px 0 12px;
}

html.sidebar-is-collapsed .sidebar-brand .brand-logo-full {
  display: none;
}

html.sidebar-is-collapsed .sidebar-brand .brand-logo-icon {
  display: block;
}

html.sidebar-is-collapsed .nav-label,
html.sidebar-is-collapsed .nav-count,
html.sidebar-is-collapsed .nav-badge,
html.sidebar-is-collapsed .company-selector-box,
html.sidebar-is-collapsed .nesta-empresa-header-text,
html.sidebar-is-collapsed .nesta-empresa-close,
html.sidebar-is-collapsed .empty-text-full,
html.sidebar-is-collapsed .sidebar-user-info {
  display: none !important;
}

html.sidebar-is-collapsed .nesta-empresa-box {
  padding: 8px 4px;
}

html.sidebar-is-collapsed .nesta-empresa-header {
  justify-content: center;
  padding: 2px 0 8px;
}

html.sidebar-is-collapsed .nesta-empresa-collapsed-icon {
  display: flex;
}

html.sidebar-is-collapsed .empty-icon-only {
  display: inline-block;
}

html.sidebar-is-collapsed .nav-item {
  justify-content: center;
  padding: 10px 0;
}

html.sidebar-is-collapsed .nav-item-left {
  justify-content: center;
  gap: 0;
}

html.sidebar-is-collapsed .nav-icon {
  font-size: 19px;
  width: auto;
}

html.sidebar-is-collapsed .sidebar-user-card {
  justify-content: center;
  padding: 9px 0;
}

/* ==========================================================================
   ÁREA DE CONTEÚDO DO PAINEL (DESKTOP ZERO-OVERFLOW & ALTA LEGIBILIDADE)
   ========================================================================== */
.app {
  display: flex;
  min-height: 100vh;
  width: 100%;
  overflow-x: clip;
}

.main {
  flex: 1 1 0%;
  min-width: 0;
  width: calc(100% - var(--sidebar-w));
  margin-left: var(--sidebar-w);
  padding: 28px 32px 40px;
  max-width: 1600px;
  box-sizing: border-box;
  transition: margin-left 0.22s ease, width 0.22s ease;
  overflow-x: hidden;
}

/* Topbar Global Desktop (Seção 4 — Barra Superior de Ferramentas) */
.desktop-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 60px;
  padding: 8px 16px;
  margin-bottom: 24px;
  background: var(--ds-surface-primary);
  border: 1px solid var(--ds-border-default);
  border-bottom: 1px solid var(--ds-border-default);
  border-radius: 12px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.08);
  flex-wrap: wrap;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1 1 420px;
  min-width: 0;
}

.topbar-search-wrapper {
  position: relative;
  width: 100%;
  max-width: 540px;
  min-width: 240px;
}

@media (min-width: 1280px) {
  .topbar-search-wrapper {
    min-width: 420px;
  }
}

.topbar-search-input {
  width: 100%;
  height: 38px;
  padding: 0 14px 0 41px;
  border-radius: 9px;
  border: 1px solid #304766;
  background: var(--ds-input-bg);
  color: var(--ds-text-primary);
  font: inherit;
  font-size: 13px;
  font-weight: 400;
  line-height: 20px;
  transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
}

[data-theme="light"] .topbar-search-input {
  border-color: var(--input-border);
}

.topbar-search-input::placeholder {
  font-size: 13px;
  font-weight: 400;
  color: var(--ds-text-aux);
}

.topbar-search-input:focus {
  outline: none;
  border-color: var(--ds-border-focus);
  box-shadow: 0 0 0 3px rgba(8, 108, 255, 0.18);
}

.topbar-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 17px;
  height: 17px;
  color: var(--ds-text-aux);
  pointer-events: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.topbar-search-icon .svg-icon {
  width: 17px;
  height: 17px;
}

.topbar-collab-context {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ds-text-primary);
}

.search-results-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--ds-surface-primary);
  border: 1px solid var(--ds-border-default);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.24);
  z-index: 400;
  display: none;
  max-height: 360px;
  overflow-y: auto;
}

.search-results-dropdown.active {
  display: block;
}

.search-result-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--ds-divider);
  transition: background 150ms ease;
}

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

.search-result-item:hover {
  background: var(--ds-surface-elevated);
}

.search-result-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.search-result-info {
  flex: 1;
  min-width: 0;
}

.search-result-info h5 {
  font-size: 13px;
  font-weight: 600;
  color: var(--ds-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-info p {
  font-size: 11px;
  color: var(--ds-text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-type {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--ds-blue-alpha);
  color: var(--ds-cyan-accent);
  flex-shrink: 0;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.topbar-company-switcher {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  background: var(--ds-surface-secondary);
  border: 1px solid #2C4567;
  border-radius: 9px;
  padding: 0 10px;
}

[data-theme="light"] .topbar-company-switcher {
  border-color: var(--border);
}

.topbar-company-switcher label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--ds-text-secondary);
  white-space: nowrap;
}

.topbar-company-switcher label .svg-icon {
  width: 15px;
  height: 15px;
  color: var(--ds-cyan-accent);
}

.topbar-company-select {
  height: 28px;
  padding: 0 8px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: var(--ds-input-bg);
  color: var(--ds-text-primary);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  max-width: 220px;
  cursor: pointer;
  transition: border-color 150ms ease;
}

.topbar-company-select:focus {
  outline: none;
  border-color: var(--ds-border-focus);
}

.topbar-context-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 12px;
  border-radius: 9px;
  border: 1px solid rgba(8, 125, 255, 0.28);
  background: var(--ds-blue-alpha);
  color: var(--ds-cyan-accent);
  font-size: 12px;
  font-weight: 600;
  line-height: 18px;
  white-space: nowrap;
  transition: background 150ms ease, border-color 150ms ease;
}

.topbar-context-pill .svg-icon {
  width: 15px;
  height: 15px;
}

.topbar-context-pill:hover {
  background: rgba(8, 108, 255, 0.18);
  border-color: var(--ds-border-focus);
}

.topbar-admin-pill {
  border-color: rgba(0, 194, 255, 0.36);
}

.topbar-profile-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 12px;
  border-radius: 9px;
  border: 1px solid #2C4567;
  background: var(--ds-surface-secondary);
  color: var(--ds-text-primary);
  font-size: 12px;
  font-weight: 600;
  line-height: 18px;
  transition: background 150ms ease, border-color 150ms ease;
}

[data-theme="light"] .topbar-profile-pill {
  border-color: var(--border);
}

.topbar-profile-pill:hover {
  background: var(--ds-hover-bg);
  border-color: var(--ds-border-focus);
}

.topbar-avatar {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--ds-blue-primary);
  color: #F5F8FF;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Barra Horizontal de Todos os Menus da Empresa Ativa */
.company-context-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  margin-bottom: 22px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.company-context-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  border: 1px solid transparent;
  transition: all 0.14s ease;
}

.company-context-chip:hover {
  background: var(--surface-elevated);
  color: var(--text);
}

.company-context-chip.active {
  background: rgba(3, 132, 252, 0.14);
  color: var(--brand);
  border-color: rgba(3, 132, 252, 0.32);
  font-weight: 700;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.page-title-group {
  min-width: 0;
  flex: 1 1 300px;
}

.page-title-group h1 {
  font-size: 23px;
  font-weight: 800;
  color: var(--color-dark-text);
  line-height: 1.25;
}

.page-title-group p {
  font-size: 14px;
  color: var(--muted);
  margin-top: 4px;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.summary-cards,
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.summary-card,
.kpi-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
}

.summary-card.red-border,
.kpi-card.border-red {
  border-left: 4px solid var(--red);
}

.summary-card.yellow-border,
.kpi-card.border-yellow {
  border-left: 4px solid var(--yellow);
}

.summary-card.green-border,
.kpi-card.border-green {
  border-left: 4px solid var(--green);
}

.kpi-card.border-blue {
  border-left: 4px solid var(--brand-blue);
}

.summary-icon {
  font-size: 22px;
  margin-bottom: 8px;
}

.kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.kpi-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.kpi-icon.blue { background: rgba(3, 132, 252, 0.15); color: var(--brand); }
.kpi-icon.green { background: var(--green-bg); color: var(--green-text); }
.kpi-icon.yellow { background: var(--yellow-bg); color: var(--yellow-text); }
.kpi-icon.red { background: var(--red-bg); color: var(--red-text); }

.summary-number,
.kpi-value {
  font-size: 28px;
  font-weight: 800;
  line-height: 1.15;
  color: var(--color-dark-text);
  overflow-wrap: anywhere;
}

.summary-label,
.kpi-label {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--muted);
  margin-top: 4px;
}

.summary-sub,
.kpi-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 24px;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.card-header {
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.card-subtitle {
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
}

.card-body {
  padding: 22px;
  min-width: 0;
}

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

.pendencia-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
  gap: 16px;
  flex-wrap: wrap;
}

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

.pendencia-info {
  flex: 1 1 280px;
  min-width: 0;
}

.pendencia-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.pendencia-title span {
  font-weight: 500;
  color: var(--muted);
}

.pendencia-desc {
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
}

.pendencia-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Tabelas Desktop: Zero Vazamento e Alta Legibilidade */
.table-responsive {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: thin;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.data-table th {
  background: var(--table-head-bg);
  padding: 12px 16px;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
  color: var(--text);
  vertical-align: middle;
  overflow-wrap: break-word;
}

.data-table tbody tr {
  transition: background 0.12s ease;
}

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

.data-table tbody tr.is-current {
  background: rgba(3, 132, 252, 0.08);
}

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

/* Toolbar, Busca Local, Células de Empresa e Barras de Progresso */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-box .search-icon {
  position: absolute;
  left: 12px;
  font-size: 13.5px;
  color: var(--muted);
  pointer-events: none;
}

.search-box .form-control {
  padding-left: 34px;
}

.cell-company {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.company-avatar {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.progress-inline {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 130px;
}

.progress {
  flex: 1;
  height: 8px;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: 99px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  border-radius: 99px;
  transition: width 0.3s ease;
}

.progress-bar.green { background: var(--green); }
.progress-bar.yellow { background: var(--yellow); }
.progress-bar.red { background: var(--red); }

.code-pill,
code {
  display: inline-block;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--surface-elevated);
  color: var(--brand);
  border: 1px solid var(--border);
  max-width: 100%;
  overflow-wrap: anywhere;
}

.text-muted {
  color: var(--muted) !important;
}

/* ==========================================================================
   BOTÕES E BADGES
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  padding: 0 16px;
  border-radius: 9px;
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.btn-sm {
  height: 32px;
  padding: 0 11px;
  font-size: 12.5px;
}

.btn-primary {
  background: var(--brand-blue);
  color: #fff;
}

.btn-primary:hover {
  background: var(--brand-deep);
}

.btn-outline {
  background: var(--surface-elevated);
  border-color: var(--input-border);
  color: var(--text);
}

.btn-outline:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.btn-success { background: var(--green); color: #fff; }
.btn-ai { background: var(--brand-gradient); color: #fff; }
.btn-whatsapp { background: #16a34a; color: #fff; }
.btn-danger { background: var(--red); color: #fff; }
.btn-ghost { background: transparent; color: var(--muted); border-color: transparent; }
.btn-ghost:hover { background: var(--surface-elevated); color: var(--text); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.badge-green { background: var(--green-bg); color: var(--green-text); }
.badge-yellow { background: var(--yellow-bg); color: var(--yellow-text); }
.badge-red { background: var(--red-bg); color: var(--red-text); }
.badge-blue { background: var(--color-light-gray); color: var(--brand); }
.badge-gray { background: var(--surface-elevated); color: var(--muted); border: 1px solid var(--border); }
.badge-purple { background: rgba(139, 92, 246, 0.18); color: #a78bfa; }

.risk-tag {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  background: var(--surface-elevated);
  color: var(--text);
  border: 1px solid var(--border);
  margin: 2px 4px 2px 0;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.grid-2 > *,
.summary-cards > *,
.kpi-grid > *,
.form-grid > *,
.company-dashboard-layout > * {
  min-width: 0;
}

.subtabs {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 22px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.subtab-btn {
  padding: 11px 16px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
  border-bottom: 2.5px solid transparent;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
}

.subtab-btn:hover {
  color: var(--text);
}

.subtab-btn.active {
  color: var(--brand);
  border-bottom-color: var(--brand);
  font-weight: 700;
}

.flash {
  padding: 14px 20px;
  border-radius: 10px;
  background: var(--green-bg);
  color: var(--green-text);
  border: 1px solid rgba(16, 185, 129, 0.3);
  font-weight: 600;
  margin-bottom: 20px;
}

.flash.danger {
  background: var(--red-bg);
  color: var(--red-text);
  border-color: rgba(239, 68, 68, 0.35);
}

.flash.warning {
  background: var(--yellow-bg);
  color: var(--yellow-text);
  border-color: rgba(245, 158, 11, 0.35);
}

.flash.info {
  background: rgba(3, 132, 252, 0.14);
  color: var(--brand);
  border-color: rgba(3, 132, 252, 0.32);
}

/* Modais */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 7, 17, 0.72);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9000;
  padding: 20px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.modal-backdrop.active { display: flex; }

.modal-dialog {
  background: var(--white);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.45);
  width: 100%;
  max-width: 620px;
  max-height: calc(100vh - 40px);
  max-height: calc(100dvh - 40px);
  margin: auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

.modal-dialog.modal-lg { max-width: 720px; }
.modal-dialog.modal-xl { max-width: 820px; }

.modal-dialog > form {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  max-height: 100%;
  overflow: hidden;
  margin: 0;
}

.modal-header {
  padding: 20px 26px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-shrink: 0;
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.25;
}

.modal-subtitle {
  font-size: 13px;
  color: var(--muted);
  margin-top: 3px;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  font-size: 14px;
  cursor: pointer;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s;
}

.modal-close:hover {
  color: var(--text);
  border-color: var(--brand);
}

.modal-body {
  padding: 22px 26px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(3, 132, 252, 0.55) rgba(148, 163, 184, 0.12);
}

.modal-body::-webkit-scrollbar {
  width: 8px;
}

.modal-body::-webkit-scrollbar-track {
  background: rgba(148, 163, 184, 0.1);
  border-radius: 99px;
  margin: 6px 0;
}

.modal-body::-webkit-scrollbar-thumb {
  background: rgba(3, 132, 252, 0.55);
  border-radius: 99px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
  background: var(--brand);
}

.modal-footer {
  padding: 16px 26px;
  border-top: 1px solid var(--border);
  background: var(--bg);
  display: flex;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  flex-shrink: 0;
}

@media (max-width: 640px) {
  .modal-backdrop {
    padding: 12px;
  }
  .modal-dialog {
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
    border-radius: 14px;
  }
  .modal-header {
    padding: 16px 18px;
  }
  .modal-body {
    padding: 16px 18px;
  }
  .modal-footer {
    padding: 14px 18px;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
}

/* Barra de busca rápida de CNPJ no topo do Modal */
.cnpj-search-bar {
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 18px;
}

.cnpj-input-row {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}

.cnpj-input-row .form-control {
  flex: 1;
  background: var(--input-bg);
  font-weight: 600;
  letter-spacing: 0.02em;
}

.cnpj-lookup-status {
  font-size: 12.5px;
  font-weight: 600;
  margin-top: 8px;
  display: none;
}

.cnpj-lookup-status.visible {
  display: block;
}

.modal-section-divider {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--brand);
  margin: 6px 0 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

/* Formulários e Campos com Alta Legibilidade em Dark e Light Mode */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 0;
  min-width: 0;
}

.form-group.full { grid-column: 1 / -1; }
.form-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}
.form-hint {
  font-size: 11.8px;
  color: var(--muted);
  margin-top: 2px;
  line-height: 1.35;
}
.form-control,
select.form-control,
textarea.form-control,
input.form-control {
  width: 100%;
  max-width: 100%;
  padding: 10px 13px;
  border-radius: 9px;
  border: 1.5px solid var(--input-border);
  background-color: var(--input-bg);
  color: var(--text);
  font: inherit;
  font-size: 13.8px;
  font-weight: 500;
  line-height: 1.4;
  transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
}

select.form-control option,
select option {
  background-color: var(--input-bg);
  color: var(--text);
  padding: 8px;
}

.form-control::placeholder {
  color: var(--muted);
  opacity: 0.78;
}

.form-control:focus {
  outline: none;
  border-color: var(--brand);
  background-color: var(--input-focus-bg);
  box-shadow: 0 0 0 3px rgba(3, 132, 252, 0.2);
}

input[type="file"].form-control {
  padding: 7px 10px;
  font-size: 12.5px;
}

.inheritance-box {
  background: var(--surface-elevated);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  margin-top: 8px;
  font-size: 13.5px;
}
.signature-pad-container { border: 1.5px dashed var(--input-border); border-radius: 10px; padding: 12px; text-align: center; }
#epiSignatureCanvas { background: #fff; border: 1px solid var(--border); width: 100%; max-width: 520px; height: 150px; }

/* Pastas Drive e PDF */
.drive-folders-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin-bottom: 24px; }
.drive-folder-card { background: var(--white); border: 1px solid var(--border); border-radius: 12px; padding: 16px; display: flex; align-items: center; gap: 12px; color: var(--text); min-width: 0; }
.drive-folder-card.active { border-color: var(--brand-blue); background: var(--color-light-gray); }
.folder-icon { font-size: 24px; flex-shrink: 0; }
.folder-info { min-width: 0; }
.folder-info h4 { font-size: 14px; font-weight: 700; overflow-wrap: anywhere; }
.folder-info span { font-size: 12.5px; color: var(--muted); }

/* Documento A4 Imprimível (Mantém sempre folha branca A4 oficial) */
.pdf-paper { background: #fff; color: #0f172a; border: 1px solid #cbd5e1; padding: 38px 42px; max-width: 840px; margin: 0 auto; font-size: 13px; box-shadow: 0 18px 48px rgba(2, 7, 17, 0.14); border-radius: 4px; position: relative; }
.pdf-header { display: flex; justify-content: space-between; align-items: center; gap: 18px; border-bottom: 2.5px solid #0f172a; padding-bottom: 16px; margin-bottom: 20px; color: #0f172a; }
.pdf-header.pdf-header-dark { background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 100%); color: #f8fafc; padding: 18px 22px; border-radius: 8px; border-bottom: 3px solid #0384fc; }
.pdf-header-brand { display: flex; align-items: center; gap: 16px; flex: 1; min-width: 0; }
.pdf-logo-box { display: flex; align-items: center; justify-content: center; flex-shrink: 0; padding-right: 14px; border-right: 1.5px solid rgba(148, 163, 184, 0.35); }
.pdf-doc-title { text-align: center; background: #f1f5f9; color: #0f172a; padding: 10px 14px; font-weight: 800; margin-bottom: 18px; border: 1px solid #cbd5e1; letter-spacing: 0.02em; }
.pdf-section-title { font-size: 12px; font-weight: 800; background: #0f172a; color: #fff; padding: 6px 10px; margin: 16px 0 10px; letter-spacing: 0.03em; }
.pdf-table { width: 100%; border-collapse: collapse; margin-bottom: 14px; font-size: 12px; color: #0f172a; }
.pdf-table th, .pdf-table td { border: 1px solid #94a3b8; padding: 7px 9px; color: #0f172a; }
.pdf-table th { background: #e2e8f0; color: #0f172a; }
.pdf-signatures { display: grid; grid-template-columns: 1fr 1fr; gap: 36px; margin-top: 32px; text-align: center; color: #0f172a; align-items: end; }
.pdf-sig-line { border-top: 1.5px solid #0f172a; padding-top: 6px; color: #0f172a; position: relative; }

/* Carimbo Técnico Oficial (CREA / CRM-RQE / Consultoria) + Rubrica Caligráfica */
.pdf-stamp-box {
  display: inline-block;
  border: 2px solid #1e3a8a;
   outline: 1px solid rgba(30, 58, 138, 0.35);
  outline-offset: 2px;
  border-radius: 6px;
  padding: 6px 14px;
  margin-bottom: 6px;
  background: rgba(239, 246, 255, 0.55);
  color: #1e3a8a;
  text-align: center;
  transform: rotate(-1.2deg);
  max-width: 290px;
}
.pdf-stamp-box.stamp-med {
  border-color: #065f46;
  outline-color: rgba(6, 95, 70, 0.35);
  background: rgba(236, 253, 245, 0.55);
  color: #065f46;
  transform: rotate(0.9deg);
}
.pdf-stamp-box.stamp-corp {
  border-color: #0f172a;
  outline-color: rgba(15, 23, 42, 0.3);
  background: rgba(248, 250, 252, 0.8);
  color: #0f172a;
  transform: rotate(-0.6deg);
}
.pdf-calligraphic-sig {
  font-family: "Georgia", "Times New Roman", cursive, serif;
  font-style: italic;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.15;
  margin-bottom: 2px;
  opacity: 0.88;
}
.pdf-stamp-title {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.pdf-stamp-role {
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.9;
}
.pdf-stamp-reg {
  font-size: 10px;
  font-family: monospace;
  font-weight: 700;
  margin-top: 1px;
}
.pdf-footer-stamp {
  margin-top: 26px;
  padding-top: 10px;
  border-top: 1px dashed #94a3b8;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 10.5px;
  color: #475569;
}

@media print {
  .page-header, .sidebar, .topbar { display: none !important; }
  .pdf-paper { border: none; box-shadow: none; padding: 0; max-width: 100%; }
}

