:root {
  --navy: #17365d;
  --blue: #1f4e78;
  --blue2: #2f75b5;

  --bg: #f3f6fa;
  --card: #ffffff;

  --text: #17202a;
  --muted: #637083;

  --line: #d9e2ec;

  --green: #207a45;
  --green-bg: #e7f5ed;

  --amber: #9a6700;
  --amber-bg: #fff4d6;

  --red: #a61b1b;
  --red-bg: #fdeaea;

  --shadow: 0 6px 18px rgba(23, 54, 93, 0.07);
}


/* =========================================================
   CONFIGURACIÓN GENERAL
   ========================================================= */

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: Inter, Segoe UI, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}

.hidden {
  display: none !important;
}


/* =========================================================
   LOGIN
   ========================================================= */

.center-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(430px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px;
  box-shadow: var(--shadow);
}

.brand {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  background: var(--navy);
  color: white;
  display: grid;
  place-items: center;

  font-weight: 800;
  font-size: 19px;

  margin-bottom: 15px;
}

h1,
h2 {
  margin: 0.15rem 0 0.35rem;
}

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

.help-text {
  font-size: 12px;
  color: var(--muted);
  margin-top: 18px;
  line-height: 1.45;
}

.stack {
  display: grid;
  gap: 14px;
  margin-top: 20px;
}


/* =========================================================
   FORMULARIOS
   ========================================================= */

label {
  display: grid;
  gap: 6px;

  font-weight: 600;
  font-size: 13px;
  color: #344050;
}

input,
select,
textarea {
  width: 100%;

  border: 1px solid #c8d3df;
  border-radius: 9px;

  background: white;

  padding: 9px 11px;

  font: inherit;
  color: var(--text);

  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue2);
  box-shadow: 0 0 0 3px rgba(47, 117, 181, 0.12);
}

input[readonly] {
  background: #eef2f6;
  color: #596675;
}


/* =========================================================
   BOTONES
   ========================================================= */

button {
  font: inherit;
}

.btn {
  border: 0;
  border-radius: 9px;

  padding: 8px 13px;

  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.primary {
  background: var(--blue);
  color: white;
}

.primary:hover {
  background: var(--navy);
}

.secondary {
  background: #e9eef5;
  color: #2b3c50;
}

.ghost {
  background: transparent;
  color: inherit;

  border: 1px solid rgba(255, 255, 255, 0.35);
}

.danger {
  background: var(--red-bg);
  color: var(--red);
}


/* =========================================================
   ENCABEZADO SUPERIOR
   ========================================================= */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;

  gap: 16px;

  background: var(--navy);
  color: white;

  padding: 8px 22px;

  min-height: 54px;

  position: sticky;
  top: 0;

  z-index: 20;

  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.topbar h1 {
  font-size: 18px;
  margin: 1px 0;
}

.eyebrow {
  font-size: 9px;

  font-weight: 800;

  letter-spacing: 0.12em;
  text-transform: uppercase;

  opacity: 0.76;
}

.account {
  display: flex;
  align-items: center;

  gap: 10px;

  font-size: 12px;
}

.topbar .btn {
  padding: 6px 11px;
}


/* =========================================================
   CONTENIDO PRINCIPAL
   ========================================================= */

.content {
  max-width: 1600px;

  margin: 0 auto;

  padding: 12px 18px;
}


/* =========================================================
   TARJETAS DE RESUMEN
   ========================================================= */

.stats {
  display: grid;

  grid-template-columns: repeat(3, minmax(0, 1fr));

  gap: 10px;

  margin-bottom: 10px;
}

.stats article {
  background: white;

  border: 1px solid var(--line);

  border-radius: 10px;

  padding: 9px 16px;

  box-shadow: var(--shadow);
}

.stats span {
  display: block;

  color: var(--muted);

  font-size: 11px;

  margin-bottom: 1px;
}

.stats strong {
  font-size: 23px;

  line-height: 1.1;

  color: var(--navy);
}


/* =========================================================
   TARJETAS GENERALES
   ========================================================= */

.card {
  background: white;

  border: 1px solid var(--line);

  border-radius: 11px;

  box-shadow: var(--shadow);
}


/* =========================================================
   BARRA DE BÚSQUEDA Y FILTROS
   ========================================================= */

.toolbar {
  display: grid;

  grid-template-columns:
    minmax(260px, 1fr)
    190px
    190px
    auto
    auto;

  gap: 8px;

  padding: 8px 10px;

  margin-bottom: 10px;
}

.toolbar input,
.toolbar select {
  padding: 7px 10px;

  height: 38px;
}

.toolbar .btn {
  height: 38px;

  padding: 7px 12px;
}

.search {
  min-width: 0;
}


/* =========================================================
   TABLA
   ========================================================= */

.table-card {
  overflow: hidden;

  margin-top: 0;
}

.table-wrap {
  overflow: auto;

  max-height: calc(100vh - 245px);
}

table {
  width: 100%;

  border-collapse: separate;
  border-spacing: 0;

  min-width: 1180px;
}

th {
  position: sticky;
  top: 0;

  background: var(--navy);
  color: white;

  padding: 8px 9px;

  text-align: left;

  font-size: 11px;

  z-index: 2;
}

td {
  padding: 7px 9px;

  border-bottom: 1px solid var(--line);

  vertical-align: top;

  font-size: 12px;
}

tbody tr:nth-child(even) {
  background: #f8fbfd;
}

tbody tr:hover {
  background: #edf5fb;
}

.id-cell {
  font-weight: 800;

  color: var(--navy);

  white-space: nowrap;
}

.conv-cell {
  text-align: center;

  font-weight: 700;
}

.obs-cell {
  min-width: 300px;

  white-space: pre-wrap;
}


/* =========================================================
   ESTADOS
   ========================================================= */

.status {
  display: inline-flex;

  padding: 4px 8px;

  border-radius: 999px;

  font-size: 11px;

  font-weight: 800;
}

.status.pendiente {
  color: var(--amber);

  background: var(--amber-bg);
}

.status.subsanado {
  color: var(--green);

  background: var(--green-bg);
}


/* =========================================================
   BOTÓN EDITAR
   ========================================================= */

.action-btn {
  border: 1px solid var(--line);

  background: white;

  border-radius: 7px;

  padding: 5px 9px;

  cursor: pointer;

  color: var(--blue);

  font-size: 12px;
}


/* =========================================================
   MENSAJE CUANDO NO HAY DATOS
   ========================================================= */

.empty {
  text-align: center;

  padding: 40px;

  color: var(--muted);
}


/* =========================================================
   MODAL NUEVO / EDITAR DESCARGO
   ========================================================= */

dialog {
  border: 0;

  padding: 0;

  border-radius: 14px;

  width: min(850px, calc(100% - 28px));

  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.28);
}

dialog::backdrop {
  background: rgba(10, 25, 42, 0.58);
}

.modal {
  padding: 22px;
}

.modal-head {
  display: flex;

  justify-content: space-between;

  align-items: flex-start;

  margin-bottom: 18px;
}

.modal-head h2 {
  font-size: 22px;
}

.icon-btn {
  border: 0;

  background: #edf1f5;

  width: 34px;
  height: 34px;

  border-radius: 50%;

  font-size: 22px;

  cursor: pointer;
}


/* =========================================================
   FORMULARIO DEL MODAL
   ========================================================= */

.form-grid {
  display: grid;

  grid-template-columns: repeat(2, minmax(0, 1fr));

  gap: 13px;
}

.span-2 {
  grid-column: span 2;
}

.modal-actions {
  display: flex;

  align-items: center;

  gap: 9px;

  margin-top: 18px;
}

.grow {
  flex: 1;
}


/* =========================================================
   NOTIFICACIONES
   ========================================================= */

.toast {
  position: fixed;

  right: 20px;
  bottom: 20px;

  z-index: 1000;

  max-width: min(430px, calc(100% - 40px));

  padding: 12px 15px;

  border-radius: 9px;

  background: #152638;
  color: white;

  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22);

  transform: translateY(120px);

  opacity: 0;

  transition: 0.25s;
}

.toast.show {
  transform: translateY(0);

  opacity: 1;
}

.toast.error {
  background: #8e1e1e;
}


/* =========================================================
   CARGANDO
   ========================================================= */

.spinner {
  width: 42px;
  height: 42px;

  border: 4px solid #d8e0e8;

  border-top-color: var(--blue);

  border-radius: 50%;

  animation: spin 0.8s linear infinite;

  margin: auto;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}


/* =========================================================
   TABLET
   ========================================================= */

@media (max-width: 900px) {

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

  .toolbar .search {
    grid-column: span 2;
  }

  .stats {
    grid-template-columns: repeat(3, 1fr);
  }

  .table-wrap {
    max-height: none;
  }

  .topbar {
    align-items: flex-start;

    padding: 10px 14px;
  }

  .account {
    flex-direction: column;

    align-items: flex-end;
  }

}


/* =========================================================
   CELULAR
   ========================================================= */

@media (max-width: 620px) {

  .content {
    padding: 8px;
  }

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

  .toolbar .search {
    grid-column: auto;
  }

  .stats {
    grid-template-columns: repeat(3, 1fr);

    gap: 5px;
  }

  .stats article {
    padding: 8px;
  }

  .stats span {
    font-size: 9px;
  }

  .stats strong {
    font-size: 20px;
  }

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

  .span-2 {
    grid-column: auto;
  }

  .topbar h1 {
    font-size: 16px;
  }

  .account span {
    display: none;
  }

  .auth-card {
    padding: 22px;
  }

}
