/* Histórico e cabeçalho de sessão, baseados na referência do Clube. */
.ach-history-header-title { display: none; }
.ach-session-summary { display: contents; }

body:has(#prontas.active):not(.auth-locked) {
  --history-ink: #091a56;
  --history-muted: #535e76;
  --history-bg: #f2f6ff;
  --ml-bg: var(--history-bg);
  --ml-ink: var(--history-ink);
  --ml-footer: clamp(26px, 8vw, 74px);
  --ml-nav-row: clamp(53px, 15.3vw, 142px);
  background: radial-gradient(ellipse at 50% 12%, #fafcff, var(--history-bg) 70%) !important;
}

body:has(#prontas.active):not(.auth-locked) header.ach-branded-header {
  height: clamp(78px, 22.1vw, 208px) !important;
  max-width: 941px;
  margin-inline: auto;
  background: var(--history-bg) url("./assets/historico-cabecalho-r41.webp") center / 100% 100% no-repeat !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

body:has(#prontas.active) header.ach-branded-header::before,
body:has(#prontas.active) header.ach-branded-header::after,
body:has(#prontas.active) .ach-r35-brand,
body:has(#prontas.active)::after { display: none !important; }

body:has(#prontas.active) .ach-history-header-title {
  position: absolute;
  display: block;
  top: 11%;
  left: 30.7%;
  right: 3.3%;
  color: white;
  font-size: clamp(17px, 4.2vw, 40px);
  font-weight: 830;
  letter-spacing: -.035em;
  line-height: 1.08;
}

body:has(#prontas.active) .ach-history-header-title::before {
  content: "";
  position: absolute;
  left: -4%;
  top: .32em;
  width: 2px;
  height: 2.15em;
  border-radius: 2px;
  background: #ecf5ff;
}

body:has(#prontas.active):not(.auth-locked) #achSessionBadge {
  position: absolute;
  top: clamp(31px, 8vw, 75px) !important;
  left: max(30.7vw, (100% - 941px) / 2 + 289px);
  right: max(3.3vw, (100% - 941px) / 2 + 31px) !important;
  justify-content: flex-start;
  align-items: center;
  gap: clamp(4px, 1.5vw, 14px);
  max-width: none;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

body:has(#prontas.active) .ach-session-summary {
  display: flex;
  align-items: center;
  flex: 1;
  gap: clamp(3px, .9vw, 9px);
  min-width: 0;
  min-height: clamp(24px, 6.2vw, 57px);
  padding: 0 clamp(5px, 1.65vw, 17px);
  border-radius: 100px;
  background: #f4f8ff;
  color: var(--history-ink);
}

body:has(#prontas.active) #achSessionBadge span {
  min-width: 0;
  max-width: none !important;
  font-size: clamp(8px, 2.15vw, 22px) !important;
  line-height: 1.15;
  letter-spacing: -.025em;
}

body:has(#prontas.active) #achUserLabel { flex: 1; }
body:has(#prontas.active) #achSyncStatus { flex: 1; }

body:has(#prontas.active) #achSessionBadge button {
  flex: none;
  border: 0 !important;
  border-radius: 100px !important;
  background: #e6f1fe !important;
  color: #104b91 !important;
  box-shadow: none !important;
  line-height: 1 !important;
}

body:has(#prontas.active) #achSessionBadge #achLogout {
  min-height: clamp(24px, 6.2vw, 57px);
  padding: .25em .95em !important;
  font-size: clamp(9px, 2.55vw, 24px) !important;
}

body:has(#prontas.active) #achSessionBadge #achSyncRefresh {
  min-width: 20px;
  min-height: 20px;
  padding: .2em !important;
  background: transparent !important;
  font-size: clamp(10px, 2.65vw, 25px) !important;
}

body:has(#prontas.active) main {
  max-width: 941px !important;
  min-height: 0 !important;
  padding: clamp(4px, 1vw, 9px) clamp(10px, 3.1vw, 29px) calc(var(--ml-nav-row) + var(--ml-footer) + 18px + env(safe-area-inset-bottom)) !important;
}

#prontas .ach-history-intro,
#prontas .card.ach-history-card {
  padding: clamp(11px, 2.8vw, 27px) !important;
  margin: 0 0 clamp(8px, 2vw, 19px) !important;
  border: 1px solid #e6edf9 !important;
  border-radius: clamp(17px, 4.1vw, 40px) !important;
  box-shadow: 0 7px 20px #23498217 !important;
}

#prontas .ach-history-intro {
  position: relative;
  overflow: hidden;
  background: linear-gradient(115deg, #eef6ff, #d7e7fc 64%, #e1e3ff) !important;
}

#prontas .ach-history-intro > span {
  position: relative;
  z-index: 1;
  color: var(--history-muted) !important;
  font-size: clamp(10px, 2.75vw, 25px) !important;
  letter-spacing: .035em !important;
}

#prontas .ach-history-intro h1 {
  position: relative;
  z-index: 1;
  margin: .05em 0 0 !important;
  color: var(--history-ink) !important;
  font-size: clamp(24px, 6.1vw, 59px) !important;
  line-height: 1.04;
  letter-spacing: -.045em;
}

#prontas .ach-history-documents {
  position: absolute;
  width: 13%;
  height: 90%;
  right: 6%;
  top: 13%;
  transform: rotate(13deg);
  border-radius: 17%;
  background: #f3f7ffad;
  box-shadow: 0 6px 15px #3770c326, -.96em .95em 0 -.28em #eff5ff81, -1.6em 1.45em 0 -.52em #f5f8ff54;
  font-size: clamp(10px, 3vw, 28px);
}

#prontas .ach-history-documents::after {
  content: "";
  position: absolute;
  inset: 24% 18% 21%;
  background:
    linear-gradient(#adcaf7, #adcaf7) 0 0 / 100% 12% no-repeat,
    linear-gradient(#adcaf7, #adcaf7) 0 31% / 100% 12% no-repeat,
    linear-gradient(#adcaf7, #adcaf7) 0 62% / 83% 12% no-repeat,
    linear-gradient(#adcaf7, #adcaf7) 0 93% / 58% 12% no-repeat;
}

#prontas .card.ach-history-card {
  background: linear-gradient(140deg, #fff, #fafcff) !important;
}

#prontas .ach-history-actions {
  gap: 6px;
  flex-wrap: nowrap;
  align-items: center;
  margin-bottom: clamp(8px, 2vw, 18px);
}

#prontas .ach-history-actions h2 {
  margin: 0 !important;
  color: var(--history-ink) !important;
  font-size: clamp(16px, 4.45vw, 43px) !important;
  font-weight: 850;
  line-height: 1.07;
  letter-spacing: -.045em;
}

#prontas .ach-history-actions .ach-history-refresh {
  display: flex;
  align-items: center;
  flex: none;
  gap: .28em;
  padding: .45em .85em !important;
  border-radius: .8em !important;
  background: linear-gradient(155deg, #ff9809, #f35b00) !important;
  color: white !important;
  font-size: clamp(11px, 3.3vw, 31px);
  line-height: 1;
  box-shadow: 0 3px 6px #5a370d23 !important;
}

#prontas .ach-history-refresh span { font-size: 1.23em; }

#prontas .ach-history-search {
  position: relative;
  margin-bottom: clamp(8px, 2.2vw, 20px);
}

#prontas .ach-history-search > span {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: .92em;
  width: .92em;
  height: .92em;
  transform: translateY(-55%);
  border: max(1.5px, .095em) solid #616572;
  border-radius: 50%;
  pointer-events: none;
  font-size: clamp(12px, 3.5vw, 33px);
}

#prontas .ach-history-search > span::after {
  content: "";
  position: absolute;
  top: 87%;
  left: 76%;
  width: .46em;
  height: max(1.5px, .095em);
  transform: rotate(45deg);
  border-radius: 5px;
  background: #616572;
}

#prontas .ach-history-card input,
#prontas .ach-history-card select {
  min-width: 0;
  width: 100%;
  min-height: clamp(37px, 7.7vw, 73px);
  margin: 0 !important;
  padding: .5em .7em !important;
  border: 1px solid #c2cee5 !important;
  border-radius: .78em !important;
  background: #fafbfe !important;
  color: #151f42 !important;
  font-size: clamp(12px, 3.15vw, 30px) !important;
  line-height: 1.15;
}

#prontas .ach-history-card #readySearch { padding-inline-start: 2.87em !important; }

#prontas .ach-history-filters {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(7px, 2.55vw, 25px);
}

#prontas .ach-history-filters label {
  display: block;
  margin: 0 0 .48em;
  color: var(--history-ink) !important;
  font-size: clamp(11px, 2.9vw, 28px) !important;
  font-weight: 800 !important;
}

#prontas #readyDateRange { margin-top: 9px; }

#prontas .ach-history-card #readyCount {
  margin: .75em 0 !important;
  color: var(--history-muted) !important;
  font-size: clamp(11px, 2.95vw, 28px) !important;
}

#prontas #readyList .ach-v62-history-head,
#prontas #readyList .ach-v62-history-row {
  display: grid;
  grid-template-columns: minmax(0, 17%) minmax(0, 1fr) minmax(0, 27%);
  gap: clamp(4px, 1.5vw, 15px);
  padding: clamp(7px, 2vw, 19px) clamp(7px, 2.35vw, 22px);
  border: 0;
  color: var(--history-ink);
}

#prontas #readyList .ach-v62-history-head {
  border-radius: clamp(10px, 2.55vw, 24px) !important;
  background: linear-gradient(135deg, #dfedfa, #d7e8fa);
  font-size: clamp(10px, 2.9vw, 28px);
  line-height: 1.1;
}

#prontas #readyList .ach-v62-history-row {
  border-radius: 0 !important;
  background: #f1ebfa !important;
}

#prontas #readyList :nth-child(even of .ach-v62-history-row) {
  background: #e7f6f0 !important;
}

#prontas #readyList :nth-last-child(1 of .ach-v62-history-row) {
  border-radius: 0 0 clamp(8px, 2vw, 16px) clamp(8px, 2vw, 16px) !important;
}

#prontas .ach-v62-when {
  gap: .28em;
  font-size: clamp(12px, 3.25vw, 30px);
  line-height: 1.12;
}

#prontas .ach-v62-when small,
#prontas .ach-v62-product-link small {
  color: var(--history-muted);
  font-size: clamp(9px, 2.72vw, 24px);
  line-height: 1.15;
}

#prontas .ach-v62-history-row .ach-v62-product-link {
  color: var(--history-ink) !important;
  font-size: clamp(11px, 3vw, 29px) !important;
  text-align: left;
  box-shadow: none !important;
  line-height: 1.16;
}

#prontas .ach-history-product-name {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}

#prontas .ach-history-product-name + small { margin-top: .36em; }

#prontas .ach-v62-pending-items {
  align-items: stretch;
  gap: clamp(3px, 1vw, 10px);
  max-width: 8em;
  font-size: clamp(9px, 2.65vw, 25px);
}

#prontas .ach-v62-pending-items button.ach-v62-pending {
  min-width: 0;
  padding: .36em .63em !important;
  border-radius: .7em !important;
  background: #d9e9fa !important;
  color: #104a88 !important;
  font-size: inherit !important;
  line-height: 1.15;
  overflow-wrap: anywhere;
  box-shadow: none !important;
}

#prontas .ach-v62-all-done { font-size: inherit; }

body:has(#prontas.active):not(.auth-locked) .tabbar {
  padding-inline: max(7px, (100% - 911px) / 2) !important;
  background-image: url("./assets/historico-rodape-r41.webp") !important;
  background-size: min(100%, 941px) calc(var(--ml-footer) + env(safe-area-inset-bottom)) !important;
}

body:has(#prontas.active) .tabbar .tabs {
  padding-inline: clamp(2px, .6vw, 5px);
  border-radius: clamp(15px, 4vw, 36px);
  background: linear-gradient(160deg, #fff, #f8fbff);
  box-shadow: 0 4px 13px #244a751a;
}

body:has(#prontas.active) .tabbar :is(.tabs > .tab, .ach-more-button) {
  border-color: transparent !important;
  background: transparent !important;
  box-shadow: none !important;
}

body:has(#prontas.active) .tabbar .tabs > .tab.active {
  border-color: #ffce31 !important;
  background: linear-gradient(140deg, #e5f1ff, #c9e3fb) !important;
  color: #0a2c74 !important;
  box-shadow: inset 0 0 0 1px #fff9dc, 0 2px 6px #f6c13c30 !important;
}
