/* Admin panel — visual language matched to the marketing site (styles.css) */
:root {
  --bg: #181e2a;
  --band: #141a27;
  --panel: #222a3a;
  --panel-2: #263042;
  --stroke: rgba(255, 255, 255, 0.07);
  --stroke-2: rgba(255, 255, 255, 0.14);
  --text: #eef2f8;
  --muted: #94a1b8;
  --blue: #22a8f0;
  --blue-2: #44bbfc;
  --blue-3: #1f7daf;
  --green: #57f287;
  --red: #ed4245;
  --amber: #fee75c;
  --radius: 14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

/* The HTML5 `hidden` attribute must win over any author `display: …` rule
   below (e.g. .login { display: grid } would otherwise keep the login screen
   visible even after login when we flip `#login.hidden = true`). */
[hidden] { display: none !important; }

/* Hide native scrollbars everywhere the user can scroll — matches the
   marketing site's chrome-less style. Content still scrolls with wheel /
   trackpad / drag; we just don't paint a scrollbar. */
* { scrollbar-width: none; -ms-overflow-style: none; }
*::-webkit-scrollbar { width: 0; height: 0; display: none; }
html, body { overflow-x: hidden; max-width: 100%; }
body {
  font-family: "Roboto", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

code { font-family: ui-monospace, "SF Mono", Menlo, monospace; background: rgba(34, 168, 240, 0.15); color: #9fdcff; padding: 1px 6px; border-radius: 6px; font-size: 0.9em; }
.muted { color: var(--muted); font-weight: 400; }

/* --- Login screen --- */
.login {
  min-height: 100vh; display: grid; place-items: center;
  background: radial-gradient(circle at 30% 0%, rgba(34,168,240,0.1), transparent 60%),
              radial-gradient(circle at 80% 100%, rgba(88,101,242,0.08), transparent 60%),
              var(--bg);
  padding: 24px;
}
.login-card {
  width: 100%; max-width: 380px; background: var(--panel);
  border: 1px solid var(--stroke-2); border-radius: var(--radius);
  padding: 32px 28px; display: flex; flex-direction: column; gap: 14px;
  box-shadow: 0 30px 80px -30px rgba(0,0,0,0.85);
}
#gate-step1, #gate-step2 { display: flex; flex-direction: column; gap: 12px; }
.gate-input {
  width: 100%; box-sizing: border-box; background: var(--bg); color: #fff;
  border: 1px solid var(--stroke-2); border-radius: 10px; padding: 12px 14px;
  font-size: 15px; font-family: inherit;
}
.gate-input:focus { outline: none; border-color: #5865f2; }
.gate-input::placeholder { color: var(--muted); }
.brand { display: flex; align-items: center; justify-content: center; gap: 9px; font-size: 20px; font-weight: 800; letter-spacing: -0.01em; }
.brand img { width: 26px; height: 26px; border-radius: 7px; display: block; }
.hint { color: var(--muted); font-size: 14px; }
.discord-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  background: #5865F2; color: #fff; text-decoration: none;
  padding: 13px 18px; border-radius: 10px; font-weight: 700; font-size: 15px;
  transition: background 0.15s, transform 0.05s;
}
.discord-btn:hover { background: #4752c4; }
.discord-btn:active { transform: translateY(1px); }

/* Language switch (sidebar + login) */
.lang-switch { display: inline-flex; gap: 2px; padding: 3px; background: rgba(255,255,255,0.04); border: 1px solid var(--stroke); border-radius:8px; }
.sidebar .lang-switch { align-self: flex-start; margin-bottom: 8px; }
.login-card .lang-switch { align-self: flex-end; margin-bottom: -4px; }
.lang-switch button { border: none; cursor: pointer; padding: 5px 11px; border-radius:8px; font-size: 12px; font-weight: 700; font-family: inherit; background: transparent; color: var(--muted); }
.lang-switch button.active { background: var(--blue); color: #06121c; }

/* Owner "view as admin" preview banner */
#view-banner {
  grid-column: 1 / -1;
  display: flex; align-items: center; justify-content: center; gap: 14px;
  background: rgba(245, 179, 0, 0.16); color: var(--amber, #f5b300);
  border-bottom: 1px solid rgba(245, 179, 0, 0.35);
  padding: 8px 16px; font-size: 13.5px; font-weight: 700;
}
#view-banner button {
  background: var(--amber, #f5b300); color: #1a1400; border: none;
  padding: 5px 12px; border-radius:8px; font-weight: 800; font-size: 12.5px; cursor: pointer;
}
#view-banner button:hover { filter: brightness(1.08); }

/* Warning: on-air ads with no join-check (link points to a bot-less server) */
.warn-banner {
  grid-column: 1 / -1;
  background: rgba(237, 66, 69, 0.14); color: #ff8a8d;
  border-bottom: 1px solid rgba(237, 66, 69, 0.4);
  padding: 11px 18px; font-size: 13px; line-height: 1.5;
}
.warn-banner b { color: #ffb3b5; }
.warn-banner ul { margin: 7px 0 0; padding-left: 20px; }
.warn-banner li { margin: 2px 0; }
.warn-banner .muted { color: rgba(255, 138, 141, 0.6); }
#code {
  padding: 14px; text-align: center; letter-spacing: 8px; font-size: 22px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--stroke-2); border-radius: 10px;
}
#code:focus { outline: none; border-color: var(--blue); }
.err { color: var(--red); font-size: 14px; text-align: center; }

/* --- Buttons --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-weight: 700; font-size: 13.5px; padding: 12px 20px;
  border-radius:8px; border: 1px solid transparent; cursor: pointer;
  transition: transform 0.12s, background 0.15s, border-color 0.15s;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--blue); color: #06121c; }
.btn.primary:hover { background: var(--blue-2); }
.btn.ghost { background: rgba(255,255,255,0.04); border-color: var(--stroke-2); color: var(--text); }
.btn.ghost:hover { background: rgba(255,255,255,0.09); border-color: rgba(255,255,255,0.24); }
.btn.danger { background: transparent; border-color: rgba(237,66,69,0.4); color: var(--red); }
.btn.danger:hover { background: rgba(237,66,69,0.12); }
.btn.sm { padding: 8px 14px; font-size: 12.5px; }

/* --- App layout --- */
#app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; max-width: 100vw; }
/* The content column is the grid's 1fr track. Without min-width:0 a grid item won't
   shrink below its content's min-content size, so a wide child (funnel table, chart,
   card row, server chips) forces the whole column past the viewport — and body's
   overflow-x:hidden then CLIPS it (the "cut off on the right" on phones and in the
   browser's desktop-site mode). min-width:0 lets it shrink; wide children scroll
   inside their own overflow-x:auto wrappers instead of blowing out the page. */
#app > .content, #app > .sidebar { min-width: 0; }

/* Top bar — unified with the cabinet pages (avatar burger holds the cross-cabinet
   links + logout; the sidebar keeps only the admin section tabs). */
.topbar { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 12px 20px; border-bottom: 1px solid var(--stroke); background: rgba(11,15,23,0.85); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); position: sticky; top: 0; z-index: 30; }
.topbar .brand-sm { margin-bottom: 0; font-size: 20px; }
.top-right { display: flex; align-items: center; gap: 12px; }
.cab-menu { position: relative; display: flex; align-items: center; }
.cab-av { width: 40px; height: 40px; border-radius: 50%; padding: 0; border: 1px solid var(--stroke-2); background-size: cover; background-position: center; background-color: var(--band, #141a26); color: var(--text); font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.cab-av:hover { border-color: var(--blue); }
.nav-menu { position: absolute; top: calc(100% + 12px); right: 0; width: 250px; background: var(--panel, #141a26); border: 1px solid var(--stroke-2); border-radius: 14px; overflow: hidden; box-shadow: 0 24px 60px -24px rgba(0,0,0,0.85); z-index: 60; }
.nav-menu[hidden] { display: none; }
.nm-head { position: relative; height: 84px; overflow: hidden; }
.nm-banner { position: absolute; inset: 0; background: linear-gradient(135deg, var(--blue), var(--blue-2)); background-size: cover; background-position: center; }
.nm-banner::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,0.2), rgba(0,0,0,0.72)); }
.nm-id { position: absolute; left: 14px; right: 14px; bottom: 11px; z-index: 1; display: flex; align-items: center; gap: 11px; }
.nm-av { width: 44px; height: 44px; border-radius: 50%; flex: none; border: 2px solid rgba(255,255,255,0.9); background-size: cover; background-position: center; background-color: var(--blue); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; }
.nm-txt { min-width: 0; }
.nm-txt b { display: block; color: #fff; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 3px rgba(0,0,0,0.55); }
.nm-txt span { display: block; color: rgba(255,255,255,0.85); font-size: 12.5px; text-shadow: 0 1px 3px rgba(0,0,0,0.55); }
.nm-items { padding: 6px; }
.nm-items a, .nm-items .nav-logout { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: var(--text); font-size: 14px; font-weight: 600; background: transparent; border: 0; width: 100%; text-align: left; cursor: pointer; font-family: inherit; text-decoration: none; }
.nm-items a:hover, .nm-items .nav-logout:hover { background: rgba(255,255,255,0.06); }
.nm-sep { height: 1px; background: var(--stroke); margin: 6px 8px; }
.nm-items .nav-logout { color: #ff9a9c; }
.nm-items .nav-logout:hover { background: rgba(237,66,69,0.14); }
.sidebar {
  background: var(--band); border-right: 1px solid var(--stroke);
  padding: 24px 16px; display: flex; flex-direction: column; gap: 12px;
}
.brand-sm { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 18px; margin-bottom: 8px; color: var(--text, #e7ecf6); text-decoration: none; }
.brand-sm img { width: 26px; height: 26px; border-radius: 7px; display: block; flex: none; }
.tabs { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.tab {
  background: transparent; border: none; color: var(--muted);
  text-align: left; padding: 10px 12px; font-size: 14.5px; font-weight: 600;
  cursor: pointer; border-radius: 8px; transition: background 0.15s, color 0.15s;
}
.tab:hover { background: rgba(255,255,255,0.04); color: var(--text); }
.tab.active { background: rgba(34,168,240,0.16); color: var(--blue-2); }

.cab-links { display: flex; flex-direction: column; gap: 2px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--stroke); }
.cab-links .cl-link { color: var(--muted); font-size: 13.5px; font-weight: 600; padding: 8px 12px; border-radius: 8px; text-decoration: none; }
.cab-links .cl-link:hover { background: rgba(255,255,255,0.05); color: var(--text); }
.sidebar #logout { margin-top: 4px; }

.content { padding: 32px 40px; max-width: 1100px; }
.pane h1 {
  font-size: 26px; font-weight: 800; margin-bottom: 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap;
}
.pane h2 { font-size: 18px; font-weight: 700; margin: 22px 0 12px; }
.row-title { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin: 22px 0 10px; }
.row-title .muted { text-transform: none; letter-spacing: 0; }

/* --- Stat cards --- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.stat-card {
  background: var(--panel); border: 1px solid var(--stroke);
  border-radius: 12px; padding: 16px 18px;
}
.stat-card .k { color: var(--muted); font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.05em; }
.stat-card .v { font-size: 24px; font-weight: 800; margin-top: 6px; }
.stat-card .v .v-sub { font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.card-add {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; vertical-align: middle; margin-left: 6px;
  border-radius: 8px; border: 1px solid var(--stroke-2);
  background: rgba(34,168,240,0.14); color: var(--blue-2);
  font-size: 16px; font-weight: 700; line-height: 1; cursor: pointer;
  transition: background 0.12s;
}
.card-add:hover { background: rgba(34,168,240,0.26); }

.table-wrap { overflow-x: auto; }
.stat-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.stat-table th, .stat-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--stroke); }
.stat-table th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; }
.stat-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.stat-table td .gid { color: var(--muted); font-size: 12px; margin-left: 6px; }

/* --- Ad / Template editors --- */
.ad-editor, .tpl-editor {
  background: var(--panel); border: 1px solid var(--stroke);
  border-radius: 12px; padding: 16px;
  display: flex; flex-direction: column; gap: 10px;
}
.ad-editor.card, .tpl-editor.card { background: var(--panel-2); }
.ad-editor .row, .tpl-editor .row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ad-editor .label, .tpl-editor .label { font-weight: 700; }
.ad-editor .gid, .tpl-editor .gid { color: var(--muted); font-size: 12.5px; font-family: ui-monospace, Menlo, monospace; }
.ad-editor textarea, .tpl-editor textarea {
  min-height: 100px; resize: vertical;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--stroke-2); border-radius: 8px; padding: 10px 12px;
  font-family: ui-monospace, Menlo, monospace; font-size: 13.5px; line-height: 1.5;
}
.ad-editor textarea:focus, .tpl-editor textarea:focus { outline: none; border-color: var(--blue); }
.ad-editor input, .tpl-editor input {
  background: var(--bg); color: var(--text);
  border: 1px solid var(--stroke-2); border-radius: 8px; padding: 8px 10px;
  font-family: ui-monospace, Menlo, monospace; font-size: 13px;
}
.ad-editor input:focus, .tpl-editor input:focus { outline: none; border-color: var(--blue); }
.ad-editor .actions, .tpl-editor .actions { display: flex; gap: 8px; margin-top: 4px; }
.ad-editor .actions .spacer, .tpl-editor .actions .spacer { flex: 1; }

.ad-list, .tpl-list { display: flex; flex-direction: column; gap: 12px; }

/* --- Toggle switch --- */
.toggle-card {
  background: var(--panel); border: 1px solid var(--stroke);
  border-radius: 12px; padding: 22px 24px;
  display: flex; align-items: center; gap: 20px;
}
.switch { position: relative; display: inline-block; width: 56px; height: 30px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; inset: 0; background: rgba(255,255,255,0.08);
  border-radius:8px; cursor: pointer;
  transition: background 0.2s;
}
.slider::before {
  content: ""; position: absolute; left: 3px; top: 3px; width: 24px; height: 24px;
  background: var(--text); border-radius: 50%;
  transition: transform 0.2s;
}
.switch input:checked + .slider { background: var(--red); }
.switch input:checked + .slider::before { transform: translateX(26px); }
.switch-labels { display: flex; flex-direction: column; gap: 3px; }
.switch-state { font-weight: 800; font-size: 18px; }
.switch-since { font-size: 13px; }

/* --- Filters bar --- */
.filters {
  display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px;
  background: var(--panel); border: 1px solid var(--stroke);
  border-radius: 10px; padding: 12px 14px;
}
.filters input, .filters select {
  background: var(--bg); color: var(--text);
  border: 1px solid var(--stroke-2); border-radius: 8px;
  padding: 8px 12px; font-size: 13.5px; font-family: inherit;
}
.filters input { flex: 1 1 200px; min-width: 160px; }
.filters input:focus, .filters select:focus { outline: none; border-color: var(--blue); }
.filters select { min-width: 160px; cursor: pointer; appearance: none; -webkit-appearance: none; -moz-appearance: none; padding-right: 30px; 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='%238b97ab' stroke-width='2.5' 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 10px center; background-size: 12px; }
.filters select::-ms-expand { display: none; }

/* Balance table extras */
.stat-table tr.clickable { cursor: pointer; transition: background 0.12s; }
.stat-table tr.clickable:hover td { background: rgba(34,168,240,0.06); }
.stat-table td .uid { color: var(--muted); font-size: 12px; font-family: ui-monospace, Menlo, monospace; margin-left: 4px; }
.stat-table .chip {
  display: inline-block; padding: 2px 8px; border-radius:8px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.02em;
  background: rgba(255,255,255,0.06); color: var(--muted);
  white-space: nowrap;
}
.stat-table .chip.green { background: rgba(87,242,135,0.14); color: var(--green); }
.stat-table .chip.red   { background: rgba(237,66,69,0.14);  color: var(--red); }
.stat-table .chip.blue  { background: rgba(34,168,240,0.14); color: var(--blue-2); }

.stat-table .v-sub { font-size: 11px; font-weight: 500; color: var(--muted); white-space: nowrap; }

/* Server cell: icon + name */
.srv-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.srv-ic {
  width: 28px; height: 28px; border-radius: 50%; flex: none;
  object-fit: cover; background: rgba(255,255,255,0.06);
}
.srv-ic-fallback {
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(34,168,240,0.16); color: var(--blue-2);
  font-weight: 800; font-size: 13px;
}
.copy-id {
  display: inline-flex; align-items: center; flex: none;
  padding: 3px 9px; font-size: 10.5px; font-weight: 700;
  border-radius:8px; border: 1px solid var(--stroke-2);
  background: rgba(255,255,255,0.04); color: var(--muted); cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.copy-id:hover { background: rgba(255,255,255,0.09); color: var(--text); }

/* Compact inline actions inside stat-table rows */
.stat-table .actions { display: inline-flex; gap: 6px; }
.stat-table .btn-mini {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 10px; font-size: 11.5px; font-weight: 700;
  border-radius:8px; border: 1px solid var(--stroke-2);
  background: rgba(255,255,255,0.04); color: var(--text);
  cursor: pointer; white-space: nowrap;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.stat-table .btn-mini:hover { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.24); }
.stat-table .btn-mini.on  { background: rgba(87,242,135,0.14); border-color: rgba(87,242,135,0.35); color: var(--green); }
.stat-table .btn-mini.off { background: rgba(237,66,69,0.14);  border-color: rgba(237,66,69,0.35);  color: var(--red); }
.stat-table .btn-mini.on:hover  { background: rgba(87,242,135,0.22); }
.stat-table .btn-mini.off:hover { background: rgba(237,66,69,0.22); }

.sm { font-size: 12.5px; font-weight: 500; }

.pane h1 .muted.sm { font-size: 14px; font-weight: 500; }

/* Stats mode segmented control */
.mode-switch {
  display: inline-flex; gap: 2px; padding: 3px;
  background: rgba(255,255,255,0.04); border: 1px solid var(--stroke);
  border-radius:8px;
}
.mode-switch button {
  border: none; cursor: pointer;
  padding: 6px 14px; border-radius:8px;
  font-size: 12.5px; font-weight: 700; font-family: inherit;
  background: transparent; color: var(--muted);
  transition: background 0.15s, color 0.15s;
}
.mode-switch button:hover { color: var(--text); }
.mode-switch button.active { background: var(--blue); color: #06121c; }
.mode-hint { margin: -8px 0 16px; max-width: 640px; }

/* --- Balance detail modal --- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(4,8,15,0.7); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.modal {
  background: var(--panel); border: 1px solid var(--stroke-2);
  border-radius: 14px; max-width: 780px; width: 100%;
  max-height: 90vh; overflow: auto; position: relative;
  box-shadow: 0 40px 80px -20px rgba(0,0,0,0.7);
}
.modal-close {
  position: absolute; top: 12px; right: 14px; z-index: 1;
  background: transparent; border: none; color: var(--muted);
  font-size: 20px; cursor: pointer; padding: 6px 10px; border-radius: 6px;
}
.modal-close:hover { background: rgba(255,255,255,0.05); color: var(--text); }
.modal-body { padding: 24px 28px; }
.modal h2 { font-size: 20px; margin-bottom: 12px; }
.modal h3 { font-size: 14px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 700; margin: 18px 0 10px; }
.modal .kv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px 20px; margin-bottom: 6px; }
.modal .kv { display: flex; flex-direction: column; gap: 2px; }
.modal .kv .k { color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.04em; }
.modal .kv .v { font-weight: 700; font-size: 14.5px; word-break: break-all; }
.modal .kv .v.mono { font-family: ui-monospace, Menlo, monospace; font-weight: 500; }
.modal .req { background: var(--bg); border: 1px solid var(--stroke-2); border-radius: 8px; padding: 10px 12px; font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; white-space: pre-wrap; word-break: break-word; }
.wd-row { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--stroke); font-size: 13.5px; }
.wd-row:last-child { border-bottom: none; }
.wd-row .amount { font-weight: 800; font-variant-numeric: tabular-nums; }
.wd-row .date { color: var(--muted); font-size: 12px; }
/* User-bots ("Для ботоводов") tab */
.bf-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin: 14px 0 6px; }
.bf-sum-card { background: var(--panel); border: 1px solid var(--stroke); border-radius: 14px; padding: 14px 16px; }
.bf-sum-card .k { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
.bf-sum-card .v { font-size: 26px; font-weight: 800; margin-top: 4px; font-variant-numeric: tabular-nums; }
.bf-sum-card .sub { font-size: 11.5px; margin-top: 4px; }
.bf-add-row { display: flex; gap: 10px; margin: 16px 0 0; max-width: 560px; }
.bf-add-row input { flex: 1; min-width: 0; background: var(--panel); border: 1px solid var(--stroke); color: var(--text); border-radius: 10px; padding: 11px 13px; font-size: 14px; }
.bf-add-row input:focus { outline: none; border-color: var(--accent); }
.bf-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; margin-top: 6px; }
.bf-cards .empty { grid-column: 1/-1; text-align: center; padding: 40px; border: 1px dashed var(--stroke); border-radius: 14px; }
.bf-card { background: var(--panel); border: 1px solid var(--stroke); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.bf-card.off { border-color: rgba(240,97,109,.4); }
.bf-card .head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.bf-card .title b { display: block; font-size: 15px; word-break: break-word; }
.bf-card .title .uid { color: var(--muted); font-size: 11.5px; font-family: ui-monospace, Menlo, monospace; }
.bf-pill { font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius:8px; white-space: nowrap; }
.bf-pill.green { color: var(--green); background: rgba(63,185,80,.12); }
.bf-pill.red { color: var(--red); background: rgba(240,97,109,.12); }
.bf-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.bf-stat { background: var(--panel2); border-radius: 10px; padding: 10px 12px; }
.bf-stat .k { color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px; }
.bf-stat .v { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.bf-card .foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; border-top: 1px solid var(--stroke); padding-top: 10px; }
.bf-access-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; max-width: 520px; }
.bf-access-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--panel); border: 1px solid var(--stroke); border-radius: 10px; padding: 9px 13px; font-family: ui-monospace, Menlo, monospace; font-size: 13px; }
.btn.danger { color: var(--red); border-color: rgba(240,97,109,.4); }
@media (max-width:560px){ .bf-add-row { flex-direction: column; } .bf-cards { grid-template-columns: 1fr; } }

.wd-row.completed .amount { color: var(--green); }
.wd-row.processing .amount { color: var(--amber); }
.wd-row.review .amount, .wd-row.failed .amount { color: var(--red); }
.wd-row .date { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.wd-retry { background: transparent; border: 1px solid var(--stroke); color: var(--muted); border-radius: 6px; padding: 2px 8px; font-size: 12px; line-height: 1.4; cursor: pointer; white-space: nowrap; }
.wd-retry:hover { color: var(--text); border-color: var(--red); }
.wd-retry:disabled { opacity: .5; cursor: default; }

/* --- Modal settings section --- */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
  gap: 12px; margin-bottom: 10px;
}
.setting {
  background: var(--bg); border: 1px solid var(--stroke-2);
  border-radius: 10px; padding: 12px 14px;
  display: flex; flex-direction: column; gap: 8px;
  min-width: 0;   /* let the grid shrink us; otherwise input intrinsic width blows the row */
}
.setting > label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 700; }
.setting input[type="text"], .setting input[type="number"], .setting textarea {
  width: 100%; min-width: 0;   /* critical: default input min-width is intrinsic (~size=20) */
  background: var(--panel); color: var(--text);
  border: 1px solid var(--stroke-2); border-radius: 8px;
  padding: 8px 10px; font-family: ui-monospace, Menlo, monospace; font-size: 13px;
}
.setting input:focus, .setting textarea:focus { outline: none; border-color: var(--blue); }
.setting textarea { min-height: 80px; resize: vertical; }
.setting .actions-row { display: flex; justify-content: flex-end; gap: 8px; margin-top: 2px; }
.setting.wide { grid-column: 1 / -1; }
.setting.autopay { flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; }
.setting.autopay > label { flex: 1; min-width: 0; }
/* Auto-payout switch: green when enabled (positive-good, unlike the red kill-switch) */
.switch.positive input:checked + .slider { background: var(--green); }

/* Modal body itself must never cause horizontal scroll — vertical only */
.modal-body { overflow-x: hidden; }
.modal-body h2 { word-break: break-all; }

/* --- Ad statistics cards --- */
.ad-stat-list { display: flex; flex-direction: column; gap: 12px; }
.ad-stat-card {
  background: var(--panel); border: 1px solid var(--stroke);
  border-radius: 12px; padding: 14px 16px;
}
.ad-stat-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 10px;
}
.ad-stat-badge { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.ad-stat-badge strong { font-weight: 800; font-size: 15px; }
.ad-stat-badge .gid { color: var(--muted); font-size: 12px; font-family: ui-monospace, Menlo, monospace; }
.ad-stat-numbers { display: flex; gap: 6px; flex-wrap: wrap; }
.stat-pill {
  display: inline-flex; flex-direction: column; align-items: center;
  padding: 4px 10px; border-radius: 8px;
  background: rgba(255,255,255,0.04); border: 1px solid var(--stroke);
  min-width: 46px;
}
.stat-pill em { color: var(--muted); font-style: normal; font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 700; }
.stat-pill { font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-pill.total { background: rgba(34,168,240,0.12); border-color: rgba(34,168,240,0.30); color: var(--blue-2); }

.ad-text-preview {
  background: var(--bg); border: 1px solid var(--stroke-2); border-radius: 8px;
  padding: 10px 12px; margin: 0;
  font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; line-height: 1.5;
  white-space: pre-wrap; word-break: break-word;
  max-height: 220px; overflow-y: auto;
}
.ad-stat-foot { font-size: 12px; margin-top: 8px; }

/* Join-limit controls inside a creative card */
.ad-limit-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 10px; padding: 10px 12px;
  background: rgba(255,255,255,0.03); border: 1px solid var(--stroke);
  border-radius: 8px;
}
.ad-limit-row input[type="number"] {
  width: 130px; min-width: 0;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--stroke-2); border-radius: 8px;
  padding: 6px 10px; font-family: ui-monospace, Menlo, monospace; font-size: 13px;
}
.ad-limit-row input[type="number"]:focus { outline: none; border-color: var(--blue); }
.ad-limit-row .btn-mini {
  display: inline-flex; align-items: center;
  padding: 6px 12px; font-size: 11.5px; font-weight: 700;
  border-radius:8px; border: 1px solid var(--stroke-2);
  background: rgba(255,255,255,0.04); color: var(--text); cursor: pointer;
}
.ad-limit-row .btn-mini:hover { background: rgba(255,255,255,0.08); }

/* --- Toast --- */
.toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 100;
  background: var(--panel-2); border: 1px solid var(--stroke-2);
  padding: 12px 18px; border-radius: 10px; font-size: 14px;
  box-shadow: 0 20px 40px -10px rgba(0,0,0,0.6);
  max-width: 380px;
}
.toast.err { border-color: rgba(237,66,69,0.6); color: #ffb0b1; }
.toast.ok  { border-color: rgba(87,242,135,0.5); }

/* --- Responsive --- */
/* 900px: sidebar collapses, content goes full-width, tabs become a swipeable strip */
@media (max-width: 900px) {
  #app { grid-template-columns: 1fr; }
  .sidebar {
    border-right: none; border-bottom: 1px solid var(--stroke);
    padding: 12px 14px;
    flex-direction: row; align-items: center; flex-wrap: wrap; gap: 8px;
  }
  .brand-sm { margin-bottom: 0; margin-right: 4px; }
  .sidebar #logout { margin-top: 0; margin-left: auto; padding: 7px 12px; }
  /* Tabs become a horizontally swipeable strip */
  .tabs {
    flex-direction: row; flex-wrap: nowrap; margin-top: 0;
    width: 100%; order: 3;
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    scrollbar-width: none; -ms-overflow-style: none;
    padding-bottom: 2px; /* keeps active-tab outline from clipping at the strip edge */
  }
  .tabs::-webkit-scrollbar { display: none; }
  .cab-links { flex-direction: row; flex-wrap: wrap; margin-top: 0; padding-top: 0; border-top: none; order: 4; width: 100%; }
  .cab-links .cl-link { padding: 6px 10px; font-size: 13px; }
  /* Tabs: ≥40px tall, easy to tap */
  .tab { white-space: nowrap; padding: 10px 14px; font-size: 13.5px; min-height: 40px; }
  .content { padding: 18px 14px; max-width: 100%; }
  .pane h1 { font-size: 21px; }

  .cards { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
  .stat-card { padding: 12px 14px; }
  .stat-card .v { font-size: 20px; }

  /* Big tables: scroll horizontally, never squish columns */
  .table-wrap { -webkit-overflow-scrolling: touch; }
  .stat-table { font-size: 13px; min-width: 480px; }
  .card-stats { min-width: 0; } /* compact funnel table — stays at natural width */
  .stat-table th, .stat-table td { padding: 8px 8px; }
  .stat-table .actions { flex-wrap: wrap; }

  .filters { padding: 10px; gap: 8px; }
  .filters input, .filters select { flex: 1 1 140px; min-width: 120px; }

  .modal-overlay { padding: 10px; align-items: flex-start; }
  .modal { max-height: calc(100vh - 20px); border-radius: 12px; }
  .modal-body { padding: 18px 14px; }
  .modal .kv-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px 14px; }
  .settings-grid { grid-template-columns: 1fr; }

  .ad-stat-head { flex-direction: column; align-items: stretch; }
  .ad-limit-row input[type="number"] { flex: 1; width: auto; }

  .lot-field input { width: 130px; }

  .toast { left: 12px; right: 12px; bottom: 12px; max-width: none; }
}

/* Phone (≤600px): stack controls, full-width buttons, near-full modals */
@media (max-width: 600px) {
  .content { padding: 14px 12px; }
  .pane h1 { font-size: 19px; }
  .pane h2 { font-size: 16px; }

  /* Tabs: slightly taller for easier tap */
  .tab { padding: 10px 12px; font-size: 13px; min-height: 42px; }

  /* Modals: near-full-width, top-aligned, internal scroll keeps close button reachable */
  .modal { width: calc(100vw - 20px); max-width: none; max-height: calc(100vh - 20px); }
  .modal-overlay { align-items: flex-start; padding: 10px; }
  .modal-close { top: 10px; right: 10px; min-width: 36px; min-height: 36px; display: inline-flex; align-items: center; justify-content: center; }
  .modal .kv-grid { grid-template-columns: 1fr 1fr; }

  /* Filter bars: stack to full-width columns, ≥40px tap height */
  .filters { flex-direction: column; }
  .filters input, .filters select { width: 100%; min-width: 0; flex: none; min-height: 40px; box-sizing: border-box; }
  .filters .btn { width: 100%; min-height: 40px; justify-content: center; }

  /* Activity-log filter strip */
  .plog-filters { flex-direction: column; }
  .plog-sel, .plog-inp { width: 100%; min-width: 0; min-height: 40px; box-sizing: border-box; }
  .plog-filters .btn { width: 100%; min-height: 40px; }

  /* Lot form: stacked column, full-width fields */
  .lot-form { flex-direction: column; gap: 10px; }
  .lot-field { width: 100%; }
  .lot-field input { width: 100%; }
  .lot-form > .btn { width: 100%; min-height: 44px; }

  /* Emergency tab — card action buttons: full-width, thumb-friendly */
  .cardrow-actions { flex-direction: column; gap: 6px; }
  .cardrow-actions .btn-mini {
    width: 100%; justify-content: center; text-align: center;
    min-height: 42px; border-radius: 10px;
  }

  /* Stats activity chart bar: column layout */
  .vchart-bar { flex-direction: column; align-items: stretch; gap: 8px; }
  .vchart-tiles { justify-content: flex-start; }

  /* CPC calibration rate slider: stack label + range */
  .calib-rate-ctl { flex-direction: column; align-items: stretch; }
  .calib-rate-ctl input[type=range] { min-width: 0; width: 100%; }

  /* Calibration server card header: was one cramped flex row where the conversion,
     server id and the two buttons overlapped. Now the icon + name + conversion sit on
     the first line and each action button drops to its own full-width, tappable row. */
  .calib-srv-head { flex-wrap: wrap; row-gap: 10px; }
  .calib-srv-conv { margin-right: 0; }
  .calib-run, .calib-off {
    flex: 1 1 100%; min-height: 42px;
    display: flex; align-items: center; justify-content: center; text-align: center;
  }

  /* User-bots add row: respect full container width */
  .bf-add-row { max-width: 100%; }

  /* Tables: tighter min-width so the scroll starts later on real phones */
  .stat-table { min-width: 360px; font-size: 12.5px; }
  .stat-table th, .stat-table td { padding: 7px 6px; }

  /* Settings bar buttons: comfortable tap height */
  .settings-bar .btn { min-height: 40px; }
}

/* Small phones (≤400px) */
@media (max-width: 400px) {
  .pane h1 { font-size: 18px; flex-direction: column; align-items: flex-start; }
  .stat-pill { min-width: 38px; padding: 3px 6px; font-size: 12px; }
  .login-card { padding: 20px 14px; }
  #code { font-size: 18px; letter-spacing: 5px; }

  .tab { padding: 10px 10px; font-size: 12.5px; }

  /* kv-grid: single column on very narrow screens */
  .modal .kv-grid { grid-template-columns: 1fr; }

  /* Calibration grids: tighten to 1 column */
  .calib-srv-stats { grid-template-columns: 1fr; }
  /* bf-summary: 1 column so values breathe */
  .bf-summary { grid-template-columns: 1fr; }

  /* Tables: minimal sizing for 320px screens */
  .stat-table { min-width: 300px; font-size: 12px; }
  .stat-table th, .stat-table td { padding: 6px 5px; }

  .toast { padding: 10px 13px; font-size: 13px; }
}

/* Verification-card management ("Экстренно" tab) */
.cardrow { border: 1px solid var(--stroke-2); border-radius: 12px; padding: 14px 16px; margin-bottom: 12px; background: rgba(255,255,255,.02); }
.cardrow-head { display: flex; align-items: center; gap: 9px; font-size: 14px; }
.cardrow-head a { color: var(--blue, #4aa8ff); text-decoration: none; }
.cardrow-meta { margin-top: 8px; font-size: 13px; color: var(--muted); display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.cardrow-meta b { color: var(--text); }
.cardrow-members { margin: 3px 0 0 37px; font-size: 12px; }
.cardrow-conv { margin-top: 8px; font-size: 12.5px; color: var(--muted); display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.cardrow-conv b { color: var(--text); font-size: 14px; }
.conv-tag { font-size: 11px; font-weight: 600; color: var(--amber, #f0b23a); border: 1px solid rgba(240,178,58,.45); border-radius:8px; padding: 1px 8px; }
.card-stats { width: auto; margin: 12px 0 10px; border-collapse: collapse; font-size: 12.5px; }
.card-stats th, .card-stats td { padding: 4px 16px 4px 0; text-align: left; white-space: nowrap; }
.card-stats th { color: var(--muted); font-weight: 600; }
.card-stats td.num, .card-stats th.num { text-align: right; font-variant-numeric: tabular-nums; min-width: 44px; }
.cardrow-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.cardrow-actions .btn-mini {
  font-size: 12px; padding: 5px 11px; border-radius: 8px; cursor: pointer;
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.14); color: var(--text);
}
.cardrow-actions .btn-mini:hover { background: rgba(255,255,255,0.09); border-color: rgba(255,255,255,0.24); }
.cardrow-actions .btn-mini.ok  { background: rgba(87,242,135,0.14); border-color: rgba(87,242,135,0.35); color: var(--green); }
.cardrow-actions .btn-mini.ok:hover  { background: rgba(87,242,135,0.22); }
.cardrow-actions .btn-mini.off { background: rgba(237,66,69,0.14); border-color: rgba(237,66,69,0.35); color: var(--red); }
.cardrow-actions .btn-mini.off:hover { background: rgba(237,66,69,0.22); }
.cardrow-actions .btn-mini:disabled,
.cardrow-actions .btn-mini[disabled] { opacity: .4; cursor: not-allowed; background: rgba(255,255,255,0.03); }
.cardrow-actions .btn-mini:disabled:hover { background: rgba(255,255,255,0.03); border-color: rgba(255,255,255,0.14); }

.cardrow.deleted { border-color: rgba(237,66,69,.3); background: rgba(237,66,69,.05); }

/* Activity log (журнал) */
.plog-filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.plog-sel, .plog-inp { background: var(--panel-2); color: var(--text); border: 1px solid var(--stroke-2); border-radius: 9px; padding: 8px 11px; font-size: 13px; font-family: inherit; font-weight: 600; }
.plog-sel:focus, .plog-inp:focus { outline: none; border-color: var(--blue-2); }
/* kill the native (white) dropdown arrow; use a custom chevron */
.plog-sel { appearance: none; -webkit-appearance: none; -moz-appearance: none; cursor: pointer; padding-right: 30px; background-color: var(--panel-2); 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='%238b97ab' stroke-width='2.5' 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 10px center; background-size: 12px; }
.plog-sel::-ms-expand { display: none; }
.plog-inp { min-width: 150px; }
#alog-list, #plog-list { display: flex; flex-direction: column; gap: 6px; }
.plog-row { display: flex; align-items: center; gap: 12px; background: var(--panel); border: 1px solid var(--stroke); border-radius: 11px; padding: 11px 14px; }
.plog-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--muted); }
.plog-g .plog-dot { background: var(--green); }
.plog-d .plog-dot { background: var(--red); }
.plog-u .plog-dot { background: var(--amber); }
.plog-main { flex: 1; min-width: 0; }
.plog-title { font-size: 13.5px; font-weight: 700; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.plog-tag { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius:8px; background: rgba(255,255,255,.07); color: var(--muted); }
.plog-sub { margin-top: 3px; font-size: 12px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; }
.plog-sv { color: var(--blue-2); }
.plog-usr { font-variant-numeric: tabular-nums; }
.plog-sp { color: var(--muted); }
.plog-sp::before { content: '→ '; opacity: .6; }
.plog-d .plog-sp::before, .plog-u .plog-sp::before { content: '← '; }
.plog-right { display: flex; align-items: center; gap: 12px; flex: none; white-space: nowrap; }
.plog-amt { font-weight: 800; font-size: 14px; }
.plog-amt.pos { color: var(--green); }
.plog-amt.neg { color: var(--red); }
.plog-time { font-size: 12px; color: var(--muted); }
@media (max-width: 560px) { .plog-right { flex-direction: column; align-items: flex-end; gap: 2px; } }
.plog-pager { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.plog-pager .wd-page { font-variant-numeric: tabular-nums; }
.plog-pager button:disabled { opacity: .4; cursor: not-allowed; }

/* Lots / auctions */
/* Verification activity chart (Statistics) */
.vchart-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin: 12px 0 8px; }
.vchart-ranges { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.vchart-ranges button { padding: 6px 12px; font-size: 12.5px; font-weight: 600; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--stroke-2, #333); background: rgba(255,255,255,.03); color: var(--muted); }
.vchart-ranges button:hover { color: var(--text); }
.vchart-ranges button.active { background: #22a8f0; border-color: #22a8f0; color: #fff; }
.vchart-tiles { display: inline-flex; gap: 8px; }
.vtile { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; padding: 6px 12px; border-radius: 9px;
  border: 1px solid var(--stroke, #2a2a33); background: rgba(255,255,255,.02); min-width: 74px; }
.vtile i { font-style: normal; font-size: 10px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.vtile b { font-size: 16px; font-variant-numeric: tabular-nums; }
.vchart-wrap { position: relative; border: 1px solid var(--stroke, #2a2a33); border-radius: 12px; background: rgba(255,255,255,.02);
  padding: 4px 4px 0; overflow: hidden; }
.vchart-wrap canvas { display: block; cursor: crosshair; }
.vchart-tip { position: absolute; z-index: 5; pointer-events: none; min-width: 150px; padding: 8px 10px; border-radius: 9px;
  border: 1px solid var(--stroke-2, #3a3a44); background: rgba(20,20,26,.96); box-shadow: 0 6px 20px rgba(0,0,0,.45); font-size: 12px; }
.vtip-t { font-weight: 700; margin-bottom: 5px; }
.vtip-r { display: flex; align-items: center; gap: 6px; line-height: 1.6; }
.vtip-r i { width: 8px; height: 8px; border-radius: 2px; flex: 0 0 auto; }
.vtip-r span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 160px; color: var(--muted); }
.vtip-r b { font-variant-numeric: tabular-nums; }
.vchart-metrics { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.vmchip { display: inline-flex; align-items: center; gap: 7px; padding: 6px 11px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--stroke-2, #333); background: rgba(255,255,255,.03); color: var(--muted); font-size: 12.5px; font-weight: 600; }
.vmchip:hover { color: var(--text); }
.vmchip.active { border-color: var(--vc, #22a8f0); color: var(--text); background: color-mix(in srgb, var(--vc, #22a8f0) 16%, transparent); }
.vmchip:not(.active) .vchip-dot { opacity: .35; }
.vchart-note { margin: 0 0 8px; }
.vchart-servers { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 4px; }
.vchip { display: inline-flex; align-items: center; gap: 6px; max-width: 230px; padding: 5px 9px; border-radius:8px; cursor: pointer;
  border: 1px solid var(--stroke-2, #333); background: rgba(255,255,255,.03); color: var(--muted); font-size: 12px; }
.vchip:hover { color: var(--text); }
.vchip.active { border-color: var(--vc, #22a8f0); color: var(--text); background: color-mix(in srgb, var(--vc, #22a8f0) 14%, transparent); }
.vchip img { width: 16px; height: 16px; border-radius: 50%; object-fit: cover; flex: 0 0 auto; }
.vchip-dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
.vchip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vchip i { font-style: normal; font-variant-numeric: tabular-nums; opacity: .65; }

/* Vemoni network funnel card (Statistics) */
.vemoni-card { border: 1px solid var(--stroke, #2a2a33); border-radius: 12px; padding: 14px 16px; margin: 16px 0; background: rgba(255,255,255,.02); max-width: 560px; }
.vemoni-card .ref-head { display: flex; align-items: center; gap: 11px; }
.vemoni-card .ref-av { width: 38px; height: 38px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; flex: 0 0 auto; }
.vemoni-card .vemoni-av { object-fit: cover; background: transparent; }
.vemoni-card .ref-id { display: flex; flex-direction: column; line-height: 1.25; }
.vemoni-card table { width: 100%; border-collapse: collapse; }
.vemoni-card th, .vemoni-card td { text-align: left; padding: 5px 8px; font-size: 13px; border-bottom: 1px solid var(--stroke, #26262e); }
.vemoni-card th.num, .vemoni-card td.num { text-align: right; font-variant-numeric: tabular-nums; }
.vemoni-card thead th { color: var(--muted); font-weight: 600; font-size: 12px; }

/* Settings / runtime config */
.settings-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 12px 0 18px; }
.cfg-cat { margin: 18px 0; }
.cfg-cat h2 { font-size: 15px; margin: 0 0 10px; }
.cfg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.cfg-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.cfg-label { font-size: 12.5px; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cfg-input { width: 100%; box-sizing: border-box; padding: 8px 11px; font-size: 13px; border-radius: 8px; border: 1px solid var(--stroke-2, #333); background: rgba(255,255,255,.03); color: var(--text); font-family: inherit; }
.cfg-input:focus { outline: none; border-color: var(--blue-2, #22a8f0); }
textarea.cfg-input { resize: vertical; word-break: break-all; }
.cfg-help { line-height: 1.35; }
.cfg-badge { font-size: 10px; font-weight: 700; padding: 1px 7px; border-radius:8px; background: rgba(240,160,42,.16); color: #f0a02a; }
.cfg-badge.live { background: rgba(52,199,89,.16); color: #34c759; }
.cfg-clear { display: inline-flex; align-items: center; gap: 5px; }
.cfg-srow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cfg-reveal { cursor: pointer; }
.cfg-reserve { grid-column: 1 / -1; margin-top: 10px; padding: 10px 12px; border-radius: 9px;
  border: 1px solid var(--stroke, #2a2a33); background: rgba(255,255,255,.02); display: flex; flex-direction: column; gap: 6px; }
.cfg-res-h { font-size: 12.5px; }
.cfg-res-list { display: flex; flex-wrap: wrap; gap: 6px; }
.cfg-res-g { padding: 3px 9px; border-radius:8px; font-size: 11.5px; background: rgba(52,199,89,.14); color: #34c759; }

.lot-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin: 14px 0 8px; }
.lot-field { display: flex; flex-direction: column; gap: 5px; }
.lot-field label { font-size: 12px; color: var(--muted); font-weight: 600; }
.lot-field input, #lot-template, #lot-channel-name {
  background: var(--bg); color: var(--text);
  border: 1px solid var(--stroke-2); border-radius: 8px;
  padding: 9px 12px; font-size: 13.5px; font-family: inherit;
}
.lot-field input { width: 170px; }
.lot-field input:focus, #lot-template:focus, #lot-channel-name:focus { outline: none; border-color: var(--blue); }
#lot-channel-name { display: block; box-sizing: border-box; }
#lot-template { display: block; resize: vertical; min-height: 110px; line-height: 1.5; }
#lots-list { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.lot-card { background: var(--panel); border: 1px solid var(--stroke); border-radius: 12px; padding: 14px 16px; }
.lot-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.lot-title { font-weight: 700; font-size: 16px; }
.lot-meta { margin-top: 6px; }
.lot-result { margin-top: 8px; }
.lot-bids { margin-top: 8px; }
.lot-bids summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.lot-bid { display: flex; gap: 10px; align-items: center; padding: 5px 0; border-top: 1px solid var(--stroke); }
.lot-bid span:first-child { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* clickable usernames / server names → partner cabinet */
.ulink{color:inherit;text-decoration:none;border-bottom:1px dashed rgba(140,160,180,.5);cursor:pointer}
.ulink:hover{color:var(--blue-2,#5cc3ff);border-bottom-color:var(--blue-2,#5cc3ff)}

/* ---------- CPC calibration tab ---------- */
.calib-summary{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:10px;margin:14px 0}
.calib-kpi{background:var(--panel);border:1px solid var(--stroke);border-radius:12px;padding:12px 14px;display:flex;flex-direction:column;gap:4px}
.calib-kpi span{color:var(--muted);font-size:12px}
.calib-kpi b{font-size:20px;font-weight:700}
.calib-rate-box{margin:6px 0 18px}
.calib-rate{background:var(--panel);border:1px solid var(--stroke);border-radius:12px;padding:14px 16px}
.calib-rate>label{display:block;margin-bottom:10px}
.calib-rate-ctl{display:flex;align-items:center;gap:12px;flex-wrap:wrap}
.calib-rate-ctl input[type=range]{flex:1;min-width:180px;accent-color:var(--blue-2,#5cc3ff)}
.calib-rate-ctl #calib-rate-val{min-width:44px;font-weight:700;font-variant-numeric:tabular-nums}
.calib-servers{display:flex;flex-direction:column;gap:12px}
.calib-srv{background:var(--panel);border:1px solid var(--stroke);border-radius:14px;padding:14px 16px}
.calib-srv-head{display:flex;align-items:center;gap:12px}
.calib-ic{width:40px;height:40px;border-radius:10px;object-fit:cover;flex:none}
.calib-ic.ph{background:var(--panel-2)}
.calib-srv-name{display:flex;flex-direction:column;min-width:0;flex:1}
.calib-srv-name b{font-size:15px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.calib-srv-name .uid{color:var(--muted);font-size:11px;font-variant-numeric:tabular-nums}
.calib-srv-conv{display:flex;flex-direction:column;align-items:flex-end;margin-right:6px}
.calib-srv-conv span{color:var(--muted);font-size:11px}
.calib-srv-conv b{font-size:18px;font-weight:700}
.calib-srv-stats{display:grid;grid-template-columns:repeat(auto-fit,minmax(160px,1fr));gap:8px 16px;margin-top:12px;padding-top:12px;border-top:1px solid var(--stroke)}
.calib-srv-stats>div{display:flex;flex-direction:column;gap:2px}
.calib-srv-stats span{color:var(--muted);font-size:12px}
.calib-srv-stats b{font-size:14px;font-weight:600;font-variant-numeric:tabular-nums}
.calib-run{background:rgba(88,101,242,.16);border:1px solid rgba(88,101,242,.42);color:var(--text)}
.calib-run:hover{background:rgba(88,101,242,.26)}
.calib-run.running{background:rgba(240,178,58,.16);border-color:rgba(240,178,58,.5);color:var(--amber,#f0b23a)}
.calib-cards{margin-top:12px;display:flex;flex-direction:column;gap:6px}
.calib-card{display:flex;align-items:center;gap:14px;flex-wrap:wrap;font-size:12px;color:var(--muted);background:var(--panel-2);border-radius:8px;padding:7px 10px}
.calib-card b{color:var(--text)}
.calib-card-role{flex:1;min-width:140px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

/* Stays category — embedded orders cabinet (chrome-less iframe) */
.stays-pane{padding:0}
.stays-frame{width:100%;height:calc(100vh - 64px);border:0;display:block;background:var(--bg);border-radius:12px}
