/* MPX-009-002 — Documento Mi Pedido + verificación visual
   Filosofía: foto confirma; documento no es tarjeta ni catálogo. */

:root {
  --black: #111111;
  --white: #ffffff;
  --gold: #c4a05a;
  --gold-soft: rgba(196, 160, 90, 0.35);
  --paper: #f3f3f3;
  --muted: rgba(17, 17, 17, 0.55);
  --line: rgba(17, 17, 17, 0.08);
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.2);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

.mp-body {
  min-height: 100dvh;
  background: var(--paper);
  color: var(--black);
  font-family: Poppins, Montserrat, Arial, sans-serif;
}

.staging-env-banner {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #b45309;
  color: #fff;
  text-align: center;
  padding: 0.5rem;
  font-weight: 700;
  font-size: 0.875rem;
}

.mp-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  min-height: calc(100dvh - 2.5rem);
  max-width: 480px;
  margin: 0 auto;
  background: var(--white);
}

/* MPX-013 — identidad documental institucional */
.mp-header {
  display: grid;
  gap: 12px;
  padding: 18px 20px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--white);
}

.mp-doc-masthead {
  display: grid;
  justify-items: center;
  gap: 8px;
  text-align: center;
  padding: 8px 0 4px;
}

.mp-header__title {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.mp-header__rule {
  width: 48px;
  height: 1px;
  margin: 2px 0 4px;
  background: var(--gold);
}

.mp-header__id {
  margin: 0;
  font-size: 30px;
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1.05;
  color: var(--black);
}

.mp-header__meta {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--gold);
}

.mp-header__facts {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
  justify-items: start;
}

.mp-header__fact {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

.mp-header__fact strong {
  color: var(--black);
  font-weight: 700;
}

.mp-header__fact-icon {
  display: inline-flex;
  color: var(--gold);
}

.mp-stage {
  min-height: 0;
  overflow: auto;
  padding: 22px 20px 24px;
  -webkit-overflow-scrolling: touch;
}

.mp-document {
  display: grid;
  gap: 0;
  width: min(100%, 420px);
  margin: 0 auto;
  color: var(--black);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.45;
  word-break: break-word;
}

.mp-document__dept {
  margin: 28px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--gold-soft);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.mp-document__dept:first-child,
.mp-closure-lead + .mp-document__dept {
  margin-top: 0;
}

.mp-document__line {
  margin: 0;
}

.mp-document__divider {
  margin: 12px 0 4px;
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 0.02em;
}

.mp-closure-lead {
  display: grid;
  gap: 2px;
  margin-bottom: 16px;
}

.mp-product {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.mp-product:last-child {
  border-bottom: 0;
  padding-bottom: 4px;
}

.mp-product__photo {
  display: block;
  width: 96px;
  height: 96px;
  object-fit: contain;
  background: #f7f7f7;
  border: 1px solid rgba(17, 17, 17, 0.06);
  border-radius: 4px;
  box-shadow: none;
}

.mp-product__photo--empty {
  background: #f0f0f0;
}

.mp-product__body {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding-top: 2px;
}

.mp-product__name {
  margin: 0;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.3;
  text-transform: uppercase;
  letter-spacing: 0.01em;
}

.mp-product__code {
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}

.mp-product__sizes {
  display: grid;
  gap: 2px;
  margin-top: 4px;
}

.mp-product__size {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
}

.mp-closure-seal {
  display: grid;
  place-items: center;
  width: min(100%, 420px);
  margin: 28px auto 0;
}

.mp-closure-seal[hidden] {
  display: none !important;
}

.mp-closure-seal__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1.5px solid var(--gold);
  border-radius: 999px;
  color: var(--gold);
}

.mp-footnote {
  width: min(100%, 420px);
  margin: 14px auto 0;
  padding: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
  text-align: center;
}

.mp-footnote--closed {
  font-style: italic;
  font-weight: 500;
}

.mp-history {
  display: grid;
  gap: 6px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.mp-history__item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: baseline;
  width: 100%;
  margin: 0;
  padding: 4px 0;
  border: 0;
  background: transparent;
  color: var(--black);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.mp-history__item.is-active {
  font-weight: 700;
}

.mp-history__date,
.mp-history__ver,
.mp-history__status {
  font-size: 13px;
  font-weight: 600;
}

.mp-history__ver,
.mp-history__status {
  color: var(--muted);
}

.mp-history__item.is-active .mp-history__ver,
.mp-history__item.is-active .mp-history__status {
  color: var(--black);
}

.mp-history__sep {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.02em;
}

.mp-viewing-banner {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
}

.mp-text-action {
  display: block;
  width: min(100%, 420px);
  margin: 16px auto 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--black);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.mp-header .mp-text-action {
  width: 100%;
  margin-top: 8px;
}

.mp-text-action[hidden] {
  display: none !important;
}

.mp-add__option {
  display: grid;
  gap: 4px;
  width: 100%;
  margin: 0;
  padding: 14px 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.mp-add__option:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.mp-actions,
.mp-closure__actions {
  display: grid;
  gap: 10px;
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--line);
  background: var(--white);
  box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.06);
}

.mp-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 54px;
  padding: 0 18px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 0.02em;
  cursor: pointer;
}

.mp-cta:focus-visible {
  outline: 2px solid var(--black);
  outline-offset: 3px;
}

.mp-cta--primary {
  border: 1px solid var(--gold);
  background: var(--gold);
  color: var(--black);
}

.mp-cta--secondary {
  border: 1px solid rgba(13, 13, 13, 0.18);
  background: var(--white);
  color: var(--black);
}

.mp-cta.is-feedback {
  opacity: 0.85;
}

/* Punto de Cierre — mismo patrón que Certainty Point */
.mp-closure {
  position: fixed;
  inset: 0;
  top: 2.5rem;
  z-index: 90;
  display: grid;
  place-items: stretch;
  background: var(--paper);
}

.mp-closure[hidden] {
  display: none !important;
}

.mp-closure__panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: 100%;
  height: 100%;
  max-height: calc(100dvh - 2.5rem);
  background: var(--white);
}

.mp-closure__context {
  display: grid;
  gap: 4px;
  padding: 10px 14px 8px;
  border-bottom: 1px solid var(--line);
}

.mp-closure__back {
  justify-self: start;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--black);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  min-height: 32px;
  font-family: inherit;
}

.mp-closure__back:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.mp-closure__message {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.25;
}

.mp-closure__stage {
  min-height: 0;
  overflow: auto;
  padding: 12px 14px 16px;
  -webkit-overflow-scrolling: touch;
}

.mp-toast {
  position: fixed;
  left: 50%;
  bottom: calc(88px + env(safe-area-inset-bottom, 0px));
  z-index: 120;
  transform: translateX(-50%);
  max-width: min(92vw, 360px);
  padding: 12px 16px;
  border-radius: 8px;
  background: var(--black);
  color: var(--white);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  box-shadow: var(--shadow);
}

.mp-toast[hidden] {
  display: none !important;
}

body.mp-closure-open,
body.mp-overlay-open {
  overflow: hidden;
}

.mp-header__nav {
  margin: 0 0 8px;
}

.mp-document__empty,
.mp-document__hint {
  margin: 0 0 10px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--muted);
}

.mp-device-note {
  margin: 0;
  padding: 8px 16px 14px;
  font-size: 10px;
  line-height: 1.35;
  font-weight: 500;
  color: rgba(13, 13, 13, 0.42);
  text-align: center;
}

.mp-actions--closed #mpCloseOrder,
.mp-actions #mpCloseOrder[hidden] {
  display: none !important;
}

.mp-body.mp-demo .staging-env-banner {
  background: #7c2d12;
}

@media (min-width: 721px) {
  .mp-body {
    background: #e9e9e9;
  }

  .mp-shell {
    margin: 24px auto;
    min-height: min(92vh, 860px);
    border-radius: 8px;
    border: 1px solid rgba(13, 13, 13, 0.08);
    box-shadow: var(--shadow);
    overflow: hidden;
  }

  .mp-closure {
    top: 0;
    place-items: center;
    padding: 24px;
    background: rgba(0, 0, 0, 0.68);
    backdrop-filter: blur(8px);
  }

  .mp-closure__panel {
    width: min(100%, 480px);
    height: min(92vh, 860px);
    max-height: min(92vh, 860px);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    box-shadow: var(--shadow);
    overflow: hidden;
  }

  .mp-cta {
    min-height: 56px;
    font-size: 17px;
  }
}
