@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Sora:wght@600;700;800&display=swap');

:root {
  --bg: #15101a;
  --bg-2: #1d1622;
  --surface: rgba(255,255,255,0.045);
  --surface-hi: rgba(255,255,255,0.08);
  --border: rgba(255,255,255,0.09);
  --text: #f6f0f2;
  --muted: #a89aa0;
  --burgundy: #8b2332;
  --burgundy-soft: #c0414f;
  --green: #7cc242;
  --amber: #f4b740;
  --shadow: 0 18px 40px -18px rgba(0,0,0,0.7);
  --r: 18px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1100px 700px at 12% -8%, rgba(139,35,50,0.22), transparent 60%),
    radial-gradient(900px 600px at 100% 0%, rgba(124,194,66,0.10), transparent 55%),
    linear-gradient(180deg, var(--bg), var(--bg-2));
  min-height: 100%;
  -webkit-font-smoothing: antialiased;
}
.wrap { max-width: 1280px; margin: 0 auto; padding: 26px 26px 60px; }

/* Header */
header.top { display: flex; align-items: center; gap: 18px; margin-bottom: 22px; }
.brand { display: flex; align-items: center; gap: 13px; }
.logo {
  width: 46px; height: 46px; border-radius: 13px;
  background: linear-gradient(135deg, var(--burgundy), var(--burgundy-soft));
  display: grid; place-items: center;
  font-family: 'Sora'; font-weight: 800; font-size: 22px; color: #fff;
  box-shadow: 0 8px 22px -8px rgba(192,65,79,0.8);
}
.brand h1 { font-family: 'Sora'; font-size: 20px; letter-spacing: -0.2px; }
.brand p { color: var(--muted); font-size: 12.5px; margin-top: 1px; }
.live { margin-left: auto; display: flex; align-items: center; gap: 18px; color: var(--muted); font-size: 13px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); animation: ping 2s infinite; }
.dot.off { background: var(--amber); animation: none; }
@keyframes ping {
  0% { box-shadow: 0 0 0 0 rgba(124,194,66,0.55); }
  70% { box-shadow: 0 0 0 9px rgba(124,194,66,0); }
  100% { box-shadow: 0 0 0 0 rgba(124,194,66,0); }
}
.clock { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text); }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 24px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 16px 18px; position: relative; overflow: hidden; }
.stat .k { font-family: 'Sora'; font-size: 30px; font-weight: 700; line-height: 1; }
.stat .l { color: var(--muted); font-size: 12.5px; margin-top: 7px; }
.stat .bar { position: absolute; left: 0; top: 0; bottom: 0; width: 4px; }
.stat.por .bar { background: var(--green); } .stat.por .k { color: var(--green); }
.stat.dig .bar { background: var(--burgundy-soft); }
.stat.lib .bar { background: rgba(255,255,255,0.25); }

/* Filters */
.filters { display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.chip { border: 1px solid var(--border); background: var(--surface); color: var(--muted); padding: 8px 15px; border-radius: 999px; font-size: 13px; font-weight: 500; cursor: pointer; transition: .18s; }
.chip:hover { color: var(--text); border-color: var(--surface-hi); }
.chip.on { background: linear-gradient(135deg, var(--burgundy), var(--burgundy-soft)); color: #fff; border-color: transparent; box-shadow: 0 8px 20px -10px rgba(192,65,79,.9); }

/* Grid */
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.card { position: relative; border-radius: var(--r); padding: 16px 16px 14px; background: var(--surface); border: 1px solid var(--border); cursor: default; transition: transform .16s ease, box-shadow .16s ease, border-color .16s; min-height: 132px; display: flex; flex-direction: column; }
.card.clickable { cursor: pointer; }
.card.clickable:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--surface-hi); }
.card .num { font-family: 'Sora'; font-weight: 800; font-size: 30px; line-height: 1; }
.card .mesa-lbl { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 1.5px; margin-bottom: 2px; }
.card .foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; }
.card .total { font-weight: 700; font-size: 15px; }
.card .meta { color: var(--muted); font-size: 11.5px; }
.pill { align-self: flex-start; font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 999px; margin: 10px 0 0; display: inline-flex; align-items: center; gap: 6px; }
.pill .pd { width: 6px; height: 6px; border-radius: 50%; }

.card.libre { opacity: .6; }
.card.libre .num { color: var(--muted); }
.card.libre .pill { background: rgba(255,255,255,0.06); color: var(--muted); }
.card.libre .pill .pd { background: var(--muted); }

.card.por { border-color: rgba(124,194,66,0.55); background: linear-gradient(180deg, rgba(124,194,66,0.16), var(--surface)); animation: glow 2.4s infinite; }
@keyframes glow {
  0% { box-shadow: 0 0 0 0 rgba(124,194,66,0.35); }
  70% { box-shadow: 0 0 0 12px rgba(124,194,66,0); }
  100% { box-shadow: 0 0 0 0 rgba(124,194,66,0); }
}
.card.por .pill { background: rgba(124,194,66,0.2); color: #a6e06a; }
.card.por .pill .pd { background: var(--green); }
.card.por .num { color: #bdf08a; }

.card.digitado { opacity: .8; }
.card.digitado .pill { background: rgba(255,255,255,0.06); color: var(--muted); }
.card.digitado .pill .pd { background: var(--green); }
.card .check { position: absolute; top: 14px; right: 14px; color: var(--green); font-size: 16px; }
.badge { position: absolute; top: 12px; right: 12px; background: var(--green); color: #15301a; font-weight: 800; font-size: 12px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; display: grid; place-items: center; }

/* Modal */
.scrim { position: fixed; inset: 0; background: rgba(8,5,10,0.62); backdrop-filter: blur(7px); display: none; align-items: center; justify-content: center; padding: 20px; z-index: 50; }
.scrim.open { display: flex; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; } }
.modal { width: min(460px, 100%); background: linear-gradient(180deg, #221a28, #1a141f); border: 1px solid var(--border); border-radius: 22px; box-shadow: var(--shadow); overflow: hidden; animation: pop .22s cubic-bezier(.2,.9,.3,1.3); }
@keyframes pop { from { transform: translateY(18px) scale(.97); opacity: 0; } }
.modal .mh { padding: 20px 22px; background: linear-gradient(135deg, var(--burgundy), var(--burgundy-soft)); }
.modal .mh .row { display: flex; align-items: center; justify-content: space-between; }
.modal .mh h2 { font-family: 'Sora'; font-size: 15px; opacity: .9; font-weight: 600; }
.modal .mh .big { font-family: 'Sora'; font-size: 40px; font-weight: 800; line-height: 1; margin-top: 2px; }
.modal .mh .when { color: rgba(255,255,255,.8); font-size: 12.5px; margin-top: 6px; }
.x { background: rgba(255,255,255,.15); border: 0; color: #fff; width: 34px; height: 34px; border-radius: 10px; font-size: 18px; cursor: pointer; transition: .15s; }
.x:hover { background: rgba(255,255,255,.28); }
.items { padding: 8px 22px 4px; max-height: 46vh; overflow: auto; }
.it { display: flex; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--border); }
.it:last-child { border-bottom: 0; }
.qty { font-family: 'Sora'; font-weight: 700; color: var(--burgundy-soft); min-width: 26px; }
.it .nm { font-weight: 600; font-size: 14.5px; }
.it .sz { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.it .nt { color: var(--amber); font-size: 12px; margin-top: 3px; }
.it .pr { margin-left: auto; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sum { padding: 16px 22px; display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--border); }
.sum .t { color: var(--muted); font-size: 13px; }
.sum .v { font-family: 'Sora'; font-size: 24px; font-weight: 800; }
.actions { padding: 0 22px 22px; display: flex; gap: 10px; }
.btn { flex: 1; border: 0; border-radius: 12px; padding: 13px; font-weight: 700; font-size: 14px; cursor: pointer; transition: .15s; font-family: inherit; }
.btn.primary { background: linear-gradient(135deg, var(--green), #5fa72f); color: #0f2410; }
.btn.primary:hover { filter: brightness(1.07); }
.btn.ghost { background: var(--surface); color: var(--text); border: 1px solid var(--border); flex: 0 0 auto; padding: 13px 16px; }
.btn.ghost:hover { background: var(--surface-hi); }
.btn:disabled { opacity: .5; cursor: default; }

/* Empty / loading */
.empty { text-align: center; color: var(--muted); padding: 60px 0; font-size: 14px; }

/* Login */
.login { position: fixed; inset: 0; display: grid; place-items: center; padding: 20px; z-index: 80;
  background: radial-gradient(900px 600px at 50% -10%, rgba(139,35,50,0.3), transparent 60%), linear-gradient(180deg, var(--bg), var(--bg-2)); }
.login.hidden { display: none; }
.login .box { width: min(360px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 22px; padding: 32px 28px; text-align: center; box-shadow: var(--shadow); }
.login .logo { margin: 0 auto 16px; }
.login h2 { font-family: 'Sora'; font-size: 20px; margin-bottom: 4px; }
.login p { color: var(--muted); font-size: 13px; margin-bottom: 22px; }
.login input { width: 100%; background: rgba(0,0,0,0.25); border: 1px solid var(--border); border-radius: 12px; padding: 14px; color: var(--text); font-size: 22px; text-align: center; letter-spacing: 6px; font-family: 'Sora'; font-weight: 700; }
.login input:focus { outline: none; border-color: var(--burgundy-soft); }
.login .btn { width: 100%; margin-top: 14px; }
.login .err { color: #ff8896; font-size: 13px; margin-top: 12px; min-height: 18px; }
