/* =========================================================
   WIRTZ HUB · RECURSOS · ACTIVOS FIJOS
   Pantalla compacta, premium y operativa
   ========================================================= */

.assets-page {
  display: grid;
  grid-auto-rows: max-content;
  align-content: start;
  gap: 7px;
  min-height: calc(100vh - var(--topbar-height) - 44px);
  animation: fadeUp 0.2s ease both;
}

/* =========================================================
   HEADER COMPACTO
   ========================================================= */

.assets-head {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-height: 56px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--panel-solid);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.assets-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.assets-brand__icon {
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-soft);
  color: var(--text-strong);
}

.assets-brand__icon .icon {
  width: 15px;
  height: 15px;
}

.assets-brand h2 {
  margin: 0;
  color: var(--text-strong);
  font-size: 13px;
  font-weight: 950;
  line-height: 1;
  letter-spacing: -0.055em;
}

.assets-brand p {
  margin: 2px 0 0;
  max-width: 580px;
  color: var(--muted);
  font-size: 8.5px;
  font-weight: 760;
  line-height: 1.25;
}

.assets-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  flex-wrap: wrap;
}

/* =========================================================
   BUTTONS
   ========================================================= */

.assets-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 26px;
  padding: 5px 8px;
  border-radius: 8px;
  font-size: 8.5px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
  transition:
    background var(--transition),
    border-color var(--transition),
    color var(--transition),
    transform var(--transition),
    opacity var(--transition);
}

.assets-btn .icon {
  width: 11px;
  height: 11px;
  stroke-width: 2;
}

.assets-btn:active {
  transform: scale(0.98);
}

.assets-btn--light {
  border: 1px solid var(--line);
  background: var(--panel-solid);
  color: var(--text-strong);
}

.assets-btn--light:hover {
  border-color: var(--line-strong);
  background: var(--panel-hover);
}

.assets-btn--dark {
  border: 1px solid var(--text-strong);
  background: var(--text-strong);
  color: var(--white);
}

.assets-btn--dark:hover {
  opacity: 0.88;
}

html[data-theme="dark"] .assets-btn--dark {
  color: #090b10;
}

/* =========================================================
   MÉTRICAS COMPACTAS
   ========================================================= */

.assets-metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--panel-solid);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.assets-metric {
  display: grid;
  gap: 3px;
  min-height: 45px;
  padding: 7px 8px;
  border-right: 1px solid var(--line);
  align-content: center;
}

.assets-metric:last-child {
  border-right: 0;
}

.assets-metric span {
  color: var(--muted);
  font-size: 7.2px;
  font-weight: 950;
  letter-spacing: 0.085em;
  line-height: 1;
  text-transform: uppercase;
}

.assets-metric strong {
  color: var(--text-strong);
  font-size: 14px;
  font-weight: 950;
  line-height: 1;
  letter-spacing: -0.06em;
}

.assets-metric small {
  color: var(--muted-2);
  font-size: 7px;
  font-weight: 820;
  line-height: 1;
}

/* =========================================================
   PANEL GENERAL
   ========================================================= */

.assets-panel,
.assets-history {
  display: grid;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--panel-solid);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.assets-toolbar {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 7px;
  border-bottom: 1px solid var(--line);
}

.assets-title {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.assets-title span {
  color: var(--muted);
  font-size: 7.4px;
  font-weight: 950;
  letter-spacing: 0.1em;
  line-height: 1;
  text-transform: uppercase;
}

.assets-title strong {
  color: var(--text-strong);
  font-size: 11.5px;
  font-weight: 950;
  line-height: 1.1;
  letter-spacing: -0.045em;
}

/* =========================================================
   FILTROS
   ========================================================= */

.assets-filters {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  min-width: 0;
  flex-wrap: wrap;
}

.assets-search {
  display: flex;
  align-items: center;
  gap: 6px;
  width: min(390px, 100%);
  min-width: 240px;
  height: 28px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-solid);
  color: var(--muted);
  transition:
    background var(--transition),
    border-color var(--transition);
}

.assets-search:focus-within {
  border-color: var(--line-strong);
  background: var(--panel-hover);
}

.assets-search .icon {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
}

.assets-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text-strong);
  outline: none;
  font-size: 9px;
  font-weight: 780;
}

.assets-search input::placeholder {
  color: var(--muted-2);
}

.assets-filters select {
  height: 28px;
  min-width: 104px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-solid);
  color: var(--text-strong);
  outline: none;
  font-size: 8.5px;
  font-weight: 850;
}

/* =========================================================
   TABLE
   ========================================================= */

.assets-table-wrap {
  width: 100%;
  max-width: 100%;
  overflow: auto;
}

.assets-table {
  width: 100%;
  min-width: 1220px;
  border-collapse: collapse;
  background: var(--panel-solid);
}

.assets-table th,
.assets-table td {
  height: 31px;
  padding: 0 8px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  font-size: 8.6px;
  font-weight: 720;
  text-align: left;
  white-space: nowrap;
  vertical-align: middle;
}

.assets-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--panel-solid);
  color: var(--muted);
  font-size: 7px;
  font-weight: 950;
  letter-spacing: 0.085em;
  text-transform: uppercase;
}

.assets-table tbody tr {
  transition:
    background var(--transition),
    color var(--transition);
}

.assets-table tbody tr:hover {
  background: var(--panel-hover);
}

.assets-table strong {
  color: var(--text-strong);
  font-weight: 950;
}

.assets-code {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--text-strong);
  font-size: 7.5px;
  font-weight: 950;
}

.assets-name {
  display: inline-block;
  max-width: 210px;
  overflow: hidden;
  color: var(--text-strong);
  text-overflow: ellipsis;
  vertical-align: bottom;
}

.assets-kind {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text-strong);
  font-weight: 880;
}

.assets-kind .icon {
  width: 11px;
  height: 11px;
  color: var(--muted);
}

.assets-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 18px;
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--text-strong);
  font-size: 7.5px;
  font-weight: 950;
}

.assets-status::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: var(--muted);
}

.assets-status.is-ok::before {
  background: var(--success);
}

.assets-status.is-service::before {
  background: var(--warning);
}

.assets-status.is-down::before {
  background: var(--danger);
}

.assets-maintenance {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-strong);
  font-weight: 870;
}

.assets-maintenance .icon {
  width: 11px;
  height: 11px;
  color: var(--muted);
}

/* =========================================================
   HISTORIAL ABAJO
   ========================================================= */

.assets-history {
  align-content: start;
}

.assets-history__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 38px;
  padding: 7px 8px;
  border-bottom: 1px solid var(--line);
}

.assets-history__head span {
  color: var(--muted);
  font-size: 7.4px;
  font-weight: 950;
  letter-spacing: 0.1em;
  line-height: 1;
  text-transform: uppercase;
}

.assets-history__head strong {
  display: block;
  margin-top: 2px;
  color: var(--text-strong);
  font-size: 11.5px;
  font-weight: 950;
  line-height: 1;
  letter-spacing: -0.04em;
}

.assets-history__head .icon {
  width: 14px;
  height: 14px;
  color: var(--text-strong);
}

.assets-timeline {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.assets-event {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 7px;
  min-height: 62px;
  padding: 8px;
  border-right: 1px solid var(--line);
}

.assets-event:last-child {
  border-right: 0;
}

.assets-event__icon {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--text-strong);
}

.assets-event__icon .icon {
  width: 12px;
  height: 12px;
}

.assets-event__body {
  display: grid;
  gap: 3px;
  min-width: 0;
  align-content: start;
}

.assets-event__body strong {
  color: var(--text-strong);
  font-size: 9px;
  font-weight: 950;
  line-height: 1.1;
}

.assets-event__body p {
  margin: 0;
  color: var(--muted);
  font-size: 7.8px;
  font-weight: 760;
  line-height: 1.3;
}

.assets-event__body small {
  color: var(--muted-2);
  font-size: 7px;
  font-weight: 850;
  line-height: 1;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 1380px) {
  .assets-head {
    grid-template-columns: 1fr;
  }

  .assets-actions {
    justify-content: flex-start;
  }

  .assets-toolbar {
    grid-template-columns: 1fr;
  }

  .assets-filters {
    justify-content: flex-start;
  }

  .assets-timeline {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .assets-event:nth-child(2n) {
    border-right: 0;
  }

  .assets-event:nth-child(n + 3) {
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 1100px) {
  .assets-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .assets-metric:nth-child(3n) {
    border-right: 0;
  }

  .assets-metric:nth-child(n + 4) {
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 620px) {
  .assets-actions,
  .assets-filters {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .assets-search {
    width: 100%;
    min-width: 0;
  }

  .assets-btn,
  .assets-filters select {
    width: 100%;
  }

  .assets-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .assets-metric {
    border-right: 1px solid var(--line);
    border-top: 1px solid var(--line);
  }

  .assets-metric:nth-child(1),
  .assets-metric:nth-child(2) {
    border-top: 0;
  }

  .assets-metric:nth-child(2n) {
    border-right: 0;
  }

  .assets-timeline {
    grid-template-columns: 1fr;
  }

  .assets-event {
    border-right: 0;
    border-top: 1px solid var(--line);
  }

  .assets-event:first-child {
    border-top: 0;
  }

  .assets-brand {
    align-items: flex-start;
  }
}