/* ============================================================
   Orion Desk — design system
   Mobile-first. Breakpoints: sm ≥480 · md ≥720 · lg ≥1024
   ============================================================ */
:root {
  /* surfaces */
  --bg: #0a0e17;
  --bg-elev: #0e1420;
  --panel: #131a2a;
  --panel-2: #1a2338;
  --panel-3: #212d47;
  --line: #26334d;
  --line-soft: rgba(38, 51, 77, .55);

  /* text */
  --text: #eef2fa;
  --text-dim: #b6c1d6;
  --muted: #8ea0bd;
  --faint: #64748f;

  /* accents */
  --accent: #4f8cff;
  --accent-strong: #3b7bff;
  --accent-soft: rgba(79, 140, 255, .14);
  --violet: #8b5cf6;
  --brand-grad: linear-gradient(135deg, #4f8cff, #8b5cf6);

  /* semantic */
  --good: #34d399;
  --good-soft: rgba(52, 211, 153, .14);
  --bad: #fb7185;
  --bad-soft: rgba(251, 113, 133, .14);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, .14);
  --info: #38bdf8;

  /* shape */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .25);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, .35);
  --shadow-lg: 0 24px 70px rgba(0, 0, 0, .5);

  /* motion */
  --ease: cubic-bezier(.4, 0, .2, 1);
  --t-fast: .15s var(--ease);
  --t-med: .25s var(--ease);

  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "SF Mono", "Cascadia Code", "JetBrains Mono", Consolas, monospace;

  --topbar-h: 60px;
  --side-w: 248px;
  --touch: 44px;           /* minimum touch target */
  --content: 1440px;
}
* { box-sizing: border-box; }
html { height: 100%; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100%;
  font: 16px/1.5 var(--font);
  background: var(--bg); color: var(--text);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
@media (min-width: 720px) { body { font-size: 15px; } }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .4em; font-weight: 650; letter-spacing: -.01em; }
p { margin: 0 0 .8em; }
a { color: var(--accent); }
a:hover { color: var(--accent-strong); }
button { font: inherit; }
::selection { background: rgba(79, 140, 255, .35); }

:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.skip-link {
  position: fixed; top: -100px; left: 12px; z-index: 200;
  background: var(--accent); color: #fff; padding: 10px 16px; border-radius: var(--r-sm);
  font-weight: 600; transition: top var(--t-fast);
}
.skip-link:focus { top: 12px; }

/* ============ app frame ============ */
.app { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 10px;
  height: var(--topbar-h); padding: 0 14px;
  background: rgba(10, 14, 23, .82);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line-soft);
}
.layout { flex: 1; display: flex; width: 100%; max-width: var(--content); margin: 0 auto; }
.main {
  flex: 1; min-width: 0; /* grid/table containment */
  padding: 18px 14px 56px;
}
@media (min-width: 720px) { .main { padding: 26px 30px 64px; } }

/* brand */
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand:hover { color: var(--text); }
.brand-mark {
  width: 34px; height: 34px; flex: none; border-radius: 10px;
  display: grid; place-items: center; font-weight: 800; font-size: 17px; color: #fff;
  background: var(--brand-grad);
  box-shadow: 0 4px 14px rgba(79, 140, 255, .35);
}
.brand-name { font-weight: 750; font-size: 15.5px; letter-spacing: .2px; display: flex; align-items: baseline; gap: 8px; }
.brand-sub { font-size: 11px; color: var(--muted); font-weight: 550; }
@media (max-width: 719px) { .brand-sub { display: none; } }

/* icon button (drawer toggle etc.) */
.icon-btn {
  width: var(--touch); height: var(--touch); flex: none;
  display: inline-grid; place-items: center;
  background: transparent; border: 1px solid transparent; border-radius: var(--r-sm);
  color: var(--text-dim); cursor: pointer; padding: 0;
  transition: background var(--t-fast), color var(--t-fast);
}
.icon-btn:hover { background: var(--panel-2); color: var(--text); }
.icon-btn svg { width: 22px; height: 22px; }
@media (min-width: 1024px) { #navToggle { display: none; } }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; min-width: 0; }

/* float chip */
.float-chip {
  display: flex; align-items: center; gap: 8px;
  background: var(--accent-soft); border: 1px solid rgba(79, 140, 255, .25);
  border-radius: 999px; padding: 6px 12px; white-space: nowrap;
}
.float-chip .fc-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; font-weight: 650; display: none; }
.float-chip .fc-value { font-family: var(--mono); font-weight: 700; font-size: 15px; }
@media (min-width: 480px) { .float-chip .fc-label { display: inline; } }

.whoami { color: var(--muted); font-size: 13px; font-weight: 600; white-space: nowrap; }
@media (max-width: 479px) { .whoami { display: none; } }
#logoutBtn { display: inline-flex; align-items: center; gap: 6px; }

/* ============ sidebar ============ */
.sidebar {
  width: min(84vw, var(--side-w)); flex: none;
  background: var(--bg-elev); border-right: 1px solid var(--line-soft);
  display: flex; flex-direction: column;
  padding: 14px 12px 16px;
}
.sidebar .side-foot { margin-top: auto; border-top: 1px solid var(--line-soft); padding-top: 12px; }

/* mobile drawer */
@media (max-width: 1023px) {
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 60;
    transform: translateX(-102%);
    transition: transform .28s var(--ease);
    box-shadow: var(--shadow-lg);
    overflow-y: auto;
  }
  body.drawer-open { overflow: hidden; }
  body.drawer-open .sidebar { transform: translateX(0); }
}
.drawer-backdrop {
  position: fixed; inset: 0; z-index: 55;
  background: rgba(4, 7, 14, .66);
  backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
}
@media (min-width: 1024px) { .drawer-backdrop { display: none !important; } }

/* nav */
.nav { display: flex; flex-direction: column; gap: 4px; margin: 6px 0 16px; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: 1.1px; color: var(--faint); font-weight: 700; padding: 0 12px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 12px; border-radius: var(--r-md);
  color: var(--muted); text-decoration: none; cursor: pointer;
  font-weight: 600; font-size: 14.5px;
  border: 1px solid transparent; min-height: 44px;
  transition: background var(--t-fast), color var(--t-fast);
}
.nav-item svg { width: 19px; height: 19px; flex: none; opacity: .9; }
.nav-item:hover { background: var(--panel); color: var(--text); }
.nav-item.active {
  background: linear-gradient(90deg, var(--accent-soft), rgba(139, 92, 246, .10));
  border-color: rgba(79, 140, 255, .22);
  color: #fff;
}
.nav-item.active svg { color: var(--accent); }

/* ============ page header ============ */
.view { display: none; }
.view.active { display: block; animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(3px); } }

.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 16px; margin: 2px 0 20px; }
.page-head h1 { font-size: clamp(22px, 3.4vw, 27px); margin: 0; letter-spacing: -.02em; }
.page-head .page-desc { color: var(--muted); font-size: 14px; margin-top: 3px; }
.page-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* ============ cards & grids ============ */
.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
@media (min-width: 720px) { .cards { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; } }
.card {
  background: var(--panel); border: 1px solid var(--line-soft);
  border-radius: var(--r-lg); padding: 16px;
  box-shadow: var(--shadow-sm);
}
@media (min-width: 720px) { .card { padding: 20px; } }
.card + .card { margin-top: 16px; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }
.card-head h2 { font-size: 16px; margin: 0; }
.card-sub {
  font-size: 11.5px; color: var(--muted); font-weight: 700;
  text-transform: uppercase; letter-spacing: .9px; margin: 22px 0 10px;
  display: flex; align-items: center; gap: 8px;
}
.card-sub:first-of-type { margin-top: 0; }

.stat { position: relative; overflow: hidden; }
.stat .stat-label { color: var(--muted); font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .7px; display: flex; align-items: center; gap: 7px; }
.stat .stat-label svg { width: 15px; height: 15px; color: var(--accent); }
.stat .stat-value { font-family: var(--mono); font-size: clamp(22px, 3vw, 28px); font-weight: 750; margin: 8px 0 2px; letter-spacing: -.02em; }
.stat .stat-note { color: var(--faint); font-size: 12px; }
.stat.hero { background: linear-gradient(140deg, rgba(79, 140, 255, .16), rgba(139, 92, 246, .10) 60%, var(--panel)); border-color: rgba(79, 140, 255, .3); }
.stat .stat-icon { position: absolute; right: 14px; top: 14px; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--panel-2); color: var(--muted); }
.stat .stat-icon svg { width: 18px; height: 18px; }

/* ============ toolbars / forms ============ */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.toolbar .grow { flex: 1 1 180px; }
@media (min-width: 720px) { .toolbar .grow { flex: 1 1 260px; } }

.input, select.input, .field-input {
  width: 100%; min-height: 42px;
  background: var(--bg-elev); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 9px 12px; font: inherit; font-size: 15px;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.input:focus, select.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79, 140, 255, .18); outline: none; }
.input::placeholder { color: var(--faint); }
select.input { appearance: none; background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238ea0bd' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
input[type=date].input { color-scheme: dark; min-width: 0; }
.check {
  display: inline-flex; align-items: center; gap: 9px;
  color: var(--muted); font-size: 14.5px; cursor: pointer;
  min-height: var(--touch); padding: 0 4px; user-select: none;
}
.check input { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; margin: 0; }
.field { display: block; margin-bottom: 14px; text-align: left; }
.field > span { display: block; font-size: 12.5px; font-weight: 650; color: var(--text-dim); margin-bottom: 6px; letter-spacing: .2px; }
.field .hint { font-size: 12px; color: var(--faint); margin-top: 6px; line-height: 1.4; }
textarea.field-input { min-height: 84px; resize: vertical; font: inherit; }
.modal-body { display: flex; flex-direction: column; }

/* ============ buttons ============ */
.btn {
  --btn-bg: var(--panel-3);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 9px 16px;
  background: var(--btn-bg); color: var(--text);
  border: 1px solid transparent; border-radius: var(--r-sm);
  font: inherit; font-weight: 650; font-size: 14.5px; cursor: pointer; white-space: nowrap;
  transition: filter var(--t-fast), background var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast);
}
.btn svg { width: 17px; height: 17px; flex: none; }
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 4px 14px rgba(79, 140, 255, .28); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-violet { background: linear-gradient(135deg, var(--accent), var(--violet)); color: #fff; box-shadow: 0 4px 14px rgba(139, 92, 246, .28); }
.btn-good { background: #10b981; color: #fff; box-shadow: 0 4px 12px rgba(16, 185, 129, .3); }
.btn-good:hover { filter: brightness(1.08); }
.btn-danger { background: #f43f5e; color: #fff; box-shadow: 0 4px 12px rgba(244, 63, 94, .3); }
.btn-danger:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--text-dim); }
.btn-ghost:hover { background: var(--panel-2); color: var(--text); }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: 13.5px; }
.btn-block { width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn .spin { display: none; }
.btn.is-busy { pointer-events: none; opacity: .8; }
.btn.is-busy .spin { display: inline-block; }

/* ============ tables ============ */
.table-card { overflow: hidden; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line-soft); border-radius: var(--r-md); background: var(--panel); }
.table-scroll { min-width: 640px; }   /* triggers contained scroll on small screens */
.table-scroll.wide { min-width: 860px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th {
  text-align: left; color: var(--muted); font-weight: 700; font-size: 11px;
  text-transform: uppercase; letter-spacing: .7px; padding: 11px 12px;
  border-bottom: 1px solid var(--line); background: var(--panel-2);
  position: sticky; top: 0; white-space: nowrap;
}
.tbl td { padding: 11px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; white-space: nowrap; }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr.clickable { cursor: pointer; transition: background var(--t-fast); }
.tbl tbody tr.clickable:hover { background: rgba(79, 140, 255, .07); }
.tbl tbody tr.selected { background: rgba(79, 140, 255, .12); box-shadow: inset 3px 0 0 var(--accent); }
.tbl tr.clickable:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.tbl .acct { font-weight: 700; }
.mono { font-family: var(--mono); }
.num { font-family: var(--mono); text-align: right; }
.pos { color: var(--good); font-weight: 650; }
.neg { color: var(--bad); font-weight: 650; }
td .muted2 { color: var(--muted); }
.tbl tbody tr.empty-row td { padding: 0; }

/* empty + loading states */
.empty-state { padding: 34px 16px; text-align: center; color: var(--muted); }
.empty-state .es-icon {
  width: 46px; height: 46px; margin: 0 auto 12px; border-radius: 14px;
  display: grid; place-items: center; background: var(--panel-2); color: var(--faint);
}
.empty-state .es-icon svg { width: 22px; height: 22px; }
.empty-state .es-title { font-weight: 650; color: var(--text-dim); margin-bottom: 3px; font-size: 14.5px; }
.empty-state .es-text { font-size: 13px; max-width: 340px; margin: 0 auto; }
.empty-state.compact { padding: 20px 12px; }

.skeleton-row td { padding: 0; border: none; }
.skeleton {
  height: 44px; display: flex; flex-direction: column; justify-content: center;
}
.skeleton .sk-line { height: 11px; border-radius: 6px; background: var(--panel-3); margin: 0 12px; position: relative; overflow: hidden; }
.skeleton .sk-line::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .06), transparent);
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

/* pills / badges */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 750; letter-spacing: .2px; }
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.neutral { background: var(--panel-3); color: var(--muted); }

/* ============ players split layout ============ */
.split { display: grid; gap: 14px; align-items: start; }
@media (min-width: 1024px) {
  .split { grid-template-columns: minmax(0, 1fr) 350px; }
  .detail-card { position: sticky; top: calc(var(--topbar-h) + 18px); }
}
.detail-card h3 { font-size: 18px; margin-bottom: 2px; }
.detail-card .acct { color: var(--muted); font-size: 12.5px; margin-bottom: 14px; font-family: var(--mono); }
.detail-card .kv { display: grid; grid-template-columns: auto 1fr; gap: 9px 18px; margin: 0 0 16px; font-size: 14px; }
.detail-card .kv dt { color: var(--muted); font-weight: 600; }
.detail-card .kv dd { margin: 0; font-family: var(--mono); text-align: right; }
.detail-card .kv dd .cur { color: var(--text); }
.badged {
  display: flex; align-items: flex-start; gap: 8px; font-size: 13px;
  padding: 9px 12px; border-radius: var(--r-sm); margin-bottom: 14px; line-height: 1.45;
}
.badged svg { width: 16px; height: 16px; flex: none; margin-top: 2px; }
.badged.info { background: var(--accent-soft); color: var(--text-dim); border: 1px solid rgba(79, 140, 255, .2); }
.badged.warn { background: var(--warn-soft); color: var(--warn); border: 1px solid rgba(251, 191, 36, .25); }
.badged.ok { background: var(--good-soft); color: var(--good); border: 1px solid rgba(52, 211, 153, .25); }
.detail-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.detail-actions .btn { width: 100%; }
.detail-actions .span-2 { grid-column: span 2; }
.detail-empty { text-align: center; padding: 40px 12px; color: var(--faint); font-size: 14px; }
.detail-empty svg { width: 34px; height: 34px; margin-bottom: 10px; color: var(--faint); }

/* ============ modal ============ */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(4, 7, 13, .72);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  display: grid; place-items: center; padding: 16px;
}
.modal {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
  width: min(460px, 100%); max-height: calc(100vh - 32px);
  display: flex; flex-direction: column;
  animation: modal-in .2s var(--ease);
}
@keyframes modal-in { from { opacity: 0; transform: translateY(14px) scale(.98); } }
.modal-head {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 18px 20px 0;
}
.modal-head h3 { font-size: 17px; margin: 0; }
.modal-head .modal-close { margin-left: auto; }
.modal-sub { color: var(--muted); font-size: 13px; padding: 4px 20px 0; line-height: 1.5; }
.modal-sub code { font-family: var(--mono); color: var(--text-dim); background: var(--panel-2); padding: 1px 6px; border-radius: 6px; font-size: 12px; }
.modal-body { padding: 16px 20px 20px; overflow-y: auto; }
.modal-body form { display: block; }
.modal-foot {
  display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap;
  padding: 0 20px 20px;
}
.modal-foot .spacer { flex: 1; }
.modal-summary {
  display: flex; align-items: center; gap: 10px; padding: 11px 14px;
  background: var(--bg-elev); border: 1px solid var(--line-soft);
  border-radius: var(--r-md); margin-bottom: 16px; font-size: 13.5px;
}
.modal-summary .ms-avatar {
  width: 34px; height: 34px; flex: none; border-radius: 10px; display: grid; place-items: center;
  background: var(--brand-grad); color: #fff; font-weight: 750; font-size: 14px;
}
.modal-summary .ms-main { min-width: 0; }
.modal-summary .ms-title { font-weight: 700; font-size: 14.5px; }
.modal-summary .ms-sub { color: var(--muted); font-size: 12px; font-family: var(--mono); }
.modal-summary .ms-val { margin-left: auto; font-family: var(--mono); font-weight: 700; font-size: 16px; }

/* ============ toasts ============ */
.toasts {
  position: fixed; left: 12px; right: 12px; bottom: 14px; z-index: 150;
  display: flex; flex-direction: column; gap: 8px; align-items: stretch;
  pointer-events: none;
}
@media (min-width: 720px) {
  .toasts { left: auto; right: 20px; bottom: 20px; align-items: flex-end; }
}
.toast {
  pointer-events: auto;
  display: flex; align-items: center; gap: 10px;
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: var(--r-md); box-shadow: var(--shadow-md);
  padding: 12px 14px; font-size: 14px; max-width: min(420px, 100%);
  animation: toast-in .22s var(--ease);
}
.toast svg { width: 18px; height: 18px; flex: none; }
.toast.ok { border-left-color: var(--good); } .toast.ok svg { color: var(--good); }
.toast.err { border-left-color: var(--bad); } .toast.err svg { color: var(--bad); }
.toast.warn { border-left-color: var(--warn); } .toast.warn svg { color: var(--warn); }
.toast .t-msg { flex: 1; }
.toast .t-close { background: none; border: none; color: var(--muted); cursor: pointer; padding: 4px; border-radius: 6px; display: grid; place-items: center; }
.toast .t-close:hover { color: var(--text); background: var(--panel-3); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

/* ============ loading bar ============ */
.loadbar { position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 300; pointer-events: none; display: none; }
.loadbar.show { display: block; }
.loadbar::after {
  content: ""; display: block; height: 100%; width: 35%;
  background: var(--brand-grad);
  animation: loadbar 1s var(--ease) infinite;
}
@keyframes loadbar { from { transform: translateX(-110%); } to { transform: translateX(320%); } }

/* ============ login ============ */
.login-body { min-height: 100vh; display: grid; place-items: center; padding: 18px;
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(139, 92, 246, .14), transparent 60%),
    radial-gradient(800px 420px at -10% 110%, rgba(79, 140, 255, .16), transparent 60%),
    var(--bg);
}
.login-card {
  width: min(400px, 100%); background: rgba(19, 26, 42, .9);
  border: 1px solid var(--line); border-radius: 20px;
  padding: clamp(22px, 5vw, 34px);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.login-card .brand-row { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.login-card .brand-mark { width: 42px; height: 42px; font-size: 20px; }
.login-card h1 { font-size: 21px; margin-bottom: 2px; }
.login-card .login-sub { color: var(--muted); font-size: 13.5px; margin-bottom: 24px; }
.login-err {
  display: flex; align-items: center; gap: 8px;
  color: var(--bad); background: var(--bad-soft);
  border: 1px solid rgba(251, 113, 133, .3);
  padding: 10px 12px; border-radius: var(--r-sm); font-size: 13.5px; margin: 0 0 14px;
}
.login-err svg { width: 16px; height: 16px; flex: none; }
.login-foot { margin-top: 18px; text-align: center; color: var(--faint); font-size: 12px; }

/* ============ reduced motion ============ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  .skeleton .sk-line::after { animation: none; }
}

/* ============ extras ============ */
.spin svg { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.min-w-0 { min-width: 0; }
.table-hint { color: var(--faint); font-size: 12px; margin: 8px 2px 0; }
@media (max-width: 1023px) { .table-hint { display: none; } }
.date-sep { color: var(--faint); padding: 0 2px; }
.toolbar .input { flex: none; }
.toolbar .input.grow { flex: 1 1 220px; }
.toolbar .input[type=date] { flex: 1 1 150px; max-width: 190px; }
@media (max-width: 479px) { .logout-label { display: none; } #logoutBtn { min-width: 44px; justify-content: center; } }
@media (min-width: 1024px) { .detail-card .kv { grid-template-columns: 92px 1fr; } }

/* ============ row quick actions (credits) ============ */
.th-actions { width: 96px; }
.row-actions { display: flex; gap: 6px; align-items: center; }
.icon-action {
  width: 32px; height: 32px; flex: none;
  display: inline-grid; place-items: center;
  border-radius: 8px; cursor: pointer; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--text-dim);
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.icon-action svg { width: 16px; height: 16px; }
.icon-action.add:hover { background: var(--good-soft); border-color: rgba(52, 211, 153, .35); color: var(--good); }
.icon-action.sub:hover { background: var(--bad-soft); border-color: rgba(251, 113, 133, .35); color: var(--bad); }
.icon-action.is-busy { opacity: .6; pointer-events: none; }
@media (max-width: 479px) { .th-actions { width: 86px; } .row-actions { gap: 4px; } }

/* ============ credit action buttons (detail card) ============ */
.btn-credit {
  min-height: 48px; font-size: 15px; font-weight: 750;
  border-radius: 10px; letter-spacing: .1px;
}
.btn-credit svg { width: 18px; height: 18px; }
.btn-danger-ghost {
  background: transparent; color: var(--bad);
  border: 1px solid rgba(251, 113, 133, .4);
}
.btn-danger-ghost:hover { background: var(--bad-soft); color: #fff; }

/* ============ Orion Portal additions ============ */
.portal-main { width: 100%; max-width: 1080px; margin: 0 auto; padding: 20px 14px 60px; }
.portal-top { display:flex; align-items:center; gap:10px; flex-wrap:wrap; margin-bottom:18px; }
.portal-top h1 { font-size: clamp(20px,3vw,24px); margin:0; }
.portal-top .spacer { flex:1; }
.nav-pills { display:flex; gap:6px; flex-wrap:wrap; }
.nav-pill { padding:8px 14px; border-radius:999px; font-size:13.5px; font-weight:650; color:var(--muted); border:1px solid var(--line); cursor:pointer; text-decoration:none; background:var(--panel); }
.nav-pill:hover { color:var(--text); border-color:var(--accent); }
.nav-pill.active { background:var(--accent); color:#fff; border-color:transparent; }
.flashes { display:flex; flex-direction:column; gap:8px; margin-bottom:14px; }
.flash { padding:11px 14px; border-radius:10px; font-size:14px; border:1px solid; }
.flash.ok { background:var(--good-soft); border-color:rgba(52,211,153,.35); color:var(--good); }
.flash.err { background:var(--bad-soft); border-color:rgba(251,113,133,.35); color:var(--bad); }
.flash.warn { background:var(--warn-soft); border-color:rgba(251,191,36,.35); color:var(--warn); }
.bal-hero { display:flex; align-items:center; gap:14px; flex-wrap:wrap; }
.bal-hero .big { font-family:var(--mono); font-size:clamp(30px,5vw,42px); font-weight:800; letter-spacing:-.02em; }
.creds-box { font-family:var(--mono); background:var(--bg-elev); border:1px dashed var(--line); border-radius:10px; padding:12px 14px; font-size:15px; word-break:break-all; }
.grid-2 { display:grid; gap:14px; }
@media (min-width:760px){ .grid-2{ grid-template-columns:1fr 1fr; } }
.row-form { display:flex; flex-direction:column; gap:12px; }
.muted-sm { color:var(--muted); font-size:13px; }
.mono { font-family:var(--mono); }
.pill.badge-agent { background:var(--accent-soft); color:var(--accent); }
.pill.badge-admin { background:rgba(139,92,246,.15); color:var(--violet); }
table.tbl td.wrap { white-space:normal; word-break:break-word; }

/* ============================================================
   Orion game-theme layer — unify portal with the play client
   (dark futuristic: cyan glow, gold money, deep navy)
   ============================================================ */
:root {
  --bg: #04060c;
  --bg-elev: #070b14;
  --panel: #0a1120;
  --panel-2: #0f1a31;
  --panel-3: #17264a;
  --line: #1d3564;
  --line-soft: rgba(29, 62, 116, .55);
  --text: #e9f6ff;
  --text-dim: #b7d2ea;
  --muted: #7fa6cc;
  --faint: #4d6a93;
  --accent: #00d4ff;
  --accent-strong: #38e1ff;
  --accent-soft: rgba(0, 212, 255, .12);
  --violet: #00a8e8;
  --gold: #ffd700;
  --brand-grad: linear-gradient(135deg, #00d4ff, #0066ff);
  --good: #2ee6a8;
  --good-soft: rgba(46, 230, 168, .13);
  --bad: #ff5c7a;
  --bad-soft: rgba(255, 92, 122, .14);
  --warn: #ffc61a;
  --warn-soft: rgba(255, 198, 26, .14);
  --shadow-md: 0 10px 34px rgba(0, 0, 0, .55);
}
body { background:
  radial-gradient(900px 500px at 85% -10%, rgba(0, 102, 255, .12), transparent 60%),
  radial-gradient(700px 420px at -10% 110%, rgba(0, 212, 255, .10), transparent 55%),
  var(--bg); }
.topbar { background: rgba(4, 8, 16, .78); border-bottom: 1px solid rgba(0, 212, 255, .18); }
.brand-mark { background: var(--brand-grad); box-shadow: 0 0 18px rgba(0, 212, 255, .5); color: #021018; }
.brand-name { letter-spacing: .4px; }
.float-chip { background: rgba(0, 212, 255, .1); border-color: rgba(0, 212, 255, .35); }
.float-chip .fc-value { color: var(--gold); text-shadow: 0 0 12px rgba(255, 215, 0, .35); }
.btn-primary { background: linear-gradient(180deg, #00e5ff, #0093e0); color: #02131f;
  box-shadow: 0 0 16px rgba(0, 212, 255, .45); }
.btn-primary:hover { filter: brightness(1.1); }
.btn-violet { background: linear-gradient(135deg, #00d4ff, #0066ff); color: #02131f;
  box-shadow: 0 0 14px rgba(0, 140, 255, .4); }
.btn:focus-visible { outline-color: var(--accent); box-shadow: 0 0 0 3px rgba(0, 212, 255, .25); }
.nav-item.active { background: linear-gradient(90deg, rgba(0, 212, 255, .14), rgba(0, 102, 255, .08));
  border-color: rgba(0, 212, 255, .35); color: #fff; text-shadow: 0 0 8px rgba(0, 212, 255, .4); }
.nav-item.active svg { color: var(--accent); filter: drop-shadow(0 0 6px rgba(0, 212, 255, .6)); }
.nav-pill { background: rgba(15, 26, 49, .8); }
.nav-pill.active { background: linear-gradient(180deg, #00e5ff, #0093e0); color: #02131f; box-shadow: 0 0 12px rgba(0, 212, 255, .4); }
.card { background: rgba(10, 17, 32, .9); box-shadow: 0 6px 24px rgba(0, 0, 0, .35); }
.stat.hero { background: linear-gradient(140deg, rgba(0, 212, 255, .12), rgba(0, 102, 255, .08) 60%, var(--panel)); border-color: rgba(0, 212, 255, .3); }
.stat .stat-value { color: var(--gold); text-shadow: 0 0 16px rgba(255, 215, 0, .25); }
.stat .stat-label { color: #9fd0ff; }
.stat .stat-label svg { color: var(--accent); }
.tbl th { background: rgba(7, 11, 20, .9); color: #7fa6cc; }
.tbl tbody tr.selected { background: rgba(0, 212, 255, .1); box-shadow: inset 3px 0 0 var(--accent); }
.tbl tbody tr.clickable:hover { background: rgba(0, 212, 255, .05); }
.bal-hero .big { color: var(--gold); text-shadow: 0 0 18px rgba(255, 215, 0, .3); }
.pos { color: var(--gold); text-shadow: 0 0 10px rgba(255, 215, 0, .2); }
.neg { color: var(--bad); }
.input, select.input, .field-input, textarea.field-input { background: rgba(4, 8, 16, .8); }
.input:focus, select.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0, 212, 255, .18), 0 0 14px rgba(0, 212, 255, .25); }
.icon-btn:hover { background: rgba(0, 212, 255, .1); color: #fff; }
.login-body { background:
  radial-gradient(900px 520px at 85% -10%, rgba(0, 102, 255, .2), transparent 60%),
  radial-gradient(760px 440px at -10% 110%, rgba(0, 212, 255, .18), transparent 55%),
  radial-gradient(500px 300px at 50% 50%, rgba(0, 60, 160, .12), transparent 70%),
  #04060c; }
.login-card { background: rgba(8, 14, 28, .92); border: 1px solid rgba(0, 212, 255, .3);
  box-shadow: 0 0 60px rgba(0, 212, 255, .12), var(--shadow-lg); }
.login-card .brand-mark { box-shadow: 0 0 24px rgba(0, 212, 255, .6); }
.modal { border-color: rgba(0, 212, 255, .3); box-shadow: 0 0 40px rgba(0, 120, 255, .15), var(--shadow-lg); }
.pill.good { color: #2ee6a8; }
.pill.bad { color: #ff5c7a; }
.flash.ok { color: #2ee6a8; }
.creds-box { border-color: rgba(0, 212, 255, .4); color: var(--gold); }
.btn-good { background: #0dae7e; color: #fff; box-shadow: 0 0 12px rgba(46, 230, 168, .35); }
.btn-danger { background: #d63354; color: #fff; box-shadow: 0 0 12px rgba(255, 92, 122, .3); }
.ms-avatar { background: var(--brand-grad); color: #021018; }
.stat .stat-icon { background: rgba(0, 212, 255, .08); color: var(--accent); }

/* ============ full-screen play ============ */
.play-full { margin: 0; height: 100vh; overflow: hidden; background: #000; }
.play-frame-fs { position: fixed; inset: 0; }
.play-frame-fs iframe { width: 100%; height: 100%; border: 0; background: #000; }
.play-float {
  position: fixed; top: 10px; left: 50%; transform: translateX(-50%); z-index: 30;
  display: flex; align-items: center; gap: 8px; padding: 6px 8px;
  background: rgba(4, 8, 16, .7); border: 1px solid rgba(0, 212, 255, .25);
  border-radius: 999px; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  font-size: 13px; box-shadow: 0 4px 20px rgba(0, 0, 0, .4);
}
.play-float .pf-acct { color: #9fd0ff; padding: 0 8px; font-size: 12.5px; }
.play-float a, .play-float button { color: #cfeaff; text-decoration: none; display: inline-flex;
  align-items: center; gap: 6px; background: rgba(0, 212, 255, .12); border: 1px solid rgba(0, 212, 255, .3);
  border-radius: 999px; padding: 6px 12px; font: inherit; font-weight: 600; font-size: 12.5px; cursor: pointer; }
.play-float a:hover, .play-float button:hover { background: rgba(0, 212, 255, .22); color: #fff; }
.play-float .pf-home { border: 1px solid rgba(255, 255, 255, .2); background: rgba(255, 255, 255, .06); }
@media (max-width: 560px) { .play-float { top: 6px; gap: 5px; } .play-float .pf-acct { display: none; } }

/* ============ admin back-office shell (left sidebar) ============ */
.admin-shell { display: flex; gap: 18px; align-items: flex-start; }
.side-nav {
  width: 212px; flex: 0 0 212px; position: sticky; top: 76px;
  display: flex; flex-direction: column; gap: 3px;
  background: rgba(8, 13, 26, .85); border: 1px solid rgba(0, 212, 255, .16);
  border-radius: 14px; padding: 12px 10px;
}
.side-cap { margin: 2px 8px 4px; font-size: 10.5px; letter-spacing: 1.6px;
  text-transform: uppercase; color: var(--faint); }
.side-link {
  display: block; padding: 8px 10px; border-radius: 9px; color: var(--text-dim);
  text-decoration: none; font-size: 13.5px; font-weight: 600;
  border: 1px solid transparent; transition: all .15s ease;
}
.side-link:hover { background: rgba(0, 212, 255, .08); color: #fff; }
.side-link.active {
  background: linear-gradient(90deg, rgba(0, 212, 255, .16), rgba(0, 102, 255, .07));
  border-color: rgba(0, 212, 255, .35); color: #fff;
  box-shadow: inset 3px 0 0 var(--accent);
}
.admin-main { flex: 1; min-width: 0; }
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat-cards .stat { text-decoration: none; color: inherit; transition: transform .15s ease, border-color .15s ease; }
.stat-cards .stat:hover { transform: translateY(-2px); border-color: rgba(0, 212, 255, .5); }
.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 12px 14px; margin-bottom: 16px; }
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 12px; }
.create-card { padding: 12px 14px; margin-bottom: 16px; }
.create-card summary { cursor: pointer; margin-bottom: 10px; }
.create-card[open] summary { margin-bottom: 12px; }
.create-card .row-form { gap: 10px; }
.check { display: inline-flex; align-items: center; gap: 7px; font-size: 13.5px; color: var(--text-dim); }
.sub-tabs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 8px; margin-bottom: 16px; }
.sub-tab { padding: 7px 13px; border-radius: 999px; font-size: 13px; font-weight: 600;
  color: var(--text-dim); text-decoration: none; border: 1px solid transparent; }
.sub-tab:hover { color: #fff; }
.sub-tab.active { background: linear-gradient(180deg, #00e5ff, #0093e0); color: #02131f;
  box-shadow: 0 0 10px rgba(0, 212, 255, .35); }
.pill.gold { background: rgba(255, 215, 0, .13); color: var(--gold); }
.pill.blue { background: rgba(0, 212, 255, .13); color: var(--accent); }
.ta-r { text-align: right; }
.empty { text-align: center; color: var(--faint); padding: 34px 10px; }
.page-head { margin-bottom: 16px; }
.page-head h1 { font-size: 22px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.page-desc { color: var(--muted); font-size: 13.5px; margin-top: 3px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
@media (max-width: 900px) {
  .admin-shell { flex-direction: column; }
  .side-nav { position: static; width: 100%; flex-direction: row; flex-wrap: wrap; }
  .side-cap { display: none; }
  .side-link { padding: 7px 12px; font-size: 13px; }
}

.page-head { position: relative; }
