/* ==========================================================================
   Enterprise Design System — BV Garantia Brand Palette
   Gestão da Inadimplência — uma solução BV Garantia
   ========================================================================== */

:root {
  /* Brand: Emerald Depths (Primary) + Tan/Bronze (Secondary) */
  --bg: #f7f9f8;
  --surface: #ffffff;
  --surface-2: #f1f5f3;
  --surface-3: #e2e8e5;
  --line: #d5ddd9;
  --line-strong: #b0bdb5;
  --ink: #0c1f17;
  --ink-soft: #3d5a4e;
  --ink-faint: #7a9488;

  --primary: #154734;
  --primary-hover: #0f3526;
  --primary-soft: #e8f5ef;
  --primary-border: #a7d4bc;

  --secondary: #967E57;
  --secondary-hover: #7d6845;
  --secondary-soft: #f5f0e8;
  --secondary-border: #cdbfa3;

  --success: #154734;
  --success-hover: #0f3526;
  --success-soft: #e8f5ef;
  --success-border: #a7d4bc;

  --warning: #967E57;
  --warning-hover: #7d6845;
  --warning-soft: #f5f0e8;
  --warning-border: #cdbfa3;

  --danger: #b91c1c;
  --danger-hover: #991b1b;
  --danger-soft: #fef2f2;
  --danger-border: #fecaca;

  --purple: #6d5a9a;
  --purple-soft: #f3f0f9;
  --purple-border: #d1c7e6;

  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.08), 0 1px 2px -1px rgba(0, 0, 0, 0.06);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.06), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.06), 0 4px 6px -4px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.06), 0 8px 10px -6px rgba(0, 0, 0, 0.03);

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  --sidebar-width: 260px;
  --sidebar-collapsed-width: 72px;

  /* Scrollbar Tokens (Light) */
  --scrollbar-track: transparent;
  --scrollbar-thumb: #b0bdb5;
  --scrollbar-thumb-hover: #7a9488;
}

[data-theme="dark"] {
  --bg: #0a0a0a;
  --surface: #141414;
  --surface-2: #1e1e1e;
  --surface-3: #2a2a2a;
  --line: #2e2e2e;
  --line-strong: #454545;
  --ink: #e8f0ec;
  --ink-soft: #94b0a3;
  --ink-faint: #5e8070;

  --primary: #2d9e6a;
  --primary-hover: #3dbf82;
  --primary-soft: rgba(45, 158, 106, 0.15);
  --primary-border: #1a5c42;

  --secondary: #c4a96e;
  --secondary-hover: #d4bc88;
  --secondary-soft: rgba(196, 169, 110, 0.15);
  --secondary-border: #6b5a38;

  --success: #2d9e6a;
  --success-hover: #3dbf82;
  --success-soft: rgba(45, 158, 106, 0.15);
  --success-border: #1a5c42;

  --warning: #c4a96e;
  --warning-hover: #d4bc88;
  --warning-soft: rgba(196, 169, 110, 0.15);
  --warning-border: #6b5a38;

  --danger: #f87171;
  --danger-hover: #fca5a5;
  --danger-soft: rgba(248, 113, 113, 0.15);
  --danger-border: #7f1d1d;

  --purple: #a78bfa;
  --purple-soft: rgba(167, 139, 250, 0.15);
  --purple-border: #4c1d95;

  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.4);
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 10px 25px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 20px 35px rgba(0, 0, 0, 0.6);

  /* Scrollbar Tokens (Dark) */
  --scrollbar-track: transparent;
  --scrollbar-thumb: #334155;
  --scrollbar-thumb-hover: #475569;
}

/* ==========================================================================
   Minimalist Theme-Aware Custom Scrollbars (Vertical & Horizontal)
   ========================================================================== */

/* Standard CSS (Firefox / modern browsers) */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

/* WebKit / Chromium / Edge / Safari */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
}

::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: var(--radius-full);
  transition: background 0.15s ease;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
}

::-webkit-scrollbar-corner {
  background: transparent;
}

/* ==========================================================================
   Base & Reset
   ========================================================================== */

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

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* App Layout: Sidebar + Main Content */
.app-layout {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* ==========================================================================
   Side Navigation Bar (Sidenav)
   ========================================================================== */

.sidebar {
  width: var(--sidebar-width);
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  max-height: 100vh;
  z-index: 100;
  transition: width 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
  overflow: hidden;
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed-width);
}

.sidebar.collapsed .sidebar-top-section {
  padding: 0 4px 8px 4px !important;
}

.sidebar.collapsed #nav-dashboard {
  justify-content: center !important;
  padding: 10px 0 !important;
  width: 100% !important;
}

.sidebar.collapsed #nav-dashboard > div {
  justify-content: center !important;
  gap: 0 !important;
}

.sidebar.collapsed #nav-dashboard .sidebar-group-icon {
  margin: 0 auto !important;
}

.sidebar.collapsed .sidebar-brand-text,
.sidebar.collapsed .sidebar-item-label,
.sidebar.collapsed .sidebar-item-badge,
.sidebar.collapsed .sidebar-group-label,
.sidebar.collapsed .sidebar-group-chevron,
.sidebar.collapsed .sidebar-footer {
  display: none !important;
}

.sidebar.collapsed .sidebar-header {
  flex-direction: column;
  gap: 10px;
  align-items: center;
  justify-content: center;
  padding: 14px 6px;
}

.sidebar.collapsed .sidebar-nav {
  overflow: visible !important;
  padding: 12px 6px;
}

.sidebar.collapsed .sidebar-group {
  position: relative;
  margin-bottom: 6px;
}

.sidebar.collapsed .sidebar-group-header {
  justify-content: center;
  padding: 10px 0;
  border-radius: var(--radius-sm);
}

.sidebar.collapsed .sidebar-group-title {
  justify-content: center;
  width: 100%;
}

.sidebar.collapsed .sidebar-group-icon {
  width: 24px;
  height: 24px;
  margin: 0 auto;
}

.sidebar.collapsed .sidebar-group-svg {
  width: 20px;
  height: 20px;
}

/* ==========================================================================
   Modal Flutuante de Subopções (Sidebar Recolhida / Portal Flutuante)
   ========================================================================== */

.sidebar-floating-flyout {
  position: fixed;
  z-index: 9999;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.45);
  padding: 10px 12px;
  min-width: 250px;
  max-width: 320px;
  display: none;
  flex-direction: column;
  gap: 4px;
  backdrop-filter: blur(12px);
  animation: flyoutFadeIn 0.16s cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar-floating-flyout.active {
  display: flex !important;
}

@keyframes flyoutFadeIn {
  from {
    opacity: 0;
    transform: translateX(-10px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

.sidebar-floating-flyout::before {
  content: "";
  position: absolute;
  left: -6px;
  top: 16px;
  width: 10px;
  height: 10px;
  background: var(--surface);
  border-left: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
  transform: rotate(45deg);
  pointer-events: none;
}

.sidebar-flyout-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 6px;
  gap: 8px;
}

.sidebar-flyout-title-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.sidebar-flyout-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  color: var(--primary);
  flex-shrink: 0;
}

.sidebar-flyout-icon svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
}

.sidebar-flyout-title {
  font-weight: 700;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-flyout-close {
  background: transparent;
  border: none;
  color: var(--ink-faint);
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 4px;
  transition: all 0.15s ease;
}

.sidebar-flyout-close:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.sidebar-flyout-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-height: 380px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

.sidebar-flyout-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-xs);
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.15s ease;
  cursor: pointer;
}

.sidebar-flyout-item:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.sidebar-flyout-item.active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
}

.sidebar-flyout-item .subitem-bullet {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--ink-faint);
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.sidebar-flyout-item:hover .subitem-bullet {
  background: var(--ink);
}

.sidebar-flyout-item.active .subitem-bullet {
  background: var(--primary);
  box-shadow: 0 0 6px var(--primary);
  transform: scale(1.25);
}

.sidebar.collapsed .sidebar-subnav {
  display: none !important;
}

.sidebar-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-shrink: 0;
  min-height: 64px;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  min-width: 0;
  flex: 1;
}

.sidebar-brand-icon {
  width: 36px;
  height: 36px;
  background: var(--primary-soft);
  border: 1px solid var(--primary-border);
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: var(--shadow-xs);
  transition: all 0.15s ease;
}

.sidebar-brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  transition: opacity 0.15s ease;
}

.sidebar-brand-title {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink);
  line-height: 1.25;
  white-space: normal;
  word-break: normal;
  overflow-wrap: break-word;
}

.sidebar-brand-sub {
  font-size: 10.5px;
  color: var(--ink-soft);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  line-height: 1.25;
  white-space: normal;
  word-break: normal;
  overflow-wrap: break-word;
  margin-top: 2px;
}

.sidebar-toggle-btn {
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  width: 26px;
  height: 26px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 11px;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.sidebar-toggle-btn:hover {
  color: var(--ink);
  background: var(--surface-3);
  border-color: var(--line-strong);
}

/* Sidebar Navigation Items */
.sidebar-nav {
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto !important;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

.sidebar-nav::-webkit-scrollbar {
  width: 5px;
}

.sidebar-nav::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 4px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  text-decoration: none;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid transparent;
  white-space: nowrap;
  position: relative;
}

.sidebar-item:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.sidebar-item.active {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: var(--primary-border);
  font-weight: 700;
}

.sidebar-item-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-item-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity 0.15s ease;
}

.sidebar.collapsed .sidebar-item-label {
  display: none;
}

.sidebar-item-badge {
  font-size: 10px;
  font-family: var(--mono);
  padding: 2px 6px;
  border-radius: 4px;
}

.sidebar.collapsed .sidebar-item-badge {
  display: none;
}

/* Sidebar Disabled Items (ISSUE-49) */
.sidebar-item.disabled,
.sidebar-subitem.disabled,
.sidebar-group.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.sidebar-item.disabled:hover,
.sidebar-subitem.disabled:hover,
.sidebar-group.disabled:hover {
  background: transparent;
  border-color: transparent;
}

.sidebar-item.disabled .sidebar-item-label,
.sidebar-subitem.disabled .sidebar-subitem-label {
  color: var(--ink-faint);
}

.sidebar-item.disabled .sidebar-item-icon,
.sidebar-subitem.disabled .sidebar-subitem-icon {
  color: var(--ink-faint);
}

/* Tooltip for disabled items */
.sidebar-item.disabled[title],
.sidebar-subitem.disabled[title] {
  position: relative;
}

.sidebar-item.disabled[title]:hover::after,
.sidebar-subitem.disabled[title]:hover::after {
  content: attr(title);
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  margin-left: 8px;
  padding: 6px 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 11px;
  color: var(--ink-soft);
  white-space: nowrap;
  z-index: 1000;
  box-shadow: var(--shadow);
  pointer-events: none;
}

.sidebar.collapsed .sidebar-item.disabled[title]:hover::after,
.sidebar.collapsed .sidebar-subitem.disabled[title]:hover::after {
  left: auto;
  right: 100%;
  margin-left: 0;
  margin-right: 8px;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.sidebar.collapsed .sidebar-footer {
  display: none;
}

/* Filter Pills for Lists & Tabs */
.filter-pill-group {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.filter-pill {
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.filter-pill:hover {
  color: var(--ink);
  background: var(--surface-3);
  border-color: var(--line-strong);
}

.filter-pill.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}

.filter-pill.active.pill-pending {
  background: #d97706;
  border-color: #d97706;
  box-shadow: 0 2px 6px rgba(217, 119, 6, 0.25);
}

.filter-pill.active.pill-approved {
  background: #16a34a;
  border-color: #16a34a;
  box-shadow: 0 2px 6px rgba(22, 163, 74, 0.25);
}

/* ==========================================================================
   Top Navigation Bar (Topbar)
   ========================================================================== */

.app-main-wrapper {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  height: 60px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 90;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

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

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-soft);
  font-weight: 500;
}

.breadcrumb-active {
  color: var(--ink);
  font-weight: 700;
}

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

/* Live KPI Pills */
.kpi-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  background: var(--surface-2);
  padding: 5px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  font-weight: 600;
}

.kpi-pill strong {
  color: var(--ink);
  font-family: var(--mono);
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  display: inline-block;
  box-shadow: 0 0 0 2px var(--success-soft);
  animation: pulseDot 2s infinite;
}

@keyframes pulseDot {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* ==========================================================================
   Main Content & Views
   ========================================================================== */

main {
  flex: 1;
  max-width: 1840px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 32px;
}

.tab-pane { display: none; }
.tab-pane.active {
  display: block;
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
  transition: border-color 0.15s ease;
}

.card:hover {
  border-color: var(--line-strong);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.card-title {
  font-size: 17px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.card-desc {
  color: var(--ink-soft);
  font-size: 13px;
  margin-top: 4px;
}

/* KPI Summary Stat Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-xs);
  transition: all 0.2s ease;
}

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

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.stat-icon.blue { background: var(--primary-soft); color: var(--primary); }
.stat-icon.green { background: var(--success-soft); color: var(--success); }
.stat-icon.yellow { background: var(--warning-soft); color: var(--warning); }
.stat-icon.red { background: var(--danger-soft); color: var(--danger); }
.stat-icon.purple { background: var(--purple-soft); color: var(--purple); }

.stat-info { display: flex; flex-direction: column; }
.stat-label { font-size: 12px; font-weight: 600; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.02em; }
.stat-value { font-size: 22px; font-weight: 800; color: var(--ink); font-family: var(--mono); margin-top: 2px; }
.stat-badge { font-size: 11px; margin-top: 4px; }

/* ==========================================================================
   Buttons & Badges (Shadcn Standard)
   ========================================================================== */

.btn {
  background: var(--primary);
  color: #fff;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-xs);
}

.btn:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn:active { transform: translateY(0); }

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

.btn-outline:hover {
  background: var(--surface-2);
  border-color: var(--ink-soft);
  color: var(--ink);
}

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: var(--success-hover); }

.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { background: var(--warning-hover); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-hover); }

.btn-purple { background: var(--purple); color: #fff; }
.btn-purple:hover { filter: brightness(0.9); }

.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 6px; }
.btn-lg { padding: 12px 24px; font-size: 15px; border-radius: 10px; font-weight: 700; }

/* Badges (Pills) */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-family: var(--mono);
  border: 1px solid transparent;
  line-height: 1.4;
}

.badge-primary { background: var(--primary-soft); color: var(--primary); border-color: var(--primary-border); }
.badge-success { background: var(--success-soft); color: var(--success); border-color: var(--success-border); }
.badge-warning { background: var(--warning-soft); color: var(--warning); border-color: var(--warning-border); }
.badge-danger { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-border); }
.badge-purple { background: var(--purple-soft); color: var(--purple); border-color: var(--purple-border); }
.badge-neutral { background: var(--surface-2); color: var(--ink-soft); border-color: var(--line); }

/* Inputs & Form Elements */
.input {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-family: inherit;
  font-size: 13px;
  color: var(--ink);
  outline: none;
  transition: all 0.15s ease;
  box-shadow: var(--shadow-xs);
}

.input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

/* ==========================================================================
   Data Tables (Shadcn Style)
   ========================================================================== */

.table-wrap {
  width: 100%;
  overflow-x: auto;
  overflow-y: auto;
  max-height: 760px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  position: relative;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

.table-wrap table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  text-align: left;
  font-size: 13px;
}

.table-wrap th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--surface-2);
  color: var(--ink-soft);
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 12px 16px;
  border-bottom: 2px solid var(--line);
  box-shadow: 0 1px 0 var(--line);
}

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

.table-wrap tr:last-child td { border-bottom: none; }
.table-wrap tr:hover td { background: var(--surface-2); }

/* Container com scroll para lista lateral de devedores */
.debtor-list,
.scrollable-list-wrap {
  max-height: 760px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
  padding-right: 4px;
}

.table-wrap::-webkit-scrollbar,
.debtor-list::-webkit-scrollbar,
.scrollable-list-wrap::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.table-wrap::-webkit-scrollbar-track,
.debtor-list::-webkit-scrollbar-track,
.scrollable-list-wrap::-webkit-scrollbar-track {
  background: var(--surface-2);
  border-radius: 4px;
}

.table-wrap::-webkit-scrollbar-thumb,
.debtor-list::-webkit-scrollbar-thumb,
.scrollable-list-wrap::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 4px;
}

.table-wrap::-webkit-scrollbar-thumb:hover,
.debtor-list::-webkit-scrollbar-thumb:hover,
.scrollable-list-wrap::-webkit-scrollbar-thumb:hover {
  background: var(--ink-faint);
}

/* ==========================================================================
   Decision Matrix & Benchmarking Multi-Views (Segmented Tabs & Panes)
   ========================================================================== */

.bench-view-tabs {
  display: flex;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  padding: 0 16px;
  gap: 6px;
  overflow-x: auto;
}

.bench-view-tab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 11px 14px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.bench-view-tab:hover {
  color: var(--ink);
  background: rgba(0, 0, 0, 0.02);
}

.bench-view-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 700;
}

/* Modo 2: Módulos / Especialidades Grid */
.modules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
}

.module-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow-xs);
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

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

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

.module-title {
  font-size: 14.5px;
  font-weight: 800;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 6px;
}

.module-champions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
}

.module-champion-item {
  display: flex;
  flex-direction: column;
}

.module-champion-label {
  font-size: 10.5px;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--ink-soft);
}

.module-champion-value {
  font-size: 13.5px;
  font-weight: 800;
  font-family: var(--mono);
  margin-top: 2px;
}

.module-providers-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.module-provider-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  border-radius: 6px;
  background: var(--surface-2);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.module-provider-item:hover {
  background: var(--primary-soft);
  color: var(--primary);
}

/* Modo 3: Nível de Cascata Waterfall Grid */
.waterfall-layers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
}

.layer-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.layer-card.layer-tier-0 { border-top: 4px solid var(--purple); }
.layer-card.layer-tier-1 { border-top: 4px solid var(--primary); }
.layer-card.layer-tier-2 { border-top: 4px solid var(--warning); }

.layer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.layer-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
}

/* Modo 4: Kanban de Status */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  align-items: start;
}

.kanban-col {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 380px;
}

.kanban-col-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
}

.kanban-col-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 6px;
}

.kanban-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px;
  box-shadow: var(--shadow-xs);
  cursor: pointer;
  transition: all 0.15s ease;
}

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

/* ==========================================================================
   Dropzone (Modern Drag-and-Drop)
   ========================================================================== */

.dropzone-box {
  border: 2px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 48px 24px;
  text-align: center;
  background: var(--surface-2);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.dropzone-box:hover, .dropzone-box.dragover {
  border-color: var(--primary);
  background: var(--primary-soft);
  transform: scale(0.995);
}

/* ==========================================================================
   Dossiê 360° Layout (2 Colunas)
   ========================================================================== */

.dossier-layout {
  display: grid;
  grid-template-columns: minmax(280px, 35%) 1fr;
  gap: 24px;
  align-items: start;
}

@media (max-width: 1024px) {
  .dossier-layout { grid-template-columns: 1fr; }
}

.debtor-list {
  max-height: 760px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 4px;
}

.debtor-item {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.debtor-item:hover {
  border-color: var(--primary-border);
  background: var(--surface);
  transform: translateX(2px);
}

.debtor-item.selected {
  background: var(--surface);
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-soft);
}

/* Comparative Cards (Original vs Provedor) */
.comparative-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.contact-card-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  margin-bottom: 8px;
  transition: all 0.15s ease;
}

.contact-card-row:hover {
  border-color: var(--line-strong);
}

.contact-card-row.is-new {
  border-left: 3px solid var(--success);
  background: var(--surface);
}

/* ==========================================================================
   Providers Hub & Drawer 360°
   ========================================================================== */

.providers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}

.provider-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.2s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

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

.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 680px; max-width: 100vw;
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
}

.drawer.open { transform: translateX(0); }

.drawer-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 190;
  display: none;
}

.drawer-overlay.open { display: block; }

.drawer-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Drawer Navigation Tabs */
.drawer-tabs {
  display: flex;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  padding: 0 16px;
  gap: 4px;
  overflow-x: auto;
}

.drawer-tab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 10px 14px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.drawer-tab:hover {
  color: var(--ink);
  background: rgba(0, 0, 0, 0.03);
}

.drawer-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 700;
  background: transparent;
}

.drawer-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

/* ==========================================================================
   Toast Notifications
   ========================================================================== */

#toast {
  position: fixed;
  bottom: 24px; right: 24px;
  background: var(--ink);
  color: var(--surface);
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  display: none;
  z-index: 1000;
  animation: slideUp 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid var(--line-strong);
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   Waterfall Simulator & Funnel Visuals
   ========================================================================== */

.waterfall-funnel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 20px 0;
}

.funnel-tier-bar {
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  font-size: 13px;
  transition: all 0.2s ease;
}

.funnel-tier-0 { background: var(--success-soft); border: 1px solid var(--success-border); color: var(--success); }
.funnel-tier-1 { background: var(--primary-soft); border: 1px solid var(--primary-border); color: var(--primary); }
.funnel-tier-2 { background: var(--purple-soft); border: 1px solid var(--purple-border); color: var(--purple); }

/* ==========================================================================
   JSON Syntax Highlighting & Log Inspector Modal
   ========================================================================== */

.json-key { color: var(--primary); font-weight: 700; }
.json-string { color: var(--success); }
.json-number { color: var(--warning); font-weight: 600; }
.json-boolean { color: var(--purple); font-weight: 700; }
.json-null { color: var(--danger); font-style: italic; }

#json-inspector-modal.open {
  display: flex !important;
}

#json-inspector-overlay.open {
  display: block !important;
}

#heatmap-cell-modal.open {
  display: flex !important;
}

#heatmap-cell-overlay.open {
  display: block !important;
  z-index: 1099 !important;
}

#reconsultar-modal.open {
  display: flex !important;
}

#reconsultar-overlay.open {
  display: block !important;
  z-index: 1109 !important;
}

#btn-reconsultar-precificados:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ==========================================================================
   Docs Portal 360° — Unified 3-Column Documentation Experience
   ========================================================================== */

.docs-top-banner {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 24px;
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  box-shadow: var(--shadow-xs);
  position: relative;
  overflow: hidden;
}

.docs-top-banner::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, #154734, #967E57, #2d9e6a);
}

.docs-brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: linear-gradient(135deg, rgba(37,99,235,0.12), rgba(139,92,246,0.15));
  border: 1px solid rgba(37,99,235,0.25);
  color: var(--primary);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  letter-spacing: 0.5px;
}

.docs-top-banner-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  align-items: center;
}

/* 3-Column Grid Layout */
.docs-portal-container {
  display: grid;
  grid-template-columns: 290px minmax(380px, 1fr) 440px;
  gap: 16px;
  align-items: start;
  min-height: calc(100vh - 230px);
}

/* Coluna 1: Navigation Tree */
.docs-nav-tree {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow-xs);
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 160px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.docs-search-box {
  position: relative;
  margin-bottom: 12px;
  flex-shrink: 0;
}

.docs-search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  opacity: 0.6;
  pointer-events: none;
}

.docs-search-box input {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 7px 28px 7px 30px;
  font-size: 12px;
  color: var(--ink);
  outline: none;
  transition: all 0.15s ease;
}

.docs-search-box input:focus {
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 2px var(--primary-soft);
}

.docs-search-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--ink-faint);
  font-size: 12px;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
}

.docs-search-clear:hover {
  color: var(--ink);
}

.docs-tree-scroll {
  overflow-y: auto;
  flex: 1;
  padding-right: 4px;
}

.docs-tree-group {
  margin-bottom: 14px;
}

.docs-tree-group-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  font-weight: 800;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 6px 4px 6px 6px;
  cursor: pointer;
  user-select: none;
  border-radius: var(--radius-xs);
  transition: color 0.15s ease;
}

.docs-tree-group-header:hover {
  color: var(--ink);
}

.docs-group-toggle {
  font-size: 9px;
  transition: transform 0.2s ease;
  opacity: 0.7;
}

.docs-tree-group.collapsed .docs-group-toggle {
  transform: rotate(-90deg);
}

.docs-tree-group.collapsed .docs-tree-group-items {
  display: none;
}

.docs-tree-group-items {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 4px;
}

.docs-nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12px;
  color: var(--ink);
  transition: all 0.15s ease;
  position: relative;
  text-decoration: none;
  user-select: none;
}

.docs-nav-item:hover {
  background: var(--surface-2);
}

.docs-nav-item.active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}

.docs-nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 3px;
  background: var(--primary);
  border-radius: 0 2px 2px 0;
}

.nav-item-icon {
  font-size: 13px;
  flex-shrink: 0;
}

.nav-item-text {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex: 1;
}

.nav-item-title {
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-item-sub {
  font-size: 10px;
  color: var(--ink-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.docs-nav-item.active .nav-item-sub {
  color: var(--primary);
  opacity: 0.8;
}

/* HTTP Method Badges */
.http-badge {
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 800;
  padding: 2px 5px;
  border-radius: 4px;
  flex-shrink: 0;
  letter-spacing: 0.2px;
}

.http-badge.get { background: rgba(16,185,129,0.15); color: #059669; border: 1px solid rgba(16,185,129,0.3); }
.http-badge.post { background: rgba(21,71,52,0.15); color: var(--primary); border: 1px solid rgba(21,71,52,0.3); }
.http-badge.put { background: rgba(245,158,11,0.15); color: #d97706; border: 1px solid rgba(245,158,11,0.3); }
.http-badge.delete { background: rgba(239,68,68,0.15); color: #dc2626; border: 1px solid rgba(239,68,68,0.3); }

[data-theme="dark"] .http-badge.get { color: #34d399; }
[data-theme="dark"] .http-badge.post { color: var(--primary); }
[data-theme="dark"] .http-badge.put { color: #fbbf24; }
[data-theme="dark"] .http-badge.delete { color: #f87171; }

.badge-xs {
  font-size: 9.5px !important;
  padding: 1px 5px !important;
}

/* Coluna 2: Middle Main Content */
.docs-main-content {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px 32px;
  box-shadow: var(--shadow-xs);
  max-height: calc(100vh - 160px);
  overflow-y: auto;
  min-width: 0;
}

.docs-header-area {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.docs-header-category {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 6px;
  letter-spacing: 0.4px;
}

.docs-header-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 6px;
  line-height: 1.3;
}

.docs-header-desc {
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.6;
}

.docs-endpoint-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  margin: 14px 0;
  font-family: var(--mono);
  font-size: 13px;
}

.docs-endpoint-path {
  font-weight: 700;
  color: var(--ink);
  flex: 1;
  word-break: break-all;
}

.docs-endpoint-auth {
  font-family: var(--font);
  font-size: 11px;
}

/* Markdown & Content Components */
.docs-prose h1 {
  font-size: 20px;
  font-weight: 800;
  color: var(--ink);
  margin: 30px 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.docs-prose h2 {
  font-size: 17px;
  font-weight: 800;
  color: var(--ink);
  margin: 28px 0 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}

.docs-prose h3 {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--ink);
  margin: 24px 0 10px;
}

.docs-prose p {
  font-size: 13px;
  line-height: 1.65;
  color: var(--ink-soft);
  margin: 10px 0;
}

.docs-prose ul, .docs-prose ol {
  font-size: 13px;
  line-height: 1.65;
  color: var(--ink-soft);
  margin: 10px 0 14px 20px;
}

.docs-prose li {
  margin-bottom: 5px;
}

.docs-prose hr {
  border: none;
  border-top: 1px solid var(--line);
  margin: 30px 0;
}

.docs-prose blockquote {
  border-left: 3px solid var(--primary);
  background: var(--primary-soft);
  padding: 8px 14px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 14px 0;
  color: var(--ink-soft);
  font-size: 12.5px;
}

.docs-prose code {
  font-family: var(--mono);
  font-size: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--primary);
}

.docs-prose pre {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  overflow: auto;
  margin: 16px 0;
}



/* Drawer markdown-content rendering */
.markdown-content h1 {
  font-size: 22px;
  font-weight: 800;
  color: var(--ink);
  margin: 30px 0 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.markdown-content h2 {
  font-size: 17px;
  font-weight: 800;
  color: var(--ink);
  margin: 28px 0 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}

.markdown-content h3 {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--ink);
  margin: 24px 0 10px;
}

.markdown-content p {
  font-size: 13px;
  line-height: 1.65;
  color: var(--ink-soft);
  margin: 10px 0;
}

.markdown-content ul, .markdown-content ol {
  font-size: 13px;
  line-height: 1.65;
  color: var(--ink-soft);
  margin: 10px 0 14px 20px;
}

.markdown-content li {
  margin-bottom: 5px;
}

.markdown-content hr {
  border: none;
  border-top: 1px solid var(--line);
  margin: 30px 0;
}

.markdown-content blockquote {
  border-left: 3px solid var(--primary);
  background: var(--primary-soft);
  padding: 8px 14px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 14px 0;
  color: var(--ink-soft);
  font-size: 12.5px;
}

.markdown-content code {
  font-family: var(--mono);
  font-size: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--primary);
}

.markdown-content pre {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  overflow: auto;
  margin: 16px 0;
}

.markdown-content pre code {
  background: none;
  padding: 0;
  font-size: 12px;
  color: inherit;
  border: none;
}

.markdown-content table {
  border-collapse: collapse;
  margin: 16px 0;
  width: 100%;
  font-size: 12.5px;
}

.markdown-content th, .markdown-content td {
  border: 1px solid var(--line-strong);
  padding: 7px 10px;
  text-align: left;
  vertical-align: top;
}

.markdown-content th {
  background: var(--surface-2);
}

/* Parameter & Schema Tables */
.docs-param-table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0 20px;
  font-size: 12.5px;
}

.docs-param-table th {
  background: var(--surface-2);
  border-bottom: 2px solid var(--line-strong);
  padding: 8px 12px;
  text-align: left;
  font-weight: 700;
  color: var(--ink);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.docs-param-table td {
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  vertical-align: top;
}

.param-name {
  font-family: var(--mono);
  font-weight: 700;
  color: var(--primary);
}

.param-type {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-faint);
  display: block;
  margin-top: 2px;
}

.param-req {
  display: inline-block;
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid var(--danger-border);
  padding: 1px 4px;
  border-radius: 3px;
  margin-left: 4px;
}

.param-opt {
  display: inline-block;
  font-size: 9.5px;
  color: var(--ink-faint);
  background: var(--surface-2);
  padding: 1px 4px;
  border-radius: 3px;
  margin-left: 4px;
}

/* Callout Boxes */
.callout-box {
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  margin: 14px 0;
  font-size: 12.5px;
  line-height: 1.5;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.callout-box .callout-icon {
  font-size: 18px;
  flex-shrink: 0;
  margin-top: 1px;
}

.callout-box.info {
  background: var(--primary-soft);
  border: 1px solid var(--primary-border);
  color: var(--ink);
}

.callout-box.success {
  background: var(--success-soft);
  border: 1px solid var(--success-border);
  color: var(--ink);
}

.callout-box.warning {
  background: var(--warning-soft);
  border: 1px solid var(--warning-border);
  color: var(--ink);
}

.callout-box.purple {
  background: var(--purple-soft);
  border: 1px solid var(--purple-border);
  color: var(--ink);
}

/* Bureau Docs Multi-file Switcher */
.docs-provider-files-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 8px 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
}

.docs-file-tab {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 11.5px;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.docs-file-tab:hover {
  background: var(--surface-3);
  color: var(--ink);
}

.docs-file-tab.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  font-weight: 600;
}

/* Coluna 3: Code Console (ReDoc / Dark Sandbox) */
.docs-code-console {
  background: #090d16;
  border: 1px solid #1e293b;
  border-radius: var(--radius);
  box-shadow: 0 10px 25px -5px rgba(0,0,0,0.3);
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 160px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: #f8fafc;
}

.code-console-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: #0f172a;
  border-bottom: 1px solid #1e293b;
  flex-shrink: 0;
}

.code-console-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.code-console-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 6px rgba(16,185,129,0.6);
}

.code-console-title {
  font-size: 11.5px;
  font-weight: 700;
  color: #e2e8f0;
  font-family: var(--mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-copy-code {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  color: #f1f5f9;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 5px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}

.btn-copy-code:hover {
  background: rgba(255,255,255,0.18);
  border-color: rgba(255,255,255,0.3);
}

.btn-copy-code.copied {
  background: #059669;
  border-color: #10b981;
  color: #ffffff;
}

.code-console-tabs {
  display: flex;
  background: #090d16;
  border-bottom: 1px solid #1e293b;
  padding: 4px 8px;
  gap: 4px;
  overflow-x: auto;
  flex-shrink: 0;
}

.code-tab {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 600;
  padding: 5px 9px;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.code-tab:hover {
  color: #f8fafc;
  background: rgba(255,255,255,0.05);
}

.code-tab.active {
  color: var(--primary);
  background: var(--primary-soft);
  font-weight: 700;
}

.code-console-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
  background: #090d16;
}

.code-console-pre {
  margin: 0;
  padding: 0;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  color: #e2e8f0;
}

.code-console-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 14px;
  background: #0f172a;
  border-top: 1px solid #1e293b;
  font-size: 10.5px;
  font-family: var(--mono);
  color: #94a3b8;
  flex-shrink: 0;
}

.code-lang-tag {
  color: var(--primary);
}

.code-auth-tag {
  color: #cbd5e1;
}

/* Responsive adjustments */
@media (max-width: 1280px) {
  .docs-portal-container {
    grid-template-columns: 260px 1fr 380px;
    gap: 12px;
  }
}

@media (max-width: 1080px) {
  .docs-portal-container {
    grid-template-columns: 240px 1fr;
  }
  .docs-code-console {
    grid-column: 1 / -1;
    position: static;
    max-height: 480px;
  }
}

@media (max-width: 768px) {
  .docs-portal-container {
    grid-template-columns: 1fr;
  }
  .docs-nav-tree {
    position: static;
    max-height: 340px;
  }
  .docs-main-content {
    max-height: none;
    padding: 18px;
  }
  .docs-top-banner {
    flex-direction: column;
    align-items: flex-start;
  }
  /* Dossiê: em telas estreitas permite quebrar a linha de ações */
  .dossier-actions {
    flex-wrap: wrap !important;
    justify-content: flex-start !important;
  }
}

/* ==========================================================================
   ISSUE-34: Hierarchical Sidebar & Accordion Groups
   ========================================================================== */

.sidebar-group {
  margin-bottom: 4px;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.sidebar-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
  background: transparent;
}

.sidebar-group-header:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.sidebar-group-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.sidebar-group-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: var(--primary);
  transition: transform 0.15s ease, color 0.15s ease;
}

.sidebar-group-header:hover .sidebar-group-icon {
  color: var(--primary-hover);
  transform: scale(1.08);
}

.sidebar-group-svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
}

/* Active parent group header styling */
.sidebar-group.active .sidebar-group-header,
.sidebar-group-header.active {
  background: var(--primary-soft) !important;
  color: var(--primary) !important;
  font-weight: 700;
}

.sidebar-group.active .sidebar-group-icon,
.sidebar-group-header.active .sidebar-group-icon {
  color: var(--primary) !important;
}

/* Active parent indicator in collapsed sidebar */
.sidebar.collapsed .sidebar-group.active .sidebar-group-header,
.sidebar.collapsed .sidebar-group-header.active {
  background: var(--primary-soft) !important;
  color: var(--primary) !important;
  border: 1px solid var(--line-strong) !important;
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.22);
  position: relative;
}

.sidebar.collapsed .sidebar-group.active .sidebar-group-header::before,
.sidebar.collapsed .sidebar-group-header.active::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 16px;
  background: var(--primary);
  border-radius: 2px;
  box-shadow: 0 0 8px var(--primary);
}

.sidebar.collapsed .sidebar-group.active .sidebar-group-icon,
.sidebar.collapsed .sidebar-group-header.active .sidebar-group-icon {
  color: var(--primary) !important;
  transform: scale(1.12);
}

.sidebar-group-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 11.5px;
  letter-spacing: 0.01em;
}

.sidebar-group-chevron {
  font-size: 9px;
  transition: transform 0.2s ease;
  color: var(--ink-faint);
  flex-shrink: 0;
}

.sidebar-group.collapsed .sidebar-group-chevron {
  transform: rotate(-90deg);
}

.sidebar-subnav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-left: 20px;
  padding-right: 4px;
  margin-top: 2px;
  overflow: hidden;
  transition: max-height 0.25s ease, opacity 0.2s ease;
  max-height: 500px;
  opacity: 1;
}

.sidebar-group.collapsed .sidebar-subnav {
  max-height: 0;
  opacity: 0;
  margin-top: 0;
  pointer-events: none;
}

.sidebar-subitem {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: var(--radius-xs);
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 11.5px;
  font-weight: 500;
  transition: all 0.15s ease;
  position: relative;
}

.sidebar-subitem:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.sidebar-subitem.active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
}

.subitem-bullet {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--ink-faint);
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.sidebar-subitem:hover .subitem-bullet {
  background: var(--ink);
}

.sidebar-subitem.active .subitem-bullet {
  background: var(--primary);
  box-shadow: 0 0 6px var(--primary);
  transform: scale(1.25);
}

.sidebar.collapsed .sidebar-group-chevron,
.sidebar.collapsed .sidebar-subnav,
.sidebar.collapsed .sidebar-group-label {
  display: none !important;
}

/* ==========================================================================
   Cascade Execution History Dropdown-Select
   ========================================================================== */

.cascade-history-dropdown {
  position: relative;
  width: 100%;
}

.cascade-history-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  box-shadow: var(--shadow-xs);
  user-select: none;
}

.cascade-history-trigger:hover {
  border-color: var(--primary);
}

.cascade-history-trigger.open {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.cascade-history-trigger .trigger-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cascade-history-trigger .trigger-arrow {
  margin-left: 8px;
  font-size: 10px;
  transition: transform 0.2s ease;
}

.cascade-history-trigger.open .trigger-arrow {
  transform: rotate(180deg);
}

.cascade-history-panel {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 220px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  z-index: 1000;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

.cascade-history-panel.open {
  display: block;
}

.cascade-history-panel::-webkit-scrollbar { width: 5px; }
.cascade-history-panel::-webkit-scrollbar-track { background: var(--scrollbar-track); }
.cascade-history-panel::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 4px; }

.cascade-history-empty {
  padding: 10px 12px;
  font-size: 12px;
  color: var(--ink-soft);
  text-align: center;
}

.cascade-history-item {
  padding: 8px 12px;
  font-size: 12px;
  color: var(--ink);
  cursor: pointer;
  border-bottom: 1px solid var(--line);
  transition: background 0.1s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.cascade-history-item:hover {
  background: var(--primary-soft);
}

.cascade-history-item.active {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
}

/* ==========================================================================
   ISSUE-34: Inverted Pyramid / Funnel Visualizer & Semantic Status Colors
   ========================================================================== */

.cascade-funnel-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 24px 16px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}

.cascade-funnel-container::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: 100%;
  background: linear-gradient(180deg, rgba(16,185,129,0.5) 0%, rgba(37,99,235,0.5) 50%, rgba(168,85,247,0.5) 100%);
  z-index: 0;
  pointer-events: none;
}

.pyramid-layer {
  position: relative;
  z-index: 1;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  box-shadow: var(--shadow-sm);
  transition: all 0.25s ease;
  margin-bottom: 20px;
}

.pyramid-layer:last-child {
  margin-bottom: 0;
}

.pyramid-layer:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--primary-border);
}

.pyramid-tier-0 {
  width: 100%;
  border-top: 3px solid #10b981;
}

.pyramid-tier-1 {
  width: 84%;
  border-top: 3px solid var(--primary);
  margin-left: auto;
  margin-right: auto;
}

.pyramid-tier-2 {
  width: 68%;
  border-top: 3px solid #a855f7;
  margin-left: auto;
  margin-right: auto;
}

.pyramid-layer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 8px;
}

.pyramid-layer-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 800;
}

.pyramid-layer-stats {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
}

.bureau-nodes-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.bureau-node-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius-xs);
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 600;
  transition: all 0.2s ease;
  cursor: default;
}

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

/* 5 Semantic Status Colors (ISSUE-34) */
.node-matched, .status-badge.matched {
  background: rgba(16, 185, 129, 0.12) !important;
  border-color: #10b981 !important;
  color: #10b981 !important;
}

.node-partial, .status-badge.partial {
  background: rgba(245, 158, 11, 0.12) !important;
  border-color: #f59e0b !important;
  color: #f59e0b !important;
}

.node-nodata, .status-badge.nodata {
  background: rgba(249, 115, 22, 0.12) !important;
  border-color: #f97316 !important;
  color: #f97316 !important;
}

.node-skipped, .status-badge.skipped {
  background: rgba(6, 182, 212, 0.12) !important;
  border-color: #06b6d4 !important;
  color: #0891b2 !important;
  font-style: italic;
}

.node-apierror, .status-badge.apierror {
  background: rgba(239, 68, 68, 0.12) !important;
  border-color: #ef4444 !important;
  color: #ef4444 !important;
}

.node-stopmatch, .status-badge.stopmatch {
  background: rgba(168, 85, 247, 0.12) !important;
  border-color: #a855f7 !important;
  color: #a855f7 !important;
  font-weight: 700;
}

.node-idle {
  background: var(--surface-2);
  border-color: var(--line);
  color: var(--ink-soft);
}

/* Pyramid dinamico - Cards clicaveis */
.bureau-node-card {
  cursor: pointer;
}

.bureau-node-card .node-name {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 2px;
}

.bureau-node-card .node-id {
  display: block;
  font-size: 9px;
  font-family: var(--mono);
  color: var(--ink-soft);
}

.bureau-node-card .node-cost {
  display: block;
  font-size: 10px;
  font-weight: 600;
  color: var(--primary);
  margin-top: 2px;
}

.node-configured {
  background: rgba(59, 130, 246, 0.08) !important;
  border-color: rgba(59, 130, 246, 0.3) !important;
}

/* ==========================================================================
   PYRAMID PHASE SUBCATEGORIES
   ========================================================================== */

.pyramid-phases-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pyramid-phase-group {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  transition: all 0.2s ease;
}

.pyramid-phase-group:hover {
  border-color: var(--primary-border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.pyramid-phase-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.pyramid-phase-icon {
  font-size: 16px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.8);
}

.pyramid-phase-name {
  font-weight: 700;
  font-size: 12.5px;
  color: var(--ink);
}

.pyramid-phase-desc {
  font-size: 11px;
  color: var(--ink-soft);
  flex: 1;
}

.pyramid-phase-stats {
  display: flex;
  gap: 6px;
  font-size: 10px;
  font-family: var(--mono);
}

.phase-stat-matched {
  color: #10b981;
  font-weight: 600;
}

.phase-stat-skipped {
  color: #f59e0b;
  font-weight: 600;
}

.phase-stat-nodata {
  color: #6b7280;
  font-weight: 600;
}

/* Phase-specific colors for pyramid */
.pyramid-phase-group.phase-1 {
  border-left: 3px solid #10b981;
}

.pyramid-phase-group.phase-2 {
  border-left: 3px solid #3b82f6;
}

.pyramid-phase-group.phase-3 {
  border-left: 3px solid #8b5cf6;
}

.pyramid-phase-group.phase-4 {
  border-left: 3px solid #f59e0b;
}

.pyramid-phase-group.phase-5 {
  border-left: 3px solid #ef4444;
}

.pyramid-phase-group.phase-6 {
  border-left: 3px solid #6366f1;
}

/* Modal de detalhe do provedor: linha 1 com 4 cards, linha 2 com 5 cards */
.provider-summary-grid {
  display: grid;
  gap: 10px;
  margin-bottom: 0;
}

.provider-summary-grid.cols-4 {
  grid-template-columns: repeat(4, 1fr);
}

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

@media (max-width: 900px) {
  .provider-summary-grid.cols-4,
  .provider-summary-grid.cols-5 {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 560px) {
  .provider-summary-grid.cols-4,
  .provider-summary-grid.cols-5 {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Birô não acionado na cascata executada: apagado e sem hover de card ativo */
.bureau-node-card[data-used="0"]:hover {
  transform: none;
  box-shadow: none;
}

.provider-summary-grid .stat-card {
  padding: 12px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  text-align: center;
  border: 1px solid var(--line);
}

.provider-summary-grid .stat-value {
  font-size: 18px;
  font-weight: 800;
  color: var(--ink);
}

.provider-summary-grid .stat-label {
  font-size: 10px;
  color: var(--ink-soft);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Ordenacao na tabela */
.data-table thead th {
  cursor: pointer;
  user-select: none;
}

.data-table thead th:hover {
  background: var(--surface-3);
}

/* Tabs do Deep Dive - Cascata */
.deep-dive-tab.active {
  border-bottom-color: var(--primary) !important;
  color: var(--primary) !important;
}

.progress {
  display: flex;
  align-items: center;
  height: 100%;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #22c55e, #16a34a, #15803d);
  transition: width 0.4s ease-out;
  border-radius: 5px;
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.5);
  min-width: 0;
}

.progress-sm .progress-bar {
  border-radius: 5px;
}

.progress-sm {
  height: 10px;
  border-radius: 5px;
  overflow: hidden;
  background: var(--surface-3);
  border: 1px solid var(--line);
}

.status-text {
  color: var(--ink-soft);
  font-size: 10px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid transparent;
}

/* Trace Timeline (ISSUE-34) */
.trace-timeline {
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
  padding-left: 24px;
}

.trace-timeline::before {
  content: "";
  position: absolute;
  top: 8px;
  left: 7px;
  width: 2px;
  height: calc(100% - 16px);
  background: var(--line-strong);
}

.trace-step {
  position: relative;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  transition: all 0.15s ease;
}

.trace-step::before {
  content: "";
  position: absolute;
  top: 18px;
  left: -21px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid var(--surface);
}

.trace-step.is-stop::before {
  background: #a855f7;
  box-shadow: 0 0 8px #a855f7;
}

.trace-step-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  flex-wrap: wrap;
  gap: 6px;
}

.trace-step-title {
  font-weight: 700;
  font-size: 13px;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 6px;
}

.trace-step-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  font-family: var(--mono);
}

.trace-data-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.trace-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid transparent;
}

.trace-tag.matched {
  background: rgba(16, 185, 129, 0.15);
  border-color: #10b981;
  color: #10b981;
}

.trace-tag.partial {
  background: rgba(245, 158, 11, 0.15);
  border-color: #f59e0b;
  color: #f59e0b;
}

.trace-tag.nodata {
  background: rgba(249, 115, 22, 0.15);
  border-color: #f97316;
  color: #f97316;
}

.trace-tag.apierror {
  background: rgba(239, 68, 68, 0.15);
  border-color: #ef4444;
  color: #ef4444;
}

.trace-tag.stopmatch {
  background: rgba(168, 85, 247, 0.15);
  border-color: #a855f7;
  color: #a855f7;
}

.trace-step-body {
  margin-top: 0;
}

.trace-diagnostic-box {
  display: block;
}

.trace-target-box {
  display: block;
}

.trace-step-raw-details {
  display: block;
}

.trace-step-raw-details summary {
  outline: none;
}

.trace-step-raw-details summary:hover {
  opacity: 0.8;
}

.trace-step-raw-details[open] summary {
  margin-bottom: 6px;
}

/* ==========================================================================
   CASCADE PHASE STYLES
   ========================================================================== */

.cascade-phase-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  margin: 16px 0 8px 0;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 13px;
  color: var(--ink);
  position: relative;
}

.cascade-phase-header:first-child {
  margin-top: 0;
}

.cascade-phase-icon {
  font-size: 18px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.8);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.cascade-phase-info {
  flex: 1;
}

.cascade-phase-name {
  font-weight: 800;
  font-size: 14px;
  margin-bottom: 2px;
}

.cascade-phase-desc {
  font-size: 11.5px;
  font-weight: 500;
  opacity: 0.8;
}

.cascade-phase-stats {
  display: flex;
  gap: 8px;
  font-size: 11px;
  font-family: var(--mono);
}

.cascade-phase-stat {
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.6);
}

.cascade-phase-steps {
  margin-left: 16px;
  padding-left: 20px;
  border-left: 3px solid var(--line);
  position: relative;
}

.cascade-phase-steps::before {
  content: "";
  position: absolute;
  top: 0;
  left: -7px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--line);
}

/* Phase colors */
.phase-1 { background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(16, 185, 129, 0.05)); border: 1px solid rgba(16, 185, 129, 0.3); }
.phase-2 { background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(59, 130, 246, 0.05)); border: 1px solid rgba(59, 130, 246, 0.3); }
.phase-3 { background: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(139, 92, 246, 0.05)); border: 1px solid rgba(139, 92, 246, 0.3); }
.phase-4 { background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(245, 158, 11, 0.05)); border: 1px solid rgba(245, 158, 11, 0.3); }
.phase-5 { background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(239, 68, 68, 0.05)); border: 1px solid rgba(239, 68, 68, 0.3); }
.phase-6 { background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(99, 102, 241, 0.05)); border: 1px solid rgba(99, 102, 241, 0.3); }

/* Phase connector line */
.phase-connector {
  width: 3px;
  height: 16px;
  margin-left: 30px;
  background: var(--line);
  border-radius: 2px;
}

/* ==========================================================================
   DASHBOARD EXECUTIVO 360° STYLES
   ========================================================================== */

.dashboard-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md, 10px);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s ease;
  position: relative;
  overflow: hidden;
}

.card-interactive {
  cursor: pointer;
  user-select: none;
}

.card-interactive:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
  border-color: var(--primary);
}

[data-theme="dark"] .card-interactive:hover {
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
  border-color: var(--primary);
}

.dash-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.dash-card-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.dash-card-val {
  font-size: 24px;
  font-weight: 800;
  font-family: var(--mono);
  color: var(--ink);
  letter-spacing: -0.5px;
  line-height: 1.2;
}

.dash-card-label {
  font-size: 12.5px;
  color: var(--ink-soft);
  margin-top: 4px;
  font-weight: 500;
}

.dash-card-footer {
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
  font-size: 11.5px;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.funnel-tier-row {
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.funnel-tier-row:hover {
  transform: translateX(4px);
  border-color: var(--primary) !important;
}

.health-mini-card {
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 4px;
  transition: border-color 0.15s ease;
}

.health-mini-card:hover {
  border-color: var(--primary);
}

/* ==========================================================================
   APPROVALS QUEUE & COMPARISON MODAL STYLES
   ========================================================================== */

#approvals-container .card {
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

#approvals-container .card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  transform: translateY(-1px);
}

.contact-highlight-target {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 2px var(--primary-soft), 0 2px 8px rgba(21, 71, 52, 0.12) !important;
  position: relative;
}

.contact-highlight-target::before {
  content: '🎯 SELECIONADO NA FILA';
  position: absolute;
  top: -9px;
  right: 12px;
  background: var(--primary);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 4px;
  letter-spacing: 0.4px;
}

/* ==========================================================================
   KANBAN DE CICLO DE VIDA DOS PROVEDORES (6 ESTÁGIOS)
   ========================================================================== */

.kanban-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  align-items: start;
  overflow-x: auto;
  padding-bottom: 12px;
}

@media (min-width: 1400px) {
  .kanban-board {
    grid-template-columns: repeat(6, 1fr);
  }
}

.kanban-column {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  max-height: 80vh;
  min-width: 250px;
}

.kanban-column-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 2;
}

.kanban-column-title {
  font-size: 12.5px;
  font-weight: 800;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 6px;
}

.kanban-column-count {
  font-size: 11px;
  font-weight: 800;
  font-family: var(--mono);
  padding: 2px 7px;
  border-radius: var(--radius-full);
}

.kanban-cards-list {
  padding: 10px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.kanban-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  padding: 12px;
  box-shadow: var(--shadow-xs);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  cursor: pointer;
  position: relative;
}

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

.kanban-card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.kanban-card-desc {
  font-size: 11px;
  color: var(--ink-soft);
  margin-bottom: 8px;
  line-height: 1.4;
}

.kanban-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  font-size: 11px;
}

/* ==========================================================================
   LABORATÓRIO & RAW INSPECTOR ZERO-DATA-LOSS
   ========================================================================== */

.raw-json-viewer {
  font-family: 'SF Mono', 'Fira Code', Menlo, Consolas, monospace !important;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-all;
  tab-size: 2;
}

.telemetry-stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.telemetry-stat-val {
  font-size: 22px;
  font-weight: 800;
  font-family: var(--mono);
  color: var(--ink);
}

.telemetry-stat-lbl {
  font-size: 11.5px;
  color: var(--ink-soft);
  font-weight: 600;
  text-transform: uppercase;
}

.divergence-alert-card {
  background: var(--warning-soft);
  border: 1px solid var(--warning-border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}

/* ==========================================================================
   PROVIDER DEEP DIVE PAGE
   ========================================================================== */

/* Hero card */
.deep-dive-hero {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.deep-dive-hero-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.deep-dive-hero-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  background: var(--primary-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.deep-dive-hero-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--ink);
  margin: 0;
}

.deep-dive-hero-subtitle {
  font-size: 13px;
  color: var(--ink-soft);
  margin-top: 2px;
}

.deep-dive-hero-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.deep-dive-hero-kpi {
  text-align: center;
}

.deep-dive-hero-kpi-value {
  font-size: 24px;
  font-weight: 800;
  font-family: var(--mono);
  color: var(--ink);
  line-height: 1;
}

.deep-dive-hero-kpi-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-soft);
  text-transform: uppercase;
  margin-top: 4px;
}

/* Sub-tabs navigation */
.deep-dive-tabs {
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}

.deep-dive-tab:hover {
  color: var(--ink);
  background: var(--surface-3);
}

.deep-dive-tab.active {
  border-bottom-color: var(--primary) !important;
  color: var(--primary);
}

/* Sub-tab panes */
.deep-dive-pane {
  min-height: 200px;
}

/* Section card */
.dd-section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  overflow: hidden;
}

.dd-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}

.dd-section-body {
  padding: 16px;
}

/* Metric card */
.dd-metric {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dd-metric-value {
  font-size: 22px;
  font-weight: 800;
  font-family: var(--mono);
  color: var(--ink);
}

.dd-metric-label {
  font-size: 11.5px;
  color: var(--ink-soft);
  font-weight: 600;
  text-transform: uppercase;
}

/* Metric grid */
.dd-metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

/* Resilience status badge */
.dd-resilience-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 700;
  border: 1px solid;
}

.dd-resilience-badge.ok {
  background: var(--success-soft);
  border-color: var(--success-border);
  color: var(--success);
}

.dd-resilience-badge.warning {
  background: var(--warning-soft);
  border-color: var(--warning-border);
  color: var(--warning);
}

.dd-resilience-badge.error {
  background: var(--danger-soft);
  border-color: var(--danger-border);
  color: var(--danger);
}

/* Log entry */
.dd-log-entry {
  display: grid;
  grid-template-columns: 140px 80px 1fr 100px 100px;
  gap: 8px;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  font-family: var(--mono);
}

.dd-log-entry:last-child {
  border-bottom: none;
}

.dd-log-timestamp {
  color: var(--ink-soft);
  font-size: 11px;
}

.dd-log-level {
  font-weight: 700;
  font-size: 10px;
  text-transform: uppercase;
}

.dd-log-level.success {
  color: var(--success);
}

.dd-log-level.error {
  color: var(--danger);
}

.dd-log-level.warning {
  color: var(--warning);
}

.dd-log-message {
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dd-log-latency {
  text-align: right;
  color: var(--ink-soft);
}

.dd-log-cost {
  text-align: right;
  color: var(--ink-soft);
}

/* Raw JSON viewer */
.dd-raw-viewer {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 16px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.6;
  overflow-x: auto;
  max-height: 400px;
  overflow-y: auto;
}

/* Action button */
.dd-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}

.dd-action-btn:hover {
  background: var(--surface-2);
  border-color: var(--primary);
  color: var(--primary);
}

.dd-action-btn.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.dd-action-btn.primary:hover {
  background: var(--primary-hover);
}

/* Timeline */
.dd-timeline {
  position: relative;
  padding-left: 20px;
}

.dd-timeline::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--line);
}

.dd-timeline-item {
  position: relative;
  padding-bottom: 16px;
}

.dd-timeline-item::before {
  content: '';
  position: absolute;
  left: -18px;
  top: 4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid var(--surface);
}

.dd-timeline-item-time {
  font-size: 11px;
  color: var(--ink-faint);
  margin-bottom: 4px;
}

.dd-timeline-item-content {
  font-size: 13px;
  color: var(--ink);
}

/* Empty state */
.dd-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--ink-faint);
}

.dd-empty-icon {
  font-size: 32px;
  margin-bottom: 12px;
}

.dd-empty-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
}

.dd-empty-subtext {
  font-size: 12px;
  color: var(--ink-faint);
  margin-top: 4px;
}

/* ==========================================================================
   Contact Details Drawer (ISSUE-51)
   ========================================================================== */

.details-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xs, 4px);
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.details-btn:hover {
  background: var(--surface-2);
  border-color: var(--primary);
  color: var(--primary);
}

.details-btn svg {
  flex-shrink: 0;
}

.contact-details-drawer {
  display: none;
  position: fixed;
  top: 0;
  right: 0;
  width: 420px;
  max-width: 90vw;
  height: 100%;
  background: var(--surface);
  border-left: 1px solid var(--line);
  z-index: 1000;
  flex-direction: column;
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
  transform: translateX(100%);
  transition: transform 0.25s ease;
}

.contact-details-drawer.open {
  display: flex;
  transform: translateX(0);
}

.contact-details-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.contact-details-drawer-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}

.contact-details-drawer-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ink-soft);
  padding: 4px;
  border-radius: var(--radius-xs, 4px);
  transition: color 0.15s ease;
}

.contact-details-drawer-close:hover {
  color: var(--ink);
  background: var(--surface-2);
}

.contact-details-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.details-section {
  margin-bottom: 24px;
}

.details-section:last-child {
  margin-bottom: 0;
}

.details-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.details-section-title svg {
  color: var(--primary);
  flex-shrink: 0;
}

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

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

.details-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.details-value {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
}

.details-raw {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-xs, 4px);
  padding: 12px;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.5;
  color: var(--ink);
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 300px;
  overflow-y: auto;
  margin: 0;
}

.details-occurrence-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  color: var(--ink);
}

.details-occurrence-row:last-of-type {
  border-bottom: none;
}

.details-occurrence-count {
  font-weight: 700;
  color: var(--primary);
}

.details-occurrence-total {
  margin-top: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
}

@media (max-width: 600px) {
  .contact-details-drawer {
    width: 100%;
    max-width: 100%;
  }

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

/* ==========================================================================
   Dados cadast categorizados (GET /dossier/{id}/facts)
   --------------------------------------------------------------------------
   Espaço ADAPTATIVO: o backend manda `density` (single|few|many) e `dense`
   (grupo de itens) e a UI respeita — nunca lista infinita de campos.
   ========================================================================== */

.dfact {
  background: var(--surface-2);
  border: 1px solid var(--line);
  /* Fio de 3px na esquerda, como a ficha legada (`.dficha`): a separacao é
   * por fio + fundo, nunca por sombra. */
  border-left: 3px solid var(--primary);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 16px;
}

.dfact-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding-bottom: 10px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.dfact-head-title { font-weight: 700; font-size: 13px; }
.dfact-head-stats {
  font-size: 11px;
  color: var(--ink-soft);
  font-family: var(--mono);
}
.dfact-head-cost { font-size: 11px; color: var(--ink-soft); }

.dfact-filter { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; font-size: 11px; }
.dfact-select {
  font-family: var(--mono);
  font-size: 11px;
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  background: var(--surface);
  color: var(--ink);
  max-width: 180px;
}

.dfact-body { display: flex; flex-direction: column; gap: 8px; }

/* --- Seção colapsável de um grupo canônico ------------------------------- */
.dfact-group {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.dfact-group-head {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink);
  text-align: left;
}
.dfact-group-head:hover { background: var(--surface-2); }
.dfact-group-caret { color: var(--ink-soft); font-size: 11px; width: 10px; }
.dfact-group-ic { font-size: 13px; }
.dfact-group-title { flex: 1; min-width: 0; }
.dfact-group-count {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: var(--radius-full);
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink-soft);
}
.dfact-group-body { padding: 4px 12px 12px; display: flex; flex-direction: column; gap: 10px; }
.dfact-group--unclassified > summary { list-style: none; }
.dfact-group--unclassified > summary::-webkit-details-marker { display: none; }
.dfact-group--unclassified[open] > summary .dfact-group-caret { transform: rotate(90deg); }

/* --- Grade por densidade -------------------------------------------------- */
/* single: 1-2 campos -> linha inline (label-valor, como o resto do dossiê) */
.dfact-grid--single { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: baseline; }
.dfact-grid--single .dfact-cell { flex-direction: row; align-items: baseline; gap: 6px; }
.dfact-grid--single .dfact-value { font-size: 13px; }

/* few: 2-5 campos -> grid compacto de 2-3 colunas */
.dfact-grid--few {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px 12px;
}

/* many: >=6 campos -> grade que CRESCE com wrap (sem scroll infinito) */
.dfact-grid--many {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 8px 12px;
}

/* --- Modo LINHA: a gramática da ficha legada, absorvida -------------------- */
/*
 * O modo `few` (2-5 campos) não é um par label-valor espremido numa célula de
 * 180px: é uma LINHA, com coluna fixa de rótulo, valor ocupando o resto e
 * badge na 3ª trilha. É a medida do legado (`.dficha-mrow`), copiada aqui:
 *
 *   legado  .dficha-mrow { grid-template-columns: 190px 1fr auto;
 *                          align-items: baseline; gap: 10px; padding: 4px 6px; }
 *   /facts  .dfact-grid--rows .dfact-cell { idem }
 *
 * O DOM já estava na forma certa: `renderFactField` emite
 * `.dfact-label` | `.dfact-value` | `.dfact-provs` nessa ordem — exatamente
 * as três colunas. Por isso estaMudança é CSS, não é reescrita de markup.
 *
 * A diferença estrutural que importa: no grid denso o valor fica ABAIXO do
 * rótulo dentro dos mesmos 170-180px, e o olho não tem linha de base para
 * varrer. Aqui o valor tem `1fr` — todo o resto da linha.
 */
.dfact-grid--rows {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.dfact-grid--rows .dfact-cell {
  display: grid;
  grid-template-columns: 190px 1fr auto;
  align-items: baseline;
  gap: 10px;
  padding: 4px 6px;
}
/* Zebra: o FUNDO é o separador. Sem border-bottom — é a regra do legado. */
.dfact-grid--rows .dfact-cell:nth-child(odd) { background: var(--surface-2); }
/* A zebra (0,3,0) ganha do `--changed` (0,1,0). Tem que voltar a ganhar o
 * destaque de divergência, senão birôs discordando somem na linha impar. */
.dfact-grid--rows .dfact-cell--changed {
  border-left-color: var(--warning, #b45309);
  background: var(--warning-soft, #fef3c7);
}
/* Rótulo: 11px/600 caixa alta, como `.dficha-mrow-l`. O legado usa 600 (não
 * 700) porque aqui o valor tem a linha inteira e não precisa de peso. */
.dfact-grid--rows .dfact-label {
  font-size: 11px;
  font-weight: 600;
}
/* Valor: 13px na cor de tinta cheia. Sempre MAIOR que o rótulo, sempre
 * menos claro. É a relação que segura a leitura. */
.dfact-grid--rows .dfact-value {
  font-size: 13px;
  font-weight: 400;
}
/* 3ª trilha: a procedência encosta na direita da linha. */
.dfact-grid--rows .dfact-provs { justify-content: flex-end; }

/* --- Tier de decisão ------------------------------------------------------ */
/* Mesmo vocabulário do legado: cabeçalho em caixa alta COM divisor, linhas
 * com coluna fixa de rótulo e zebra. O que muda é o peso do bloco — é a
 * primeira coisa que se lê, então o fio é do `--primary` e o fundo é limpo. */
.dfact-tier-decisao {
  border: 1px solid var(--line);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 10px 12px 12px;
  margin-bottom: 4px;
}
.dfact-tier-t {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 8px;
}
.dfact-decisao + .dfact-decisao { margin-top: 10px; }
.dfact-decisao-t {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 3px;
}

.dfact-cell {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  padding: 3px 5px;
  border-radius: var(--radius-xs);
  border-left: 2px solid transparent;
}
/* `changed: true` (birôs discordam) recebe destaque mais forte que o badge. */
.dfact-cell--changed {
  border-left-color: var(--warning, #b45309);
  background: var(--warning-soft, #fef3c7);
}

.dfact-label {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.dfact-value {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  word-break: break-word;
  min-width: 0;
}
.dfact-masked { font-family: var(--mono); color: var(--ink-soft); }
.dfact-provs { display: flex; flex-wrap: wrap; gap: 4px; }

/* Chip de proveniência por dado */
.dfact-prov {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  background: var(--primary-soft);
  border: 1px solid var(--primary-border);
  color: var(--primary);
  white-space: nowrap;
}
.dfact-prov--multi { position: relative; cursor: help; }
.dfact-prov--none { background: var(--surface-2); border-color: var(--line); color: var(--ink-faint); }
.dfact-prov-list {
  display: none;
  position: absolute;
  left: 0;
  top: calc(100% + 4px);
  z-index: 40;
  padding: 6px 8px;
  border-radius: var(--radius-xs);
  background: var(--surface);
  border: 1px solid var(--line-strong, var(--line));
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
  white-space: nowrap;
  font-size: 10.5px;
  color: var(--ink);
}
.dfact-prov--multi:hover .dfact-prov-list,
.dfact-prov--multi:focus-within .dfact-prov-list { display: block; }

/* Badge de histórico/diff (≠) */
.dfact-hist {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: var(--radius-xs);
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  cursor: pointer;
  font-family: var(--mono);
}
.dfact-hist--changed {
  background: var(--warning-soft);
  border-color: var(--warning-border);
  color: var(--warning);
}

.dfact-reveal {
  font-family: inherit;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-xs);
  background: none;
  border: 1px solid var(--primary-border);
  color: var(--primary);
  cursor: pointer;
}
.dfact-reveal:disabled { opacity: 0.5; cursor: progress; }

/* "ver todos (+N)" — o corte que substitui a barra de rolagem infinita */
.dfact-more {
  grid-column: 1 / -1;
  justify-self: start;
  margin-top: 2px;
  padding: 2px 8px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  color: var(--primary);
  background: none;
  border: 1px dashed var(--primary-border);
  border-radius: var(--radius-full);
  cursor: pointer;
}
.dfact-fields-rest { display: contents; }

/* --- Grupos densos: grade de cartões (NUNCA label-valor empilhado) -------- */
.dfact-items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 8px;
}
.dfact-items-rest { display: contents; }

.dfact-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 8px 10px;
  border-radius: var(--radius-xs);
  background: var(--surface-2);
  border: 1px solid var(--line);
  min-width: 0;
}
.dfact-item--changed { border-color: var(--warning-border); background: var(--warning-soft); }
.dfact-item-top { display: flex; align-items: center; gap: 5px; min-width: 0; }
.dfact-item-ic { font-size: 12px; flex-shrink: 0; }
.dfact-item-val {
  flex: 1;
  min-width: 0;
  font-size: 12.5px;
  font-weight: 700;
  font-family: var(--mono);
  color: var(--ink);
  overflow-wrap: anywhere;
}
.dfact-item-prov { display: flex; flex-wrap: wrap; gap: 4px; }
.dfact-item-chips { display: flex; flex-wrap: wrap; gap: 3px; }

.dfact-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  font-size: 10px;
  line-height: 1.5;
  padding: 0 5px;
  border-radius: var(--radius-xs);
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  max-width: 100%;
  overflow-wrap: anywhere;
}
.dfact-chip b { font-weight: 700; color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.2px; }
.dfact-chip--money { font-family: var(--mono); font-weight: 700; color: var(--ink); cursor: help; }
.dfact-chip--mais { font-family: var(--mono); font-weight: 700; cursor: help; }

/* Selos de cobrança: a cor carrega a urgência (bloqueio > multa/IPVA > neutro). */
.dfact-item-alerts { display: flex; flex-wrap: wrap; gap: 4px; }
.dfact-alert {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  max-width: 100%;
  padding: 0 6px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 10.5px;
  line-height: 1.6;
  color: var(--ink-soft);
  overflow-wrap: anywhere;
  cursor: help;
}
.dfact-alert--danger { background: var(--danger-soft); border-color: var(--danger-border); color: var(--danger); font-weight: 700; }
.dfact-alert--warn { background: var(--warning-soft); border-color: var(--warning-border); color: var(--warning); }
.dfact-alert--neutral { background: var(--surface-2); }
.dfact-alert-dots { margin-left: 4px; font-size: 10px; white-space: nowrap; cursor: help; }

/* Tabela densa (layout=table): lista homogênea de N itens, não N cards. */
.dfact-tablewrap { overflow-x: auto; }
.dfact-tablewrap--cut { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.dfact-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
}
.dfact-th {
  position: sticky;
  top: 0;
  text-align: left;
  padding: 5px 8px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--ink-faint);
  white-space: nowrap;
}
.dfact-th--label { min-width: 190px; }
.dfact-row { cursor: pointer; }
.dfact-row:hover { background: var(--surface-2); }
.dfact-td {
  padding: 4px 8px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-soft);
  vertical-align: top;
}
.dfact-td--label {
  font-weight: 700;
  color: var(--ink);
  overflow-wrap: anywhere;
}

/* Contagem de lista ("3 veículos") no lugar do `null` que o backend deixa. */
.dfact-count { font-family: var(--mono); font-weight: 700; color: var(--ink-soft); }

/* Modal de detalhes de UM item (mesmo conteúdo do tooltip do card). */
.dfact-modal {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  max-width: 720px;
  width: 100%;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: var(--ink);
}
.dfact-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 18px 10px;
  border-bottom: 1px solid var(--line);
}
.dfact-modal-title { font-size: 14px; font-weight: 800; overflow-wrap: anywhere; }
.dfact-modal-sub { margin-top: 2px; font-size: 11px; color: var(--ink-soft); }
.dfact-modal-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 18px 18px;
  overflow: auto;
}
.dfact-kvs-title {
  margin-bottom: 4px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--ink-faint);
}
.dfact-kv {
  display: flex;
  gap: 8px;
  padding: 3px 0;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
}
.dfact-kv-k { flex: 0 0 40%; color: var(--ink-faint); font-weight: 700; }
.dfact-kv-v { flex: 1; color: var(--ink); overflow-wrap: anywhere; }
/* Housekeeping do birô: presente, mas marcado como não-cobrança. */
.dfact-kvs--noise .dfact-kv-v { font-family: var(--mono); color: var(--ink-faint); }
.dfact-kvs--noise .dfact-kvs-title { color: var(--ink-faint); }
.dfact-prov-raw {
  margin: 0;
  padding: 6px 8px;
  border-radius: var(--radius-xs);
  background: var(--surface-2);
  font-family: var(--mono);
  font-size: 11px;
  white-space: pre-wrap;
  color: var(--ink-soft);
}

.dfact-empty {
  padding: 14px 0;
  text-align: center;
  font-size: 12px;
  color: var(--ink-faint);
}
.dfact-notice {
  padding: 6px 10px;
  border-radius: var(--radius-xs);
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--ink-soft);
}
.dfact-notice--warn { background: var(--warning-soft); border-color: var(--warning-border); color: var(--warning); }

/* --- Timeline de histórico/diff ------------------------------------------ */
.dfact-ev {
  padding: 8px 10px;
  border-radius: var(--radius-xs);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--line);
  margin-bottom: 6px;
}
.dfact-ev--current { border-left-color: var(--success, #16a34a); }
.dfact-ev--override { border-left-color: var(--warning, #b45309); }
.dfact-ev-top {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-soft);
}
.dfact-ev-val {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  margin: 3px 0;
  overflow-wrap: anywhere;
}
.dfact-ev-meta { font-size: 10.5px; color: var(--ink-faint); font-family: var(--mono); }

.dfact-hist-items { margin-top: 10px; }
.dfact-hist-items-title { font-size: 11px; font-weight: 700; color: var(--ink-soft); margin-bottom: 5px; }
.dfact-hist-item {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 4px 0;
  border-top: 1px solid var(--line);
}
.dfact-hist-sig {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-faint);
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ==========================================================================
   FICHA RESUMIDA do devedor (bloco legado)
   --------------------------------------------------------------------------
   O grid label-valor de ~25 linhas virou ficha de leitura rápida: 3 linhas
   com o essencial + o que só o birô tem. Os grupos do `/facts` são o
   detalhe completo. Sem lista de telefone/e-mail/endereço aqui — isso é
   item do grupo `contatos`.
   ========================================================================== */

.dficha {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}
.dficha-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}
.dficha-tit {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
/* Uma linha = uma frase. `·` separa os pares (não inline-block: os pares
   quebram juntos quando a linha wrappa). */
.dficha-line {
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink);
  padding: 2px 0;
}
.dficha-line--birô { color: var(--ink-soft); }
.dficha-line--vazio { font-size: 12px; color: var(--ink-faint); font-style: italic; }
.dficha-par b {
  font-weight: 700;
  color: var(--ink-faint);
  text-transform: uppercase;
  font-size: 10.5px;
  letter-spacing: 0.3px;
  margin-right: 2px;
}
.dficha-sep {
  color: var(--ink-faint);
  margin: 0 7px;
}
.dficha-div {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
  color: var(--warning, #b45309);
  margin-left: 5px;
  cursor: help;
}
.dficha-reveal {
  border: none;
  background: none;
  padding: 0 2px;
  margin-left: 2px;
  cursor: pointer;
  font-size: 11px;
  font-family: inherit;
  line-height: 1;
}
.dficha-reveal:hover { filter: brightness(1.2); }
.dficha-reveal:disabled { opacity: 0.5; cursor: progress; }
.dficha-masked { font-family: var(--mono); color: var(--ink-soft); }
.dficha-fale {
  margin-bottom: 8px;
  padding: 8px 12px;
  border-radius: 6px;
  background: var(--danger-soft, #fee2e2);
  color: var(--danger, #b91c1c);
  font-weight: 700;
  font-size: 13px;
}
/* O protesto chega como `.details-item` (herança do bloco legado): na ficha
   ele é um bloco de largura inteira logo abaixo do cabeçalho. */
.dficha > .details-item { margin: 6px 0; }

/* --- Modal "Ficha cadastral completa" ------------------------------------ */
.dficha-mhead { margin-bottom: 10px; }
.dficha-mname { font-size: 15px; font-weight: 800; color: var(--ink); }
.dficha-msub { font-size: 11px; color: var(--ink-soft); font-family: var(--mono); }
.dficha-msec { margin-bottom: 14px; }
.dficha-msec-t {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
}
.dficha-msec-notice {
  font-size: 11px;
  color: var(--ink-soft);
  padding: 3px 0 5px;
}
.dficha-msec-notice--lock { color: var(--warning, #b45309); }
/* Coluna label-valor: como ficha de crédito, para leitura linear. */
.dficha-mrow {
  display: grid;
  grid-template-columns: 190px 1fr auto;
  align-items: baseline;
  gap: 10px;
  padding: 4px 6px;
  border-radius: var(--radius-xs);
  border-left: 2px solid transparent;
}
.dficha-mrow:nth-child(odd) { background: var(--surface-2); }
.dficha-mrow-l {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.dficha-mrow-v {
  font-size: 13px;
  color: var(--ink);
  word-break: break-word;
}
.dficha-mrow-v--vazio { color: var(--ink-faint); }
.dficha-mdiff {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--warning, #b45309);
  background: var(--warning-soft, #fef3c7);
  border: 1px solid var(--warning-border, #fde68a);
  border-radius: var(--radius-full);
  padding: 1px 6px;
  white-space: nowrap;
  cursor: help;
}

@media (max-width: 640px) {
  .dfact-grid--single { flex-direction: column; gap: 4px; }
  .dfact-grid--few, .dfact-grid--many { grid-template-columns: 1fr; }
  .dfact-items { grid-template-columns: 1fr; }
  .dfact-filter { margin-left: 0; }
  .dficha-mrow { grid-template-columns: 1fr; gap: 1px; }
  .dficha-sep { margin: 0 4px; }
}

/* ==========================================================================
   Related Persons Card (ISSUE-52)
   ========================================================================== */

.related-persons-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.related-person-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  transition: border-color 0.15s ease;
}

.related-person-card:hover {
  border-color: var(--line-strong);
}

.related-person-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.related-person-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.related-person-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  font-size: 12.5px;
  color: var(--ink-soft);
  margin-bottom: 10px;
}

.related-person-meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.related-person-actions {
  display: flex;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.pill-yellow {
  background: var(--warning-soft, #fef3cd);
  color: var(--warning, #856404);
}

.pill-red {
  background: var(--danger-soft, #f8d7da);
  color: var(--danger, #842029);
}

/* ---- NEXUS UI (grupo 4: Operacao Nexcore + Validacao de Campo) ---- */
.nx-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 16px; align-items: start; }
.nx-grid-campo { grid-template-columns: 1fr 1.4fr; }
@media (max-width: 1024px) { .nx-grid, .nx-grid-campo { grid-template-columns: 1fr; } }
.nx-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 18px; margin-bottom: 16px; }
.nx-card h2 { font-size: 15px; margin: 0 0 4px; color: var(--ink); }
.nx-card .nx-hint { font-size: 12.5px; color: var(--ink-faint); margin: 0 0 12px; }
.nx-field { margin-bottom: 10px; }
.nx-field label { display: block; font-size: 12px; font-weight: 600; color: var(--ink-soft); margin-bottom: 4px; }
.nx-field input, .nx-field select { width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 13.5px; background: var(--surface); color: var(--ink); }
.nx-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; margin-bottom: 12px; }
.nx-result { font-size: 13px; margin-top: 10px; margin-bottom: 10px; color: var(--ink-soft); }
.nx-result strong.ok { color: var(--success); }
.nx-result strong.bad { color: var(--danger); }
.nx-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.nx-table th, .nx-table td { border-bottom: 1px solid var(--line); padding: 7px 8px; text-align: left; }
.nx-table th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint); }
.nx-temp { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.nx-temp.quente { background: #fde8e8; color: #991b1b; }
.nx-temp.morno { background: #fef3d8; color: #92400e; }
.nx-temp.frio { background: #e3f0fd; color: #1e40af; }
.nx-timeline { list-style: none; margin: 0; padding: 0; }
.nx-timeline li { border-left: 3px solid var(--line); margin-left: 6px; padding: 8px 0 8px 14px; }
.nx-timeline li + li { margin-top: 2px; }
.nx-kind { display: inline-block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint); }
.nx-kind.mensagem { color: var(--primary); }
.nx-kind.tabulacao { color: var(--success); }
.nx-kind.status { color: var(--ink-soft); }
.nx-when { font-size: 12px; color: var(--ink-faint); }
.nx-tab-form { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (max-width: 1024px) { .nx-tab-form { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------------------
   UX-01 — Aba do Operador (apêndice aditivo: toques de 44px, responsivo)
   --------------------------------------------------------------------------- */
.op-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 16px; align-items: start; }
.op-btn { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
.op-timeline { margin-top: 12px; max-height: 260px; overflow-y: auto; }
.op-erros { margin: 8px 0 0; padding-left: 18px; font-size: 12.5px; }
.op-erros li { margin-bottom: 4px; }
#tab-operador .nx-field input, #tab-operador .nx-field select { min-height: 44px; }
@media (max-width: 1024px) { .op-grid { grid-template-columns: 1fr; } }
@media (max-width: 640px) {
  #tab-operador .nx-row { flex-direction: column; align-items: stretch; }
  #tab-operador .nx-row .op-btn { width: 100%; }
}
/* ---- UX-07 Mensagens (envio por agente + caixa por protocolo, responsivo) ---- */
.nx-msg-grid { display: grid; grid-template-columns: 1fr 1.4fr; gap: 16px; align-items: start; }
@media (max-width: 1024px) { .nx-msg-grid { grid-template-columns: 1fr; } }
.nx-sub { font-size: 13px; margin: 0 0 10px; color: var(--ink); }
#nx-mensagens input:focus-visible, #nx-mensagens select:focus-visible, #nx-mensagens button:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
#nx-mensagens .btn { min-height: 44px; transition: background-color 200ms ease, color 200ms ease; }
.nx-msg-list { max-height: 420px; overflow-y: auto; }
.nx-msg { border-radius: 0 8px 8px 0; }
.nx-msg-cliente { border-left-color: var(--success); background: color-mix(in srgb, var(--success) 6%, transparent); }
.nx-msg-agente { border-left-color: var(--primary); background: color-mix(in srgb, var(--primary) 6%, transparent); }
.nx-msg-bot { border-left-color: var(--ink-faint); }
.nx-st { display: inline-block; padding: 3px 12px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.nx-st-enviada { background: #e3f0fd; color: #1e40af; }
.nx-st-entregue { background: #e0f2f1; color: #00695c; }
.nx-st-lida { background: #e8f5e9; color: #1b5e20; }
.nx-st-falha { background: #fde8e8; color: #991b1b; }
.nx-st-excluida { background: #f3e5f5; color: #6a1b9a; }
/* ==========================================================================
   UX-02 — Aba Gerir (NEXUS UI, apêndice aditivo)
   Alvos de toque >= 44px, foco visível, colapso responsivo em telas menores.
   ========================================================================== */
#tab-gerir .nx-gerir-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
#tab-gerir .nx-card { margin-bottom: 16px; }
#tab-gerir .btn { min-height: 44px; }
#tab-gerir input, #tab-gerir select, #tab-gerir textarea { min-height: 44px; }
#tab-gerir textarea { resize: vertical; }
#tab-gerir .nx-check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; min-height: 44px; cursor: pointer; }
#tab-gerir .nx-check input { min-height: 20px; width: 20px; accent-color: var(--primary); }
#tab-gerir .btn:focus-visible, #tab-gerir input:focus-visible, #tab-gerir select:focus-visible, #tab-gerir textarea:focus-visible { outline: 3px solid var(--primary-border); outline-offset: 2px; }
#tab-gerir .nx-row .btn { transition: transform 0.15s ease, box-shadow 0.15s ease; }
@media (max-width: 1024px) { #tab-gerir .nx-gerir-grid { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { #tab-gerir .nx-row .btn { transition: none; } }
/* ---- UX-03 ACOMPANHAR (append-only): relatorios + quentes + polling ---- */
.nx-grid-rel { grid-template-columns: 1.2fr 1fr; }
@media (max-width: 1024px) { .nx-grid-rel { grid-template-columns: 1fr; } }
.nx-linhagem { list-style: none; margin: 8px 0 0; padding: 0; font-size: 12.5px; color: var(--ink-soft); }
.nx-linhagem li { border-left: 3px solid var(--line); margin-left: 4px; padding: 4px 0 4px 10px; }
.nx-live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #10b981; margin-right: 6px; animation: nx-pulse 2s infinite; }
@keyframes nx-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
#vc-acompanhar .btn { min-height: 44px; }
#vc-acompanhar :focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
#vc-acompanhar .nx-card { transition: border-color 0.25s ease; }
/* ==========================================================================
   UX-08 Polish guardrails (apêndice aditivo, escopo: 4 abas Nexcore)
   Alvos >=44px, :focus-visible, contraste AA, grid 4/8px, paleta por tokens,
   transições <=250ms + reduced-motion. Não altera blocos acima.
   ========================================================================== */
#tab-nexcore .btn, #tab-validacao-campo .btn { min-height: 44px; }
#tab-nexcore .nx-field input, #tab-nexcore .nx-field select,
#tab-validacao-campo .nx-field input, #tab-validacao-campo .nx-field select,
#tab-operador .nx-field textarea, #tab-gerir .nx-field textarea { min-height: 44px; }
#tab-nexcore .btn:focus-visible, #tab-nexcore input:focus-visible,
#tab-nexcore select:focus-visible, #tab-nexcore textarea:focus-visible,
#tab-validacao-campo .btn:focus-visible, #tab-validacao-campo input:focus-visible,
#tab-validacao-campo select:focus-visible, #tab-validacao-campo textarea:focus-visible,
#tab-operador .btn:focus-visible, #tab-operador input:focus-visible,
#tab-operador select:focus-visible, #tab-operador textarea:focus-visible { outline: 3px solid var(--primary-border); outline-offset: 2px; }
/* Contraste AA: dica/cabeçalho/linha do tempo usam tinta suave, nunca apagada */
#tab-nexcore .nx-card .nx-hint, #tab-validacao-campo .nx-card .nx-hint,
#tab-operador .nx-card .nx-hint, #tab-gerir .nx-card .nx-hint,
#tab-nexcore .nx-table th, #tab-validacao-campo .nx-table th,
#tab-operador .nx-table th, #tab-gerir .nx-table th,
#tab-nexcore .nx-kind, #tab-validacao-campo .nx-kind,
#tab-nexcore .nx-when, #tab-validacao-campo .nx-when,
#tab-operador .nx-when { color: var(--ink-soft); }
/* Grid 4/8px: múltiplos de 4/8 nos blocos Nexcore */
#tab-nexcore .nx-card, #tab-validacao-campo .nx-card,
#tab-operador .nx-card { padding: 16px; margin-bottom: 16px; }
#tab-nexcore .nx-field, #tab-validacao-campo .nx-field,
#tab-operador .nx-field { margin-bottom: 8px; }
#tab-nexcore .nx-table th, #tab-nexcore .nx-table td,
#tab-validacao-campo .nx-table th, #tab-validacao-campo .nx-table td { padding: 8px; }
#tab-nexcore .nx-timeline li, #tab-validacao-campo .nx-timeline li,
#tab-operador .nx-timeline li { padding: 8px 0 8px 12px; }
/* Paleta por tokens (sem hex próprio): quente=perigo, morno=alerta, frio=principal */
#tab-nexcore .nx-temp.quente, #tab-validacao-campo .nx-temp.quente { background: var(--danger-soft); color: var(--danger); }
#tab-nexcore .nx-temp.morno, #tab-validacao-campo .nx-temp.morno { background: var(--warning-soft); color: var(--warning-hover); }
#tab-nexcore .nx-temp.frio, #tab-validacao-campo .nx-temp.frio { background: var(--primary-soft); color: var(--primary); }
#tab-validacao-campo .nx-st-enviada { background: var(--primary-soft); color: var(--primary); }
#tab-validacao-campo .nx-st-entregue, #tab-validacao-campo .nx-st-lida { background: var(--success-soft); color: var(--success); }
#tab-validacao-campo .nx-st-falha { background: var(--danger-soft); color: var(--danger); }
#tab-validacao-campo .nx-st-excluida { background: var(--purple-soft); color: var(--purple); }
#tab-validacao-campo .nx-msg-cliente { border-left-color: var(--success); }
#tab-validacao-campo .nx-msg-agente { border-left-color: var(--primary); }
#tab-validacao-campo .nx-live-dot { background: var(--success); }
/* Transições <=250ms no escopo Nexcore */
#tab-nexcore .nx-card, #tab-validacao-campo .nx-card,
#tab-operador .nx-card { transition: border-color 0.2s ease, box-shadow 0.2s ease; }
#tab-nexcore .btn, #tab-validacao-campo .btn,
#tab-operador .btn { transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease; }
@media (max-width: 640px) {
  #tab-nexcore .nx-row, #tab-validacao-campo .nx-row { flex-direction: column; align-items: stretch; }
  #tab-nexcore .nx-row .btn, #tab-validacao-campo .nx-row .btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  #tab-nexcore .nx-card, #tab-validacao-campo .nx-card, #tab-operador .nx-card,
  #tab-nexcore .btn, #tab-validacao-campo .btn, #tab-operador .btn,
  #tab-validacao-campo .nx-live-dot { transition: none; animation: none; }
}

/* ============================================================================
   F3c — cascata como execucao continua
   O log cresce por append: cada linha nova entra no fim e as anteriores nunca
   sao reescritas. Por isso nao ha innerHTML sobre o container aqui.
   ============================================================================ */

.cascade-progress-detail-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 6px;
  min-height: 18px;
}

.cascade-progress-detail {
  font-size: 11.5px;
  color: var(--ink-muted, var(--ink-faint, #64748b));
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cascade-run-status {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink-muted, var(--ink-faint, #64748b));
  white-space: nowrap;
}

.cascade-live-log-wrap {
  margin: 12px 0 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm, 8px);
  overflow: hidden;
  background: var(--surface, #0b1220);
}

.cascade-live-log-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 12px;
  background: var(--surface-2, #111827);
  border-bottom: 1px solid var(--line);
}

.cascade-live-log-title {
  font-size: 12px;
  font-weight: 800;
  color: var(--ink);
}

.cascade-live-log-hint {
  font-size: 11px;
  color: var(--ink-muted, var(--ink-faint, #64748b));
}

.cascade-live-log {
  height: 132px;
  overflow-y: auto;
  padding: 8px 12px;
  font-family: var(--font-mono, ui-monospace, 'Cascadia Mono', Consolas, monospace);
  font-size: 11.5px;
  line-height: 1.65;
  color: #cbd5e1;
  background: var(--surface, #0b1220);
  scrollbar-width: thin;
}

.cascade-log-line {
  white-space: pre-wrap;
  word-break: break-word;
  animation: cascadeLogIn 0.18s ease-out;
}

.cascade-log-time {
  color: #64748b;
  margin-right: 6px;
  font-variant-numeric: tabular-nums;
}

.cascade-log-line.log-ok { color: #4ade80; }
.cascade-log-line.log-erro { color: #f87171; }
.cascade-log-line.log-aviso { color: #fbbf24; }

.cascade-log-empty {
  color: #64748b;
  font-style: italic;
}

@keyframes cascadeLogIn {
  from { opacity: 0; transform: translateY(2px); }
  to { opacity: 1; transform: none; }
}

/* .btn-xs nao existia no tema e e usado na coluna "ver" da tabela granular */
.btn-xs {
  padding: 2px 8px;
  font-size: 10.5px;
  border-radius: 5px;
  line-height: 1.4;
}

/* card de biro recebe estado DURANTE a execucao */
/* card de biro recebe estado DURANTE a execucao */
.bureau-node-card {
  transition: box-shadow 0.25s ease, opacity 0.25s ease;
}

.bureau-node-card[data-bureau-state="rodando"] {
  box-shadow: inset 3px 0 0 var(--primary, #3b82f6);
}

.bureau-node-card[data-bureau-state="ok"] {
  box-shadow: inset 3px 0 0 var(--success, #22c55e);
}

.bureau-node-card[data-bureau-state="erro"] {
  box-shadow: inset 3px 0 0 var(--danger, #ef4444);
}

/* historico: badge de estado da execucao */
.cascade-history-item {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: space-between;
}

.cascade-history-item.cascade-history-active {
  outline: 2px solid var(--primary, #3b82f6);
  outline-offset: -2px;
}

.cascade-history-state {
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid var(--line);
  white-space: nowrap;
}

.cascade-history-state[data-state="RUNNING"] {
  color: #93c5fd;
  border-color: #3b82f6;
  background: rgba(59, 130, 246, 0.12);
  animation: cascadePulse 1.6s ease-in-out infinite;
}

.cascade-history-state[data-state="PENDING"] {
  color: #fcd34d;
  border-color: var(--warning, #f59e0b);
}

.cascade-history-state[data-state="DONE"] { color: #4ade80; border-color: var(--success, #22c55e); }
.cascade-history-state[data-state="STOPPED"],
.cascade-history-state[data-state="ABANDONED"] {
  color: #fcd34d;
  border-color: var(--warning, #f59e0b);
}
.cascade-history-state[data-state="FAILED"] {
  color: #f87171;
  border-color: var(--danger, #ef4444);
}

@keyframes cascadePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

/* ============================================================================
   Grade de provedores da cascata: 5 colunas fechada, 6 com a lista aberta.
   Com 6 cabem os 6 provedores principais numa linha so, sem quebra.

   ATIVO porem: o pedido foi revertido — a lista de "Provedores selecionados"
   volta a ser a lista detalhada original (`repeat(auto-fill, minmax(200px,1fr)`,
   um item por linha com nome, PRV e preco). A regra fica aqui apenas para
   documentar que a contagem de colunas pertence ao CSS e nunca deve voltar
   como `grid-template-columns` inline, que sabota qualquer classe.
   ============================================================================ */
.cascade-prov-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.cascade-prov-grid.is-open {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

/* ============================================================================
   S14 — Esteira unificada (fila única, visual centralizado)
   ============================================================================ */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.cobranca-page {
  width: 100%;
  max-width: 1480px;
  margin: 24px auto 56px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}
.cobranca-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 28px 32px;
  background: linear-gradient(135deg, var(--surface), var(--surface-2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.cobranca-kicker,
.cobranca-section-label { display: block; color: var(--secondary); font-size: 10px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; }
.cobranca-title { margin: 6px 0 5px; color: var(--ink); font-size: 30px; line-height: 1.1; font-weight: 850; letter-spacing: -0.04em; }
.cobranca-subtitle { margin: 0; max-width: 700px; color: var(--ink-soft); font-size: 13px; line-height: 1.6; }
.cobranca-hero-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; flex-shrink: 0; }
.cobranca-hero-actions .btn { min-width: 176px; min-height: 44px; justify-content: center; }
.cobranca-updated { color: var(--ink-faint); font-size: 11px; font-family: var(--mono); }
.cobranca-summary {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  min-width: 0;
}
.cobranca-summary .stat-card { min-height: 96px; margin: 0; padding: 14px 16px; }
.cobranca-summary .stat-value { font-size: 24px; }
.cobranca-workbench { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 340px); gap: 16px; align-items: start; }
.cobranca-table-card,
.cobranca-side-panel { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.cobranca-table-card { overflow: hidden; }
.cobranca-panel-header,
.cobranca-side-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.cobranca-panel-title { margin: 4px 0 0; color: var(--ink); font-size: 17px; font-weight: 800; }
.cobranca-count { display: inline-flex; align-items: center; justify-content: center; min-width: 88px; min-height: 32px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--ink-soft); background: var(--surface-2); font: 800 11px var(--mono); }
.cobranca-count-live { color: var(--success); background: var(--success-soft); border-color: var(--success-border); }
.cobranca-tabs { display: flex; gap: 2px; padding: 8px 12px 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
.cobranca-tab { display: inline-flex; align-items: center; gap: 7px; min-height: 44px; padding: 0 12px; border: 0; border-bottom: 2px solid transparent; color: var(--ink-soft); background: transparent; font: 700 12px/1 var(--font); white-space: nowrap; cursor: pointer; }
.cobranca-tab span { min-width: 28px; padding: 3px 6px; border-radius: var(--radius-xs); color: var(--ink-faint); background: var(--surface-2); font: 700 10px/1 var(--mono); }
.cobranca-tab:hover { color: var(--ink); background: var(--surface-2); }
.cobranca-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.cobranca-tab.active span { color: var(--primary); background: var(--primary-soft); }
.cobranca-filters { display: flex; align-items: center; gap: 10px; padding: 12px; border-bottom: 1px solid var(--line); }
.cobranca-search { position: relative; flex: 1 1 280px; }
.cobranca-search svg { position: absolute; left: 12px; top: 50%; width: 17px; height: 17px; transform: translateY(-50%); fill: none; stroke: var(--ink-faint); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.cobranca-search input { width: 100%; min-height: 42px; padding: 0 12px 0 38px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--ink); font: 500 13px var(--font); }
.cobranca-select { display: flex; align-items: center; gap: 8px; color: var(--ink-soft); font-size: 12px; font-weight: 700; }
.cobranca-select select { min-height: 42px; padding: 0 30px 0 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--ink); font: 600 12px var(--font); }
.cobranca-group-toggle { display: inline-flex; align-items: center; gap: 8px; min-height: 42px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--ink-soft); font-size: 12px; font-weight: 700; cursor: pointer; }
.cobranca-group-toggle input { width: 15px; height: 15px; accent-color: var(--primary); cursor: pointer; }
.cobranca-warning { margin: 0; padding: 10px 16px; border-bottom: 1px solid var(--line); background: #fffbeb; color: #92400e; font-size: 12px; font-weight: 600; }
.cobranca-search input:focus,
.cobranca-select select:focus,
.cobranca-tab:focus-visible,
.cobranca-filters .btn:focus-visible,
.cobranca-table .btn:focus-visible { outline: 3px solid var(--secondary-border); outline-offset: 2px; }
.cobranca-empty { margin: 0; padding: 56px 20px; color: var(--ink-soft); text-align: center; font-size: 14px; }
.cobranca-table-wrap { overflow: auto; max-height: 640px; }
.cobranca-table { width: 100%; min-width: 760px; border-collapse: separate; border-spacing: 0; font-size: 12.5px; }
.cobranca-table th,
.cobranca-table td { padding: 14px 16px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.cobranca-table thead { position: sticky; top: 0; z-index: 2; background: var(--surface); }
.cobranca-table th { color: var(--ink-faint); font-size: 10px; font-weight: 800; letter-spacing: 0.09em; text-transform: uppercase; white-space: nowrap; }
.cobranca-table tbody tr:hover td { background: var(--surface-2); }
.cobranca-table tbody tr:last-child td { border-bottom: 0; }
.cobranca-channel { display: inline-flex; align-items: flex-start; gap: 7px; min-width: 110px; color: var(--ink-soft); font-size: 11.5px; font-weight: 700; }
.cobranca-kind-dot { width: 8px; height: 8px; margin-top: 4px; flex: 0 0 auto; border-radius: 999px; background: var(--secondary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--secondary) 18%, transparent); }
.cobranca-kind-dot.nexcore { background: var(--success); box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 18%, transparent); }
.cobranca-kind-dot.atendimento { background: var(--warning); box-shadow: 0 0 0 3px color-mix(in srgb, var(--warning) 18%, transparent); }
.cobranca-channel-copy { display: flex; flex-direction: column; gap: 1px; line-height: 1.2; }
.cobranca-channel-title { color: var(--ink); font-size: 11.5px; font-weight: 750; }
.cobranca-channel-sub { color: var(--ink-faint); font-size: 9.5px; font-weight: 650; letter-spacing: 0.05em; }
.cobranca-contact { color: var(--ink); font: 700 12.5px var(--mono); white-space: nowrap; }
.cobranca-context { display: block; margin-top: 3px; color: var(--ink-faint); font-size: 10.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 190px; }
.cobranca-result { max-width: 260px; color: var(--ink-soft); line-height: 1.4; }
.cobranca-status { display: inline-flex; align-items: center; gap: 6px; min-height: 26px; padding: 0 9px; border-radius: 999px; font-size: 11px; font-weight: 750; letter-spacing: 0.01em; }
.cobranca-status::before { content: ""; width: 6px; height: 6px; border-radius: 999px; background: currentColor; }
.cobranca-status.pendente { color: var(--ink-soft); background: var(--surface-2); }
.cobranca-status.respondida { color: #14532d; background: #dcfce7; }
.cobranca-status.sem_resposta { color: #92400e; background: #fef3c7; }
.cobranca-status.erro { color: #991b1b; background: #fee2e2; }
.cobranca-status.esteira { color: #3b0764; background: #f3e8ff; }
.cobranca-status.concluida { color: #0f3d2e; background: #dcfce7; }
.cobranca-status.is-enviado { color: #1e40af; background: #dbeafe; }
.cobranca-status.is-entregue { color: #0e7490; background: #cffafe; }
.cobranca-status.is-lido { color: #166534; background: #dcfce7; }
.cobranca-status.is-respondido { color: #14532d; background: #bbf7d0; }
/* Badge distinto para o status de FILA do NexCore (ISSUE-88), separado do
 * status/result da tentativa. Cor própria (azul) para diferenciar da tentativa. */
.cobranca-status.fila { color: #1e3a8a; background: #dbeafe; }
.cobranca-status.is-fila-queued { color: #1e3a8a; background: #dbeafe; }
.cobranca-status.is-fila-enviado-nexcore { color: #1e3a8a; background: #dbeafe; }
.cobranca-status.is-fila-processado-nexcore { color: #1e3a8a; background: #dbeafe; }
.cobranca-status.is-fila-falha-reatribuicao { color: #991b1b; background: #fee2e2; }
.cobranca-last { max-width: 250px; color: var(--ink-soft); line-height: 1.45; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.cobranca-mono { color: var(--ink-soft); font-family: var(--mono); font-size: 12px; }
.cobranca-when { color: var(--ink-faint); font: 600 11px var(--mono); white-space: nowrap; }
.cobranca-progress { min-width: 132px; }
.cobranca-progress-bar { display: flex; gap: 3px; width: 112px; height: 6px; margin: 0 0 6px; }
.cobranca-progress-bar-lg { width: 100%; height: 8px; margin: 8px 0 6px; }
.cobranca-progress-step { flex: 1; border-radius: 999px; background: var(--surface-3); transition: background 0.2s ease; }
.cobranca-progress-step.done { background: var(--primary); }
.cobranca-progress-value { color: var(--ink-faint); font: 600 10.5px var(--mono); }
.cobranca-table td.cobranca-row-actions { text-align: right; white-space: nowrap; }
.cobranca-action { min-height: 34px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); font: 700 12px var(--font); cursor: pointer; white-space: nowrap; transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease; }
.cobranca-action:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }

/* Detalhe no drawer da esteira */
.cobranca-detail { display: flex; flex-direction: column; gap: 20px; }
.cobranca-detail-head { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.cobranca-detail-head h4 { margin: 0; color: var(--ink); font-size: 17px; font-weight: 700; line-height: 1.3; }
.cobranca-detail-kicker { color: var(--ink-faint); font-size: 10px; font-weight: 800; letter-spacing: 0.09em; text-transform: uppercase; }
.cobranca-detail-progress { display: flex; flex-direction: column; }
.cobranca-detail-label { color: var(--ink-faint); font-size: 10.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.cobranca-detail-hint { margin-top: 6px; color: var(--ink-soft); font-size: 11.5px; }
.cobranca-detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 20px; margin: 0; }
.cobranca-detail-grid dt { margin: 0 0 3px; color: var(--ink-faint); font-size: 10px; font-weight: 800; letter-spacing: 0.07em; text-transform: uppercase; }
.cobranca-detail-grid dd { margin: 0; color: var(--ink); font-size: 12.5px; font-weight: 600; word-break: break-word; }
.cobranca-detail-block { display: flex; flex-direction: column; gap: 8px; }
.cobranca-attendance { padding: 10px 12px; border: 1px solid var(--success-border); border-left: 3px solid var(--success); border-radius: var(--radius-sm); background: var(--success-soft); }
.cobranca-attendance h5 { color: var(--success); }
.cobranca-attendance.is-expired { border-color: var(--danger-border); border-left-color: var(--danger); background: var(--danger-soft); }
.cobranca-attendance.is-expired h5 { color: var(--danger); }
.cobranca-detail-block h5 { margin: 0; color: var(--ink-faint); font-size: 10px; font-weight: 800; letter-spacing: 0.07em; text-transform: uppercase; }
.cobranca-detail-block p { margin: 0; color: var(--ink-soft); font-size: 12.5px; line-height: 1.55; }
.cobranca-message-log { display: flex; flex-direction: column; gap: 8px; max-height: 300px; overflow-y: auto; padding: 4px; }
.cobranca-message-row { align-self: flex-start; max-width: 85%; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--ink); font-size: 12.5px; line-height: 1.45; }
.cobranca-message-row.is-client { align-self: flex-end; background: var(--primary-soft); border-color: var(--primary-border, var(--line-strong)); }
.cobranca-message-time { display: block; margin-top: 4px; color: var(--ink-faint); font-size: 9.5px; font-weight: 600; text-align: right; }
.cobranca-reply { display: flex; gap: 8px; margin-top: 4px; }
.cobranca-reply .input { flex: 1; }
.cobranca-drawer-actions { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 4px; }
.cobranca-drawer-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--ink-soft); font-size: 12px; }
.cobranca-drawer-kicker { color: var(--ink-faint); font-size: 10px; font-weight: 800; letter-spacing: 0.09em; text-transform: uppercase; }
.cobranca-side-empty { margin: 0; padding: 16px; color: var(--ink-faint); font-size: 12.5px; text-align: center; }
.cobranca-side-panel { overflow: hidden; }
.cobranca-side-block { padding: 15px 18px 17px; border-bottom: 1px solid var(--line); }
.cobranca-side-block:last-child { border-bottom: 0; }
.cobranca-side-block-title { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 9px; color: var(--ink-soft); font-size: 11px; font-weight: 800; }
.cobranca-side-block-title span:last-child { min-width: 25px; padding: 2px 6px; border-radius: var(--radius-xs); text-align: center; color: var(--ink); background: var(--surface-2); font-family: var(--mono); }
.cobranca-side-list { display: grid; gap: 4px; }
.cobranca-side-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; width: 100%; min-height: 46px; padding: 7px 8px; border: 0; border-radius: var(--radius-sm); background: transparent; text-align: left; cursor: pointer; }
.cobranca-side-item:hover { background: var(--surface-2); }
.cobranca-side-item:focus-visible { outline: 3px solid var(--secondary-border); outline-offset: 1px; }
.cobranca-side-phone { display: block; color: var(--ink); font: 700 11px var(--mono); }
.cobranca-side-copy { display: block; max-width: 230px; margin-top: 3px; color: var(--ink-faint); font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cobranca-side-badge { padding: 3px 5px; border: 1px solid var(--line); border-radius: var(--radius-xs); color: var(--ink-soft); background: var(--surface-2); font: 700 9px var(--mono); text-transform: uppercase; }
.cobranca-side-empty { margin: 0; padding: 10px 0; color: var(--ink-faint); font-size: 11px; line-height: 1.4; }

@media (max-width: 1180px) {
  .cobranca-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cobranca-workbench { grid-template-columns: 1fr; }
  .cobranca-side-panel { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cobranca-side-header { grid-column: 1 / -1; }
  .cobranca-side-block + .cobranca-side-block { border-left: 1px solid var(--line); }
}
@media (max-width: 800px) {
  main { padding: 14px 12px; }
  .cobranca-page { width: 100%; margin: 8px auto 32px; gap: 12px; }
  .cobranca-hero { align-items: flex-start; flex-direction: column; padding: 20px; }
  .cobranca-title { font-size: 25px; }
  .cobranca-hero-actions { align-items: stretch; width: 100%; }
  .cobranca-hero-actions .btn { width: 100%; }
  .cobranca-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .cobranca-summary .stat-card { min-height: 78px; padding: 11px; }
  .cobranca-panel-header { align-items: flex-start; padding: 13px 14px; }
  .cobranca-filters { align-items: stretch; flex-direction: column; }
  .cobranca-search { flex: 1 1 auto; width: 100%; }
  .cobranca-select { justify-content: space-between; }
  .cobranca-side-panel { display: block; }
  .cobranca-side-block + .cobranca-side-block { border-left: 0; }
}
@media (max-width: 540px) {
  .cobranca-summary { grid-template-columns: 1fr; }
  .cobranca-tabs { padding-inline: 8px; }
  .cobranca-table { min-width: 940px; }
}
@media (prefers-reduced-motion: reduce) {
  .cobranca-tab,
  .cobranca-action,
  .cobranca-side-item { transition: none; }
}


/* ============ Trace Categorizado (grade) ? ISSUE P?s-v1 ============ */
.trace-cat {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.trace-cat-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
}
.trace-cat-body {
  padding: 8px 12px;
  background: var(--surface-2);
}
.trace-cat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px 12px;
}
.trace-cell {
  display: flex;
  flex-direction: column;
  padding: 4px 6px;
  border-radius: 5px;
  background: var(--surface);
  border: 1px solid transparent;
}
.trace-cell.ok {
  border-color: rgba(16, 185, 129, 0.35);
}
.trace-cell-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-faint);
  line-height: 1.4;
}
.trace-cell-value {
  font-size: 12px;
  color: var(--ink);
  font-weight: 600;
  word-break: break-word;
  line-height: 1.45;
}
.trace-cell-ok   { color: #10b981; font-weight: 800; }
.trace-cell-no   { color: var(--ink-faint); font-weight: 600; }
.trace-cell-warn { color: #f59e0b; font-weight: 700; }
.trace-cell-danger { color: #ef4444; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; }
.trace-chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-3, var(--surface));
  border: 1px solid var(--line);
  font-size: 10px;
  font-family: var(--mono);
  color: var(--ink);
  margin: 2px 2px 2px 0;
}
.trace-address {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 8px;
  margin-bottom: 6px;
  background: var(--surface);
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2px 12px;
}
.trace-address-head {
  grid-column: 1 / -1;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 6px;
}
.trace-address-head .atual {
  font-size: 9.5px;
  font-weight: 800;
  padding: 1px 7px;
  border-radius: 999px;
  background: #10b981;
  color: #fff;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.trace-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}
.trace-table thead th {
  text-align: left;
  padding: 4px 6px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--ink-faint);
  border-bottom: 1px solid var(--line);
  letter-spacing: 0.05em;
}
.trace-table tbody td {
  padding: 5px 6px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}
.trace-table tbody tr:last-child td { border-bottom: none; }
.trace-table .doc-mono { font-family: var(--mono); font-size: 10.5px; color: var(--ink-soft); }
@media (max-width: 900px) {
  .trace-cat-grid { grid-template-columns: 1fr; }
  .trace-address  { grid-template-columns: 1fr; }
}

/* Comparador Multi-Biros - grade side-by-side (ISSUE-94) */
.comparador-grid td, .comparador-grid th { vertical-align: top; font-size: 12px; }
.cmp-cell-same { background: rgba(34, 197, 94, 0.10); }
.cmp-cell-divergent { background: rgba(245, 158, 11, 0.16); box-shadow: inset 0 0 0 2px var(--warning, #f59e0b); }
.cmp-cell-winner { background: rgba(34, 197, 94, 0.14); box-shadow: inset 0 0 0 2px var(--success, #22c55e); }
.cmp-cell-missing { background: rgba(148, 163, 184, 0.08); color: var(--ink-faint, #94a3b8); }
.cmp-cell-value { font-family: var(--mono); font-size: 11px; white-space: normal; word-break: break-word; }
.cmp-cell-tag { display: inline-block; margin-top: 6px; font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; padding: 2px 6px; border-radius: 999px; }
.cmp-cell-tag-win { background: var(--success, #22c55e); color: #052e16; }
.cmp-cell-tag-diff { background: var(--warning, #f59e0b); color: #422006; }
.cmp-cell-tag-miss { background: transparent; border: 1px dashed var(--line, #e2e8f0); color: var(--ink-faint, #94a3b8); }
.cmp-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }
.cmp-dot-same { background: #22c55e; }
.cmp-dot-divergent { background: #f59e0b; }
.cmp-dot-winner { background: #16a34a; }
.cmp-dot-missing { background: #cbd5e1; }
