/* Identidad de marca Detona AI, mismos tokens que panel-leads/panel-aprobacion. */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: #12141a;
  color: #f4f2ec;
}

h1, h2, h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0;
}

/* ---- Login ---- */

.lock-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.lock-screen[hidden] {
  display: none;
}

.lock-form {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  width: 100%;
  max-width: 360px;
  padding: 2.25rem 1.75rem;
  text-align: left;
  background: #161920;
  border: 1px solid #23262e;
  border-radius: 16px;
}

.lock-form__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 0.25rem;
}

.lock-form__brand h1 {
  font-size: 1.1rem;
}

.lock-form__sub {
  margin: 0 0 0.5rem;
  color: #8b8f9b;
  font-size: 0.85rem;
}

.lock-form input {
  padding: 0.75rem 0.9rem;
  font-size: 0.95rem;
  font-family: 'Inter', sans-serif;
  border: 1.5px solid #2a2d36;
  border-radius: 9px;
  background: #1c1f27;
  color: #f4f2ec;
}

.lock-form input:focus {
  outline: none;
  border-color: #ff4a26;
}

.lock-form__password-wrapper {
  position: relative;
  display: flex;
}

.lock-form__password-wrapper input {
  flex: 1;
  padding-right: 2.5rem;
}

.lock-form__toggle-password {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 1.05rem;
  padding: 0 0.75rem;
  color: #8b8f9b;
}

.lock-form button[type='submit'] {
  padding: 0.8rem;
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  border-radius: 9px;
  background: #ff4a26;
  color: #12141a;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
}

.lock-form button[type='submit']:hover {
  background: #ff6a4a;
}

.lock-error {
  color: #ff9e85;
  margin: 0;
  font-size: 0.85rem;
}

.lock-success {
  color: #7fd99a;
  margin: 0;
  font-size: 0.85rem;
}

.lock-form__link {
  align-self: flex-start;
  border: none;
  background: transparent;
  color: #8b8f9b;
  font-size: 0.82rem;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}

.lock-form__link:hover {
  color: #ff9e85;
}

.lock-form__link:disabled {
  cursor: default;
  opacity: 0.6;
  text-decoration: none;
}

/* ---- Layout general ---- */

.panel-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 24px 80px;
}

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

.panel-header__brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.panel-header__brand h1 {
  font-size: 1.2rem;
}

.panel-header__usuario {
  display: flex;
  align-items: center;
  gap: 12px;
}

.usuario-actual {
  font-size: 0.85rem;
  color: #c8c9d0;
  font-family: 'JetBrains Mono', monospace;
}

.panel-section {
  margin-bottom: 2rem;
}

.panel-section__titulo {
  font-size: 0.95rem;
  color: #c8c9d0;
  margin-bottom: 1rem;
}

.btn-secundario {
  padding: 0.55rem 1rem;
  border: 1px solid #2a2d36;
  border-radius: 8px;
  background: #161920;
  color: #f4f2ec;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
}

.btn-secundario:hover {
  border-color: #ff4a26;
  color: #ff4a26;
}

.mensaje-vacio {
  color: #5b5e68;
  font-size: 0.95rem;
  text-align: center;
  padding: 60px 20px;
}

/* ---- Resumen (tiles genéricos, reusados en detalle de bot) ---- */

.resumen-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 2rem;
}

.resumen-tile {
  background: #161920;
  border: 1px solid #23262e;
  border-radius: 14px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.resumen-tile__valor {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.8rem;
  color: #ff4a26;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px;
}

.resumen-tile__label {
  font-size: 0.78rem;
  color: #8b8f9b;
  font-family: 'JetBrains Mono', monospace;
}

/* ---- Barra global: saldo por proveedor + selector de período ---- */
/* Persiste en ambas vistas -- el saldo es acumulado real (no por bot, no
   por período), separado a propósito de las tarjetas de bot de abajo. */

.barra-global {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 2rem;
  padding-bottom: 1.75rem;
  border-bottom: 1px solid #23262e;
}

.saldo-proveedores {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.saldo-proveedor-tile {
  background: #161920;
  border: 1px solid #23262e;
  border-radius: 14px;
  padding: 16px 22px;
  min-width: 200px;
}

.saldo-proveedor-tile__label {
  font-size: 0.72rem;
  color: #8b8f9b;
  font-family: 'JetBrains Mono', monospace;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  display: block;
  margin-bottom: 6px;
}

.saldo-proveedor-tile__valor {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.5rem;
  color: #ff4a26;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px;
}

.filtro-periodo {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: end;
}

.filtro-periodo__titulo {
  font-size: 0.75rem;
  color: #8b8f9b;
  font-family: 'JetBrains Mono', monospace;
  align-self: center;
}

.filtro-periodo label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.75rem;
  color: #8b8f9b;
  font-family: 'JetBrains Mono', monospace;
}

.filtro-periodo input {
  padding: 0.5rem 0.6rem;
  border: 1.5px solid #2a2d36;
  border-radius: 8px;
  background: #1c1f27;
  color: #f4f2ec;
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
}

.filtro-periodo input:focus {
  outline: none;
  border-color: #ff4a26;
}

.btn-primario {
  padding: 0.55rem 1.1rem;
  border: none;
  border-radius: 8px;
  background: #ff4a26;
  color: #12141a;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
  font-family: 'Inter', sans-serif;
}

.btn-primario:hover {
  background: #ff6a4a;
}

.barra-global__acciones {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-start;
}

.barra-global__acciones[hidden] {
  display: none;
}

/* ---- Historial de cargas de crédito ---- */

.historial-cargas {
  margin-bottom: 2rem;
}

.historial-cargas[hidden] {
  display: none;
}

.carga-acciones {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.btn-eliminar-definitivo {
  padding: 0.5rem 0.8rem;
  border: none;
  border-radius: 8px;
  background: rgba(255, 74, 38, 0.16);
  color: #ff4a26;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  white-space: nowrap;
}

.btn-eliminar-definitivo:hover {
  background: rgba(255, 74, 38, 0.3);
}

/* ---- Modal genérico (confirmación + formulario de carga) ---- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 11, 14, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 10;
}

.modal-overlay[hidden] {
  display: none;
}

.modal-caja {
  width: 100%;
  max-width: 380px;
  background: #161920;
  border: 1px solid #23262e;
  border-radius: 16px;
  padding: 1.75rem;
  text-align: center;
}

.modal-caja h2 {
  font-size: 1.05rem;
  margin-bottom: 0.6rem;
}

.modal-caja p {
  color: #8b8f9b;
  font-size: 0.88rem;
  margin: 0 0 1.5rem;
}

.modal-caja__acciones {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.modal-form {
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.modal-form label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.78rem;
  color: #8b8f9b;
  font-family: 'JetBrains Mono', monospace;
}

.modal-form input,
.modal-form select {
  padding: 0.65rem 0.8rem;
  font-size: 0.9rem;
  font-family: 'Inter', sans-serif;
  border: 1.5px solid #2a2d36;
  border-radius: 9px;
  background: #1c1f27;
  color: #f4f2ec;
}

.modal-form input:focus,
.modal-form select:focus {
  outline: none;
  border-color: #ff4a26;
}

.modal-form__acciones {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 0.4rem;
}

.modal-form-error {
  color: #ff9e85;
  margin: 0;
  font-size: 0.82rem;
}

.modal-form-error[hidden] {
  display: none;
}

/* ---- Vista 1: grid de bots ---- */

.bots-grid[hidden] {
  display: none;
}

.bots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}

.bot-tile {
  background: #161920;
  border: 1px solid #23262e;
  border-radius: 16px;
  padding: 22px 24px;
  cursor: pointer;
  transition: border-color 0.15s;
}

.bot-tile:hover,
.bot-tile:focus-visible {
  border-color: #ff4a26;
  outline: none;
}

.bot-tile__nombre {
  font-size: 1.05rem;
  margin-bottom: 1.1rem;
}

.bot-tile__metricas {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.bot-tile__metrica {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.bot-tile__valor {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.3rem;
  color: #ff4a26;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px;
}

.bot-tile__label {
  font-size: 0.72rem;
  color: #8b8f9b;
  font-family: 'JetBrains Mono', monospace;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* ---- Marca de "estimado" -- nunca se ve igual que un dato exacto ---- */

.badge-estimado {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 20px;
  background: rgba(255, 158, 133, 0.16);
  color: #ff9e85;
  font-size: 0.62rem;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  vertical-align: middle;
}

.nota-estimado {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #8b8f9b;
  font-size: 0.78rem;
  margin-top: 0.85rem;
}

.nota-estimado[hidden] {
  display: none;
}

.nota-estimado code {
  font-family: 'JetBrains Mono', monospace;
  color: #c8c9d0;
}

/* ---- Vista 2: detalle de bot ---- */

.btn-volver {
  border: none;
  background: transparent;
  color: #8b8f9b;
  cursor: pointer;
  font-size: 0.85rem;
  font-family: 'JetBrains Mono', monospace;
  padding: 0;
  margin-bottom: 1.25rem;
}

.btn-volver:hover {
  color: #ff4a26;
}

.detalle-header {
  margin-bottom: 1.5rem;
}

.detalle-header h2 {
  font-size: 1.3rem;
}

/* ---- Gráfico de gasto diario (SVG a mano) ---- */

.chart-wrapper {
  position: relative;
  background: #161920;
  border: 1px solid #23262e;
  border-radius: 14px;
  padding: 16px;
}

.chart-wrapper svg {
  width: 100%;
  height: 220px;
  display: block;
}

.chart-tooltip {
  position: absolute;
  background: #0a0b0e;
  border: 1px solid #2a2d36;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 0.75rem;
  font-family: 'JetBrains Mono', monospace;
  color: #f4f2ec;
  pointer-events: none;
  white-space: nowrap;
  z-index: 5;
}

.chart-tooltip[hidden] {
  display: none;
}

.chart-caption {
  color: #ff9e85;
  font-size: 0.75rem;
  font-family: 'JetBrains Mono', monospace;
  margin: 0.6rem 0 0;
}

.chart-caption[hidden] {
  display: none;
}

/* ---- Tabla de desglose ---- */

.tabla-costos-wrapper {
  overflow-x: auto;
}

.tabla-costos {
  width: 100%;
  border-collapse: collapse;
  background: #161920;
  border: 1px solid #23262e;
  border-radius: 14px;
  overflow: hidden;
}

.tabla-costos th,
.tabla-costos td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid #23262e;
  font-size: 0.85rem;
  vertical-align: middle;
}

.tabla-costos th {
  color: #8b8f9b;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.tabla-costos tbody tr:last-child td {
  border-bottom: none;
}

.tabla-costos tbody tr:hover {
  background: #1c1f27;
}

.costos-nodo {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  color: #c8c9d0;
}

.costos-total {
  font-weight: 600;
  color: #ff4a26;
  white-space: nowrap;
}
