/* Responsive refinements for the existing Dictamina workspace. */
html {
  min-width: 320px;
  overflow-x: clip;
  -webkit-text-size-adjust: 100%;
}

body,
#landing,
#auth-view,
#workspace,
#admin-view {
  min-width: 0;
  max-width: 100%;
}

body {
  overflow-x: clip;
}

img,
svg,
video,
canvas {
  max-width: 100%;
}

button,
input,
select,
textarea {
  max-width: 100%;
}

button,
a.button-link,
.admin-nav-link,
.history-actions a {
  touch-action: manipulation;
}

.panel,
.admin-section,
.metric-card,
.auth-card,
.auth-form-side,
.wallet-main,
.wallet-purchase,
.history-head,
.history-row,
.biblioteca-item,
.ficha-revista,
.admin-section-head,
.admin-heading,
.campos > *,
.cols > *,
#resultado > * {
  min-width: 0;
}

.identity-name,
.history-row,
.history-row *,
.biblioteca-item *,
.revista-detalle *,
.admin-table-wrap td,
.admin-table-wrap th,
.result-table-wrap td,
.result-table-wrap th {
  overflow-wrap: anywhere;
}

.result-table-wrap,
.admin-table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-color: #9aafc1 #e7eef4;
}

.result-table-wrap:focus-visible,
.admin-table-wrap:focus-visible {
  outline: 2px solid #557b9e;
  outline-offset: 3px;
}

.result-table-wrap table {
  min-width: 520px;
}

#tabla-calif th,
#tabla-calif td {
  overflow-wrap: anywhere;
}

#workspace-header {
  align-items: center;
}

#workspace-header .identity {
  min-width: 0;
}

.wallet-buy-row select,
.wallet-buy-row button {
  min-width: 0;
}

.history-head > div {
  min-width: 0;
}

@media (max-width: 900px) {
  main {
    padding-right: 20px;
    padding-left: 20px;
  }

  .admin-shell {
    padding-right: 20px;
    padding-left: 20px;
  }

  .wallet-panel {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr);
    gap: 20px;
  }

  .wallet-purchase {
    padding-left: 19px;
  }
}

@media (max-width: 680px) {
  html,
  body {
    width: 100%;
  }

  header#workspace-header {
    gap: 9px 12px;
    padding: 12px 16px;
    align-items: center;
  }

  #workspace-header .workspace-brand {
    font-size: 18px;
  }

  #workspace-header .identity {
    margin-left: auto;
    gap: 7px;
  }

  #workspace-header .admin-nav-link:not(.oculto) {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: normal;
    text-align: center;
  }

  #workspace-header .signout-button {
    min-height: 40px;
    font-size: 12px;
    padding: 8px 10px;
  }

  main:not(.landing-main):not(.admin-shell) {
    padding: 16px 14px;
  }

  .panel {
    padding: 16px;
  }

  .campos,
  .ficha-revista .campos {
    grid-template-columns: minmax(0, 1fr);
    gap: 13px;
  }

  #workspace > .panel > .campos {
    align-items: stretch;
  }

  #workspace > .panel > .campos > div,
  #workspace > .panel > .campos > div > input,
  #workspace > .panel > .campos > div > select,
  #workspace > .panel > .campos > div > button {
    width: 100%;
  }

  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="search"],
  input[type="file"],
  select,
  textarea,
  .ficha-revista textarea,
  .auth-field input,
  .admin-search input,
  .admin-search select,
  .wallet-buy-row select {
    min-height: 44px;
    font-size: 16px;
  }

  input[type="file"] {
    height: auto;
    min-height: 48px;
    overflow: hidden;
  }

  textarea {
    width: 100%;
  }

  button {
    min-height: 44px;
    padding: 10px 14px;
  }

  .check {
    align-items: flex-start;
    line-height: 1.45;
  }

  .check input {
    flex: 0 0 auto;
    margin-top: 3px;
    width: 18px;
    height: 18px;
  }

  .history-head {
    align-items: stretch;
  }

  .history-head > button {
    width: 100%;
  }

  .history-row {
    align-items: stretch;
    flex-direction: column;
  }

  .history-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .history-actions button,
  .history-actions a,
  .biblioteca-item button {
    min-height: 44px;
  }

  .biblioteca-item {
    align-items: stretch;
  }

  .wallet-panel {
    grid-template-columns: minmax(0, 1fr);
    gap: 15px;
  }

  .wallet-purchase {
    padding: 15px 0 0;
    border-left: 0;
    border-top: 1px solid #d3dee8;
  }

  .wallet-buy-row {
    flex-direction: column;
  }

  .wallet-buy-row select,
  .wallet-buy-row button {
    width: 100%;
    min-height: 46px;
  }

  .descargas a,
  .descargas a button {
    min-height: 46px;
  }

  .admin-shell {
    padding: 22px 14px 40px;
  }

  .admin-table-wrap {
    border-radius: 5px;
  }

  .admin-table-wrap::after,
  .result-table-wrap::after {
    content: "Desliza horizontalmente para ver todas las columnas";
    display: block;
    position: sticky;
    left: 0;
    width: max-content;
    max-width: 100%;
    padding: 7px 10px;
    color: #64798e;
    background: #edf3f8;
    border-top: 1px solid #d4dfe8;
    font: 10px/1.4 "IBM Plex Mono", monospace;
  }

  .admin-table-wrap table {
    min-width: 760px;
  }

  .result-table-wrap table {
    min-width: 520px;
  }

  .admin-pager {
    gap: 8px;
    flex-wrap: wrap;
  }

  .admin-pager button {
    min-height: 40px;
    padding: 8px 11px;
  }

  .admin-user-action {
    min-height: 40px;
  }

  .site-nav,
  .auth-nav {
    min-height: 70px;
    height: auto;
    gap: 10px;
  }

  .nav-actions {
    gap: clamp(8px, 3vw, 16px);
  }

  .nav-link,
  .nav-actions .button-link {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .auth-nav .back-home {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
  }

  .auth-card {
    width: 100%;
    padding: 25px 20px 22px;
  }
}

@media (max-width: 420px) {
  .site-nav {
    padding-right: 12px;
    padding-left: 12px;
  }

  .site-nav .brand {
    gap: 7px;
    font-size: 11px;
    letter-spacing: .1em;
  }

  .site-nav .brand img {
    width: 32px;
    height: 32px;
  }

  .site-nav .brand small {
    font-size: 7px;
    letter-spacing: .1em;
  }

  .nav-actions {
    gap: 7px;
  }

  .nav-link {
    font-size: 11px;
    white-space: nowrap;
  }

  .nav-actions .button-link {
    padding: 8px 9px;
    font-size: 11px;
    gap: 5px;
    white-space: nowrap;
  }

  .auth-nav {
    padding-right: 13px;
    padding-left: 13px;
  }

  .auth-nav .brand {
    gap: 7px;
    font-size: 11px;
  }

  .auth-nav .back-home {
    font-size: 11px;
    white-space: nowrap;
  }

  .hero h1 {
    font-size: clamp(42px, 13vw, 54px);
  }

  .hero-ctas {
    align-items: stretch;
    flex-direction: column;
    gap: 11px;
  }

  .hero-ctas .button-link {
    width: 100%;
  }

  .hero-ctas .text-link {
    min-height: 42px;
  }

  .hero-art {
    height: 340px;
    margin-right: -4px;
    margin-left: -4px;
  }

  .document-card {
    width: min(250px, 78vw);
    height: 320px;
    padding: 18px;
  }

  .orbit-one {
    width: min(300px, 94vw);
  }

  .orbit-two {
    width: min(330px, 102vw);
  }

  .art-caption {
    right: -1px;
  }

  .landing-close .button-link {
    width: 100%;
  }

  .auth-layout {
    padding-right: 14px;
    padding-left: 14px;
  }

  .auth-aside h1 {
    font-size: 34px;
  }

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

  .metric-card {
    min-height: 102px;
  }

  .admin-section-head > div:first-child {
    min-width: 0;
  }

  .admin-section-head p,
  .admin-disclaimer {
    overflow-wrap: anywhere;
  }

  .result-table-wrap table {
    min-width: 460px;
  }

  .resumen {
    gap: 14px 20px;
  }
}

@media (max-width: 360px) {
  .site-nav {
    flex-wrap: wrap;
    justify-content: center;
    padding-top: 9px;
    padding-bottom: 9px;
  }

  .site-nav > .brand {
    width: 100%;
    justify-content: center;
  }

  .site-nav .nav-actions {
    width: 100%;
    justify-content: center;
  }

  .auth-nav {
    flex-wrap: wrap;
    justify-content: space-between;
    padding-top: 8px;
    padding-bottom: 8px;
  }

  #workspace-header .identity {
    flex: 1 1 100%;
    justify-content: space-between;
  }

  #workspace-header .identity-name {
    display: inline-block;
    max-width: 100px;
  }

  .panel {
    padding: 14px;
  }

  .auth-card {
    padding-right: 16px;
    padding-left: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
