.md {
  --md-bg: rgba(255, 255, 255, 0.72);
  --md-ink: #0F2A4A;
  --md-muted: #4A5D78;
  --md-line: rgba(15, 42, 74, 0.10);
  --md-accent: #1F4FE0;
  --md-ok: #0B6B44;
  --md-warn: #A2560B;
  --md-radius: 22px;
  --md-ease: cubic-bezier(0.23, 1, 0.32, 1);
  position: relative;
  width: 100%;
  max-width: 440px;
  padding: 18px;
  border-radius: var(--md-radius);
  background: var(--md-bg);
  color: var(--md-ink);
  font-size: 15px;
  line-height: 1.35;
  -webkit-backdrop-filter: blur(22px) saturate(1.4);
  backdrop-filter: blur(22px) saturate(1.4);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset, 0 24px 60px -18px rgba(15, 42, 74, 0.35), 0 2px 6px rgba(15, 42, 74, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.55);
  font-variant-numeric: tabular-nums;
}
.md-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.md-avatar { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: var(--md-ink); }
.md-avatar img { width: 16px; height: 16px; }
.md-who { display: flex; flex-direction: column; }
.md-who strong { font-size: 14px; }
.md-status { color: var(--md-muted); font-size: 13.5px; transition: color .3s; }
.md[data-fase="hecho"] .md-status { color: var(--md-ok); }

.md-doc { position: relative; overflow: hidden; border-radius: 14px; background: rgba(255, 255, 255, 0.6); border: 1px solid var(--md-line); padding: 10px 12px; min-height: 340px; }
.md-doc-top { display: flex; justify-content: space-between; font-size: 12px; color: var(--md-muted); padding-bottom: 8px; border-bottom: 1px solid var(--md-line); margin-bottom: 4px; }
.md-lines { list-style: none; margin: 0; padding: 0; }
.md-line { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--md-line); opacity: 0; transform: translateY(6px); transition: opacity .45s var(--md-ease), transform .45s var(--md-ease); }
.md-line:last-child { border-bottom: 0; }
.md-line.is-in { opacity: 1; transform: none; }
.md-prod { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.md-uds { color: var(--md-muted); font-size: 13.5px; }
.md-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 600; padding: 3px 8px 3px 6px; border-radius: 99px; min-width: 96px; justify-content: center; transition: background .3s, color .3s; }
.md-chip svg { width: 13px; height: 13px; }
.md-chip i { width: 10px; height: 10px; border-radius: 50%; border: 1.6px solid currentColor; border-right-color: transparent; animation: md-spin .8s linear infinite; }
.md-chip[data-e="pend"] { color: var(--md-muted); background: rgba(15, 42, 74, 0.05); }
.md-chip[data-e="ok"] { color: var(--md-ok); background: rgba(14, 122, 79, 0.10); }
.md-chip[data-e="duda"], .md-chip[data-e="parecido"] { color: var(--md-warn); background: rgba(162, 86, 11, 0.10); }

.md-ask { margin: 2px 0 6px; padding: 10px 12px; border-radius: 12px; background: var(--md-ink); color: #fff; font-size: 13px; opacity: 0; transform: translateY(-4px) scale(.98); transform-origin: top center; transition: opacity .35s var(--md-ease), transform .35s var(--md-ease); }
.md-ask.is-in { opacity: 1; transform: none; }
.md-ask.is-out { opacity: 0; transform: translateY(-4px) scale(.98); }
.md-ask p { margin: 0 0 8px; }
.md-ask div { display: flex; gap: 6px; }
.md-ask button { position: relative; min-height: 34px; padding: 6px 14px; border: 0; border-radius: 9px; background: rgba(255, 255, 255, 0.14); color: #fff; font: inherit; font-weight: 600; cursor: pointer; transition: transform .16s var(--md-ease), background .2s, color .2s; }
.md-ask .md-yes { background: #fff; color: var(--md-ink); }
.md-ask button:hover { background: rgba(255, 255, 255, 0.24); }
.md-ask .md-yes:hover { background: #E8EEFF; }
.md-ask button:active, .md-ask button.is-press { transform: scale(.96); }
.md-ask button:disabled { cursor: default; }
.md-ask button:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.md-ask .md-yes::after { content: ""; position: absolute; inset: -4px; border-radius: 12px; border: 2px solid #fff; opacity: 0; pointer-events: none; }
.md-ask.llama .md-yes::after { animation: md-llama 1.6s var(--md-ease) infinite; }
.md-chip[data-e="fuera"] { color: var(--md-muted); background: rgba(15, 42, 74, 0.06); }
.md-line.md-fuera .md-prod, .md-line.md-fuera .md-uds { opacity: .5; text-decoration: line-through; text-decoration-thickness: 1px; }
.md-otra { margin-top: 10px; min-height: 34px; padding: 6px 14px; border: 0; border-radius: 9px; background: #fff; color: var(--md-ink); font: inherit; font-weight: 600; cursor: pointer; }

.md-scan { position: absolute; left: 0; right: 0; top: 0; height: 64px; pointer-events: none; opacity: 0; background: linear-gradient(to bottom, transparent, rgba(95, 130, 255, 0.16), transparent); }
.md[data-fase="leyendo"] .md-scan { opacity: 1; animation: md-scan 1s var(--md-ease) infinite; }

.md-foot { margin-top: 12px; }
.md-btn { position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 12px 14px; border-radius: 12px; font-weight: 600; font-size: 13px; color: var(--md-muted); background: rgba(15, 42, 74, 0.05); border: 1px dashed var(--md-line); transition: color .3s, background .3s, border-color .3s; }
.md-btn > span:last-child { position: relative; }
.md-bar { position: absolute; inset: 0; background: var(--md-accent); transform: scaleX(0); transform-origin: left; }
.md-btn.is-on { color: #fff; border-color: transparent; }
.md-btn.is-on .md-bar { transform: scaleX(1); transition: transform 1s var(--md-ease); }
.md-btn.md-progreso { padding: 0; height: 4px; border: 0; border-radius: 4px; background: rgba(15, 42, 74, 0.08); }
.md-tag { margin: 10px 0 0; font-size: 11px; color: var(--md-muted); text-align: center; letter-spacing: .01em; }

.md-result { position: absolute; left: 18px; right: 18px; bottom: 18px; padding: 14px; border-radius: 14px; background: var(--md-ink); color: #fff; font-size: 13.5px; opacity: 0; transform: translateY(8px); transition: opacity .45s var(--md-ease), transform .45s var(--md-ease); pointer-events: none; }
.md-result.is-in { opacity: 1; transform: none; pointer-events: auto; }
.md-result p { margin: 0; }

@keyframes md-llama { 0% { opacity: .7; transform: scale(.96); } 70%, 100% { opacity: 0; transform: scale(1.18); } }
@keyframes md-spin { to { transform: rotate(360deg); } }
@keyframes md-scan { from { transform: translateY(-64px); } to { transform: translateY(260px); } }

@media (prefers-reduced-motion: reduce) {
  .md *, .md { transition: none !important; animation: none !important; }
}
