/* Mobile First (RNF-03) · Responsivo (RNF-02) · Accesible (RNF-04) */
:root {
  --bg: #f4f6f8; --card: #ffffff; --text: #1c2733; --muted: #5b6b7b;
  --primary: #0b5cad; --primary-text: #ffffff; --border: #d7dee6;
  --ok-bg: #e6f4ea; --ok-fg: #14532d; --warn-bg: #fef3c7; --warn-fg: #78350f;
  --err-bg: #fde8e8; --err-fg: #7f1d1d; --info-bg: #e0edff; --info-fg: #1e3a8a;
}
* { box-sizing: border-box; }
body {
  margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.5;
}
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.skip-link {
  position: absolute; left: -999px; top: 0; background: var(--primary);
  color: #fff; padding: .5rem 1rem; z-index: 100;
}
.skip-link:focus { left: 0; }

.header { padding: 1rem; text-align: center; }
.header h1 { font-size: 1.25rem; margin: 0 0 .25rem; }
.subtitle { margin: 0 0 .5rem; color: var(--muted); font-size: .9rem; }
.badge {
  display: inline-block; padding: .2rem .7rem; border-radius: 999px; font-size: .8rem;
}
.badge--ok { background: var(--ok-bg); color: var(--ok-fg); }
.badge--err { background: var(--err-bg); color: var(--err-fg); }
.badge--pending { background: var(--warn-bg); color: var(--warn-fg); }

.status { margin: .5rem 1rem; padding: .7rem 1rem; border-radius: 8px; font-size: .95rem; }
.status--info { background: var(--info-bg); color: var(--info-fg); }
.status--success { background: var(--ok-bg); color: var(--ok-fg); }
.status--warning { background: var(--warn-bg); color: var(--warn-fg); }
.status--error { background: var(--err-bg); color: var(--err-fg); }

.layout { display: grid; gap: 1rem; padding: 1rem; grid-template-columns: 1fr; }
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; padding: 1rem;
}
.card h2 { font-size: 1rem; margin: 0 0 .75rem; }

.actions { display: flex; flex-wrap: wrap; gap: .6rem; }
.btn {
  min-height: 44px; min-width: 44px; padding: .6rem 1rem; border-radius: 8px;
  border: 1px solid transparent; font-size: .95rem; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.btn:focus-visible, input:focus-visible + .btn { outline: 3px solid #f59e0b; outline-offset: 2px; }
.btn--primary { background: var(--primary); color: var(--primary-text); }
.btn--secondary { background: #fff; color: var(--primary); border-color: var(--primary); }
.btn--ghost { background: transparent; color: var(--muted); border-color: var(--border); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.hint { color: var(--muted); font-size: .85rem; margin: .5rem 0 0; }
.canvas-wrap { position: relative; min-height: 140px; display: grid; place-items: center;
  background: #eef2f6; border-radius: 8px; overflow: hidden; }
canvas { max-width: 100%; height: auto; display: block; }
.placeholder { color: var(--muted); font-size: .9rem; padding: 2rem 1rem; text-align: center; }

.ocr-text {
  display: block; font-family: "Courier New", monospace; font-size: 2rem;
  font-weight: 700; letter-spacing: .15em; text-align: center;
  background: #0f172a; color: #4ade80; padding: 1rem; border-radius: 8px;
  overflow-wrap: anywhere;
}
.ocr-meta { display: flex; flex-wrap: wrap; gap: 1rem; margin: .75rem 0 0; }
.ocr-meta div { flex: 1 1 100px; }
.ocr-meta dt { font-size: .75rem; color: var(--muted); text-transform: uppercase; }
.ocr-meta dd { margin: 0; font-weight: 600; font-size: .9rem; overflow-wrap: anywhere; }

.overlay {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .55);
  display: grid; place-items: center; align-content: center; gap: 1rem;
  color: #fff; z-index: 50;
}
.spinner {
  width: 48px; height: 48px; border: 5px solid rgba(255,255,255,.3);
  border-top-color: #fff; border-radius: 50%; animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2s; } }

.camera-dialog { border: none; border-radius: 12px; padding: 1rem; width: min(94vw, 560px); }
.camera-dialog::backdrop { background: rgba(0,0,0,.6); }
.camera-dialog video { width: 100%; border-radius: 8px; background: #000; }
.camera-dialog .actions { margin-top: .75rem; justify-content: center; }

.footer { text-align: center; color: var(--muted); font-size: .8rem; padding: 1rem; }

/* Escritorio (GUI-10): 2 columnas */
@media (min-width: 768px) {
  .layout { grid-template-columns: 1fr 1fr; max-width: 1100px; margin: 0 auto; }
  .header h1 { font-size: 1.6rem; }
}