/* ==========================================================================
   Panel de Costos de Torre — estilos propios
   Se cargan junto a Tailwind (CDN) en index.php. Sube este archivo a la
   misma carpeta que index.php.
   ========================================================================== */

:root {
  --bg: #0a0a0d;
  --panel: #111114;
  --panel-2: #16161a;
  --border: rgba(255,255,255,0.08);
  --text: #e4e4e7;
  --text-dim: #8b8b93;
  --accent: #8b5cf6;
}

body { font-family: 'Inter', system-ui, sans-serif; background: var(--bg); }
.mono { font-variant-numeric: tabular-nums; }

/* ---------- Layout: barra superior horizontal ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 12px 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
  flex-wrap: wrap;
}
@media (min-width: 768px) { .topbar { padding: 12px 32px; } }

.topbar-brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.topbar-brand .logo-badge {
  width: 34px; height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.topbar-brand .logo-badge svg { width: 18px; height: 18px; color: white; }
.topbar-brand .brand-text { line-height: 1.15; }
.topbar-brand .brand-text .t1 { font-size: 13px; font-weight: 600; color: white; }
.topbar-brand .brand-text .t2 { font-size: 11px; color: var(--text-dim); }

.topbar-nav { display: flex; gap: 2px; flex: 1; flex-wrap: wrap; }
.topbar-nav a {
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--text-dim);
  text-decoration: none;
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.topbar-nav a:hover { background: rgba(255,255,255,0.06); color: white; }

.topbar-actions { display: flex; align-items: center; gap: 16px; flex-shrink: 0; margin-left: auto; }
.topbar-period { font-size: 13px; color: var(--text-dim); }
.topbar-logout {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--text-dim); text-decoration: none;
  padding: 7px 12px; border-radius: 8px; transition: background .15s, color .15s;
}
.topbar-logout svg { width: 15px; height: 15px; }
.topbar-logout:hover { background: rgba(248,113,113,0.08); color: #f87171; }

.main-content-full {
  max-width: 1800px;
  margin: 0 auto;
  padding: 24px 20px 56px;
}
@media (min-width: 768px)  { .main-content-full { padding: 32px 32px 56px; } }
@media (min-width: 1536px) { .main-content-full { padding: 32px 48px 56px; } }

/* ---------- Tarjetas ---------- */
.card {
  background: linear-gradient(180deg, rgba(255,255,255,0.035), rgba(255,255,255,0.015));
  border: 1px solid var(--border);
  border-radius: 16px;
}

.stat-card {
  position: relative;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 18px 16px;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 4px;
}
.stat-card.accent-blue::before   { background: #60a5fa; }
.stat-card.accent-violet::before { background: #a78bfa; }
.stat-card.accent-emerald::before{ background: #34d399; }
.stat-card.accent-red::before    { background: #f87171; }
.stat-card.accent-amber::before  { background: #fbbf24; }

.stat-card .stat-top { display: flex; align-items: flex-start; justify-content: space-between; }
.stat-card .stat-icon {
  width: 34px; height: 34px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-card .stat-icon svg { width: 17px; height: 17px; }
.stat-icon.i-blue    { background: rgba(96,165,250,0.15);  color: #60a5fa; }
.stat-icon.i-violet  { background: rgba(167,139,250,0.15); color: #a78bfa; }
.stat-icon.i-emerald { background: rgba(52,211,153,0.15);  color: #34d399; }
.stat-icon.i-red     { background: rgba(248,113,113,0.15); color: #f87171; }
.stat-icon.i-amber   { background: rgba(251,191,36,0.15);  color: #fbbf24; }

.stat-card .stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-dim); margin-top: 12px; }
.stat-card .stat-value { font-size: 24px; font-weight: 600; color: white; margin-top: 4px; }
.stat-card .stat-sub   { font-size: 12px; margin-top: 8px; }

/* ---------- Tabla responsive con primera columna fija ---------- */
.table-wrap { overflow-x: auto; border-radius: 16px; }
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12.5px; white-space: nowrap; }
.data-table th, .data-table td { padding: 11px 12px; }
.data-table thead th {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-dim); border-bottom: 1px solid var(--border);
  text-align: right; background: var(--panel-2);
}
.data-table thead th:first-child, .data-table td:first-child { text-align: left; }

.data-table td:first-child, .data-table th:first-child {
  position: sticky; left: 0; z-index: 2;
  background: var(--panel-2);
  box-shadow: 2px 0 6px rgba(0,0,0,0.35);
}
.data-table tbody tr:nth-child(even) td:first-child { background: #131317; }
.data-table tbody tr:hover td:first-child { background: #1a1a20; }

.data-table td:last-child, .data-table th:last-child {
  position: sticky; right: 0; z-index: 2;
  background: var(--panel-2);
  box-shadow: -2px 0 6px rgba(0,0,0,0.35);
}
.data-table tbody tr:nth-child(even) td:last-child { background: #131317; }
.data-table tbody tr:hover td:last-child { background: #1a1a20; }

/* Fila de totales: destacada como bloque completo */
.data-table .totales-row td {
  background: #1c1a26;
  border-top: 2px solid rgba(167,139,250,0.4);
}
.data-table .totales-row td:first-child,
.data-table .totales-row td:last-child {
  background: #1c1a26;
}

@media (max-width: 640px) {
  .data-table th, .data-table td { padding: 9px 10px; font-size: 12px; }
}