/* Janela Achados: mesma largura do stage/cabeçalho. */
body.achados-page {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overflow-x: clip;
}

.achados-page .desktop {
  overflow-x: clip;
  max-width: 100%;
}

.achados-page .achados-stage {
  width: 100%;
  max-width: none;
  margin: 0;
}

.achados-page .menubar-links a[aria-current="page"] {
  color: var(--header-bg);
  font-weight: 700;
  border-color: color-mix(in srgb, var(--header-bg) 18%, var(--border));
  background: color-mix(in srgb, var(--header-bg) 6%, var(--white));
}

.achados-auth-body .lede,
.achados-home-body .lede {
  margin-bottom: 0.75rem;
}

.achados-form .soft-btn,
.achados-form .hard-btn,
.achados-form .ghost-btn {
  width: 100%;
  box-sizing: border-box;
}

.soft-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--off-white);
  color: var(--bordo);
  font-family: var(--brand);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: none;
  transition: background 120ms ease, transform 80ms ease, border-color 120ms ease;
}

.soft-btn:hover,
.soft-btn:focus-visible {
  background: color-mix(in srgb, var(--off-white) 70%, #fff);
  border-color: color-mix(in srgb, var(--bordo) 25%, var(--border));
}

.soft-btn:active {
  transform: scale(0.98);
}

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

.achados-modal:not([hidden]) {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 16px;
  box-sizing: border-box;
}

.achados-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(46, 8, 18, 0.45);
}

.achados-modal-panel {
  position: relative;
  z-index: 1;
  width: min(100%, 28rem);
  max-height: min(90vh, 40rem);
  overflow: auto;
  margin: 0;
}

.achados-modal-close {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted, #6b635c);
  font-size: 1.35rem;
  line-height: 1;
  width: 2rem;
  height: 2rem;
  cursor: pointer;
  border-radius: var(--radius-sm);
}

.achados-modal-close:hover,
.achados-modal-close:focus-visible {
  color: var(--bordo);
  background: color-mix(in srgb, var(--bordo) 8%, transparent);
}

body.is-achados-modal-open {
  overflow: hidden;
}

.achados-home-intro {
  margin-bottom: 1rem;
  width: 100%;
  max-width: none;
}

.achados-home-intro .lede {
  max-width: none;
  width: 100%;
}

.achados-load-more-wrap,
.achados-list-actions {
  margin: 0 0 1rem;
}

.achados-list-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.achados-add-est-btn {
  width: 100%;
  box-sizing: border-box;
  text-align: center;
  text-decoration: none;
}

.achados-workspace {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.achados-results-stream {
  min-width: 0;
}

.achados-detail-page {
  display: none;
  min-width: 0;
}

.achados-detail-page[hidden] {
  display: none !important;
}

.achados-detail-empty {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

body.is-achados-detail #como-funciona-achados,
body.is-achados-detail #achados-home > .titlebar,
body.is-achados-detail .achados-results-stream {
  display: none;
}

body.is-achados-detail #achados-home {
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}

body.is-achados-detail .achados-home-body {
  padding: 0;
}

body.is-achados-detail .achados-detail-page:not([hidden]) {
  display: grid;
  gap: 12px;
}

.achados-search-toolbar {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 8px;
  margin-bottom: 0.75rem;
}

.achados-search-toolbar input {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
}

.achados-geo-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--bordo);
  cursor: pointer;
}

.achados-geo-btn:hover:not(:disabled) {
  background: color-mix(in srgb, var(--bordo) 6%, var(--surface));
}

.achados-geo-btn:disabled {
  opacity: 0.55;
  cursor: wait;
}

.achados-geo-btn.is-loading svg {
  animation: achados-geo-spin 0.8s linear infinite;
}

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

.achados-pager {
  margin: 0 0 0.75rem;
}

.achados-pager #est-page-label {
  font-size: 13px;
  color: var(--muted);
}

.achados-panel {
  margin-bottom: 0.25rem;
}

.achados-inline-search {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.achados-inline-search input {
  flex: 1 1 220px;
  font: inherit;
  padding: 0.5rem 0.65rem;
  border: 1px solid #151210;
  background: #fff;
  box-sizing: border-box;
}

.achados-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.achados-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.achados-tab {
  font: inherit;
  border: 1px solid #151210;
  background: #f7f3ef;
  padding: 0.4rem 0.85rem;
  cursor: pointer;
}

.achados-tab.is-active {
  background: #2e0812;
  color: #f7f3ef;
}

.achados-form {
  display: grid;
  gap: 0.75rem;
  max-width: 28rem;
}

.achados-form[hidden],
.achados-page .mac-window[hidden],
.achados-page #header-user-nav[hidden],
.achados-register-success[hidden] {
  display: none !important;
}

.achados-form-wide {
  max-width: 36rem;
}

.achados-form label {
  display: grid;
  gap: 0.25rem;
  font-size: 0.9rem;
}

.achados-form input[type="text"],
.achados-form input[type="email"],
.achados-form input[type="password"],
.achados-form input[type="url"],
.achados-form input[type="search"],
.achados-form select,
.achados-full-input,
.achados-toolbar input {
  font: inherit;
  padding: 0.5rem 0.65rem;
  border: 1px solid #151210;
  background: #fff;
  width: 100%;
  box-sizing: border-box;
}

.achados-check {
  display: flex !important;
  align-items: center;
  gap: 0.5rem;
  grid-template-columns: none !important;
}

.achados-form select:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

@media (max-width: 720px) {
  .achados-page input,
  .achados-page select,
  .achados-page textarea {
    font-size: 16px;
  }
}

.achados-check input {
  width: auto;
}

.achados-error {
  margin-top: 1rem;
  color: #a82238;
  font-size: 0.9rem;
}

.achados-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.achados-toolbar input {
  flex: 1 1 220px;
}

.achados-map {
  width: 100%;
  height: 360px;
  min-height: 280px;
  margin: 0 0 1rem;
  border: 1px solid var(--border);
  background: #e8e4df;
}

.achados-map-tall {
  height: min(62vh, 520px);
  min-height: 320px;
}

.est-list {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  display: grid;
  gap: 6px;
}

.est-list .est-item,
.wine-row {
  display: grid;
  gap: 2px;
  width: 100%;
  text-align: left;
  font: inherit;
  padding: 10px 12px;
  border: 1px solid var(--border);
  background: var(--white);
  cursor: pointer;
}

.est-list .est-item-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px;
  gap: 10px;
  align-items: center;
  -webkit-appearance: none;
  appearance: none;
  background: var(--white);
}

.est-list .est-item-card.is-active {
  background: color-mix(in srgb, var(--rose) 28%, var(--white));
  border-color: color-mix(in srgb, var(--bordo) 35%, var(--border));
}

.achados-card-main {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.achados-card-main strong,
.achados-card-main span {
  display: block;
  overflow-wrap: anywhere;
}

.achados-card-votes {
  margin-top: 2px;
}

.achados-card-photo-wrap {
  width: 72px;
  height: 72px;
  min-width: 72px;
  min-height: 72px;
  justify-self: end;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #e8e4df;
  box-sizing: border-box;
}

.achados-card-photo {
  display: block;
  width: 72px;
  height: 72px;
  max-width: none;
  object-fit: cover;
  border: 0;
  background: #e8e4df;
}

.achados-card-photo-fallback {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  font-size: 10px;
  text-align: center;
  color: var(--muted);
  padding: 4px;
  box-sizing: border-box;
}

@media (max-width: 720px) {
  .est-list .est-item-card {
    grid-template-columns: minmax(0, 1fr) 64px;
    gap: 8px;
  }

  .achados-card-photo-wrap,
  .achados-card-photo {
    width: 64px;
    height: 64px;
    min-width: 64px;
    min-height: 64px;
  }

  .achados-add-est-btn {
    flex: 1 1 auto;
  }
}

.est-list .est-item span,
.wine-row span {
  display: block;
  font-size: 13px;
}

a.hard-btn {
  /* Keep inline-flex from .hard-btn so label is vertically centered (min-height). */
  display: inline-flex;
  text-decoration: none;
  box-sizing: border-box;
}

.achados-confirm {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 12px;
  margin-top: 1rem;
  padding: 12px;
  border: 1px solid var(--border);
  background: var(--white);
}

.achados-confirm-media img,
.achados-confirm-media .achados-card-photo-fallback {
  width: 96px;
  height: 96px;
}

.achados-confirm-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 0.75rem;
}

@media (max-width: 520px) {
  .achados-confirm {
    grid-template-columns: 1fr;
  }
}

.wine-row {
  grid-template-columns: 1fr auto;
  align-items: center;
  cursor: default;
}

.btn-tiny {
  font: inherit;
  font-size: 12px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  background: #f7f3ef;
  cursor: pointer;
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

.cred-divider {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 1.25rem 0;
}

.cred-form-title {
  margin: 0 0 0.5rem;
  font-size: 15px;
  font-weight: 700;
}

.cred-note {
  margin: 0 0 0.75rem;
  font-size: 13px;
  color: var(--muted);
}

/* iOS Safari: font-size ≥16px nos campos (mesmo critério da Adega em styles.css). */
@media (max-width: 899px) {
  .achados-page .achados-form input,
  .achados-page .achados-form select,
  .achados-page .achados-toolbar input,
  .achados-page .achados-inline-search input,
  .achados-page .achados-full-input,
  .achados-page #est-search {
    font-size: 18px;
  }

  .achados-page .achados-toolbar input,
  .achados-page #est-search {
    height: 42px;
    min-height: 42px;
    line-height: normal;
  }
}


.achados-page .est-list li,
.achados-page .achados-tab,
.achados-page .achados-form input,
.achados-page .achados-form select,
.achados-page .achados-full-input,
.achados-page #est-search {
  border-radius: var(--radius-sm);
}

.achados-page .achados-tab.is-active {
  background: var(--bordo);
  color: var(--white);
  border-color: var(--bordo);
}

.achados-page .achados-form input,
.achados-page .achados-form select,
.achados-page .achados-full-input,
.achados-page #est-search {
  border: 1px solid var(--border);
  min-height: 44px;
  padding: 0 12px;
  background: var(--surface);
}

.achados-detail-toolbar {
  display: flex;
  align-items: center;
  position: sticky;
  top: var(--app-header-offset, 72px);
  z-index: 65;
  width: 100%;
  margin: 0 0 12px;
  padding: 8px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  box-sizing: border-box;
}

.achados-detail-toolbar[hidden] {
  display: none !important;
}

.achados-back {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--bordo);
  font: inherit;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
}

.achados-est-detail {
  margin: 0;
}

.achados-est-detail-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--white);
}

.achados-wines-title {
  margin-top: 1.75rem;
}

.achados-wine-list {
  gap: 10px;
}

.achados-wine-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px 12px;
  align-items: stretch;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--white);
}

.achados-wine-photo-wrap,
.achados-wine-photo {
  width: 72px;
  height: 108px;
  min-width: 72px;
  min-height: 108px;
}

.achados-wine-photo-wrap {
  overflow: hidden;
  background: #e8e4df;
  box-sizing: border-box;
}

.achados-wine-photo {
  display: block;
  max-width: none;
  object-fit: contain;
  object-position: center;
  border: 0;
  background: #fff;
}

.achados-wine-copy {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  min-height: 108px;
}

.achados-wine-text {
  display: grid;
  gap: 2px;
}

.achados-wine-copy strong,
.achados-wine-copy span {
  display: block;
  overflow-wrap: anywhere;
}

.achados-vote-bar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  width: 100%;
  margin-top: auto;
}

.achados-vote-btn {
  --achados-gold: #c4a046;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 52px;
  padding: 6px 4px;
  border: 0;
  background: transparent;
  color: #000;
  font: inherit;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.15;
  text-align: center;
  cursor: pointer;
}

.achados-vote-btn svg {
  display: block;
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
}

.achados-vote-label,
.achados-vote-count {
  display: block;
}

.achados-vote-count {
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.achados-vote-btn.has-votes svg,
.achados-vote-btn.is-selected svg {
  width: 18px;
  height: 18px;
}

.achados-vote-btn.has-votes,
.achados-vote-btn.is-selected {
  font-size: 11px;
}

.achados-vote-btn.has-votes .achados-vote-count,
.achados-vote-btn.is-selected .achados-vote-count {
  font-size: 11px;
}

.achados-vote-btn.is-selected {
  color: var(--achados-gold);
}

.achados-vote-btn:disabled {
  opacity: 0.55;
  cursor: wait;
}

@media (max-width: 899px) {
  .achados-vote-bar {
    grid-template-columns: minmax(0, 0.66fr) minmax(0, 1fr) minmax(0, 1.34fr);
    grid-template-rows: repeat(3, minmax(0, auto));
    column-gap: 3px;
    row-gap: 2px;
  }

  .achados-vote-btn {
    display: grid;
    grid-template-rows: subgrid;
    grid-row: span 3;
    justify-items: center;
    align-items: center;
    gap: 0;
    min-height: 0;
    padding: 4px 2px;
    font-size: 9px;
  }

  .achados-vote-btn svg,
  .achados-vote-btn.has-votes svg,
  .achados-vote-btn.is-selected svg {
    width: 16px;
    height: 16px;
  }

  .achados-vote-btn.has-votes,
  .achados-vote-btn.is-selected {
    font-size: 9px;
  }

  .achados-vote-label {
    white-space: nowrap;
    font-size: 9px;
    line-height: 1.1;
    text-align: center;
  }

  .achados-vote-count,
  .achados-vote-btn.has-votes .achados-vote-count,
  .achados-vote-btn.is-selected .achados-vote-count {
    font-size: 10px;
    line-height: 1;
  }

  .achados-vote-btn[data-vote-kind="vale_a_grana"] {
    margin-left: 16px;
  }

  .achados-vote-btn[data-vote-kind="nao_vale"] {
    padding-inline: 0;
  }
}

@media (min-width: 900px) {
  .achados-home-body {
    display: grid;
    gap: 16px;
    min-height: calc(100vh - var(--app-header-offset, 72px) - 56px);
  }

  .achados-workspace {
    --achados-list-pane-height: calc(100vh - var(--app-header-offset, 72px) - 220px);
    grid-template-columns: minmax(280px, 0.92fr) minmax(0, 1.08fr);
    align-items: stretch;
    min-height: var(--achados-list-pane-height);
  }

  .achados-results-stream {
    display: flex;
    flex-direction: column;
    height: var(--achados-list-pane-height);
    min-height: 28rem;
    max-height: var(--achados-list-pane-height);
    overflow: hidden;
  }

  .achados-results-stream .est-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    margin-bottom: 0;
    padding-right: 10px;
    align-content: start;
    grid-auto-rows: max-content;
    gap: 10px;
  }

  .est-list .est-item-card {
    grid-template-columns: minmax(0, 1fr) 88px;
    gap: 12px;
    min-height: 144px;
    padding: 12px 14px;
    align-items: center;
    border-radius: var(--radius);
  }

  .est-list .est-item-card .achados-card-photo-wrap,
  .est-list .est-item-card .achados-card-photo {
    width: 88px;
    height: 88px;
    min-width: 88px;
    min-height: 88px;
  }

  .achados-detail-page,
  .achados-detail-page:not([hidden]),
  .achados-detail-page[hidden] {
    display: grid !important;
    gap: 12px;
    position: static;
    height: max-content;
    max-height: var(--achados-list-pane-height);
    overflow-y: auto;
    align-self: start;
    align-content: start;
  }

  .achados-pager {
    flex: 0 0 auto;
    margin: 12px 0 0;
  }

  .achados-list-actions {
    flex: 0 0 auto;
    display: block;
    margin: 12px 0 0;
    width: 100%;
  }

  .achados-add-est-btn {
    display: inline-flex;
    width: 100%;
    justify-content: center;
  }

  .achados-page .achados-detail-toolbar,
  .achados-page .achados-back {
    display: none !important;
  }

  .achados-est-detail-card {
    grid-template-columns: minmax(0, 1fr) 88px;
  }

  .achados-est-detail-card .achados-card-photo-wrap,
  .achados-est-detail-card .achados-card-photo {
    width: 88px;
    height: 88px;
    min-width: 88px;
    min-height: 88px;
  }

  .achados-wine-copy {
    min-height: 128px;
  }

  .achados-wine-photo-wrap,
  .achados-wine-photo {
    width: 88px;
    height: 128px;
    min-width: 88px;
    min-height: 128px;
  }

  .achados-vote-btn {
    font-size: 11px;
    min-height: 56px;
  }

  .achados-vote-btn.has-votes svg,
  .achados-vote-btn.is-selected svg {
    width: 20px;
    height: 20px;
  }

  .achados-vote-btn.has-votes,
  .achados-vote-btn.is-selected {
    font-size: 12px;
  }

  .achados-vote-btn.has-votes .achados-vote-count,
  .achados-vote-btn.is-selected .achados-vote-count {
    font-size: 12px;
  }
}

.achados-success {
  color: #1a6b3c;
  font-size: 14px;
  margin: 0.5rem 0;
}

.achados-register-success {
  margin-top: 1rem;
}

.achados-perfil-body .cred-form-title {
  margin-top: 1.5rem;
}

.achados-perfil-col-main .cred-form-title:first-child,
.achados-perfil-col-security .cred-form-title:first-child {
  margin-top: 0;
}

@media (min-width: 900px) {
  .achados-perfil-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: start;
  }
}

.achados-totp-action-btn {
  width: 100%;
  max-width: 28rem;
  margin-top: 0.5rem;
}

.achados-totp-setup,
.achados-totp-disable-panel {
  margin-top: 1rem;
  max-width: 28rem;
}

.achados-totp-qr {
  margin: 0.75rem 0 1rem;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--white);
  width: fit-content;
}

.achados-totp-qr svg {
  display: block;
  width: 180px;
  height: 180px;
}

.achados-totp-enable-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-end;
}

.achados-totp-enable-row label {
  flex: 1 1 10rem;
  min-width: 0;
}

.achados-totp-enable-row .hard-btn {
  flex: 0 0 auto;
}

.achados-totp-disable-submit {
  width: 100%;
  margin-top: 0.25rem;
}

.achados-perfil-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 1rem;
}

.achados-stat {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  text-align: center;
}

.achados-stat strong {
  display: block;
  font-size: 1.5rem;
  line-height: 1.2;
}

.achados-stat span {
  font-size: 12px;
  color: var(--muted);
}

.achados-totp-uri code {
  display: block;
  word-break: break-all;
  font-size: 11px;
  margin: 0.5rem 0;
}

.achados-form-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-end;
}

.app-header-user {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  margin-left: 6px;
}

.app-header-user[hidden] {
  display: none !important;
}
