* {
  margin: 0;
  padding: 0;

  box-sizing: border-box;

  font-family:
    "Inter",
    "Segoe UI",
    Arial,
    sans-serif;
}

:root {
  --bg: #070b11;

  --surface: #101720;

  --surface-2: #151e2a;

  --surface-3: #1b2635;

  --border:
    rgba(255, 255, 255, 0.09);

  --border-strong:
    rgba(255, 255, 255, 0.16);

  --text: #f5f7fb;

  --text-soft: #aeb7c6;

  --red: #d92730;

  --red-2: #f03a42;

  --yellow: #f2a900;
}

html,
body {
  min-height: 100%;
}

body {
  background:
    radial-gradient(
      circle at 88% 12%,
      rgba(174, 24, 30, 0.22),
      transparent 26%
    ),
    linear-gradient(
      180deg,
      #070b11 0%,
      #101720 100%
    );

  color: var(--text);
}

/* =========================================
   ESTRUCTURA GENERAL
   ========================================= */

.app-shell {
  width: 100%;

  min-height: 100vh;

  padding: 32px;
}

.sheet {
  width: min(1280px, 100%);

  margin: 0 auto;
}

/* =========================================
   TOPBAR
   ========================================= */

.topbar {
  position: relative;

  margin-bottom: 26px;

  padding: 34px;

  overflow: hidden;

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

  border-radius: 30px;

  background:
    rgba(16, 23, 32, 0.9);

  box-shadow:
    0 24px 55px
    rgba(0, 0, 0, 0.42);
}

.topbar::after {
  content: "";

  position: absolute;

  inset: 0;

  background:
    radial-gradient(
      circle at top right,
      rgba(217, 39, 48, 0.26),
      transparent 32%
    ),
    linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.04),
      transparent 45%
    );

  pointer-events: none;
}

.topbar-content {
  position: relative;

  z-index: 1;

  display: grid;

  grid-template-columns:
    1fr 320px;

  gap: 28px;

  align-items: center;
}

/* =========================================
   MARCA
   ========================================= */

.brand-block {
  display: flex;

  flex-direction: column;

  gap: 16px;
}

.brand-badges {
  display: flex;

  gap: 10px;

  flex-wrap: wrap;
}

.badge-pill {
  width: fit-content;

  min-height: 34px;

  padding: 0 14px;

  display: inline-flex;

  align-items: center;

  border:
    1px solid
    rgba(217, 39, 48, 0.32);

  border-radius: 999px;

  background:
    rgba(217, 39, 48, 0.15);

  color: #ff626a;

  font-size: 13px;

  font-weight: 800;
}

.badge-soft {
  border-color:
    rgba(255, 255, 255, 0.12);

  background:
    rgba(255, 255, 255, 0.08);

  color: #d8dee9;
}

.brand-block h1 {
  color: #ffffff;

  font-size:
    clamp(
      2.4rem,
      4vw,
      4.4rem
    );

  font-weight: 900;

  line-height: 1.04;

  letter-spacing: -1px;
}

.brand-block p {
  max-width: 760px;

  color:
    var(--text-soft);

  font-size: 1.05rem;

  line-height: 1.7;
}

/* =========================================
   LADO DERECHO CABECERA
   ========================================= */

.topbar-side {
  display: flex;

  flex-direction: column;

  gap: 14px;
}

.topbar-actions {
  display: flex;

  justify-content: flex-end;

  gap: 10px;

  flex-wrap: wrap;
}

.logout-btn {
  padding: 12px 16px;

  border:
    1px solid
    rgba(255, 255, 255, 0.12);

  border-radius: 16px;

  outline: none;

  background:
    linear-gradient(
      90deg,
      #e32d34 0%,
      #9f1119 100%
    );

  color: #ffffff;

  font-size: 0.92rem;

  font-weight: 800;

  cursor: pointer;

  box-shadow:
    0 12px 24px
    rgba(180, 20, 28, 0.25);

  transition:
    all 0.22s ease;
}

.logout-btn:hover {
  transform:
    translateY(-2px);
}

.logo-box {
  min-height: 110px;

  padding: 18px;

  display: flex;

  align-items: center;

  justify-content: center;

  overflow: hidden;

  border-radius: 24px;

  background: #ffffff;
}

.logo-box img {
  display: block;

  width: 100%;

  max-width: 240px;

  max-height: 90px;

  object-fit: contain;
}

.system-mini-card,
.user-mini-card {
  padding: 16px 18px;

  border:
    1px solid
    rgba(255, 255, 255, 0.12);

  border-radius: 20px;

  background:
    rgba(255, 255, 255, 0.07);
}

.user-card-label,
.mini-card-label {
  display: block;

  margin-bottom: 5px;

  color:
    var(--text-soft);

  font-size: 0.76rem;

  font-weight: 800;

  letter-spacing: 1px;

  text-transform: uppercase;
}

.user-mini-card strong {
  display: block;

  margin-bottom: 4px;

  color: #ffffff;

  font-size: 1.05rem;
}

.user-mini-card > span:last-child {
  color:
    var(--text-soft);

  font-size: 0.88rem;
}

.system-mini-card strong {
  color: #ffffff;

  font-size: 1.15rem;
}

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

.main-content {
  width: 100%;

  display: flex;

  flex-direction: column;

  gap: 26px;
}

/* =========================================
   TARJETA SELECTOR
   ========================================= */

.selector-card,
.history-card {
  padding: 34px;

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

  border-radius: 30px;

  background:
    rgba(16, 23, 32, 0.82);

  box-shadow:
    0 18px 38px
    rgba(0, 0, 0, 0.32);
}

.selector-intro {
  margin-bottom: 28px;
}

.section-kicker {
  display: inline-block;

  margin-bottom: 10px;

  color: #ff4b55;

  font-size: 0.78rem;

  font-weight: 900;

  letter-spacing: 1.2px;

  text-transform: uppercase;
}

.selector-intro h2,
.history-heading h2 {
  margin-bottom: 8px;

  color: #ffffff;

  font-size: 2rem;

  font-weight: 900;
}

.selector-intro p,
.history-heading p {
  max-width: 760px;

  color:
    var(--text-soft);

  font-size: 1rem;

  line-height: 1.65;
}

/* =========================================
   OPCIONES
   ========================================= */

.cierre-options {
  display: grid;

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

  gap: 20px;

  align-items: start;
}

.cierre-option-card {
  width: 100%;

  min-height: 128px;

  padding: 22px;

  display: flex;

  align-items: center;

  gap: 18px;

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

  border-radius: 24px;

  background:
    linear-gradient(
      180deg,
      #141d28 0%,
      #101720 100%
    );

  color: inherit;

  text-decoration: none;

  box-shadow:
    0 12px 28px
    rgba(0, 0, 0, 0.26);

  transition:
    all 0.22s ease;
}

.cierre-option-card:hover {
  transform:
    translateY(-4px);

  border-color:
    rgba(217, 39, 48, 0.45);

  box-shadow:
    0 18px 40px
    rgba(0, 0, 0, 0.38);
}

.cierre-option-icon {
  width: 66px;

  height: 66px;

  flex:
    0 0 66px;

  display: flex;

  align-items: center;

  justify-content: center;

  border:
    1px solid
    rgba(255, 255, 255, 0.10);

  border-radius: 20px;

  background:
    linear-gradient(
      180deg,
      #202b39 0%,
      #151e2a 100%
    );

  font-size: 30px;
}

.cierre-option-text {
  flex: 1;
}

.cierre-option-text h3 {
  margin-bottom: 8px;

  color: #ffffff;

  font-size: 1.35rem;

  font-weight: 900;
}

.cierre-option-text h4 {
  margin-bottom: 6px;

  color: #ffffff;

  font-size: 1.08rem;

  font-weight: 900;
}

.cierre-option-text p {
  color:
    var(--text-soft);

  font-size: 0.96rem;

  line-height: 1.55;
}

.cierre-option-arrow,
.sub-card-arrow {
  color: #ff4b55;

  font-size: 1.6rem;

  font-weight: 900;
}

.cierre-option-button {
  appearance: none;

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

  font: inherit;

  text-align: left;

  cursor: pointer;
}

/* =========================================
   PROFORMAS
   ========================================= */

.proforma-wrapper {
  display: flex;

  flex-direction: column;

  gap: 12px;
}

.sub-options-proforma {
  display: flex;

  flex-direction: column;

  gap: 12px;

  padding-left: 14px;
}

.sub-card {
  min-height: auto;

  padding: 18px;

  border-radius: 20px;

  background:
    linear-gradient(
      180deg,
      #1b2635 0%,
      #121a25 100%
    );

  box-shadow: none;
}

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

.history-card {
  position: relative;

  overflow: hidden;
}

.history-card::before {
  content: "";

  position: absolute;

  top: -140px;

  right: -110px;

  width: 330px;

  height: 330px;

  border-radius: 50%;

  background:
    radial-gradient(
      circle,
      rgba(217, 39, 48, 0.13),
      transparent 67%
    );

  pointer-events: none;
}

.history-header {
  position: relative;

  z-index: 1;

  margin-bottom: 24px;

  display: flex;

  align-items: flex-start;

  justify-content: space-between;

  gap: 20px;
}

.history-heading {
  flex: 1;
}

.history-refresh-btn {
  min-height: 44px;

  padding: 0 16px;

  display: inline-flex;

  align-items: center;

  justify-content: center;

  gap: 8px;

  border:
    1px solid
    rgba(255, 255, 255, 0.12);

  border-radius: 14px;

  background:
    #202b39;

  color: #ffffff;

  font-size: 0.9rem;

  font-weight: 800;

  cursor: pointer;

  transition:
    transform 0.2s ease,
    background 0.2s ease,
    opacity 0.2s ease;
}

.history-refresh-btn:hover:not(:disabled) {
  transform:
    translateY(-2px);

  background:
    #293749;
}

.history-refresh-btn:disabled {
  opacity: 0.55;

  cursor: wait;
}

.history-refresh-icon {
  display: inline-flex;

  align-items: center;

  justify-content: center;

  font-size: 1.2rem;

  line-height: 1;
}

.history-refresh-icon.girando {
  animation:
    historySpin
    0.8s linear infinite;
}

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

/* =========================================
   ESTADÍSTICAS
   ========================================= */

.history-stats {
  position: relative;

  z-index: 1;

  margin-bottom: 22px;

  display: grid;

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

  gap: 12px;
}

.history-stat {
  min-height: 112px;

  padding: 17px;

  display: flex;

  flex-direction: column;

  justify-content: center;

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

  border-radius: 19px;

  background:
    linear-gradient(
      180deg,
      rgba(27, 38, 53, 0.93),
      rgba(17, 25, 35, 0.93)
    );
}

.history-stat-label {
  margin-bottom: 6px;

  color:
    var(--text-soft);

  font-size: 0.74rem;

  font-weight: 900;

  letter-spacing: 0.8px;

  text-transform: uppercase;
}

.history-stat strong {
  margin-bottom: 2px;

  color: #ffffff;

  font-size: 2rem;

  font-weight: 900;

  line-height: 1;
}

.history-stat small {
  color:
    #7f8b9b;

  font-size: 0.78rem;

  font-weight: 700;
}

/* =========================================
   LISTA HISTORIAL
   ========================================= */

.history-list {
  position: relative;

  z-index: 1;

  display: flex;

  flex-direction: column;

  gap: 10px;
}

.history-item {
  min-height: 96px;

  padding: 16px 18px;

  display: grid;

  grid-template-columns:
    155px
    minmax(220px, 1fr)
    minmax(170px, 0.75fr)
    180px;

  align-items: center;

  gap: 18px;

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

  border-radius: 20px;

  background:
    linear-gradient(
      180deg,
      rgba(21, 30, 42, 0.96),
      rgba(14, 21, 30, 0.96)
    );

  transition:
    transform 0.2s ease,
    border-color 0.2s ease,
    background 0.2s ease;
}

.history-item:hover {
  transform:
    translateX(3px);

  border-color:
    rgba(255, 255, 255, 0.16);

  background:
    linear-gradient(
      180deg,
      rgba(27, 38, 53, 0.98),
      rgba(16, 24, 34, 0.98)
    );
}

.history-item-latest {
  border-color:
    rgba(217, 39, 48, 0.28);

  box-shadow:
    inset 3px 0 0
    #d92730;
}

.history-code-block,
.history-client-block,
.history-user-block,
.history-side-block {
  min-width: 0;

  display: flex;

  flex-direction: column;
}

.history-code-block {
  gap: 7px;
}

.history-code {
  color: #ffffff;

  font-size: 1.08rem;

  font-weight: 900;

  letter-spacing: 0.4px;
}

.history-type {
  width: fit-content;

  max-width: 100%;

  padding: 5px 8px;

  border-radius: 999px;

  font-size: 0.68rem;

  font-weight: 900;

  white-space: nowrap;
}

.history-type-proforma {
  background:
    rgba(72, 149, 239, 0.13);

  color: #72aef7;

  border:
    1px solid
    rgba(72, 149, 239, 0.24);
}

.history-type-cotizacion {
  background:
    rgba(242, 169, 0, 0.13);

  color: #f5be3f;

  border:
    1px solid
    rgba(242, 169, 0, 0.24);
}

.history-type-cierre-venta {
  background:
    rgba(217, 39, 48, 0.14);

  color: #ff626a;

  border:
    1px solid
    rgba(217, 39, 48, 0.28);
}

.history-type-cierre-arriendo {
  background:
    rgba(53, 174, 112, 0.13);

  color: #61d69b;

  border:
    1px solid
    rgba(53, 174, 112, 0.26);
}

.history-type-documento {
  background:
    rgba(255, 255, 255, 0.08);

  color: #d8dee9;

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

.history-client-block,
.history-user-block {
  gap: 5px;
}

.history-client,
.history-user {
  overflow: hidden;

  color: #ffffff;

  font-size: 0.95rem;

  font-weight: 850;

  line-height: 1.3;

  text-overflow: ellipsis;

  white-space: nowrap;
}

.history-rut,
.history-role {
  overflow: hidden;

  color:
    var(--text-soft);

  font-size: 0.78rem;

  font-weight: 700;

  text-overflow: ellipsis;

  white-space: nowrap;
}

.history-side-block {
  align-items: flex-end;

  gap: 8px;
}

.history-date {
  color:
    var(--text-soft);

  font-size: 0.76rem;

  font-weight: 700;

  text-align: right;
}

.history-status {
  width: fit-content;

  padding: 5px 9px;

  border:
    1px solid
    rgba(53, 174, 112, 0.25);

  border-radius: 999px;

  background:
    rgba(53, 174, 112, 0.12);

  color: #67db9f;

  font-size: 0.68rem;

  font-weight: 900;

  text-transform: capitalize;
}

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

.history-state {
  min-height: 190px;

  padding: 28px;

  display: flex;

  flex-direction: column;

  align-items: center;

  justify-content: center;

  gap: 8px;

  border:
    1px dashed
    rgba(255, 255, 255, 0.13);

  border-radius: 22px;

  background:
    rgba(255, 255, 255, 0.025);

  text-align: center;
}

.history-state strong {
  color: #ffffff;

  font-size: 1rem;

  font-weight: 900;
}

.history-state span {
  color:
    var(--text-soft);

  font-size: 0.86rem;
}

.history-loader {
  width: 30px;

  height: 30px;

  margin-bottom: 5px;

  border:
    3px solid
    rgba(255, 255, 255, 0.10);

  border-top-color:
    #d92730;

  border-radius: 50%;

  animation:
    historySpin
    0.8s linear infinite;
}

.history-state-icon {
  width: 38px;

  height: 38px;

  margin-bottom: 5px;

  display: flex;

  align-items: center;

  justify-content: center;

  border-radius: 50%;

  background:
    rgba(255, 255, 255, 0.07);

  color: #ffffff;

  font-size: 1.15rem;

  font-weight: 900;
}

.history-state-error {
  border-color:
    rgba(217, 39, 48, 0.25);

  background:
    rgba(217, 39, 48, 0.06);
}

.history-state-error
.history-state-icon {
  background:
    rgba(217, 39, 48, 0.16);

  color: #ff626a;
}

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

@media (max-width: 1080px) {
  .history-item {
    grid-template-columns:
      140px
      minmax(200px, 1fr)
      minmax(150px, 0.7fr);

    gap: 15px;
  }

  .history-side-block {
    grid-column:
      2 / -1;

    flex-direction: row;

    align-items: center;

    justify-content: space-between;
  }
}

@media (max-width: 980px) {
  .topbar-content {
    grid-template-columns:
      1fr;
  }

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

  .topbar-side {
    max-width: 420px;
  }

  .cierre-options {
    grid-template-columns:
      1fr;
  }

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

@media (max-width: 760px) {
  .history-header {
    flex-direction:
      column;
  }

  .history-refresh-btn {
    width: 100%;
  }

  .history-item {
    grid-template-columns:
      1fr;
  }

  .history-side-block {
    grid-column: auto;

    flex-direction: row;

    align-items: center;

    justify-content: space-between;
  }

  .history-date {
    text-align: left;
  }
}

@media (max-width: 640px) {
  .app-shell {
    padding: 0;
  }

  .topbar,
  .selector-card,
  .history-card {
    border-left: none;

    border-right: none;

    border-radius: 0;
  }

  .topbar {
    padding:
      26px 18px;
  }

  .selector-card,
  .history-card {
    padding:
      26px 18px;
  }

  .brand-block h1 {
    font-size: 2.2rem;
  }

  .cierre-option-card {
    min-height: auto;

    align-items:
      flex-start;

    padding: 18px;
  }

  .cierre-option-icon {
    width: 54px;

    height: 54px;

    flex-basis: 54px;

    font-size: 24px;
  }

  .cierre-option-arrow,
  .sub-card-arrow {
    display: none;
  }

  .history-stats {
    grid-template-columns:
      1fr 1fr;

    gap: 9px;
  }

  .history-stat {
    min-height: 98px;

    padding: 14px;
  }

  .history-stat strong {
    font-size: 1.7rem;
  }

  .history-item {
    padding: 16px;
  }
}

/* =========================================
   RESPETAR ELEMENTOS OCULTOS
   ========================================= */

.history-state[hidden],
.history-list[hidden],
.user-mini-card[hidden] {
  display: none !important;
}

/* =========================================
   BOTÓN VER DOCUMENTO
   ========================================= */

.history-view-btn {
  min-height: 32px;

  padding: 0 11px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  border:
    1px solid
    rgba(255, 255, 255, 0.13);

  border-radius: 10px;

  background:
    rgba(255, 255, 255, 0.07);

  color: #ffffff;

  font-size: 0.74rem;
  font-weight: 900;

  cursor: pointer;

  transition:
    transform 0.18s ease,
    background 0.18s ease,
    border-color 0.18s ease;
}

.history-view-btn:hover {
  transform:
    translateY(-2px);

  border-color:
    rgba(217, 39, 48, 0.42);

  background:
    rgba(217, 39, 48, 0.15);
}

/* =========================================
   MODAL VISTA PREVIA
   ========================================= */

body.modal-open {
  overflow: hidden;
}

.document-preview-modal {
  position: fixed;

  inset: 0;

  z-index: 99999;

  display: grid;

  place-items: center;

  padding: 24px;
}

.document-preview-modal[hidden] {
  display: none !important;
}

.document-preview-backdrop {
  position: absolute;

  inset: 0;

  background:
    rgba(3, 7, 12, 0.78);

  backdrop-filter:
    blur(8px);
}

.document-preview-card {
  position: relative;

  z-index: 1;

  width:
    min(
      980px,
      calc(100vw - 32px)
    );

  max-height:
    calc(100vh - 48px);

  display: flex;

  flex-direction: column;

  overflow: hidden;

  border:
    1px solid
    rgba(255, 255, 255, 0.13);

  border-radius: 26px;

  background:
    linear-gradient(
      180deg,
      #151e2a 0%,
      #0d141d 100%
    );

  box-shadow:
    0 35px 100px
    rgba(0, 0, 0, 0.65);
}

/* CABECERA */

.document-preview-header {
  padding: 24px 26px;

  display: flex;

  align-items: flex-start;

  justify-content: space-between;

  gap: 20px;

  border-bottom:
    1px solid
    rgba(255, 255, 255, 0.09);
}

.document-preview-heading {
  min-width: 0;

  display: flex;

  flex-direction: column;

  align-items: flex-start;

  gap: 8px;
}

.document-preview-heading h2 {
  color: #ffffff;

  font-size: 2rem;

  font-weight: 900;

  letter-spacing: -0.4px;
}

.document-preview-heading p {
  max-width: 650px;

  overflow: hidden;

  color: #aeb7c6;

  font-size: 0.95rem;

  font-weight: 700;

  text-overflow: ellipsis;

  white-space: nowrap;
}

.document-preview-close {
  width: 42px;

  height: 42px;

  flex: 0 0 42px;

  display: inline-flex;

  align-items: center;

  justify-content: center;

  border:
    1px solid
    rgba(255, 255, 255, 0.12);

  border-radius: 14px;

  background:
    rgba(255, 255, 255, 0.07);

  color: #ffffff;

  font-size: 1.55rem;

  line-height: 1;

  cursor: pointer;

  transition:
    background 0.18s ease,
    transform 0.18s ease;
}

.document-preview-close:hover {
  background:
    rgba(217, 39, 48, 0.18);

  transform:
    rotate(4deg);
}

/* METADATOS */

.document-preview-meta {
  padding: 14px 26px;

  display: flex;

  flex-wrap: wrap;

  gap: 8px;

  border-bottom:
    1px solid
    rgba(255, 255, 255, 0.08);

  background:
    rgba(255, 255, 255, 0.025);
}

.document-preview-meta-item {
  padding: 6px 10px;

  border:
    1px solid
    rgba(255, 255, 255, 0.10);

  border-radius: 999px;

  background:
    rgba(255, 255, 255, 0.055);

  color: #c4ccd8;

  font-size: 0.74rem;

  font-weight: 800;
}

/* CARGANDO / ERROR */

.document-preview-state {
  min-height: 360px;

  display: flex;

  flex-direction: column;

  align-items: center;

  justify-content: center;

  gap: 8px;

  padding: 30px;

  text-align: center;
}

.document-preview-state[hidden],
.document-preview-content[hidden] {
  display: none !important;
}

.document-preview-state strong {
  color: #ffffff;

  font-size: 1rem;
}

.document-preview-state span {
  color: #aeb7c6;

  font-size: 0.86rem;
}

.preview-error-icon {
  width: 42px;

  height: 42px;

  display: flex;

  align-items: center;

  justify-content: center;

  border-radius: 50%;

  background:
    rgba(217, 39, 48, 0.16);

  color: #ff626a;

  font-size: 1.2rem;

  font-weight: 900;
}

/* CONTENIDO */

.document-preview-content {
  padding: 22px 26px 28px;

  display: grid;

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

  gap: 16px;

  overflow-y: auto;
}

.preview-section {
  min-width: 0;

  overflow: hidden;

  border:
    1px solid
    rgba(255, 255, 255, 0.09);

  border-radius: 18px;

  background:
    rgba(255, 255, 255, 0.035);
}

.preview-section h3 {
  padding: 13px 15px;

  border-bottom:
    1px solid
    rgba(255, 255, 255, 0.08);

  background:
    rgba(255, 255, 255, 0.035);

  color: #ffffff;

  font-size: 0.9rem;

  font-weight: 900;

  text-transform: capitalize;
}

.preview-section-body {
  padding: 8px 15px 12px;
}

.preview-data-row {
  min-height: 42px;

  padding: 8px 0;

  display: grid;

  grid-template-columns:
    minmax(120px, 0.75fr)
    minmax(0, 1.25fr);

  gap: 14px;

  align-items: center;

  border-bottom:
    1px solid
    rgba(255, 255, 255, 0.055);
}

.preview-data-row:last-child {
  border-bottom: none;
}

.preview-data-label {
  color: #8e99a8;

  font-size: 0.72rem;

  font-weight: 800;
}

.preview-data-value {
  min-width: 0;

  overflow-wrap: anywhere;

  color: #f3f6fa;

  font-size: 0.8rem;

  font-weight: 800;

  text-align: right;
}

.preview-subsection-title {
  margin:
    12px 0 4px;

  padding-bottom: 6px;

  border-bottom:
    1px solid
    rgba(217, 39, 48, 0.20);

  color: #ff626a;

  font-size: 0.75rem;

  font-weight: 900;
}

.preview-empty {
  grid-column:
    1 / -1;

  min-height: 180px;

  display: flex;

  align-items: center;

  justify-content: center;

  color: #aeb7c6;

  text-align: center;
}

/* =========================================
   RESPONSIVE VISTA PREVIA
   ========================================= */

@media (max-width: 760px) {
  .document-preview-modal {
    padding: 0;
  }

  .document-preview-card {
    width: 100vw;

    height: 100vh;

    max-height: none;

    border: none;

    border-radius: 0;
  }

  .document-preview-content {
    grid-template-columns: 1fr;

    padding:
      18px;
  }

  .document-preview-header {
    padding:
      20px 18px;
  }

  .document-preview-meta {
    padding:
      12px 18px;
  }
}
/* =========================================
   HISTORIAL 2.0
   BUSCADOR + FILTROS + MOSTRAR MÁS
   ========================================= */

.history-tools {
  position: relative;

  z-index: 2;

  margin-bottom: 14px;

  display: flex;

  flex-direction: column;

  gap: 13px;
}

/* =========================================
   BUSCADOR
   ========================================= */

.history-search-box {
  position: relative;

  width: 100%;

  min-height: 54px;

  display: flex;

  align-items: center;

  border:
    1px solid
    rgba(255, 255, 255, 0.11);

  border-radius: 17px;

  background:
    linear-gradient(
      180deg,
      rgba(27, 38, 53, 0.94),
      rgba(17, 25, 35, 0.94)
    );

  box-shadow:
    inset 0 1px 0
    rgba(255, 255, 255, 0.025);

  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.2s ease;
}

.history-search-box:focus-within {
  border-color:
    rgba(217, 39, 48, 0.48);

  box-shadow:
    0 0 0 4px
    rgba(217, 39, 48, 0.08);

  transform:
    translateY(-1px);
}

.history-search-icon {
  width: 52px;

  flex: 0 0 52px;

  display: flex;

  align-items: center;

  justify-content: center;

  color: #ff5962;

  font-size: 1.35rem;

  font-weight: 900;

  pointer-events: none;
}

#historySearch {
  width: 100%;

  min-width: 0;

  height: 52px;

  padding: 0 48px 0 0;

  border: none;

  outline: none;

  background: transparent;

  color: #ffffff;

  font-size: 0.96rem;

  font-weight: 700;
}

#historySearch::placeholder {
  color: #748091;

  font-weight: 600;
}

#historySearch::-webkit-search-cancel-button {
  display: none;
}

.history-search-clear {
  position: absolute;

  top: 50%;

  right: 12px;

  width: 31px;

  height: 31px;

  transform:
    translateY(-50%);

  display: inline-flex;

  align-items: center;

  justify-content: center;

  padding: 0;

  border:
    1px solid
    rgba(255, 255, 255, 0.09);

  border-radius: 10px;

  background:
    rgba(255, 255, 255, 0.06);

  color: #b8c1ce;

  font-size: 1.15rem;

  line-height: 1;

  cursor: pointer;

  transition:
    background 0.18s ease,
    color 0.18s ease,
    transform 0.18s ease;
}

.history-search-clear:hover {
  color: #ffffff;

  background:
    rgba(217, 39, 48, 0.18);

  transform:
    translateY(-50%)
    scale(1.05);
}

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

.history-filters {
  display: flex;

  align-items: center;

  gap: 8px;

  flex-wrap: wrap;
}

.history-filter-btn {
  min-height: 38px;

  padding: 0 14px;

  display: inline-flex;

  align-items: center;

  justify-content: center;

  border:
    1px solid
    rgba(255, 255, 255, 0.10);

  border-radius: 999px;

  background:
    rgba(255, 255, 255, 0.045);

  color: #9da8b7;

  font-size: 0.76rem;

  font-weight: 900;

  cursor: pointer;

  transition:
    transform 0.18s ease,
    background 0.18s ease,
    color 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}

.history-filter-btn:hover {
  transform:
    translateY(-2px);

  color: #ffffff;

  border-color:
    rgba(255, 255, 255, 0.18);

  background:
    rgba(255, 255, 255, 0.08);
}

/* Todos */

.history-filter-btn.active[
  data-history-filter="todos"
] {
  border-color:
    rgba(217, 39, 48, 0.48);

  background:
    rgba(217, 39, 48, 0.16);

  color: #ff6870;

  box-shadow:
    0 8px 20px
    rgba(217, 39, 48, 0.10);
}

/* Proformas */

.history-filter-btn.active[
  data-history-filter="proforma"
] {
  border-color:
    rgba(72, 149, 239, 0.42);

  background:
    rgba(72, 149, 239, 0.15);

  color: #82b9fb;
}

/* Cotizaciones */

.history-filter-btn.active[
  data-history-filter="cotizacion"
] {
  border-color:
    rgba(242, 169, 0, 0.42);

  background:
    rgba(242, 169, 0, 0.14);

  color: #f6c95e;
}

/* Venta */

.history-filter-btn.active[
  data-history-filter="cierre_venta"
] {
  border-color:
    rgba(217, 39, 48, 0.45);

  background:
    rgba(217, 39, 48, 0.15);

  color: #ff6971;
}

/* Arriendo */

.history-filter-btn.active[
  data-history-filter="cierre_arriendo"
] {
  border-color:
    rgba(53, 174, 112, 0.42);

  background:
    rgba(53, 174, 112, 0.14);

  color: #70dca5;
}

/* =========================================
   CONTADOR DE RESULTADOS
   ========================================= */

.history-results-row {
  position: relative;

  z-index: 1;

  min-height: 26px;

  margin-bottom: 10px;

  display: flex;

  align-items: center;

  justify-content: space-between;
}

#historyResultsText {
  color: #7f8b9b;

  font-size: 0.76rem;

  font-weight: 750;
}

/* =========================================
   MOSTRAR MÁS
   ========================================= */

.history-more-wrap {
  position: relative;

  z-index: 1;

  margin-top: 15px;

  display: flex;

  justify-content: center;
}

.history-load-more-btn {
  min-width: 240px;

  min-height: 46px;

  padding: 0 18px;

  display: inline-flex;

  align-items: center;

  justify-content: center;

  gap: 10px;

  border:
    1px solid
    rgba(255, 255, 255, 0.11);

  border-radius: 15px;

  background:
    linear-gradient(
      180deg,
      #202b39,
      #182330
    );

  color: #ffffff;

  font-size: 0.82rem;

  font-weight: 900;

  cursor: pointer;

  box-shadow:
    0 10px 24px
    rgba(0, 0, 0, 0.20);

  transition:
    transform 0.2s ease,
    border-color 0.2s ease,
    background 0.2s ease;
}

.history-load-more-btn:hover {
  transform:
    translateY(-3px);

  border-color:
    rgba(217, 39, 48, 0.38);

  background:
    linear-gradient(
      180deg,
      #293748,
      #1c2938
    );
}

.history-load-more-btn strong {
  color: #ff5962;

  font-size: 1rem;

  transition:
    transform 0.2s ease;
}

.history-load-more-btn:hover strong {
  transform:
    translateY(3px);
}

/* =========================================
   RESPETAR HIDDEN
   ========================================= */

.history-search-clear[hidden],
.history-load-more-btn[hidden],
.history-more-wrap[hidden] {
  display: none !important;
}

/* =========================================
   RESPONSIVE HISTORIAL 2.0
   ========================================= */

@media (max-width: 640px) {
  .history-search-box {
    min-height: 50px;
  }

  #historySearch {
    height: 48px;

    font-size: 0.88rem;
  }

  .history-search-icon {
    width: 46px;

    flex-basis: 46px;
  }

  .history-filters {
    gap: 6px;
  }

  .history-filter-btn {
    min-height: 35px;

    padding: 0 11px;

    font-size: 0.7rem;
  }

  .history-load-more-btn {
    width: 100%;
  }
}

/* =========================================
   BOTÓN ABRIR DOCUMENTO COMPLETO
   ========================================= */

.document-preview-actions {
  display: flex;

  align-items: center;

  gap: 10px;
}

.document-preview-open-full {
  min-height: 42px;

  padding: 0 14px;

  display: inline-flex;

  align-items: center;

  justify-content: center;

  border:
    1px solid
    rgba(217, 39, 48, 0.36);

  border-radius: 14px;

  background:
    rgba(217, 39, 48, 0.14);

  color: #ff6971;

  font-size: 0.8rem;

  font-weight: 900;

  cursor: pointer;

  transition:
    transform 0.18s ease,
    background 0.18s ease,
    border-color 0.18s ease;
}

.document-preview-open-full:hover {
  transform:
    translateY(-2px);

  border-color:
    rgba(217, 39, 48, 0.58);

  background:
    rgba(217, 39, 48, 0.22);

  color: #ffffff;
}

@media (max-width: 640px) {
  .document-preview-actions {
    align-items: flex-end;

    flex-direction: column-reverse;
  }

  .document-preview-open-full {
    width: max-content;
  }
}

/* =========================================
   ACCIONES PDF EN HISTORIAL
   ========================================= */

.history-pdf-actions {
  display: flex;

  align-items: center;

  justify-content: flex-end;

  gap: 7px;

  flex-wrap: wrap;
}

.history-pdf-btn {
  min-height: 30px;

  padding: 0 9px;

  font-size: 0.68rem;
}

.history-pdf-btn:disabled {
  opacity: 0.55;

  cursor: wait;

  transform: none;
}

@media (max-width: 760px) {
  .history-pdf-actions {
    justify-content: flex-start;
  }
}