/* ==========================================================================
   SIMP FLOW (6º Simulador Agencialink) — Design System Moderno (Estilo Koter)
   Plataforma Web Padrão (HTML5 / CSS3 / Vanilla JS / PHP Compatível)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Inter:wght@400;500;600;700&display=swap');

:root {
  /* Paleta Identidade Agencialink / SIMP Flow (Azul Safira & Índigo Profundo) */
  --brand-primary: #2563eb;
  --brand-primary-hover: #1d4ed8;
  --brand-primary-active: #1e40af;
  --brand-primary-soft: #eff6ff;
  --brand-primary-border: #bfdbfe;
  --brand-accent: #4f46e5;
  --brand-gradient: linear-gradient(135deg, #2563eb 0%, #4f46e5 100%);
  --brand-rail-bg: #0f172a;
  --brand-rail-item: rgba(255, 255, 255, 0.08);
  --brand-rail-active: #2563eb;

  /* Superfícies & Fundos (Soft UI) */
  --bg-canvas: #f1f5f9;
  --bg-sidebar: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-muted: #f8fafc;
  --bg-surface-hover: #f1f5f9;
  --bg-input: #f1f5f9;
  --bg-glass: rgba(255, 255, 255, 0.88);

  /* Textos */
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-subtle: #94a3b8;
  --text-on-brand: #ffffff;

  /* Bordas & Divisores */
  --border-subtle: #e2e8f0;
  --border-strong: #cbd5e1;

  /* Status Semânticos */
  --success: #10b981;
  --success-soft: #ecfdf5;
  --success-text: #047857;
  --warning: #f59e0b;
  --warning-soft: #fffbeb;
  --warning-text: #b45309;
  --danger: #ef4444;
  --danger-soft: #fef2f2;
  --danger-text: #b91c1c;
  --info: #0ea5e9;
  --info-soft: #f0f9ff;
  --info-text: #0369a1;
  --purple: #7c3aed;
  --purple-soft: #f5f3ff;

  /* Raios (Geometria Arredondada Koter-style) */
  --radius-xs: 8px;
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-xl: 28px;
  --radius-pill: 9999px;

  /* Sombras Suaves em Camadas */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 4px 12px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 10px 25px -5px rgba(15, 23, 42, 0.08), 0 4px 10px -3px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 20px 40px -10px rgba(15, 23, 42, 0.14);
  --shadow-float: 0 16px 36px rgba(15, 23, 42, 0.22);

  /* Transições */
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --brand-primary: #3b82f6;
  --brand-primary-hover: #2563eb;
  --brand-primary-soft: rgba(59, 130, 246, 0.15);
  --brand-primary-border: rgba(59, 130, 246, 0.35);
  --brand-rail-bg: #020617;

  --bg-canvas: #0b1120;
  --bg-sidebar: #0f172a;
  --bg-surface: #1e293b;
  --bg-surface-muted: #162032;
  --bg-surface-hover: #263449;
  --bg-input: #0f172a;
  --bg-glass: rgba(30, 41, 59, 0.9);

  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --text-subtle: #64748b;

  --border-subtle: #334155;
  --border-strong: #475569;

  --success-soft: rgba(16, 185, 129, 0.15);
  --success-text: #34d399;
  --warning-soft: rgba(245, 158, 11, 0.15);
  --warning-text: #fbbf24;
  --danger-soft: rgba(239, 68, 68, 0.15);
  --danger-text: #f87171;
  --info-soft: rgba(14, 165, 233, 0.15);
  --info-text: #38bdf8;
  --purple-soft: rgba(124, 58, 237, 0.18);
}

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

html, body {
  height: 100%;
  font-family: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

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

/* Scrollbars suaves */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--radius-pill);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

.hidden {
  display: none !important;
}

/* ==========================================================================
   TELA DE LOGIN (Split Moderno + Aceite de Termos)
   ========================================================================== */
.login-screen {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  background: var(--bg-canvas);
  overflow-y: auto;
}

.login-hero {
  flex: 1.1;
  background: linear-gradient(145deg, #0f172a 0%, #1e3a8a 55%, #2563eb 100%);
  color: #ffffff;
  padding: 48px 56px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.login-hero::before {
  content: '';
  position: absolute;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.22) 0%, transparent 70%);
  top: -120px;
  right: -120px;
  pointer-events: none;
}

.login-hero::after {
  content: '';
  position: absolute;
  width: 440px;
  height: 440px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.28) 0%, transparent 70%);
  bottom: -100px;
  left: -80px;
  pointer-events: none;
}

.login-brand-header {
  display: flex;
  align-items: center;
  gap: 14px;
  z-index: 1;
}

.login-brand-header img {
  height: 42px;
  object-fit: contain;
}

.login-brand-badge {
  background: rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(8px);
  padding: 5px 14px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.login-hero-content {
  max-width: 520px;
  z-index: 1;
  margin: auto 0;
}

.login-hero-content h1 {
  font-size: 36px;
  font-weight: 800;
  line-height: 1.18;
  margin-bottom: 18px;
  letter-spacing: -0.02em;
}

.login-hero-content p {
  font-size: 16px;
  color: rgba(255, 255, 255, 0.82);
  margin-bottom: 32px;
  line-height: 1.6;
}

.login-feature-pills {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.login-feature-card {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(10px);
  padding: 16px 18px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.login-feature-card i {
  font-size: 18px;
  color: #38bdf8;
  margin-top: 2px;
}

.login-feature-card strong {
  display: block;
  font-size: 13.5px;
  margin-bottom: 3px;
}

.login-feature-card span {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.72);
}

.login-panel-wrapper {
  flex: 0.9;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 32px;
  background: var(--bg-surface);
}

.login-card {
  width: 100%;
  max-width: 420px;
}

.login-card-header {
  margin-bottom: 28px;
}

.login-card-header h2 {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 6px;
  letter-spacing: -0.02em;
}

.login-card-header p {
  color: var(--text-muted);
  font-size: 14px;
}

.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 7px;
}

.input-pill-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-pill-wrap i.input-icon {
  position: absolute;
  left: 16px;
  color: var(--text-muted);
  font-size: 15px;
  pointer-events: none;
}

.input-pill {
  width: 100%;
  background: var(--bg-input);
  border: 1.5px solid transparent;
  border-radius: var(--radius-md);
  padding: 13px 16px 13px 44px;
  font-size: 14px;
  color: var(--text-primary);
  transition: var(--transition-fast);
  outline: none;
}

.input-pill.no-icon {
  padding-left: 16px;
}

.input-pill:focus {
  background: var(--bg-surface);
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 4px var(--brand-primary-soft);
}

.input-action-btn {
  position: absolute;
  right: 12px;
  color: var(--text-muted);
  padding: 6px;
  border-radius: var(--radius-xs);
}

.input-action-btn:hover {
  color: var(--text-primary);
}

.login-options-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
  font-size: 13px;
}

.btn-primary-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--brand-gradient);
  color: #ffffff;
  font-weight: 700;
  font-size: 14.5px;
  padding: 13px 26px;
  border-radius: var(--radius-pill);
  box-shadow: 0 8px 20px -4px rgba(37, 99, 235, 0.45);
  transition: var(--transition-fast);
}

.btn-primary-pill:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px -4px rgba(37, 99, 235, 0.55);
}

.btn-primary-pill:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-secondary-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--bg-surface-muted);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  font-weight: 600;
  font-size: 13.5px;
  padding: 10px 20px;
  border-radius: var(--radius-pill);
  transition: var(--transition-fast);
}

.btn-secondary-pill:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-strong);
}

.btn-outline-brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--bg-surface);
  color: var(--brand-primary);
  border: 1.5px solid var(--brand-primary);
  font-weight: 700;
  font-size: 13.5px;
  padding: 10px 22px;
  border-radius: var(--radius-pill);
  transition: var(--transition-fast);
}

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

/* ==========================================================================
   ESTRUTURA DE 4 PAINÉIS (ESTILO KOTER)
   1. Rail Primário (Esquerda Escura)
   2. Sidebar Secundária (Menu do Módulo)
   3. Área Central (Workspace)
   4. Painel Lateral Direito (Contexto / Filtros)
   ========================================================================== */
.app-shell {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  background: var(--bg-canvas);
}

/* 1. Rail Primário */
.primary-rail {
  width: 68px;
  background: var(--brand-rail-bg);
  color: #ffffff;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 0;
  z-index: 40;
  flex-shrink: 0;
}

.rail-logo {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: var(--brand-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 20px;
  color: #fff;
  margin-bottom: 24px;
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.45);
  cursor: pointer;
}

.rail-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  padding: 0 8px;
  flex: 1;
}

.rail-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 4px;
  border-radius: var(--radius-sm);
  color: rgba(255, 255, 255, 0.65);
  font-size: 10px;
  font-weight: 600;
  transition: var(--transition-fast);
  position: relative;
}

.rail-btn i {
  font-size: 17px;
}

.rail-btn:hover {
  background: var(--brand-rail-item);
  color: #ffffff;
}

.rail-btn.active {
  background: var(--brand-rail-active);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.rail-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  width: 100%;
}

.rail-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--brand-primary);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.25);
  cursor: pointer;
}

.rail-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* 2. Sidebar Secundária */
.secondary-sidebar {
  width: 230px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  flex-shrink: 0;
  transition: width var(--transition-smooth), padding var(--transition-smooth);
}

.secondary-sidebar.collapsed {
  width: 0;
  padding: 18px 0;
  overflow: hidden;
  border-right: none;
}

.sidebar-workspace-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px 16px;
  font-weight: 800;
  font-size: 15px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 14px;
}

.sidebar-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-subtle);
  padding: 10px 12px 6px;
}

.sidebar-menu {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  overflow-y: auto;
}

.sidebar-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-pill);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 13.5px;
  transition: var(--transition-fast);
  text-align: left;
}

.sidebar-item-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-item i {
  width: 18px;
  text-align: center;
  font-size: 15px;
  color: var(--text-muted);
}

.sidebar-item:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
}

.sidebar-item.active {
  background: var(--bg-surface);
  color: var(--brand-primary);
  box-shadow: var(--shadow-xs);
  font-weight: 700;
}

.sidebar-item.active i {
  color: var(--brand-primary);
}

.sidebar-badge {
  background: var(--brand-primary-soft);
  color: var(--brand-primary);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
}

/* 3. Área Principal (Header + Conteúdo + Painel Direito) */
.main-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100vh;
  overflow: hidden;
}

/* Top Header */
.top-header {
  height: 64px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-shrink: 0;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-icon-circle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--bg-surface-muted);
  border: 1px solid var(--border-subtle);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: var(--transition-fast);
  position: relative;
}

.btn-icon-circle:hover {
  background: var(--bg-surface-hover);
  color: var(--brand-primary);
  border-color: var(--brand-primary-border);
}

.badge-dot {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--radius-pill);
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-surface);
}

.header-city-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  font-weight: 600;
  font-size: 13px;
  color: var(--text-primary);
  transition: var(--transition-fast);
}

.header-city-pill i {
  color: var(--brand-primary);
}

.header-city-pill:hover {
  border-color: var(--brand-primary);
  background: var(--brand-primary-soft);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 12px 5px 6px;
  border-radius: var(--radius-pill);
  background: var(--bg-surface-muted);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
}

.user-chip-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--brand-gradient);
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.user-chip-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-chip-info {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.user-chip-name {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-primary);
}

.user-chip-role {
  font-size: 10.5px;
  color: var(--text-muted);
}

/* Workspace Body */
.workspace-body {
  flex: 1;
  display: flex;
  min-height: 0;
  overflow: hidden;
}

.workspace-center {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px 100px;
  min-width: 0;
}

.workspace-right-panel {
  width: 350px;
  background: var(--bg-surface);
  border-left: 1px solid var(--border-subtle);
  padding: 22px 20px 90px;
  overflow-y: auto;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* ==========================================================================
   COMPONENTES DO DASHBOARD DE COTAÇÕES (frame_001.jpg)
   ========================================================================== */
.page-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.page-title-group h1 {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.page-title-group p {
  font-size: 13px;
  color: var(--text-muted);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 22px;
}

.kpi-card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-xs);
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: var(--transition-fast);
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.kpi-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.kpi-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.kpi-icon.blue { background: var(--brand-primary-soft); color: var(--brand-primary); }
.kpi-icon.green { background: var(--success-soft); color: var(--success); }
.kpi-icon.amber { background: var(--warning-soft); color: var(--warning); }
.kpi-icon.purple { background: var(--purple-soft); color: var(--purple); }

.kpi-value {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.1;
}

.kpi-label {
  font-size: 12.5px;
  color: var(--text-muted);
  font-weight: 500;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.status-dot.blue { background: var(--brand-primary); box-shadow: 0 0 0 4px var(--brand-primary-soft); }
.status-dot.green { background: var(--success); box-shadow: 0 0 0 4px var(--success-soft); }
.status-dot.amber { background: var(--warning); box-shadow: 0 0 0 4px var(--warning-soft); }

/* Action Bar & Segmented Controls */
.action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.segmented-pills {
  display: inline-flex;
  background: var(--bg-surface);
  padding: 4px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  gap: 4px;
}

.segmented-pill {
  padding: 7px 16px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: var(--transition-fast);
}

.segmented-pill.active {
  background: var(--brand-primary);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}

/* Tabela Moderna de Cotações */
.card-surface {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.modern-table {
  width: 100%;
  border-collapse: collapse;
}

.modern-table th {
  text-align: left;
  padding: 14px 20px;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  background: var(--bg-surface-muted);
  border-bottom: 1px solid var(--border-subtle);
}

.modern-table td {
  padding: 15px 20px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
  font-size: 13.5px;
}

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

.modern-table tbody tr {
  transition: var(--transition-fast);
}

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

.client-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.client-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--brand-primary-soft);
  color: var(--brand-primary);
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.client-name {
  font-weight: 700;
  color: var(--text-primary);
}

.client-code {
  font-size: 12px;
  color: var(--text-muted);
}

.pill-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 700;
}

.pill-badge.green { background: var(--success-soft); color: var(--success-text); }
.pill-badge.amber { background: var(--warning-soft); color: var(--warning-text); }
.pill-badge.blue { background: var(--brand-primary-soft); color: var(--brand-primary); }
.pill-badge.info { background: var(--info-soft); color: var(--info-text); }
.pill-badge.purple { background: var(--purple-soft); color: var(--purple); }
.pill-badge.danger { background: var(--danger-soft); color: var(--danger-text); }

/* Kanban Board */
.kanban-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.kanban-col {
  background: var(--bg-surface-muted);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 420px;
}

.kanban-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  font-size: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
}

.kanban-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-shadow: var(--shadow-xs);
  transition: var(--transition-fast);
  cursor: pointer;
}

.kanban-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
  border-color: var(--brand-primary-border);
}

/* ==========================================================================
   ETAPA 1 DA COTAÇÃO: CONVERSOR DE FAIXAS ETÁRIAS + PAINEL DIREITO (frame_007, 015, 018, 024)
   ========================================================================== */
.wizard-steps-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.wizard-step-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  transition: var(--transition-fast);
}

.wizard-step-pill .step-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--bg-input);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
}

.wizard-step-pill.active {
  border-color: var(--brand-primary);
  background: var(--brand-primary-soft);
  color: var(--brand-primary);
}

.wizard-step-pill.active .step-num {
  background: var(--brand-primary);
  color: #fff;
}

.wizard-step-pill.done {
  border-color: var(--success);
  color: var(--success-text);
}

.wizard-step-pill.done .step-num {
  background: var(--success);
  color: #fff;
}

.converter-card {
  background: var(--bg-surface);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-sm);
  padding: 28px 30px;
}

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

.converter-header h2 {
  font-size: 21px;
  font-weight: 800;
  margin-bottom: 4px;
}

.converter-header p {
  font-size: 13.5px;
  color: var(--text-muted);
}

.age-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-bottom: 26px;
}

.age-bracket-card {
  background: var(--bg-surface-muted);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 12px;
  text-align: center;
  transition: var(--transition-fast);
}

.age-bracket-card.has-lives {
  background: var(--brand-primary-soft);
  border-color: var(--brand-primary);
}

.age-bracket-label {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 10px;
  display: block;
}

.age-bracket-card.has-lives .age-bracket-label {
  color: var(--brand-primary);
}

.stepper-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface);
  border-radius: var(--radius-pill);
  padding: 4px;
  border: 1px solid var(--border-subtle);
}

.stepper-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 15px;
  color: var(--text-secondary);
  background: var(--bg-surface-muted);
  transition: var(--transition-fast);
}

.stepper-btn:hover {
  background: var(--brand-primary);
  color: #ffffff;
}

.stepper-input {
  width: 42px;
  text-align: center;
  border: none;
  background: transparent;
  font-weight: 800;
  font-size: 15px;
  color: var(--text-primary);
  outline: none;
  -moz-appearance: textfield;
}
.stepper-input::-webkit-outer-spin-button,
.stepper-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.converter-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 20px;
  border-top: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}

.disclaimer-check {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: var(--radius-pill);
  background: var(--warning-soft);
  color: var(--warning-text);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

.disclaimer-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--warning);
  cursor: pointer;
}

/* Painel Lateral Direito: Controles */
.panel-section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mode-toggle-group {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: var(--bg-input);
  padding: 4px;
  border-radius: var(--radius-pill);
  gap: 4px;
}

.mode-toggle-btn {
  padding: 9px 10px;
  border-radius: var(--radius-pill);
  font-weight: 700;
  font-size: 12.5px;
  color: var(--text-secondary);
  text-align: center;
  transition: var(--transition-fast);
}

.mode-toggle-btn.active {
  background: var(--brand-primary);
  color: #ffffff;
  box-shadow: 0 3px 10px rgba(37, 99, 235, 0.35);
}

.lives-summary-box {
  background: var(--brand-primary-soft);
  border: 1px solid var(--brand-primary-border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.lives-summary-box strong {
  color: var(--brand-primary);
  font-size: 15px;
  font-weight: 800;
}

.autocomplete-dropdown {
  position: relative;
}

.autocomplete-list {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  max-height: 230px;
  overflow-y: auto;
  z-index: 90;
}

.autocomplete-item {
  padding: 10px 14px;
  font-size: 13px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.autocomplete-item:hover {
  background: var(--brand-primary-soft);
  color: var(--brand-primary);
}

/* ==========================================================================
   ETAPA 2 DA COTAÇÃO: OPERADORAS & SELEÇÃO DE PLANOS (frame_033, 040, 046, 096)
   ========================================================================== */
.operator-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.operator-accordion {
  background: var(--bg-surface);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: var(--transition-fast);
  box-shadow: var(--shadow-xs);
}

.operator-accordion.has-selected {
  border-color: var(--brand-primary);
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.08);
}

.operator-header {
  padding: 16px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  cursor: pointer;
  user-select: none;
}

.operator-header:hover {
  background: var(--bg-surface-hover);
}

.operator-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.operator-logo-box {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.operator-logo-box img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.operator-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-primary);
}

.operator-subtitle {
  font-size: 12.5px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 2px;
}

.selected-mini-cards-strip {
  padding: 0 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.selected-mini-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 12px;
}

.selected-mini-card {
  background: var(--bg-surface-muted);
  border: 1px solid var(--brand-primary-border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
}

.selected-mini-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.selected-mini-card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mini-icon-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: var(--transition-fast);
}

.mini-icon-btn.info {
  background: var(--brand-primary-soft);
  color: var(--brand-primary);
}

.mini-icon-btn.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.operator-plans-body {
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface-muted);
  padding: 18px 22px;
}

.product-group-block {
  margin-bottom: 18px;
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  padding: 16px;
}

.product-group-block:last-child {
  margin-bottom: 0;
}

.product-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--border-subtle);
  flex-wrap: wrap;
}

.plan-option-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid transparent;
  transition: var(--transition-fast);
  cursor: pointer;
}

.plan-option-row:hover {
  background: var(--bg-surface-hover);
}

.plan-option-row.selected {
  background: var(--brand-primary-soft);
  border-color: var(--brand-primary);
}

.plan-option-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.custom-check {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 2px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  flex-shrink: 0;
  transition: var(--transition-fast);
}

.plan-option-row.selected .custom-check {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
  color: #fff;
}

.plan-option-price {
  font-size: 16px;
  font-weight: 800;
  color: var(--brand-primary);
  white-space: nowrap;
}

/* ==========================================================================
   ETAPA 3: MESA DE COTAÇÃO INTERATIVA & COMPARATIVO (frame_062, 078, 081, 115)
   ========================================================================== */
.quote-workbench-header {
  background: var(--bg-surface);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-subtle);
  padding: 22px 26px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-xs);
}

.workbench-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.editable-client-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 800;
}

.editable-client-title input {
  font-size: 20px;
  font-weight: 800;
  border: 1px dashed transparent;
  background: transparent;
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  color: var(--text-primary);
}

.editable-client-title input:focus {
  border-color: var(--brand-primary);
  background: var(--bg-input);
  outline: none;
}

/* Barra Horizontal de Categorias / Abas em Pílula (Preços, Rede, Comercialização, etc.) */
.category-pills-scroll {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.category-tab-pill {
  padding: 9px 18px;
  border-radius: var(--radius-pill);
  background: var(--bg-surface-muted);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition-fast);
}

.category-tab-pill:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
}

.category-tab-pill.active {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

/* Grid de Cards de Planos da Cotação (frame_078, 081, 115) */
.quote-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 20px;
}

.quote-plan-card {
  background: var(--bg-surface);
  border-radius: var(--radius-xl);
  border: 2px solid var(--border-subtle);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  transition: var(--transition-smooth);
}

.quote-plan-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.quote-plan-card.recommended {
  border-color: var(--brand-primary);
  box-shadow: 0 12px 28px -6px rgba(37, 99, 235, 0.25);
}

.recommended-ribbon {
  position: absolute;
  top: -12px;
  left: 22px;
  background: var(--brand-gradient);
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 14px;
  border-radius: var(--radius-pill);
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.35);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.plan-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.plan-card-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.plan-card-brand img {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--border-subtle);
  padding: 4px;
}

.plan-card-title {
  font-size: 17px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 10px;
  line-height: 1.3;
}

.plan-card-bullets {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 18px;
  font-size: 13px;
  color: var(--text-secondary);
}

.plan-card-bullets li {
  display: flex;
  align-items: center;
  gap: 8px;
}

.plan-card-bullets li i {
  color: var(--brand-primary);
  width: 16px;
  text-align: center;
}

.plan-card-price-box {
  background: var(--bg-surface-muted);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 14px;
  border: 1px solid var(--border-subtle);
}

.plan-card-price-label {
  font-size: 11.5px;
  color: var(--text-muted);
  font-weight: 600;
}

.plan-card-price-val {
  font-size: 24px;
  font-weight: 800;
  color: var(--brand-primary);
  letter-spacing: -0.02em;
}

/* Menu de Contexto (...) do Card */
.card-menu-wrap {
  position: relative;
}

.card-context-menu {
  position: absolute;
  top: 36px;
  right: 0;
  width: 210px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 60;
}

.card-context-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-xs);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-align: left;
}

.card-context-item:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
}

.card-context-item.danger {
  color: var(--danger);
}

.card-context-item.danger:hover {
  background: var(--danger-soft);
}

/* ==========================================================================
   TOOLBAR FLUTUANTE INFERIOR (frame_078, 081)
   ========================================================================== */
.floating-action-dock {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--brand-rail-bg);
  color: #ffffff;
  padding: 8px 12px;
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-float);
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 100;
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.dock-counter {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--brand-gradient);
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dock-divider {
  width: 1px;
  height: 24px;
  background: rgba(255, 255, 255, 0.16);
  margin: 0 4px;
}

.dock-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  color: rgba(255, 255, 255, 0.9);
  font-size: 13px;
  font-weight: 600;
  transition: var(--transition-fast);
}

.dock-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.dock-btn.primary {
  background: var(--brand-primary);
  color: #ffffff;
}

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

.dock-btn.whatsapp {
  background: #10b981;
  color: #ffffff;
}

.dock-btn.whatsapp:hover {
  background: #059669;
}

/* ==========================================================================
   MODAIS COM BACKDROP BLUR (frame_011, 029, 055, 073, 089, 106)
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.48);
  backdrop-filter: blur(8px);
  z-index: 1500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-window {
  background: var(--bg-surface);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalPop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-window.modal-lg {
  max-width: 920px;
}

.modal-window.modal-sm {
  max-width: 440px;
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

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

.modal-header h3 {
  font-size: 19px;
  font-weight: 800;
  color: var(--text-primary);
}

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

.modal-body {
  padding: 22px 26px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 16px 26px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* Chips / Tags de Datas de Nascimento (frame_011) */
.date-tags-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  min-height: 38px;
}

.date-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: var(--brand-primary-soft);
  border: 1px solid var(--brand-primary-border);
  color: var(--brand-primary);
  font-size: 12.5px;
  font-weight: 700;
}

.date-chip button {
  color: var(--brand-primary);
  font-size: 12px;
  opacity: 0.75;
}

.date-chip button:hover {
  opacity: 1;
}

/* Toast Notification */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast-item {
  background: var(--brand-rail-bg);
  color: #ffffff;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13.5px;
  font-weight: 600;
  animation: modalPop 0.2s ease-out;
}

/* Responsividade */
@media (max-width: 1180px) {
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .age-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .workspace-body {
    flex-direction: column;
    overflow-y: auto;
  }
  .workspace-center {
    overflow-y: visible;
    padding-bottom: 24px;
  }
  .workspace-right-panel {
    width: 100%;
    border-left: none;
    border-top: 1px solid var(--border-subtle);
    overflow-y: visible;
  }
}

@media (max-width: 860px) {
  .login-hero {
    display: none;
  }
  .secondary-sidebar {
    position: fixed;
    left: 68px;
    top: 0;
    bottom: 0;
    z-index: 35;
    box-shadow: var(--shadow-lg);
  }
  .kanban-grid {
    grid-template-columns: 1fr;
  }
}

@media print {
  .primary-rail,
  .secondary-sidebar,
  .top-header,
  .workspace-right-panel,
  .floating-action-dock,
  .wizard-steps-bar {
    display: none !important;
  }
  body, .app-shell, .main-stage, .workspace-body, .workspace-center {
    height: auto !important;
    overflow: visible !important;
    background: #fff !important;
  }
}

#sectionCotador .workspace-center {
  padding-bottom: 120px;
}

.rich-content img {
  max-width: 100%;
  height: auto;
}

.rich-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.rich-content td,
.rich-content th {
  border: 1px solid var(--border-subtle);
  padding: 4px 6px;
}

/* ==========================================================================
   MOBILE (até 860px): navegação inferior, gavetas laterais e dock compacto
   ========================================================================== */
.mobile-only,
.mobile-backdrop {
  display: none;
}

@media (max-width: 860px) {
  .mobile-only {
    display: inline-flex;
  }

  .app-shell {
    height: 100dvh;
  }

  .main-stage {
    height: calc(100dvh - 62px);
  }

  /* Rail vira barra de navegação inferior */
  .primary-rail {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 62px;
    flex-direction: row;
    padding: 0 4px env(safe-area-inset-bottom);
    z-index: 900;
    box-shadow: 0 -6px 20px rgba(15, 23, 42, 0.18);
  }

  .rail-logo,
  .rail-footer {
    display: none;
  }

  .rail-nav {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 2px;
    padding: 0;
    height: 100%;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .rail-nav::-webkit-scrollbar {
    display: none;
  }

  .rail-btn {
    flex: 1 0 50px;
    padding: 7px 2px;
    font-size: 9.5px;
  }

  .rail-btn i {
    font-size: 16px;
  }

  /* Sidebar secundária vira gaveta */
  .secondary-sidebar,
  .secondary-sidebar.collapsed {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(84vw, 300px);
    padding: 18px 14px;
    border-right: 1px solid var(--border-subtle);
    overflow: hidden;
    z-index: 1200;
    transform: translateX(-105%);
    transition: transform var(--transition-smooth);
    box-shadow: var(--shadow-lg);
  }

  body.sidebar-open .secondary-sidebar {
    transform: translateX(0);
  }

  body.sidebar-open .mobile-backdrop,
  body.panel-open .mobile-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(3px);
    z-index: 1100;
  }

  /* Painel de cliente e filtros vira gaveta à direita */
  .workspace-right-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(92vw, 380px);
    border-top: none;
    border-left: 1px solid var(--border-subtle);
    padding: 16px 16px 32px;
    overflow-y: auto;
    z-index: 1200;
    transform: translateX(105%);
    transition: transform var(--transition-smooth);
    box-shadow: var(--shadow-lg);
  }

  body.panel-open .workspace-right-panel {
    transform: translateX(0);
  }

  .mobile-panel-header {
    align-items: center;
    justify-content: space-between;
    font-size: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-subtle);
  }

  /* Header compacto */
  .top-header {
    height: 58px;
    padding: 0 12px;
    gap: 8px;
  }

  .header-left,
  .header-right {
    gap: 6px;
    min-width: 0;
  }

  .header-city-pill {
    padding: 7px 12px;
    font-size: 12px;
    max-width: 42vw;
    overflow: hidden;
  }

  .header-city-pill span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .header-new-quote {
    width: 38px;
    height: 38px;
    padding: 0 !important;
    justify-content: center;
  }

  .header-new-quote span,
  .user-chip-info {
    display: none;
  }

  .user-chip {
    padding: 3px;
  }

  .btn-icon-circle {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
  }

  /* Conteúdo */
  .workspace-body {
    overflow-y: auto;
  }

  .workspace-center {
    padding: 14px 12px 24px;
  }

  #sectionCotador .workspace-center {
    padding-bottom: 110px;
  }

  .page-title-group h1 {
    font-size: 20px;
  }

  .page-header-row > div:last-child,
  .action-bar > div {
    width: 100%;
    flex-wrap: wrap;
  }

  .page-header-row .input-pill-wrap,
  .action-bar .input-pill-wrap {
    min-width: 0 !important;
    flex: 1 1 100%;
  }

  .action-bar select,
  .action-bar .btn-primary-pill,
  .action-bar .btn-secondary-pill {
    flex: 1 1 auto;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .kpi-card {
    padding: 12px;
  }

  .kpi-left {
    gap: 10px;
  }

  .kpi-icon {
    width: 36px;
    height: 36px;
    font-size: 15px;
  }

  .kpi-value {
    font-size: 18px;
  }

  .kpi-label {
    font-size: 11px;
  }

  .kpi-card .status-dot {
    display: none;
  }

  /* Etapas */
  .wizard-steps-bar {
    flex-wrap: nowrap;
    gap: 6px;
    margin-bottom: 14px;
  }

  .wizard-step-pill {
    padding: 7px 10px;
    font-size: 12px;
    white-space: nowrap;
  }

  .wizard-step-pill:not(.active) span:not(.step-num) {
    display: none;
  }

  .converter-card {
    padding: 18px 14px;
  }

  .converter-header h2 {
    font-size: 18px;
  }

  .converter-header > div:last-child {
    width: 100%;
  }

  .converter-header > div:last-child > button {
    flex: 1;
    justify-content: center;
  }

  .age-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 18px;
  }

  .age-bracket-card {
    padding: 10px 8px;
  }

  .stepper-btn {
    width: 32px;
    height: 32px;
  }

  .stepper-input {
    width: 34px;
  }

  .converter-footer > div,
  .converter-footer .btn-primary-pill {
    width: 100%;
    justify-content: space-between;
  }

  .card-surface {
    padding: 16px !important;
  }

  /* Operadoras */
  .operator-header {
    padding: 12px 14px;
    gap: 10px;
  }

  .operator-brand {
    gap: 10px;
    min-width: 0;
  }

  .operator-logo-box {
    width: 42px;
    height: 42px;
    border-radius: 12px;
  }

  .operator-title {
    font-size: 14.5px;
  }

  .operator-subtitle {
    flex-wrap: wrap;
    gap: 4px 8px;
    font-size: 12px;
  }

  .selected-mini-cards-strip {
    padding: 0 14px 12px;
  }

  .operator-plans-body {
    padding: 10px;
  }

  .product-group-block {
    padding: 12px 10px;
  }

  .plan-option-row {
    padding: 10px 8px;
    gap: 8px;
    align-items: flex-start;
  }

  .plan-option-price {
    font-size: 14px;
  }

  /* Mesa da cotação */
  .quote-workbench-header {
    padding: 14px;
  }

  .workbench-top-row > div {
    width: 100%;
  }

  .editable-client-title,
  .editable-client-title input {
    font-size: 17px;
  }

  .editable-client-title input {
    min-width: 0;
    width: 100%;
  }

  .workbench-top-row .btn-secondary-pill,
  .workbench-top-row .btn-outline-brand {
    padding: 8px 12px;
    font-size: 12px;
  }

  .workbench-top-row .segmented-pills {
    width: 100%;
  }

  .workbench-top-row .segmented-pill {
    flex: 1;
    justify-content: center;
  }

  .category-tab-pill {
    padding: 8px 14px;
    font-size: 12px;
  }

  .quote-cards-grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .quote-plan-card {
    padding: 18px 16px;
  }

  .modern-table th,
  .modern-table td {
    padding: 10px 12px;
  }

  /* Dock flutuante compacto acima da navegação inferior */
  .floating-action-dock {
    left: 8px;
    right: 8px;
    bottom: 70px;
    transform: none;
    padding: 6px 8px;
    gap: 4px;
    border-radius: 18px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .floating-action-dock::-webkit-scrollbar {
    display: none;
  }

  .floating-action-dock > span,
  .dock-divider {
    display: none;
  }

  .dock-counter {
    width: 30px;
    height: 30px;
    font-size: 12px;
    flex-shrink: 0;
  }

  .dock-btn {
    flex: 1 1 0;
    min-width: 0;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    padding: 6px 2px;
    font-size: 9.5px;
    border-radius: 12px;
    line-height: 1.1;
    text-align: center;
  }

  .dock-btn i {
    font-size: 15px;
  }

  .dock-btn.primary {
    flex-grow: 1.4;
  }

  /* Modais em formato de folha inferior */
  .modal-backdrop {
    padding: 0;
    align-items: flex-end;
  }

  .modal-window,
  .modal-window.modal-lg,
  .modal-window.modal-sm {
    max-width: 100%;
    max-height: 92dvh;
    border-radius: 22px 22px 0 0;
  }

  .modal-header {
    padding: 16px 16px 12px;
  }

  .modal-header h3 {
    font-size: 17px;
  }

  .modal-body {
    padding: 16px;
  }

  .modal-footer {
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    flex-wrap: wrap;
  }

  .modal-footer > div {
    flex-wrap: wrap;
  }

  .modal-footer .btn-primary-pill,
  .modal-footer .btn-secondary-pill,
  .modal-footer .btn-outline-brand {
    flex: 1 1 auto;
    justify-content: center;
  }

  .toast-container {
    top: 12px;
    left: 12px;
    right: 12px;
  }

  .login-panel-wrapper {
    padding: 28px 18px;
  }
}

/* ==========================================================================
   ASSISTENTE DE IA FLUTUANTE
   ========================================================================== */
#appShell.hidden ~ .ai-assistant-root {
  display: none;
}

.ai-fab {
  position: fixed;
  right: 24px;
  bottom: 22px;
  z-index: 1300;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 52px;
  padding: 0 20px 0 16px;
  border: none;
  border-radius: var(--radius-pill);
  background: var(--brand-gradient);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 14px 30px rgba(79, 70, 229, 0.38);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), bottom var(--transition-smooth);
}

.ai-fab i {
  font-size: 18px;
}

.ai-fab:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 36px rgba(79, 70, 229, 0.45);
}

.ai-fab.active {
  transform: scale(0.94);
}

body:has(#floatingDock:not(.hidden)) .ai-fab {
  bottom: 92px;
}

.ai-panel {
  position: fixed;
  right: 24px;
  bottom: 88px;
  z-index: 1400;
  width: min(420px, calc(100vw - 32px));
  height: min(640px, calc(100dvh - 120px));
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-float);
  overflow: hidden;
  animation: aiPanelIn 0.22s ease-out;
}

.ai-panel.hidden {
  display: none;
}

body:has(#floatingDock:not(.hidden)) .ai-panel {
  bottom: 158px;
  height: min(600px, calc(100dvh - 190px));
}

@keyframes aiPanelIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.ai-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 14px 14px 16px;
  background: var(--brand-gradient);
  color: #fff;
}

.ai-panel-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.ai-panel-title strong {
  display: block;
  font-size: 15px;
}

.ai-panel-title small {
  display: block;
  font-size: 12px;
  opacity: 0.85;
}

.ai-avatar {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.ai-avatar.sm {
  width: 28px;
  height: 28px;
  font-size: 12px;
  background: var(--brand-gradient);
}

.ai-panel-actions {
  display: flex;
  gap: 4px;
}

.ai-icon-btn {
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  cursor: pointer;
}

.ai-icon-btn:hover {
  background: rgba(255, 255, 255, 0.26);
}

.ai-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--bg-canvas);
}

.ai-msg {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.ai-msg.user {
  justify-content: flex-end;
}

.ai-bubble {
  max-width: 86%;
  padding: 10px 13px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.5;
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-bottom-left-radius: 6px;
  overflow-wrap: anywhere;
}

.ai-msg.user .ai-bubble {
  background: var(--brand-primary);
  color: #fff;
  border-color: transparent;
  border-bottom-left-radius: 16px;
  border-bottom-right-radius: 6px;
}

.ai-msg.error .ai-bubble {
  background: var(--danger-soft);
  border-color: var(--danger);
  color: var(--danger-text);
}

.ai-bubble p {
  margin: 0 0 6px;
}

.ai-bubble p:last-child {
  margin-bottom: 0;
}

.ai-bubble ul {
  margin: 4px 0 8px;
  padding-left: 18px;
}

.ai-bubble li {
  margin: 2px 0;
}

.ai-typing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.ai-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand-primary);
  animation: aiDot 1.2s infinite ease-in-out;
}

.ai-typing span:nth-child(2) {
  animation-delay: 0.15s;
}

.ai-typing span:nth-child(3) {
  animation-delay: 0.3s;
}

.ai-typing em {
  margin-left: 8px;
  font-style: normal;
  font-size: 12.5px;
  color: var(--text-muted);
}

@keyframes aiDot {
  0%, 80%, 100% {
    opacity: 0.3;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

.ai-welcome {
  margin: auto 0;
  text-align: center;
  padding: 8px 6px;
}

.ai-welcome-icon {
  width: 54px;
  height: 54px;
  margin: 0 auto 12px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: #fff;
  background: var(--brand-gradient);
  box-shadow: 0 12px 26px rgba(79, 70, 229, 0.3);
}

.ai-welcome h4 {
  margin: 0 0 6px;
  font-size: 16px;
}

.ai-welcome p {
  margin: 0 0 14px;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

.ai-suggestions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ai-suggestion {
  text-align: left;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 12.5px;
  cursor: pointer;
  transition: border-color var(--transition-fast), color var(--transition-fast);
}

.ai-suggestion:hover {
  border-color: var(--brand-primary);
  color: var(--brand-primary);
}

.ai-summary {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-muted);
  border: 1px solid var(--border-subtle);
}

.ai-summary-title {
  font-weight: 700;
  font-size: 12.5px;
  color: var(--brand-primary);
  margin-bottom: 6px;
}

.ai-summary-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0;
  font-size: 12.5px;
  border-top: 1px dashed var(--border-subtle);
}

.ai-summary-row span {
  color: var(--text-muted);
  flex-shrink: 0;
}

.ai-summary-row strong {
  text-align: right;
  font-weight: 600;
}

.ai-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.ai-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

.ai-action:hover {
  border-color: var(--brand-primary);
  color: var(--brand-primary);
}

.ai-action.primary {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
  color: #fff;
}

.ai-action.primary:hover {
  background: var(--brand-primary-hover);
  color: #fff;
}

.ai-composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}

.ai-composer textarea {
  flex: 1;
  resize: none;
  max-height: 140px;
  padding: 10px 14px;
  border-radius: 18px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-input);
  color: var(--text-primary);
  font: inherit;
  font-size: 13.5px;
  line-height: 1.4;
  outline: none;
}

.ai-composer textarea:focus {
  border-color: var(--brand-primary);
}

.ai-send-btn {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  border: none;
  border-radius: 50%;
  background: var(--brand-primary);
  color: #fff;
  cursor: pointer;
}

.ai-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

@media (max-width: 860px) {
  .ai-fab {
    right: 14px;
    bottom: 76px;
    width: 52px;
    padding: 0;
    justify-content: center;
  }

  .ai-fab-label {
    display: none;
  }

  body:has(#floatingDock:not(.hidden)) .ai-fab {
    bottom: 140px;
  }

  body.ai-open .ai-fab {
    display: none;
  }

  .ai-panel,
  body:has(#floatingDock:not(.hidden)) .ai-panel {
    inset: 0;
    width: 100%;
    height: 100dvh;
    border-radius: 0;
    border: none;
  }

  .ai-panel-header {
    padding-top: calc(14px + env(safe-area-inset-top));
  }

  .ai-bubble {
    max-width: 90%;
  }
}
