/* NexoGames DEMO · hoja de estilo única, mobile-first, sin recursos externos. */
:root {
  --ink: #0f172a;
  --ink-soft: #475569;
  --line: #e2e8f0;
  --bg: #f5f7fb;
  --card: #ffffff;
  --brand: #4c1d95;
  --brand-soft: #ede9fe;
  --ok: #047857;
  --ok-soft: #d1fae5;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --bad: #b91c1c;
  --bad-soft: #fee2e2;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 8px 24px rgba(15, 23, 42, .06);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

img, svg, table { max-width: 100%; }

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

h1, h2, h3 { line-height: 1.25; overflow-wrap: anywhere; }
h1 { font-size: 1.5rem; margin: .2rem 0 .35rem; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 1rem 0 .4rem; }

.muted { color: var(--ink-soft); font-size: .9rem; }
.hint { color: var(--ink-soft); font-size: .85rem; }

.demo-banner {
  background: #1e1b4b;
  color: #ede9fe;
  font-size: .8rem;
  padding: .5rem .75rem;
  text-align: center;
}

.shell {
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
  padding: 1rem .9rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
}

.page-head { display: flex; flex-direction: column; gap: .35rem; min-width: 0; }
.brand {
  font-weight: 800;
  letter-spacing: .02em;
  color: var(--brand);
  margin: 0;
  font-size: 1.05rem;
  text-transform: uppercase;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
  min-width: 0;
}
.card-info { background: #fffbeb; border-color: #fde68a; }
.card-ok { background: var(--ok-soft); border-color: #6ee7b7; }
.card-alert { background: var(--bad-soft); border-color: #fca5a5; }

.chip-row { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip {
  display: inline-block;
  padding: .18rem .6rem;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid transparent;
}
.chip-ok { background: var(--ok-soft); color: var(--ok); border-color: #6ee7b7; }
.chip-warn { background: var(--warn-soft); color: var(--warn); border-color: #fcd34d; }
.chip-bad { background: var(--bad-soft); color: var(--bad); border-color: #fca5a5; }
.chip-neutral { background: #e2e8f0; color: #334155; }

.kv { margin: 0; display: grid; grid-template-columns: 1fr; gap: .35rem; }
.kv-row { display: flex; flex-wrap: wrap; gap: .25rem .6rem; justify-content: space-between; padding: .4rem 0; border-bottom: 1px dashed var(--line); min-width: 0; }
.kv-row:last-child { border-bottom: 0; }
.kv-row dt { color: var(--ink-soft); font-size: .85rem; margin: 0; }
.kv-row dd { margin: 0; font-weight: 600; text-align: right; overflow-wrap: anywhere; }

.products { display: grid; grid-template-columns: 1fr; gap: .6rem; padding: 0; margin: 0; list-style: none; }
.product {
  display: flex; flex-direction: column; gap: .3rem;
  border: 2px solid var(--line); border-radius: 12px; padding: .75rem; cursor: pointer;
  background: #fff;
}
.product:hover { border-color: #c4b5fd; }
.product input { position: absolute; opacity: 0; pointer-events: none; }
.product.selected { border-color: var(--brand); background: var(--brand-soft); }
.product-title { font-weight: 700; }
.product-price { font-weight: 700; color: var(--brand); }
.product-demo { font-size: .75rem; color: var(--warn); font-weight: 600; }
.product-game { font-size: .75rem; font-weight: 700; color: var(--brand); text-transform: uppercase; letter-spacing: .02em; }
.filter-row { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .75rem; }
.filter-row .chip { cursor: pointer; font-size: .8rem; padding: .35rem .7rem; min-height: 32px; }

form .field { display: flex; flex-direction: column; gap: .25rem; margin-bottom: .75rem; min-width: 0; }
label { font-size: .85rem; font-weight: 600; color: #334155; }
input, select, textarea, button { font: inherit; }
input, select, textarea {
  width: 100%;
  padding: .6rem .7rem;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid #a78bfa; outline-offset: 1px; border-color: var(--brand); }

.grid-2 { display: grid; grid-template-columns: 1fr; gap: 0 .75rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .65rem 1rem; border-radius: 10px; border: 1px solid #cbd5e1;
  background: #fff; color: var(--ink); cursor: pointer; font-weight: 600;
  text-decoration: none; min-height: 44px;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-bad { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-block { width: 100%; }

.actions-row { display: flex; flex-wrap: wrap; gap: .5rem; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.actions .btn { flex: 1 1 100%; }

.inline-form { display: flex; flex-direction: column; gap: .5rem; }

.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.timeline li { border-left: 3px solid var(--brand-soft); padding: .15rem 0 .15rem .7rem; }
.timeline-type { margin: 0; font-weight: 700; font-size: .88rem; }

.summary-line { display: flex; justify-content: space-between; gap: .5rem; padding: .35rem 0; border-bottom: 1px dashed var(--line); }
.summary-line strong { text-align: right; }
.total-line { border-bottom: 0; font-size: 1.05rem; }

.steps { counter-reset: step; list-style: none; padding: 0; margin: 0 0 .5rem; display: flex; flex-direction: column; gap: .25rem; }
.steps li { font-size: .85rem; color: var(--ink-soft); }

.alert { border-radius: 10px; padding: .6rem .75rem; font-size: .88rem; margin: .5rem 0 0; }
.alert-ok { background: var(--ok-soft); color: #065f46; }
.alert-warn { background: var(--warn-soft); color: #92400e; }
.alert-bad { background: var(--bad-soft); color: #991b1b; }
.hidden { display: none !important; }

/* ---------------- admin ---------------- */
.metrics-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .6rem; }
.metric { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: .7rem; min-width: 0; }
.metric-value { font-size: 1.35rem; font-weight: 800; }
.metric-label { font-size: .78rem; color: var(--ink-soft); }

.order-cards { display: grid; grid-template-columns: 1fr; gap: .6rem; }
.order-card { border: 1px solid var(--line); border-radius: 12px; padding: .7rem; background: #fff; cursor: pointer; }
.order-card.selected { border-color: var(--brand); background: var(--brand-soft); }
.order-card-head { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; justify-content: space-between; }
.order-number { font-weight: 800; overflow-wrap: anywhere; }

.data-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.data-table th, .data-table td { text-align: left; padding: .45rem .4rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.data-table th { color: var(--ink-soft); font-size: .78rem; text-transform: uppercase; letter-spacing: .02em; }
.table-scroll { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-scroll:focus-visible { outline: 2px solid #a78bfa; outline-offset: 2px; }
.scroll-hint { display: none; font-size: .75rem; color: var(--ink-soft); margin: .35rem 0 0; }

.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85rem; overflow-wrap: anywhere; }

.login-card { max-width: 420px; margin: 10vh auto 0; }
.mock-controls { display: flex; flex-wrap: wrap; gap: .5rem; align-items: end; }
.mock-controls .field { margin-bottom: 0; flex: 1 1 180px; }

.site-footer { text-align: center; padding: 1rem .9rem 2rem; color: var(--ink-soft); font-size: .8rem; }
.site-footer p { margin: 0 0 .6rem; }
.footer-links { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; }
.footer-links .btn { min-height: 36px; padding: .45rem .8rem; font-size: .82rem; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (min-width: 560px) {
  .products { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .actions .btn { flex: 0 1 auto; }
  .kv-row { flex-wrap: nowrap; }
  h1 { font-size: 1.75rem; }
}

@media (min-width: 900px) {
  .shell { padding: 1.5rem 1.25rem 4rem; }
  .products { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  h1 { font-size: 2rem; }
}

@media (max-width: 640px) {
  .scroll-hint { display: block; }
}

@media print {
  .demo-banner, .site-footer, .no-print { display: none !important; }
  .card { box-shadow: none; border-color: #999; }
}

/* ---------------- simulador de WhatsApp ---------------- */
.chat-page { background: #e5ddd5; }
.chat-shell { display: flex; flex-direction: column; gap: 1rem; max-width: 1040px; margin: 0 auto; padding: 1rem .75rem 2rem; }
.chat-card { background: #fff; border-radius: 14px; overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; min-height: 70vh; min-width: 0; }
.chat-head { display: flex; align-items: center; gap: .6rem; background: #075e54; color: #fff; padding: .7rem .8rem; }
.chat-avatar { width: 40px; height: 40px; border-radius: 50%; background: #25d366; color: #04352c; font-weight: 800; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.chat-head-text { min-width: 0; flex: 1 1 auto; }
.chat-title { margin: 0; font-weight: 700; font-size: 1rem; }
.chat-subtitle { margin: 0; font-size: .78rem; color: #d1fae5; overflow-wrap: anywhere; }
.chat-reset { flex: 0 0 auto; padding: .4rem .7rem; min-height: 36px; font-size: .8rem; }
.chat-body { flex: 1 1 auto; overflow-y: auto; padding: .9rem .75rem; display: flex; flex-direction: column; gap: .5rem; background: #ece5dd; max-height: 60vh; min-height: 320px; }
.bubble { max-width: 85%; padding: .55rem .7rem; border-radius: 12px; font-size: .92rem; line-height: 1.4; box-shadow: 0 1px 1px rgba(0,0,0,.08); overflow-wrap: anywhere; }
.bubble-bot { background: #fff; align-self: flex-start; border-top-left-radius: 4px; }
.bubble-client { background: #dcf8c6; align-self: flex-end; border-top-right-radius: 4px; }
.bubble-options { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .5rem; }
.bubble-options .chip { cursor: pointer; }
.chat-quick { display: flex; flex-wrap: wrap; gap: .4rem; padding: .5rem .75rem 0; }
.chat-input { display: flex; gap: .4rem; padding: .6rem .75rem; border-top: 1px solid var(--line); align-items: center; }
.chat-input input[type="text"], .chat-input > input { flex: 1 1 auto; min-width: 0; }
.chat-attach {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  min-width: 44px; min-height: 44px; font-size: 1.2rem; cursor: pointer;
  border: 1px solid #cbd5e1; border-radius: 10px; background: #fff;
}
.chat-attach input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.chat-attach:has(input:checked) { background: var(--brand-soft); border-color: var(--brand); }
.chat-attach:has(input:focus-visible) { outline: 2px solid #a78bfa; outline-offset: 2px; }
.chat-hint { margin: 0; padding: 0 .75rem .8rem; font-size: .75rem; color: var(--ink-soft); }
.chat-side { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }

@media (min-width: 900px) {
  .chat-shell { flex-direction: row; align-items: flex-start; padding: 1.5rem 1.25rem 3rem; }
  .chat-card { flex: 2 1 0; }
  .chat-side { flex: 1 1 320px; max-width: 380px; }
  .chat-body { max-height: 65vh; }
}

.dev-token { margin: .5rem 0 1rem; }
.dev-token summary { cursor: pointer; font-size: .85rem; color: var(--ink-soft); }
