* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

:root {
  --bg: #eef1f6;
  --bg-2: #ffffff;
  --panel: #ffffff;
  --panel-2: #f7f9fc;
  --panel-3: #f0f3f8;
  --text: #0f1b2d;
  --muted: #586a82;
  --muted-2: #94a1b5;
  --line: #e3e8f0;
  --line-2: #eef2f7;
  --line-strong: #d5dce7;
  --accent: #2f7ef5;
  --accent-strong: #1f6ae6;
  --accent-bg: #eaf2ff;
  --accent-soft: #dfeaff;
  --active-bg: #eaf2ff;
  --active-fg: #1f6ae6;
  --brand: linear-gradient(135deg, #ff7a52, #f0392b);
  --grad: linear-gradient(135deg, #4b93ff, #2f7ef5);
  --ok: #16a34a; --ok-bg: #e6f6ec; --ok-line: #bfe8cd;
  --warn: #e08a00; --warn-bg: #fff4dc; --warn-line: #f6dfa8;
  --err: #e2453a; --err-bg: #fdecea; --err-line: #f6cfcb;
  --muted-bg: #eef2f6;
  --gold: #f5a524;
  --shadow-sm: 0 1px 2px rgba(16, 27, 45, .06), 0 1px 3px rgba(16, 27, 45, .04);
  --shadow: 0 6px 20px rgba(16, 27, 45, .08), 0 2px 6px rgba(16, 27, 45, .05);
  --shadow-lg: 0 18px 50px rgba(16, 27, 45, .16);
  --accent-shadow: rgba(47, 126, 245, .28);
  --radius: 14px; --radius-sm: 10px;
  --sidebar-w: 236px;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "SFMono-Regular", ui-monospace, "JetBrains Mono", "Cascadia Mono", Consolas, monospace;
}
[data-theme="dark"] {
  --bg: #0d1219;
  --bg-2: #151c26;
  --panel: #151c26;
  --panel-2: #1a222e;
  --panel-3: #202a38;
  --text: #e9eef6;
  --muted: #9fb0c4;
  --muted-2: #68788e;
  --line: #28323f;
  --line-2: #202a38;
  --line-strong: #35414f;
  --accent: #4b93ff;
  --accent-strong: #67a4ff;
  --accent-bg: #16273f;
  --accent-soft: #1b3352;
  --active-bg: #16273f;
  --active-fg: #67a4ff;
  --brand: linear-gradient(135deg, #ff8f74, #f0553d);
  --grad: linear-gradient(135deg, #4b93ff, #2f7ef5);
  --ok: #37c982; --ok-bg: #12291f; --ok-line: #1f5138;
  --warn: #f2b34a; --warn-bg: #2a2110; --warn-line: #57431c;
  --err: #ff6b5e; --err-bg: #2c1614; --err-line: #5a2a25;
  --muted-bg: rgba(148, 163, 184, .14);
  --gold: #f5b942;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 8px 24px rgba(0, 0, 0, .5);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, .6);
  --accent-shadow: rgba(75, 147, 255, .3);
}

body {
  font-family: var(--sans);
  background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; letter-spacing: -.01em;
  -webkit-font-smoothing: antialiased; transition: background .3s, color .3s;
}
svg { width: 20px; height: 20px; fill: currentColor; flex: none; display: block; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }

/* ============ Shell ============ */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; height: 100vh; overflow: hidden; }
.app.collapsed { --sidebar-w: 74px; }

/* ============ Sidebar (light) ============ */
.sidebar { background: var(--bg-2); border-right: 1px solid var(--line); display: flex; flex-direction: column; height: 100vh; position: relative; z-index: 20; }
.brand { display: flex; align-items: center; gap: 12px; padding: 16px 18px; min-height: 62px; border-bottom: 1px solid var(--line); }
.logo-mark {
  width: 36px; height: 36px; border-radius: 10px; flex: none; object-fit: cover; display: block;
  box-shadow: 0 5px 15px rgba(16, 27, 45, .2);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; overflow: hidden; }
.brand-text b { font-size: 14.5px; font-weight: 750; letter-spacing: -.02em; white-space: nowrap; }
.brand-text span { font-size: 10.5px; color: var(--muted-2); font-weight: 600; white-space: nowrap; }

.nav { flex: 1; overflow-y: auto; padding: 12px 12px; display: flex; flex-direction: column; gap: 3px; }
.nav-label { font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted-2); padding: 15px 10px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 9px 11px; border: none; border-radius: 10px;
  background: none; color: var(--muted); cursor: pointer; font-size: 13.5px; font-weight: 550;
  font-family: inherit; white-space: nowrap; transition: background .15s, color .15s; position: relative; width: 100%; text-align: left;
}
.nav-item:hover { background: var(--panel-3); color: var(--text); }
.nav-item.active { background: var(--accent-bg); color: var(--accent-strong); font-weight: 650; }
.nav-item.active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.ni-ico { width: 20px; height: 20px; flex: none; display: flex; align-items: center; justify-content: center; }
.ni-ico svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; }
.ni-txt { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.nav-item .count { font-style: italic; font-size: 11px; font-weight: 700; background: var(--panel-3); color: var(--muted); padding: 1px 8px; border-radius: 20px; min-width: 22px; text-align: center; }
.nav-item.active .count { background: var(--accent); color: #fff; }

.side-foot { padding: 12px; border-top: 1px solid var(--line); }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px 9px; border-radius: 11px; background: var(--panel-2); border: 1px solid var(--line); cursor: pointer; transition: border-color .15s, background .15s; }
.user-chip:hover { border-color: var(--line-strong); background: var(--panel-3); }
.me-av { width: 34px; height: 34px; border-radius: 50%; flex: none; background: linear-gradient(135deg, #3f8bff, #7c5cff); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; }
.me-info { display: flex; flex-direction: column; overflow: hidden; line-height: 1.25; flex: 1; min-width: 0; }
.user-chip .chev { width: 16px; height: 16px; flex: none; color: var(--muted-2); fill: none; }
.me-info b { font-size: 12.5px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-info span { font-size: 10.5px; color: var(--muted-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.app.collapsed .brand-text,
.app.collapsed .nav-label,
.app.collapsed .ni-txt,
.app.collapsed .nav-item .count,
.app.collapsed .user-chip .chev,
.app.collapsed .me-info { display: none; }
.app.collapsed .nav-item { justify-content: center; padding: 10px; }
.app.collapsed .nav-item.active::before { left: -12px; }
.app.collapsed .brand { justify-content: center; padding: 16px 0; }
.app.collapsed .user-chip { justify-content: center; padding: 8px; }

/* ============ Main ============ */
.main { display: flex; flex-direction: column; min-width: 0; height: 100vh; overflow: hidden; }
.topbar {
  display: flex; align-items: center; gap: 11px; padding: 11px 22px; min-height: 62px; flex: none;
  background: color-mix(in srgb, var(--bg-2) 86%, transparent); backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line); position: relative; z-index: 15;
}
.topbar-spacer { flex: 1; }
.search {
  width: 340px; max-width: 42vw; height: 40px; display: flex; align-items: center; gap: 9px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 11px; padding: 0 13px;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.search:focus-within { background: var(--bg-2); border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-shadow); }
.search:focus-within svg { color: var(--accent); }
.search svg { width: 18px; height: 18px; color: var(--muted-2); }
.search input { flex: 1; border: none; background: none; color: var(--text); font-size: 13.5px; outline: none; }
.search input::placeholder { color: var(--muted-2); }
.search kbd { font-family: var(--mono); font-size: 10.5px; color: var(--muted-2); background: var(--bg-2); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px; flex: none; line-height: 1.4; }

.btn { display: inline-flex; align-items: center; gap: 8px; padding: 0 15px; height: 40px; border: none; border-radius: 11px; cursor: pointer; font-size: 13.5px; font-weight: 650; font-family: inherit; transition: all .16s; white-space: nowrap; }
.btn svg { width: 17px; height: 17px; }
.btn.primary { background: var(--accent); color: #fff; box-shadow: 0 5px 14px var(--accent-shadow); }
.btn.primary:hover { background: var(--accent-strong); transform: translateY(-1px); }
.btn.ghost { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); }
.icon-btn { width: 40px; height: 40px; flex: none; display: flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 11px; background: var(--panel-2); color: var(--muted); cursor: pointer; transition: all .16s; }
.icon-btn:hover { color: var(--accent); border-color: var(--accent); }
.icon-btn.on { background: var(--accent-bg); color: var(--accent-strong); border-color: var(--accent-soft); }
.icon-btn svg { width: 19px; height: 19px; }
.ghost-ic { border-color: transparent; background: none; }
.ghost-ic:hover { background: var(--panel-3); border-color: var(--line); }

.status-pill { display: flex; align-items: center; gap: 7px; height: 40px; padding: 0 14px; border-radius: 22px; background: var(--muted-bg); font-size: 12.5px; font-weight: 650; color: var(--muted); white-space: nowrap; }
.status-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted-2); position: relative; }
.status-pill.ok { background: var(--ok-bg); color: var(--ok); }
.status-pill.ok .dot { background: var(--ok); }
.status-pill.ok .dot::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; background: var(--ok); opacity: .3; animation: pulse 2s infinite; }
@keyframes pulse { 0% { transform: scale(.7); opacity: .5; } 70% { transform: scale(2.2); opacity: 0; } 100% { opacity: 0; } }
.status-pill.err { background: var(--err-bg); color: var(--err); }
.status-pill.err .dot { background: var(--err); }

.cur-wrap { position: relative; flex: none; }
.cur-btn { display: flex; align-items: center; gap: 7px; height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel-2); color: var(--text); cursor: pointer; font-size: 13px; font-weight: 700; font-family: inherit; transition: border-color .15s, background .15s; }
.cur-btn:hover { border-color: var(--accent); background: var(--bg-2); }
.cur-btn .cur-ico { width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--accent); color: #fff; font-size: 11px; font-weight: 800; }
.cur-btn svg { width: 16px; height: 16px; color: var(--muted); }
.cur-menu { position: absolute; top: 48px; right: 0; width: 190px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); z-index: 150; padding: 6px; }
#cur-options { display: flex; flex-direction: column; gap: 2px; max-height: 220px; overflow-y: auto; }
#cur-options button { text-align: left; padding: 9px 12px; border: none; background: none; color: var(--text); cursor: pointer; font-size: 13px; font-weight: 600; border-radius: 8px; font-family: inherit; display: flex; align-items: center; justify-content: space-between; }
#cur-options button:hover { background: var(--panel-2); }
#cur-options button.on { background: var(--active-bg); color: var(--active-fg); }
#cur-options .cur-x { color: var(--muted-2); font-size: 14px; padding: 0 2px; }
#cur-options .cur-x:hover { color: var(--err); }
.cur-add { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 8px; }
.cur-add input { width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel-2); color: var(--text); font-size: 13px; outline: none; text-transform: uppercase; font-family: inherit; }
.cur-add input:focus { border-color: var(--accent); }
.cur-add-btns { display: flex; gap: 8px; margin-top: 8px; }
.cur-add-btns .btn { flex: 1; height: 36px; padding: 0; justify-content: center; }

.cols-wrap { position: relative; flex: none; }
.cols-panel { position: absolute; top: 48px; right: 0; width: 250px; max-height: 60vh; overflow-y: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); z-index: 150; padding: 8px; }
.cols-panel .ci-head { display: flex; justify-content: space-between; align-items: center; padding: 6px 10px 10px; font-size: 12px; color: var(--muted); font-weight: 700; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.cols-panel .ci-head a { color: var(--accent); cursor: pointer; font-weight: 600; }
.cols-panel .ci { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 8px; font-size: 13px; border: 1px solid transparent; }
.cols-panel .ci:hover { background: var(--panel-2); }
.cols-panel .ci input { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; }
.cols-panel .ci-grip { cursor: grab; color: var(--muted-2); font-size: 14px; line-height: 1; letter-spacing: -2px; }
.cols-panel .ci-label { flex: 1; cursor: default; }
.cols-panel .ci.dragging { opacity: .5; }
.cols-panel .ci.drop-target { border-color: var(--accent); background: var(--active-bg); }

/* ============ Page head ============ */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding: 18px 26px 14px; flex: none; }
.ph-text { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.ph-text b { font-size: 21px; font-weight: 750; letter-spacing: -.03em; }
.ph-text span { font-size: 13px; color: var(--muted); }
.ph-updated { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted-2); white-space: nowrap; flex: none; }
.ph-updated svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; }

.connect-banner { display: flex; align-items: center; gap: 14px; margin: 4px 26px 0; padding: 16px 20px; flex: none; border-radius: var(--radius); background: var(--warn-bg); border: 1px solid var(--warn-line); }
.cb-icon { font-size: 26px; }
.cb-text { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.cb-text b { color: var(--text); }
.cb-text span { font-size: 12.5px; color: var(--muted); }
.diag { margin: 10px 26px 0; padding: 14px; border-radius: 12px; background: var(--panel); flex: none; border: 1px solid var(--line); color: var(--muted); font-size: 11.5px; white-space: pre-wrap; max-height: 180px; overflow: auto; font-family: var(--mono); }

/* ============ Views ============ */
.scroll { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.view { display: none; animation: fade .25s ease; }
.view.active { display: block; flex: 1; min-height: 0; overflow-y: auto; padding: 6px 26px 26px; }
.view.table-view { position: relative; }
.view.table-view.active { display: flex; flex-direction: column; overflow: hidden; padding: 16px 24px; }
.panel { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.table-view .table-wrap { flex: 1; min-height: 0; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.pager { flex: none; display: flex; align-items: center; justify-content: space-between; padding: 12px 26px; border-top: 1px solid var(--line); background: var(--bg-2); }
.pager-info { font-size: 13px; color: var(--muted); font-weight: 600; }
.pager-ctrl { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
#page-size { padding: 6px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel-2); color: var(--text); font-size: 13px; cursor: pointer; outline: none; }
.pg-btn { width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel-2); color: var(--text); cursor: pointer; font-size: 17px; line-height: 1; display: flex; align-items: center; justify-content: center; transition: all .15s; }
.pg-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.pg-btn:disabled { opacity: .4; cursor: default; }
#page-num { font-weight: 700; color: var(--text); min-width: 54px; text-align: center; }

/* ============ Overview: KPI ============ */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 16px 14px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden; transition: transform .18s, box-shadow .18s; }
.stat::after { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--kc, var(--accent)); opacity: .9; }
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat .s-top { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; font-weight: 600; }
.stat .s-ico { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; font-size: 15px; background: var(--kbg, var(--accent-bg)); }
.stat .s-val { font-size: 27px; font-weight: 780; letter-spacing: -.04em; margin-top: 10px; line-height: 1; }
.stat .s-lab { font-size: 11.5px; color: var(--muted-2); margin-top: 7px; }

.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 16px 14px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden; transition: transform .18s, box-shadow .18s; }
.kpi::after { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--kc, var(--accent)); opacity: .85; }
.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.kpi .kt { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; font-weight: 600; }
.kpi .kt .ki { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--kbg, var(--accent-bg)); color: var(--kc, var(--accent)); flex: none; }
.kpi .kt .ki svg { width: 15px; height: 15px; stroke-width: 2; fill: none; }
.kpi .kv { font-size: 26px; font-weight: 780; letter-spacing: -.035em; margin-top: 10px; line-height: 1; }
.kpi .kd { margin-top: 7px; font-size: 11.5px; color: var(--muted-2); display: flex; align-items: center; gap: 5px; }
.trend { display: inline-flex; align-items: center; gap: 3px; font-weight: 700; padding: 1px 6px; border-radius: 20px; font-size: 11px; }
.trend.up { color: var(--ok); background: var(--ok-bg); }
.trend.down { color: var(--err); background: var(--err-bg); }

.cards-2 { display: grid; grid-template-columns: 1.55fr 1fr; gap: 16px; margin-top: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-head { display: flex; align-items: center; justify-content: space-between; padding: 15px 18px 12px; }
.card-head b { font-size: 14.5px; font-weight: 700; letter-spacing: -.02em; }
.card-head .sub { font-size: 12px; color: var(--muted-2); font-weight: 500; }

/* distribution */
.distro { padding: 4px 18px 18px; }
.distro-bar { display: flex; height: 34px; border-radius: 9px; overflow: hidden; background: var(--panel-3); gap: 2px; }
.distro-bar i { display: block; height: 100%; transition: width .5s cubic-bezier(.4, 0, .2, 1); }
.distro-legend { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 14px; }
.lg { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.lg .sw { width: 11px; height: 11px; border-radius: 3.5px; flex: none; }
.lg b { font-weight: 700; font-variant-numeric: tabular-nums; }
.lg span { color: var(--muted-2); }
.muted-mid { color: var(--muted); text-align: center; padding: 24px 0; }

/* top spenders */
.spender { display: flex; align-items: center; gap: 11px; padding: 9px 18px; }
.spender + .spender { border-top: 1px solid var(--line); }
.spender .rank { width: 22px; height: 22px; border-radius: 7px; background: var(--panel-3); color: var(--muted); font-size: 11.5px; font-weight: 800; display: grid; place-items: center; flex: none; }
.spender:first-child .rank { background: var(--gold); color: #5a3d00; }
.spender .nm { flex: 1; min-width: 0; font-weight: 600; font-size: 13px; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.spender .nm em { font-style: normal; display: block; font-size: 11px; color: var(--muted-2); font-weight: 500; }
.spender .amt { font-weight: 750; font-variant-numeric: tabular-nums; font-size: 13px; }

/* ============ Table ============ */
.table-wrap { overflow: auto; }
.grid { width: 100%; border-collapse: separate; border-spacing: 0; min-width: max-content; font-size: 13px; }
.grid th, .grid td { padding: 0 16px; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--line-2); }
.grid td { overflow: hidden; text-overflow: ellipsis; color: var(--text); vertical-align: middle; }
.grid th.num, .grid td.num { text-align: right; }
.col-resize { position: absolute; top: 0; right: 0; width: 10px; height: 100%; cursor: col-resize; z-index: 6; }
.col-resize::after { content: ""; position: absolute; top: 26%; right: 3px; width: 2px; height: 48%; border-radius: 2px; background: transparent; transition: background .15s; }
.col-resize:hover::after { background: var(--accent); }
body.col-resizing { cursor: col-resize !important; user-select: none; }
body.col-resizing * { cursor: col-resize !important; }
.grid td:first-child, .grid th:first-child { padding-left: 22px; }
.grid th:not(.chk), .grid td:not(.chk) { min-width: 120px; }
.grid th.col-status, .grid td.col-status { min-width: 140px; }
.grid th.col-acct, .grid td.col-acct { min-width: 260px; }
.grid tbody tr { height: 56px; transition: background .12s; }
.grid tbody tr td { transition: background .12s; }
.grid tbody tr:hover td { background: var(--panel-2); }
.grid tbody tr.sel td { background: var(--active-bg); }
.grid tbody tr.sel td:first-child { box-shadow: inset 3px 0 0 0 var(--accent); }
.grid tbody tr:last-child td { border-bottom: none; }
.grid thead th {
  height: 42px; background: var(--panel-2); color: var(--muted);
  font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .02em;
  cursor: pointer; user-select: none; border-bottom: 1px solid var(--line);
}
.grid thead th[data-sort]::after { content: ""; margin-left: 4px; font-size: 10px; opacity: 0; }
.grid thead th[data-sort].sort-desc::after { content: "▼"; opacity: 1; color: var(--accent); }
.grid thead th[data-sort].sort-asc::after { content: "▲"; opacity: 1; color: var(--accent); }
.grid thead th:hover { color: var(--accent); }
.grid tfoot td { height: 48px; background: var(--panel-2); font-weight: 750; color: var(--text); border-top: 1.5px solid var(--line-strong); border-bottom: none; }
.grid th.chk, .grid td.chk { width: 46px; text-align: center; padding: 0; }

.hf-pane { position: absolute; z-index: 20; overflow: hidden; background: var(--panel-2); }
.hf-pane.hf-head { z-index: 21; box-shadow: 0 3px 8px rgba(16, 27, 45, .06); }
.hf-pane.hf-foot { z-index: 21; box-shadow: 0 -3px 8px rgba(16, 27, 45, .06); }
.hf-pane.hf-pin { z-index: 20; background: var(--panel); border-right: 1px solid var(--line); box-shadow: 5px 0 12px rgba(16, 27, 45, .06); }
.hf-pane.hf-corner { z-index: 22; border-right: 1px solid var(--line); }
.hf-pane .grid { box-shadow: none; }
.hf-inner { will-change: transform; }
.grid tbody tr.hl > td { background: var(--panel-2); }
.grid .chk input { width: 17px; height: 17px; accent-color: var(--accent); cursor: pointer; vertical-align: middle; }
.grid td.name { font-weight: 600; }
.grid td.mono { font-family: var(--mono); color: var(--muted); font-size: 12.5px; }
.cell-sub { font-size: 12px; color: var(--err); }
.money { font-weight: 700; color: var(--ok); }
.flag { font-weight: 600; font-size: 12px; }
.dim, .grid td.dim { color: var(--muted-2); }

/* account cell w/ avatar */
.acc-cell { display: flex; align-items: center; gap: 10px; }
.acc-ava { width: 30px; height: 30px; border-radius: 8px; flex: none; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 12px; }
.acc-cell .an { line-height: 1.3; min-width: 0; overflow: hidden; }
.acc-cell .an b { font-weight: 650; font-size: 13px; display: block; overflow: hidden; text-overflow: ellipsis; }
.acc-cell .an em { font-style: normal; display: block; color: var(--muted-2); font-size: 11px; font-family: var(--mono); }
.acct { display: flex; flex-direction: column; line-height: 1.4; }
.acct b { font-weight: 650; font-size: 13px; }
.acct span { font-size: 11px; color: var(--muted-2); font-family: var(--mono); }

.pay { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; }
.pay .pc { width: 24px; height: 16px; border-radius: 4px; display: grid; place-items: center; font-size: 8px; font-weight: 800; color: #fff; letter-spacing: -.02em; flex: none; }
.cap { display: flex; align-items: center; gap: 8px; min-width: 130px; }
.cap-track { flex: 1; height: 7px; border-radius: 5px; background: var(--panel-3); overflow: hidden; }
.cap-fill { height: 100%; border-radius: 5px; transition: width .5s ease; }
.cap-val { font-size: 12px; font-weight: 700; color: var(--muted); min-width: 34px; text-align: right; }
.cap-edit { border: none; background: none; cursor: pointer; font-size: 13px; padding: 2px 4px; border-radius: 6px; opacity: .55; transition: opacity .15s, background .15s; flex: none; }
.cap-edit:hover { opacity: 1; background: var(--panel-2); }
.grid td.tz { font-size: 12px; color: var(--muted); }
.empty { text-align: left; color: var(--muted); padding: 44px 30px !important; position: sticky; left: 0; font-size: 14px; }
.openable { cursor: pointer; user-select: none; }
.openable:hover b, .openable.name:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }

.stt { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700; white-space: nowrap; padding: 4px 10px; border-radius: 20px; }
.stt::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.stt-ok { color: var(--ok); background: var(--ok-bg); border: 1px solid var(--ok-line); }
.stt-warn { color: var(--warn); background: var(--warn-bg); border: 1px solid var(--warn-line); }
.stt-err { color: var(--err); background: var(--err-bg); border: 1px solid var(--err-line); }
.stt-muted { color: var(--muted); background: var(--muted-bg); }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 20px; font-size: 11.5px; font-weight: 700; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.b-ok { background: var(--ok-bg); color: var(--ok); border: 1px solid var(--ok-line); }
.b-warn { background: var(--warn-bg); color: var(--warn); border: 1px solid var(--warn-line); }
.b-err { background: var(--err-bg); color: var(--err); border: 1px solid var(--err-line); }
.b-muted { background: var(--muted-bg); color: var(--muted); }
.tag { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 6px; background: var(--panel-3); color: var(--muted); }

.note-cell { cursor: pointer; max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 7px 9px; border-radius: 8px; font-size: 13px; }
.note-cell:hover { background: var(--panel-2); color: var(--accent); }
.note-empty { color: var(--muted-2); font-size: 12.5px; }

/* ============ Batch ============ */
.batch-top { margin-bottom: 16px; }
.batch-input { padding: 18px; }
.batch-input textarea { width: 100%; height: 150px; resize: vertical; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); color: var(--text); padding: 14px; font-family: var(--mono); font-size: 13px; margin: 14px 0; outline: none; }
.batch-input textarea:focus { border-color: var(--accent); }
.batch-actions { display: flex; gap: 10px; }
.progress-box { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px; box-shadow: var(--shadow-sm); }
.progress-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.progress-head > span { font-weight: 700; }
.progress-stats { display: flex; gap: 12px; }
.ps { font-size: 12px; color: var(--muted); font-weight: 600; }
.ps b { font-weight: 800; }
.ps-ok b { color: var(--ok); } .ps-warn b { color: var(--warn); } .ps-err b { color: var(--err); }
.progress-bar { height: 12px; border-radius: 8px; background: var(--panel-3); overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), #7c5cff); border-radius: 8px; transition: width .3s ease; }
.batch-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.bcol { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.bcol-head { padding: 13px 16px; font-weight: 700; font-size: 13.5px; display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--line); }
.bcol-head em { margin-left: auto; font-style: normal; background: var(--muted-bg); padding: 2px 9px; border-radius: 20px; font-size: 12px; }
.bcol-head.ok { color: var(--ok); } .bcol-head.warn { color: var(--warn); } .bcol-head.err { color: var(--err); }
.bcol-body { max-height: 340px; overflow-y: auto; padding: 8px; }
.bitem { padding: 9px 11px; border-radius: 9px; font-size: 12.5px; margin-bottom: 5px; background: var(--panel-2); display: flex; flex-direction: column; gap: 2px; }
.bitem b { font-weight: 600; }
.bitem span { color: var(--muted); font-family: var(--mono); font-size: 11.5px; }

/* ============ Settings ============ */
.settings-card { max-width: 640px; }
.set-row { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--line-2); }
.set-row:last-child { border-bottom: none; }
.set-row > div { display: flex; flex-direction: column; gap: 2px; }
.set-row .muted { color: var(--muted); font-size: 12px; }

/* ============ App Developer ============ */
.app-create { padding: 0 18px 18px; }
.app-lbl { display: block; font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: .3px; text-transform: uppercase; margin: 14px 0 6px; }
.app-lbl .muted, .app-lbl b { font-weight: 600; text-transform: none; letter-spacing: 0; }
.app-inp { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); color: var(--text); font-size: 13.5px; outline: none; font-family: inherit; }
.app-inp:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-shadow); }
textarea.app-inp { resize: vertical; font-family: var(--mono); font-size: 12.5px; line-height: 1.5; }
.app-full { width: 100%; justify-content: center; margin-top: 14px; }
.app-learned { margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: var(--ok-bg); border: 1px solid var(--ok-line); color: var(--ok); font-size: 12px; line-height: 1.5; }
.app-learned b { color: var(--ok); }
.app-adv { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; }
.app-adv summary { cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--muted); list-style: none; }
.app-adv summary::-webkit-details-marker { display: none; }
.app-adv summary::before { content: "▸  "; }
.app-adv[open] summary::before { content: "▾  "; }
.app-adv summary:hover { color: var(--accent); }
.app-adv-body { margin-top: 8px; }
.app-hint { font-size: 11.5px; color: var(--muted-2); margin-top: 10px; line-height: 1.5; }
.app-note { padding: 4px 18px 18px; font-size: 13px; color: var(--muted); line-height: 1.7; }
.app-note p { margin-bottom: 4px; }
.app-note b { color: var(--text); }
.link { color: var(--accent); font-weight: 600; font-size: 12.5px; cursor: pointer; text-decoration: none; }
.link:hover { text-decoration: underline; }
.app-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; }
.app-actions .ap-card { margin-bottom: 0; }
.app-adv-block { margin-top: 14px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px 14px; background: var(--panel); }
.app-adv-block summary { padding: 4px 0; }
.app-list-card { margin-top: 16px; width: 100%; }
#view-apps .table-wrap { width: 100%; }
#view-apps .grid { width: 100% !important; min-width: 100% !important; table-layout: auto; }
#view-apps .grid th, #view-apps .grid td { min-width: 0; }
#view-apps .grid .col-acct { width: 30%; }
.app-bmbar { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.app-sel-info { font-size: 13px; color: var(--muted); font-weight: 600; }
.app-bm-sel { min-width: 260px; max-width: 380px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); color: var(--text); font-size: 13px; outline: none; font-family: inherit; cursor: pointer; }
.app-bm-sel:focus { border-color: var(--accent); }
.app-bmbar .btn { height: 38px; }
.app-table { border: none; }
.app-act { display: flex; gap: 6px; }
.mini-btn { width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; transition: .13s; }
.mini-btn svg { width: 15px; height: 15px; fill: none; }
.mini-btn:hover { border-color: var(--accent); color: var(--accent); }
.mini-btn.danger:hover { border-color: var(--err); color: var(--err); background: var(--err-bg); }
.app-act { display: flex; gap: 6px; }

/* ============ Modal ============ */
.modal-overlay { position: fixed; inset: 0; background: rgba(8, 12, 20, .5); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; z-index: 200; animation: fade .2s ease; }
.modal { width: 420px; max-width: 92vw; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); overflow: hidden; animation: pop .22s ease; }
@keyframes pop { from { transform: scale(.94); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head b { font-size: 16px; }
.modal-x { border: none; background: none; color: var(--muted); cursor: pointer; font-size: 16px; width: 30px; height: 30px; border-radius: 8px; }
.modal-x:hover { background: var(--panel-2); color: var(--text); }
.modal-body { padding: 20px; }
.modal-sub { font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.modal-sub b { color: var(--text); }
.modal-field { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel-2); padding: 0 14px; }
.modal-field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-shadow); }
.modal-field input { flex: 1; border: none; background: none; color: var(--text); font-size: 18px; font-weight: 700; padding: 13px 0; outline: none; }
.modal-field span { font-size: 14px; font-weight: 700; color: var(--muted); }
#modal-textarea { width: 100%; min-height: 150px; resize: vertical; border: 1px solid var(--line); border-radius: 11px; background: var(--panel-2); color: var(--text); font-size: 14px; padding: 12px 14px; outline: none; font-family: inherit; line-height: 1.6; }
#modal-textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-shadow); }
.modal-hint { font-size: 12px; color: var(--muted-2); margin-top: 10px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--panel-2); }

/* ============ Action panel ============ */
.action-handle { position: fixed; top: 50%; right: 0; transform: translateY(-50%); z-index: 140; width: 26px; height: 54px; border: 1px solid var(--line); border-right: none; border-radius: 12px 0 0 12px; background: var(--panel); color: var(--accent); cursor: pointer; box-shadow: var(--shadow); display: flex; align-items: center; justify-content: center; transition: right .3s ease, background .15s; }
.action-handle:hover { background: var(--panel-2); }
.action-handle svg { width: 20px; height: 20px; transition: transform .3s; }
body.ap-open .action-handle { right: 340px; }
body.ap-open .action-handle svg { transform: rotate(180deg); }
.action-panel { position: fixed; top: 0; right: 0; height: 100vh; width: 340px; background: var(--bg-2); border-left: 1px solid var(--line); box-shadow: -8px 0 30px rgba(20, 30, 45, .1); z-index: 145; transform: translateX(100%); transition: transform .3s ease; display: flex; flex-direction: column; }
body.ap-open .action-panel { transform: none; }
.ap-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.ap-head-txt b { font-size: 16px; font-weight: 750; }
.ap-sub { font-size: 12px; color: var(--muted-2); margin-top: 2px; }
.ap-sub b { color: var(--accent-strong); font-weight: 700; }
.ap-close { border: none; background: none; color: var(--muted); cursor: pointer; font-size: 15px; width: 30px; height: 30px; border-radius: 8px; }
.ap-close:hover { background: var(--panel-2); color: var(--text); }
.ap-card { display: flex; align-items: center; gap: 13px; padding: 13px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); cursor: pointer; transition: .15s; margin-bottom: 10px; }
.ap-card:hover { border-color: var(--accent-soft); box-shadow: var(--shadow); transform: translateY(-1px); }
.ap-card:hover .ap-card-arw { color: var(--accent); }
.ap-card .aci { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; flex: none; }
.ap-card .aci svg { width: 20px; height: 20px; fill: none; }
.ap-card .act-t { flex: 1; min-width: 0; }
.ap-card .act-t b { font-size: 13.5px; font-weight: 650; display: block; }
.ap-card .act-t span { font-size: 12px; color: var(--muted); }
.ap-card-arw { width: 18px; height: 18px; fill: none; color: var(--muted-2); flex: none; transition: color .15s; }
.ap-empty { color: var(--muted); font-size: 13px; text-align: center; padding: 34px 10px; line-height: 1.6; }
.ap-back { display: inline-flex; align-items: center; gap: 4px; border: none; background: none; color: var(--muted); font-size: 12.5px; font-weight: 600; cursor: pointer; padding: 4px 0 2px; font-family: inherit; }
.ap-back svg { width: 16px; height: 16px; fill: none; }
.ap-back:hover { color: var(--accent); }
.ap-cfg-head { display: flex; align-items: center; gap: 11px; margin-top: 10px; }
.ap-cfg-head .aci { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.ap-cfg-head .aci svg { width: 19px; height: 19px; fill: none; }
.ap-cfg-head b { font-size: 15px; font-weight: 700; }
.ap-body { flex: 1; overflow-y: auto; padding: 8px 18px 18px; }
.ap-sec { margin-top: 16px; }
.ap-sec > label { display: block; font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: .3px; margin-bottom: 8px; }
#ap-action, #ap-mode, #ap-input, .ap-range input, .ap-conc input { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); color: var(--text); font-size: 13.5px; outline: none; font-family: inherit; }
#ap-action:focus, #ap-input:focus { border-color: var(--accent); }
#ap-input { resize: vertical; min-height: 70px; }
.ap-tmp { display: flex; align-items: center; gap: 8px; margin-top: 9px; }
.ap-tmp #ap-tmp-n { width: 56px; padding: 8px 8px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel-2); color: var(--text); font-size: 13px; text-align: center; outline: none; font-family: inherit; }
.ap-tmp-btn { display: inline-flex; align-items: center; gap: 5px; height: 36px; padding: 0 13px; border: none; border-radius: 9px; background: var(--accent); color: #fff; font-size: 12.5px; font-weight: 650; cursor: pointer; font-family: inherit; transition: .14s; white-space: nowrap; }
.ap-tmp-btn:hover { background: var(--accent-strong); }
.ap-tmp-btn.ghost { background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); }
.ap-tmp-btn.ghost:hover { color: var(--text); border-color: var(--line-strong); background: var(--panel-3); }
.ap-tmp-btn:disabled { opacity: .6; cursor: default; }
.tm-mask { position: fixed; inset: 0; z-index: 70; background: rgba(8, 12, 20, .5); display: flex; align-items: center; justify-content: center; padding: 24px; }
.tm-box { width: 640px; max-width: 100%; max-height: 84vh; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; overflow: hidden; }
.tm-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 18px; border-bottom: 1px solid var(--line); }
.tm-head b { font-size: 15px; font-weight: 700; }
.tm-head .sub { font-size: 12px; color: var(--muted-2); }
.tm-x { border: none; background: none; color: var(--muted); cursor: pointer; width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; }
.tm-x:hover { background: var(--panel-3); color: var(--text); }
.tm-body { overflow: auto; padding: 8px; }
.tm-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; }
.tm-row + .tm-row { border-top: 1px solid var(--line); }
.tm-row .tm-addr { flex: 1; min-width: 0; font-size: 13px; font-weight: 600; font-family: var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tm-mini { border: 1px solid var(--line); background: var(--panel-2); color: var(--muted); border-radius: 8px; height: 30px; padding: 0 10px; font-size: 12px; font-weight: 600; cursor: pointer; font-family: inherit; }
.tm-mini:hover { color: var(--text); border-color: var(--line-strong); }
.tm-msgs { padding: 4px 12px 12px 40px; display: flex; flex-direction: column; gap: 6px; }
.tm-msg { border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px; cursor: pointer; background: var(--panel-2); }
.tm-msg:hover { border-color: var(--accent); }
.tm-msg .s { font-size: 12.5px; font-weight: 650; }
.tm-msg .f { font-size: 11px; color: var(--muted-2); margin-top: 2px; }
.tm-empty { font-size: 12px; color: var(--muted-2); padding: 6px 2px; }
.tm-view { padding: 12px 14px; border-top: 1px solid var(--line); max-height: 40vh; overflow: auto; }
.tm-view .lnk { display: inline-flex; align-items: center; gap: 6px; margin: 4px 0; padding: 8px 12px; border-radius: 9px; background: var(--accent-bg); color: var(--accent-strong); font-size: 12.5px; font-weight: 650; text-decoration: none; word-break: break-all; }
.tm-view .htmlbody { font-size: 12.5px; color: var(--muted); margin-top: 10px; line-height: 1.5; }
.tm-view .lnk.invite { background: var(--ok-bg); color: var(--ok); border: 1px solid var(--ok-line); font-size: 13px; }
.tm-head-btns { display: flex; align-items: center; gap: 8px; }
.tm-links { border-bottom: 1px solid var(--line); background: var(--panel-2); padding: 8px 10px; max-height: 34vh; overflow: auto; }
.tm-links-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 2px 4px 8px; }
.tm-links-head b { font-size: 13px; }
.tm-link-row { display: flex; align-items: center; gap: 8px; padding: 5px 4px; }
.tm-link-row + .tm-link-row { border-top: 1px solid var(--line); }
.tm-link-row .lnk { flex: 1; min-width: 0; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: var(--accent-bg); color: var(--accent-strong); padding: 6px 10px; border-radius: 8px; text-decoration: none; font-size: 12px; font-weight: 600; }
.bml-wrap { padding: 4px 2px; }
.bml-card { padding: 16px 18px; }
.bml-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.bml-auto { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); font-weight: 600; cursor: pointer; }
.bml-auto input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--accent); }
.bml-auto #bml-delay, .bml-auto #nbm-delay, .bml-auto #req-delay { width: 62px; height: 34px; padding: 0 8px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel-2); color: var(--text); font-size: 13px; text-align: center; outline: none; font-family: inherit; }
#req-bm-select { max-width: 320px; }
.nbm-pass { width: 220px; height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel-2); color: var(--text); font-size: 13.5px; outline: none; font-family: inherit; }
.nbm-pass:focus { border-color: var(--accent); }
.bml-spacer { flex: 1; }
#bml-input, #nbm-input, #req-input { width: 100%; min-height: 220px; resize: vertical; margin-top: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); color: var(--text); padding: 13px 14px; font-family: var(--mono); font-size: 12.5px; line-height: 1.7; outline: none; }
#bml-input:focus, #nbm-input:focus, #req-input:focus { border-color: var(--accent); }
.bml-hint { font-size: 12.5px; color: var(--muted-2); margin: 10px 2px 0; }
.bml-log { display: flex; flex-direction: column; gap: 4px; margin-top: 12px; max-height: 240px; overflow: auto; }
.bml-logrow { font-size: 12px; font-family: var(--mono); padding: 5px 10px; border-radius: 8px; background: var(--panel-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bml-logrow.ok { color: var(--ok); }
.bml-logrow.err { color: var(--err); }
#upd-banner { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 80; display: flex; align-items: center; gap: 14px; background: var(--accent); color: #fff; padding: 11px 16px; border-radius: 12px; box-shadow: var(--shadow-lg); font-size: 13.5px; font-weight: 600; max-width: 92vw; }
#upd-banner a { color: #fff; font-weight: 800; text-decoration: underline; }
#upd-banner .upd-x { cursor: pointer; opacity: .85; font-weight: 700; }
#upd-banner .upd-x:hover { opacity: 1; }
.ap-check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); font-weight: 500; cursor: pointer; margin-bottom: 10px; }
.ap-check input { width: 16px; height: 16px; accent-color: var(--accent); }
.ap-range { display: flex; align-items: center; gap: 6px; }
.ap-range input { width: 70px; text-align: center; }
.ap-range span { font-size: 12px; color: var(--muted); }
.ap-range input:disabled { opacity: .5; }
.ap-dash { margin: 0 2px; }
.ap-conc { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ap-conc span { font-size: 13px; color: var(--muted); }
.ap-conc input { width: 80px; text-align: center; }
.ap-exec { width: 100%; margin-top: 22px; padding: 13px; border: none; border-radius: 11px; background: var(--accent); color: #fff; font-size: 14px; font-weight: 700; cursor: pointer; box-shadow: 0 6px 16px var(--accent-shadow); font-family: inherit; }
.ap-exec:hover { background: var(--accent-strong); }
.ap-exec:disabled { cursor: default; box-shadow: none; opacity: .7; }
.ap-exec.running { animation: apPulse 1.1s ease-in-out infinite; }
@keyframes apPulse { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(1.15); } }
.ap-log-list { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.ap-log-list:empty { margin: 0; }
.ap-log-empty { color: var(--muted); text-align: center; padding: 30px 0; font-size: 13px; }
.ap-log-item { padding: 10px 12px; border-radius: 9px; background: var(--panel-2); font-size: 12.5px; display: flex; flex-direction: column; gap: 2px; }
.ap-log-item b { font-weight: 600; }
.ap-log-item.ok { border-left: 3px solid var(--ok); }
.ap-log-item.err { border-left: 3px solid var(--err); }
.ap-log-item.wait { border-left: 3px solid var(--muted-2); opacity: .7; }
.ap-log-item.run { border-left: 3px solid var(--accent); animation: apPulse 1.1s ease-in-out infinite; }
.ap-log-item span { color: var(--muted); font-size: 11.5px; }

/* ============ Toast / loading ============ */
.toast-wrap { position: fixed; top: 20px; right: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 300; }
.toast { background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 12px; padding: 12px 18px; box-shadow: var(--shadow-lg); font-size: 13px; font-weight: 500; min-width: 240px; animation: slidein .3s ease; }
.toast.ok { border-left-color: var(--ok); }
.toast.err { border-left-color: var(--err); }
@keyframes slidein { from { transform: translateX(120%); opacity: 0; } to { transform: none; opacity: 1; } }
.toast-mid { position: fixed; bottom: 80px; left: 50%; transform: translate(-50%, 12px); background: rgba(15, 27, 45, .94); color: #fff; padding: 12px 24px; border-radius: 24px; font-weight: 600; font-size: 13.5px; box-shadow: 0 14px 34px rgba(0, 0, 0, .34); z-index: 400; opacity: 0; transition: opacity .25s ease, transform .25s ease; pointer-events: none; }
.toast-mid.show { opacity: 1; transform: translate(-50%, 0); }
.loading { position: fixed; inset: 0; background: rgba(8, 12, 20, .5); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; z-index: 90; backdrop-filter: blur(3px); color: #fff; font-weight: 600; }
.spinner { width: 46px; height: 46px; border: 4px solid rgba(255, 255, 255, .25); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted-2); }

/* ============ Currency seg ============ */
.cur-seg { display: flex; align-items: center; background: var(--panel-2); border: 1px solid var(--line); border-radius: 11px; padding: 3px; gap: 2px; flex: none; height: 40px; }
.cur-seg button { display: inline-flex; align-items: center; gap: 3px; border: none; background: none; color: var(--muted); font-weight: 700; font-size: 12.5px; padding: 0 12px; height: 100%; border-radius: 8px; cursor: pointer; font-family: inherit; transition: .13s; }
.cur-seg button:hover { color: var(--text); }
.cur-seg button.on { background: var(--bg-2); color: var(--accent-strong); box-shadow: var(--shadow-sm); }
.cur-seg .cur-x { font-style: normal; opacity: .5; font-size: 14px; line-height: 1; padding: 0 1px; }
.cur-seg .cur-x:hover { opacity: 1; color: var(--err); }
.cur-seg .cur-add-btn { color: var(--muted-2); font-size: 17px; font-weight: 700; padding: 0 11px; }
.cur-seg .cur-add-btn:hover { color: var(--accent); }

/* ============ Table toolbar ============ */
.toolbar { display: flex; align-items: center; gap: 9px; padding: 12px 14px; border-bottom: 1px solid var(--line); background: var(--panel); flex-wrap: wrap; flex: none; }
.tb-title { font-size: 13.5px; font-weight: 700; }
.tfooter { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); background: var(--panel); flex-wrap: wrap; }
.rowsel { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.rowsel b { color: var(--text); font-weight: 700; }
.rowsel select { border: 1px solid var(--line); background: var(--panel-2); border-radius: 8px; padding: 5px 8px; color: var(--text); font-size: 12.5px; cursor: pointer; outline: none; font-family: inherit; }
.pager-num { display: flex; align-items: center; gap: 4px; }
.pager-num button { min-width: 30px; height: 30px; padding: 0 7px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--muted); font-weight: 650; cursor: pointer; font-size: 12.5px; font-family: inherit; transition: .13s; }
.pager-num button:hover:not(.on):not(:disabled):not(.dots) { background: var(--panel-3); color: var(--text); }
.pager-num button.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.pager-num button.dots { border-color: transparent; background: none; cursor: default; color: var(--muted-2); }
.pager-num button:disabled { opacity: .4; cursor: default; }
.chips { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2); color: var(--muted); font-size: 12.5px; font-weight: 600; cursor: pointer; font-family: inherit; transition: .13s; white-space: nowrap; }
.chip:hover { border-color: var(--line-strong); color: var(--text); }
.chip.on { background: var(--accent-bg); border-color: var(--accent-soft); color: var(--accent-strong); }
.chip .badge { padding: 1px 8px; font-size: 11.5px; font-weight: 700; }
.chip[data-filter="live"], .chip[data-filter="dead"], .chip[data-filter="warn"] { padding: 0 6px; }
.chip svg { width: 15px; height: 15px; }
.chip .chip-n { font-weight: 800; font-style: normal; margin-left: 1px; }
.act-btn { color: var(--accent-strong); }
.toolbar-spacer { flex: 1; min-width: 8px; }

/* ============ Open column ============ */
.grid th.col-open, .grid td.col-open { width: 46px; text-align: center; padding: 0 10px; }
.grid td.col-open { color: var(--muted-2); cursor: pointer; }
.grid td.col-open:hover { color: var(--accent); }
.open-ic { width: 17px; height: 17px; margin: 0 auto; fill: none; }
.me-ok { color: var(--ok) !important; font-weight: 600; }

/* ============ Responsive ============ */
@media (max-width: 1180px) {
  .app { --sidebar-w: 74px; }
  .brand-text, .nav-label, .ni-txt, .nav-item .count, .me-info, .user-chip .chev { display: none; }
  .nav-item { justify-content: center; padding: 10px; }
  .brand { justify-content: center; padding: 16px 0; }
  .user-chip { justify-content: center; padding: 8px; }
  .rf-txt { display: none; }
  #refresh { width: 40px; padding: 0; justify-content: center; }
  .search { width: 200px; }
  .status-pill span:last-child { display: none; }
  .cards-2 { grid-template-columns: 1fr; }
}
@media (max-width: 820px) { .batch-cols { grid-template-columns: 1fr; } }

.gt-wrap { padding: 4px 2px; }
.gt-panel { padding: 24px 24px 20px; }
.gt-labelrow { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.gt-label { font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--muted-2); }
.gt-badge { background: var(--accent-bg); color: var(--accent-strong, var(--accent)); font-weight: 700; font-size: 12px; padding: 3px 12px; border-radius: 999px; letter-spacing: .01em; }
.gt-area { width: 100%; min-height: 220px; resize: vertical; display: block; border: 1.5px solid var(--line); border-radius: 14px; background: var(--panel-2); color: var(--text); padding: 16px 18px; font-family: var(--mono); font-size: 13px; line-height: 1.85; outline: none; transition: border-color .15s, box-shadow .15s, background .15s; }
.gt-area::placeholder { color: var(--muted-2); }
.gt-area:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-shadow); background: var(--panel); }
.gt-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.gt-tag { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--muted); background: var(--panel-2); border: 1px solid var(--line); padding: 5px 11px; border-radius: 999px; }
.gt-tag svg { width: 14px; height: 14px; color: var(--accent); }
.gt-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 18px; }
.gt-btn { display: inline-flex; align-items: center; justify-content: center; gap: 9px; height: 46px; padding: 0 24px; font-size: 14.5px; font-weight: 700; letter-spacing: -.01em; }
.gt-btn svg { width: 18px; height: 18px; }
.gt-delay-wrap { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); font-weight: 600; background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 0 14px; height: 46px; }
.gt-delay-wrap input { width: 52px; height: 32px; border: 0; background: transparent; color: var(--text); font-size: 15px; font-weight: 700; text-align: center; outline: none; font-family: inherit; }
.gt-spacer { flex: 1; }
.gt-hint { font-size: 12.5px; color: var(--muted-2); line-height: 1.7; margin-top: 18px; padding: 13px 15px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; }
#view-gettoken .bml-log { margin-top: 16px; max-height: 460px; gap: 10px; }

.gt-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; background: var(--panel-2); }
.gt-card.err { border-color: rgba(220, 70, 70, .4); }
.gt-head { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text); }
.gt-pref { margin-left: auto; background: #f5a524; color: #101010; font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 8px; letter-spacing: .02em; }
.gt-row, .gt-row2 { display: flex; align-items: flex-start; gap: 8px; margin-top: 8px; }
.gt-tk, .gt-ck { flex: 1; font-family: Consolas, "SFMono-Regular", monospace; font-size: 12px; word-break: break-all; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px; max-height: 66px; overflow: auto; }
.gt-ck { color: var(--muted); font-size: 11px; }
.gt-cp { flex: 0 0 auto; padding: 5px 11px; font-size: 12px; height: auto; }
.gt-errtxt { color: #e5484d; font-size: 12px; margin-top: 6px; word-break: break-word; }
.gt-errsub { color: var(--muted); font-size: 11px; margin-top: 4px; }
