:root {
  --bg-deep: #080c14;
  --bg-surface: #0e1524;
  --bg-card: #141c2f;
  --bg-card-hover: #1b2640;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(16, 185, 129, 0.4);
  
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-sub: #64748b;
  
  --accent-emerald: #10b981;
  --accent-emerald-glow: rgba(16, 185, 129, 0.2);
  --accent-cyan: #06b6d4;
  --accent-cyan-glow: rgba(6, 182, 212, 0.2);
  --accent-amber: #f59e0b;
  --accent-amber-glow: rgba(245, 158, 11, 0.2);
  --accent-rose: #f43f5e;
  --accent-purple: #8b5cf6;
  
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
}

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

body.dark-theme {
  background-color: var(--bg-deep);
  color: var(--text-main);
  font-family: var(--font-sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* TOP SOVEREIGN HEADER */
.sovereign-header {
  background: rgba(14, 21, 36, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.brand-icon {
  font-size: 1.6rem;
  filter: drop-shadow(0 2px 8px rgba(6, 182, 212, 0.4));
}

.brand-titles {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: 0.05em;
  background: linear-gradient(135deg, #ffffff 40%, var(--accent-cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-sub {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-sub);
  letter-spacing: 0.08em;
}

.hermes-status-pill {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.75rem;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-emerald);
}

.status-dot.pulsing {
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
  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); }
}

.status-label {
  font-weight: 600;
  color: var(--text-muted);
}

.model-tag {
  background: rgba(139, 92, 246, 0.15);
  color: #c4b5fd;
  border: 1px solid rgba(139, 92, 246, 0.3);
  font-size: 0.65rem;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-family: var(--font-mono);
}

/* CND SENTINEL TRIPOD */
.cnd-tripod {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.cnd-badge {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  font-size: 0.72rem;
  font-family: var(--font-mono);
}

.cnd-badge.ok {
  border-color: rgba(16, 185, 129, 0.3);
  background: rgba(16, 185, 129, 0.05);
  color: #a7f3d0;
}

.cnd-badge.warn {
  border-color: rgba(245, 158, 11, 0.4);
  background: rgba(245, 158, 11, 0.08);
  color: #fde68a;
  animation: pulse-amber 2s infinite;
}

.cnd-icon { font-size: 0.85rem; }
.cnd-name { font-weight: 700; color: #fff; }
.cnd-val { color: var(--accent-emerald); }

.header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-normal);
  border: 1px solid transparent;
}

.btn-sync {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.15), rgba(16, 185, 129, 0.15));
  border: 1px solid rgba(6, 182, 212, 0.4);
  color: #67e8f9;
}

.btn-sync:hover {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.25), rgba(16, 185, 129, 0.25));
  box-shadow: 0 0 16px rgba(6, 182, 212, 0.3);
  transform: translateY(-1px);
}

.telegram-connected-badge {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(0, 136, 204, 0.12);
  border: 1px solid rgba(0, 136, 204, 0.3);
  color: #7dd3fc;
  font-size: 0.75rem;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
}

/* KPI RIBBON */
.kpi-ribbon {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  padding: 1rem 1.5rem;
}

.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.9rem 1.1rem;
  transition: var(--transition-normal);
}

.kpi-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

.kpi-card.highlight {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.08), var(--bg-surface));
  border-color: rgba(16, 185, 129, 0.3);
}

.kpi-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 600;
}

.kpi-value {
  font-family: var(--font-mono);
  font-size: 1.45rem;
  font-weight: 700;
  margin: 0.3rem 0;
  color: #fff;
}

.kpi-sub {
  font-size: 0.7rem;
  color: var(--text-sub);
}

.text-cyan { color: var(--accent-cyan) !important; }
.text-emerald { color: var(--accent-emerald) !important; }
.text-amber { color: var(--accent-amber) !important; }

/* CONTROLS BAR */
.controls-bar {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 0 1.5rem 1rem 1.5rem;
  flex-wrap: wrap;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.85rem;
  flex: 1;
  min-width: 280px;
}

.search-box input {
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-size: 0.85rem;
  width: 100%;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.filter-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.pill-selector {
  display: flex;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 2px;
}

.pill-selector .pill {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.35rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.pill-selector .pill.active {
  background: var(--bg-card-hover);
  color: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.checkbox-container {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  user-select: none;
}

/* KANBAN BOARD */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1rem;
  padding: 0 1.5rem 1.5rem 1.5rem;
  flex: 1;
  overflow-x: auto;
}

.kanban-column {
  background: rgba(14, 21, 36, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  min-width: 270px;
  max-height: calc(100vh - 210px);
}

.kanban-column.highlight-column {
  border-color: rgba(16, 185, 129, 0.25);
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.04), rgba(14, 21, 36, 0.6));
}

.column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
}

.col-title {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: #fff;
}

.col-count {
  background: rgba(255, 255, 255, 0.06);
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-muted);
}

.cards-container {
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  overflow-y: auto;
  flex: 1;
}

/* CUSTOM SCROLLBAR */
.cards-container::-webkit-scrollbar,
.drawer-content::-webkit-scrollbar {
  width: 5px;
}
.cards-container::-webkit-scrollbar-thumb,
.drawer-content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
}

/* OPPORTUNITY CARD */
.opp-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  cursor: pointer;
  transition: var(--transition-normal);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  position: relative;
}

.opp-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(6, 182, 212, 0.4);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mod-tag {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.15rem 0.45rem;
  border-radius: 3px;
  letter-spacing: 0.04em;
}

.mod-tag.dispensa {
  background: rgba(6, 182, 212, 0.15);
  color: #67e8f9;
  border: 1px solid rgba(6, 182, 212, 0.3);
}

.mod-tag.leilao {
  background: rgba(245, 158, 11, 0.15);
  color: #fde68a;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.uf-tag {
  font-size: 0.65rem;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-muted);
}

.card-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: #fff;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-orgao {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.2rem;
  padding-top: 0.45rem;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.card-val {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent-emerald);
}

.card-badge-me {
  font-size: 0.65rem;
  font-weight: 600;
  background: rgba(16, 185, 129, 0.12);
  color: #6ee7b7;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
}

/* DRAWER LATERAL */
.quotation-drawer {
  position: fixed;
  top: 0;
  right: -600px;
  width: 580px;
  height: 100vh;
  background: var(--bg-surface);
  border-left: 1px solid var(--border-subtle);
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.7);
  z-index: 100;
  display: flex;
  flex-direction: column;
  transition: right var(--transition-normal);
}

.quotation-drawer.open {
  right: 0;
}

.drawer-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.drawer-badge {
  font-size: 0.7rem;
  font-weight: 700;
  background: rgba(6, 182, 212, 0.15);
  color: #67e8f9;
  border: 1px solid rgba(6, 182, 212, 0.3);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  display: inline-block;
  margin-bottom: 0.4rem;
}

.drawer-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.3;
}

.drawer-meta {
  font-size: 0.75rem;
  color: var(--text-sub);
  margin-top: 0.25rem;
}

.btn-close-drawer {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.25rem;
  transition: var(--transition-fast);
}

.btn-close-drawer:hover { color: #fff; }

.drawer-content {
  padding: 1.25rem 1.5rem;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.drawer-section {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.75rem;
}

.hermes-brief-box {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.08), var(--bg-card));
  border-color: rgba(139, 92, 246, 0.3);
}

.section-title-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.hermes-veredito-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-sm);
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #6ee7b7;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.hermes-veredito-badge.caution {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.4);
  color: #fde68a;
}

.hermes-veredito-badge.nogo {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}

.hermes-dossier-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.65rem;
  margin: 0.85rem 0;
}

.dossier-card {
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: var(--radius-sm);
  padding: 0.65rem;
}

.dossier-card-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: #a5b4fc;
  margin-bottom: 0.3rem;
}

.dossier-card-body {
  font-size: 0.75rem;
  line-height: 1.4;
  color: #94a3b8;
}

.hermes-summary-text {
  font-size: 0.82rem;
  line-height: 1.5;
  color: #cbd5e1;
  margin-bottom: 0.85rem;
}

.brief-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.chip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  font-size: 0.72rem;
  padding: 0.25rem 0.55rem;
  border-radius: 4px;
  color: var(--text-muted);
}

.chip-link {
  color: var(--accent-cyan);
  border-color: rgba(6, 182, 212, 0.4);
  text-decoration: none;
  font-weight: 600;
}

.chip-link:hover {
  text-decoration: underline;
}

.chip-action {
  background: rgba(99, 102, 241, 0.25);
  border: 1px solid rgba(99, 102, 241, 0.6);
  color: #c7d2fe;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s ease;
}

.chip-action:hover {
  background: rgba(99, 102, 241, 0.45);
  border-color: #818cf8;
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.3);
}

.chip-action.loading {
  opacity: 0.7;
  pointer-events: none;
}

/* ITEMS TABLE */
.table-responsive {
  overflow-x: auto;
}

.items-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.75rem;
}

.items-table th {
  text-align: left;
  padding: 0.5rem;
  color: var(--text-sub);
  border-bottom: 1px solid var(--border-subtle);
  font-weight: 600;
}

.items-table td {
  padding: 0.55rem 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  color: var(--text-main);
}

.items-table input {
  background: var(--bg-deep);
  border: 1px solid var(--border-subtle);
  color: #fff;
  padding: 0.25rem 0.4rem;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  width: 85px;
}

/* CALCULATOR */
.calc-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.calc-input-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.calc-input-group label {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
}

.calc-input-group input {
  background: var(--bg-deep);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.65rem;
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  outline: none;
}

.calc-input-group input:focus {
  border-color: var(--accent-emerald);
}

.profit-banner {
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.profit-metric .p-label {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.profit-metric .p-value {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent-emerald);
}

.profit-verdict {
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #6ee7b7;
}

/* DRAWER ACTIONS */
.drawer-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1.2fr;
  gap: 0.65rem;
  margin-top: auto;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-subtle);
  color: #fff;
}
.btn-secondary:hover { background: rgba(255, 255, 255, 0.1); }

.btn-telegram {
  background: rgba(0, 136, 204, 0.15);
  border-color: rgba(0, 136, 204, 0.4);
  color: #7dd3fc;
}
.btn-telegram:hover { background: rgba(0, 136, 204, 0.25); }

.btn-primary {
  background: linear-gradient(135deg, var(--accent-emerald), #059669);
  color: #fff;
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.3);
}
.btn-primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

/* TOAST */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 200;
}

.toast {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1.1rem;
  font-size: 0.82rem;
  color: #fff;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  animation: slide-in 0.25s ease;
}

@keyframes slide-in {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@media (max-width: 1200px) {
  .kanban-board {
    grid-template-columns: repeat(5, 280px);
  }
}

/* NAV TABS */
.nav-tabs {
  display: flex;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 2px;
}

.nav-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.4rem 0.85rem;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: var(--transition-fast);
}

.nav-tab.active {
  background: var(--bg-card-hover);
  color: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

/* SUPPLIERS VIEW */
.suppliers-section {
  padding: 0 1.5rem 1.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.suppliers-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.sup-header-titles h2 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
}

.sup-header-titles p {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.btn-apify {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.2), rgba(139, 92, 246, 0.2));
  border: 1px solid rgba(6, 182, 212, 0.4);
  color: #a5f3fc;
  box-shadow: 0 2px 12px rgba(6, 182, 212, 0.2);
}
.btn-apify:hover {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.3), rgba(139, 92, 246, 0.3));
  transform: translateY(-1px);
}

.suppliers-filters-bar {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.suppliers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 1rem;
}

.supplier-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: var(--transition-normal);
}

.supplier-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(6, 182, 212, 0.3);
  transform: translateY(-2px);
}

.sup-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.sup-badge-cat {
  font-size: 0.68rem;
  font-weight: 700;
  background: rgba(139, 92, 246, 0.15);
  color: #c4b5fd;
  border: 1px solid rgba(139, 92, 246, 0.3);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}

.sup-uf-tag {
  font-size: 0.72rem;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-muted);
}

.sup-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
}

.sup-legal-name {
  font-size: 0.72rem;
  color: var(--text-sub);
}

.sup-info-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.74rem;
}

.sup-info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sup-info-label { color: var(--text-muted); }
.sup-info-val { font-weight: 600; color: #fff; }
.sup-info-val.emerald { color: var(--accent-emerald); font-family: var(--font-mono); }

.sup-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.btn-whatsapp {
  background: rgba(37, 211, 102, 0.15);
  border: 1px solid rgba(37, 211, 102, 0.4);
  color: #86efac;
  font-size: 0.75rem;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  text-decoration: none;
  font-weight: 600;
  cursor: pointer;
}

.btn-whatsapp:hover {
  background: rgba(37, 211, 102, 0.25);
  box-shadow: 0 0 12px rgba(37, 211, 102, 0.3);
}

/* SUPPLIER SELECTOR IN DRAWER */
.supplier-pick-box {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.06), var(--bg-card));
  border-color: rgba(6, 182, 212, 0.3);
}

.supplier-selector-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.45rem;
}

.supplier-select {
  flex: 1;
  background: var(--bg-deep);
  border: 1px solid var(--border-subtle);
  color: #fff;
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  outline: none;
}

.supplier-details-hint {
  font-size: 0.72rem;
  color: var(--text-sub);
  margin-top: 0.4rem;
}

/* MODAL */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  width: 90%;
  max-width: 480px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.8);
  overflow: hidden;
}

.modal-header {
  padding: 1.1rem 1.35rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.btn-close-modal {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
}

.modal-body {
  padding: 1.35rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.modal-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.modal-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.modal-field label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.modal-field input {
  background: var(--bg-deep);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  color: #fff;
  font-size: 0.85rem;
  outline: none;
}

.modal-field input:focus { border-color: var(--accent-cyan); }

.modal-footer {
  padding: 1rem 1.35rem;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.65rem;
}

/* ========================================================= */
/* ALERTA SOBERANO: SERVIÇOS VS MATERIAIS                    */
/* ========================================================= */
.service-risk-alert {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(245, 158, 11, 0.12));
  border: 1px solid rgba(239, 68, 68, 0.45);
  border-left: 4px solid #ef4444;
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  margin-bottom: 0.5rem;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.1);
}

.service-risk-alert .alert-icon {
  font-size: 1.3rem;
  line-height: 1;
}

.service-risk-alert .alert-title {
  font-size: 0.75rem;
  font-weight: 800;
  color: #fca5a5;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.service-risk-alert .alert-text {
  font-size: 0.74rem;
  color: #fed7aa;
  line-height: 1.45;
}

/* BADGES DE TIPO NOS CARDS KANBAN */
.badge-tipo-material {
  font-size: 0.65rem;
  font-weight: 700;
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 0.12rem 0.4rem;
  border-radius: 4px;
}

.badge-tipo-servico {
  font-size: 0.65rem;
  font-weight: 700;
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 0.12rem 0.4rem;
  border-radius: 4px;
}

/* ========================================================= */
/* FORNECEDORES COMPATÍVEIS NO DRAWER                        */
/* ========================================================= */
.btn-text-link {
  background: transparent;
  border: none;
  color: var(--accent-cyan);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  text-decoration: underline;
  transition: opacity 0.2s;
}

.btn-text-link:hover {
  opacity: 0.8;
}

.matched-suppliers-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.matched-supplier-card {
  background: var(--bg-deep);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.85rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: border-color 0.2s, background 0.2s;
}

.matched-supplier-card:hover {
  border-color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.04);
}

.matched-supplier-card.top-match {
  border-color: rgba(16, 185, 129, 0.4);
  background: rgba(16, 185, 129, 0.04);
}

.ms-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.ms-title-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.ms-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: #fff;
}

.ms-badge-score {
  font-size: 0.65rem;
  font-weight: 800;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.ms-badge-score.medium {
  background: rgba(245, 158, 11, 0.15);
  color: #fde68a;
  border-color: rgba(245, 158, 11, 0.3);
}

.ms-meta {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.ms-reason {
  font-size: 0.68rem;
  color: #67e8f9;
  font-style: italic;
}

.ms-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-whatsapp-compact {
  background: #25d366;
  color: #000;
  font-size: 0.72rem;
  font-weight: 700;
  border: none;
  border-radius: 4px;
  padding: 0.4rem 0.65rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  text-decoration: none;
  transition: transform 0.15s, filter 0.15s;
}

.btn-whatsapp-compact:hover {
  transform: translateY(-1px);
  filter: brightness(1.1);
}

/* ========================================================= */
/* DECOMPOSIÇÃO FINANCEIRA & SIMULADOR                       */
/* ========================================================= */
.btn-auto-simulate {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.25), rgba(16, 185, 129, 0.2));
  color: #67e8f9;
  border: 1px solid rgba(6, 182, 212, 0.5);
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.2s;
}

.btn-auto-simulate:hover {
  background: rgba(6, 182, 212, 0.35);
  color: #fff;
  transform: translateY(-1px);
}

.financial-breakdown-card {
  background: var(--bg-deep);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.65rem;
}

.breakdown-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.breakdown-row.sub {
  padding-left: 0.85rem;
  font-size: 0.78rem;
}

.breakdown-row.highlight-sub {
  background: rgba(6, 182, 212, 0.06);
  padding: 0.35rem 0.65rem;
  border-radius: 4px;
  border-left: 3px solid var(--accent-cyan);
}

.breakdown-row .b-label {
  color: #cbd5e1;
}

.breakdown-row .b-val {
  font-family: var(--font-mono);
  font-weight: 600;
}

.breakdown-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 0.3rem 0;
}

.breakdown-divider.thick {
  height: 2px;
  background: rgba(6, 182, 212, 0.3);
  margin: 0.4rem 0;
}

.slider-control-box {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.slider-inline {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.slider-inline input[type="range"] {
  width: 90px;
  accent-color: var(--accent-cyan);
  cursor: pointer;
}

.slider-inline span {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent-cyan);
  font-size: 0.75rem;
}

.breakdown-row.total {
  padding: 0.5rem 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.profit-highlight-box {
  display: flex;
  flex-direction: column;
}

.profit-title {
  font-size: 0.72rem;
  font-weight: 800;
  color: #94a3b8;
  letter-spacing: 0.05em;
}

.profit-value-large {
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 800;
  color: #10b981;
}

.profit-pct-box {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.2rem;
}

.profit-pct-label {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.profit-pct-badge {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 800;
  color: #10b981;
  background: rgba(16, 185, 129, 0.15);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}

.calc-advanced-details {
  margin-top: 0.5rem;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.calc-advanced-details summary {
  cursor: pointer;
  padding: 0.25rem 0;
  user-select: none;
}

/* ========================================================= */
/* RÉGUA DE LIQUIDAÇÃO & PÓS-VENDA                           */
/* ========================================================= */
.settlement-card {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem 1.15rem;
}

.settlement-desc {
  font-size: 0.74rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 0.75rem;
}

.settlement-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.65rem;
}

.settlement-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.settlement-field label {
  font-size: 0.7rem;
  font-weight: 600;
  color: #94a3b8;
}

.settlement-field input {
  background: var(--bg-deep);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.6rem;
  color: #fff;
  font-size: 0.76rem;
  outline: none;
  font-family: inherit;
}

.settlement-field input:focus {
  border-color: var(--accent-cyan);
}

/* CORES DAS NOVAS COLUNAS KANBAN */
#colEmTransito .column-header .col-title {
  color: #38bdf8;
}

#colLiquidacao .column-header .col-title {
  color: #fbbf24;
}

#colConcluido .column-header .col-title {
  color: #34d399;
}

