/* ==========================================================================
   Enterprise Design System — BV Garantia Brand Palette
   SaaS Enriquecimento Cadastral — Centro de Operações Agênticas
   ========================================================================== */

: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;
}

/* ==========================================================================
   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 */
.provider-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.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;
  }
}

/* ==========================================================================
   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);
}
