/* ---------- scrollbars ---------- */
* { scrollbar-width: thin; scrollbar-color: #1a1b1e transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: #1a1b1e; border-radius: 6px; border: 2px solid #2b2d31; }
*::-webkit-scrollbar-track { background: transparent; }

/* ---------- virtual list ---------- */
.vl-viewport { position: relative; overflow-y: auto; overflow-x: hidden; }
.vl-spacer { width: 1px; }
.vl-window { position: absolute; top: 0; left: 0; right: 0; will-change: transform; }
.vl-row { position: relative; user-select: none; }

/* ---------- selection ---------- */
.row-sel { background: rgba(88, 101, 242, 0.18); }
.row-sel:hover { background: rgba(88, 101, 242, 0.26); }
.rubber-band {
  position: fixed; z-index: 60; pointer-events: none;
  background: rgba(88, 101, 242, 0.15);
  border: 1px solid rgba(88, 101, 242, 0.8);
}
.drag-ghost {
  position: fixed; z-index: 70; pointer-events: none;
  background: #5865F2; color: #fff; font-size: 12px; font-weight: 600;
  padding: 4px 10px; border-radius: 999px; box-shadow: 0 4px 14px rgba(0,0,0,.5);
  transform: translate(-50%, -140%);
}
.drop-hover { outline: 2px solid #5865F2; outline-offset: -2px; border-radius: 6px; }

/* ---------- toggle switch ---------- */
.nh-toggle { position: relative; width: 38px; height: 20px; border-radius: 999px; background: #4e5058; transition: background .15s; cursor: pointer; flex: none; }
.nh-toggle::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; transition: transform .15s;
}
.nh-toggle.on { background: #23a55a; }
.nh-toggle.on::after { transform: translateX(18px); }

/* ---------- stat bars ---------- */
.statbar { height: 6px; border-radius: 999px; background: #1e1f22; overflow: hidden; }
.statbar > div { height: 100%; border-radius: 999px; transition: width .8s ease, background .8s ease; }
.corebar { height: 100%; border-radius: 2px; background: #1e1f22; overflow: hidden; display: flex; flex-direction: column-reverse; }
.corebar > div { width: 100%; transition: height .8s ease; }

/* ---------- misc ---------- */
.fade-in { animation: fadeIn .18s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.menu-pop { box-shadow: 0 8px 24px rgba(0,0,0,.5); }
.card { background: #2b2d31; border: 1px solid #3f4147; border-radius: 10px; }
.btn { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500;
  padding: 6px 12px; border-radius: 6px; background: #383a40; color: #dbdee1; cursor: pointer;
  border: 1px solid transparent; transition: background .12s; white-space: nowrap; }
.btn:hover { background: #41434a; }
.btn-primary { background: #5865F2; color: #fff; }
.btn-primary:hover { background: #4752C4; }
.btn-danger { background: transparent; color: #f23f43; border-color: rgba(242,63,67,.4); }
.btn-danger:hover { background: rgba(242,63,67,.12); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.input { background: #1e1f22; border: 1px solid #3f4147; border-radius: 6px; color: #dbdee1;
  font-size: 13px; padding: 6px 10px; outline: none; }
.input:focus { border-color: #5865F2; }
select.input { appearance: none; }
.badge { font-size: 11px; padding: 1px 7px; border-radius: 999px; background: #383a40; color: #949ba4; white-space: nowrap; }
.badge-config { background: rgba(88,101,242,.18); color: #aeb4ff; }
.mono { font-family: 'JetBrains Mono', Consolas, Menlo, monospace; }

/* lua-ish textarea */
.lua-edit { background: #1e1f22; border: 1px solid #3f4147; border-radius: 8px; color: #cde0ff;
  font-family: 'JetBrains Mono', Consolas, monospace; font-size: 12.5px; line-height: 1.55;
  padding: 10px 12px; width: 100%; outline: none; resize: vertical; tab-size: 2; }
.lua-edit:focus { border-color: #5865F2; }

/* toast */
#toast-wrap { position: fixed; bottom: 20px; right: 20px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #313338; border: 1px solid #3f4147; border-left: 3px solid #5865F2; color: #dbdee1;
  font-size: 13px; padding: 10px 14px; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.5);
  animation: fadeIn .18s ease; max-width: 340px; }

/* modal */
.modal-back { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 80;
  display: flex; align-items: center; justify-content: center; animation: fadeIn .15s ease; }
.modal-box { background: #2b2d31; border: 1px solid #3f4147; border-radius: 12px;
  box-shadow: 0 16px 48px rgba(0,0,0,.6); max-width: 92vw; max-height: 88vh; display: flex; flex-direction: column; }

/* drawer */
.drawer { position: absolute; top: 0; right: 0; bottom: 0; width: 320px; z-index: 40;
  background: #2b2d31; border-left: 1px solid #3f4147; box-shadow: -8px 0 24px rgba(0,0,0,.4);
  animation: slideIn .16s ease; display: flex; flex-direction: column; }
@keyframes slideIn { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }

.tree-row:hover .tree-actions { opacity: 1; }
.tree-actions { opacity: 0; }
.account-row:hover .row-more { opacity: 1; }
.row-more { opacity: 0; }

/* ---------- details-based dropdowns (server-rendered menus) ---------- */
.dd > summary { list-style: none; }
.dd > summary::-webkit-details-marker { display: none; }
.dd-body { display: none; position: absolute; z-index: 60; left: 0; top: calc(100% + 4px);
  min-width: 100%; width: max-content; max-width: 340px; max-height: 320px; overflow-y: auto;
  background: #313338; border: 1px solid #3f4147; border-radius: 8px; padding: 4px 0;
  box-shadow: 0 8px 24px rgba(0,0,0,.5); }
.dd[open] > .dd-body { display: block; }
.dd-body > button { display: flex; align-items: center; width: 100%; text-align: left;
  padding: 6px 12px; font-size: 13px; color: #dbdee1; white-space: nowrap; }
.dd-body > button:hover { background: #383a40; }
.dd.is-disabled > summary { opacity: .45; pointer-events: none; }

/* ---------- selectable account rows ---------- */
.acct-row.sel { background: rgba(88,101,242,0.18); }
.acct-row.sel:hover { background: rgba(88,101,242,0.26); }
.acct-row.sel { cursor: grab; }
.acct-row.sel .row-check { background: #5865F2; border-color: #5865F2; }
