/* Facturas 3AMAT — app de captura (Spec §3.7). Pensada para el móvil, botones grandes. */

:root {
  --primary: #1f4e79;
  --primary-dark: #163a5a;
  --accent: #f1c232;
  --ok: #188038;
  --ok-bg: #e6f4ea;
  --ko: #c5221f;
  --ko-bg: #fce8e6;
  --warn: #7a4100;
  --warn-bg: #fef7e0;
  --text: #202124;
  --muted: #5f6368;
  --line: #dadce0;
  --soft: #f1f3f4;
  --bg: #ffffff;
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.4;
  -webkit-text-size-adjust: 100%;
}

[hidden] { display: none !important; }

.bar {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: var(--primary);
  color: #fff;
}
.bar-title { font-weight: 700; }
.bar-who { font-size: 14px; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

main {
  max-width: 560px;
  margin: 0 auto;
  padding: 16px 16px calc(24px + env(safe-area-inset-bottom));
}

.screen { display: flex; flex-direction: column; gap: 14px; }

h1 { font-size: 22px; margin: 4px 0 0; }
h2 { font-size: 16px; margin: 0 0 6px; }
p { margin: 0; }
.center { text-align: center; }
.muted { color: var(--muted); }

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.btn:active { background: var(--soft); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:active { background: var(--primary-dark); }
.btn.big { min-height: 60px; font-size: 18px; }
.btn.small { min-height: 40px; padding: 6px 12px; font-size: 15px; flex: none; }
.btn.link { border: none; background: none; color: var(--muted); font-weight: 400; text-decoration: underline; }
.btn:disabled { opacity: .5; }

.row { display: flex; gap: 10px; }
.row > * { flex: 1; }

.reminder {
  padding: 12px 14px;
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  background: var(--warn-bg);
  font-weight: 600;
}

.guide { display: grid; grid-template-columns: 1fr; gap: 10px; }
.guide ul { margin: 0; padding-left: 20px; }
.guide li { margin: 2px 0; }
.guide-ok, .guide-ko { padding: 10px 12px; border-radius: 10px; font-size: 15px; }
.guide-ok { background: var(--ok-bg); }
.guide-ko { background: var(--ko-bg); }

.steps { margin: 0; padding-left: 22px; }
.steps li { margin: 8px 0; }

.screen form { display: flex; flex-direction: column; gap: 12px; }

.code-input {
  width: 100%;
  min-height: 60px;
  padding: 10px;
  border: 2px solid var(--line);
  border-radius: 12px;
  font: inherit;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 28px;
  letter-spacing: 4px;
  text-align: center;
  text-transform: uppercase;
}
.code-input:focus { outline: none; border-color: var(--primary); }

.msg { padding: 10px 12px; border-radius: 10px; background: var(--soft); }
.msg.ok { background: var(--ok-bg); color: var(--ok); }
.msg.error { background: var(--ko-bg); color: var(--ko); }
.msg.warn { background: var(--warn-bg); color: var(--warn); }

.queue {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--soft);
  font-size: 15px;
}
.queue.warn { background: var(--warn-bg); color: var(--warn); }

.preview {
  width: 100%;
  max-height: 62vh;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--soft);
}

.thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.thumbs figure { margin: 0; width: 84px; text-align: center; font-size: 13px; color: var(--muted); }
.thumbs img { width: 84px; height: 112px; object-fit: cover; border: 1px solid var(--line); border-radius: 6px; }

.big-icon { font-size: 64px; text-align: center; margin-top: 16px; }

.spinner {
  width: 44px;
  height: 44px;
  margin: 40px auto 8px;
  border: 4px solid var(--soft);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}
