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