/* ============================================================
   Pragmatic Play — Admin dashboard
   ============================================================ */
:root {
  --bg: #0b0c11; --panel: #14151d; --panel-2: #1b1d28; --line: rgba(255,255,255,0.09);
  --text: #f4f5fa; --muted: #9aa0b2; --gold: #f6921e; --gold-2: #f4511e;
  --green: #2fcf8e; --red: #ff5670; --cyan: #ffc266; --purple: #ff7a18;
  --radius: 14px; --font: 'Inter', system-ui, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--text); min-height: 100vh; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select { font-family: inherit; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: 9px; font-weight: 700; font-size: 13px; transition: all .15s; }
.btn--gold { background: linear-gradient(135deg, var(--gold), var(--gold-2)); color: #fff; }
.btn--gold:hover { box-shadow: 0 0 18px rgba(255,197,107,.5); }
.btn--ghost { background: rgba(255,255,255,.06); border: 1px solid var(--line); }
.btn--ghost:hover { background: rgba(255,255,255,.12); }
.btn--sm { padding: 6px 11px; font-size: 12px; border-radius: 7px; }
.btn--danger { background: rgba(255,86,112,.16); border: 1px solid rgba(255,86,112,.4); color: #ffb3c0; }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(50vw 50vh at 50% 0%, rgba(155,92,255,.25), transparent 70%), var(--bg); }
.login__card { width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 18px; padding: 32px; box-shadow: 0 24px 60px rgba(0,0,0,.5); }
.login__brand { font-family: 'Poppins', sans-serif; font-weight: 800; font-size: 26px; letter-spacing: 0.5px; text-align: center; }
.login__brand span { color: var(--gold); margin-left: 5px; }
.login__sub { text-align: center; color: var(--muted); margin-bottom: 22px; font-weight: 600; font-size: 13px; letter-spacing: 1px; text-transform: uppercase; }
.fld { display: block; margin-bottom: 14px; }
.fld span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
.fld input, .fld select { width: 100%; padding: 11px 13px; border-radius: 9px; background: rgba(255,255,255,.05);
  border: 1px solid var(--line); color: var(--text); font-size: 14px; }
.fld input:focus, .fld select:focus { outline: none; border-color: rgba(255,197,107,.55); }
.login__err { margin-top: 12px; padding: 10px; border-radius: 8px; background: rgba(255,86,112,.14);
  border: 1px solid rgba(255,86,112,.4); color: #ffb3c0; font-size: 13px; text-align: center; }
.login .btn--gold { width: 100%; justify-content: center; padding: 12px; }

/* Layout */
.admin { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 20px 14px; position: sticky; top: 0; height: 100vh; }
.side__brand { font-family: 'Poppins', sans-serif; font-weight: 800; font-size: 20px; letter-spacing: 0.3px; padding: 0 8px 18px; }
.side__brand span { color: var(--gold); margin-left: 4px; }
.side__nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.navitem { text-align: left; padding: 11px 13px; border-radius: 10px; font-weight: 600; font-size: 14px; color: var(--muted); }
.navitem:hover { background: rgba(255,255,255,.05); color: var(--text); }
.navitem.is-active { background: linear-gradient(135deg, rgba(246,146,30,.18), rgba(255,122,24,.16)); color: var(--text); }
.nav-badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 4px; border-radius: 999px; background: var(--red); color: #fff; font-size: 11px; font-weight: 800; }
.side__foot { display: flex; flex-direction: column; gap: 6px; border-top: 1px solid var(--line); padding-top: 14px; }
.side__link { text-align: left; padding: 8px 13px; border-radius: 8px; color: var(--muted); font-size: 13px; font-weight: 600; }
.side__link:hover { color: var(--text); background: rgba(255,255,255,.05); }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 26px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: rgba(10,7,18,.85); backdrop-filter: blur(10px); z-index: 10; }
.topbar h1 { font-size: 22px; font-weight: 800; }
.topbar__actions { display: flex; align-items: center; gap: 12px; }
.src-pill { font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: rgba(56,232,160,.16); color: var(--green); border: 1px solid rgba(56,232,160,.4); text-transform: uppercase; letter-spacing: .5px; }
.src-pill.is-local { background: rgba(56,232,255,.14); color: var(--cyan); border-color: rgba(56,232,255,.4); }
.who { color: var(--muted); font-size: 13px; font-weight: 600; }

.view { padding: 26px; }

/* Cards / stats */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px,1fr)); gap: 14px; margin-bottom: 24px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.stat__label { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.stat__value { font-size: 30px; font-weight: 800; margin-top: 6px; }
.stat__sub { color: var(--muted); font-size: 12px; margin-top: 4px; }
.stat--accent { border-color: rgba(246,146,30,.5); background: linear-gradient(160deg, rgba(246,146,30,.12), var(--panel)); }
.stat--accent .stat__value { color: var(--gold); }
.ggr.pos b { color: var(--green); }
.ggr.neg b { color: var(--red); }
.hint { color: var(--muted); font-size: 12px; line-height: 1.5; margin: 4px 2px 20px; }
.bargrid { display: flex; align-items: center; gap: 9px; min-width: 200px; }
.bargrid__bar { flex: 1; height: 7px; border-radius: 999px; background: rgba(255,255,255,.08); overflow: hidden; }
.bargrid__bar i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--gold), var(--gold-2)); }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 20px; }
.panel__head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.panel__head h2 { font-size: 16px; font-weight: 700; }
.panel__body { padding: 4px 0; }

/* Tables */
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; padding: 11px 16px; color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); }
.tbl td { padding: 11px 16px; border-bottom: 1px solid rgba(255,255,255,.04); vertical-align: middle; }
.tbl tr:hover td { background: rgba(255,255,255,.025); }
.tbl__scroll { max-height: 70vh; overflow: auto; }
.thumb { width: 38px; height: 38px; border-radius: 8px; object-fit: cover; background: var(--panel-2); }

.badge { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; text-transform: uppercase; letter-spacing: .4px; }
.badge--active { background: rgba(56,232,160,.16); color: var(--green); }
.badge--inactive { background: rgba(255,86,112,.16); color: var(--red); }
.badge--info { background: rgba(56,232,255,.14); color: var(--cyan); }
.badge--warn { background: rgba(255,197,107,.16); color: var(--gold); }
.badge--cat { background: rgba(155,92,255,.16); color: #c9b3ff; }

.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.search-bar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.search-bar input, .search-bar select { padding: 9px 13px; border-radius: 9px; background: var(--panel); border: 1px solid var(--line); color: var(--text); font-size: 13px; }
.search-bar input[type=search] { min-width: 220px; }

.inline-input { width: 78px; padding: 6px 8px; border-radius: 7px; background: var(--panel-2); border: 1px solid var(--line); color: var(--text); font-size: 13px; }
.toggle { position: relative; width: 44px; height: 24px; border-radius: 999px; background: rgba(255,255,255,.12); transition: background .2s; flex-shrink: 0; }
.toggle.on { background: var(--green); }
.toggle::after { content: ''; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .2s; }
.toggle.on::after { transform: translateX(20px); }

.empty { text-align: center; color: var(--muted); padding: 40px; }
.log-line { font-family: ui-monospace, monospace; font-size: 12px; }
.lvl-info { color: var(--cyan); } .lvl-warn { color: var(--gold); } .lvl-error { color: var(--red); }

/* Modal */
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; }
.modal__bg { position: absolute; inset: 0; background: rgba(4,2,10,.7); backdrop-filter: blur(4px); }
.modal__card { position: relative; width: 100%; max-width: 460px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 24px; max-height: 90vh; overflow: auto; }
.modal__card h3 { margin-bottom: 16px; }
.modal__row { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }

/* Manage player (balance) modal */
.mp__bal { font-size: 13px; color: var(--muted); margin-bottom: 16px; padding: 12px 14px; border-radius: 10px; background: rgba(255,255,255,.04); border: 1px solid var(--line); }
.mp__bal b { color: var(--text); font-size: 18px; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 4px; margin-bottom: 14px; border-radius: 11px; background: rgba(255,255,255,.05); border: 1px solid var(--line); }
.seg button { padding: 9px 6px; border-radius: 8px; font-weight: 700; font-size: 13px; color: var(--muted); transition: all .12s; }
.seg button:hover { color: var(--text); }
.seg button.is-active { background: linear-gradient(135deg, var(--gold), var(--gold-2)); color: #fff; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 14px; }
.chips button { padding: 7px 13px; border-radius: 999px; font-weight: 700; font-size: 13px; color: var(--text); background: rgba(255,255,255,.06); border: 1px solid var(--line); }
.chips button:hover { background: rgba(246,146,30,.18); border-color: rgba(246,146,30,.5); }
.mp__preview { min-height: 20px; font-size: 14px; color: var(--muted); margin-top: 4px; }
.mp__preview b { font-size: 16px; }
.mp__preview .pos { color: var(--green); }
.mp__preview .neg { color: var(--red); font-weight: 600; }

/* Toasts */
.toasts { position: fixed; bottom: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast { padding: 12px 18px; border-radius: 10px; font-weight: 600; font-size: 13px; background: var(--panel-2); border: 1px solid var(--line); box-shadow: 0 12px 30px rgba(0,0,0,.4); animation: tin .25s ease; }
.toast--ok { border-color: rgba(56,232,160,.5); } .toast--err { border-color: rgba(255,86,112,.5); }
@keyframes tin { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }

@media (max-width: 800px) {
  .admin { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; }
  .side__nav { flex-direction: row; flex-wrap: wrap; }
  .side__foot { flex-direction: row; }
}
