:root {
  --azul: #0f2f57;
  --azul-2: #164a7a;
  --celeste: #33a9dc;
  --celeste-suave: #eaf7fc;
  --blanco: #ffffff;
  --gris-50: #f5f8fb;
  --gris-100: #e8eef4;
  --gris-300: #c9d4df;
  --gris-600: #5f6d7a;
  --gris-800: #243241;
  --error: #b42318;
  --ok: #13795b;
  --shadow: 0 18px 45px rgba(15, 47, 87, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--gris-800);
  font-family: Arial, Helvetica, sans-serif;
  background: linear-gradient(180deg, #eef8fd 0%, var(--gris-50) 42%, #ffffff 100%);
}

body.home-page {
  position: relative;
  background: #07111b;
}

body.home-page::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: url("assets/fondo-inicio.png") center / cover no-repeat;
  opacity: 1;
}

body.home-page > * {
  position: relative;
  z-index: 1;
}

a {
  color: inherit;
  text-decoration: none;
}

.topbar {
  background: var(--azul);
  color: var(--blanco);
  border-bottom: 4px solid var(--celeste);
}

.topbar__inner {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.topbar h1 {
  margin: 4px 0 0;
  font-size: clamp(1.35rem, 2.5vw, 2.15rem);
  letter-spacing: 0;
}

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

.brand__logo {
  width: 58px;
  height: 58px;
  flex: 0 0 58px;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.18));
}

.topbar__actions,
.filters__actions,
.form-grid__actions,
.actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.topbar__actions form,
.inline-form {
  margin: 0;
}

.page {
  width: min(1180px, calc(100% - 32px));
  margin: 28px auto 48px;
}

.panel {
  background: var(--blanco);
  border: 1px solid var(--gris-100);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: clamp(18px, 3vw, 28px);
  margin-bottom: 24px;
}

.panel--toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.panel--toolbar h2 {
  margin: 4px 0 0;
  color: var(--azul);
  font-size: 1.35rem;
}

.section-title {
  margin-bottom: 20px;
}

.section-title--split {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.section-title__actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.section-title h2 {
  margin: 4px 0 0;
  color: var(--azul);
  font-size: 1.35rem;
}

.eyebrow {
  margin: 0;
  color: var(--celeste);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.counter {
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--celeste-suave);
  color: var(--azul-2);
  font-weight: 700;
  white-space: nowrap;
}

.collapse-toggle {
  width: 38px;
  height: 38px;
  border: 1px solid var(--gris-300);
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--celeste);
  color: var(--blanco);
  cursor: pointer;
  font: inherit;
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1;
  transition: transform 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.collapse-toggle:hover,
.collapse-toggle:focus-visible {
  background: var(--celeste);
  box-shadow: 0 10px 22px rgba(51, 169, 220, 0.24);
  transform: translateY(-1px);
  outline: none;
}

.collapsible-content {
  display: block;
}

.collapsible-content.is-collapsed {
  display: none;
}

.dashboard-panel {
  display: grid;
  gap: 20px;
}

.status-group {
  display: grid;
  gap: 12px;
}

.status-group + .status-group {
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid var(--gris-100);
}

.status-group__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.status-group__header h3 {
  margin: 0;
  color: var(--azul);
  font-size: 1.05rem;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
}

.status-card {
  border: 1px solid var(--gris-100);
  border-radius: 8px;
  background: #fbfdff;
  padding: 16px;
  display: grid;
  gap: 8px;
  min-height: 132px;
}

.status-card__label,
.status-card__note {
  color: var(--gris-600);
  font-size: 0.84rem;
  font-weight: 700;
}

.status-card strong {
  color: var(--azul);
  font-size: 2rem;
  line-height: 1;
}

.status-card--total {
  border-top: 4px solid var(--celeste);
}

.status-card--ok {
  border-top: 4px solid #16a34a;
}

.status-card--danger {
  border-top: 4px solid #cf334d;
}

.status-card--warning {
  border-top: 4px solid #f59e0b;
}

.status-card--muted {
  border-top: 4px solid var(--gris-300);
}

.form-grid,
.filters {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.filters {
  grid-template-columns: minmax(220px, 1.2fr) minmax(220px, 1fr) auto;
  align-items: end;
  margin-bottom: 18px;
}

label {
  display: grid;
  gap: 7px;
  min-width: 0;
}

label span {
  color: var(--gris-600);
  font-size: 0.9rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--gris-300);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--gris-800);
  background: var(--blanco);
  font: inherit;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

textarea {
  resize: vertical;
  min-height: 92px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--celeste);
  box-shadow: 0 0 0 4px rgba(51, 169, 220, 0.16);
}

.field-error {
  border-color: var(--error);
  box-shadow: 0 0 0 4px rgba(180, 35, 24, 0.12);
}

.form-grid__wide {
  grid-column: 1 / -1;
}

.form-grid__actions {
  grid-column: 1 / -1;
  justify-content: flex-end;
}

.btn,
.btn-icon {
  border: 0;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 15px;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.btn:hover,
.btn-icon:hover {
  transform: translateY(-1px);
}

.btn--primary {
  background: var(--celeste);
  color: var(--blanco);
  box-shadow: 0 10px 22px rgba(51, 169, 220, 0.24);
}

.btn--secondary {
  background: var(--celeste);
  color: var(--blanco);
  box-shadow: 0 10px 22px rgba(51, 169, 220, 0.24);
}

.btn--ghost {
  border: 1px solid rgba(255, 255, 255, 0.42);
  color: var(--blanco);
  background: rgba(255, 255, 255, 0.08);
}

.btn--light {
  background: var(--gris-100);
  color: var(--azul);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--gris-100);
  border-radius: 8px;
}

table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  table-layout: fixed;
  background: var(--blanco);
}

th,
td {
  padding: 12px 13px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--gris-100);
  font-size: 0.94rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
  word-break: normal;
}

th {
  background: var(--azul);
  color: var(--blanco);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  vertical-align: middle;
}

th:nth-child(1),
td:nth-child(1) {
  width: 16%;
}

th:nth-child(2),
td:nth-child(2) {
  width: 25%;
}

th:nth-child(3),
td:nth-child(3),
th:nth-child(4),
td:nth-child(4) {
  width: 13%;
}

th:nth-child(5),
td:nth-child(5) {
  width: 16%;
}

th:nth-child(6),
td:nth-child(6) {
  width: 9%;
  text-align: center;
}

th:nth-child(7),
td:nth-child(7) {
  width: 11%;
}

tbody tr:hover {
  background: var(--celeste-suave);
}

tbody tr:last-child td {
  border-bottom: 0;
}

.empty {
  text-align: center;
  color: var(--gris-600);
  padding: 28px;
}

.empty--compact {
  margin: 0;
  padding: 16px;
}

.btn-icon {
  width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  font-size: 1rem;
  white-space: nowrap;
  border: 1px solid #f2bfc6;
  border-radius: 8px;
  background: #fffafb;
  color: #d8233a;
  box-shadow: none;
}

.btn-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

td.actions {
  text-align: center;
  vertical-align: middle;
  padding-left: 10px;
  padding-right: 10px;
}

.actions__group {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: nowrap;
  min-width: 98px;
}

.actions__group .inline-form {
  flex: 0 0 auto;
}

.actions__group .btn-icon {
  flex: 0 0 44px;
}

.inline-form {
  display: inline-flex;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.alert-editor {
  border: 1px solid #f18b9b;
  border-radius: 8px;
  background: #fff1f3;
  padding: 16px;
  display: grid;
  gap: 14px;
}

.alert-editor__title {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #cf334d;
}

.alert-badge {
  border: 1px solid #ea7890;
  border-radius: 999px;
  padding: 5px 12px;
  color: #cf334d;
  background: #fff7f8;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.alert-editor p {
  margin: 0;
  color: var(--gris-600);
  font-size: 0.92rem;
}

.alert-dot {
  width: 13px;
  height: 13px;
  border-radius: 999px;
  display: inline-block;
  flex: 0 0 13px;
}

.alert-dot--red {
  background: #cf334d;
}

.alert-dot--orange {
  background: #f59e0b;
}

.alert-dot--green {
  background: #16a34a;
}

.alert-cell {
  text-align: center;
}

.alert-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  color: var(--blanco);
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 8px 18px rgba(15, 47, 87, 0.12);
}

.alert-indicator.alert-dot--red {
  background: #cf334d;
}

.alert-indicator.alert-dot--orange {
  background: #f59e0b;
}

.alert-indicator.alert-dot--green {
  background: #16a34a;
}

.muted {
  color: var(--gris-600);
}

.btn-icon--edit {
  background: #fffafb;
  border-color: #f2bfc6;
  color: #d8233a;
}

.btn-icon--delete {
  background: #fffafb;
  border-color: #f2bfc6;
  color: #d8233a;
}

.btn-icon--edit:hover,
.btn-icon--edit:focus-visible {
  background: #fff3f5;
  border-color: #e98f9d;
  color: #b7162b;
  box-shadow: 0 8px 16px rgba(216, 35, 58, 0.12);
}

.btn-icon--delete:hover,
.btn-icon--delete:focus-visible {
  background: #fff3f5;
  border-color: #e98f9d;
  color: #b7162b;
  box-shadow: 0 8px 16px rgba(216, 35, 58, 0.12);
}

.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.pagination a {
  min-width: 38px;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid var(--gris-300);
  color: var(--azul);
  font-weight: 700;
}

.pagination a.is-active {
  background: var(--azul);
  color: var(--blanco);
  border-color: var(--azul);
}

.alert {
  padding: 14px 16px;
  margin-bottom: 16px;
  border-radius: 8px;
  font-weight: 700;
  box-shadow: 0 10px 24px rgba(15, 47, 87, 0.08);
  transition: opacity 0.24s ease, transform 0.24s ease, margin 0.24s ease, padding 0.24s ease;
}

.alert--success {
  background: #e7f6ef;
  color: var(--ok);
  border: 1px solid #bfe7d3;
}

.alert--error {
  background: #fdeceb;
  color: var(--error);
  border: 1px solid #f6c5c0;
}

.alert--hide {
  opacity: 0;
  transform: translateY(-8px);
  margin-bottom: 0;
  padding-top: 0;
  padding-bottom: 0;
  overflow: hidden;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(420px, calc(100% - 36px));
  padding: 14px 16px;
  border-radius: 8px;
  background: var(--azul);
  color: var(--blanco);
  box-shadow: var(--shadow);
  z-index: 20;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.toast--hide {
  opacity: 0;
  transform: translateY(10px);
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 30;
}

.modal.is-open {
  display: flex;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 47, 87, 0.58);
  backdrop-filter: blur(4px);
}

.modal__dialog {
  position: relative;
  width: min(920px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  background: var(--blanco);
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(15, 47, 87, 0.28);
  padding: clamp(18px, 3vw, 28px);
}

.modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.modal__header h2 {
  margin: 4px 0 0;
  color: var(--azul);
  font-size: 1.35rem;
}

.modal__close {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 8px;
  background: var(--gris-100);
  color: var(--azul);
  cursor: pointer;
  font-size: 1.55rem;
  line-height: 1;
  font-weight: 700;
}

body.modal-open {
  overflow: hidden;
}

@media (max-width: 920px) {
  .topbar__inner {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .filters {
    grid-template-columns: 1fr;
  }

  .filters__actions {
    justify-content: flex-start;
  }
}

@media (max-width: 680px) {
  .topbar__inner,
  .page {
    width: min(100% - 20px, 1180px);
  }

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

  .brand__logo {
    width: 48px;
    height: 48px;
    flex-basis: 48px;
  }

  .panel {
    padding: 16px;
  }

  .panel--toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .panel--toolbar .btn {
    width: 100%;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .status-grid {
    grid-template-columns: 1fr;
  }

  .topbar__actions,
  .topbar__actions form,
  .topbar__actions .btn,
  .form-grid__actions,
  .form-grid__actions .btn,
  .form-grid__actions a,
  .filters__actions,
  .filters__actions .btn,
  .filters__actions a {
    width: 100%;
  }

  .section-title--split {
    align-items: flex-start;
    flex-direction: column;
  }
}
