:root {
  --bg: #0e1116;
  --panel: #161b22;
  --panel2: #1c232c;
  --line: #2a3340;
  --text: #e6edf3;
  --muted: #8b96a5;
  --accent: #3b82f6;
  --green: #2ea043;
  --amber: #d29922;
  --red: #f85149;
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
header.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 14px;
  padding: 12px 20px; background: rgba(14,17,22,.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
header.top h1 { font-size: 16px; margin: 0; font-weight: 700; letter-spacing: .2px; }
header.top .sp { flex: 1; }
header.top .pill { font-size: 12px; color: var(--muted); border: 1px solid var(--line);
  border-radius: 999px; padding: 3px 10px; }
main { max-width: 1440px; margin: 0 auto; padding: 20px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.grid { display: grid; gap: 14px; }
.kpis { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.kpi .lab { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .6px; }
.kpi .val { font-size: 26px; font-weight: 700; margin-top: 6px; }
.kpi .sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
label { color: var(--muted); font-size: 12px; display: block; margin-bottom: 4px; }
input, select, button, textarea {
  font: inherit; color: var(--text); background: var(--panel2);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
button { cursor: pointer; background: #222b36; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
button.ghost { background: transparent; }
button:disabled { opacity: .5; cursor: default; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); font-size: 13px; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
tr:hover td { background: var(--panel2); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.tag { display: inline-block; font-size: 11px; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line); }
.tag.green { color: #3fb950; border-color: #1f6f36; }
.tag.amber { color: #e3b341; border-color: #6b5314; }
.tag.red { color: #ff7b72; border-color: #6e2b2b; }
.chart { display: flex; align-items: flex-end; gap: 6px; height: 160px; padding-top: 10px; }
.chart .bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; min-width: 18px; }
.chart .bar i { display: block; width: 100%; background: linear-gradient(180deg,#3b82f6,#1d4ed8); border-radius: 4px 4px 0 0; min-height: 2px; }
.chart .bar span { font-size: 10px; color: var(--muted); white-space: nowrap; transform: rotate(-45deg); }
.tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.tabs button { border-radius: 999px; padding: 6px 14px; }
.tabs button.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.hidden { display: none !important; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: #1f2937; border: 1px solid var(--line); padding: 10px 16px; border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0,0,0,.5); font-size: 13px; z-index: 50; }
.toast.err { border-color: var(--red); color: #ffb4ab; }
.toast.ok { border-color: var(--green); color: #7ee787; }
.modal { position: fixed; inset: 0; padding: 16px; background: rgba(0,0,0,.68); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; z-index: 60; }
.modal .box { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 0; width: min(760px, 95vw); max-height: 88vh; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 22px 54px rgba(0,0,0,.65); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 18px; border-bottom: 1px solid var(--line); background: rgba(28,35,44,.55); flex-shrink: 0; }
.modal-head h3 { margin: 0; font-size: 15px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-close { padding: 4px 10px; line-height: 1.1; font-size: 14px; border-radius: 8px; }
#modalBody { padding: 16px 18px; overflow-y: auto; flex: 1; min-height: 0; }
.modal-foot { padding: 10px 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; flex-shrink: 0; background: rgba(14,17,22,.45); }
.tbl-scroll { width: 100%; overflow-x: auto; }
.act-cell { white-space: nowrap; }
.act-cell button { padding: 4px 8px; font-size: 12px; }

/* ---- Account Detail Modal ---- */
.acc-hero { display: flex; align-items: center; gap: 14px; padding: 12px 14px; background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; margin-bottom: 12px; }
.acc-av { width: 52px; height: 52px; border-radius: 10px; object-fit: cover; border: 1px solid var(--line); background: #0e1116; flex-shrink: 0; display: block; }
.acc-av-ph { width: 52px; height: 52px; border-radius: 10px; display: flex; align-items: center; justify-content: center; background: #1f2a38; color: #79c0ff; font-weight: 700; font-size: 19px; border: 1px solid var(--line); flex-shrink: 0; }
.acc-hero-main { flex: 1; min-width: 0; }
.acc-hero-title { font-size: 15px; font-weight: 700; color: var(--text); word-break: break-all; }
.acc-hero-sub { font-size: 12px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-hero-pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; align-items: center; }
.acc-sec { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; background: rgba(255,255,255,.015); }
.acc-sec-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin: 0 0 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.acc-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; }
.acc-span2 { grid-column: span 2; }
.acc-field label { font-size: 11px; color: var(--muted); margin-bottom: 4px; display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.acc-input-wrap { display: flex; gap: 6px; align-items: center; }
.acc-input-wrap input { width: 100%; min-width: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; padding: 6px 9px; background: #0e1116; border: 1px solid var(--line); border-radius: 7px; color: var(--text); }
.acc-input-wrap input.is-green { color: #3fb950; font-weight: 600; }
.acc-input-wrap input.is-muted { color: var(--muted); }
.acc-btn-sm { padding: 4px 9px; font-size: 12px; border-radius: 7px; white-space: nowrap; flex-shrink: 0; height: 29px; line-height: 1.2; display: inline-flex; align-items: center; gap: 4px; }
.acc-cookie-box { width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; line-height: 1.45; min-height: 78px; max-height: 140px; resize: vertical; background: #0e1116; color: #c9d1d9; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; word-break: break-all; }
.acc-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 10px; padding-top: 12px; border-top: 1px solid var(--line); }
.acc-actions button { padding: 6px 11px; font-size: 12.5px; }
@media (max-width: 640px) {
  .acc-grid { grid-template-columns: 1fr; }
  .acc-span2 { grid-column: span 1; }
}
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.auth-card { max-width: 420px; margin: 12vh auto 0; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 10px; }
.sep { height: 1px; background: var(--line); margin: 14px 0; }
.note { color: var(--muted); font-size: 12px; }
.member-shell { max-width: 560px; margin: 0 auto; }
.big-result { font-size: 15px; font-weight: 600; }

.pt-high { display: inline-block; color: #0b6b2e !important; background: #d7f5dd;
  border: 1px solid #7bd39a; border-radius: 999px; padding: 1px 8px; font-weight: 700; }
.highbonus { display:inline-block; font-size:12px; color:#0b6b2e; background:#d7f5dd;
  border:1px solid #7bd39a; border-radius:999px; padding:2px 10px; margin-left:8px; }


/* ---- Backup acc table: 14 cot khop colgroup, khong de cot ---- */
#tab-backup .bk-scroll { width: 100%; overflow-x: auto; }
#tab-backup table { min-width: 1580px; table-layout: fixed; }
#tab-backup th, #tab-backup td { white-space: nowrap; font-size: 12px; padding: 6px 8px; vertical-align: middle; }
#tab-backup th { font-size: 11px; letter-spacing: .3px; }
#tab-backup td.ell { overflow: hidden; text-overflow: ellipsis; }
#tab-backup col.c-id { width: 56px; }
#tab-backup col.c-time { width: 94px; }
#tab-backup col.c-member { width: 58px; }
#tab-backup col.c-acc { width: 185px; }
#tab-backup col.c-user { width: 135px; }
#tab-backup col.c-email { width: 195px; }
#tab-backup col.c-nick { width: 125px; }
#tab-backup col.c-dev { width: 115px; }
#tab-backup col.c-av { width: 54px; }
#tab-backup col.c-fp { width: 74px; }
#tab-backup col.c-bal { width: 76px; }
#tab-backup col.c-flag { width: 242px; }
#tab-backup col.c-act { width: 78px; }
#tab-backup .bk-tags { display: inline-flex; gap: 4px; align-items: center; flex-wrap: nowrap; }
#tab-backup .bk-btn { padding: 2px 8px; height: 24px; white-space: nowrap; font-size: 12px; }

/* ---- Real-time Runtime Bar & Live Feedback ---- */
.rt-bar { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.rt-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; color: var(--text);
  background: var(--panel2); border: 1px solid var(--line);
  border-radius: 999px; padding: 4px 11px; cursor: pointer;
  transition: border-color .2s, background .2s, color .2s;
}
.rt-pill:hover { border-color: var(--accent); }
.rt-pill .rt-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--muted);
  display: inline-block; flex-shrink: 0;
}
.rt-pill.is-live { border-color: rgba(46,160,67,.55); color: #7ee787; background: rgba(46,160,67,.10); }
.rt-pill.is-live .rt-dot { background: #3fb950; box-shadow: 0 0 0 0 rgba(63,185,80,.7); animation: rtDotPulse 1.8s infinite; }
.rt-pill.is-poll { border-color: rgba(59,130,246,.55); color: #79c0ff; background: rgba(59,130,246,.10); }
.rt-pill.is-poll .rt-dot { background: #58a6ff; animation: rtDotPulse 2.2s infinite; }
.rt-pill.is-busy { border-color: rgba(210,153,34,.6); color: #e3b341; }
.rt-pill.is-busy .rt-dot { background: #e3b341; }
.rt-pill.is-paused { color: var(--muted); border-color: var(--line); }
.rt-pill.is-err { border-color: rgba(248,81,73,.65); color: #ff7b72; background: rgba(248,81,73,.10); }
.rt-pill.is-err .rt-dot { background: #f85149; }
.rt-pill .rt-sep { opacity: .45; }
.rt-pill .rt-ago { font-weight: 500; font-size: 11px; opacity: .88; font-variant-numeric: tabular-nums; }
.rt-select {
  font-size: 12px; padding: 4px 8px; border-radius: 999px;
  background: var(--panel2); border: 1px solid var(--line); color: var(--text);
}
.rt-clock {
  font-size: 11.5px; color: var(--muted); border: 1px solid var(--line);
  border-radius: 999px; padding: 3px 9px; font-variant-numeric: tabular-nums;
}
.rt-inline-live {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .3px;
  color: #3fb950; background: rgba(46,160,67,.12);
  border: 1px solid rgba(46,160,67,.4); border-radius: 999px;
  padding: 1px 7px; margin-left: 6px; vertical-align: middle;
}
.rt-inline-live.is-paused {
  color: var(--muted); background: transparent; border-color: var(--line);
}
.kpi.rt-changed, .pill.rt-changed { animation: rtValFlash 1.4s ease-out; }
@keyframes rtDotPulse {
  0% { box-shadow: 0 0 0 0 rgba(63,185,80,.65); }
  70% { box-shadow: 0 0 0 6px rgba(63,185,80,0); }
  100% { box-shadow: 0 0 0 0 rgba(63,185,80,0); }
}
@keyframes rtValFlash {
  0% { box-shadow: 0 0 0 2px rgba(63,185,80,.55), inset 0 0 18px rgba(63,185,80,.15); }
  100% { box-shadow: 0 0 0 0 rgba(63,185,80,0), inset 0 0 0 rgba(63,185,80,0); }
}
