/* =====================================================
   MODALES
   ===================================================== */

html.modal-ui-open,
body.modal-ui-open {
  overflow: hidden !important;
  overscroll-behavior: none;
  touch-action: none;
}

body.modal-ui-open .bottom-nav {
  display: none !important;
}

body.modal-ui-open .app-shell {
  padding-bottom: env(safe-area-inset-bottom);
}

.sale-modal-backdrop,
.sale-editor-backdrop {
  z-index: 9999 !important;
}

.sale-modal-card,
.sale-editor-card {
  padding-bottom:
    calc(22px + env(safe-area-inset-bottom));
}

/* =====================================================
   HISTÓRICO
   ===================================================== */

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

.history-reset-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

#history-results-container {
  min-height: 120px;
}

/* =====================================================
   CALENDARIO
   ===================================================== */

.calendar-editable-sale-card {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.68);
  color: var(--text);
  text-align: left;
}

.calendar-editable-sale-card:active {
  transform: scale(0.985);
}

.calendar-editable-sale-card strong,
.calendar-editable-sale-card span,
.calendar-editable-sale-card small {
  display: block;
}

.calendar-editable-sale-card span {
  margin-top: 4px;
  color: var(--muted);
}

.calendar-editable-sale-card small {
  margin-top: 5px;
  color: #0f766e;
  font-weight: 900;
}

.calendar-editable-sale-card b {
  white-space: nowrap;
  letter-spacing: -0.04em;
}

/* =====================================================
   MENÚ INFERIOR
   ===================================================== */

.bottom-nav {
  display: grid !important;
  grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
  align-items: stretch;
  column-gap: clamp(2px, 1vw, 8px);
  padding-inline:
    max(6px, env(safe-area-inset-left))
    max(6px, env(safe-area-inset-right));
}

.bottom-nav .bottom-nav-item,
.bottom-nav button {
  min-width: 0 !important;
  width: 100%;
  display: grid;
  grid-template-rows: 25px auto;
  place-items: center;
  align-content: center;
  gap: 3px;
  padding: 7px 2px !important;
  overflow: hidden;
}

.bottom-nav .nav-icon,
.bottom-nav button > span {
  width: 100%;
  min-width: 0;
  display: grid;
  place-items: center;
  font-size: clamp(1rem, 4.2vw, 1.25rem);
  line-height: 1;
}

.bottom-nav button small {
  width: 100%;
  min-width: 0;
  display: block;
  overflow: hidden;
  color: inherit;
  font-size: clamp(0.58rem, 2.45vw, 0.73rem);
  font-weight: 850;
  line-height: 1.08;
  letter-spacing: -0.015em;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bottom-nav button[data-route="calendar"] small {
  font-size: clamp(0.54rem, 2.2vw, 0.69rem);
}

@media (max-width: 390px) {
  .bottom-nav {
    column-gap: 1px;
    padding-inline:
      max(3px, env(safe-area-inset-left))
      max(3px, env(safe-area-inset-right));
  }

  .bottom-nav .bottom-nav-item,
  .bottom-nav button {
    padding-inline: 0 !important;
  }

  .bottom-nav button small {
    font-size: 0.58rem;
  }

  .bottom-nav button[data-route="calendar"] small {
    font-size: 0.53rem;
    letter-spacing: -0.045em;
  }
}

@media (max-width: 350px) {
  .bottom-nav button small {
    font-size: 0.54rem;
  }

  .bottom-nav button[data-route="history"] small {
    font-size: 0.51rem;
  }

  .bottom-nav button[data-route="calendar"] small {
    font-size: 0.49rem;
  }
}

@media (min-width: 700px) {
  .bottom-nav {
    column-gap: 8px;
  }

  .bottom-nav .bottom-nav-item,
  .bottom-nav button {
    padding-inline: 8px !important;
  }

  .bottom-nav button small {
    font-size: 0.75rem;
  }
}