* { box-sizing: border-box; }
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

.card {
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(51, 65, 85, 0.5);
  border-radius: 12px;
  backdrop-filter: blur(12px);
}

.tab-btn {
  color: #94a3b8;
  background: transparent;
}
.tab-btn:hover {
  color: #e2e8f0;
  background: rgba(51, 65, 85, 0.4);
}
.tab-btn.active {
  color: #fff;
  background: rgba(37, 99, 235, 0.2);
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.status-badge {
  padding: 2px 10px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.status-en-transito { background: rgba(59,130,246,0.15); color: #60a5fa; }
.status-cerrado { background: rgba(34,197,94,0.15); color: #4ade80; }
.status-cancelado { background: rgba(239,68,68,0.15); color: #f87171; }
.status-confirmado { background: rgba(168,85,247,0.15); color: #c084fc; }
.status-por-confirmar { background: rgba(251,191,36,0.15); color: #fbbf24; }
.status-rechazado { background: rgba(239,68,68,0.15); color: #f87171; }
.status-desviado { background: rgba(251,146,60,0.15); color: #fb923c; }
.status-aceptado { background: rgba(34,197,94,0.15); color: #4ade80; }
.status-bajo-reclamo { background: rgba(251,191,36,0.15); color: #fbbf24; }
.status-pagado { background: rgba(34,197,94,0.15); color: #4ade80; }
.status-pago-rechazado { background: rgba(239,68,68,0.15); color: #f87171; }

.doc-present { color: #4ade80; }
.doc-missing { color: #f87171; opacity: 0.5; }

.change-new_row { border-left: 3px solid #4ade80; }
.change-deleted_row { border-left: 3px solid #f87171; }
.change-cell_change { border-left: 3px solid #60a5fa; }
.change-new_column { border-left: 3px solid #c084fc; }
.change-structural { border-left: 3px solid #fbbf24; }

table { width: 100%; }
th { 
  padding: 8px 12px; 
  text-align: left; 
  font-size: 11px; 
  font-weight: 600; 
  color: #94a3b8; 
  text-transform: uppercase; 
  letter-spacing: 0.05em;
  border-bottom: 1px solid rgba(51,65,85,0.5);
  white-space: nowrap;
}
td {
  padding: 8px 12px;
  font-size: 13px;
  border-bottom: 1px solid rgba(51,65,85,0.3);
  white-space: nowrap;
}
tr:hover td { background: rgba(51,65,85,0.2); }

.animate-fade-in {
  animation: fadeIn 0.3s ease-out;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.prog-accordion .prog-body { max-height: 0; overflow: hidden; transition: max-height 0.35s ease; }
.prog-accordion.open .prog-body { max-height: 5000px; }
.prog-accordion .prog-chevron { transition: transform 0.25s ease; }
.prog-accordion.open .prog-chevron { transform: rotate(180deg); }

/* Cashflow Program Detail hierarchy */
.cf-prog-card { border: 1px solid rgba(51,65,85,0.4); border-radius: 10px; overflow: hidden; margin-bottom: 12px; }
.cf-prog-header { cursor: pointer; transition: background 0.2s; }
.cf-prog-header:hover { background: rgba(51,65,85,0.25); }
.cf-prog-body { max-height: 0; overflow: hidden; transition: max-height 0.35s ease; }
.cf-prog-card.open .cf-prog-body { max-height: 8000px; }
.cf-prog-card .cf-chevron { transition: transform 0.25s ease; }
.cf-prog-card.open .cf-chevron { transform: rotate(180deg); }
.cf-po-row { cursor: pointer; transition: background 0.15s; }
.cf-po-row:hover { background: rgba(51,65,85,0.3) !important; }
.cf-calibre-row { display: none; }
.cf-calibre-row.show { display: table-row; }
.cf-po-caret { transition: transform 0.2s ease; display: inline-block; }
.cf-po-caret.open { transform: rotate(90deg); }

/* Layer Toggles */
.ff-layer-toggle {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  border: 1px solid rgba(51,65,85,0.5);
  background: rgba(30,41,59,0.8);
  color: #64748b;
  transition: all 0.2s;
  user-select: none;
}
.ff-layer-toggle:hover { background: rgba(51,65,85,0.6); color: #e2e8f0; }
.ff-layer-toggle.active[data-layer="cargado"] { background: rgba(34,197,94,0.15); border-color: #22c55e; color: #4ade80; cursor: default; }
.ff-layer-toggle.active[data-layer="comprometido"] { background: rgba(59,130,246,0.15); border-color: #3b82f6; color: #60a5fa; }
.ff-layer-toggle.active[data-layer="especulado"] { background: rgba(249,115,22,0.15); border-color: #f97316; color: #fb923c; }
.ff-layer-toggle:not(.active) { opacity: 0.5; }
.ff-layer-card {
  border-radius: 12px;
  padding: 16px 20px;
  border: 1px solid rgba(51,65,85,0.5);
  background: rgba(15,23,42,0.6);
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}
.ff-layer-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
}
.ff-layer-card[data-layer="cargado"]::before { background: #22c55e; }
.ff-layer-card[data-layer="comprometido"]::before { background: #3b82f6; }
.ff-layer-card[data-layer="especulado"]::before { background: #f97316; }
.ff-layer-card.disabled { opacity: 0.35; filter: grayscale(0.5); }
.ff-stacked-bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; margin-top: 10px; }
.margin-positive { color: #4ade80; }
.margin-negative { color: #f87171; }
.margin-bar { height: 6px; border-radius: 3px; transition: width 0.4s ease; }
.po-caret { transition: transform 0.2s ease; }

.kpi-card {
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(51, 65, 85, 0.5);
  border-radius: 12px;
  padding: 16px;
  transition: all 0.2s;
}
.kpi-card:hover {
  border-color: rgba(59, 130, 246, 0.3);
  transform: translateY(-1px);
}
.kpi-card.clickable {
  cursor: pointer;
}
.kpi-card.clickable:hover {
  border-color: rgba(59, 130, 246, 0.5);
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.1);
  transform: translateY(-2px);
}
.kpi-card.clickable::after {
  content: '\f054';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  font-size: 9px;
  color: rgba(148, 163, 184, 0.4);
  position: absolute;
  top: 8px;
  right: 10px;
}
.kpi-card.clickable { position: relative; }

/* FCL Treemap Squarified */
.fcl-treemap-container {
  position: relative;
  width: 100%;
  height: 380px;
  border-radius: 10px;
  overflow: hidden;
}
.tm-cell {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
  transition: filter 0.2s, z-index 0s;
  cursor: default;
  box-sizing: border-box;
  border: 2px solid rgba(15,23,42,0.6);
}
.tm-cell:hover {
  filter: brightness(1.15);
  z-index: 5;
}
.tm-cell .tm-name {
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,0.5);
  line-height: 1.15;
  padding: 0 4px;
  word-break: break-word;
}
.tm-cell .tm-fcl {
  font-weight: 900;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0,0,0,0.4);
  line-height: 1;
}
.tm-cell .tm-pct {
  font-weight: 700;
  color: rgba(255,255,255,0.9);
  text-shadow: 0 1px 3px rgba(0,0,0,0.4);
}
.tm-tooltip {
  position: absolute;
  background: rgba(15,23,42,0.95);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(100,116,139,0.4);
  border-radius: 10px;
  padding: 10px 14px;
  color: #e2e8f0;
  font-size: 12px;
  pointer-events: none;
  z-index: 100;
  white-space: nowrap;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  display: none;
}

/* Inline edit styles */
.edit-input { transition: border-color 0.2s; }
.edit-input:focus { border-color: #3b82f6; box-shadow: 0 0 0 2px rgba(59,130,246,0.2); }
.edit-saved { animation: editFlash 1.5s ease; }
.edit-error { animation: editError 2s ease; }
@keyframes editFlash { 0% { background: rgba(34,197,94,0.3); } 100% { background: transparent; } }
@keyframes editError { 0% { background: rgba(239,68,68,0.3); } 100% { background: transparent; } }
td.cursor-pointer { position: relative; }
td.cursor-pointer::after { content: ''; position: absolute; inset: 0; border-radius: 4px; transition: box-shadow 0.15s; pointer-events: none; }
td.cursor-pointer:hover::after { box-shadow: inset 0 0 0 1px rgba(59,130,246,0.25); }

/* ============================================================
   DASHBOARD OVERHAUL — Pulso del negocio
   ============================================================ */

/* Period toggle (YTD/Q/M/W) */
.dash-period-btn { transition: background 0.15s, color 0.15s; }
.dash-period-btn.active { background: rgba(59, 130, 246, 0.85); color: #fff; }
.dash-period-btn:hover:not(.active) { background: rgba(51, 65, 85, 0.6); color: #e2e8f0; }

/* Hero KPI cards with sparkline */
.kpi-hero {
  background: linear-gradient(135deg, rgba(30,41,59,0.7), rgba(15,23,42,0.7));
  border: 1px solid rgba(51, 65, 85, 0.6);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  overflow: hidden;
  transition: transform 0.15s, border-color 0.15s;
}
.kpi-hero.clickable { cursor: pointer; }
.kpi-hero.clickable:hover { transform: translateY(-2px); border-color: rgba(59, 130, 246, 0.5); }
.kpi-hero .label { font-size: 11px; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.5px; font-weight: 500; display: flex; align-items: center; gap: 6px; }
.kpi-hero .value { font-size: 22px; font-weight: 700; color: #fff; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi-hero .delta { font-size: 11px; font-weight: 600; display: inline-flex; align-items: center; gap: 3px; }
.kpi-hero .delta.up { color: #4ade80; }
.kpi-hero .delta.down { color: #f87171; }
.kpi-hero .delta.flat { color: #64748b; }
.kpi-hero .sparkline { height: 28px; margin-top: 4px; opacity: 0.85; }
.kpi-hero .sparkline svg { width: 100%; height: 100%; }

/* Market mix cards */
.mix-card {
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid rgba(51, 65, 85, 0.6);
  border-radius: 12px;
  padding: 16px;
  position: relative;
  overflow: hidden;
}
.mix-card::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; }
.mix-card.cam::before  { background: #10b981; }
.mix-card.es::before   { background: #3b82f6; }
.mix-card.ch::before   { background: #8b5cf6; }
.mix-card.empty::before { background: #475569; }

/* Risk / pipeline rows */
.risk-row, .pipeline-row, .watchlist-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px;
  background: rgba(15, 23, 42, 0.5);
  border-left: 3px solid transparent;
  font-size: 12px;
  transition: background 0.15s;
  cursor: pointer;
}
.risk-row:hover, .pipeline-row:hover, .watchlist-row:hover { background: rgba(51, 65, 85, 0.4); }
.risk-row.crit { border-left-color: #ef4444; }
.risk-row.warn { border-left-color: #f59e0b; }
.risk-row.info { border-left-color: #3b82f6; }
.risk-row .icon { width: 18px; flex-shrink: 0; text-align: center; }

/* Program ranking row */
.prog-rank-row {
  display: grid;
  grid-template-columns: 18px 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 12px;
}
.prog-rank-row:hover { background: rgba(51, 65, 85, 0.3); cursor: pointer; }
.prog-rank-row .rank { color: #94a3b8; font-weight: 700; font-size: 11px; }
.prog-rank-row .bar { height: 4px; border-radius: 2px; background: rgba(51, 65, 85, 0.5); overflow: hidden; margin-top: 2px; }
.prog-rank-row .bar > div { height: 100%; border-radius: 2px; transition: width 0.5s; }

/* ─── SHIPMENTS COCKPIT — urgency row coloring ─── */
.ship-row-urgent {
  background: linear-gradient(90deg, rgba(244,63,94,0.10) 0%, rgba(244,63,94,0.04) 100%);
  border-left: 3px solid #f43f5e;
}
.ship-row-urgent:hover { background: linear-gradient(90deg, rgba(244,63,94,0.18) 0%, rgba(244,63,94,0.08) 100%); }
.ship-row-soon {
  background: linear-gradient(90deg, rgba(245,158,11,0.08) 0%, rgba(245,158,11,0.02) 100%);
  border-left: 3px solid rgba(245,158,11,0.6);
}
.ship-row-soon:hover { background: linear-gradient(90deg, rgba(245,158,11,0.14) 0%, rgba(245,158,11,0.05) 100%); }
.ship-row-closed { opacity: 0.55; }
.ship-row-closed:hover { opacity: 1; }

/* ============================================================ */
/* Forecast Flow — Strategic View (sliders, hero) */
/* ============================================================ */
.ff-slider {
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: #1e293b;
  border-radius: 3px;
  outline: none;
}
.ff-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #3b82f6;
  border: 2px solid #fff;
  cursor: pointer;
  box-shadow: 0 0 0 2px rgba(59,130,246,0.3);
}
.ff-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #3b82f6;
  border: 2px solid #fff;
  cursor: pointer;
  box-shadow: 0 0 0 2px rgba(59,130,246,0.3);
}
#ff-prob-esp.ff-slider::-webkit-slider-thumb { background: #f97316; box-shadow: 0 0 0 2px rgba(249,115,22,0.3); }
#ff-prob-esp.ff-slider::-moz-range-thumb     { background: #f97316; box-shadow: 0 0 0 2px rgba(249,115,22,0.3); }

/* Profit hero (Dashboard) — eye-catcher giant card */
.profit-hero {
  background: linear-gradient(135deg, rgba(16,185,129,0.12) 0%, rgba(59,130,246,0.10) 50%, rgba(168,85,247,0.10) 100%);
  border: 1px solid rgba(16,185,129,0.30);
  border-radius: 14px;
  padding: 18px 22px;
  position: relative;
  overflow: hidden;
}
.profit-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(800px circle at 20% 50%, rgba(16,185,129,0.08), transparent 40%);
  pointer-events: none;
}
.profit-hero-amount {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 38px;
  line-height: 1;
  font-weight: 800;
  background: linear-gradient(90deg, #10b981, #3b82f6, #a855f7);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: -0.5px;
}
.profit-hero-bar {
  height: 8px;
  background: rgba(15,23,42,0.6);
  border-radius: 4px;
  overflow: hidden;
  display: flex;
}
