:root {
    --bg: #0e100f;
    --bg-soft: #121412;
    --bg-card: #171a18;
    --bg-tertiary: #212523;
    --bg-hover: #2a2f2c;
    --border: #2a2e2b;
    --border-soft: #1e211f;
    --text: #ffffff;
    --muted: #a0a5a1;
    --dim: #6d726e;
    --green: #34d399;
    --green-soft: rgba(52,211,153,0.10);
    --amber: #fbbf24;
    --amber-soft: rgba(251,191,36,0.10);
    --red: #f87171;
    --red-soft: rgba(248,113,113,0.12);
    --accent: #10b981;
    --accent-strong: #059669;
    --accent-soft: rgba(16,185,129,0.14);
    --accent-2: #34d399;
    --rose: #fb7185;
    --rose-soft: rgba(251,113,133,0.12);
    --radius: 12px;
    --sidebar-w: 240px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    background:
        radial-gradient(900px 460px at 82% -8%, rgba(16,185,129,0.06), transparent 60%),
        radial-gradient(760px 400px at -8% 26%, rgba(16,185,129,0.04), transparent 60%),
        var(--bg);
    background-attachment: fixed;
    color: var(--text);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-size: 14px;
    min-height: 100vh;
}
.logo-font { font-family: 'Space Grotesk', sans-serif; letter-spacing: -0.02em; }
.mono { font-family: 'Space Grotesk', ui-monospace, monospace; }

/* ── layout ── */
.layout { display: flex; min-height: 100vh; }
.main { margin-left: var(--sidebar-w); flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* ── sidebar ── */
.sidebar {
    position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w);
    background: linear-gradient(180deg, #171a18, #0e100f);
    border-right: 1px solid var(--border-soft);
    display: flex; flex-direction: column; z-index: 60;
}
.side-brand { display: flex; align-items: center; gap: 11px; padding: 20px 18px; border-bottom: 1px solid var(--border-soft); }
.side-logo {
    width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0;
    background: var(--accent-strong);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 17px; color: #fff;
    box-shadow: 0 4px 14px rgba(5,150,105,0.30);
}
.side-name { font-size: 17px; font-weight: 700; letter-spacing: 0.02em; }
.side-sub { color: var(--dim); font-size: 11px; margin-top: 1px; }
.side-nav { flex: 1; padding: 14px 10px; display: flex; flex-direction: column; gap: 4px; }
.nav-item {
    display: flex; align-items: center; gap: 11px;
    padding: 11px 13px; border: 0; border-radius: 8px;
    background: transparent; color: var(--muted);
    font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; text-align: left;
    width: 100%; transition: background 0.15s, color 0.15s;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover { background: var(--bg-tertiary); color: var(--text); }
.nav-item.active {
    background: var(--accent-strong);
    color: #fff;
    box-shadow: 0 6px 18px rgba(5,150,105,0.30);
}
.side-foot { padding: 14px 18px; border-top: 1px solid var(--border-soft); }
.side-version { color: var(--dim); font-size: 11px; margin-bottom: 10px; }
.side-logout {
    display: flex; align-items: center; gap: 9px; text-decoration: none;
    color: var(--muted); font-size: 13px; font-weight: 500; padding: 8px 0;
}
.side-logout:hover { color: var(--red); }
.side-logout svg { width: 16px; height: 16px; }

/* ── topbar ── */
.topbar {
    position: sticky; top: 0; z-index: 50;
    background: rgba(10,10,10,0.86);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-soft);
    padding: 14px 26px;
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.page-title { font-size: 19px; font-weight: 700; }
.page-title .sub { color: var(--muted); font-size: 13px; font-weight: 400; margin-left: 8px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.icon-btn {
    width: 38px; height: 38px; border-radius: 8px; border: 1px solid var(--border);
    background: var(--bg-card); color: var(--muted); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
.icon-btn:hover { color: var(--text); border-color: var(--dim); }
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn.danger { color: var(--red); }
.icon-btn.danger:hover { color: var(--red); border-color: rgba(248,113,113,.4); background: var(--red-soft); }

/* ── content ── */
.content { padding: 24px 26px 40px; }

.flash {
    position: fixed; top: 0; left: 50%; transform: translate(-50%, -150%); z-index: 1000;
    padding: 13px 20px; border-radius: 12px; font-size: 14px;
    border: 1px solid; width: max-content; max-width: min(90vw, 480px);
    box-shadow: 0 16px 48px rgba(0,0,0,0.5);
    opacity: 0; pointer-events: none;
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.35s ease;
}
.flash.show { transform: translate(-50%, 18px); opacity: 1; }
.flash.ok { background: var(--green-soft); border-color: rgba(34,197,94,0.4); color: var(--green); }
.flash.err { background: var(--red-soft); border-color: rgba(239,68,68,0.4); color: var(--red); }

/* ── sections ── */
.section-title { font-size: 15px; font-weight: 600; margin: 26px 0 12px; }
.section-title .hint { color: var(--dim); font-weight: 400; font-size: 12px; margin-left: 8px; }
.section-title:first-child { margin-top: 0; }

/* ── cards / stat ── */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.card {
    background: var(--bg-card); border: 1px solid var(--border-soft);
    border-radius: var(--radius); padding: 18px;
    display: flex; gap: 14px; align-items: flex-start;
}
.card-icon {
    width: 42px; height: 42px; border-radius: 10px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg-tertiary); color: var(--muted);
}
.card-icon svg { width: 20px; height: 20px; }
.card-icon.ci-rose { background: var(--rose-soft); color: var(--rose); }
.card-icon.ci-amber { background: var(--amber-soft); color: var(--amber); }
.card-icon.ci-green { background: var(--green-soft); color: var(--green); }
.stat-value { font-size: 24px; font-weight: 700; font-family: 'Space Grotesk', sans-serif; line-height: 1.1; }
.stat-label { color: var(--muted); font-size: 12px; margin-top: 4px; }
.stat-sub { color: var(--dim); font-size: 11px; margin-top: 2px; }

/* ── panel ── */
.panel {
    background: var(--bg-card); border: 1px solid var(--border-soft);
    border-radius: var(--radius); overflow: hidden; margin-top: 16px;
}
.panel-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 14px; padding: 16px 18px; flex-wrap: wrap;
    border-bottom: 1px solid var(--border-soft);
}
.panel-title { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 10px; }
.count-badge {
    font-size: 12px; font-weight: 600; color: var(--muted);
    background: var(--bg-tertiary); border: 1px solid var(--border);
    border-radius: 20px; padding: 3px 10px;
}
.search { display: flex; gap: 8px; }
.search .inp { width: 240px; }
.panel-foot {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; padding: 14px 18px; border-top: 1px solid var(--border-soft); flex-wrap: wrap;
}
.page-info { color: var(--dim); font-size: 13px; }
.pager { display: flex; gap: 6px; align-items: center; }
.page-btn {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 34px; height: 34px; padding: 0 12px; border-radius: 7px;
    border: 1px solid var(--border); background: var(--bg-soft); color: var(--muted);
    text-decoration: none; font-size: 13px; font-weight: 500;
}
.page-btn:hover:not(.disabled) { color: var(--text); border-color: var(--dim); }
.page-btn.disabled { opacity: 0.4; pointer-events: none; }
.page-btn.current { background: var(--accent-strong); border-color: transparent; color: #fff; }

/* ── table ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
.info-table td { white-space: normal; padding: 8px 4px; border-bottom: 1px solid var(--border-soft); }
.info-table td:first-child { color: var(--dim); font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; width: 40%; }
th, td { text-align: left; padding: 11px 18px; border-bottom: 1px solid var(--border-soft); white-space: nowrap; }
th { color: var(--dim); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; background: var(--bg-soft); }
tbody tr:hover { background: var(--bg-hover); }
tr:last-child td { border-bottom: 0; }
.positive { color: var(--green); }
.negative { color: var(--red); }
.neutral { color: var(--muted); }
.dim { color: var(--dim); }

/* ── badges ── */
.badge {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 12px; font-weight: 500; padding: 3px 11px; border-radius: 20px;
    border: 1px solid var(--border); background: var(--bg-tertiary);
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--dim); }
.b-connected { color: var(--green); border-color: rgba(34,197,94,0.4); background: var(--green-soft); }
.b-connected::before { background: var(--green); }
.b-pending_code, .b-pending_password, .b-new { color: var(--amber); border-color: rgba(250,204,21,0.4); background: var(--amber-soft); }
.b-pending_code::before, .b-pending_password::before, .b-new::before { background: var(--amber); }
.b-error { color: var(--red); border-color: rgba(239,68,68,0.4); background: var(--red-soft); }
.b-error::before { background: var(--red); }

/* ── inputs / buttons ── */
.inp {
    width: 100%; background: var(--bg-soft); color: var(--text);
    border: 1px solid var(--border); border-radius: 8px;
    padding: 10px 13px; font-size: 14px; outline: none; font-family: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.inp:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.inp::placeholder { color: var(--dim); }
.inp-sm { width: auto; padding: 7px 11px; font-size: 13px; }
.btn {
    background: var(--bg-soft); color: var(--text);
    border: 1px solid var(--border); border-radius: 8px;
    padding: 10px 16px; font-size: 14px; font-weight: 500; cursor: pointer; font-family: inherit;
    transition: background 0.15s, border-color 0.15s;
}
.btn:hover { border-color: var(--dim); background: var(--bg-hover); }
.btn.primary {
    background: var(--accent-strong); border-color: transparent; color: #fff;
    box-shadow: 0 4px 14px rgba(5,150,105,0.24);
}
.btn.primary:hover { background: #047857; box-shadow: 0 6px 18px rgba(5,150,105,0.32); }
.btn.danger { color: var(--red); border-color: rgba(239,68,68,0.4); background: transparent; padding: 7px 12px; font-size: 13px; }
.btn.danger:hover { background: var(--red-soft); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.add-row { display: flex; gap: 10px; flex-wrap: wrap; }
.add-row .inp { flex: 1; min-width: 220px; }

/* ── bot page ── */
.bot-hero {
    position: relative;
    display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap;
    padding: 20px 22px; margin-bottom: 22px;
    border-radius: 14px;
    background: linear-gradient(120deg, rgba(16,185,129,0.10), transparent 60%), var(--bg-card);
    border: 1px solid rgba(16,185,129,0.28);
    overflow: hidden;
}
.bot-hero::after {
    content: ''; position: absolute; top: -70%; right: -4%;
    width: 320px; height: 320px; border-radius: 50%;
    background: radial-gradient(circle, rgba(16,185,129,0.20), transparent 70%);
    pointer-events: none;
}
.bot-hero-main { display: flex; align-items: center; gap: 14px; position: relative; z-index: 1; }
.bot-hero-icon {
    width: 46px; height: 46px; border-radius: 12px; flex-shrink: 0;
    background: var(--accent-strong); color: #fff;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 6px 18px rgba(5,150,105,0.32);
}
.bot-hero-icon svg { width: 22px; height: 22px; }
.bot-hero-title { font-size: 17px; font-weight: 700; }
.bot-status { display: flex; align-items: center; gap: 8px; margin-top: 3px; font-size: 13px; color: var(--muted); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dim); position: relative; }
.status-dot.on { background: var(--green); box-shadow: 0 0 0 4px var(--green-soft); }
.status-dot.off { background: var(--red); box-shadow: 0 0 0 4px var(--red-soft); }
.status-dot.pending { background: var(--amber); box-shadow: 0 0 0 4px var(--amber-soft); }

.acct { display: flex; flex-direction: row; align-items: center; gap: 12px; transition: border-color 0.15s, transform 0.15s; position: relative; }
.acct:hover { border-color: var(--border); }
.acct-avatar {
    width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0; position: relative;
    background: var(--accent-strong); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 17px;
    box-shadow: 0 4px 12px rgba(5,150,105,0.24);
    overflow: hidden;
}
.acct-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.acct-avatar-fallback { line-height: 1; }
.acct-info { min-width: 0; }
.acct-nick { font-weight: 600; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 6px; }
.acct-tgid { color: var(--muted); font-size: 12px; margin-top: 2px; }
.acct-flag {
    width: 22px; height: 15px; border-radius: 3px; flex-shrink: 0; overflow: hidden;
    background: var(--bg-tertiary); border: 1px solid var(--border-soft);
    object-fit: cover; vertical-align: text-bottom; display: inline-block; line-height: 0;
}
.phone { font-weight: 600; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acct-sub { color: var(--muted); font-size: 12px; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acct-sub .dim { color: var(--dim); }
.err-text { color: var(--red); font-size: 12px; margin-top: 10px; }
.pending-row { display: flex; gap: 8px; margin-top: 12px; align-items: center; }
.pending-row .inp { flex: 1; }
.toggles { display: flex; flex-direction: column; gap: 10px; }
.tgl { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--muted); cursor: pointer; user-select: none; }
.tgl:hover { color: var(--text); }
.switch { position: relative; display: inline-block; width: 40px; height: 22px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track {
    position: absolute; inset: 0; border-radius: 999px;
    background: var(--bg-tertiary); border: 1px solid var(--border);
    transition: background 0.2s, border-color 0.2s;
}
.switch .track::after {
    content: ''; position: absolute; width: 16px; height: 16px; border-radius: 50%;
    background: var(--dim); top: 2px; left: 2px; transition: transform 0.2s, background 0.2s;
}
.switch input:checked + .track { background: var(--accent-strong); border-color: var(--accent-strong); }
.switch input:checked + .track::after { transform: translateX(18px); background: #fff; }
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px var(--accent-soft); }

.suburls-edit { margin-top: 14px; border-top: 1px solid var(--border-soft); padding-top: 12px; }
.suburls-edit summary { cursor: pointer; color: var(--muted); font-size: 13px; user-select: none; }
.suburls-edit summary:hover { color: var(--text); }
.suburls-edit textarea { margin-top: 8px; }

.empty { color: var(--dim); font-size: 14px; padding: 24px; text-align: center; }

.logs { font-size: 12px; font-family: 'Space Grotesk', ui-monospace, monospace; }
.log-line { padding: 6px 18px; border-bottom: 1px solid var(--border-soft); display: flex; gap: 12px; align-items: flex-start; }
.log-line:last-child { border-bottom: 0; }
.log-ts { color: var(--dim); white-space: nowrap; padding-top: 2px; }
.log-lv {
    flex-shrink: 0; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
    padding: 2px 8px; border-radius: 6px; align-self: flex-start; margin-top: 1px;
}
.log-lv.lv-info { background: var(--accent-soft); color: var(--accent); }
.log-lv.lv-warn { background: var(--amber-soft); color: var(--amber); }
.log-lv.lv-error { background: var(--red-soft); color: var(--red); }
.log-lv.lv-success { background: var(--green-soft); color: var(--green); }
.log-msg { color: var(--muted); word-break: break-all; }
.log-msg.warn { color: var(--amber); }
.log-msg.error { color: var(--red); }

.hint { color: var(--dim); font-size: 12px; margin-top: 12px; line-height: 1.6; }

/* ── bot page v2 ── */
.bot-hero-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; position: relative; z-index: 1; }
.bot-hero-meta { color: var(--dim); font-size: 12px; margin-top: 6px; }
.bot-hero-meta .mono { color: var(--muted); }
.icon-btn.spin svg { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.bot-stats { margin-bottom: 22px; }

/* ── bot page v2 layout ── */
.bot-hero-v2 {
    display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr);
    gap: 16px; margin-bottom: 22px;
}

/* ── System page ── */
.sys-hero {
    display: flex; align-items: center; justify-content: space-between; gap: 18px;
    background: linear-gradient(120deg, rgba(16,185,129,0.10), transparent 60%), var(--bg-card);
    border: 1px solid rgba(16,185,129,0.28); border-radius: 14px;
    padding: 18px 20px; margin-bottom: 22px; flex-wrap: wrap;
}
.sys-hero-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.sys-hero-icon {
    width: 46px; height: 46px; border-radius: 12px; flex-shrink: 0;
    background: var(--accent-soft); color: var(--accent);
    display: flex; align-items: center; justify-content: center;
}
.sys-hero-icon svg { width: 24px; height: 24px; }
.sys-hero-title { font-size: 18px; font-weight: 700; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sys-hero-ver { font-size: 12px; color: var(--muted); font-weight: 500; }
.sys-hero-sub { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; margin-top: 6px; }
.sys-hero-meta { display: flex; gap: 26px; flex-wrap: wrap; }
.sys-hero-meta-item { display: flex; flex-direction: column; gap: 3px; }
.sys-hero-meta-item span { font-size: 11px; color: var(--dim); text-transform: uppercase; letter-spacing: 0.06em; }
.sys-hero-meta-item b { font-size: 14px; font-weight: 600; color: var(--text); }

/* ── Файловый менеджер ── */
.fm-panel {
    margin-top: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px 18px;
    box-shadow: var(--shadow, none);
}
.fm-crumbs { display: flex; flex-wrap: wrap; gap: 4px; font-size: 12px; color: var(--muted); }
.fm-crumb { cursor: pointer; color: var(--accent); padding: 1px 3px; border-radius: 5px; }
.fm-crumb:hover { background: var(--accent-soft); }
.fm-crumb.sep { color: var(--dim); cursor: default; }
.fm-crumb.root { color: var(--text); cursor: pointer; font-weight: 600; }
.fm-box {
    background: var(--bg-card); border: 1px solid var(--border-soft); border-radius: 12px;
    min-height: 120px; overflow: auto;
}
.fm-row {
    display: flex; align-items: center; gap: 12px; padding: 9px 14px;
    border-bottom: 1px solid var(--border-soft); cursor: default; transition: background .12s;
}
.fm-row:last-child { border-bottom: 0; }
.fm-row:hover { background: var(--bg-hover); }
.fm-row.cursor-pointer { cursor: pointer; }
.fm-ico {
    width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg-tertiary); color: var(--dim);
}
.fm-row.dir .fm-ico { color: var(--amber); background: rgba(245,158,11,.12); }
.fm-row.file .fm-ico { color: var(--accent); background: rgba(16,185,129,.12); }
.fm-ico svg { width: 16px; height: 16px; }
.fm-name {
    flex: 1; min-width: 0; font-size: 13.5px; color: var(--text);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.fm-meta { font-size: 12px; color: var(--dim); white-space: nowrap; flex-shrink: 0; }
.fm-actions { display: flex; gap: 6px; flex-shrink: 0; }
.fm-actions .icon-btn { width: 30px; height: 30px; border-radius: 7px; }
.fm-actions .icon-btn svg { width: 14px; height: 14px; }
.fm-empty { color: var(--dim); text-align: center; padding: 44px 20px; font-size: 13.5px; }
.fm-drop {
    outline: 2px dashed var(--accent); outline-offset: -2px;
    background: rgba(16,185,129,0.06);
}
.fm-edit-actions { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.fm-edit-area {
    width: 100%; min-height: 420px; resize: vertical;
    font-family: 'Space Grotesk', 'Cascadia Code', Consolas, monospace; font-size: 12.5px;
    line-height: 1.5; tab-size: 4; white-space: pre;
}
.bot-card-v2 {
    background: var(--bg-card); border: 1px solid var(--border-soft); border-radius: 14px;
    padding: 18px 20px; min-width: 0;
}
.bot-card-main {
    display: flex; flex-direction: column; gap: 16px;
    background: linear-gradient(120deg, rgba(16,185,129,0.10), transparent 60%), var(--bg-card);
    border-color: rgba(16,185,129,0.28);
}
.bot-card-v2-top { display: flex; align-items: center; gap: 14px; min-width: 0; }
.bot-card-label { color: var(--dim); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 10px; }
.bot-card-value { font-size: 24px; font-weight: 700; font-family: 'Space Grotesk', sans-serif; line-height: 1.15; word-break: break-all; }
.bot-card-value.mono { font-size: 20px; }
.bot-card-sub { color: var(--muted); font-size: 12px; margin-top: 8px; line-height: 1.5; word-break: break-word; }
.bot-card-error { color: var(--red); font-size: 12.5px; line-height: 1.5; }
.bot-toolbar-v2 {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    background: var(--bg-card); border: 1px solid var(--border-soft); border-radius: 12px;
    padding: 12px 14px; margin-bottom: 22px;
}
.bot-toolbar-search { position: relative; flex: 1; min-width: 220px; }
.bot-toolbar-search svg {
    position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
    width: 15px; height: 15px; color: var(--dim); pointer-events: none;
}
.bot-toolbar-search .inp { width: 100%; padding-left: 34px; }
.bot-filter { max-width: 190px; }
.bot-toolbar-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-left: auto; }
.bot-workspace-v2 {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 20px; align-items: start; margin-bottom: 22px;
}
.bot-sessions-v2 { min-width: 0; }
.bot-sessions-head {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    margin-bottom: 14px; flex-wrap: wrap;
}
.bot-sessions-title { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.count-badge {
    font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 999px;
    background: var(--accent-soft); color: var(--accent); line-height: 1.5;
}
.bot-sessions-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.bot-details-v2 {
    position: sticky; top: 88px;
    background: var(--bg-card); border: 1px solid var(--border-soft); border-radius: 14px;
    padding: 18px;
    height: calc(100vh - 108px);
    overflow-y: auto;
}
.bot-details-empty {
    color: var(--dim); font-size: 14px; text-align: center;
    display: flex; align-items: center; justify-content: center;
    height: 100%; min-height: 0;
}
.bot-details-title { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.bot-details-title .dim { color: var(--dim); font-weight: 400; }
.bot-details-nav { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 16px; }
.bot-details-nav .btn.active { background: var(--accent-strong); border-color: var(--accent-strong); color: #fff; }

.bot-details-top {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid var(--border-soft);
}
.bot-sel { display: flex; align-items: center; gap: 10px; min-width: 0; }
.bot-sel-avatar {
    width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; position: relative;
    background: var(--accent-strong); color: #fff; font-weight: 700; font-size: 16px;
    display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.bot-sel-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.bot-sel-info { min-width: 0; }
.bot-sel-nick {
    font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    display: flex; align-items: center; gap: 6px;
}
.bot-sel-nick .acct-flag { flex-shrink: 0; }
.bot-sel-id { color: var(--dim); font-size: 12px; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.bot-dd { position: relative; flex-shrink: 0; }
.bot-dd-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 12px; border-radius: 9px; cursor: pointer; user-select: none;
    background: var(--bg-soft); border: 1px solid var(--border-soft);
    color: var(--text); font-size: 13px; font-weight: 500;
}
.bot-dd-btn:hover { border-color: var(--border); }
.bot-dd-btn svg { width: 14px; height: 14px; color: var(--dim); transition: transform 0.15s; }
.bot-dd.open .bot-dd-btn svg { transform: rotate(180deg); }
.bot-dd-menu {
    position: absolute; top: calc(100% + 6px); right: 0; z-index: 50; min-width: 170px;
    background: var(--bg-card); border: 1px solid var(--border-soft); border-radius: 10px;
    box-shadow: 0 12px 32px rgba(0,0,0,0.28); overflow: hidden; padding: 4px;
    display: none;
}
.bot-dd.open .bot-dd-menu { display: block; }
.bot-dd-item {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 8px 10px; border-radius: 7px; font-size: 13px; color: var(--text);
    cursor: pointer; user-select: none; width: 100%; text-align: left; border: 0; background: transparent;
}
.bot-dd-item:hover { background: var(--bg-soft); }
.bot-dd-item.active { color: var(--accent); font-weight: 600; }
.bot-dd-item .dd-check { color: var(--accent); font-size: 12px; }

.set-group { margin-bottom: 16px; }
.set-group:last-child { margin-bottom: 0; }
.set-group-head {
    display: flex; align-items: center; gap: 8px; margin-bottom: 8px;
    font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--dim);
}
.set-rows { display: flex; flex-direction: column; gap: 6px; }
.set-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.set-grid .set-row { min-height: 40px; }
.set-row {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 9px 10px; border-radius: 9px; background: var(--bg-soft);
    border: 1px solid var(--border-soft); min-height: 38px;
}
.set-row-label { font-size: 13px; color: var(--text); display: flex; align-items: center; gap: 8px; min-width: 0; }
.set-row-label .lbl-sub { color: var(--dim); font-size: 12px; }
.set-row-label .val { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
.set-actions { display: flex; gap: 6px; flex-shrink: 0; align-items: center; }
.set-act {
    font-size: 12px; padding: 4px 10px; border-radius: 7px; cursor: pointer;
    background: transparent; border: 1px solid var(--border); color: var(--muted);
}
.set-act:hover { color: var(--text); border-color: var(--border); }
.set-act.danger { color: var(--red); }
.set-act.danger:hover { border-color: var(--red); }
.set-row .tgl { flex-shrink: 0; }
.set-row .switch { transform: scale(0.86); transform-origin: right center; }

.set-collapse { border: 1px solid var(--border-soft); border-radius: 9px; overflow: hidden; }
.set-collapse summary {
    list-style: none; cursor: pointer; user-select: none;
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 9px 10px; font-size: 13px; color: var(--text); background: var(--bg-soft);
}
.set-collapse summary::-webkit-details-marker { display: none; }
.set-collapse summary .chev { color: var(--dim); font-size: 11px; transition: transform 0.15s; }
.set-collapse[open] summary .chev { transform: rotate(90deg); }
.set-collapse .collapsible-body { padding: 10px; }
.set-collapse .collapsible-body .hint { margin: 0 0 8px; }

.mod-list { display: flex; flex-direction: column; gap: 8px; }
.mod-row {
    display: flex; align-items: center; gap: 10px; padding: 11px 12px;
    border: 1px solid var(--border-soft); border-radius: 10px; background: var(--bg-soft);
}
.mod-ico {
    width: 36px; height: 36px; border-radius: 9px; flex-shrink: 0;
    background: var(--accent-soft); color: var(--accent);
    display: flex; align-items: center; justify-content: center; font-size: 16px;
}
.mod-main { min-width: 0; flex: 1; }
.mod-name { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13.5px; }
.mod-badge {
    font-size: 10px; font-weight: 700; padding: 1px 7px; border-radius: 999px;
    background: var(--bg-tertiary); color: var(--muted); line-height: 1.7; letter-spacing: 0.03em;
}
.mod-desc { color: var(--dim); font-size: 12px; margin-top: 2px; }
.mod-meta { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.mod-card {
    border: 1px solid var(--border-soft); border-radius: 12px; overflow: hidden;
    background: var(--bg-soft);
}
.mod-card .mod-row { border: 0; border-radius: 0; background: transparent; }
.mod-card .set-collapse { border: 0; border-top: 1px solid var(--border-soft); border-radius: 0; }

.set-thumb {
    width: 26px; height: 26px; border-radius: 50%; object-fit: cover; flex-shrink: 0;
    vertical-align: middle; background: var(--bg-tertiary); border: 1px solid var(--border-soft);
}
.modal-crop { max-width: 560px; }

.crop-wrap {
    position: relative; display: block; margin: 14px auto 0;
    background: #16181d; border-radius: 10px; overflow: hidden;
    user-select: none; -webkit-user-drag: none; touch-action: none; line-height: 0;
    box-shadow: 0 4px 18px rgba(0,0,0,0.35);
}
.crop-wrap canvas { display: block; }
.crop-box { position: absolute; border: 2px solid #fff; cursor: move; background: transparent; box-sizing: border-box; }
.crop-box::after {
    content: ''; position: absolute; inset: -4000px; pointer-events: none;
    box-shadow: inset 0 0 0 4000px rgba(0,0,0,0.6);
}
.crop-box .crop-grid { position: absolute; inset: 0; pointer-events: none; }
.crop-grid::before, .crop-grid::after { content:''; position:absolute; background:rgba(255,255,255,0.22); }
.crop-grid::before { left:33.3%; right:33.3%; top:0; bottom:0; }
.crop-grid::after { top:33.3%; bottom:33.3%; left:0; right:0; }
.crop-handle {
    position: absolute; right: 2px; bottom: 2px; width: 16px; height: 16px;
    border-right: 3px solid #fff; border-bottom: 3px solid #fff; cursor: nwse-resize;
    pointer-events: auto;
}

.sess-list { display: flex; flex-direction: column; gap: 10px; max-height: 480px; overflow-y: auto; }
.sess-row {
    display: flex; align-items: flex-start; gap: 12px;
    padding: 12px; border: 1px solid var(--border-soft); border-radius: 10px; background: var(--bg-soft);
}
.sess-icon { width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0; background: var(--bg-tertiary); display: flex; align-items: center; justify-content: center; font-size: 17px; }
.sess-main { min-width: 0; flex: 1; }
.sess-device { font-weight: 600; font-size: 13.5px; word-break: break-word; }
.sess-device .badge { margin-left: 6px; }
.sess-meta { color: var(--dim); font-size: 12px; margin-top: 3px; word-break: break-word; }
.sess-time { color: var(--muted); font-size: 12px; white-space: nowrap; flex-shrink: 0; padding-top: 2px; }

.panel-chats { display: grid; grid-template-columns: minmax(0, 42%) minmax(0, 58%); gap: 12px; }
.panel-chats-list { max-height: 460px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.panel-chats-main { min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.chat-item.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent-soft); }
.bot-logs-v2 { margin-top: 4px; }
.bot-logs-head {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    margin-bottom: 14px; flex-wrap: wrap;
}
.bot-logs-title { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
#logs-box {
    background: var(--bg-card); border: 1px solid var(--border-soft); border-radius: 12px;
    max-height: 380px; overflow-y: auto;
}
.modal-subtitle { font-size: 14px; font-weight: 600; margin: 0 0 8px; }

.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.section-head .section-title { margin: 0; }

.btn-sm { padding: 7px 11px; font-size: 12.5px; }
.acct { cursor: pointer; user-select: none; -webkit-user-select: none; }
.acct.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent-soft); }
.acct.dragging {
    cursor: grabbing; z-index: 10;
    opacity: 0.9; transform: scale(1.045);
    box-shadow: 0 12px 28px rgba(0,0,0,0.28);
    border-color: var(--accent);
    transition: none;
}
.acct.drag-over { outline: 2px dashed var(--accent); outline-offset: -2px; }
.acct.drag-ph {
    outline: 2px dashed var(--accent); outline-offset: -2px;
    background: var(--accent-soft); border-radius: 14px;
    opacity: 0.55; pointer-events: none;
}
.bot-sessions-grid.can-reorder .acct::after {
    content: '⇅'; position: absolute; top: 8px; right: 10px;
    font-size: 12px; color: var(--dim); pointer-events: none;
}
.sub-lbl { color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.panel-label { color: var(--muted); font-size: 13px; margin: 14px 0 8px; display: block; }

/* ── modals ── */
.modal-overlay {
    position: fixed; inset: 0; z-index: 100;
    background: rgba(5,6,5,0.66); backdrop-filter: blur(3px);
    display: none; align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
    width: 100%; max-width: 480px; max-height: 88vh;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 14px; display: flex; flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.modal-wide { max-width: 760px; }
.modal-head {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 15px 18px; border-bottom: 1px solid var(--border-soft);
}
.modal-title { font-size: 15px; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-body { padding: 18px; overflow-y: auto; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
.c-actions { display: flex; justify-content: center; padding: 4px 18px 18px; }
.c-actions .btn { width: 100%; }
.c-field { display: block; margin-bottom: 14px; }
.c-field:last-of-type { margin-bottom: 0; }
.c-field span { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.c-body .hint, .modal-body .hint { margin: 14px 0 0; }

/* ── chats ── */
.chat-list { display: flex; flex-direction: column; gap: 8px; max-height: 460px; overflow-y: auto; }
.chat-item {
    display: flex; gap: 10px; align-items: center;
    padding: 10px 12px; border: 1px solid var(--border-soft); border-radius: 10px;
    cursor: pointer; background: var(--bg-soft); text-align: left; width: 100%;
}
.chat-item:hover { border-color: var(--dim); background: var(--bg-hover); }
.chat-item-avatar {
    width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0;
    background: var(--bg-tertiary); color: var(--muted);
    display: flex; align-items: center; justify-content: center; font-weight: 600;
}
.chat-item-main { min-width: 0; flex: 1; }
.chat-item-title { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item-prev { color: var(--dim); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.chat-view-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.chat-view-head .chat-item-title { font-size: 14.5px; }
.chat-messages {
    display: flex; flex-direction: column; gap: 8px; max-height: 460px; overflow-y: auto;
    padding: 12px; background: var(--bg-soft); border: 1px solid var(--border-soft); border-radius: 10px;
    flex: 1;
}
.msg { max-width: 78%; padding: 8px 11px; border-radius: 10px; font-size: 13px; }
.msg-in { background: var(--bg-tertiary); align-self: flex-start; border-bottom-left-radius: 3px; }
.msg-out { background: var(--accent-strong); align-self: flex-end; border-bottom-right-radius: 3px; }
.msg-meta { font-size: 10.5px; color: var(--dim); margin-bottom: 3px; }
.msg-out .msg-meta { color: rgba(255,255,255,0.72); }
.msg-text { word-break: break-word; white-space: pre-wrap; }
.chat-send { display: flex; gap: 8px; margin-top: 12px; }
.chat-send .inp { flex: 1; }

/* ── AniStats ── */
/* ── метрики ── */
.asx-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }

/* ── тулбар страницы AniStats ── */
.asx-toolbar {
    display: flex; align-items: center; justify-content: flex-end; gap: 12px;
    padding: 0 2px; margin-bottom: 14px;
}
.asx-toolbar-title { font-size: 12.5px; color: var(--muted); }

/* ── сервисы (привязка) ── */
.svc-list { display: flex; flex-direction: column; gap: 10px; }
.svc-item {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 14px; border: 1px solid var(--border-soft); border-radius: 12px;
    background: var(--bg-soft);
}
.svc-ico {
    width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0;
    background: var(--accent-strong); color: #fff;
    display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px;
}
.svc-ico.svc-off { background: var(--bg-tertiary); color: var(--muted); }
.svc-ico.svc-yummi { background: rgba(251,113,133,.16); color: var(--rose); }
.svc-info { flex: 1; min-width: 0; }
.svc-name { font-size: 14px; font-weight: 600; color: var(--text); }
.svc-desc { font-size: 12px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.svc-state { font-size: 11.5px; font-weight: 600; color: var(--dim); padding: 3px 9px; border-radius: 20px; border: 1px solid var(--border-soft); white-space: nowrap; }
.svc-state.on { color: var(--green); border-color: rgba(52,211,153,.35); background: var(--green-soft); }
.svc-state.err { color: var(--red); border-color: rgba(248,113,113,.35); background: var(--red-soft); }
.svc-state.soon { color: var(--muted); }
.svc-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

/* ── форма привязки сервиса ── */
.svc-form { display: flex; flex-direction: column; gap: 14px; }
.svc-field { display: flex; flex-direction: column; gap: 6px; }
.svc-field span { font-size: 12px; font-weight: 600; color: var(--muted); }
.sys-kv {
    display: flex; flex-direction: column; gap: 1px; padding: 0 12px;
    border-left: 1px solid var(--border-soft); min-width: 84px;
}
.sys-kv span { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--dim); }
.sys-kv b { font-size: 13px; font-weight: 600; color: var(--text); font-family: 'Space Grotesk', monospace; }

/* ── метрики ── */
.asx-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.asx-tile {
    position: relative; overflow: hidden; border-radius: 16px; padding: 18px 20px;
    background: var(--bg-card); border: 1px solid var(--border-soft);
    display: flex; flex-direction: column; gap: 10px;
}
.asx-tile::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; }
.asx-tile-1::before { background: var(--accent-strong); }
.asx-tile-2::before { background: var(--green); }
.asx-tile-3::before { background: var(--amber); }
.asx-tile-4::before { background: var(--rose); }
.asx-tile-label { font-size: 11px; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); }
.asx-tile-top { display: flex; align-items: center; gap: 10px; }
.asx-tile-ico {
    width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: var(--accent-soft); color: var(--accent);
}
.asx-tile-ico svg { width: 17px; height: 17px; }
.asx-tile-2 .asx-tile-ico { background: var(--green-soft); color: var(--green); }
.asx-tile-3 .asx-tile-ico { background: var(--amber-soft); color: var(--amber); }
.asx-tile-4 .asx-tile-ico { background: var(--rose-soft); color: var(--rose); }
.asx-tile-num {
    font-family: 'Space Grotesk', sans-serif; font-size: 32px; font-weight: 700; line-height: 1.1;
    background: linear-gradient(135deg, #fff, #cbd5e1); -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
    max-width: 100%; min-width: 0; white-space: nowrap; text-overflow: ellipsis; overflow: hidden;
}

/* ── панель ── */
.asx-panel {
    margin-top: 16px; background: var(--bg-card); border: 1px solid var(--border-soft);
    border-radius: 16px; overflow: hidden;
}
.asx-panel-head {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
    padding: 16px 20px; border-bottom: 1px solid var(--border-soft);
}
.asx-panel-title { font-size: 15px; font-weight: 700; color: var(--text); }
.asx-panel-title .asx-panel-sub { font-size: 11px; color: var(--dim); font-weight: 500; margin-left: 8px; }
.asx-head-right { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.asx-sum { font-size: 12px; color: var(--muted); font-family: 'Space Grotesk', sans-serif; }
.asx-sum b { color: var(--accent); font-weight: 700; }
.asx-seg { display: flex; gap: 4px; background: var(--bg-tertiary); border: 1px solid var(--border-soft); padding: 4px; border-radius: 10px; }
.asx-seg button {
    border: 0; background: transparent; color: var(--muted); font-size: 12.5px; font-weight: 600;
    padding: 6px 13px; border-radius: 7px; cursor: pointer; font-family: inherit; transition: all .15s;
}
.asx-seg button:hover { color: var(--text); }
.asx-seg button.active { background: var(--accent-strong); color: #fff; }

/* ── график ── */
.asx-chart { padding: 20px; }
.asx-chart-wrap {
    display: flex; align-items: flex-end; gap: 2px; height: 230px; width: 100%; padding-top: 8px;
    background: repeating-linear-gradient(to top, rgba(255,255,255,.028) 0 1px, transparent 1px 28px);
}
.asx-bar {
    flex: 1 1 0; min-width: 1px; max-width: none; border-radius: 4px 4px 0 0; position: relative;
    background: linear-gradient(180deg, #10b981, #047857); transition: filter .15s; cursor: pointer;
}
.asx-bar-num {
    position: absolute; left: 50%; bottom: calc(100% + 4px); transform: translateX(-50%);
    font-family: 'Space Grotesk', sans-serif; font-size: 10px; font-weight: 700;
    color: var(--text); opacity: .85; pointer-events: none; white-space: nowrap;
}
.asx-bar:hover { filter: brightness(1.25); }
.asx-bar.zero { height: 2px !important; background: var(--bg-tertiary); border-radius: 2px; }
.asx-bar .asx-bar-tip {
    position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
    background: #111; border: 1px solid #2d2d3a; color: #fff; font-size: 11px; font-weight: 600;
    padding: 4px 8px; border-radius: 7px; white-space: nowrap; opacity: 0; pointer-events: none;
    transition: opacity .15s; z-index: 6;
}
.asx-bar:hover .asx-bar-tip { opacity: 1; }
.asx-chart-x { position: relative; height: 16px; margin-top: 8px; color: var(--dim); font-size: 10.5px; }
.asx-chart-x span { position: absolute; bottom: 0; white-space: nowrap; }
.asx-chart-x span:first-child { text-align: left; }
.asx-chart-x span:last-child { text-align: right; }
.asx-chart-empty { color: var(--dim); font-size: 14px; text-align: center; padding: 70px 0; }

/* ── попап: просмотры за день ── */
.asx-day-list { display: flex; flex-direction: column; gap: 8px; max-height: 56vh; overflow-y: auto; }
.asx-day-item {
    display: flex; align-items: center; gap: 12px; padding: 10px; min-width: 0;
    background: var(--bg-soft); border: 1px solid var(--border-soft); border-radius: 12px;
    color: var(--text); text-decoration: none; transition: border-color .15s, background .15s;
}
.asx-day-item:hover { border-color: var(--accent); background: var(--bg-tertiary); }
.asx-day-poster { width: 44px; height: 62px; object-fit: cover; border-radius: 8px; background: var(--bg-tertiary); flex-shrink: 0; }
.asx-day-info { min-width: 0; flex: 1; }
.asx-day-name { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asx-day-ep { font-size: 12px; color: var(--dim); margin-top: 3px; }

/* ── годы + жанры в одну строку ── */
.asx-split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; align-items: start; }
.asx-chips { display: flex; flex-wrap: wrap; gap: 9px; align-content: flex-start; }
.asx-chip {
    display: inline-flex; align-items: center; gap: 9px; padding: 8px 14px;
    background: var(--bg-tertiary); border: 1px solid var(--border-soft); border-radius: 12px;
    font-size: 13px; color: var(--text); transition: border-color .15s;
}
.asx-chip:hover { border-color: var(--accent-2); }
.asx-chip .asx-chip-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.asx-chip .asx-chip-name { font-weight: 600; }
.asx-chip .asx-chip-count { color: var(--dim); font-size: 11.5px; }
.asx-chip .asx-chip-pct { color: var(--accent); font-weight: 700; font-size: 11.5px; }
.asx-chip { border-left-width: 3px; border-left-style: solid; }

/* ── просмотры по годам ── */
.asx-years { display: flex; flex-direction: column; padding: 16px 20px 20px; }
.asx-years .yr { display: grid; grid-template-columns: 84px 1fr auto auto; gap: 14px; align-items: center; padding: 9px 12px; }
.asx-years .yr-head .yr-cell { font-size: 10px; color: var(--dim); text-transform: uppercase; letter-spacing: .07em; font-weight: 700; padding-bottom: 4px; }
.asx-years .yr:not(.yr-head) { background: var(--bg-soft); border: 1px solid var(--border-soft); border-radius: 10px; margin-bottom: 7px; }
.asx-years .yr-year { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 14px; color: var(--muted); }
.asx-years .yr-cell b { font-size: 14px; font-weight: 700; color: var(--text); font-family: 'Space Grotesk', sans-serif; }
.asx-years .yr-cell span { font-size: 10.5px; color: var(--dim); margin-left: 5px; text-transform: lowercase; }
.asx-years .yr-barcell { padding-right: 4px; }
.asx-years .yr-bar { height: 6px; background: var(--bg-tertiary); border-radius: 4px; overflow: hidden; margin-top: 5px; }
.asx-years .yr-bar i { display: block; height: 100%; background: var(--accent-2); border-radius: 4px; }
.asx-years .yr-total { display: grid; grid-template-columns: 84px 1fr auto auto; gap: 14px; padding: 12px; margin-top: 4px; border-top: 1px solid var(--border-soft); align-items: center; }
.asx-years .yr-total .yr-year { color: var(--text); }
.asx-donut-panel { display: flex; align-items: center; }
.asx-genres-flex { display: flex; gap: 14px; align-items: stretch; padding: 18px 20px; }
.asx-genres-flex .asx-chips { flex: 1; min-width: 0; align-content: flex-start; }
.asx-genres-flex .asx-donut-panel { flex-shrink: 0; }
.as-donut { width: 150px; height: 150px; border-radius: 50%; position: relative; background: var(--bg-tertiary); flex-shrink: 0; }
.as-donut::after { content: ''; position: absolute; inset: 32px; border-radius: 50%; background: var(--bg-card); box-shadow: inset 0 0 0 1px var(--border-soft); }
.as-donut-label { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; flex-direction: column; z-index: 2; font-family: 'Space Grotesk', sans-serif; }
.as-donut-label b { font-size: 22px; }
.as-donut-label span { color: var(--dim); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }

/* ── списки ── */
.asx-lists { margin-top: 16px; display: flex; flex-direction: column; gap: 16px; }
.asx-list-panel { background: var(--bg-card); border: 1px solid var(--border-soft); border-radius: 16px; overflow: hidden; }
.asx-list-head { display: flex; align-items: center; gap: 10px; padding: 15px 20px; border-bottom: 1px solid var(--border-soft); }
.asx-list-name { font-size: 15px; font-weight: 700; color: var(--text); }
.asx-list-count { background: var(--accent-strong); color: #fff; font-size: 11.5px; font-weight: 700; padding: 2px 10px; border-radius: 20px; }
.asx-list-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; padding: 20px; }
.asx-title-card {
    position: relative; display: flex; flex-direction: column; border-radius: 13px; overflow: hidden;
    background: var(--bg-soft); border: 1px solid var(--border-soft); text-decoration: none; color: inherit;
    transition: border-color .15s, box-shadow .15s;
}
button.asx-title-card {
    -webkit-appearance: none; appearance: none; text-align: left; cursor: pointer;
    font-family: inherit; font-size: inherit; padding: 0; width: 100%;
}
button.asx-title-card:hover { border-color: rgba(16,185,129,.5); box-shadow: 0 10px 26px rgba(0,0,0,.28); }
.asx-title-card:hover { border-color: rgba(16,185,129,.5); box-shadow: 0 10px 26px rgba(0,0,0,.28); }
.asx-title-card .asx-tc-poster { width: 100%; aspect-ratio: 3/4; object-fit: cover; display: block; background: var(--bg-tertiary); }
.asx-title-card .asx-tc-body { padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.asx-title-card .asx-tc-name { font-size: 13px; font-weight: 600; line-height: 1.25; color: var(--text); min-height: 2.5em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.asx-title-card .asx-tc-alt { font-size: 10.5px; color: var(--dim); line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.asx-title-card .asx-tc-meta { font-size: 11.5px; color: var(--muted); }
.asx-title-card .asx-tc-meta .asx-tc-grade { color: var(--amber); font-weight: 700; }
.asx-title-card .asx-tc-date { font-size: 10.5px; color: var(--dim); }
.asx-title-card .asx-tc-progress { height: 4px; border-radius: 3px; background: var(--bg-tertiary); overflow: hidden; margin-top: 2px; }
.asx-title-card .asx-tc-progress i { display: block; height: 100%; background: linear-gradient(90deg, #10b981, #047857); }

/* ── скелетон загрузки ── */
.asx-sk {
    position: relative; overflow: hidden; display: inline-block; vertical-align: middle;
    border-radius: 7px; height: 1em; background: var(--bg-tertiary);
}
.asx-sk::after {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.07), transparent);
    transform: translateX(-100%);
    animation: asx-shimmer 1.5s infinite;
}
@keyframes asx-shimmer { to { transform: translateX(100%); } }

/* ── пустое состояние ── */
.asx-empty {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 8px; padding: 40px 20px; text-align: center; color: var(--muted); min-height: 150px;
}
.asx-empty svg { width: 34px; height: 34px; opacity: .45; }
.asx-empty b { font-size: 14px; font-weight: 600; color: var(--text); }
.asx-empty span { font-size: 12.5px; color: var(--dim); max-width: 320px; line-height: 1.5; }
.asx-chart .asx-empty { padding: 60px 20px; min-height: 260px; }
.asx-years .asx-empty, .asx-chips .asx-empty { width: 100%; }
.asx-svc-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 16px; height: 16px; padding: 0 3px; margin-left: 4px; border-radius: 4px; font-size: 9px; font-weight: 800; color: #0d100e; vertical-align: middle; }
.asx-svc-yum { background: #f59e0b; }
.asx-svc-conf { background: #f87171; color: #fff; }
.tag-svc { background: rgba(255,255,255,.08); color: var(--muted); }

/* ── донут / детали дня / тайтл (модалки) ── */
.tag {
    display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 20px;
    font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
    border: 1px solid var(--border-soft); flex-shrink: 0; white-space: nowrap;
}
.tag-source { color: var(--green); border-color: rgba(52,211,153,.35); background: var(--green-soft); }
.tag-synthetic { color: var(--amber); border-color: rgba(250,204,21,.35); background: var(--amber-soft); }
.tag-no_history { color: var(--dim); border-color: var(--border-soft); background: var(--bg-tertiary); }

.ad-list { display: flex; flex-direction: column; gap: 8px; max-height: 52vh; overflow-y: auto; }
.ad-row {
    display: flex; align-items: center; gap: 12px; padding: 9px 12px;
    background: var(--bg-soft); border: 1px solid var(--border-soft); border-radius: 10px;
}
.ad-poster { width: 38px; height: 52px; border-radius: 7px; object-fit: cover; flex-shrink: 0; background: var(--bg-tertiary); }
.ad-ph {
    display: flex; align-items: center; justify-content: center;
    font-family: 'Space Grotesk', sans-serif; font-weight: 700; color: var(--dim); font-size: 16px;
}
.ad-main { min-width: 0; flex: 1; }
.ad-name { font-weight: 600; font-size: 13.5px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ad-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }

.asx-kv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; margin-bottom: 16px; }
.asx-kv {
    display: flex; flex-direction: column; gap: 2px; padding: 9px 12px;
    background: var(--bg-soft); border: 1px solid var(--border-soft); border-radius: 10px;
}
.asx-kv span { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--dim); }
.asx-kv b { font-size: 13px; font-weight: 600; color: var(--text); word-break: break-word; }

.ep-list { display: flex; flex-direction: column; gap: 6px; max-height: 42vh; overflow-y: auto; }
.ep-row {
    display: flex; align-items: center; gap: 10px; padding: 8px 12px;
    background: var(--bg-soft); border: 1px solid var(--border-soft); border-radius: 9px;
    min-height: 40px;
}
.ep-pos { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 12.5px; color: var(--muted); min-width: 42px; }
.ep-time { flex: 1; font-size: 12.5px; color: var(--text); font-family: 'Space Grotesk', monospace; }
.ep-edit { display: flex; gap: 6px; align-items: center; }
.ep-edit .inp-sm { padding: 5px 8px; font-size: 12px; }
.ep-actions { display: flex; gap: 5px; align-items: center; flex-shrink: 0; }
.ep-actions .btn-sm { padding: 5px 9px; font-size: 12px; }
.ep-reload { text-align: center; margin-top: 8px; }

@media (max-width: 900px) {
    .asx-metrics { grid-template-columns: repeat(2, 1fr); }
    .asx-split { grid-template-columns: 1fr; }
}

/* ── login ── */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-logo { text-align: center; margin-bottom: 24px; }
.auth-title { font-size: 24px; font-weight: 700; margin-top: 14px; }
.auth-sub { color: var(--muted); font-size: 14px; margin-top: 6px; }
.auth-box {
    background: var(--bg-card); border: 1px solid var(--border-soft);
    border-radius: 14px; padding: 28px; text-align: center;
}
.auth-error {
    background: var(--red-soft); border: 1px solid rgba(239,68,68,0.4);
    color: var(--red); border-radius: 8px; padding: 10px 14px; font-size: 13px; margin-bottom: 16px; text-align: left;
}

/* ── responsive ── */
@media (max-width: 1100px) {
    .bot-workspace-v2 { grid-template-columns: 1fr; }
    .bot-details-v2 { position: static; height: auto; min-height: 520px; overflow: visible; }
}
@media (max-width: 900px) {
    .layout { flex-direction: column; }
    .sidebar { position: static; width: 100%; height: auto; border-right: 0; border-bottom: 1px solid var(--border-soft); }
    .side-nav { flex-direction: row; padding: 8px 10px; }
    .side-foot { display: none; }
    .main { margin-left: 0; }
    .content { padding: 18px; }
    .topbar { padding: 12px 18px; }
    .search .inp { width: 100%; }
    .search { width: 100%; }
    .bot-hero-v2 { grid-template-columns: 1fr; }
    .panel-chats { grid-template-columns: 1fr; }
    .panel-chats-list { max-height: 260px; }
}

/* ══════════ v2.2.0 ══════════ */

/* статус на карточке сессии */
.acct-status {
    margin-left: auto; display: flex; flex-direction: column;
    align-items: center; gap: 6px; padding-right: 2px; flex-shrink: 0;
}
.acct-status .status-dot {
    width: 9px; height: 9px; min-width: 9px; min-height: 9px;
    max-width: 9px; max-height: 9px; border-radius: 50%; flex: none;
}
.acct-status-text { font-size: 10.5px; color: var(--dim); white-space: nowrap; line-height: 1; }
.acct.is-disabled { opacity: 0.55; }

/* длинное имя не ломает карточку */
.acct-info { min-width: 0; }
.acct-nick { display: flex; align-items: center; gap: 6px; min-width: 0; }
.acct-nick-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-tgid { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* тумблер участия в массовых действиях на карточке */
.acct-bulk { gap: 7px; }

/* результаты массового репорта */
.bulk-res-list { display: flex; flex-direction: column; gap: 6px; }
.bulk-res-row {
    display: flex; justify-content: space-between; gap: 12px; align-items: center;
    padding: 8px 12px; border-radius: 10px; font-size: 13px;
    border: 1px solid var(--border-soft); background: var(--bg-soft);
}
.bulk-res-row.ok span:last-child { color: var(--green); }
.bulk-res-row.err span:last-child { color: var(--red); text-align: right; word-break: break-word; }

/* ══════════ v2.2.1 ══════════ */

/* спиннер на кнопке в состоянии загрузки */
.btn.is-busy { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-busy::after {
    content: ''; position: absolute; left: 50%; top: 50%;
    width: 14px; height: 14px; margin: -7px 0 0 -7px;
    border-radius: 50%; border: 2px solid rgba(255,255,255,0.35);
    border-top-color: #fff; animation: lw-spin 0.7s linear infinite;
}
@keyframes lw-spin { to { transform: rotate(360deg); } }

/* глобальный индикатор загрузки */
#global-loader {
    position: fixed; right: 18px; bottom: 18px; z-index: 9999;
    display: flex; align-items: center; gap: 9px;
    padding: 9px 14px; border-radius: 999px;
    background: var(--bg-card); border: 1px solid var(--border);
    color: var(--muted); font-size: 13px;
    box-shadow: 0 10px 26px rgba(0,0,0,0.4);
    opacity: 0; transform: translateY(8px);
    transition: opacity 0.18s, transform 0.18s;
    pointer-events: none;
}
#global-loader.show { opacity: 1; transform: none; }
.gl-spin {
    width: 13px; height: 13px; border-radius: 50%; flex-shrink: 0;
    border: 2px solid var(--border); border-top-color: var(--accent);
    animation: lw-spin 0.7s linear infinite;
}

/* мастер входа */
.lw-error { color: var(--red); font-size: 12.5px; margin-top: 10px; }
.lw-done { text-align: center; padding: 26px 0 10px; color: var(--muted); }
.lw-done svg { width: 46px; height: 46px; color: var(--green); margin-bottom: 10px; }
.lw-done b { display: block; font-size: 15px; color: var(--text); margin-bottom: 4px; }
.lw-done span { font-size: 12.5px; color: var(--dim); }

/* тулбар логов (фильтр + поиск) */
.logs-toolbar { display: flex; gap: 8px; align-items: center; margin-left: auto; }
.logs-toolbar .inp-sm { height: 32px; padding: 4px 10px; font-size: 12.5px; }
.logs-toolbar input.inp-sm { width: 170px; }
.bot-logs-head .btn.btn-sm { margin-left: 8px; }

/* кнопка обновления в чатах */
.chat-view-head .chat-refresh-btn { margin-left: auto; width: 30px; height: 30px; }
.chat-view-head .chat-refresh-btn svg { width: 15px; height: 15px; }

/* пустой раздел «Массовые действия» — удалено в пользу массового репорта */

@media (max-width: 900px) {
    .logs-toolbar input.inp-sm { width: 110px; }
}
