/* ECO3 Rewards — shared styles for the customer app (/) and the staff app (/personal/). */
:root {
  --navy: #213964; --navy-2: #2c4a80; --orange: #e6973f; --orange-soft: #fbecd9;
  --ink: #1d2436; --ink-2: #4b5563; --muted: #6f6f6f; --line: #e6e3de;
  --bg: #f4f1ec; --card: #ffffff; --good: #2e7d4f; --good-soft: #e3f3e9; --bad: #b3261e; --warn-soft: #fff3cd;
  --radius: 14px; --shadow: 0 4px 16px rgba(29, 36, 54, .08);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { font-family: 'Open Sans', system-ui, sans-serif; color: var(--ink); background: var(--bg); font-size: 15px; line-height: 1.45; -webkit-tap-highlight-color: transparent; }
h1, h2, h3, h4 { font-family: 'Raleway', sans-serif; margin: 0; color: var(--ink); }
button { font: inherit; cursor: pointer; }
input, select { font: inherit; }
a { color: var(--navy); }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }

/* ---------- buttons, cards, lists ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 10px; padding: 12px 16px; font-weight: 700; background: var(--navy); color: #fff; text-decoration: none; }
.btn.block { width: 100%; }
.btn.ghost { background: transparent; color: var(--navy); border: 1.5px solid var(--navy); }
.btn.orange { background: var(--orange); }
.btn.good { background: var(--good); }
.btn.danger { background: transparent; color: var(--bad); border: 1.5px solid var(--bad); }
.btn.small { padding: 8px 12px; font-size: .88rem; }
.btn:disabled { background: #cfd3da; color: #fff; cursor: not-allowed; border-color: transparent; }
.pill-btn { border: 1.5px solid var(--line); background: #fff; border-radius: 99px; padding: 7px 14px; font-weight: 600; font-size: .85rem; color: var(--ink-2); text-decoration: none; display: inline-block; }
.pill-btn[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: #fff; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.card + .card, .card + .section-title, .section-title + .card { margin-top: 14px; }
.section-title { font-family: 'Raleway', sans-serif; font-weight: 700; font-size: 1rem; margin: 20px 2px 10px; }
.small:not(.btn) { font-size: .82rem; color: var(--ink-2); }
.muted { color: var(--muted); }
.error { color: var(--bad); font-size: .88rem; margin: 8px 0 0; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list .t { font-weight: 600; font-size: .92rem; }
.list .s { font-size: .78rem; color: var(--muted); }
.pts { font-weight: 700; white-space: nowrap; }
.pts.plus { color: var(--good); } .pts.minus { color: var(--bad); }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: .75rem; font-weight: 700; padding: 4px 10px; border-radius: 99px; white-space: nowrap; }
.chip.bronce { background: #f3e3d3; color: #7a4a1d; } .chip.plata { background: #e8ecf2; color: #3e4b61; } .chip.oro { background: #fbe9c2; color: #7a5600; }
.badge { font-size: .7rem; font-weight: 700; padding: 3px 8px; border-radius: 99px; white-space: nowrap; }
.badge.pendiente { background: var(--warn-soft); color: #7a5600; } .badge.entregado { background: var(--good-soft); color: var(--good); } .badge.cancelado { background: #f1f1f1; color: var(--muted); }
.progress { height: 10px; background: #efe9e1; border-radius: 99px; overflow: hidden; margin: 14px 0 8px; }
.progress span { display: block; height: 100%; background: var(--orange); border-radius: 99px; }
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: .8rem; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.field input, .field select, .input { width: 100%; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); }
.field input:focus, .field select:focus, .input:focus { outline: none; border-color: var(--navy); }
.code-input { font-size: 1.8rem; letter-spacing: .5em; text-align: center; font-weight: 700; padding-left: .5em !important; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.code-box { font-family: 'Raleway', sans-serif; font-weight: 800; font-size: 1.8rem; letter-spacing: .12em; color: var(--navy); background: var(--orange-soft); border-radius: 12px; padding: 10px 18px; display: inline-block; }
.qr { width: 230px; height: 230px; background: #fff; padding: 12px; border-radius: 12px; border: 1px solid var(--line); }
.qr svg { width: 100%; height: 100%; display: block; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--navy); border-radius: 50%; animation: spin .8s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- modal & toast ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(29, 36, 54, .45); display: flex; align-items: flex-end; justify-content: center; z-index: 40; }
.modal { background: #fff; width: 100%; max-width: 520px; border-radius: 22px 22px 0 0; padding: 24px 20px calc(24px + env(safe-area-inset-bottom)); max-height: 92vh; overflow: auto; }
.modal h3 { font-size: 1.15rem; margin-bottom: 8px; }
@media (min-width: 700px) { .modal-bg { align-items: center; } .modal { border-radius: 18px; } }
.toast { position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 99px; font-size: .88rem; font-weight: 600; z-index: 60; box-shadow: var(--shadow); max-width: 92vw; text-align: center; }

/* ---------- customer app ---------- */
.app { max-width: 480px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; background: var(--bg); }
@media (min-width: 520px) { body.customer { background: #e9e5df; } .app { box-shadow: 0 0 40px rgba(0, 0, 0, .08); } }
.app-main { flex: 1; padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
.app-head { background: var(--navy); color: #fff; padding: calc(14px + env(safe-area-inset-top)) 20px 26px; }
.app-head img { height: 32px; display: block; }
.app-head .row { display: flex; justify-content: space-between; align-items: center; }
.app-head h2 { color: #fff; font-size: 1.35rem; margin-top: 14px; }
.app-body { padding: 16px; }
.lift { margin-top: -16px; position: relative; }
.points-num { font-family: 'Raleway', sans-serif; font-weight: 800; font-size: 3rem; line-height: 1; color: var(--navy); }
.points-label { color: var(--muted); font-size: .85rem; }
.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.quick button { border: 0; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 12px; text-align: left; }
.quick button b { display: block; font-family: 'Raleway', sans-serif; font-size: .98rem; color: var(--ink); }
.quick button span { font-size: .78rem; color: var(--muted); }
.nudge { background: var(--orange-soft); box-shadow: none; border: 1px solid #f2d3ac; }
.nudge h4 { font-size: .98rem; margin-bottom: 4px; }
.promo { background: linear-gradient(135deg, var(--navy), var(--navy-2)); color: #fff; }
.promo h4 { color: #fff; font-size: 1rem; margin-bottom: 4px; }
.promo p { margin: 0; color: #dfe6f3; font-size: .85rem; }
.promo a { color: #fff; font-weight: 700; }
.reward { display: flex; gap: 14px; align-items: center; }
.reward .ic { flex: none; width: 52px; height: 52px; border-radius: 12px; background: var(--orange-soft); display: flex; align-items: center; justify-content: center; font-size: 1.5rem; }
.reward .info { flex: 1; min-width: 0; }
.reward h4 { font-size: .98rem; }
.reward .cost { font-weight: 700; color: var(--orange); font-size: .85rem; }
.center { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; }
.member-id { font-family: 'Raleway', sans-serif; font-weight: 800; letter-spacing: .06em; font-size: 1.2rem; color: var(--navy); }
.tabbar { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 480px; display: grid; grid-template-columns: repeat(5, 1fr); background: #fff; border-top: 1px solid var(--line); padding: 6px 4px calc(8px + env(safe-area-inset-bottom)); z-index: 30; }
.tabbar button { border: 0; background: transparent; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .68rem; color: var(--muted); padding: 6px 0; }
.tabbar svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabbar button[aria-current="page"] { color: var(--navy); font-weight: 700; }
.login { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; background: var(--navy); color: #fff; }
.login .top { padding: calc(44px + env(safe-area-inset-top)) 28px 30px; text-align: center; }
.login .top img { height: 46px; }
.login .top h1 { color: #fff; font-size: 1.7rem; margin-top: 24px; }
.login .top p { color: #dfe6f3; margin: 8px 0 0; }
.login .sheet { flex: 1; background: var(--bg); border-radius: 26px 26px 0 0; padding: 26px 22px calc(26px + env(safe-area-inset-bottom)); color: var(--ink); }
.login .sheet a { color: var(--navy); font-weight: 600; }
.perks { display: grid; gap: 10px; margin: 22px 0 0; }
.perks div { display: flex; gap: 10px; align-items: center; font-size: .88rem; color: var(--ink-2); }
.perks b { flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--orange-soft); display: flex; align-items: center; justify-content: center; }
.toggle { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.toggle:last-child { border-bottom: 0; }
.toggle .t { font-weight: 600; }
.switch { width: 46px; height: 28px; border-radius: 99px; background: var(--good); position: relative; flex: none; border: 0; }
.switch::after { content: ""; position: absolute; top: 4px; left: 22px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: left .15s; }
.switch[aria-checked="false"] { background: #cfd3da; } .switch[aria-checked="false"]::after { left: 4px; }

/* ---------- staff app ---------- */
body.staff-body { background: var(--bg); }
.staff { display: grid; grid-template-columns: 230px minmax(0, 1fr); min-height: 100vh; }
.staff { background: linear-gradient(90deg, var(--navy) 230px, var(--bg) 230px); }
.side { background: var(--navy); color: #fff; padding: 20px 14px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; align-self: start; }
.side img { height: 34px; width: auto; align-self: flex-start; object-fit: contain; margin: 4px 8px; }
.side .who { font-size: .75rem; color: #c9d3e6; margin: 2px 8px 18px; word-break: break-all; }
.side .nav-btn { display: flex; align-items: center; gap: 10px; border: 0; background: transparent; color: #dfe6f3; text-align: left; padding: 10px 12px; border-radius: 10px; font-weight: 600; }
.side .nav-btn svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.side .nav-btn[aria-current="page"] { background: rgba(255, 255, 255, .14); color: #fff; }
.side .count { margin-left: auto; background: var(--orange); color: #fff; font-size: .7rem; padding: 1px 7px; border-radius: 99px; }
.side .spacer { flex: 1; }
.side .logout { border: 1px solid rgba(255, 255, 255, .3); background: transparent; color: #fff; border-radius: 10px; padding: 8px 12px; }
.main { padding: 26px 30px 60px; min-width: 0; }
.main-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.main-head h2 { font-size: 1.5rem; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.prod { border: 1.5px solid var(--line); background: #fff; border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.prod b { font-size: .9rem; }
.prod .price { color: var(--muted); font-size: .8rem; }
.prod.on { border-color: var(--navy); box-shadow: 0 0 0 2px rgba(33, 57, 100, .12); }
.stepper { display: flex; align-items: center; gap: 8px; margin-top: auto; }
.stepper button { width: 36px; height: 36px; border-radius: 8px; border: 1.5px solid var(--line); background: #fff; font-weight: 700; font-size: 1.1rem; line-height: 1; }
.stepper output { min-width: 22px; text-align: center; font-weight: 700; }
.cust-pill { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; background: #fff; border: 1.5px solid var(--navy); flex-wrap: wrap; }
.avatar { flex: none; width: 42px; height: 42px; border-radius: 50%; background: var(--navy); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-family: 'Raleway', sans-serif; }
.summary .row { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; font-size: .92rem; }
.summary .row.total { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 12px; font-weight: 700; font-size: 1.05rem; }
.summary .row.pts-row { color: var(--good); font-weight: 700; }
.results { margin-top: 8px; border: 1px solid var(--line); border-radius: 10px; background: #fff; overflow: hidden; }
.results button { display: flex; width: 100%; justify-content: space-between; gap: 10px; border: 0; border-bottom: 1px solid var(--line); background: #fff; padding: 11px 12px; text-align: left; }
.results button:last-child { border-bottom: 0; }
.results button:hover { background: #f7f5f2; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--line); }
td { padding: 11px 12px; border-bottom: 1px solid var(--line); }
td .sub { display: block; font-size: .78rem; color: var(--muted); }
tr.click { cursor: pointer; } tr.click:hover { background: #faf8f5; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td input, td select { padding: 7px 9px; border: 1.5px solid var(--line); border-radius: 8px; width: 100%; background: #fff; }
.table-wrap { overflow-x: auto; }
.filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.filters .input { max-width: 340px; padding: 9px 12px; }
.status-inactive, .status-active { display: inline-flex; align-items: center; gap: 5px; font-size: .78rem; font-weight: 700; }
.status-inactive { color: #8a4b00; } .status-active { color: var(--good); }
.status-inactive::before, .status-active::before { content: ""; width: 8px; height: 8px; border-radius: 50%; }
.status-inactive::before { background: #d97706; } .status-active::before { background: var(--good); }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; }
.kpi .label { font-size: .8rem; color: var(--ink-2); font-weight: 600; }
.kpi .value { font-family: 'Raleway', sans-serif; font-weight: 800; font-size: 2rem; color: var(--ink); line-height: 1.15; margin-top: 4px; }
.kpi .sub { font-size: .78rem; color: var(--muted); }
.chart-card { position: relative; }
.chart-card .head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.chart svg { width: 100%; height: auto; display: block; }
.chart .grid line { stroke: #ece8e2; }
.chart .axis text { fill: var(--muted); font-size: 11px; font-family: 'Open Sans', sans-serif; }
.chart .bar { fill: var(--navy); } .chart .bar.hl { fill: var(--navy-2); }
.chart .hit { fill: transparent; }
.tip { position: absolute; pointer-events: none; background: var(--ink); color: #fff; padding: 6px 10px; border-radius: 8px; font-size: .8rem; white-space: nowrap; transform: translate(-50%, -115%); z-index: 5; }
.tip b { display: block; }
.drawer-bg { position: fixed; inset: 0; background: rgba(29, 36, 54, .35); z-index: 40; display: flex; justify-content: flex-end; }
.drawer { width: min(460px, 100%); height: 100%; background: #fff; padding: 24px; overflow: auto; }
.set-row { display: grid; grid-template-columns: 1fr 140px; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.set-row input { padding: 9px 12px; border: 1.5px solid var(--line); border-radius: 10px; width: 100%; text-align: right; }
.set-row .lbl b { display: block; font-size: .92rem; }
.set-row .lbl span { font-size: .8rem; color: var(--muted); }
.scanner video { width: 100%; border-radius: 12px; background: #000; aspect-ratio: 1; object-fit: cover; }
.staff-login { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--navy); padding: 20px; }
.staff-login .card { width: min(420px, 100%); }
.staff-login img { height: 40px; display: block; margin: 0 auto 6px; }

@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid2 { grid-template-columns: 1fr; } }
@media (max-width: 820px) {
  .staff { grid-template-columns: 1fr; background: var(--bg); }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px; }
  .side img, .side .who, .side .spacer { display: none; }
  .side .nav-btn { padding: 8px 10px; font-size: .88rem; }
  .main { padding: 18px 14px 60px; }
  .grid3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
td input[name="icon"] { text-align: center; font-size: 1.2rem; padding: 5px 4px; }
