:root {
  --bg: #f4f5f7; --card: #fff; --text: #1d2330; --muted: #6b7280; --line: #e3e6eb;
  --primary: #7c3aed; --primary-2: #6d28d9; --ok: #16a34a; --wa: #25d366; --gold: #f59e0b; --danger: #dc2626;
  --sold: #d1d5db; --radius: 12px;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--primary); }
h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.2; }
.wrap { max-width: 1000px; margin: 0 auto; padding: 16px; }
.card { background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: 0 1px 3px rgba(0,0,0,.06); margin-bottom: 16px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.row > * { flex: 1 1 180px; }
.grow { flex: 1; }
.muted { color: var(--muted); font-size: .9em; }
.right { text-align: right; }
.hidden { display: none !important; }

button, .btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 10px; padding: 10px 14px;
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; background: var(--primary); color: #fff; }
button:hover, .btn:hover { background: var(--primary-2); }
button:disabled { opacity: .5; cursor: not-allowed; }
.btn-light { background: #eef0f4; color: var(--text); } .btn-light:hover { background: #e2e5eb; }
.btn-wa { background: var(--wa); color: #fff; } .btn-wa:hover { background: #1ebe5a; }
.btn-danger { background: var(--danger); } .btn-danger:hover { background: #b91c1c; }
.btn-sm { padding: 6px 10px; font-size: .85em; }

label { display: block; font-weight: 600; font-size: .85em; margin-bottom: 4px; }
input, select, textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font: inherit; background: #fff; color: var(--text); }
textarea { min-height: 80px; }
.field { margin-bottom: 12px; }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-size: .8em; color: var(--muted); text-transform: uppercase; }
.table-wrap { overflow-x: auto; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: .78em; font-weight: 700; background: #eef0f4; }
.badge.open { background: #dcfce7; color: #166534; } .badge.closed { background: #fee2e2; color: #991b1b; }
.badge.promo { background: #fef3c7; color: #92400e; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 6px; }
.num { padding: 10px 0; border-radius: 8px; border: 2px solid var(--line); background: #fff; color: var(--text); font-weight: 700; font-variant-numeric: tabular-nums; }
.num:hover { background: #f3efff; border-color: var(--primary); }
.num.sold { background: var(--sold); color: #6b7280; border-color: var(--sold); cursor: not-allowed; text-decoration: line-through; }
.num.sel { background: var(--ok); border-color: var(--ok); color: #fff; }
.num.bonus { background: var(--gold); border-color: var(--gold); color: #fff; }
.num.win { background: var(--primary); border-color: var(--primary); color: #fff; text-decoration: none; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .85em; margin: 8px 0 12px; }
.legend span::before { content: ''; display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; border: 2px solid var(--line); }
.legend .l-sold::before { background: var(--sold); border-color: var(--sold); }
.legend .l-sel::before { background: var(--ok); border-color: var(--ok); }
.legend .l-bonus::before { background: var(--gold); border-color: var(--gold); }

.progress { height: 10px; background: #eef0f4; border-radius: 99px; overflow: hidden; }
.progress > div { height: 100%; background: linear-gradient(90deg, var(--primary), #a855f7); }

.topbar { background: #1d1530; color: #fff; }
.topbar .wrap { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; }
.topbar a { color: #e9e3ff; text-decoration: none; padding: 6px 10px; border-radius: 8px; font-weight: 600; }
.topbar a:hover, .topbar a.active { background: rgba(255,255,255,.12); }
.topbar .brand { font-weight: 800; font-size: 1.1em; color: #fff; margin-right: auto; }

.sticky-bar { position: sticky; bottom: 0; background: var(--card); border-top: 1px solid var(--line); box-shadow: 0 -4px 16px rgba(0,0,0,.08); padding: 12px 16px; z-index: 5; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.stat { background: #f8f7fc; border-radius: 10px; padding: 12px; }
.stat b { display: block; font-size: 1.4em; }

.modal { position: fixed; inset: 0; background: rgba(15,10,30,.55); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50; }
.modal .card { max-width: 480px; width: 100%; max-height: 90vh; overflow: auto; }
.toast { position: fixed; left: 50%; top: 16px; transform: translateX(-50%); background: #1d2330; color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 100; box-shadow: 0 6px 20px rgba(0,0,0,.25); max-width: 90vw; }
.toast.err { background: var(--danger); }
pre.receipt { white-space: pre-wrap; background: #f8f7fc; padding: 12px; border-radius: 10px; font: inherit; }

.hero { display: grid; grid-template-columns: minmax(0, 340px) 1fr; gap: 20px; align-items: start; }
.hero img { width: 100%; border-radius: var(--radius); background: #eee; }
@media (max-width: 680px) { .pdv-bar { position: static; } .hero { grid-template-columns: 1fr; } .grid { grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); } }
@media print { .noprint { display: none !important; } body { background: #fff; } .card { box-shadow: none; } }
