/* FacturasNGN — styles.css
   Diseño: refinado oscuro-cálido. DM Serif Display + DM Sans */

/* ── VARIABLES ───────────────────────────────────────────── */
:root {
  --bg: #0d0d0f;
  --bg-2: #131316;
  --bg-3: #1a1a1f;
  --bg-4: #202026;
  --bg-5: #27272f;

  --border: rgba(255, 255, 255, 0.07);
  --border-2: rgba(255, 255, 255, 0.13);
  --border-3: rgba(255, 255, 255, 0.2);

  --text: #f0efe8;
  --text-2: #9b9a94;
  --text-3: #5c5b57;

  --accent: #7c6ef0;
  --accent-light: #a59af5;
  --accent-dim: rgba(124, 110, 240, 0.12);
  --accent-border: rgba(124, 110, 240, 0.28);

  --gold: #c9a96e;
  --gold-dim: rgba(201, 169, 110, 0.12);
  --gold-text: #e8c98c;

  --success: #4ade80;
  --danger: #f87171;
  --danger-dim: rgba(248, 113, 113, 0.1);
  --warning: #fbbf24;

  --sidebar-w: 228px;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
  --shadow-sm: 0 2px 12px rgba(0, 0, 0, 0.4);
}

/* ── RESET ───────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html,
body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "DM Sans", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── LAYOUT ──────────────────────────────────────────────── */
body {
  display: flex;
  min-height: 100vh;
}

#sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 50;
}

#main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  padding: 36px 44px 80px;
  max-width: 1240px;
}

/* ── SIDEBAR ─────────────────────────────────────────────── */
#sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px;
  border-bottom: 1px solid var(--border);
}

.brand-logo {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-name {
  font-family: "DM Serif Display", serif;
  font-size: 16px;
  color: var(--text);
  letter-spacing: 0.01em;
}

.btn-menu {
  display: none;
  border: none;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  border-radius: var(--radius-sm);
  padding: 6px;
  margin-left: auto;
}
.btn-menu:hover {
  background: var(--bg-3);
  color: var(--text);
}

#sidebar-nav {
  flex: 1;
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  overflow-y: auto;
}

.nav-group-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-3);
  padding: 8px 10px 4px;
  font-weight: 600;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-2);
  font-size: 13.5px;
  font-family: "DM Sans", sans-serif;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition:
    background 0.12s,
    color 0.12s;
}
.nav-item:hover {
  background: var(--bg-3);
  color: var(--text);
}
.nav-item.activo {
  background: var(--accent-dim);
  color: var(--accent-light);
  border: 1px solid var(--accent-border);
}
.nav-item.activo svg {
  color: var(--accent);
}

#sidebar-footer {
  padding: 14px 10px;
  border-top: 1px solid var(--border);
}

#pill-estado {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-3);
  border-radius: 20px;
  font-size: 12px;
  color: var(--text-3);
  border: 1px solid var(--border);
}

#estado-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-3);
  flex-shrink: 0;
  transition: background 0.3s;
}
#estado-dot.ok {
  background: var(--success);
  box-shadow: 0 0 8px rgba(74, 222, 128, 0.4);
}
#estado-dot.error {
  background: var(--danger);
}

/* ── PAGE HEADER ─────────────────────────────────────────── */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 28px;
  gap: 16px;
}

.page-header h1 {
  font-family: "DM Serif Display", serif;
  font-size: 30px;
  font-weight: 400;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-3);
  margin-top: 3px;
}

/* ── SECCIONES ───────────────────────────────────────────── */
.seccion {
  display: none;
}
.seccion.activa {
  display: block;
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ── KPI CARDS ───────────────────────────────────────────── */
#tarjetas {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  position: relative;
  overflow: hidden;
  transition:
    border-color 0.2s,
    transform 0.2s;
}
.kpi-card:hover {
  border-color: var(--border-2);
  transform: translateY(-1px);
}
.kpi-card.accent {
  background: linear-gradient(135deg, #1a1508 0%, #201c0e 100%);
  border-color: rgba(201, 169, 110, 0.2);
}

.kpi-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
  margin-bottom: 10px;
  font-weight: 500;
}
.kpi-valor {
  font-family: "DM Serif Display", serif;
  font-size: 28px;
  color: var(--text);
  line-height: 1;
}
.kpi-card.accent .kpi-valor {
  color: var(--gold-text);
}
.kpi-moneda {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 4px;
}
.kpi-icon {
  position: absolute;
  bottom: 16px;
  right: 18px;
  color: var(--text-3);
  opacity: 0.35;
}

/* ── DASHBOARD GRID ──────────────────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1.65fr 1fr;
  gap: 14px;
}

.panel {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.panel-titulo {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

#chart-container {
  height: 220px;
  position: relative;
}

.proveedor-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.proveedor-row:last-child {
  border-bottom: none;
}
.proveedor-nombre {
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}
.proveedor-meta {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 1px;
}
.proveedor-total {
  font-size: 13px;
  font-weight: 500;
  color: var(--gold-text);
  text-align: right;
  flex-shrink: 0;
}

.skeleton-row {
  height: 38px;
  background: linear-gradient(
    90deg,
    var(--bg-3) 25%,
    var(--bg-4) 50%,
    var(--bg-3) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}
@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* ── FILTROS ─────────────────────────────────────────────── */
#filtros,
.filtros-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.search-wrap {
  flex: 1;
  min-width: 220px;
  position: relative;
  display: flex;
  align-items: center;
}
.search-wrap svg {
  position: absolute;
  left: 12px;
  color: var(--text-3);
  pointer-events: none;
}
.search-wrap input {
  width: 100%;
  padding: 9px 12px 9px 36px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: "DM Sans", sans-serif;
  font-size: 13.5px;
  outline: none;
  transition: border-color 0.15s;
}
.search-wrap input:focus {
  border-color: var(--accent-border);
}

.filtro-fecha {
  display: flex;
  gap: 10px;
  align-items: center;
}
.filtro-fecha label {
  font-size: 12px;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 6px;
}
.filtro-fecha input[type="date"] {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: "DM Sans", sans-serif;
  font-size: 13px;
  padding: 8px 10px;
  outline: none;
  color-scheme: dark;
}

.select-filtro {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-family: "DM Sans", sans-serif;
  font-size: 13px;
  padding: 8px 12px;
  outline: none;
  cursor: pointer;
  color-scheme: dark;
  transition: border-color 0.15s;
}
.select-filtro:focus {
  border-color: var(--accent-border);
  color: var(--text);
}
/* Panel */
.proveedores-panel {
  margin-top: 36px;
}

/* Header */
.proveedores-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.proveedores-title {
  font-family: 'DM Serif Display', serif;
  font-size: 18px;
  font-weight: 400;
  color: var(--text);
}

/* Formulario */
.proveedor-form {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 16px;
}

.proveedor-form-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-3);
  margin-bottom: 14px;
  font-weight: 600;
}

.proveedor-form-grid {
  gap: 12px;
}

.form-label input {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 13.5px;
  padding: 9px 12px;
  outline: none;
  width: 100%;
}

.full-width {
  grid-column: 1 / -1;
}

/* Acciones */
.proveedor-form-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  justify-content: flex-end;
}

/* Lista */
.proveedores-lista {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.proveedores-loading {
  color: var(--text-3);
  font-size: 13px;
}

/* Items */
.proveedor-equipo-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  gap: 12px;
}

.proveedor-equipo-nombre {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 4px;
}

.proveedor-equipo-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-3);
  align-items: center;
}

/* ── TABLA ───────────────────────────────────────────────── */
.tabla-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 16px;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
thead {
  background: var(--bg-3);
}
th {
  padding: 11px 16px;
  text-align: left;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  border-bottom: 1px solid var(--border);
}
td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
  background: var(--bg-2);
}
tbody tr:last-child td {
  border-bottom: none;
}
tbody tr {
  transition: background 0.12s;
  cursor: pointer;
}
tbody tr:hover td {
  background: var(--bg-3);
}
.text-right {
  text-align: right;
}
td.text-right {
  text-align: right;
  font-weight: 500;
}

.badge-moneda {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  background: var(--bg-4);
  color: var(--text-2);
  border: 1px solid var(--border);
}
.badge-moneda.usd {
  background: var(--gold-dim);
  color: var(--gold-text);
  border-color: rgba(201, 169, 110, 0.2);
}

.badge-estado {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
}
.badge-estado.activo {
  background: rgba(124, 110, 240, 0.12);
  color: var(--accent-light);
  border: 1px solid var(--accent-border);
}
.badge-estado.completado {
  background: rgba(74, 222, 128, 0.1);
  color: var(--success);
  border: 1px solid rgba(74, 222, 128, 0.2);
}
.badge-estado.cancelado {
  background: rgba(248, 113, 113, 0.1);
  color: var(--danger);
  border: 1px solid rgba(248, 113, 113, 0.2);
}
.badge-estado.disponible {
  background: rgba(74, 222, 128, 0.1);
  color: var(--success);
  border: 1px solid rgba(74, 222, 128, 0.2);
}
.badge-estado.agotado {
  background: rgba(248, 113, 113, 0.1);
  color: var(--danger);
  border: 1px solid rgba(248, 113, 113, 0.2);
}

.emisor-nombre {
  font-weight: 500;
  color: var(--text);
}
.emisor-legal {
  font-size: 11.5px;
  color: var(--text-3);
  margin-top: 1px;
}
.estado-vacio {
  text-align: center;
  padding: 48px !important;
  color: var(--text-3);
}

/* ── PAGINACIÓN ──────────────────────────────────────────── */
#paginacion,
#paginacion-proyectos {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
#paginacion button,
#paginacion-proyectos button {
  padding: 6px 12px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-family: "DM Sans", sans-serif;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.12s;
}
#paginacion button:hover,
#paginacion-proyectos button:hover {
  border-color: var(--border-2);
  color: var(--text);
}
#paginacion button.activa,
#paginacion-proyectos button.activa {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 500;
}

/* ── PROYECTOS GRID ──────────────────────────────────────── */
.proyectos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.proyecto-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  cursor: pointer;
  transition:
    border-color 0.15s,
    transform 0.15s;
  position: relative;
}
.proyecto-card:hover {
  border-color: var(--border-2);
  transform: translateY(-1px);
}
.proyecto-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}
.proyecto-numero {
  font-size: 11px;
  color: var(--accent-light);
  font-weight: 500;
  letter-spacing: 0.04em;
}
.proyecto-nombre {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 4px;
  line-height: 1.3;
}
.proyecto-cliente {
  font-size: 12.5px;
  color: var(--text-3);
  margin-bottom: 14px;
}
.proyecto-meta {
  display: flex;
  gap: 14px;
  font-size: 12px;
  color: var(--text-3);
  border-top: 1px solid var(--border);
  padding-top: 12px;
  margin-top: 4px;
}
.proyecto-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.estado-vacio-card {
  grid-column: 1 / -1;
  text-align: center;
  padding: 56px 24px;
  color: var(--text-3);
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* ── EQUIPOS GRUPOS ──────────────────────────────────────── */
.equipo-grupo {
  margin-bottom: 28px;
}
.equipo-grupo-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.equipo-grupo-icono {
  font-size: 18px;
}
.equipo-grupo-nombre {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.equipo-grupo-count {
  font-size: 11px;
  color: var(--text-3);
  margin-left: auto;
}

.equipos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
}

.equipo-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  transition: border-color 0.15s;
}
.equipo-card:hover {
  border-color: var(--border-2);
}
.equipo-card.agotado {
  opacity: 0.55;
}
.equipo-nombre {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 4px;
  line-height: 1.3;
}
.equipo-modelo {
  font-size: 11.5px;
  color: var(--text-3);
  margin-bottom: 10px;
}
.equipo-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-3);
}
.equipo-stock {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.equipo-proveedor {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 6px;
}
.equipo-acciones {
  display: flex;
  gap: 6px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.equipo-garantia {
  font-size: 11px;
  margin-top: 6px;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.equipo-garantia.ok {
  background: rgba(74, 222, 128, 0.1);
  color: var(--success);
}
.equipo-garantia.warning {
  background: rgba(251, 191, 36, 0.1);
  color: var(--warning);
}
.equipo-garantia.expired {
  background: rgba(248, 113, 113, 0.1);
  color: var(--danger);
}

/* ── ZONA SUBIDA ─────────────────────────────────────────── */
#zonaSubida {
  border: 1.5px dashed var(--border-2);
  border-radius: var(--radius);
  padding: 60px 24px;
  text-align: center;
  cursor: pointer;
  transition:
    border-color 0.2s,
    background 0.2s;
  max-width: 540px;
}
#zonaSubida.drag-over {
  border-color: var(--accent);
  background: var(--accent-dim);
}
.zona-icono {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--bg-3);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 18px;
  color: var(--text-3);
}
.zona-titulo {
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
}
.zona-sub {
  font-size: 13px;
  color: var(--text-3);
  margin-bottom: 22px;
}
#zonaSubida input[type="file"] {
  display: none;
}

.resultado-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  padding: 16px 20px;
  background: rgba(124, 110, 240, 0.08);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius);
}
.resultado-icono-ok {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-light);
  flex-shrink: 0;
}
.resultado-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}
.resultado-campo {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
}
.resultado-campo-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  margin-bottom: 3px;
}
.resultado-campo-valor {
  font-size: 14px;
  color: var(--text);
  font-weight: 500;
}
.resultado-acciones {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

/* ── FORMULARIOS ─────────────────────────────────────────── */
.form-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 14px;
}
.form-card-titulo {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
  margin-bottom: 18px;
  font-weight: 600;
}
.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.form-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
}
.form-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-2);
}
.form-label input,
.form-label select,
.form-label textarea {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: "DM Sans", sans-serif;
  font-size: 13.5px;
  padding: 9px 12px;
  outline: none;
  transition: border-color 0.15s;
  color-scheme: dark;
}
.form-label input:focus,
.form-label select:focus,
.form-label textarea:focus {
  border-color: var(--accent-border);
}
.form-label input[readonly] {
  color: var(--text-3);
  cursor: default;
}
.form-label textarea {
  resize: vertical;
  min-height: 72px;
}
.form-acciones {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}

.item-formulario {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 10px;
}
.item-formulario-encabezado {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-size: 11px;
  color: var(--text-3);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.item-formulario-campos {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 10px;
}
.item-formulario-campos label {
  font-size: 11.5px;
  color: var(--text-3);
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.item-formulario-campos input {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: "DM Sans", sans-serif;
  font-size: 13px;
  padding: 7px 10px;
  outline: none;
  transition: border-color 0.15s;
}
.item-formulario-campos input:focus {
  border-color: var(--accent-border);
}
.item-total-linea {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-3);
  text-align: right;
}
.item-total-linea strong {
  color: var(--accent-light);
}

/* ── MODAL ───────────────────────────────────────────────── */
#overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  z-index: 100;
  backdrop-filter: blur(3px);
}
#modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 780px;
  max-height: 88vh;
  overflow-y: auto;
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  border-radius: 16px;
  z-index: 101;
  box-shadow:
    var(--shadow),
    0 0 0 1px rgba(255, 255, 255, 0.03);
}
#modalEncabezado {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg-2);
  z-index: 2;
  gap: 12px;
}
.modal-titulo-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
#modalTitulo {
  font-family: "DM Serif Display", serif;
  font-size: 18px;
  font-weight: 400;
  color: var(--text);
}
#modalSubtitulo {
  font-size: 12px;
  color: var(--text-3);
}
.modal-acciones {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}
#modalCuerpo {
  padding: 24px;
}
#modalPie {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  position: sticky;
  bottom: 0;
  background: var(--bg-2);
}

.modal-seccion {
  margin-bottom: 24px;
}
.modal-seccion-titulo {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
  margin-bottom: 14px;
  font-weight: 600;
}
.grilla-datos {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.campo-dato {
  padding: 10px 14px;
  background: var(--bg-3);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.campo-dato label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  display: block;
  margin-bottom: 4px;
}
.campo-dato p {
  font-size: 13.5px;
  color: var(--text);
  font-weight: 500;
}
.campo-dato input.editable,
.campo-dato textarea.editable {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: "DM Sans", sans-serif;
  font-size: 13.5px;
  padding: 7px 10px;
  outline: none;
}
.campo-dato textarea.editable {
  resize: vertical;
  min-height: 64px;
}

.caja-totales {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
}
.fila-total {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 13.5px;
  color: var(--text-2);
}
.fila-total.grande {
  border-top: 1px solid var(--border-2);
  margin-top: 10px;
  padding-top: 12px;
  font-size: 17px;
  font-weight: 500;
  color: var(--text);
}
.fila-total.grande span:last-child {
  color: var(--gold-text);
}

/* Detalle proyecto en modal */
.proyecto-facturas-lista {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.proyecto-factura-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.proyecto-factura-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.proyecto-factura-item-nombre {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}
.proyecto-factura-item-meta {
  font-size: 11.5px;
  color: var(--text-3);
}

.select-en-modal {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: "DM Sans", sans-serif;
  font-size: 13.5px;
  padding: 9px 12px;
  outline: none;
  width: 100%;
  color-scheme: dark;
  transition: border-color 0.15s;
}
.select-en-modal:focus {
  border-color: var(--accent-border);
}

/* ── BOTONES ─────────────────────────────────────────────── */
button {
  font-family: "DM Sans", sans-serif;
  cursor: pointer;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  transition:
    opacity 0.15s,
    transform 0.1s;
}
.btn-primary:hover {
  opacity: 0.88;
}
.btn-primary:active {
  transform: scale(0.98);
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  transition: all 0.12s;
}
.btn-ghost:hover {
  background: var(--bg-3);
  color: var(--text);
  border-color: var(--border-2);
}
.btn-ghost.btn-danger {
  color: var(--danger);
}
.btn-ghost.btn-danger:hover {
  background: var(--danger-dim);
  border-color: rgba(248, 113, 113, 0.2);
}
.btn-ghost.btn-success {
  color: var(--success);
}
.btn-ghost.btn-success:hover {
  background: rgba(74, 222, 128, 0.08);
  border-color: rgba(74, 222, 128, 0.2);
}
.btn-sm {
  padding: 6px 12px;
  font-size: 12.5px;
}
.btn-xs {
  padding: 4px 10px;
  font-size: 12px;
}

.btn-link {
  background: transparent;
  border: none;
  color: var(--accent-light);
  font-size: 12.5px;
  cursor: pointer;
  padding: 0;
  font-family: "DM Sans", sans-serif;
  transition: opacity 0.15s;
}
.btn-link:hover {
  opacity: 0.7;
}

.section-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-3);
  margin: 18px 0 10px;
  font-weight: 600;
}
.muted {
  font-size: 13px;
  color: var(--text-3);
  margin-top: 2px;
}

/* ── CARGANDO ────────────────────────────────────────────── */
#cargando {
  position: fixed;
  inset: 0;
  background: rgba(13, 13, 15, 0.85);
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  backdrop-filter: blur(4px);
}
.spinner {
  width: 28px;
  height: 28px;
  border: 2.5px solid var(--border-2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
#textoCargando {
  font-size: 14px;
  color: var(--text-2);
}

/* ── NOTIFICACIONES ──────────────────────────────────────── */
#contenedorNotificaciones {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.notificacion {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  max-width: 320px;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideIn 0.2s ease;
  box-shadow: var(--shadow);
}
@keyframes slideIn {
  from {
    transform: translateX(20px);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}
.notificacion.exito {
  background: var(--bg-3);
  border: 1px solid rgba(74, 222, 128, 0.3);
  color: var(--success);
}
.notificacion.error {
  background: var(--bg-3);
  border: 1px solid rgba(248, 113, 113, 0.3);
  color: var(--danger);
}
.notificacion.info {
  background: var(--bg-3);
  border: 1px solid var(--accent-border);
  color: var(--accent-light);
}

/* ── RESPONSIVE ──────────────────────────────────────────── */
@media (max-width: 1024px) {
  #tarjetas {
    grid-template-columns: 1fr 1fr;
  }
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  :root {
    --sidebar-w: 56px;
  }
  #sidebar {
    width: 56px;
  }
  .btn-menu {
    display: inline-flex;
  }
  #sidebar-nav {
    display: none;
  }
  #sidebar.sidebar-open #sidebar-nav {
    display: flex;
    width: var(--sidebar-w);
  }
  .brand-name,
  .nav-item span,
  .nav-group-label,
  #sidebar-footer {
    display: none;
  }
  .nav-item {
    justify-content: center;
    padding: 12px;
  }
  #main {
    padding: 24px 20px 40px;
    margin-left: 56px;
  }
  .grilla-datos {
    grid-template-columns: 1fr;
  }
  .form-grid-2,
  .form-grid-3 {
    grid-template-columns: 1fr;
  }
  .item-formulario-campos {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 680px) {
  .btn-menu {
    display: inline-flex;
  }
  #sidebar {
    width: 100%;
    height: auto;
    position: fixed;
    top: 0;
    left: 0;
    flex-direction: column;
    z-index: 100;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  #sidebar-brand {
    padding: 10px 12px;
    border-bottom: none;
  }
  .brand-name {
    display: inline-flex;
  }
  .btn-menu {
    display: inline-flex;
  }
  #sidebar-nav {
    display: none;
    flex-direction: column;
    gap: 4px;
    padding: 8px;
  }
  #sidebar.sidebar-open #sidebar-nav {
    display: flex;
    width: 100%;
  }
  .nav-item span {
    display: inline;
  }
  .nav-group-label {
    display: block;
  }
  #sidebar-footer {
    display: none;
  }
  #main {
    margin-left: 0;
    padding-top: 70px;
  }
  #tarjetas {
    grid-template-columns: 1fr 1fr;
  }
  .proyectos-grid {
    grid-template-columns: 1fr;
  }
  .equipos-grid {
    grid-template-columns: 1fr;
  }
  table th:nth-child(3),
  table td:nth-child(3),
  table th:nth-child(5),
  table td:nth-child(5) {
    display: none;
  }
}

@media (max-width: 480px) {
  #tarjetas {
    grid-template-columns: 1fr;
  }
  #main {
    padding-top: 62px;
    padding-left: 16px;
    padding-right: 16px;
  }
  .page-header h1 {
    font-size: 24px;
  }
}
