/* Checkout externo Grupo Polo Sul
   Estrutura do checkout nativo da Shopify (formulario a esquerda, trilho do
   resumo tingido a direita sangrando ate a borda), com a marca da Polo Sul.
   Paleta medida em grupopolosul.com.br. */

:root {
  color-scheme: light;

  --brand: #0a3a84;
  --brand-dark: #082c64;
  --brand-deep: #061f47;
  --brand-tint: #f4f8ff;
  --brand-tint-2: #e8f0fd;
  --cyan: #1ea7e1;
  --cyan-soft: #7ed6f7;

  --ink: #1a1a2e;
  --muted: #64748b;
  --muted-soft: #94a3b8;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --rail: #f2f4f7;
  --white: #ffffff;

  --success: #10b981;
  --success-ink: #05704f;
  --success-tint: #e9fbf3;
  --warn-ink: #9a6414;
  --warn-tint: #fffaf0;
  --warn-line: #f0d9a8;

  --radius: 8px;
  --radius-sm: 6px;
  --shadow-sm: 0 1px 2px rgba(26, 26, 46, 0.05);
  --shadow-md: 0 4px 16px rgba(10, 58, 132, 0.08);
  --shadow-brand: 0 6px 18px rgba(10, 58, 132, 0.26);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--white);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

a {
  color: var(--brand);
}

:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

/* ---------------- barra da loja ---------------- */

.store-bar {
  background: linear-gradient(180deg, var(--brand) 0%, var(--brand-dark) 100%);
  color: var(--white);
}

.store-bar-inner {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: 17px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--brand);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.brand-name {
  display: flex;
  flex-direction: column;
  font-size: 15.5px;
  font-weight: 600;
  line-height: 1.2;
}

.brand-name small {
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--cyan-soft);
}

.secure {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 13px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.13);
  font-size: 12.5px;
  font-weight: 500;
}

/* ---------------- estrutura de duas colunas ---------------- */

.checkout {
  position: relative;
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
}

/* trilho tingido do resumo, sangrando ate a borda direita da viewport */
.checkout::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(100% - 432px);
  right: calc(50% - 50vw);
  background: var(--rail);
  border-left: 1px solid var(--line);
  z-index: 0;
}

.grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 400px;
  gap: 64px;
  align-items: start;
}

.col-form,
.col-summary {
  padding: 34px 0 56px;
  min-width: 0;
}

/* ---------------- trilha de etapas ---------------- */

.crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 26px;
  font-size: 13px;
  color: var(--muted);
}

.crumbs span::after {
  content: "›";
  margin-left: 8px;
  color: var(--line-strong);
}

.crumbs span:last-child::after {
  content: none;
}

.crumbs [aria-current="step"] {
  color: var(--ink);
  font-weight: 500;
}

/* ---------------- passos do formulario ---------------- */

.step + .step {
  margin-top: 32px;
  padding-top: 30px;
  border-top: 1px solid var(--line);
}

h2 {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 0 0 18px;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.step-num {
  display: grid;
  place-items: center;
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: var(--brand);
  color: var(--white);
  font-size: 13px;
  font-weight: 700;
}

label {
  display: block;
  margin-bottom: 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}

input {
  display: block;
  width: 100%;
  margin-top: 6px;
  min-height: 48px;
  padding: 0 13px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--ink);
}

select {
  display: block;
  width: 100%;
  margin-top: 6px;
  min-height: 48px;
  padding: 0 40px 0 13px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 15px center;
  background-size: 12px 8px;
}

select:hover {
  border-color: var(--muted-soft);
}

select:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(30, 167, 225, 0.22);
}

input:hover {
  border-color: var(--muted-soft);
}

input:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(30, 167, 225, 0.22);
}

/* mensagem curta abaixo do campo: CEP encontrado, documento invalido */
.field-status {
  display: block;
  margin-top: 5px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  min-height: 16px;
}

.field-status.good {
  color: var(--success-ink);
}

.field-status.bad {
  color: #b4342a;
}

label:has(.field-status:not(:empty)) {
  margin-bottom: 9px;
}

.field-pair,
.address-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 14px;
}

.wide {
  grid-column: 1 / -1;
}

.locked input {
  background: var(--rail);
  color: var(--muted);
  border-color: var(--line);
}

/* ---------------- opcoes ricas (CPF/CNPJ, Pix/Cartao) ---------------- */

.segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.opt {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 0;
  padding: 14px 15px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--white);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.opt:hover {
  border-color: var(--brand);
}

.opt input {
  width: auto;
  min-height: auto;
  margin: 0;
  flex: none;
  accent-color: var(--brand);
}

.opt-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.opt-title {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
}

.opt-sub {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
}

.opt:has(input:checked) {
  border-color: var(--brand);
  box-shadow: inset 0 0 0 1px var(--brand);
  background: var(--brand-tint);
}

.save-badge {
  margin-left: auto;
  flex: none;
  padding: 3px 8px;
  border-radius: 5px;
  background: var(--success-tint);
  color: var(--success-ink);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.save-badge:empty {
  display: none;
}

.check {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 14px;
  min-height: 50px;
  padding: 0 15px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-size: 14.5px;
  font-weight: 500;
  cursor: pointer;
}

.check input {
  width: auto;
  min-height: auto;
  margin-top: 0;
  accent-color: var(--brand);
}

/* ---------------- botoes ---------------- */

button {
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--ink);
  font-size: 14.5px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

button:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  min-height: 58px;
  margin-top: 4px;
  border: none;
  border-radius: var(--radius);
  background: linear-gradient(180deg, #0f4699 0%, var(--brand) 100%);
  color: var(--white);
  font-size: 16.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
  box-shadow: var(--shadow-brand);
}

.primary:hover {
  background: linear-gradient(180deg, var(--brand) 0%, var(--brand-deep) 100%);
  color: var(--white);
}

.primary-total {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  opacity: 0.85;
}

.primary-total:not(:empty)::before {
  content: "·";
  margin-right: 12px;
  opacity: 0.5;
}

/* ---------------- selo de confianca ---------------- */

.trust {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 20px;
  margin-top: 16px;
  font-size: 12.5px;
  color: var(--muted);
}

.trust-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* ---------------- opcoes de frete ---------------- */

.rates {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.rate {
  display: grid;
  gap: 3px;
  justify-items: start;
  text-align: left;
  min-height: 0;
  padding: 14px 16px;
  border-radius: var(--radius);
  box-shadow: none;
}

.rate strong {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink);
}

.rate span {
  font-size: 12.5px;
  color: var(--muted);
}

.rate:hover {
  color: inherit;
}

.rate.selected {
  border-color: var(--brand);
  box-shadow: inset 0 0 0 1px var(--brand);
  background: var(--brand-tint);
}

/* ---------------- resumo do pedido ---------------- */

.summary {
  position: sticky;
  top: 24px;
}

.summary h2 {
  margin-bottom: 20px;
}

.item {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.item-media {
  position: relative;
  flex: none;
}

.thumb {
  display: block;
  width: 58px;
  height: 58px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--white);
  object-fit: cover;
}

.thumb-empty {
  display: grid;
  place-items: center;
  background: var(--brand-tint-2);
  color: var(--brand);
  font-size: 20px;
  font-weight: 700;
}

.qty {
  position: absolute;
  top: -8px;
  right: -8px;
  display: grid;
  place-items: center;
  min-width: 21px;
  height: 21px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--brand);
  color: var(--white);
  font-size: 11.5px;
  font-weight: 700;
  box-shadow: 0 0 0 2px var(--rail);
}

.item > div:last-child {
  display: flex;
  flex: 1;
  gap: 12px;
  justify-content: space-between;
  min-width: 0;
}

.item strong {
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.35;
}

.item small {
  color: var(--muted);
  font-size: 12px;
}

.item > div:last-child > span {
  white-space: nowrap;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.components {
  margin: 7px 0 0;
  padding-left: 15px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

dl {
  display: grid;
  gap: 12px;
  margin: 22px 0 0;
}

.total-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  font-size: 14.5px;
  color: var(--muted);
}

.total-row dd {
  margin: 0;
  color: var(--ink);
  font-weight: 500;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.total-row.discount,
.total-row.discount dd {
  color: var(--success-ink);
  font-weight: 600;
}

.total-row.final {
  margin-top: 6px;
  padding-top: 18px;
  border-top: 1px solid var(--line-strong);
  align-items: baseline;
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
}

.total-row.final dd {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.025em;
}

.saved-note {
  margin-top: 4px;
  padding: 10px 13px;
  border-radius: var(--radius-sm);
  background: var(--success-tint);
  color: var(--success-ink);
  font-size: 13px;
  text-align: center;
}

.saved-note strong {
  font-weight: 700;
}

/* ---------------- avisos e resultado do pagamento ---------------- */

.payment-result:not(:empty) {
  margin-top: 28px;
}

.company-result:not(:empty),
.address-lock:not(:empty) {
  margin: 4px 0 16px;
}

.notice {
  padding: 15px 16px;
  border: 1px solid #c3d5ef;
  border-radius: var(--radius);
  background: var(--brand-tint);
  font-size: 14px;
}

.notice.warn {
  border-color: var(--warn-line);
  background: var(--warn-tint);
  color: var(--warn-ink);
}

.status-line {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13.5px;
}

.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid #c3d5ef;
  border-top-color: var(--cyan);
  border-radius: 999px;
  animation: spin 0.8s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation-duration: 3s;
  }
}

.pix-qr {
  display: block;
  width: 200px;
  max-width: 100%;
  aspect-ratio: 1;
  margin: 14px 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

/* ---------------- rodape legal ---------------- */

.legal {
  margin-top: 38px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--muted);
}

.legal p {
  margin: 0;
}

.legal-company {
  font-weight: 500;
}

.legal-links {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 8px !important;
}

.legal-links a {
  color: var(--muted);
  text-decoration: none;
}

.legal-links a:hover {
  color: var(--brand);
  text-decoration: underline;
}

/* ---------------- painel operacional (uso interno) ---------------- */

.admin {
  border-top: 1px solid var(--line);
  background: var(--rail);
}

.admin-inner {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: 26px 0 40px;
}

.admin-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 4px;
}

.admin-head h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}

.admin-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 13px 0;
  border-top: 1px solid var(--line);
  font-size: 13px;
}

.pill {
  display: inline-flex;
  width: fit-content;
  padding: 4px 11px;
  border-radius: 999px;
  background: var(--brand-tint-2);
  color: var(--brand);
  font-size: 11.5px;
  font-weight: 600;
}

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

/* ---------------- banco simulado ---------------- */

.bank {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.bank h1 {
  margin: 0;
  font-size: clamp(26px, 4vw, 38px);
}

/* ---------------- mobile: resumo vai para o topo ---------------- */

@media (max-width: 900px) {
  .checkout::before {
    content: none;
  }

  .grid {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .col-summary {
    order: -1;
    margin: 0 calc(50% - 50vw);
    padding: 24px calc(50vw - 50%) 24px;
    background: var(--rail);
    border-bottom: 1px solid var(--line);
  }

  .summary {
    position: static;
  }

  .col-form {
    padding-top: 28px;
  }
}

@media (max-width: 560px) {
  .segmented,
  .field-pair,
  .address-grid {
    grid-template-columns: 1fr;
  }

  .admin-row {
    grid-template-columns: 1fr;
  }

  .primary {
    flex-direction: column;
    gap: 2px;
    padding: 12px;
  }

  .primary-total::before {
    content: none !important;
  }
}
