/* =========================================================================
   GemWin Admin — Dark Enterprise design system
   Tokens → base → layout (sidebar/topbar) → components → pages → responsive
   ========================================================================= */

:root {
  color-scheme: dark;
  /* surfaces */
  --page-bg: #070d1c;
  --sidebar-bg: #0a1226;
  --card-bg: #0d1730;
  --card-2: #111d3a;
  --card-hover: #13214a;
  --input-bg: #0a1329;
  --border: #1a2848;
  --border-2: #243659;
  /* text */
  --text: #e7edf9;
  --text-2: #aeb9d2;
  --muted: #7385a8;
  /* brand + status (used systematically: color = meaning) */
  --accent: #2f7bff;
  --accent-2: #1d64f2;
  --accent-soft: rgba(47, 123, 255, 0.14);
  --blue: #3b86ff;
  --blue-soft: rgba(59, 134, 255, 0.14);
  --green: #22c55e;
  --green-soft: rgba(34, 197, 94, 0.14);
  --orange: #f59e0b;
  --orange-soft: rgba(245, 158, 11, 0.14);
  --red: #ef4444;
  --red-soft: rgba(239, 68, 68, 0.14);
  --purple: #8b5cf6;
  --purple-soft: rgba(139, 92, 246, 0.15);
  --cyan: #06b6d4;
  --cyan-soft: rgba(6, 182, 212, 0.14);
  --gold: #fbbf24;
  --gold-soft: rgba(251, 191, 36, 0.14);
  /* shape */
  --radius: 12px;
  --radius-sm: 9px;
  --radius-xs: 6px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.45);
  --ring: 0 0 0 3px rgba(47, 123, 255, 0.28);
  /* sizing */
  --input-h: 38px;
  --btn-h: 38px;
  --row-h: 48px;
  --sidebar-w: 248px;
  --sidebar-w-collapsed: 72px;
  --topbar-h: 60px;
  /* spacing (8px scale) */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-7: 32px;
  --sp-8: 40px;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--page-bg);
  color: var(--text);
  font-family: "Be Vietnam Pro", system-ui, "Segoe UI", Roboto, sans-serif;
  font-size: 13.5px;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-weight: 600; color: var(--text); }

.num, td.num, th.num, .tabular, .svalue, .mono {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
}

::selection { background: rgba(47, 123, 255, 0.35); }

/* scrollbars */
* { scrollbar-width: thin; scrollbar-color: #26375e transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #22335a; border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #2d4274; }
::-webkit-scrollbar-track { background: transparent; }

a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible,
.nav-item:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.hidden { display: none !important; }
.muted { color: var(--muted); }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-orange { color: var(--orange); }

/* ---------------------------------------------------------------------- */
/* form controls                                                          */
/* ---------------------------------------------------------------------- */

label { display: block; margin: var(--sp-4) 0 var(--sp-2); color: var(--text-2); font-size: 12.5px; font-weight: 600; }

input, select, textarea {
  width: 100%;
  min-height: var(--input-h);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-2);
  background: var(--input-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: #5b6d92; }
input:hover, select:hover, textarea:hover { border-color: #31466f; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); background: #0c1733; }
input[type="checkbox"], input[type="radio"] { width: 16px; height: 16px; min-height: 0; accent-color: var(--accent); padding: 0; }
input[type="datetime-local"], input[type="date"] { color-scheme: dark; }
select { appearance: none; padding-right: 32px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237385a8' 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 11px center; }
select option { background: #0d1730; }

.form-field { margin-bottom: var(--sp-4); }
.form-field > label { margin: 0 0 6px; }
.form-field .req { color: var(--red); margin-left: 2px; }
.form-field .help { color: var(--muted); font-size: 12px; margin-top: 6px; line-height: 1.45; }
.form-field.invalid input, .form-field.invalid select, .form-field.invalid textarea { border-color: var(--red); }
.form-field .field-err { color: var(--red); font-size: 12px; margin-top: 6px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 var(--sp-4); }
.form-grid.cols-1 { grid-template-columns: 1fr; }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid .span-2 { grid-column: span 2; }
.form-grid.cols-1 .span-2 { grid-column: auto; }
.form-section { padding-bottom: var(--sp-4); margin-bottom: var(--sp-4); border-bottom: 1px solid var(--border); }
.form-section:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.form-section-title { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 0 0 var(--sp-3); }
.char-count { text-align: right; font-size: 11.5px; color: var(--muted); margin-top: 4px; }

.input-icon { position: relative; }
.input-icon input { padding-left: 38px; }
.input-icon .ii-left {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--muted); display: flex; pointer-events: none;
}
.input-icon .ii-right {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: none; border: none; padding: 6px; color: var(--muted); display: flex; min-height: 0;
  border-radius: 8px;
}
.input-icon .ii-right:hover { background: var(--card-2); color: var(--text-2); }

/* live search box: icon left, spinner/clear right */
.search-box { position: relative; min-width: 240px; flex: 1 1 260px; max-width: 380px; }
.search-box input { padding-left: 36px; padding-right: 34px; }
.search-box .sb-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); display: flex; pointer-events: none; }
.search-box .sb-right { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); display: flex; align-items: center; }
.search-box .sb-clear { background: none; border: none; color: var(--muted); padding: 2px; min-height: 0; display: flex; border-radius: 6px; }
.search-box .sb-clear:hover { color: var(--text); background: var(--card-2); }
.search-box.loading .sb-clear { display: none; }
.search-box .sb-spin { display: none; width: 14px; height: 14px; border-radius: 50%; border: 2px solid rgba(47,123,255,.25); border-top-color: var(--accent); animation: spin .7s linear infinite; }
.search-box.loading .sb-spin { display: block; }

/* switch */
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; margin: 0; font-weight: 500; color: var(--text-2); user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track { width: 36px; height: 20px; border-radius: 999px; background: #22314f; border: 1px solid #2c3d62; position: relative; transition: background .2s var(--ease), border-color .2s; flex: 0 0 auto; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #8fa0c4; transition: transform .2s var(--ease), background .2s; }
.switch input:checked + .track { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .track::after { transform: translateX(16px); background: #fff; }
.switch input:focus-visible + .track { box-shadow: var(--ring); }
.switch input:disabled + .track { opacity: .5; }

.remember-row { display: flex; align-items: center; gap: 8px; margin: var(--sp-4) 0 0; cursor: pointer; }
.remember-row input { width: auto; }
.remember-row span { font-size: 13px; color: var(--text-2); font-weight: 500; }

/* ---------------------------------------------------------------------- */
/* buttons                                                                */
/* ---------------------------------------------------------------------- */

button {
  position: relative;
  overflow: hidden;
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  min-height: var(--btn-h);
  padding: 0 16px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  background: var(--accent);
  color: #fff;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .08s;
}
button:hover { background: #4a8cff; box-shadow: 0 4px 16px rgba(47, 123, 255, 0.3); }
button:active { transform: translateY(1px); }
button svg { flex: 0 0 auto; }

button.secondary { background: var(--card-2); color: var(--text-2); border-color: var(--border-2); }
button.secondary:hover { background: #172647; color: var(--text); box-shadow: none; border-color: #31466f; }
button.ghost { background: transparent; color: var(--text-2); }
button.ghost:hover { background: var(--card-2); color: var(--text); box-shadow: none; }
button.danger { background: var(--red); }
button.danger:hover { background: #f25c5c; box-shadow: 0 4px 16px rgba(239, 68, 68, 0.3); }
button.success { background: #16a34a; }
button.success:hover { background: #1fb457; box-shadow: 0 4px 16px rgba(34, 197, 94, 0.28); }
button.warning { background: #d98a06; }
button.purple { background: #7c4dee; }
button.purple:hover { background: #8e63f5; box-shadow: 0 4px 16px rgba(139, 92, 246, 0.3); }
button.sm { min-height: 30px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; }
button:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; transform: none; }
button.is-loading { pointer-events: none; }
button.is-loading > *:not(.btn-spin) { opacity: .35; }
.btn-spin { position: absolute; left: 50%; top: 50%; margin: -8px 0 0 -8px; width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255,255,255,.35); border-top-color: #fff; animation: spin .7s linear infinite; }
.btn-icon { display: inline-flex; align-items: center; gap: 7px; }

/* click ripple */
.ripple { position: absolute; border-radius: 50%; transform: scale(0); background: rgba(255, 255, 255, 0.28); animation: ripple .55s ease-out; pointer-events: none; }
@keyframes ripple { to { transform: scale(2.6); opacity: 0; } }

.link-btn { background: none; color: var(--accent); padding: 0; min-height: 0; font-weight: 600; border: none; }
.link-btn:hover { background: none; box-shadow: none; color: #6aa3ff; text-decoration: underline; }

.spinner {
  width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.35); border-top-color: #fff;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.error-msg { color: var(--red); margin-top: 12px; font-size: 13px; min-height: 16px; }

/* ---------------------------------------------------------------------- */
/* login                                                                  */
/* ---------------------------------------------------------------------- */

#login-screen { min-height: 100vh; display: flex; background: var(--page-bg); }
.login-shell { display: flex; width: 100%; min-height: 100vh; }

.login-brand {
  flex: 1 1 50%;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(900px 500px at 10% 0%, rgba(47, 123, 255, 0.22), transparent 60%),
    radial-gradient(700px 500px at 100% 100%, rgba(139, 92, 246, 0.14), transparent 60%),
    #081129;
  border-right: 1px solid var(--border);
  color: #fff;
  padding: var(--sp-8) 64px;
  display: flex; flex-direction: column; justify-content: center; gap: var(--sp-7);
}
.login-brand::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,.03) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.03) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse at 30% 40%, #000 20%, transparent 75%);
}
.login-brand > * { position: relative; z-index: 1; }
.login-tagline { font-size: 15px; line-height: 1.65; color: var(--text-2); margin: 0; max-width: 420px; }
.login-features { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--sp-5); max-width: 440px; }
.login-features li { display: flex; gap: var(--sp-3); align-items: flex-start; animation: fade-up .5s var(--ease) both; }
.login-features li:nth-child(2) { animation-delay: .08s; }
.login-features li:nth-child(3) { animation-delay: .16s; }
.login-features .lf-icon {
  flex: 0 0 auto; width: 38px; height: 38px; border-radius: 10px;
  background: var(--accent-soft); color: #6aa3ff; border: 1px solid rgba(47,123,255,.25);
  display: flex; align-items: center; justify-content: center;
}
.login-features b { display: block; font-size: 13.5px; font-weight: 700; margin-bottom: 3px; color: var(--text); }
.login-features span { display: block; font-size: 12.5px; color: var(--muted); line-height: 1.5; }

.login-formside { flex: 1 1 50%; display: flex; align-items: center; justify-content: center; padding: var(--sp-6); }
.login-box {
  width: 400px; max-width: 100%;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  padding: 36px 32px;
  animation: pop-in .35s var(--ease) both;
}
.login-box h1 { font-size: 21px; margin: 0 0 4px; font-weight: 700; }
.login-box p.sub { color: var(--muted); margin: 0 0 var(--sp-5); font-size: 13px; }
.login-box button[type="submit"] { width: 100%; margin-top: var(--sp-5); min-height: 42px; }
.login-logo { display: flex; align-items: center; gap: 12px; margin-bottom: var(--sp-5); }
.login-logo.mobile-only { display: none; }
.login-box.shake { animation: shake .4s; }
@keyframes shake { 10%, 90% { transform: translateX(-1px); } 20%, 80% { transform: translateX(3px); } 30%, 50%, 70% { transform: translateX(-5px); } 40%, 60% { transform: translateX(5px); } }

.logo-mark {
  width: 38px; height: 38px; border-radius: 10px;
  background: linear-gradient(135deg, #3b86ff, #1d4fd8);
  box-shadow: 0 6px 18px rgba(47, 123, 255, 0.35);
  color: #fff; font-weight: 700; font-size: 14px;
  display: flex; align-items: center; justify-content: center; flex: 0 0 auto;
}
img.logo-mark { background: none; object-fit: contain; }
.login-logo-full { width: 260px; max-width: 100%; height: auto; display: block; }
.logo-text { font-size: 16.5px; font-weight: 700; color: var(--text); line-height: 1.2; }
.logo-text.light { color: #fff; font-size: 22px; }
.logo-text small { display: block; color: var(--muted); font-weight: 600; font-size: 11px; letter-spacing: 0.02em; margin-top: 2px; }

/* ---------------------------------------------------------------------- */
/* shell + sidebar                                                        */
/* ---------------------------------------------------------------------- */

#app-shell { display: none; min-height: 100vh; }
#app-shell.visible { display: flex; }

.sidebar {
  width: var(--sidebar-w); min-width: var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  height: 100vh; position: sticky; top: 0;
  transition: width .22s var(--ease), min-width .22s var(--ease), transform .22s var(--ease);
  z-index: 40;
}
.sidebar-backdrop { display: none; }
.sidebar .brand {
  display: flex; align-items: center; gap: 11px;
  height: var(--topbar-h); padding: 0 var(--sp-4);
  border-bottom: 1px solid var(--border);
  white-space: nowrap; overflow: hidden;
}
.nav { padding: var(--sp-3) var(--sp-3) var(--sp-4); flex: 1; overflow-y: auto; overflow-x: hidden; }
.nav-group { margin-top: var(--sp-3); }
.nav-group:first-child { margin-top: 0; }
.nav-group-label {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 10.5px; font-weight: 700; color: #5d6f95;
  text-transform: uppercase; letter-spacing: 0.08em;
  padding: 6px 10px; white-space: nowrap; cursor: pointer; user-select: none; border-radius: 6px;
}
.nav-group-label:hover { color: var(--text-2); }
.nav-group-label svg { transition: transform .2s var(--ease); }
.nav-group.collapsed .nav-group-label svg { transform: rotate(-90deg); }
.nav-items { overflow: hidden; transition: max-height .25s var(--ease); }
.nav-group.collapsed .nav-items { max-height: 0 !important; }

.nav-item {
  position: relative;
  display: flex; align-items: center; gap: 11px;
  height: 38px; padding: 0 11px;
  color: var(--text-2); cursor: pointer;
  border-radius: 9px; font-size: 13.5px; white-space: nowrap;
  margin-bottom: 2px;
  transition: background .15s, color .15s;
}
.nav-item svg { flex: 0 0 auto; opacity: .85; transition: transform .2s var(--ease); }
.nav-item .nlabel { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.nav-item .nbadge { background: var(--red-soft); color: #ff8a8a; font-size: 10.5px; font-weight: 700; border-radius: 999px; padding: 1px 7px; flex: 0 0 auto; }
.nav-item:hover { color: var(--text); background: rgba(255, 255, 255, 0.04); }
.nav-item:hover svg { transform: translateX(1px); }
.nav-item.active {
  color: #fff;
  background: linear-gradient(90deg, #2f7bff, #2563eb);
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.35);
  font-weight: 600;
}
.nav-item.active svg { opacity: 1; }
.nav-item.active .nbadge { background: rgba(255,255,255,.2); color: #fff; }

.sidebar-foot { padding: var(--sp-3); border-top: 1px solid var(--border); }
.sf-card { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 10px; background: var(--card-bg); border: 1px solid var(--border); overflow: hidden; }
.sf-card .avatar { width: 34px; height: 34px; border-radius: 50%; flex: 0 0 auto; background: linear-gradient(135deg, #3b86ff, #7c4dee); display: flex; align-items: center; justify-content: center; font-weight: 700; color: #fff; }
.sf-card .sf-who { flex: 1; min-width: 0; }
.sf-card .sf-name { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sf-card .sf-role { font-size: 11.5px; color: var(--muted); }
.sf-card .icon-btn { flex: 0 0 auto; }
.sf-version { font-size: 11px; color: #4f6089; margin: 8px 4px 0; display: flex; justify-content: space-between; white-space: nowrap; }

/* collapsed sidebar (desktop toggle or medium screens) */
body.sb-collapsed .sidebar { width: var(--sidebar-w-collapsed); min-width: var(--sidebar-w-collapsed); }
body.sb-collapsed .sidebar .logo-text,
body.sb-collapsed .nav-group-label,
body.sb-collapsed .nav-item .nlabel,
body.sb-collapsed .nav-item .nbadge,
body.sb-collapsed .sf-who, body.sb-collapsed .sf-card .icon-btn, body.sb-collapsed .sf-version { display: none; }
body.sb-collapsed .nav-item { justify-content: center; padding: 0; }
body.sb-collapsed .nav-group.collapsed .nav-items { max-height: none !important; }
body.sb-collapsed .nav-group { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--border); }
body.sb-collapsed .nav-group:first-child { border-top: none; }
body.sb-collapsed .sf-card { justify-content: center; padding: 8px 0; }
body.sb-collapsed .sidebar .brand { justify-content: center; padding: 0; }

/* tooltips (data-tip) */
[data-tip] { position: relative; }
.tip-pop {
  position: fixed; z-index: 200; pointer-events: none;
  background: #1b2a4d; color: #e7edf9; border: 1px solid #2c4070;
  font-size: 12px; font-weight: 500; padding: 5px 9px; border-radius: 7px; white-space: nowrap;
  box-shadow: var(--shadow-lg); opacity: 0; transform: translateY(3px); transition: opacity .12s, transform .12s;
}
.tip-pop.show { opacity: 1; transform: none; }

/* ---------------------------------------------------------------------- */
/* topbar                                                                 */
/* ---------------------------------------------------------------------- */

.content-col { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: var(--topbar-h);
  background: rgba(7, 13, 28, 0.82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: var(--sp-4);
  padding: 0 var(--sp-6);
  position: sticky; top: 0; z-index: 30;
}
.hamburger, .tb-icon {
  background: transparent; border: 1px solid transparent; color: var(--text-2);
  min-height: 0; width: 36px; height: 36px; padding: 0; border-radius: 9px; flex: 0 0 auto;
}
.hamburger:hover, .tb-icon:hover { background: var(--card-2); color: var(--text); box-shadow: none; border-color: var(--border); }
.tb-icon .dot { position: absolute; top: 5px; right: 5px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: var(--red); color: #fff; font-size: 10px; font-weight: 700; display: flex; align-items: center; justify-content: center; border: 2px solid var(--page-bg); }
.tb-icon { overflow: visible; }

.breadcrumb { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12.5px; white-space: nowrap; min-width: 0; }
.breadcrumb b { color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; }

.topbar-search { position: relative; flex: 1; max-width: 460px; margin-left: var(--sp-2); }
.topbar-search .ts-box {
  display: flex; align-items: center; gap: 8px;
  background: var(--card-bg); border: 1px solid var(--border-2);
  border-radius: 10px; height: 38px; padding: 0 10px 0 12px; color: var(--muted);
  transition: border-color .15s, box-shadow .15s;
}
.topbar-search .ts-box:focus-within { border-color: var(--accent); box-shadow: var(--ring); }
.topbar-search input { border: none; background: transparent; padding: 0; min-height: 0; width: 100%; font-size: 13px; }
.topbar-search input:focus { outline: none; box-shadow: none; background: transparent; }
.kbd { font-family: "JetBrains Mono", monospace; font-size: 10.5px; color: var(--muted); border: 1px solid var(--border-2); border-radius: 5px; padding: 1px 6px; background: var(--card-2); white-space: nowrap; }
.ts-spin { display: none; width: 14px; height: 14px; border-radius: 50%; border: 2px solid rgba(47,123,255,.25); border-top-color: var(--accent); animation: spin .7s linear infinite; flex: 0 0 auto; }
.topbar-search.loading .ts-spin { display: block; }
.topbar-search.loading .kbd { display: none; }

.dropdown {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0;
  background: var(--card-bg); border: 1px solid var(--border-2); border-radius: 12px;
  box-shadow: var(--shadow-lg); padding: 6px; z-index: 60;
  max-height: 420px; overflow-y: auto;
  animation: pop-in .16s var(--ease) both; transform-origin: top center;
}
.dd-section { font-size: 10.5px; font-weight: 700; color: var(--muted); letter-spacing: .07em; text-transform: uppercase; padding: 8px 10px 4px; }
.dd-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; cursor: pointer; color: var(--text-2); }
.dd-item:hover, .dd-item.hl { background: var(--accent-soft); color: var(--text); }
.dd-item .dd-main { flex: 1; min-width: 0; }
.dd-item .dd-title { font-weight: 600; color: var(--text); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dd-item .dd-sub { font-size: 11.5px; color: var(--muted); }
.dd-item .dd-ic { width: 30px; height: 30px; border-radius: 8px; background: var(--card-2); display: flex; align-items: center; justify-content: center; color: var(--text-2); flex: 0 0 auto; }
.dd-empty { padding: 18px 10px; text-align: center; color: var(--muted); font-size: 12.5px; }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.sys-pill { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--green-soft); color: var(--green); border: 1px solid rgba(34,197,94,.25); white-space: nowrap; }
.sys-pill.warn { background: var(--orange-soft); color: var(--orange); border-color: rgba(245,158,11,.3); }
.sys-pill.bad { background: var(--red-soft); color: var(--red); border-color: rgba(239,68,68,.3); }
.pulse-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 0 currentColor; animation: pulse 2s infinite; flex: 0 0 auto; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(34,197,94,.55); } 70% { box-shadow: 0 0 0 7px rgba(34,197,94,0); } 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); } }

.topbar-user { position: relative; }
.user-chip { display: flex; align-items: center; gap: 10px; border-radius: 10px; padding: 4px 8px 4px 4px; cursor: pointer; transition: background .15s; }
.user-chip:hover { background: var(--card-2); }
.user-chip .avatar { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, #3b86ff, #7c4dee); color: #fff; font-weight: 700; font-size: 13px; display: flex; align-items: center; justify-content: center; }
.user-chip .who-name { font-size: 13px; font-weight: 600; line-height: 1.2; }
.role-badge { display: block; font-size: 11px; color: var(--muted); font-weight: 500; }
.user-chip .chev { color: var(--muted); }

.user-menu, .pop-menu {
  display: none; position: absolute; right: 0; top: calc(100% + 8px);
  background: var(--card-bg); border: 1px solid var(--border-2); border-radius: 12px;
  box-shadow: var(--shadow-lg); min-width: 210px; padding: 6px; z-index: 60;
}
.user-menu.open, .pop-menu.open { display: block; animation: pop-in .15s var(--ease) both; transform-origin: top right; }
.menu-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.menu-head b { display: block; font-size: 13px; }
.menu-head span { font-size: 11.5px; color: var(--muted); }
.menu-item {
  width: 100%; justify-content: flex-start; background: none; color: var(--text-2);
  font-weight: 500; min-height: 34px; padding: 0 10px; border-radius: 8px; border: none; gap: 10px;
}
.menu-item:hover { background: rgba(255,255,255,.05); color: var(--text); box-shadow: none; }
.menu-item.danger { color: #ff8080; }
.menu-item.danger:hover { background: var(--red-soft); }
.menu-sep { height: 1px; background: var(--border); margin: 6px 0; }

.notif-list { max-height: 360px; overflow-y: auto; }
.notif-item { display: flex; gap: 10px; padding: 9px 10px; border-radius: 8px; }
.notif-item:hover { background: rgba(255,255,255,.03); }
.notif-item .ni-ic { width: 30px; height: 30px; border-radius: 8px; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; }
.notif-item b { font-size: 12.5px; display: block; }
.notif-item span { font-size: 11.5px; color: var(--muted); }

/* ---------------------------------------------------------------------- */
/* main + page scaffolding                                                */
/* ---------------------------------------------------------------------- */

.main { flex: 1; padding: var(--sp-6) var(--sp-6) var(--sp-8); overflow-x: hidden; }
.page-enter > * { animation: fade-up .38s var(--ease) both; }
.page-enter > *:nth-child(2) { animation-delay: .04s; }
.page-enter > *:nth-child(3) { animation-delay: .08s; }
.page-enter > *:nth-child(4) { animation-delay: .12s; }
.page-enter > *:nth-child(5) { animation-delay: .16s; }
.page-enter > *:nth-child(n+6) { animation-delay: .2s; }
@keyframes fade-up { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes pop-in { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--sp-4); margin-bottom: var(--sp-5); flex-wrap: wrap; }
.page-head h2 { margin: 0 0 4px; font-size: 21px; font-weight: 700; letter-spacing: -.01em; }
.page-head .page-sub { margin: 0; }
.page-head .ph-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.main .page-sub { color: var(--muted); margin: 0 0 var(--sp-5); font-size: 13px; line-height: 1.5; }
.panel .page-sub { margin: var(--sp-3) 0 0; }

/* welcome banner */
.welcome {
  position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-5); flex-wrap: wrap;
  padding: 22px 24px; margin-bottom: var(--sp-5);
  border-radius: var(--radius); border: 1px solid #1f3566;
  background: radial-gradient(600px 200px at 0% 0%, rgba(47,123,255,.28), transparent 70%), linear-gradient(90deg, #0e1f47, #0b1735 60%, #0d1733);
}
.welcome::after { content: ""; position: absolute; right: -60px; top: -80px; width: 280px; height: 280px; border-radius: 50%; background: radial-gradient(circle, rgba(47,123,255,.18), transparent 70%); pointer-events: none; }
.welcome h2 { margin: 0 0 6px; font-size: 22px; font-weight: 700; }
.welcome p { margin: 0; color: var(--text-2); font-size: 13.5px; }
.welcome .wl-right { display: flex; align-items: center; gap: var(--sp-4); position: relative; z-index: 1; flex-wrap: wrap; }
.clock-box { display: flex; align-items: center; gap: 10px; }
.clock-box .cb-ic { width: 38px; height: 38px; border-radius: 10px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.08); display: flex; align-items: center; justify-content: center; color: var(--text-2); }
.clock-box .cb-date { font-size: 12px; color: var(--text-2); }
.clock-box .cb-time { font-size: 15px; font-weight: 700; font-family: "JetBrains Mono", monospace; }

/* ---------------------------------------------------------------------- */
/* cards                                                                  */
/* ---------------------------------------------------------------------- */

.panel {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: var(--sp-5);
  margin-bottom: var(--sp-5);
  min-width: 0;
}
.panel.flush { padding: 0; }
.panel h3 { margin: 0 0 var(--sp-4); font-size: 15px; font-weight: 700; }
.panel h3 .accent-dot { color: var(--muted); font-weight: 500; font-size: 13px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-4); flex-wrap: wrap; }
.panel-head h3 { margin: 0; }
.panel-head .ph-sub { color: var(--muted); font-size: 12px; margin-top: 3px; }
.panel.flush .panel-head { padding: var(--sp-4) var(--sp-5) 0; }
.panel-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: var(--sp-5); padding-top: var(--sp-4); border-top: 1px solid var(--border); }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-5); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-5); }
.dash-row { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, 1fr); gap: var(--sp-5); }
.dash-row-2 { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr) minmax(0, .8fr); gap: var(--sp-5); }
.grid-2 > .panel, .grid-3 > .panel, .dash-row > .panel, .dash-row-2 > .panel { margin-bottom: 0; }
.dash-row, .dash-row-2, .grid-2, .grid-3 { margin-bottom: var(--sp-5); }

/* KPI / stat cards */
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-4); margin-bottom: var(--sp-5); }
.cash-report { margin-bottom: var(--sp-5); }
.cash-report-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.cash-report-title { font-weight: 700; }
.cash-report-note { color: var(--muted); font-size: 12px; }
.cash-report-split { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-3); }
.stat-card {
  position: relative; overflow: hidden;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  min-height: 104px;
  transition: border-color .2s, transform .2s var(--ease), box-shadow .2s;
}
.stat-card:hover { border-color: #2a3f6c; transform: translateY(-2px); box-shadow: 0 10px 24px rgba(0,0,0,.35); }
.stat-card .sc-top { display: flex; align-items: center; gap: 12px; }
.stat-card .sicon { width: 40px; height: 40px; border-radius: 11px; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.stat-card .stitle { color: var(--text-2); font-size: 12.5px; font-weight: 600; }
.stat-card .svalue { font-size: 24px; font-weight: 700; line-height: 1.15; margin-top: 12px; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; position: relative; z-index: 1; }
.stat-card .sc-foot { display: flex; align-items: center; gap: 6px; margin-top: 6px; position: relative; z-index: 1; }
.stat-card .ssub { color: var(--muted); font-size: 11.5px; }
.stat-card .spark { position: absolute; right: 12px; bottom: 12px; width: 42%; height: 42px; opacity: .95; }
.stat-card.has-spark .svalue, .stat-card.has-spark .sc-foot { max-width: 60%; }
.delta { font-size: 11.5px; font-weight: 700; padding: 1px 6px; border-radius: 6px; }
.delta.up { color: var(--green); background: var(--green-soft); }
.delta.down { color: var(--red); background: var(--red-soft); }
.delta.flat { color: var(--muted); background: rgba(255,255,255,.05); }
.stat-card .svalue.blue { color: var(--text); }
.stat-card .svalue.green { color: var(--green); }
.stat-card .svalue.orange { color: var(--orange); }
.stat-card .svalue.purple { color: #b39bff; }
.stat-card .svalue.red { color: #ff7373; }
.stat-card .svalue.cyan { color: var(--cyan); }
.sicon.blue { background: linear-gradient(135deg, #2f7bff, #1d4fd8); color: #fff; box-shadow: 0 6px 16px rgba(47,123,255,.3); }
.sicon.green { background: linear-gradient(135deg, #22c55e, #15803d); color: #fff; box-shadow: 0 6px 16px rgba(34,197,94,.25); }
.sicon.orange { background: linear-gradient(135deg, #f59e0b, #d97706); color: #fff; box-shadow: 0 6px 16px rgba(245,158,11,.25); }
.sicon.purple { background: linear-gradient(135deg, #8b5cf6, #6d28d9); color: #fff; box-shadow: 0 6px 16px rgba(139,92,246,.28); }
.sicon.red { background: linear-gradient(135deg, #ef4444, #b91c1c); color: #fff; box-shadow: 0 6px 16px rgba(239,68,68,.25); }
.sicon.cyan { background: linear-gradient(135deg, #06b6d4, #0e7490); color: #fff; box-shadow: 0 6px 16px rgba(6,182,212,.25); }

.sub-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--sp-3); margin-bottom: var(--sp-5); }
.sub-stat { background: var(--card-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; }
.sub-stat .label { color: var(--muted); font-size: 11.5px; font-weight: 600; margin-bottom: 6px; }
.sub-stat .value { font-size: 17px; font-weight: 700; font-family: "JetBrains Mono", monospace; }

/* charts */
.chart-wrap { position: relative; }
.chart-wrap svg { display: block; overflow: visible; }
.chart-legend { display: flex; gap: 14px; font-size: 12px; color: var(--text-2); flex-wrap: wrap; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.chart-tooltip {
  position: absolute; pointer-events: none; background: #16254a; border: 1px solid #2c4070; color: #fff;
  font-size: 12px; padding: 8px 10px; border-radius: 8px; transform: translate(-50%, -110%);
  white-space: nowrap; opacity: 0; transition: opacity .12s; z-index: 5; box-shadow: var(--shadow-lg);
}
.chart-tooltip.show { opacity: 1; }
.chart-tooltip .tt-title { color: var(--muted); font-size: 11px; margin-bottom: 4px; }
.chart-tooltip .tt-row { display: flex; align-items: center; gap: 6px; }
.chart-tooltip .tt-row i { width: 8px; height: 8px; border-radius: 50%; }
.chart-tooltip .tt-row b { margin-left: auto; padding-left: 12px; font-family: "JetBrains Mono", monospace; }
.chart-line { stroke-dasharray: 2000; stroke-dashoffset: 2000; animation: draw 1.2s var(--ease) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.chart-area { opacity: 0; animation: fade-in .8s .3s forwards; }
.chart-bar { transform-origin: bottom; transform-box: fill-box; animation: grow .6s var(--ease) both; }
@keyframes grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.chart-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--sp-2); padding: var(--sp-8) 0; color: var(--muted); }

.donut-wrap { display: flex; align-items: center; gap: var(--sp-5); flex-wrap: wrap; }
.donut-wrap svg { flex: 0 0 auto; }
.donut-seg { transition: opacity .15s, stroke-width .15s; cursor: pointer; }
.donut-seg:hover { stroke-width: 22; }
.donut-legend { flex: 1; min-width: 150px; display: flex; flex-direction: column; gap: 9px; }
.donut-legend .dl-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-2); }
.donut-legend .dl-row i { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
.donut-legend .dl-row span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.donut-legend .dl-row b { font-family: "JetBrains Mono", monospace; color: var(--text); font-weight: 600; }

/* progress / gauge */
.progress { height: 6px; background: #1a2848; border-radius: 999px; overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: 999px; background: var(--accent); width: 0; transition: width .8s var(--ease); }
.progress.green > i { background: var(--green); }
.progress.orange > i { background: var(--orange); }
.progress.red > i { background: var(--red); }
.progress.purple > i { background: var(--purple); }
.usage-cell { min-width: 120px; }
.usage-cell .progress { margin-top: 5px; }
.usage-cell .mono { font-size: 12px; }

.status-list { display: flex; flex-direction: column; gap: 4px; }
.status-row { display: flex; align-items: center; gap: 12px; padding: 9px 6px; border-radius: 9px; }
.status-row:hover { background: rgba(255,255,255,.025); }
.status-row .sr-ic { width: 32px; height: 32px; border-radius: 9px; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.status-row .sr-main { flex: 1; min-width: 0; }
.status-row .sr-name { font-weight: 600; font-size: 13px; }
.status-row .sr-sub { font-size: 11.5px; color: var(--muted); }
.status-row .progress { margin-top: 6px; }

.quick-actions { display: flex; flex-direction: column; gap: 10px; }
.quick-actions button { justify-content: flex-start; min-height: 42px; width: 100%; }

.activity-list { display: flex; flex-direction: column; }
.activity-item { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.activity-item:last-child { border-bottom: none; }
.activity-item .ai-ic { width: 32px; height: 32px; border-radius: 50%; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; }
.activity-item .ai-main { flex: 1; min-width: 0; }
.activity-item .ai-title { font-size: 13px; font-weight: 600; }
.activity-item .ai-sub { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-item .ai-time { font-size: 11.5px; color: var(--muted); white-space: nowrap; }

/* ---------------------------------------------------------------------- */
/* filter bar / toolbar                                                   */
/* ---------------------------------------------------------------------- */

.filter-card {
  background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius);
  padding: var(--sp-4) var(--sp-5); margin-bottom: var(--sp-5);
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--sp-4);
}
.panel .filter-card { background: var(--card-2); padding: var(--sp-3) var(--sp-4); margin: var(--sp-3) 0 0; }
.filter-field { display: flex; flex-direction: column; gap: 6px; min-width: 150px; flex: 0 1 auto; }
.filter-field label { margin: 0; font-size: 12px; color: var(--muted); font-weight: 600; }
.filter-field input, .filter-field select { min-height: 36px; padding-top: 6px; padding-bottom: 6px; font-size: 13px; }
.filter-actions { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; align-items: center; }

.table-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--border); }
.table-toolbar .tt-filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; flex: 1; }
.table-toolbar .tt-filters select, .table-toolbar .tt-filters input:not(.sb-input) { width: auto; min-width: 150px; min-height: 36px; }
.table-toolbar .tt-actions { display: flex; gap: 8px; margin-left: auto; }
.table-toolbar .tt-field { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.toolbar { display: flex; gap: 10px; margin-bottom: var(--sp-4); flex-wrap: wrap; align-items: center; }
.toolbar input, .toolbar select { width: auto; min-width: 160px; }

/* ---------------------------------------------------------------------- */
/* data table                                                             */
/* ---------------------------------------------------------------------- */

.dt { position: relative; }
.dt-loadbar { position: absolute; left: 0; right: 0; top: 0; height: 2px; overflow: hidden; opacity: 0; transition: opacity .2s; z-index: 3; }
.dt-loadbar::after { content: ""; position: absolute; top: 0; left: -40%; width: 40%; height: 100%; background: linear-gradient(90deg, transparent, var(--accent), transparent); animation: loadbar 1s linear infinite; }
.dt.loading .dt-loadbar { opacity: 1; }
.dt.loading tbody { opacity: .45; transition: opacity .15s; }
@keyframes loadbar { to { left: 100%; } }

.table-scroll { overflow: auto; max-height: 64vh; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
th, td { text-align: left; padding: 0 14px; height: var(--row-h); border-bottom: 1px solid var(--border); white-space: nowrap; vertical-align: middle; }
th {
  height: 40px; color: var(--muted); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em;
  background: #0b1430; position: sticky; top: 0; z-index: 2;
}
.panel > table th, .panel > div > table th { background: #0f1a36; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: rgba(47, 123, 255, 0.06); }
tbody tr:last-child td { border-bottom: none; }
tbody tr.clickable { cursor: pointer; }
td.num, th.num { text-align: right; }
td.wrap { white-space: normal; min-width: 220px; max-width: 420px; line-height: 1.45; padding-top: 8px; padding-bottom: 8px; }
td.trunc { max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
th.col-check, td.col-check { width: 40px; padding-right: 0; }
/* actions column: always last, right aligned, fixed width, sticky on horizontal scroll */
th.col-actions, td.col-actions { text-align: right; width: 1%; position: sticky; right: 0; }
td.col-actions { background: var(--card-bg); }
tbody tr:hover td.col-actions { background: #0f1c3b; }
th.col-actions { z-index: 3; }
.row-enter { animation: fade-up .3s var(--ease) both; }

.cell-user { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cell-user .cu-main { min-width: 0; }
.cell-user .cu-name { font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; }
.cell-user .cu-sub { font-size: 11.5px; color: var(--muted); }
.avatar-circle {
  width: 32px; height: 32px; border-radius: 50%; flex: 0 0 auto;
  color: #fff; font-weight: 700; font-size: 12.5px;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #3b86ff, #1d4fd8);
}
.avatar-circle.lg { width: 64px; height: 64px; font-size: 24px; border-radius: 18px; }
.avatar-circle { position: relative; overflow: hidden; }
.avatar-circle .av-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ph-avatar { position: relative; flex: 0 0 auto; }
.ph-avatar-edit { position: absolute; right: -6px; bottom: -6px; width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--bg); background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.ph-avatar-edit:hover { filter: brightness(1.12); }
.avatar-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.av-pick { position: relative; aspect-ratio: 1; border-radius: 14px; border: 2px solid var(--border-2); background: var(--card-2); cursor: pointer; overflow: hidden; padding: 0; color: var(--muted); font-weight: 700; font-size: 18px; display: flex; align-items: center; justify-content: center; }
.av-pick img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.av-pick:hover { border-color: var(--accent); }
.av-pick.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft, rgba(59,134,255,.25)); color: var(--text); }
.av-pick.active::after { content: "✓"; position: absolute; top: 4px; right: 6px; font-size: 13px; color: #fff; background: var(--accent); border-radius: 50%; width: 18px; height: 18px; line-height: 18px; text-align: center; z-index: 1; }
.kv-mini { display: grid; gap: 6px; margin-top: 12px; font-size: 12.5px; }
.name-cell { display: inline-flex; align-items: center; }
.code-chip { font-family: "JetBrains Mono", monospace; font-size: 12.5px; background: var(--card-2); border: 1px solid var(--border-2); border-radius: 6px; padding: 2px 8px; color: #cfe0ff; }

.row-actions { display: inline-flex; gap: 4px; justify-content: flex-end; align-items: center; }
.icon-btn {
  width: 30px; height: 30px; min-height: 0; padding: 0; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 1px solid transparent; color: var(--muted);
}
.icon-btn:hover { background: var(--accent-soft); color: #7fb0ff; border-color: rgba(47,123,255,.3); box-shadow: none; }
.icon-btn.danger { background: transparent; }
.icon-btn.danger:hover { background: var(--red-soft); color: #ff7b7b; border-color: rgba(239,68,68,.3); }
.icon-btn.success:hover { background: var(--green-soft); color: var(--green); border-color: rgba(34,197,94,.3); }
.icon-btn.warn:hover { background: var(--orange-soft); color: var(--orange); border-color: rgba(245,158,11,.3); }
.icon-btn.bordered { border-color: var(--border-2); background: var(--card-2); color: var(--text-2); }
.more-wrap { position: relative; display: inline-flex; }
.more-wrap .pop-menu { min-width: 190px; text-align: left; }

.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; padding: 44px var(--sp-4); color: var(--muted); text-align: center;
}
.empty-state .es-ic { width: 52px; height: 52px; border-radius: 14px; background: var(--card-2); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; color: #5d6f95; margin-bottom: 6px; }
.empty-state b, .empty-state h3 { color: var(--text); font-size: 14px; margin: 0; }
.empty-state span, .empty-state p { font-size: 12.5px; margin: 0; max-width: 460px; line-height: 1.55; }
.panel.empty-page { padding: 24px; }
td .empty-state { padding: 36px 0; }
.error-state .es-ic { color: var(--red); background: var(--red-soft); border-color: rgba(239,68,68,.25); }

.pager { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 12px var(--sp-5); border-top: 1px solid var(--border); color: var(--muted); font-size: 12.5px; flex-wrap: wrap; }
.pager .pg-left { display: flex; align-items: center; gap: 10px; }
.pager .pg-left select { width: auto; min-height: 30px; padding: 2px 28px 2px 10px; font-size: 12.5px; }
.pager .pg-btns { display: flex; gap: 4px; align-items: center; }
.pager .pg-btns button { min-width: 30px; min-height: 30px; padding: 0 8px; font-size: 12.5px; background: transparent; color: var(--text-2); border: 1px solid var(--border-2); border-radius: 8px; }
.pager .pg-btns button:hover:not(:disabled) { background: var(--card-2); color: var(--text); box-shadow: none; }
.pager .pg-btns button.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.pager .pg-btns .pg-gap { padding: 0 4px; }

/* badges */
.badge, .status-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap;
  border: 1px solid transparent;
}
.status-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ok, .status-pill.ok { background: var(--green-soft); color: var(--green); border-color: rgba(34,197,94,.22); }
.badge.bad, .status-pill.bad { background: var(--red-soft); color: #ff7373; border-color: rgba(239,68,68,.22); }
.badge.warn, .status-pill.warn, .badge.bot { background: var(--orange-soft); color: var(--orange); border-color: rgba(245,158,11,.22); }
.badge.info, .status-pill.info { background: var(--cyan-soft); color: var(--cyan); border-color: rgba(6,182,212,.22); }
.badge.purple, .status-pill.purple { background: var(--purple-soft); color: #b39bff; border-color: rgba(139,92,246,.25); }
.badge.blue, .status-pill.blue { background: var(--blue-soft); color: #7fb0ff; border-color: rgba(59,134,255,.25); }
.badge.muted, .status-pill.muted { background: rgba(255,255,255,.05); color: var(--text-2); border-color: var(--border-2); }
.badge.gold, .status-pill.gold { background: var(--gold); color: #1a1300; border-color: rgba(251,191,36,.4); }
.amount-pos { color: var(--green); font-weight: 600; }
.amount-neg { color: #ff7373; font-weight: 600; }

/* skeleton */
.skeleton { background: linear-gradient(90deg, #111d3a 25%, #182a52 37%, #111d3a 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: 6px; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
.skeleton-line { height: 12px; margin: 6px 0; }
.skeleton-row { height: 38px; margin-bottom: 8px; border-radius: 8px; }
.skeleton-card { height: 104px; border-radius: var(--radius); }
.sk-cell { height: 12px; border-radius: 6px; }

/* ---------------------------------------------------------------------- */
/* tabs                                                                   */
/* ---------------------------------------------------------------------- */

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: var(--sp-5); overflow-x: auto; position: relative; }
.tab { padding: 10px 14px; color: var(--muted); font-weight: 600; font-size: 13px; cursor: pointer; white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color .15s, border-color .15s; display: inline-flex; align-items: center; gap: 7px; }
.tab:hover { color: var(--text); }
.tab.active { color: #7fb0ff; border-bottom-color: var(--accent); }
.tab .tab-count { font-size: 11px; background: var(--card-2); border-radius: 999px; padding: 0 7px; color: var(--text-2); }
.tab-panel { animation: fade-up .3s var(--ease) both; }

/* profile header (user detail) */
.profile-head { display: flex; align-items: center; gap: var(--sp-5); flex-wrap: wrap; }
.profile-head .ph-main { flex: 1; min-width: 220px; }
.profile-head .ph-name { font-size: 20px; font-weight: 700; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.profile-head .ph-meta { color: var(--muted); font-size: 12.5px; margin-top: 6px; display: flex; gap: 14px; flex-wrap: wrap; }
.profile-head .ph-meta span { display: inline-flex; align-items: center; gap: 5px; }
.profile-head .ph-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12.5px; cursor: pointer; margin-bottom: var(--sp-3); }
.back-link:hover { color: var(--text); }

.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: var(--sp-3); }
.detail-grid .item { background: var(--card-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; min-width: 0; }
.detail-grid .item .label { color: var(--muted); font-size: 11.5px; font-weight: 600; }
.detail-grid .item .value { font-size: 14.5px; font-weight: 600; margin-top: 4px; color: var(--text); overflow: hidden; text-overflow: ellipsis; word-break: break-all; }
.kv { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 10px 14px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; color: var(--text); word-break: break-word; }
.json-view { background: #081026; border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; font-family: "JetBrains Mono", monospace; font-size: 12px; color: #c6d6ff; max-height: 420px; overflow: auto; white-space: pre-wrap; word-break: break-word; margin: 0; }
.log-view { background: #060c1e; border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; font-family: "JetBrains Mono", monospace; font-size: 11.5px; line-height: 1.55; color: #b9c6e4; max-height: 380px; overflow: auto; white-space: pre-wrap; word-break: break-word; margin: 0; }
.log-view .ln-err { color: #ff8a8a; }
.log-view .ln-warn { color: #fbbf24; }
.log-view mark { background: rgba(47,123,255,.35); color: #fff; border-radius: 2px; }

.note-item { padding: 12px 14px; background: var(--card-2); border: 1px solid var(--border); border-radius: 10px; margin-bottom: 8px; }
.note-item .ni-head { font-size: 11.5px; color: var(--muted); margin-bottom: 4px; display: flex; gap: 8px; }
.note-item .ni-head b { color: var(--text-2); }
.note-item p { margin: 0; line-height: 1.5; }

.callout { display: flex; gap: 12px; padding: 12px 14px; border-radius: 10px; border: 1px solid rgba(47,123,255,.25); background: var(--accent-soft); color: #b8d0ff; font-size: 13px; line-height: 1.55; margin-bottom: var(--sp-4); }
.callout svg { flex: 0 0 auto; margin-top: 1px; }
.callout.warn { border-color: rgba(245,158,11,.3); background: var(--orange-soft); color: #fcd88a; }
.callout.danger { border-color: rgba(239,68,68,.3); background: var(--red-soft); color: #ffb0b0; }
.callout.ok { border-color: rgba(34,197,94,.3); background: var(--green-soft); color: #9fe8b8; }

/* user lookup preview (adjust pages) */
.lookup-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 10px; border: 1px dashed var(--border-2); background: var(--card-2); min-height: 62px; color: var(--muted); font-size: 12.5px; margin-bottom: var(--sp-4); transition: border-color .2s; }
.lookup-card.found { border-style: solid; border-color: rgba(34,197,94,.35); }
.lookup-card.notfound { border-color: rgba(239,68,68,.4); color: #ff9a9a; }
.lookup-card .lc-main { flex: 1; min-width: 0; }
.lookup-card .lc-name { color: var(--text); font-weight: 600; font-size: 13.5px; }
.lookup-card .lc-bal { display: flex; gap: 16px; font-size: 12px; }
.lookup-card .lc-bal b { color: var(--text); font-family: "JetBrains Mono", monospace; }
/* một dòng trong danh sách tài khoản khớp khi admin gõ tên trùng nhau */
.lookup-pick { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 9px; border-radius: 8px; border: 1px solid var(--border-2); background: var(--card); color: var(--text); font-size: 13px; text-align: left; }
.lookup-pick:hover { border-color: var(--accent); background: var(--card-2); box-shadow: none; }

.seg { display: inline-flex; background: var(--card-2); border: 1px solid var(--border-2); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { background: transparent; color: var(--text-2); min-height: 30px; padding: 0 12px; font-size: 12.5px; border: none; border-radius: 7px; }
.seg button:hover { background: rgba(255,255,255,.05); box-shadow: none; color: var(--text); }
.seg button.active { background: var(--accent); color: #fff; }

/* ---------------------------------------------------------------------- */
/* modal / drawer / confirm / toast                                       */
/* ---------------------------------------------------------------------- */

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(3, 7, 18, 0.66); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; z-index: 90; padding: var(--sp-4);
  animation: fade-in .15s ease both;
}
.modal-backdrop.closing { animation: fade-in .15s ease reverse both; }
.modal {
  width: 480px; max-width: 100%; max-height: calc(100vh - 32px);
  display: flex; flex-direction: column;
  background: var(--card-bg); border: 1px solid var(--border-2); border-radius: 14px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
  animation: modal-in .22s var(--ease) both;
}
.modal.sm { width: 400px; }
.modal.lg { width: 680px; }
.modal.xl { width: 880px; }
.modal-backdrop.closing .modal { animation: modal-in .15s ease reverse both; }
@keyframes modal-in { from { opacity: 0; transform: translateY(12px) scale(.97); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: flex-start; gap: 12px; padding: 18px 20px 14px; border-bottom: 1px solid var(--border); }
.modal-head .mh-ic { width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.modal-head .mh-text { flex: 1; min-width: 0; }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-head .mh-sub { margin-top: 3px; color: var(--muted); font-size: 12.5px; }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-body > label:first-child { margin-top: 0; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--border); background: rgba(255,255,255,.015); border-radius: 0 0 14px 14px; }
.modal-foot .mf-left { margin-right: auto; display: flex; align-items: center; color: var(--muted); font-size: 12px; }
.modal .error-msg:empty { display: none; }
.confirm-body { text-align: center; padding: 26px 24px 8px; }
.confirm-body .cf-ic { width: 54px; height: 54px; border-radius: 50%; margin: 0 auto 14px; display: flex; align-items: center; justify-content: center; }
.confirm-body h3 { margin: 0 0 8px; font-size: 16.5px; }
.confirm-body p { margin: 0; color: var(--text-2); line-height: 1.55; }
.confirm-body .cf-detail { margin-top: 14px; text-align: left; background: var(--card-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; font-size: 12.5px; }
.confirm-body .cf-detail div { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; }
.confirm-body .cf-detail span { color: var(--muted); }
.confirm-body .cf-detail b { font-weight: 600; text-align: right; word-break: break-word; }
.modal.confirm .modal-foot { border-top: none; background: none; justify-content: center; padding-bottom: 22px; }
.modal.confirm .modal-foot button { min-width: 120px; }

.drawer-backdrop { position: fixed; inset: 0; background: rgba(3, 7, 18, 0.55); z-index: 85; animation: fade-in .18s ease both; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 480px; max-width: 100vw; z-index: 86;
  background: var(--card-bg); border-left: 1px solid var(--border-2); box-shadow: -20px 0 48px rgba(0,0,0,.5);
  display: flex; flex-direction: column; animation: drawer-in .26s var(--ease) both;
}
.drawer.wide { width: 640px; }
.drawer.closing { animation: drawer-in .2s ease reverse both; }
.drawer-backdrop.closing { animation: fade-in .2s ease reverse both; }
@keyframes drawer-in { from { transform: translateX(100%); } to { transform: none; } }
.drawer-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.drawer-head .dh-text { flex: 1; min-width: 0; }
.drawer-head h3 { margin: 0; font-size: 16px; }
.drawer-head .dh-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px; }
.drawer-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }
.drawer-body .panel { background: var(--card-2); }

.toast-wrap { position: fixed; top: 72px; right: var(--sp-5); z-index: 120; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast {
  pointer-events: auto; position: relative; overflow: hidden;
  display: flex; align-items: flex-start; gap: 10px; width: 340px; max-width: calc(100vw - 32px);
  background: #101c3a; border: 1px solid var(--border-2); border-left: 3px solid var(--accent); border-radius: 10px;
  padding: 12px 14px; font-size: 13px; box-shadow: var(--shadow-lg); color: var(--text);
  animation: toast-in .28s var(--ease) both;
}
.toast.leaving { animation: toast-out .22s ease both; }
@keyframes toast-in { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(24px); } }
.toast .t-ic { flex: 0 0 auto; margin-top: 1px; }
.toast .t-main { flex: 1; min-width: 0; }
.toast .t-title { font-weight: 700; margin-bottom: 2px; }
.toast .t-msg { color: var(--text-2); line-height: 1.45; word-break: break-word; }
.toast .t-close { background: none; border: none; color: var(--muted); min-height: 0; padding: 2px; }
.toast .t-close:hover { color: var(--text); background: none; box-shadow: none; }
.toast .t-bar { position: absolute; left: 0; bottom: 0; height: 2px; background: currentColor; opacity: .5; animation: t-bar linear forwards; }
@keyframes t-bar { from { width: 100%; } to { width: 0; } }
.toast.ok { border-left-color: var(--green); } .toast.ok .t-ic, .toast.ok .t-bar { color: var(--green); }
.toast.err { border-left-color: var(--red); } .toast.err .t-ic, .toast.err .t-bar { color: var(--red); }
.toast.warn { border-left-color: var(--orange); } .toast.warn .t-ic, .toast.warn .t-bar { color: var(--orange); }
.toast.info { border-left-color: var(--accent); } .toast.info .t-ic, .toast.info .t-bar { color: var(--accent); }

/* ---------------------------------------------------------------------- */
/* page-specific                                                          */
/* ---------------------------------------------------------------------- */

.help-block { margin-bottom: var(--sp-6); }
.help-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--sp-4); margin-bottom: var(--sp-5); }
.help-item { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.help-item b { display: block; font-size: 13.5px; margin-bottom: 4px; }
.help-item p { margin: 0; color: var(--text-2); font-size: 13px; line-height: 1.55; }
.help-policy { background: var(--accent-soft); border: 1px solid rgba(47,123,255,.3); border-radius: var(--radius); padding: var(--sp-4); color: #b8d0ff; font-size: 13.5px; line-height: 1.6; }

.jackpot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--sp-4); margin-bottom: var(--sp-5); }
.jackpot-card {
  position: relative; overflow: hidden;
  background: radial-gradient(260px 120px at 100% 0%, rgba(251,191,36,.12), transparent 70%), var(--card-bg);
  border: 1px solid var(--border); border-radius: var(--radius); padding: var(--sp-5);
  transition: transform .2s var(--ease), border-color .2s, box-shadow .2s;
}
.jackpot-card:hover { transform: translateY(-2px); border-color: rgba(251,191,36,.35); box-shadow: 0 10px 28px rgba(251,191,36,.08); }
.jackpot-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: linear-gradient(90deg, #f59e0b, #fde68a, #f59e0b); background-size: 200% 100%; animation: shine 3s linear infinite; }
@keyframes shine { to { background-position: -200% 0; } }
.jackpot-card .jp-name { font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.jackpot-card .jp-amount { font-size: 24px; font-weight: 700; color: var(--gold); margin-bottom: 12px; }
.jp-badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.jackpot-card .jp-badge.real { background: var(--green-soft); color: var(--green); }
.jackpot-card .jp-badge.display { background: rgba(255,255,255,.06); color: var(--text-2); }

.game-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: var(--sp-4); margin-bottom: var(--sp-5); }
.game-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--sp-4) var(--sp-5); transition: transform .2s var(--ease), border-color .2s; }
.game-card:hover { transform: translateY(-2px); border-color: #2a3f6c; }
.game-card .gc-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: var(--sp-4); }
.game-card .gc-name { font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.game-card .gc-ic { width: 34px; height: 34px; border-radius: 9px; background: var(--card-2); border: 1px solid var(--border-2); display: flex; align-items: center; justify-content: center; color: #7fb0ff; }
.game-card .gc-stats { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); font-size: 11.5px; color: var(--muted); }
.game-card .gc-stats b { display: block; font-size: 14px; color: var(--text); margin-top: 2px; font-family: "JetBrains Mono", monospace; font-weight: 600; }
.game-card.off { opacity: .75; }

.banner-row { display: grid; grid-template-columns: 120px 1fr 1fr auto; gap: var(--sp-3); align-items: end; padding: var(--sp-3); background: var(--card-2); border: 1px solid var(--border); border-radius: 10px; margin-bottom: 10px; }
.banner-thumb { width: 120px; height: 64px; border-radius: 8px; background: #081026 center/cover no-repeat; border: 1px solid var(--border-2); display: flex; align-items: center; justify-content: center; color: #4f6089; }
.banner-row .filter-field { min-width: 0; }
.dl-row { grid-template-columns: 140px 1fr 1.4fr auto; }

.sticky-save { position: sticky; bottom: 0; z-index: 5; display: flex; justify-content: flex-end; gap: 10px; padding: 12px var(--sp-5); margin: 0 calc(-1 * var(--sp-6)) calc(-1 * var(--sp-8)); background: rgba(7,13,28,.9); backdrop-filter: blur(8px); border-top: 1px solid var(--border); }

.settings-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: var(--sp-5); align-items: start; }
.settings-nav { position: sticky; top: calc(var(--topbar-h) + 16px); background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px; }
.settings-nav a { display: flex; align-items: center; gap: 9px; padding: 9px 10px; border-radius: 8px; color: var(--text-2); text-decoration: none; font-size: 13px; cursor: pointer; }
.settings-nav a:hover { background: rgba(255,255,255,.04); color: var(--text); }
.settings-nav a.active { background: var(--accent-soft); color: #7fb0ff; }

.pw-strength { display: flex; gap: 4px; margin-top: 8px; }
.pw-strength i { flex: 1; height: 4px; border-radius: 4px; background: #1a2848; transition: background .2s; }
.pw-strength.s1 i:nth-child(-n+1) { background: var(--red); }
.pw-strength.s2 i:nth-child(-n+2) { background: var(--orange); }
.pw-strength.s3 i:nth-child(-n+3) { background: #eab308; }
.pw-strength.s4 i:nth-child(-n+4) { background: var(--green); }

.code-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 6px; max-height: 300px; overflow: auto; }
.code-list .code-chip { text-align: center; }

.footer-bar { display: flex; justify-content: space-between; gap: 12px; padding: 14px var(--sp-6); border-top: 1px solid var(--border); color: var(--muted); font-size: 12px; flex-wrap: wrap; }
.footer-bar b { color: var(--text-2); font-weight: 600; }
.footer-bar .fb-ok { display: inline-flex; align-items: center; gap: 7px; color: var(--green); }

/* ---------------------------------------------------------------------- */
/* responsive                                                             */
/* ---------------------------------------------------------------------- */

@media (max-width: 1440px) {
  .dash-row { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
  .dash-row > .panel:nth-child(3) { grid-column: 1 / -1; }
  .dash-row-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .dash-row-2 > .panel:nth-child(3) { grid-column: 1 / -1; }
}
@media (max-width: 1280px) {
  .stat-grid, .cash-report-split { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1200px) {
  body:not(.sb-open-mobile) .sidebar { width: var(--sidebar-w-collapsed); min-width: var(--sidebar-w-collapsed); }
  body:not(.sb-open-mobile) .sidebar .logo-text,
  body:not(.sb-open-mobile) .nav-group-label,
  body:not(.sb-open-mobile) .nav-item .nlabel,
  body:not(.sb-open-mobile) .nav-item .nbadge,
  body:not(.sb-open-mobile) .sf-who, body:not(.sb-open-mobile) .sf-card .icon-btn, body:not(.sb-open-mobile) .sf-version { display: none; }
  body:not(.sb-open-mobile) .nav-item { justify-content: center; padding: 0; }
  body:not(.sb-open-mobile) .nav-group.collapsed .nav-items { max-height: none !important; }
  body:not(.sb-open-mobile) .sf-card { justify-content: center; padding: 8px 0; }
  body:not(.sb-open-mobile) .sidebar .brand { justify-content: center; padding: 0; }
  .sb-toggle { display: none !important; }
  .login-brand { padding: var(--sp-8); }
  .settings-layout { grid-template-columns: 1fr; }
  .settings-nav { position: static; display: flex; overflow-x: auto; }
}
@media (max-width: 1024px) {
  .dash-row, .dash-row-2, .grid-2 { grid-template-columns: 1fr; }
  .dash-row > .panel:nth-child(3), .dash-row-2 > .panel:nth-child(3) { grid-column: auto; }
  .login-brand { display: none; }
  .breadcrumb { display: none; }
}
@media (max-width: 768px) {
  .hamburger { display: inline-flex !important; }
  .sidebar {
    position: fixed; left: 0; top: 0; height: 100vh;
    width: var(--sidebar-w) !important; min-width: var(--sidebar-w) !important;
    transform: translateX(-100%); box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar .logo-text, .nav-group-label, .sf-who, .sf-card .icon-btn, .sf-version { display: flex !important; }
  .sidebar .logo-text, .sf-who { display: block !important; }
  .nav-item .nlabel { display: inline !important; }
  .nav-item { justify-content: flex-start !important; padding: 0 11px !important; }
  .sidebar .brand { justify-content: flex-start !important; padding: 0 var(--sp-4) !important; }
  .sf-card { justify-content: flex-start !important; padding: 10px !important; }
  .sidebar-backdrop.open { display: block; position: fixed; inset: 0; background: rgba(3,7,18,0.6); z-index: 39; animation: fade-in .2s both; }
  .topbar { padding: 0 var(--sp-3); gap: var(--sp-2); }
  .topbar-search { margin-left: 0; }
  .topbar-search .kbd, .sys-pill .sp-text, .user-chip .who, .user-chip .chev { display: none; }
  .main { padding: var(--sp-4) var(--sp-3) var(--sp-7); }
  .stat-grid { grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
  .stat-card .spark { display: none; }
  .stat-card.has-spark .svalue, .stat-card.has-spark .sc-foot { max-width: none; }
  .stat-card .svalue { font-size: 19px; }
  .grid-3, .form-grid, .form-grid.cols-3 { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .welcome { padding: 18px; }
  .welcome .clock-box { display: none; }
  .table-toolbar { padding: var(--sp-3); }
  .search-box { max-width: none; min-width: 0; flex: 1 1 100%; }
  .table-toolbar .tt-actions { margin-left: 0; }
  .banner-row, .dl-row { grid-template-columns: 1fr; }
  .banner-thumb { width: 100%; height: 90px; }
  .sticky-save { margin: 0 calc(-1 * var(--sp-3)) calc(-1 * var(--sp-7)); }
  .footer-bar { display: none; }
  .login-formside { padding: var(--sp-4); }
  .login-logo.mobile-only { display: flex; }
  .drawer, .drawer.wide { width: 100vw; }

  /* table → card list on phones */
  table.responsive thead { display: none; }
  table.responsive, table.responsive tbody, table.responsive tr, table.responsive td { display: block; width: 100%; }
  table.responsive tr { border: 1px solid var(--border); border-radius: 10px; margin: 10px; width: auto; padding: 6px 0; background: var(--card-2); }
  table.responsive td { height: auto; min-height: 34px; border: none; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 6px 14px; white-space: normal; text-align: right; }
  table.responsive td::before { content: attr(data-label); color: var(--muted); font-size: 11.5px; font-weight: 600; text-align: left; flex: 0 0 auto; }
  table.responsive td.col-actions { position: static; background: transparent; justify-content: flex-end; border-top: 1px solid var(--border); margin-top: 4px; padding-top: 8px; }
  table.responsive td.col-actions::before { content: none; }
  table.responsive td.wrap { max-width: none; min-width: 0; }
  table.responsive td[colspan] { justify-content: center; }
  table.responsive td[colspan]::before { content: none; }
  .table-scroll { max-height: none; }
}
@media (max-width: 480px) {
  .stat-grid, .cash-report-split { grid-template-columns: 1fr; }
  .page-head h2 { font-size: 18px; }
  .topbar-right .sys-pill { display: none; }
  .modal-foot { flex-wrap: wrap; }
  .modal-foot button { flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
.row-muted td { opacity: .62; }
.banner-thumb img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }

/* plain-text buttons: reset the default filled button look */
button.nav-group-label, button.back-link { background: transparent; border: 0; box-shadow: none; min-height: 0; transform: none; }
button.nav-group-label { width: 100%; font-family: inherit; }
button.nav-group-label:hover { background: rgba(255,255,255,.03); box-shadow: none; }
button.back-link { padding: 0; }
button.back-link:hover { background: transparent; box-shadow: none; }
.help-item.clickable { transition: border-color .15s, transform .15s; }
.help-item.clickable:hover { border-color: var(--accent); transform: translateY(-2px); }
a.nav-item, a.nav-item:hover, .nav-item a { text-decoration: none; }

/* dropdown / global search rows: reset global button look */
button.dd-item { width: 100%; min-height: 0; background: transparent; border: 1px solid transparent; box-shadow: none; transform: none; font: inherit; text-align: left; justify-content: flex-start; color: var(--text-2); padding: 7px 10px; margin: 1px 0; }
button.dd-item:hover, button.dd-item.hl { background: rgba(47,123,255,.12); border-color: rgba(47,123,255,.28); box-shadow: none; color: var(--text); }
button.dd-item:active { transform: none; }
.dd-item .dd-main { display: flex; flex-direction: column; gap: 2px; line-height: 1.3; }
.dd-item .dd-title { display: block; }
.dd-item .dd-sub { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dd-item.hl .dd-ic, .dd-item:hover .dd-ic { background: rgba(47,123,255,.2); color: #8db8ff; }
#search-results { padding: 6px; }
#search-results .dd-section { padding: 10px 10px 4px; }

/* ===== standard amount-adjust form ===== */
.mode-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
button.mode-card { display: flex; align-items: center; gap: 11px; min-height: 0; padding: 11px 12px; text-align: left; justify-content: flex-start; background: var(--card-2); border: 1.5px solid var(--border-2); border-radius: 11px; color: var(--text-2); box-shadow: none; font: inherit; transition: border-color .15s, background .15s; }
button.mode-card:hover { background: #142140; border-color: #34507f; box-shadow: none; color: var(--text); }
button.mode-card:active { transform: none; }
.mode-card .mc-ic { width: 34px; height: 34px; border-radius: 9px; display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,.05); flex: 0 0 auto; }
.mode-card .mc-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mode-card .mc-text b { font-size: 13.5px; color: var(--text); }
.mode-card .mc-text small { font-size: 11.5px; color: var(--muted); }
button.mode-card.active.tone-green { border-color: var(--green); background: var(--green-soft); }
button.mode-card.active.tone-green .mc-ic { background: var(--green); color: #fff; }
button.mode-card.active.tone-red { border-color: var(--red); background: var(--red-soft); }
button.mode-card.active.tone-red .mc-ic { background: var(--red); color: #fff; }
button.mode-card.active.tone-purple { border-color: var(--purple); background: var(--purple-soft); }
button.mode-card.active.tone-purple .mc-ic { background: var(--purple); color: #fff; }
button.mode-card.active.tone-blue { border-color: var(--accent); background: var(--accent-soft); }
button.mode-card.active.tone-blue .mc-ic { background: var(--accent); color: #fff; }

.amount-box { display: flex; align-items: center; gap: 8px; background: var(--input-bg, #0b1428); border: 1.5px solid var(--border-2); border-radius: 10px; padding: 0 6px 0 14px; transition: border-color .15s, box-shadow .15s; }
.amount-box:focus-within { border-color: var(--accent); box-shadow: var(--ring); }
.amount-box.tone-green:focus-within { border-color: var(--green); box-shadow: 0 0 0 3px rgba(34,197,94,.15); }
.amount-box.tone-red:focus-within { border-color: var(--red); box-shadow: 0 0 0 3px rgba(239,68,68,.15); }
.amount-box.invalid, .amount-box.invalid:focus-within { border-color: var(--red); }
.amount-box input.amount-input { flex: 1; min-width: 0; border: 0; background: transparent; box-shadow: none; padding: 0; min-height: 46px; font-size: 20px; font-weight: 700; font-family: "JetBrains Mono", monospace; letter-spacing: .02em; color: var(--text); }
.amount-box input.amount-input:focus { outline: none; box-shadow: none; background: transparent; }
.amount-unit { color: var(--muted); font-size: 12.5px; font-weight: 600; }
button.amount-max { min-height: 30px; padding: 0 10px; font-size: 12px; background: var(--accent-soft); color: #8db8ff; border: 1px solid rgba(47,123,255,.3); border-radius: 7px; box-shadow: none; }
button.amount-max:hover { background: rgba(47,123,255,.25); box-shadow: none; }
.amount-words { font-size: 12px; color: var(--muted); margin-top: 6px; min-height: 16px; }
.amount-words.bad { color: #ff9b9b; }
.amount-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
button.chip { min-height: 28px; padding: 0 11px; font-size: 12px; font-weight: 600; background: var(--card-2); color: var(--text-2); border: 1px solid var(--border-2); border-radius: 999px; box-shadow: none; }
button.chip:hover { background: #172647; color: var(--text); border-color: #31466f; box-shadow: none; }
button.chip.ghost { background: transparent; color: var(--muted); }

.adj-summary { border: 1px solid var(--border-2); border-radius: 10px; overflow: hidden; }
.as-row { display: grid; grid-template-columns: 1fr auto 18px auto minmax(90px, auto); align-items: center; gap: 10px; padding: 10px 14px; font-size: 13px; }
.as-row + .as-row { border-top: 1px solid var(--border); }
.as-label { color: var(--muted); }
.as-before { color: var(--text-2); font-family: "JetBrains Mono", monospace; }
.as-arrow { color: var(--muted); display: flex; }
.as-after { color: var(--text); font-weight: 700; font-family: "JetBrains Mono", monospace; }
.as-after.neg { color: var(--red); }
.as-diff { text-align: right; font-weight: 700; font-size: 12.5px; color: var(--muted); font-family: "JetBrains Mono", monospace; }
.as-diff.up { color: var(--green); }
.as-diff.down { color: var(--red); }
.reason-stack { display: flex; flex-direction: column; gap: 8px; }
@media (max-width: 520px) {
  .mode-cards { grid-template-columns: 1fr; }
  .as-row { grid-template-columns: 1fr auto; }
  .as-before, .as-arrow { display: none; }
  .as-diff { grid-column: 1 / -1; text-align: left; }
}
@media (max-width: 520px) { .modal-foot button { padding: 0 10px; font-size: 12.5px; white-space: nowrap; } }

/* dashboard: mini KPI rows inside panels */
.mini-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 10px; }
.mini-kpis .mk { background: var(--card-2); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mini-kpis .mk span { font-size: 11.5px; color: var(--muted); }
.mini-kpis .mk b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* user profile: phone link line */
.ph-phone { display: inline-flex; align-items: center; gap: 6px; padding: 2px 4px 2px 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--card-2); }
.ph-phone.muted { color: var(--muted); padding: 3px 10px; }
.ph-phone button.sm { height: 24px; }

/* play history: readable summary + card chips */
.play-sum { display: inline-flex; align-items: center; gap: 6px; flex-wrap: nowrap; }
.play-sum > * { flex-shrink: 0; white-space: nowrap; }
.kv dd .play-sum, .kv dd .cards-inline { flex-wrap: wrap; row-gap: 4px; }
.play-sum .sep { color: var(--muted); }
.cards-inline { display: inline-flex; gap: 3px; }
.card-chip { display: inline-block; min-width: 26px; padding: 1px 4px; border-radius: 5px; background: #eef2fb; color: #111827; font: 600 12px/1.4 var(--mono, ui-monospace, monospace); text-align: center; }
.card-chip.red { color: #dc2626; }

/* jackpot: per-bet-level pools */
.jackpot-card .jp-sub { font-size: 11.5px; margin: -6px 0 6px; }
.jackpot-card .jp-levels { display: grid; gap: 3px; margin-bottom: 12px; font-size: 12px; }
.jackpot-card .jp-lv { display: flex; justify-content: space-between; gap: 10px; padding: 3px 8px; border-radius: 6px; background: rgba(255,255,255,.035); }
.jackpot-card .jp-lv .num { color: var(--text); font-weight: 600; }
.jp-bump { animation: jpBump .6s ease; }
@keyframes jpBump { 0% { transform: scale(1); } 40% { transform: scale(1.06); color: #fde68a; } 100% { transform: scale(1); } }
.section-title{font-size:15px;font-weight:700;color:var(--text)}

.pw-result { display:grid; grid-template-columns:auto 1fr; gap:10px 16px; align-items:center; padding:14px 16px; margin-bottom:12px; border:1px solid var(--border); border-radius:12px; background:var(--surface-2, rgba(255,255,255,.03)); }
.pw-result .pw-val { font-size:14px; user-select:all; word-break:break-all; }
.pw-result .pw-val.big { font-size:20px; font-weight:700; letter-spacing:.06em; color:var(--accent); }

.dice-row { display:inline-flex; gap:3px; }
.dice-row .die { display:inline-flex; align-items:center; justify-content:center; width:20px; height:20px; border-radius:5px; background:#f8fafc; color:#111827; font:700 12px/1 var(--mono, ui-monospace, monospace); box-shadow:inset 0 -2px 0 rgba(0,0,0,.15); }
.coin-row { display:inline-flex; gap:3px; }
.coin-row .coin { width:13px; height:13px; border-radius:50%; border:1px solid rgba(0,0,0,.25); }
.coin-row .coin.red { background:#ef4444; }
.coin-row .coin.white { background:#f8fafc; }
.face-chip { display:inline-block; padding:1px 7px; border-radius:6px; background:var(--surface-2, rgba(255,255,255,.06)); border:1px solid var(--border); font-size:12px; font-weight:600; }
.ball { display:inline-block; width:13px; height:13px; border-radius:50%; box-shadow:inset 0 -2px 3px rgba(0,0,0,.3); }
.stars { color:#f59e0b; letter-spacing:1px; font-size:13px; }

/* chỉnh cầu / jackpot */
.cc-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: var(--sp-5); align-items: start; }
.cc-side {
  position: sticky; top: calc(var(--topbar-h) + 16px);
  background: var(--card-bg); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px;
}
.cc-side h4 { margin: 16px 0 8px; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.cc-kv { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 13px; color: var(--text-2); }
.cc-kv b { color: var(--text); font-weight: 700; }
.cc-kv.cc-jp b { color: var(--gold); font-size: 18px; }
.cc-cd { font-family: "JetBrains Mono", monospace; font-weight: 700; color: var(--text); }
.cc-cd.hot { color: #fb7185; }
.cc-players { display: grid; gap: 4px; max-height: 280px; overflow: auto; }
.cc-pl { display: flex; justify-content: space-between; gap: 8px; padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.cc-pl:hover { background: rgba(255,255,255,.04); }
.cc-pl-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-cols {
  display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; margin-bottom: var(--sp-4);
}
.cc-col {
  flex: 1 0 168px; min-width: 168px;
  background: var(--card-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px;
}
.cc-col.selected { border-color: #2f7bff; background: var(--accent-soft); }
.cc-col-name { text-align: center; font-weight: 800; font-size: 15px; }
.cc-col-total { text-align: center; color: var(--gold); font-size: 20px; font-weight: 700; margin: 4px 0; }
.cc-col-actions { display: flex; gap: 6px; justify-content: center; margin: 8px 0; }
.cc-col-bets { max-height: 280px; overflow: auto; border-top: 1px solid var(--border); }
.cc-betline { display: flex; justify-content: space-between; gap: 8px; padding: 6px 2px; font-size: 12.5px; border-bottom: 1px solid var(--border); cursor: pointer; }
.cc-betline:hover { background: rgba(255,255,255,.04); }
.cc-doors {
  display: grid;
  grid-template-columns: repeat(var(--cc-cols, 2), minmax(0, 1fr));
  gap: var(--sp-4);
  margin-bottom: var(--sp-5);
}
.cc-door {
  text-align: left; cursor: pointer;
  background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; box-shadow: 0 6px 18px rgba(0,0,0,.08);
  transition: transform .15s, border-color .15s, background .15s;
}
.cc-door:hover { transform: translateY(-2px); border-color: #2a3f6c; }
.cc-doors.pickable .cc-door { outline: 1px dashed rgba(47,123,255,.45); }
.cc-door.selected, .cc-door:focus-visible { background: var(--accent-soft); border-color: #2f7bff; }

.topup-bar {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--sp-3);
  margin: var(--sp-4) 0;
}
.topup-chip {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 140px;
}
.topup-chip.is-on { border-color: rgba(34, 197, 94, .45); }
.topup-chip.is-always { border-color: rgba(59, 130, 246, .35); }
.topup-chip.is-blocked { border-color: rgba(245, 158, 11, .45); }
.topup-chip-label { font-weight: 700; font-size: 14px; letter-spacing: .02em; }
.topup-chip-state { display: flex; }
.topup-chip-sw { display: flex; }
.topup-chip-hint { font-size: 12px; line-height: 1.45; }

.pay-summary { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); margin-bottom: var(--sp-4); }
.pay-summary > div { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.pay-summary-k { color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.pay-summary-v { font-weight: 650; line-height: 1.4; }
.pay-method-group { margin-top: 8px; }
.pay-method-group h3 { margin: 0 0 4px; font-size: 15px; }
.pay-method-hint { margin: 0 0 10px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.pay-method-row {
  display: grid; grid-template-columns: minmax(180px, 1.5fr) minmax(180px, 1fr) auto auto;
  gap: 14px; align-items: center;
  background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 8px;
}
.pay-method-row .pm-name { font-weight: 650; }
.pay-method-row .pm-code { color: var(--muted); font-size: 12px; margin-top: 2px; }
.pay-method-row .pm-limits { color: var(--text-2); font-size: 13px; line-height: 1.45; white-space: pre-line; }
.pay-method-row .pm-switches { display: flex; gap: 16px; align-items: center; }
.pay-method-row.off { opacity: .78; }
.pay-method-row.maint { border-color: #c47b12; }
@media (max-width: 860px) {
  .pay-summary, .pay-method-row { grid-template-columns: 1fr; }
}
.cc-door-ic { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; background: var(--card-2); color: #7fb0ff; margin-bottom: 10px; }
.cc-door-name { font-size: 18px; font-weight: 800; margin-bottom: 6px; }
.cc-door-bet { font-size: 22px; font-weight: 700; color: var(--gold); }
.cc-door-meta { margin-top: 6px; font-size: 12px; }
.cc-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: var(--sp-4); }
@media (max-width: 960px) {
  .cc-layout { grid-template-columns: 1fr; }
  .cc-side { position: static; }
  .cc-doors { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .cc-doors { grid-template-columns: 1fr; }
}

/* QA chỉnh cầu — layout ngang gọn (tham chiếu admin reference): kill + status + radio/Chọn */
.smon-qa-block.smon-ctrl {
  margin: 0;
  padding: 0;
  border: none;
}
.smon-ctrl-section { margin-top: 12px; }
.smon-ctrl-section-title {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 8px; font-size: 13px;
}
.smon-doors-block {
  margin-top: 14px; padding-top: 14px;
  border-top: 1px solid var(--border);
}
.smon-doors-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 10px; margin-bottom: 10px; flex-wrap: wrap;
}
.smon-doors-head b { font-size: 13px; font-weight: 700; }
.smon-doors-head .muted { font-size: 12px; }

.smon-ctrl-modes { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.smon-ctrl-mode-row { display: flex; flex-wrap: wrap; gap: 8px; }
.smon-mode-btn.is-on { outline: 2px solid var(--gold); outline-offset: 1px; font-weight: 800; }
.smon-fly-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
  margin: 0 0 10px; padding: 12px 14px;
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.08), rgba(249, 115, 22, 0.06));
  border: 1px solid rgba(251, 191, 36, 0.28); border-radius: 10px;
}
.smon-fly-bar.is-flying { border-color: rgba(249, 115, 22, 0.55); box-shadow: 0 0 0 1px rgba(249, 115, 22, 0.15) inset; }
.smon-fly-live { display: flex; flex-wrap: wrap; align-items: baseline; gap: 14px; }
.smon-fly-rate {
  font-size: 28px; font-weight: 800; color: var(--gold); letter-spacing: -0.02em; line-height: 1;
  font-variant-numeric: tabular-nums; min-width: 5.5ch;
}
.smon-fly-stars {
  font-size: 16px; font-weight: 700; color: #fbbf24; letter-spacing: 2px;
  font-variant-numeric: tabular-nums;
}
.smon-fly-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.smon-fly-stop, .smon-fly-jp { min-height: 34px !important; font-weight: 800 !important; }

.smon-ctrl-kill {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  margin-bottom: 10px;
}
.smon-ctrl-kill-btn {
  min-width: 168px; font-weight: 700; letter-spacing: .02em;
  background: #38bdf8 !important; color: #0b1220 !important; border: none !important;
}
.smon-ctrl-kill-btn.is-kill-on,
.smon-ctrl-kill-btn.danger {
  background: #ef4444 !important; color: #fff !important;
}
.smon-ctrl-kill-hint { font-size: 12px; text-align: center; }
.smon-ctrl-kill-hint.is-on { color: #f87171; font-weight: 600; }

.smon-ctrl-status {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 10px;
  background: var(--card-2);
}
.smon-ctrl-status.has-room-jp { grid-template-columns: 1fr 1.15fr .55fr 1.9fr; }
.smon-ctrl-cell-mode {
  flex-direction: column !important; align-items: flex-end !important; justify-content: center !important;
  gap: 4px !important; padding: 6px 10px !important;
}
.smon-ctrl-jp-amt {
  font-size: 13px; font-weight: 800; color: var(--gold);
  font-family: "JetBrains Mono", monospace; font-variant-numeric: tabular-nums;
  line-height: 1.2; white-space: nowrap;
}
.smon-ctrl-room-jp {
  min-height: 30px !important; padding: 0 14px !important;
  font-size: 12.5px !important; font-weight: 800 !important; white-space: nowrap;
  background: #f97316 !important; color: #fff !important; border: none !important;
  border-radius: 8px !important; box-shadow: none !important;
}
.smon-ctrl-status > .smon-ctrl-cell {
  display: flex; align-items: center; justify-content: center;
  gap: 8px; padding: 10px 8px; min-height: 44px;
  border-right: 1px solid var(--border);
  text-align: center;
}
.smon-ctrl-status > .smon-ctrl-cell:last-child { border-right: none; }
.smon-ctrl-status .status-pill { margin: 0; }
.smon-ctrl-cd { font-size: 18px; color: var(--gold); font-weight: 800; }
.smon-ctrl-mode { font-size: 13px; font-weight: 800; letter-spacing: .04em; color: var(--text); }
.smon-ctrl-mode.is-forced { color: #38bdf8; }
.smon-ctrl-mode.is-kill { color: #f87171; }

.smon-ctrl-doors { margin: 0; }
.smon-ctrl-doors:empty { display: none; }
.smon-ctrl-empty { padding: 12px; text-align: center; font-size: 13px; }
.smon-ctrl-grid {
  display: grid;
  grid-template-columns: repeat(var(--ctrl-cols, 4), minmax(0, 1fr));
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--card-2);
}
.smon-ctrl-cell-door {
  --qa-accent: #38bdf8;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  gap: 5px; padding: 10px 8px;
  border-right: 1px solid var(--border);
  min-width: 0;
}
.smon-ctrl-cell-door:last-child { border-right: none; }
.smon-ctrl-cell-door.is-selected { background: color-mix(in srgb, var(--qa-accent) 14%, transparent); }
.smon-ctrl-cell-door.tone-red { --qa-accent: #f87171; }
.smon-ctrl-cell-door.tone-blue { --qa-accent: #60a5fa; }
.smon-ctrl-cell-door.tone-violet { --qa-accent: #a78bfa; }
.smon-ctrl-cell-door.tone-amber { --qa-accent: #fbbf24; }
.smon-ctrl-cell-door.tone-green { --qa-accent: #4ade80; }
.smon-ctrl-cell-door.tone-orange { --qa-accent: #fb923c; }
.smon-ctrl-cell-door.tone-cyan { --qa-accent: #22d3ee; }
.smon-ctrl-cell-door.tone-rose { --qa-accent: #fb7185; }
.smon-ctrl-cell-door.tone-teal { --qa-accent: #2dd4bf; }
.smon-ctrl-cell-door.is-random { --qa-accent: #94a3b8; }
.smon-ctrl-door-name {
  font-size: 12.5px; font-weight: 800; letter-spacing: .04em;
  text-align: center; line-height: 1.2; color: var(--text);
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.smon-ctrl-door-odds { font-size: 11px; text-align: center; line-height: 1.2; }
.smon-ctrl-coins { display: flex; gap: 3px; justify-content: center; min-height: 12px; }
.smon-ctrl-coin {
  width: 10px; height: 10px; border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.35);
}
.smon-ctrl-coin.is-red { background: radial-gradient(circle at 30% 30%, #fca5a5, #dc2626 70%); }
.smon-ctrl-coin.is-white { background: radial-gradient(circle at 30% 30%, #fff, #cbd5e1 75%); }

/* Radio là span (không dùng <button>) — tránh min-height nút global kéo thành oval. */
.smon-ctrl-radio {
  display: inline-block;
  box-sizing: border-box;
  width: 16px !important; height: 16px !important;
  min-width: 16px !important; min-height: 16px !important;
  max-width: 16px !important; max-height: 16px !important;
  border-radius: 50% !important;
  border: 2px solid #64748b !important;
  background: transparent !important;
  padding: 0 !important; margin: 2px 0 !important;
  flex: 0 0 16px !important;
  cursor: pointer;
  box-shadow: none !important;
  line-height: 0 !important;
}
.smon-ctrl-radio.is-on {
  border-color: var(--qa-accent, #38bdf8) !important;
  background: radial-gradient(circle at center, var(--qa-accent, #38bdf8) 0 38%, transparent 42%) !important;
}
.smon-ctrl-pick {
  width: auto; min-width: 72px; max-width: 100%; justify-content: center;
  min-height: 28px !important; padding: 3px 12px !important;
  font-size: 12px !important; font-weight: 700 !important;
  border: none !important; border-radius: 6px !important;
  background: #38bdf8 !important; color: #0b1220 !important;
}
.smon-ctrl-jp {
  width: auto; min-width: 72px; max-width: 100%; justify-content: center;
  min-height: 24px !important; padding: 2px 8px !important; font-size: 11px !important;
}
.smon-dice-set {
  margin-top: 10px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--card-2);
}
.smon-dice-set-title {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-bottom: 8px; font-size: 13px;
}
.smon-dice-set-title-left {
  display: flex; align-items: center; gap: 6px; cursor: pointer; user-select: none; min-width: 0;
}
.smon-dice-set-toggle {
  flex: 0 0 auto; width: 26px; height: 26px; min-height: 26px !important; padding: 0 !important;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 6px !important; border: 1px solid var(--border) !important;
  background: transparent !important; color: var(--text) !important;
  box-shadow: none !important; cursor: pointer;
}
.smon-dice-set-toggle:hover { border-color: #38bdf8 !important; background: rgba(56, 189, 248, 0.1) !important; }
.smon-dice-set-chevron {
  width: 0; height: 0;
  border-left: 5px solid transparent; border-right: 5px solid transparent;
  border-top: 6px solid currentColor;
  transition: transform .15s ease;
}
.smon-dice-set.is-collapsed .smon-dice-set-chevron { transform: rotate(-90deg); }
.smon-dice-set.is-collapsed .smon-dice-set-title { margin-bottom: 0; }
.smon-dice-set.is-collapsed .smon-dice-set-body { display: none; }
.smon-dice-set-row { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; flex-wrap: wrap; }
.smon-dice-set-lab { width: 42px; font-size: 12px; color: var(--muted); }
.smon-die-pick {
  width: 32px; height: 32px; min-height: 32px !important; padding: 0 !important;
  border-radius: 8px !important; border: 1px solid var(--border) !important;
  background: transparent !important; color: var(--text) !important;
  font-weight: 800; box-shadow: none !important;
}
.smon-die-pick.is-on { background: #38bdf8 !important; color: #0b1220 !important; border-color: #38bdf8 !important; }
.smon-die-pick-wide { width: auto !important; min-width: 44px; padding: 0 8px !important; font-size: 11px !important; }
.smon-die-pick.is-zero.is-on { background: #22c55e !important; border-color: #22c55e !important; }
.smon-roulette-pick {
  display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 4px; margin: 6px 0 8px;
}
.smon-roulette-pick .smon-die-pick { width: 100% !important; }
.smon-dice-set-go { margin-top: 8px; width: 100%; }
.smon-dice-set-compact { padding: 10px; }
.smon-dice3 {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 4px 0 2px;
}
.smon-dice3-col { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.smon-dice3-lab { font-size: 11px; text-align: center; }
.smon-dice3-faces {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3px;
}
.smon-die-pick-sm {
  width: 100% !important; height: 28px !important; min-height: 28px !important;
  border-radius: 6px !important; font-size: 12px !important;
}
.smon-dice-list-head { font-size: 11px; margin: 10px 0 6px; }
.smon-dice-list {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px;
  max-height: 220px; overflow: auto; padding-right: 2px;
}
@media (min-width: 720px) {
  .smon-dice-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.smon-dice-list-item {
  display: flex; align-items: center; gap: 6px;
  width: 100%; min-height: 32px; padding: 4px 8px;
  border: 1px solid var(--border); border-radius: 6px;
  background: var(--card); color: var(--text);
  cursor: pointer; text-align: left; font-size: 12px;
}
.smon-dice-list-item:hover { border-color: #38bdf8; background: rgba(56, 189, 248, 0.08); }
.smon-dice-list-faces { font-weight: 800; letter-spacing: 0.02em; min-width: 3.2em; }
.smon-dice-list-sum { font-size: 11px; }
.smon-dice-list-tag { margin-left: auto; font-size: 11px; font-weight: 700; }
.smon-dice-list-item.tone-tai .smon-dice-list-tag { color: #f87171; }
.smon-dice-list-item.tone-xiu .smon-dice-list-tag { color: #60a5fa; }
.smon-dice-list-item.tone-bao .smon-dice-list-tag { color: #fbbf24; }
.smon-toad-set { border-color: rgba(251, 191, 36, 0.45); }
.smon-toad-row { gap: 8px; margin-top: 6px; }
.smon-toad-btn.is-on { outline: 2px solid var(--gold); outline-offset: 1px; font-weight: 800; }
.smon-bc-set { border-color: rgba(56, 189, 248, 0.4); }
.smon-dice-set-lab.is-need { color: #fbbf24; font-weight: 700; }
.smon-bc-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; align-items: center; }

.smon-ctrl-rand-note {
  font-size: 12px; min-height: 28px; display: flex; align-items: center; justify-content: center;
  color: var(--muted);
}

.smon-qa-flags {
  display: flex; gap: 6px; flex-wrap: wrap; justify-content: center;
  margin-top: 8px;
}
.smon-qa-flags:empty { display: none; margin: 0; }
.smon-qa-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 10px; }
.smon-qa-actions:empty { display: none; margin: 0; }
.smon-force-banner:empty { display: none; }
.smon-force-card {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 10px 0 4px; padding: 8px 12px;
  background: linear-gradient(180deg, rgba(251,191,36,.1), var(--card-2));
  border: 1px solid rgba(251,191,36,.35); border-radius: var(--radius-sm);
}

@media (max-width: 900px) {
  .smon-ctrl-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .smon-ctrl-cell-door:nth-child(4n) { border-right: none; }
  .smon-ctrl-cell-door { border-bottom: 1px solid var(--border); }
}
@media (max-width: 560px) {
  .smon-ctrl-status { grid-template-columns: 1fr 1fr; }
  .smon-ctrl-status > .smon-ctrl-cell:nth-child(2n) { border-right: none; }
  .smon-ctrl-status > .smon-ctrl-cell { border-bottom: 1px solid var(--border); }
  .smon-ctrl-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .smon-ctrl-cell-door:nth-child(2n) { border-right: none; }
}

/* "Giám sát phiên" (owner 2026-10-10, read-only session monitor) - new block, only .smon-* selectors,
   reuses existing theme tokens (--card-bg/--card-2/--border/--text/--muted/--accent/--sp-*/--radius*).
   Does not touch any selector above. */
.smon-search { max-width: 280px; }
.smon-trunc-note { padding: 10px var(--sp-5) 0; font-size: 12px; }

/* Kích thưởng mới (queue slot) */
.smon-reward-form select { width: 100%; }
.smon-kind-label { display: flex; align-items: baseline; gap: 6px; margin-bottom: 6px; font-size: 13px; font-weight: 600; }
.smon-kind-game { color: var(--accent, #3b82f6); font-weight: 600; }
.smon-hu-now {
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.28);
  border-radius: var(--radius-sm, 8px);
  padding: 10px 12px;
}
.smon-hu-now-label { font-size: 12px; color: var(--muted, #94a3b8); margin-bottom: 4px; }
.smon-hu-now-val { font-size: 14px; font-weight: 700; font-family: "JetBrains Mono", monospace; color: var(--text); }

.smon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: var(--sp-4); margin-bottom: var(--sp-5); }
.smon-gcard { cursor: pointer; background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--sp-4) var(--sp-5); transition: transform .2s var(--ease), border-color .2s; }
.smon-gcard:hover { transform: translateY(-2px); border-color: #2a3f6c; }
.smon-gcard.is-error { cursor: default; border-color: rgba(239,68,68,.3); }
.smon-gcard-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.smon-gcard-head b { font-size: 14px; font-weight: 700; }
.smon-gcard-row { font-size: 12.5px; margin-bottom: 6px; display: flex; align-items: center; gap: 4px; }
.smon-gcard-err { font-size: 12px; line-height: 1.5; }
.smon-gcard-stats { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--text-2); margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
.smon-gcard-stats b { color: var(--text); font-family: "JetBrains Mono", monospace; }

.smon-countdown { font-weight: 700; color: var(--text); }
.smon-countdown-lg { font-size: 20px; color: var(--gold); }

.smon-detail-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); flex-wrap: wrap; margin-bottom: var(--sp-3); }
.smon-detail-round { display: flex; align-items: center; gap: 10px; font-size: 15px; }
.smon-detail-round b { font-family: "JetBrains Mono", monospace; }
.smon-detail-cd { font-size: 13px; }
.smon-tablesel { margin-bottom: var(--sp-3); }
.smon-tablesel:empty { display: none; margin: 0; }

.smon-stats { display: flex; gap: var(--sp-3); flex-wrap: wrap; margin-top: 8px; }
.smon-stats:empty { display: none; margin: 0; }
.smon-stat { flex: 0 1 160px; background: var(--card-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 12px; }
.smon-stat span { display: block; font-size: 11.5px; margin-bottom: 3px; }
/* Value font follows the same rule as the rest of the admin (.lc-bal/.gc-stats/.as-after): mono +
   tabular digits for an actual number, the card's own Be Vietnam Pro for a sentence (resultText,
   "x2.35"...) - a sentence in JetBrains Mono reads cramped and misaligned. */
.smon-stat b { font-size: 15px; color: var(--text); font-weight: 700; line-height: 1.3; word-break: break-word; }
.smon-stat b.mono { font-family: "JetBrains Mono", monospace; font-variant-numeric: tabular-nums; letter-spacing: .01em; }
/* "Hũ" fact only: gold value + a small flat coin mark (pure CSS, no image) next to the label. */
.smon-stat.is-jackpot { border-color: rgba(251,191,36,.3); background: linear-gradient(180deg, rgba(251,191,36,.09), var(--card-2) 65%); }
.smon-stat.is-jackpot b { color: var(--gold); }
.smon-stat-label { display: flex; align-items: center; gap: 5px; }
.smon-stat.is-jackpot .smon-stat-label::before {
  content: ""; display: inline-block; flex: 0 0 auto; width: 10px; height: 10px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fef3c7, var(--gold) 70%);
  box-shadow: inset 0 0 0 1px rgba(120,53,15,.55);
}

/* Banner "Kết quả phiên #id" (owner relay 2026-10-10/11) - giữa hàng thống kê và panel "Cược theo
   cửa". Nguồn snap.result (đang sống); không có thì dùng dòng lịch sử mới nhất có .result, hiện mờ
   dạng "Phiên gần nhất #id" và KHÔNG chạy hiệu ứng is-new. Mọi phần con dùng CSS/SVG thuần, không
   ảnh raster, không data: URI - card art thật của client không được dùng ở trang admin này. */
.smon-result-wrap { margin: 10px 0 0; }
.smon-result-wrap:empty { display: none; margin: 0; }
.smon-result {
  display: flex; flex-direction: column; gap: 10px; background: var(--card-2);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px;
}
.smon-result.is-row {
  flex-direction: row; align-items: center; flex-wrap: wrap;
  gap: 10px 16px; padding: 10px 14px;
}
.smon-result.is-row .smon-result-head,
.smon-result.is-row .smon-result-body,
.smon-result.is-row .smon-result-tags {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0;
}
.smon-result.is-row .smon-result-title { font-size: 13px; white-space: nowrap; }
.smon-result-text { display: none; } /* dòng chữ trùng body đã ẩn */
.smon-result.is-fallback { opacity: .72; border-style: dashed; }
.smon-result-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.smon-result-title { font-size: 14px; font-weight: 700; }
.smon-jackpot-badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 11px; border-radius: 999px;
  background: var(--gold); color: #1a1300; font-size: 11px; font-weight: 800; letter-spacing: .3px;
}
.smon-result-body { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.smon-result-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.smon-result-text { font-size: 12.5px; line-height: 1.5; }

.smon-result.is-new { animation: smon-result-pop 1.2s var(--ease); }
@keyframes smon-result-pop {
  0% { transform: scale(.97); box-shadow: 0 0 0 0 rgba(251,191,36,.6); }
  30% { transform: scale(1.015); box-shadow: 0 0 22px 4px rgba(251,191,36,.45); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(251,191,36,0); }
}
@media (prefers-reduced-motion: reduce) {
  .smon-result.is-new { animation: none; box-shadow: 0 0 0 2px var(--gold); }
}

/* dice / diceWar */
.smon-dice-row { display: flex; align-items: center; gap: 6px; }
.smon-die { width: 26px; height: 26px; flex: 0 0 auto; color: var(--text); background: var(--card-bg); border: 1px solid var(--border-2); border-radius: 6px; padding: 2px; }
.smon-die svg { display: block; width: 100%; height: 100%; }
.smon-die-sm { width: 20px; height: 20px; }
.smon-dice-total { margin-left: 4px; font-weight: 700; color: var(--gold); }
.smon-diceWar-groups { display: flex; align-items: flex-start; gap: 20px; flex-wrap: wrap; }
.smon-diceWar-group { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.smon-diceWar-label { font-size: 11px; }

/* coins (Bầu Cua kiểu xúc xắc / xèng đỏ-trắng) */
.smon-coins-row { display: flex; gap: 5px; }
.smon-coin { width: 17px; height: 17px; border-radius: 50%; border: 1px solid rgba(0,0,0,.25); }
.smon-coin.is-red { background: radial-gradient(circle at 35% 30%, #ff8a8a, var(--red) 70%); }
.smon-coin.is-white { background: radial-gradient(circle at 35% 30%, #ffffff, #d8dee8 75%); }

/* animals (Bầu Cua: chữ + badge màu, không dùng art client - chưa xác minh bảng index) */
.smon-animals-row { display: flex; gap: 6px; flex-wrap: wrap; }
.smon-animal-badge { padding: 4px 11px; border-radius: 8px; background: var(--card-bg); border: 1px solid var(--border-2); font-size: 12.5px; font-weight: 700; }

/* cards (bài: rank + suit CSS, hoặc badge điểm khi cards rỗng) */
.smon-hands { display: flex; gap: 16px; flex-wrap: wrap; }
.smon-hand { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.smon-hand-label { font-size: 11px; }
.smon-hand-cards { display: flex; gap: 3px; }
.smon-card {
  width: 30px; height: 42px; border-radius: 5px; background: #fff; color: #161616;
  border: 1px solid var(--border-2); display: flex; flex-direction: column; align-items: center;
  justify-content: center; font-weight: 800; font-size: 13px; line-height: 1.1;
}
.smon-card.is-red { color: #d81e2c; }
.smon-score-badge { font-weight: 700; font-size: 16px; color: var(--text); background: var(--card-bg); border: 1px solid var(--border-2); border-radius: 8px; padding: 5px 12px; }

/* roulette */
.smon-roulette-ball {
  width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-weight: 800; color: #fff; font-size: 15px; border: 1px solid rgba(0,0,0,.3);
}
.smon-roulette-ball.is-red { background: var(--red); }
.smon-roulette-ball.is-black { background: #181818; }
.smon-roulette-ball.is-green { background: var(--green); }

/* balls (Keno) */
.smon-balls-row { display: flex; gap: 5px; flex-wrap: wrap; }
.smon-ball {
  width: 26px; height: 26px; border-radius: 50%; background: var(--cyan-soft); color: var(--cyan);
  display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 800;
  border: 1px solid rgba(6,182,212,.3);
}

/* xeng */
.smon-xeng-chip { display: inline-flex; align-items: center; gap: 9px; padding: 6px 13px; border-radius: 10px; background: var(--gold-soft); border: 1px solid rgba(251,191,36,.3); }
.smon-xeng-name { font-weight: 700; }
.smon-xeng-point { color: var(--gold); font-weight: 700; }

/* versus (đá gà, v.v.) */
.smon-versus { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.smon-vside { padding: 6px 14px; border-radius: 8px; background: var(--card-bg); border: 1px solid var(--border-2); font-weight: 700; }
.smon-vside.is-winner { border-color: var(--gold); color: var(--gold); background: var(--gold-soft); }
.smon-vmid { font-size: 12px; }
.smon-vscore { font-size: 12px; }

/* crash */
.smon-crash-value { font-size: 26px; font-weight: 800; color: var(--gold); font-family: "JetBrains Mono", monospace; }

/* wheel */
.smon-wheel-chip { display: inline-flex; padding: 6px 14px; border-radius: 999px; background: var(--purple-soft); color: #b39bff; border: 1px solid rgba(139,92,246,.3); font-weight: 700; }

/* lottery (Lô đề): hàng giải, Đặc biệt nổi bật, 2 số cuối tô đậm */
.smon-prizes { display: flex; flex-direction: column; gap: 3px; width: 100%; }
.smon-prize-row { display: flex; justify-content: space-between; gap: 12px; font-size: 12.5px; padding: 3px 0; border-bottom: 1px solid var(--border); }
.smon-prize-row:last-child { border-bottom: none; }
.smon-prize-row.is-special { font-weight: 800; color: var(--gold); }
.smon-prize-value { white-space: nowrap; }
.smon-prize-last2 { text-decoration: underline; font-weight: 800; }

/* Icon nhỏ trong hạt chuỗi lịch sử (bổ sung .smon-bead, không thay .smon-bead gốc). */
.smon-bico { font-size: 11px; line-height: 1; }
.smon-bico-coin-red { color: var(--red); }
.smon-bico-coin-white { color: var(--text-2); }
.smon-bico-dot {
  display: inline-flex; align-items: center; justify-content: center; width: 15px; height: 15px;
  border-radius: 50%; font-size: 9px; font-weight: 800; color: #fff; line-height: 1;
}
.smon-bico-dot.is-red { background: var(--red); }
.smon-bico-dot.is-black { background: #181818; }
.smon-bico-dot.is-green { background: var(--green); }

.smon-doors-grid { display: grid; grid-template-columns: repeat(var(--door-cols, 2), minmax(0, 1fr)); gap: 8px; margin-bottom: var(--sp-3); align-items: stretch; }
.smon-door { display: flex; flex-direction: column; background: var(--card-2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; min-width: 0; }
.smon-door-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 2px; }
.smon-door-head b { font-size: 13px; font-weight: 700; display: inline-flex; align-items: center; gap: 6px; }
.smon-door-total { color: var(--gold); font-size: 14px; font-weight: 700; }
.smon-door-sub { font-size: 11px; margin-bottom: 6px; }
.smon-door-bets { flex: 1; display: flex; flex-direction: column; gap: 4px; max-height: 220px; overflow: auto; border-top: 1px solid var(--border); padding-top: 6px; }
.smon-door-empty { font-size: 12px; padding: 4px 0; }
/* Cửa thắng của phiên vừa trả kết quả: nhấp nháy viền vàng tới khi sang phiên mới. */
.smon-win-tag { margin-left: 8px; padding: 1px 7px; border-radius: 999px; background: var(--gold); color: #1a1300; font-size: 10.5px; font-weight: 800; letter-spacing: .4px; vertical-align: 1px; }
.smon-door.is-win { border-color: var(--gold); animation: smon-win-blink 1s ease-in-out infinite; }
@keyframes smon-win-blink {
  0%, 100% { box-shadow: 0 0 0 1px var(--gold), 0 0 14px rgba(251,191,36,.45); background: rgba(251,191,36,.10); }
  50% { box-shadow: 0 0 0 1px transparent, 0 0 0 transparent; background: var(--card-2); }
}
@media (prefers-reduced-motion: reduce) {
  .smon-door.is-win { animation: none; box-shadow: 0 0 0 2px var(--gold); }
}
.smon-bet-row { display: flex; align-items: center; gap: 8px; font-size: 12px; padding: 4px 0; border-bottom: 1px solid var(--border); }
.smon-bet-row:last-child { border-bottom: none; }
.smon-bet-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.smon-bet-amt { color: var(--text); white-space: nowrap; }
.smon-bet-detail { flex: 0 0 auto; font-size: 11px; }
.smon-doors-toggle { display: inline-flex; }

/* Chuỗi kết quả gần đây trong khung phiên: hạt mới nhất bên trái, rê chuột xem phiên (data-tip). */
.smon-chain-wrap { display: flex; align-items: center; gap: 10px; margin-top: var(--sp-3); padding-top: var(--sp-3); border-top: 1px solid var(--border); min-width: 0; }
.smon-chain-label { flex: 0 0 auto; font-size: 11.5px; white-space: nowrap; }
.smon-chain { display: flex; gap: 6px; overflow-x: auto; padding: 4px 2px 6px; min-width: 0; scrollbar-width: thin; }
.smon-bead { display: inline-flex; align-items: center; gap: 4px; flex: 0 0 auto; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--border-2); background: rgba(255,255,255,.05); color: var(--text-2); font-size: 12px; font-weight: 600; line-height: 1.4; cursor: default; transition: transform .12s ease; }
.smon-bead:hover, .smon-bead:focus-visible { transform: translateY(-1px); outline: none; border-color: var(--gold); }
.smon-bead-ok { background: var(--green-soft); color: var(--green); border-color: rgba(34,197,94,.22); }
.smon-bead-bad { background: var(--red-soft); color: #ff7373; border-color: rgba(239,68,68,.22); }
.smon-bead-warn { background: var(--orange-soft); color: var(--orange); border-color: rgba(245,158,11,.22); }
.smon-bead-info { background: var(--cyan-soft); color: var(--cyan); border-color: rgba(6,182,212,.22); }
.smon-bead.is-latest { box-shadow: 0 0 0 2px var(--gold); font-weight: 800; }
.smon-bead.is-jp::after { content: " ★"; color: var(--gold); }

@media (max-width: 960px) {
  .smon-doors-grid { grid-template-columns: repeat(var(--door-cols-md, 2), minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .smon-grid { grid-template-columns: 1fr; }
  .smon-doors-grid { grid-template-columns: 1fr; }
  .smon-detail-head { flex-direction: column; align-items: flex-start; }
  .smon-chain-wrap { flex-direction: column; align-items: stretch; gap: 4px; }
  .smon-bead { cursor: pointer; }
}

/* Giám sát phiên Live: khung video bàn (session-monitor-video.js), 2 cột cạnh thẻ phiên, màn hẹp xếp dọc. */
.smon-top.has-video { display: grid; grid-template-columns: minmax(0, 1fr) minmax(340px, 44%); gap: var(--sp-5); align-items: start; }
.smon-video { position: relative; aspect-ratio: 16 / 9; background: #000; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.smon-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.smon-video-msg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 12px; font-size: 13px; text-align: center; }
.smon-video-hint { margin-top: 8px; font-size: 12px; }
.smon-video-hint:empty { display: none; }
.smon-video-actions { display: flex; gap: 8px; }
@media (max-width: 1180px) {
  .smon-top.has-video { grid-template-columns: minmax(0, 1fr); }
}
