:root {
    --c-accent: 56, 189, 248; --c-accent-deep: 2, 132, 199; --c-accent-ink: 7, 89, 133;
    --c-page: 8, 11, 18; --c-page-mid: 22, 32, 56; --c-surface: 16, 22, 36;
    --c-text: 241, 245, 249; --c-border: 148, 163, 184; --c-on-accent: 255, 255, 255;
    --c-pick: 56, 189, 248;
    --c-ok: 52, 211, 153; --c-warn: 251, 191, 36; --c-bad: 251, 113, 133;
    --ui-opacity: 0.88; --ui-blur: 16px;
    --ui-font: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    --ui-weight: 400; --ui-track: 0em; --ui-style: normal;
    --top-h: 60px; --nav-h: 64px; --safe-b: env(safe-area-inset-bottom, 0px);
    --r-card: 22px; --r-ctl: 14px; --pad-card: 20px;
    --muted: rgba(var(--c-text), 0.62); --faint: rgba(var(--c-text), 0.42);
    --line: rgba(var(--c-border), 0.18); --line-strong: rgba(var(--c-border), 0.3);
    --well: rgba(var(--c-page), 0.55);
    color-scheme: dark;
}
html.is-light { color-scheme: light; --well: rgba(var(--c-border), 0.1); }

.hidden { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
    font-family: var(--ui-font); font-weight: var(--ui-weight); letter-spacing: var(--ui-track); font-style: var(--ui-style);
    background-color: rgb(var(--c-page));
    background-image: radial-gradient(1200px 600px at 50% -10%, rgb(var(--c-page-mid)) 0%, rgb(var(--c-page)) 70%);
    background-attachment: scroll;
    color: rgb(var(--c-text)); min-height: 100vh; min-height: 100dvh; overflow-x: hidden;
}
body.has-user-bg { background-image: none; }
body.has-user-bg::before {
    content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
    background-image: var(--user-bg);
    background-size: cover; background-repeat: no-repeat;
    background-position: var(--bg-x, 50%) var(--bg-y, 50%);
    transform-origin: var(--bg-x, 50%) var(--bg-y, 50%);
    transform: translateZ(0) scale(var(--bg-z, 1));
    filter: var(--bg-filter, none);
}
body.has-user-bg::after {
    content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
    background: rgba(var(--c-page), var(--bg-dim, .45));
}
@media (max-width: 1023px) {
    body.has-user-bg::before {
        background-position: var(--bgm-x, 50%) var(--bgm-y, 50%);
        transform-origin: var(--bgm-x, 50%) var(--bgm-y, 50%);
        transform: translateZ(0) scale(var(--bgm-z, 1));
        filter: var(--bgm-filter, none);
    }
    body.has-user-bg::after { background: rgba(var(--c-page), var(--bgm-dim, .45)); }
}

/* Редакторы фона и аватарки */
.fit-tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: 14px; background: rgba(var(--c-border), .1); }
.fit-tabs button { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 10px; font-size: 12px; font-weight: 700; color: var(--muted); }
.fit-tabs button svg { width: 15px; height: 15px; }
.fit-tabs button.is-on { background: rgba(var(--c-accent), .18); color: rgb(var(--c-text)); }
.fit-stage-wrap { display: flex; justify-content: center; }
.fit-frame {
    position: relative; overflow: hidden; border-radius: 16px;
    border: 1px solid var(--line-strong, rgba(148,163,184,.35));
    background: rgb(var(--c-page)); touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none;
    max-width: 100%;
}
.fit-frame.is-drag { cursor: grabbing; }
.fit-frame.is-phone { border-radius: 26px; border-width: 3px; }
.fit-img { position: absolute; inset: 0; background-size: cover; background-repeat: no-repeat; will-change: transform; }
.fit-dim { position: absolute; inset: 0; pointer-events: none; }
.fit-mock { position: absolute; inset: 0; pointer-events: none; padding: 6%; display: flex; flex-direction: column; gap: 5%; }
.fit-mock i { display: block; border-radius: 8px; background: rgba(var(--c-surface), var(--ui-opacity, .85)); border: 1px solid rgba(var(--c-border), .18); }
.fit-mock i:first-child { height: 7%; border-radius: 6px; }
.fit-mock i:nth-child(2) { height: 22%; }
.fit-mock i:nth-child(3) { height: 30%; width: 70%; }
.fit-mock.off { display: none; }
.fit-row { display: grid; grid-template-columns: 92px 1fr 52px; align-items: center; gap: 10px; }
.fit-row label { font-size: 12px; font-weight: 700; color: var(--muted); }
.fit-row output { font-size: 11px; font-weight: 700; text-align: right; color: var(--faint); font-variant-numeric: tabular-nums; }
.fit-row input[type=range] { width: 100%; accent-color: rgb(var(--c-accent)); }
.fit-hint { font-size: 11px; color: var(--faint); text-align: center; }
.ava-stage {
    position: relative; width: min(300px, 78vw); aspect-ratio: 1; overflow: hidden; border-radius: 18px;
    background: repeating-conic-gradient(rgba(148,163,184,.12) 0 25%, transparent 0 50%) 0 0 / 20px 20px;
    touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; margin: 0 auto;
}
.ava-stage.is-drag { cursor: grabbing; }
.ava-stage img { position: absolute; left: 50%; top: 50%; max-width: none; transform-origin: center; pointer-events: none; }
.ava-stage .ava-mask { position: absolute; inset: 0; pointer-events: none; box-shadow: 0 0 0 999px rgba(0,0,0,.55); border-radius: 50%; outline: 2px solid rgba(255,255,255,.85); outline-offset: -2px; }
.ava-stage.square .ava-mask { border-radius: 18px; }
.ava-previews { display: flex; justify-content: center; align-items: flex-end; gap: 14px; }
.ava-previews canvas { border-radius: 50%; background: rgba(var(--c-border), .15); }
.ava-previews .sq { border-radius: 14px; }
button, input, select, textarea { font-style: normal; letter-spacing: 0; }
:focus-visible { outline: 2px solid rgb(var(--c-accent)); outline-offset: 2px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-style: normal; letter-spacing: 0; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }

/* ---------- Кнопки ---------- */
.btn-3d-primary, .btn-3d-emerald, .btn-3d-slate, .btn-3d-danger {
    border: 1px solid transparent; transition: transform .12s ease, filter .15s ease, background-color .15s ease, border-color .15s ease;
    -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.btn-3d-primary { background: linear-gradient(180deg, rgb(var(--c-accent)) 0%, rgb(var(--c-accent-deep)) 100%); color: rgb(var(--c-on-accent)); box-shadow: 0 6px 18px -8px rgba(var(--c-accent-deep), .8); }
.btn-3d-emerald { background: linear-gradient(180deg, #34d399 0%, #059669 100%); color: #fff; box-shadow: 0 6px 18px -8px rgba(5,150,105,.8); }
.btn-3d-danger { background: linear-gradient(180deg, #fb7185 0%, #e11d48 100%); color: #fff; box-shadow: 0 6px 18px -8px rgba(225,29,72,.8); }
.btn-3d-slate { background: rgba(var(--c-border), 0.12); border-color: var(--line); color: rgb(var(--c-text)); }
.btn-3d-primary:hover, .btn-3d-emerald:hover, .btn-3d-danger:hover { filter: brightness(1.07); }
.btn-3d-slate:hover { background: rgba(var(--c-border), 0.2); border-color: var(--line-strong); }
.btn-3d-primary:active, .btn-3d-emerald:active, .btn-3d-danger:active, .btn-3d-slate:active { transform: scale(.97); }
.btn-3d-primary.text-white, .btn-3d-primary .text-white { color: rgb(var(--c-on-accent)); }
button:disabled { opacity: .55; cursor: not-allowed; transform: none !important; }

.icon-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 40px; min-width: 40px; padding: 0 10px; border-radius: 12px; border: 1px solid var(--line); background: rgba(var(--c-border), .1); color: rgb(var(--c-text)); font-size: 12px; font-weight: 700; transition: background-color .15s ease; }
.icon-btn:hover { background: rgba(var(--c-border), .2); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn.danger { color: rgb(var(--c-bad)); }
.icon-btn .lbl { display: none; }
@media (min-width: 1100px) { .icon-btn .lbl { display: inline; } }

.chip-btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 12px; font-size: 12px; font-weight: 700; border: 1px solid var(--line); background: rgba(var(--c-border), .1); color: rgb(var(--c-text)); }
.chip-btn:hover { background: rgba(var(--c-border), .2); }
.chip-btn svg { width: 15px; height: 15px; }
.chip-btn.primary { background: rgba(var(--c-accent), .16); border-color: rgba(var(--c-accent), .4); color: rgb(var(--c-accent)); }
html.is-light .chip-btn.primary { color: rgb(var(--c-accent-deep)); }

/* ---------- Поверхности ---------- */
.surface-card {
    background: rgba(var(--c-surface), var(--ui-opacity));
    border: 1px solid var(--line);
    box-shadow: 0 18px 40px -24px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.04);
}
@media (min-width: 1024px) and (hover: hover) {
    html:not(.lite) .surface-card { backdrop-filter: blur(var(--ui-blur)); -webkit-backdrop-filter: blur(var(--ui-blur)); }
}
.input-3d { background: var(--well); border: 1px solid var(--line-strong); color: rgb(var(--c-text)); transition: border-color .15s ease, box-shadow .15s ease; }
.input-3d::placeholder { color: var(--faint); }
.input-3d:focus { outline: none; border-color: rgb(var(--c-accent)); box-shadow: 0 0 0 3px rgba(var(--c-accent), .2); }
input, select, textarea { font-size: 16px; }
@media (min-width: 768px) { .text-sm.input-3d, .text-xs.input-3d { font-size: inherit; } }

.chat-scroll { scrollbar-width: thin; scrollbar-color: rgba(var(--c-border), .3) transparent; }
.chat-scroll::-webkit-scrollbar { width: 6px; }
.chat-scroll::-webkit-scrollbar-thumb { background: rgba(var(--c-border), .3); border-radius: 4px; }
.chat-emoji { width: 26px; height: 26px; display: inline-block; vertical-align: -6px; object-fit: contain; pointer-events: none; }
.emoji-btn .chat-emoji { width: 22px; height: 22px; vertical-align: 0; }
.nav-scroll { -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.nav-scroll::-webkit-scrollbar { display: none; }

/* ---------- Шапка и навигация ---------- */
.app-top { position: sticky; top: 0; z-index: 40; background: rgba(var(--c-page), .92); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top, 0px); }
@media (min-width: 1024px) and (hover: hover) { html:not(.lite) .app-top { backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); background: rgba(var(--c-page), .78); } }
.app-top-in { max-width: 1400px; margin: 0 auto; height: var(--top-h); padding: 0 12px; display: flex; align-items: center; gap: 12px; }
.me { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1 1 auto; text-align: left; background: none; border: 0; color: inherit; padding: 4px; border-radius: 14px; }
.me-ava { width: 38px; height: 38px; border-radius: 12px; object-fit: cover; flex: none; background: rgba(var(--c-border), .2); }
.me-ava-fb { display: flex; align-items: center; justify-content: center; font-weight: 800; color: rgb(var(--c-accent)); background: rgba(var(--c-accent), .16); }
.me-txt { min-width: 0; display: flex; flex-direction: column; }
.me-name { display: flex; align-items: center; gap: 6px; min-width: 0; font-weight: 800; font-size: 14px; }
.me-name > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-sub { font-size: 11px; color: var(--faint); font-weight: 600; }
.role-pill { flex: none; font-size: 9px; font-weight: 800; text-transform: uppercase; padding: 2px 7px; border-radius: 999px; background: rgba(var(--c-accent), .18); color: rgb(var(--c-accent)); }
.role-pill.is-admin { background: rgba(var(--c-bad), .18); color: rgb(var(--c-bad)); }
.role-pill.is-moderator { background: rgba(var(--c-warn), .18); color: rgb(var(--c-warn)); }
.top-nav { display: none; align-items: center; gap: 4px; }
.top-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.top-nav button { position: relative; display: inline-flex; align-items: center; gap: 7px; height: 40px; padding: 0 12px; border-radius: 12px; font-size: 13px; font-weight: 700; color: var(--muted); background: transparent; border: 1px solid transparent; }
.top-nav button svg { width: 17px; height: 17px; }
.top-nav button:hover { color: rgb(var(--c-text)); background: rgba(var(--c-border), .1); }
.top-nav button.is-active { color: rgb(var(--c-text)); background: rgba(var(--c-accent), .14); border-color: rgba(var(--c-accent), .35); }
.top-nav button.is-active svg { color: rgb(var(--c-accent)); }
.nav-badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: #f43f5e; color: #fff; font-size: 10px; font-weight: 800; line-height: 18px; text-align: center; }
.top-nav .nav-badge { margin-left: 2px; }

.bottom-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
    height: calc(var(--nav-h) + var(--safe-b)); padding: 6px 6px calc(6px + var(--safe-b));
    background: rgba(var(--c-page), .96); border-top: 1px solid var(--line);
}
.bottom-nav button { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border: 0; border-radius: 14px; background: transparent; color: var(--faint); font-size: 10.5px; font-weight: 700; -webkit-tap-highlight-color: transparent; }
.bottom-nav button svg { width: 22px; height: 22px; }
.bottom-nav button.is-active { color: rgb(var(--c-accent)); background: rgba(var(--c-accent), .1); }
html.is-light .bottom-nav button.is-active { color: rgb(var(--c-accent-deep)); }
.bottom-nav .nav-badge { position: absolute; top: 2px; left: calc(50% + 6px); }

@media (min-width: 1024px) {
    :root { --top-h: 64px; }
    #navAdminBtnM { display: none !important; }
    .top-nav { display: flex; }
    .me { flex: 0 1 260px; }
    .top-nav { flex: 1 1 auto; justify-content: center; }
    .bottom-nav { display: none; }
}
.portal-main { padding-bottom: calc(var(--nav-h) + var(--safe-b) + 24px); }
@media (min-width: 1024px) { .portal-main { padding-bottom: 40px; } }

#globalChatFab { bottom: calc(var(--nav-h) + var(--safe-b) + 14px) !important; right: 14px !important; width: 52px; height: 52px; }
@media (min-width: 1024px) { #globalChatFab { bottom: 22px !important; right: 22px !important; } }
html.hide-global #globalChatFab, html.hide-global #globalChatPanel { display: none !important; }

/* ---------- Кабинет ---------- */
.sec-title { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 800; }
.sec-title svg { width: 18px; height: 18px; color: rgb(var(--c-accent)); }
.sec-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

.cab-alerts { display: grid; gap: 8px; }
.cab-alert { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 16px; font-size: 13px; line-height: 1.4; border: 1px solid; }
.cab-alert svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.cab-alert b { font-weight: 800; }
.cab-alert.warn { background: rgba(var(--c-warn), .1); border-color: rgba(var(--c-warn), .35); color: rgb(var(--c-warn)); }
.cab-alert.bad { background: rgba(var(--c-bad), .1); border-color: rgba(var(--c-bad), .35); color: rgb(var(--c-bad)); }
html.is-light .cab-alert.warn { color: #92400e; }
html.is-light .cab-alert.bad { color: #9f1239; }

.subs-board { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 900px) { .subs-board.is-grid, .subs-board.is-open { grid-template-columns: 1fr 1fr; } }
.sub-card { border-radius: var(--r-card); padding: 16px; cursor: pointer; transition: border-color .15s ease, box-shadow .15s ease; }
.sub-card:hover { border-color: var(--line-strong); }
.sub-card.is-picked { border-color: rgb(var(--c-pick)); box-shadow: 0 0 0 1px rgb(var(--c-pick)), 0 0 22px -4px rgba(var(--c-pick), .55); }
.sub-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.sub-kicker { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); }
.sub-card.is-picked .sub-kicker { color: rgb(var(--c-pick)); }
.sub-name { font-size: 17px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sub-id { font-size: 11px; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill { flex: none; display: inline-flex; align-items: center; gap: 5px; font-size: 10px; font-weight: 800; text-transform: uppercase; padding: 4px 8px; border-radius: 999px; background: rgba(var(--c-border), .15); color: var(--muted); }
.pill i { width: 6px; height: 6px; border-radius: 99px; background: currentColor; }
.pill.ok { background: rgba(var(--c-ok), .14); color: rgb(var(--c-ok)); }
.pill.bad { background: rgba(var(--c-bad), .14); color: rgb(var(--c-bad)); }
.pill.warn { background: rgba(var(--c-warn), .14); color: rgb(var(--c-warn)); }
html.is-light .pill.ok { color: #047857; } html.is-light .pill.bad { color: #be123c; } html.is-light .pill.warn { color: #92400e; }
.bar { height: 8px; border-radius: 99px; background: rgba(var(--c-border), .16); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, rgb(var(--c-accent)), rgb(var(--c-ok))); transition: width .4s ease; }
.bar.warn > i { background: linear-gradient(90deg, rgb(var(--c-warn)), #f97316); }
.bar.bad > i { background: linear-gradient(90deg, #f97316, rgb(var(--c-bad))); }
.sub-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--muted); margin-top: 8px; }
.sub-meta b { color: rgb(var(--c-text)); font-weight: 700; }
.sub-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.sub-tray { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 16px; width: 100%; text-align: left; cursor: pointer; border-radius: var(--r-card); padding: 14px 16px; background: rgba(var(--c-surface), var(--ui-opacity)); border: 1px solid var(--line); color: rgb(var(--c-text)); }
.sub-tray-kicker { display: block; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); font-weight: 700; }
.sub-tray-title { display: block; margin-top: 2px; font-size: 16px; font-weight: 800; }
.sub-tray-names { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.sub-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 180px; font-size: 11px; color: var(--muted); background: var(--well); border: 1px solid var(--line); border-radius: 999px; padding: 3px 8px; }
.sub-chip b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.sub-chip i { width: 6px; height: 6px; border-radius: 99px; background: rgba(var(--c-border), .6); flex: none; }
.sub-chip i.on { background: rgb(var(--c-ok)); box-shadow: 0 0 0 3px rgba(var(--c-ok), .15); }
.sub-chip.is-picked { border-color: rgb(var(--c-pick)); color: rgb(var(--c-text)); }
.sub-tray-chevron { width: 34px; height: 34px; border-radius: 12px; display: grid; place-items: center; background: rgba(var(--c-accent), .12); color: rgb(var(--c-accent)); transition: transform .18s ease; flex: none; }
.sub-tray-chevron svg { width: 18px; height: 18px; }
.sub-tray-chevron.open { transform: rotate(180deg); }

.stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.stat { border-radius: 18px; padding: 14px; min-width: 0; }
.hwid-card { border-radius: 22px; padding: 16px; }
.hwid-list { display: grid; gap: 8px; }
.hwid-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 16px; background: rgba(var(--c-border), .08); border: 1px solid var(--line); min-width: 0; }
.hwid-ico { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 12px; background: rgba(var(--c-accent), .14); color: rgb(var(--c-accent)); }
.hwid-ico svg { width: 18px; height: 18px; }
.hwid-meta { min-width: 0; flex: 1; }
.hwid-meta b { display: block; font-size: 13px; line-height: 1.3; overflow-wrap: anywhere; }
.hwid-meta p { margin: 2px 0 0; font-size: 11px; line-height: 1.35; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hwid-del { flex: none; width: 36px; height: 36px; border: 0; border-radius: 12px; display: grid; place-items: center; cursor: pointer; color: #fb7185; background: rgba(244, 63, 94, .12); }
.hwid-del:hover { background: rgba(244, 63, 94, .22); }
.hwid-del:disabled { opacity: .45; cursor: wait; }
.hwid-del svg { width: 16px; height: 16px; }
.xui-limits { margin-top: 4px; padding-top: 4px; }
.xui-limits-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; margin: 10px 0; }
@media (min-width: 640px) { .xui-limits-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.xui-limits .fld span { display: block; font-size: 11px; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.xui-bulk-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
@media (min-width: 900px) { .xui-bulk-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.xui-bulk-card { padding: 14px; border-radius: 18px; background: rgba(var(--c-border), .08); border: 1px solid var(--line); min-width: 0; }
.xui-bulk-card b { display: block; font-size: 13px; margin-bottom: 4px; }
.xui-bulk-card > p { margin: 0 0 12px; font-size: 12px; line-height: 1.4; color: var(--muted); }
.xui-bulk-card .fld-row { display: flex; gap: 8px; align-items: center; }
.xui-bulk-out { padding: 12px 14px; border-radius: 16px; background: rgba(var(--c-border), .08); border: 1px solid var(--line); }
.setup-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.setup-steps button { border: 1px solid var(--line); border-radius: 12px; padding: 8px 6px; font-size: 11px; font-weight: 700; color: var(--muted); background: rgba(var(--c-border), .08); cursor: pointer; }
.setup-steps button.is-on { color: rgb(var(--c-text)); border-color: rgba(var(--c-accent), .45); background: rgba(var(--c-accent), .16); }
.setup-guide { border: 1px solid var(--line); border-radius: 14px; background: rgba(var(--c-border), .08); overflow: hidden; }
.setup-guide summary { cursor: pointer; padding: 10px 12px; font-size: 12px; font-weight: 700; color: rgb(var(--c-text)); list-style: none; }
.setup-guide summary::-webkit-details-marker { display: none; }
.setup-guide pre { margin: 0; padding: 0 12px 12px; white-space: pre-wrap; word-break: break-word; font-size: 11px; line-height: 1.45; color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.stat-k { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); margin-bottom: 8px; }
.stat-k svg { width: 15px; height: 15px; color: rgb(var(--c-accent)); }
.stat-v { font-size: 20px; font-weight: 800; line-height: 1.15; overflow-wrap: anywhere; }
.stat-s { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.stat-wide { grid-column: 1 / -1; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 99px; background: rgba(var(--c-border), .6); }
.dot.ok { background: rgb(var(--c-ok)); box-shadow: 0 0 0 4px rgba(var(--c-ok), .18); }
.dot.bad { background: rgb(var(--c-bad)); }
.traffic-split { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.traffic-split > div { background: var(--well); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; min-width: 0; }
.traffic-split span { display: block; font-size: 10px; text-transform: uppercase; font-weight: 700; color: var(--faint); }
.traffic-split b { display: block; font-size: 13px; font-weight: 800; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (min-width: 768px) {
    .stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
    .stat { padding: 16px; }
    .stat-v { font-size: 22px; }
}

.detail-card { border-radius: var(--r-card); padding: var(--pad-card); }
.detail-grid { display: grid; gap: 16px; margin-top: 14px; align-items: start; }
@media (min-width: 1024px) { .detail-grid { grid-template-columns: 1.1fr 1fr; } }
.well { background: var(--well); border: 1px solid var(--line); border-radius: 16px; padding: 14px; min-width: 0; }
.well-t { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.usage-chart { position: relative; height: 150px; }
.usage-chart svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.usage-chart .gl { stroke: rgba(var(--c-border), .22); stroke-width: 1; stroke-dasharray: 3 4; vector-effect: non-scaling-stroke; }
.usage-chart .area { fill: url(#usageFill); }
.usage-chart .line { fill: none; stroke: rgb(var(--c-accent)); stroke-width: 2.25; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; filter: drop-shadow(0 2px 6px rgba(var(--c-accent), .45)); }
.usage-chart .g0 { stop-color: rgb(var(--c-accent)); stop-opacity: .42; }
.usage-chart .g1 { stop-color: rgb(var(--c-accent)); stop-opacity: 0; }
.usage-chart .uc-max { position: absolute; top: -2px; left: 0; font-size: 10px; color: var(--faint); pointer-events: none; }
.usage-chart .uc-pt { position: absolute; top: 0; bottom: 0; transform: translateX(-50%); cursor: default; }
.usage-chart .uc-pt::before { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; border-left: 1px dashed rgba(var(--c-accent), .55); opacity: 0; transition: opacity .15s; }
.usage-chart .uc-pt i { position: absolute; left: 50%; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; border-radius: 99px; background: rgb(var(--c-accent)); border: 2px solid rgb(var(--c-surface)); opacity: 0; transition: opacity .15s, transform .15s; }
.usage-chart .uc-pt.today i { background: rgb(var(--c-ok)); opacity: 1; box-shadow: 0 0 0 4px rgba(var(--c-ok), .2); }
.usage-chart .uc-pt b { position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); padding: 5px 8px; border-radius: 9px; font-size: 11px; font-weight: 700; white-space: nowrap; color: rgb(var(--c-text)); background: rgba(var(--c-surface), .95); border: 1px solid var(--line); box-shadow: 0 6px 18px rgba(0,0,0,.35); opacity: 0; pointer-events: none; transition: opacity .15s; z-index: 2; }
.usage-chart .uc-pt b em { display: block; font-style: normal; font-weight: 600; font-size: 10px; color: var(--faint); }
.usage-chart .uc-pt.l b { left: 0; transform: none; }
.usage-chart .uc-pt.r b { left: auto; right: 0; transform: none; }
.usage-chart .uc-pt:hover::before, .usage-chart .uc-pt:hover i, .usage-chart .uc-pt:hover b { opacity: 1; }
.usage-chart .uc-pt:hover i { transform: scale(1.25); }
.usage-x { display: flex; justify-content: space-between; margin-top: 6px; font-size: 9.5px; color: var(--faint); }
.usage-x span { width: 0; display: flex; justify-content: center; white-space: nowrap; }
.usage-x span.today { color: rgb(var(--c-ok)); font-weight: 800; }
.usage-total { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); margin-top: 10px; }
.usage-total b { color: rgb(var(--c-text)); }
.delta { font-size: 11px; font-weight: 800; letter-spacing: 0; text-transform: none; padding: 2px 8px; border-radius: 99px; background: rgba(var(--c-border), .12); color: var(--muted); }
.delta:empty { display: none; }
.delta.up { color: rgb(var(--c-warn)); background: rgba(var(--c-warn), .14); }
.delta.down { color: rgb(var(--c-ok)); background: rgba(var(--c-ok), .14); }
.wk { display: grid; gap: 8px; }
.wk-row { display: grid; grid-template-columns: 92px 1fr auto; gap: 10px; align-items: center; font-size: 12px; color: var(--muted); }
.wk-row b { font-size: 12px; color: rgb(var(--c-text)); text-align: right; min-width: 64px; }
.wk-track { height: 8px; border-radius: 99px; background: rgba(var(--c-border), .12); overflow: hidden; }
.wk-track i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, rgba(var(--c-accent), .55), rgb(var(--c-accent))); box-shadow: 0 0 10px rgba(var(--c-accent), .4); transition: width .5s ease; }
.wk-row.prev .wk-track i { background: rgba(var(--c-border), .45); box-shadow: none; }
.wk-peak { font-size: 11.5px; color: var(--faint); margin-top: 2px; }
.wk-peak b { color: rgb(var(--c-text)); }
.on-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 800; letter-spacing: 0; text-transform: none; padding: 3px 10px; border-radius: 99px; background: rgba(var(--c-border), .12); color: var(--muted); }
.on-pill i { width: 7px; height: 7px; border-radius: 99px; background: rgba(var(--c-border), .7); }
.on-pill.live { color: rgb(var(--c-ok)); background: rgba(var(--c-ok), .14); }
.on-pill.live i { background: rgb(var(--c-ok)); animation: on-pulse 1.8s infinite; }
@keyframes on-pulse { 0% { box-shadow: 0 0 0 0 rgba(var(--c-ok), .6); } 70% { box-shadow: 0 0 0 7px rgba(var(--c-ok), 0); } 100% { box-shadow: 0 0 0 0 rgba(var(--c-ok), 0); } }
.on-body { display: grid; gap: 4px; }
.on-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 6px; }
.on-stats > div { background: rgba(var(--c-border), .07); border-radius: 12px; padding: 8px 10px; min-width: 0; }
.on-stats span { display: block; font-size: 10px; text-transform: uppercase; font-weight: 700; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.on-stats b { display: block; font-size: 14px; font-weight: 800; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.on-sub { font-size: 10px; text-transform: uppercase; font-weight: 800; letter-spacing: .05em; color: var(--faint); margin-top: 8px; }
.on-ribbon { position: relative; height: 22px; border-radius: 8px; background: repeating-linear-gradient(90deg, rgba(var(--c-border), .1) 0 calc(25% - 1px), rgba(var(--c-border), .22) calc(25% - 1px) 25%); overflow: hidden; }
.on-seg { position: absolute; top: 3px; bottom: 3px; border-radius: 5px; background: linear-gradient(180deg, rgb(var(--c-ok)), rgba(var(--c-ok), .6)); box-shadow: 0 0 8px rgba(var(--c-ok), .45); }
.on-seg.pulse { width: 3px !important; border-radius: 2px; opacity: .75; box-shadow: none; background: rgba(var(--c-warn), .85); }
.on-seg:hover { filter: brightness(1.2); }
.on-now { position: absolute; right: 0; top: 0; bottom: 0; width: 3px; background: rgb(var(--c-ok)); animation: on-blink 1.6s infinite; }
@keyframes on-blink { 50% { opacity: .3; } }
.on-ticks { display: flex; justify-content: space-between; font-size: 9.5px; color: var(--faint); margin-top: 3px; }
.on-days { display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 4px; height: 78px; }
.on-day { display: flex; flex-direction: column; align-items: center; min-width: 0; }
.on-col { flex: 1; width: 100%; max-width: 18px; display: flex; align-items: flex-end; border-radius: 6px; background: rgba(var(--c-border), .08); }
.on-col i { display: block; width: 100%; border-radius: 6px; background: linear-gradient(180deg, rgb(var(--c-accent)), rgba(var(--c-accent), .4)); transition: height .5s ease; }
.on-day.today .on-col i { background: linear-gradient(180deg, rgb(var(--c-ok)), rgba(var(--c-ok), .4)); }
.on-day span { font-size: 9.5px; color: var(--faint); margin-top: 3px; }
.on-day.today span { color: rgb(var(--c-ok)); font-weight: 800; }
.on-sess, .on-all { display: grid; gap: 6px; }
.on-sess > div, .on-all > div { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 7px 10px; border-radius: 10px; background: rgba(var(--c-border), .07); font-size: 12px; }
.on-all > div { grid-template-columns: auto 1fr auto auto; }
.on-sess .t, .on-all .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.on-sess b, .on-all b { font-size: 11.5px; color: var(--muted); }
.on-all .muted { font-size: 11px; white-space: nowrap; }
.on-sess > .live, .on-all > .cur { box-shadow: inset 0 0 0 1px rgba(var(--c-ok), .35); }
.on-note { font-size: 11px; color: var(--faint); margin-top: 6px; }
@media (max-width: 420px) { .on-stats { grid-template-columns: 1fr 1fr; } .on-stats > div:last-child { grid-column: 1 / -1; } }
.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.kv > div { background: rgba(var(--c-border), .07); border-radius: 12px; padding: 9px 10px; min-width: 0; }
.kv span { display: block; font-size: 10px; text-transform: uppercase; font-weight: 700; color: var(--faint); }
.kv b { display: block; font-size: 13px; font-weight: 800; margin-top: 2px; overflow-wrap: anywhere; }
.srv-list { display: grid; gap: 8px; }
.srv-row { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 14px; background: rgba(var(--c-border), .07); }
.srv-row .nm { font-size: 13px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.srv-row .sb { font-size: 11px; color: var(--faint); }
.srv-row .tr { text-align: right; font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.ip-list { display: flex; flex-wrap: wrap; gap: 6px; }
.ip-list span { font-size: 12px; padding: 5px 9px; border-radius: 10px; background: rgba(var(--c-border), .1); border: 1px solid var(--line); }

.skel { position: relative; overflow: hidden; background: rgba(var(--c-border), .1); border-radius: 12px; }
.skel::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,.06), transparent); animation: skel 1.3s infinite; }
@keyframes skel { to { transform: translateX(100%); } }
.skel-card { height: 132px; border-radius: var(--r-card); }

.cfg-grid > div { background: var(--well) !important; border-color: var(--line) !important; }

/* ---------- Серверы ---------- */
.srv-card { border-radius: 18px; padding: 14px; background: var(--well); border: 1px solid var(--line); }
.meter { display: grid; grid-template-columns: 60px 1fr 44px; gap: 8px; align-items: center; font-size: 12px; }
.meter span { color: var(--muted); }
.meter b { text-align: right; }
.meter .bar { height: 6px; }
#serversGrid { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 768px) { #serversGrid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1280px) { #serversGrid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* ---------- Настройки ---------- */
.settings-layout { display: flex; flex-direction: column; gap: 14px; align-items: stretch; width: 100%; }
.settings-nav { display: flex; gap: 6px; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; padding-bottom: 2px; }
.settings-nav::-webkit-scrollbar { display: none; }
.settings-body { flex: 1 1 auto; min-width: 0; width: 100%; }
.set-tab { flex: none; display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 14px; font-size: 13px; font-weight: 700; white-space: nowrap; color: var(--muted); background: rgba(var(--c-border), .08); border: 1px solid var(--line); text-align: left; }
.set-tab svg { width: 17px; height: 17px; }
.set-tab.is-active { color: rgb(var(--c-text)); background: rgba(var(--c-accent), .15); border-color: rgba(var(--c-accent), .45); }
.set-tab.is-active svg { color: rgb(var(--c-accent)); }
@media (min-width: 900px) {
    .settings-layout { flex-direction: row; align-items: flex-start; }
    .settings-nav { flex-direction: column; width: 220px; flex: 0 0 220px; position: sticky; top: calc(var(--top-h) + 20px); overflow: visible; }
    .set-tab { width: 100%; }
}
.theme-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 640px) { .theme-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.theme-card { display: flex; flex-direction: column; gap: 8px; padding: 10px; border-radius: 16px; border: 1px solid var(--line); background: rgba(var(--c-border), .06); text-align: left; color: rgb(var(--c-text)); font-size: 12px; font-weight: 800; }
.theme-card:hover { border-color: var(--line-strong); }
.theme-card.is-on { border-color: rgb(var(--c-accent)); box-shadow: 0 0 0 1px rgb(var(--c-accent)); }
.theme-swatch { height: 46px; border-radius: 11px; display: flex; align-items: flex-end; gap: 4px; padding: 6px; }
.theme-swatch i { display: block; width: 14px; height: 14px; border-radius: 5px; }
.pref-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0; border-top: 1px solid var(--line); }
.pref-row:first-of-type { border-top: 0; }
.pref-row b { display: block; font-size: 13px; font-weight: 800; }
.pref-row p { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.pref-row select { min-width: 140px; border-radius: 12px; padding: 8px 10px; }
.color-grid { display: grid; grid-template-columns: 1fr; gap: 8px; }
.color-row { display: grid; grid-template-columns: 92px 34px minmax(0,1fr) minmax(0,1fr) minmax(0,1fr); gap: 8px; align-items: center; padding: 6px 10px; border-radius: 16px; background: var(--well); border: 1px solid var(--line); }
.color-row > span { font-size: 12px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.color-byte { width: 100%; min-width: 0; padding: 7px 4px; border-radius: 10px; text-align: center; font-size: 13px !important; }
@media (max-width: 420px) {
    .color-row { grid-template-columns: 34px minmax(0,1fr) minmax(0,1fr) minmax(0,1fr); }
    .color-row > span { grid-column: 1 / -1; }
}
.color-swatch { -webkit-appearance: none; appearance: none; width: 46px; height: 46px; padding: 0; margin: -6px; border: 0; background: transparent; cursor: pointer; }
.color-swatch::-webkit-color-swatch-wrapper { padding: 0; }
.color-swatch::-webkit-color-swatch { border: none; }
.color-swatch::-moz-color-swatch { border: none; }
.swatch-wrap { width: 34px; height: 34px; box-sizing: border-box; border-radius: 50%; overflow: hidden; display: block; border: 2px solid rgba(255,255,255,.32); box-shadow: 0 0 0 3px rgba(0,0,0,.2); cursor: pointer; }
.look-sliders { display: grid; grid-template-columns: 1fr; gap: 12px; }
.type-block { display: grid; gap: 10px; padding: 10px; border-radius: 16px; background: var(--well); border: 1px solid var(--line); }
.type-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.type-line > span { width: 92px; flex: none; font-size: 12px; font-weight: 700; color: var(--muted); }
.type-select { flex: 1 1 180px; min-width: 0; border-radius: 12px; padding: 8px 10px; }
.type-sample { margin: 0; padding: 10px 12px; border-radius: 12px; background: rgba(0,0,0,.18); font-size: 18px; line-height: 1.35; }
.type-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.type-pills button { border: 1px solid var(--line-strong); background: transparent; color: var(--muted); border-radius: 999px; padding: 6px 11px; font-size: 12px; font-weight: 700; cursor: pointer; }
.type-pills button.is-on { color: rgb(var(--c-text)); border-color: rgb(var(--c-accent)); background: rgba(var(--c-accent), .18); }
details.more-look > summary { cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; font-weight: 800; padding: 12px 14px; border-radius: 14px; background: rgba(var(--c-border), .08); border: 1px solid var(--line); }
details.more-look > summary::-webkit-details-marker { display: none; }
details.more-look > summary svg { width: 18px; height: 18px; transition: transform .2s ease; }
details.more-look[open] > summary svg { transform: rotate(180deg); }
@media (min-width: 980px) {
    .color-grid { grid-template-columns: 1fr 1fr; }
    .look-sliders { grid-template-columns: 1fr 1fr; gap: 18px; }
}
.toggle-track { width: 48px; height: 28px; border-radius: 9999px; background: rgba(var(--c-border), .25); border: 1px solid var(--line); position: relative; cursor: pointer; transition: background-color .2s ease; flex: none; }
.toggle-track.active { background: rgb(var(--c-accent-deep)); border-color: rgb(var(--c-accent)); }
.toggle-thumb { width: 22px; height: 22px; border-radius: 9999px; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.4); position: absolute; top: 2px; left: 2px; transition: transform .2s ease; }
.toggle-track.active .toggle-thumb { transform: translateX(20px); }

/* ---------- Сообщения ---------- */
.inbox-app { display: flex; height: calc(100dvh - var(--top-h) - 56px); min-height: 480px; background: rgba(var(--c-surface), var(--ui-opacity)); border: 1px solid var(--line); border-radius: var(--r-card); overflow: hidden; }
.inbox-list-pane { width: 310px; flex: none; display: flex; flex-direction: column; border-right: 1px solid var(--line); min-height: 0; }
.inbox-thread-pane { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 0; background: rgba(var(--c-page), .35); }
.inbox-top { display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.inbox-search { padding: 8px 10px; border-bottom: 1px solid var(--line); display: flex; gap: 6px; }
.inbox-search input { flex: 1; min-width: 0; border-radius: 12px; padding: 8px 12px; font-size: 14px; }
.inbox-filter { flex: none; border-radius: 12px; padding: 0 10px; font-size: 12px; font-weight: 700; border: 1px solid var(--line); background: transparent; color: var(--muted); }
.inbox-filter.is-on { color: rgb(var(--c-accent)); border-color: rgba(var(--c-accent), .5); background: rgba(var(--c-accent), .12); }
.inbox-list { flex: 1; overflow-y: auto; min-height: 0; }
.inbox-msgs { flex: 1; overflow-y: auto; min-height: 0; padding: 12px 10px 6px; display: flex; flex-direction: column; gap: 3px; }
.inbox-compose { display: flex; gap: 8px; align-items: flex-end; padding: 8px; border-top: 1px solid var(--line); }
.inbox-compose input[type="text"] { border-radius: 20px; }
.inbox-back { display: none; width: 38px; height: 38px; border-radius: 12px; align-items: center; justify-content: center; color: rgb(var(--c-text)); background: rgba(var(--c-border), .12); flex: none; border: 0; }
.inbox-ava { width: 38px; height: 38px; border-radius: 999px; overflow: hidden; background: rgba(var(--c-border), .2); color: rgb(var(--c-text)); display: flex; align-items: center; justify-content: center; font-weight: 700; flex: none; }
.inbox-ava img { width: 100%; height: 100%; object-fit: cover; }
.dm-bubble { max-width: 78%; padding: 8px 12px; font-size: 15px; line-height: 1.35; word-break: break-word; }
.dm-out { margin-left: auto; background: rgb(var(--c-accent-deep)); color: #fff; border-radius: 18px 18px 5px 18px; }
.dm-in { margin-right: auto; background: rgba(var(--c-border), .18); color: rgb(var(--c-text)); border-radius: 18px 18px 18px 5px; }
.inbox-row { width: 100%; text-align: left; display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line); background: transparent; color: inherit; }
.inbox-row:hover { background: rgba(var(--c-border), .07); }
.inbox-row.is-on { background: rgba(var(--c-accent), .12); }
@media (max-width: 1023px) {
    .inbox-app { height: calc(100dvh - var(--top-h) - var(--nav-h) - var(--safe-b) - 40px); }
}
@media (max-width: 900px) {
    #tabInbox:not(.hidden) { position: fixed; left: 0; right: 0; top: var(--inbox-top, var(--top-h)); bottom: calc(var(--nav-h) + var(--safe-b)); z-index: 35; background: rgb(var(--c-page)); }
    html.dm-open #tabInbox:not(.hidden) { bottom: 0; z-index: 45; }
    html.dm-open .bottom-nav, html.dm-open #globalChatFab { display: none !important; }
    .inbox-app { height: 100%; min-height: 0; border: 0; border-radius: 0; }
    #tabInbox:not(.thread-on) .inbox-thread-pane { display: none; }
    #tabInbox.thread-on .inbox-list-pane { display: none; }
    .inbox-list-pane, .inbox-thread-pane { width: 100%; height: 100%; border-right: 0; }
    .inbox-back { display: inline-flex; }
    .inbox-compose { padding-bottom: calc(8px + var(--safe-b)); }
    html.tab-inbox #globalChatFab { display: none !important; }
}

/* ---------- Общий чат ---------- */
@media (max-width: 1023px) {
    #globalChatPanel { position: fixed; inset: 0; z-index: 80; width: 100%; height: 100dvh !important; max-height: 100dvh !important; border-radius: 0 !important; padding-bottom: var(--safe-b); }
}
@media (min-width: 1024px) {
    #globalChatPanel { height: calc(100dvh - var(--top-h) - 48px) !important; top: calc(var(--top-h) + 24px) !important; }
}
#globalChatMessages, #privateChatMessages { flex: 1 1 0; min-height: 0; overflow-y: auto; }
.gc-head { background: rgba(var(--c-page), .5) !important; border-color: var(--line) !important; }

/* ---------- Таблицы админки ---------- */
@media (max-width: 760px) {
    .rtable thead { display: none; }
    .rtable, .rtable tbody, .rtable tr, .rtable td { display: block; width: 100%; }
    .rtable tbody { display: grid; gap: 10px; border: 0 !important; }
    .rtable tr { border: 1px solid var(--line) !important; border-radius: 18px; padding: 10px 12px; background: var(--well); }
    .rtable td { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 0 !important; text-align: right !important; border: 0 !important; }
    .rtable td[data-label]::before { content: attr(data-label); flex: none; font-size: 10px; font-weight: 800; text-transform: uppercase; color: var(--faint); text-align: left; }
    .rtable td.cell-user { display: block; text-align: left !important; padding-bottom: 10px !important; border-bottom: 1px solid var(--line) !important; margin-bottom: 4px; }
    .rtable td.cell-user::before { display: none; }
    .rtable td:last-child button { width: 100%; }
    .rtable.perm td:first-child { display: block; text-align: left !important; }
}

/* ---------- Мелочи ---------- */
#toastContainer { top: calc(env(safe-area-inset-top, 0px) + 12px) !important; right: 12px !important; left: auto; width: min(384px, calc(100vw - 24px)) !important; }
.toast { pointer-events: auto; display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 16px; font-size: 13px; font-weight: 600; line-height: 1.35; background: rgba(var(--c-surface), .97); border: 1px solid var(--line-strong); color: rgb(var(--c-text)); box-shadow: 0 16px 40px -12px rgba(0,0,0,.6); animation: toastIn .18s ease; }
.toast::before { content: ""; width: 8px; height: 8px; border-radius: 99px; margin-top: 5px; flex: none; background: rgb(var(--c-accent)); }
.toast.ok { border-color: rgba(var(--c-ok), .5); } .toast.ok::before { background: rgb(var(--c-ok)); }
.toast.err { border-color: rgba(var(--c-bad), .5); } .toast.err::before { background: rgb(var(--c-bad)); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 46px !important; }
.pw-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; display: grid; place-items: center; border: 0; background: transparent; color: var(--faint); border-radius: 10px; }
.pw-eye svg { width: 18px; height: 18px; }
.auth-logo { width: 56px; height: 56px; border-radius: 18px; margin: 0 auto 12px; display: grid; place-items: center; background: rgba(var(--c-accent), .15); border: 1px solid rgba(var(--c-accent), .35); color: rgb(var(--c-accent)); }
.auth-logo svg { width: 26px; height: 26px; }
.install-hint { position: fixed; z-index: 70; left: 12px; right: 12px; bottom: calc(var(--nav-h) + var(--safe-b) + 12px); display: none; align-items: center; gap: 10px; padding: 10px 10px 10px 12px; border-radius: 18px; background: rgba(var(--c-surface), .97); border: 1px solid var(--line-strong); box-shadow: 0 16px 40px rgba(0,0,0,.45); color: rgb(var(--c-text)); }
body:not(:has(#portalScreen:not(.hidden))) .install-hint { bottom: calc(var(--safe-b) + 16px); }
.install-hint.is-on { display: flex; }
.install-hint img { width: 40px; height: 40px; border-radius: 12px; flex: none; }
.install-hint b { display: block; font-size: 13px; }
.install-hint p { margin: 2px 0 0; font-size: 11px; line-height: 1.35; color: var(--muted); }
.install-hint .install-go { flex: none; border: 0; border-radius: 12px; padding: 8px 12px; font-size: 12px; font-weight: 800; color: rgb(var(--c-on-accent)); cursor: pointer; background: linear-gradient(180deg, rgb(var(--c-accent)) 0%, rgb(var(--c-accent-deep)) 100%); }
.install-hint .install-no { flex: none; width: 32px; height: 32px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-size: 18px; cursor: pointer; }
.ios-guide { position: fixed; inset: 0; z-index: 120; display: none; align-items: flex-end; justify-content: center; padding: 12px 12px calc(var(--safe-b) + 12px); background: rgba(0,0,0,.55); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.ios-guide.is-on { display: flex; }
.ios-guide-card { position: relative; width: 100%; max-width: 420px; max-height: 100%; overflow-y: auto; padding: 18px 16px 16px; border-radius: 24px; background: rgb(var(--c-surface)); border: 1px solid var(--line-strong); box-shadow: 0 24px 60px rgba(0,0,0,.55); color: rgb(var(--c-text)); }
.ios-guide-card > b { display: block; padding-right: 36px; font-size: 16px; font-weight: 800; }
.ios-guide-card > p { margin: 4px 0 0; font-size: 12px; line-height: 1.45; color: var(--muted); }
.ios-guide-close { position: absolute; top: 10px; right: 10px; width: 34px; height: 34px; border: 0; border-radius: 12px; background: transparent; color: var(--muted); font-size: 20px; cursor: pointer; }
.ios-guide-warn { margin-top: 12px !important; padding: 10px 12px; border-radius: 14px; background: rgba(245, 158, 11, .12); border: 1px solid rgba(245, 158, 11, .35); color: rgb(var(--c-text)) !important; }
.ios-steps { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 10px; }
.ios-steps li { display: flex; align-items: flex-start; gap: 12px; padding: 10px 12px; border-radius: 16px; background: rgba(var(--c-accent), .07); border: 1px solid var(--line); }
.ios-step-ico { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; background: rgba(var(--c-accent), .16); color: rgb(var(--c-accent)); }
.ios-step-ico svg { width: 20px; height: 20px; }
.ios-steps b { display: block; font-size: 13px; }
.ios-steps p { margin: 2px 0 0; font-size: 12px; line-height: 1.4; color: var(--muted); }
.ios-guide .install-go { display: block; width: 100%; margin-top: 14px; border: 0; border-radius: 14px; padding: 12px; font-size: 14px; font-weight: 800; color: rgb(var(--c-on-accent)); cursor: pointer; background: linear-gradient(180deg, rgb(var(--c-accent)) 0%, rgb(var(--c-accent-deep)) 100%); }
.site-dot { width: 10px; height: 10px; border-radius: 99px; flex: none; display: block; background: #f43f5e; }
.site-dot.on { background: rgb(var(--c-ok)); box-shadow: 0 0 10px rgba(var(--c-ok), .75); }
.user-search { width: min(260px, 100%); }
.modal-card { max-height: calc(100dvh - 32px); overflow-y: auto; }
.max-w-2xl { max-width: 42rem; }
.z-\[70\] { z-index: 70; }
.z-\[75\] { z-index: 75; }
.max-h-\[85vh\] { max-height: 85vh; max-height: 85dvh; }

/* Модалка: шапка на месте, прокручивается только тело */
.mdl-wrap {
    z-index: 95;
    padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
    overscroll-behavior: contain;
}
.mdl-wrap.mdl-top { z-index: 97; }
.mdl-confirm { z-index: 99; }
.mdl-card {
    display: flex; flex-direction: column;
    max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px);
    overflow: hidden;
}
.mdl-head { flex: none; }
.mdl-body {
    flex: 1 1 auto; min-height: 0;
    overflow-y: auto; overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    margin-right: -6px; padding-right: 6px;
}
@media (max-width: 639px) {
    .mdl-wrap { align-items: flex-end; padding-left: 0; padding-right: 0; padding-bottom: 0; }
    .mdl-wrap .mdl-card { max-width: none; border-bottom-left-radius: 0; border-bottom-right-radius: 0; max-height: calc(100dvh - max(12px, env(safe-area-inset-top))); padding-bottom: max(16px, env(safe-area-inset-bottom)); }
}

/* Бейдж общего чата на плавающей кнопке */
#globalChatFab { position: fixed; }
.fab-badge {
    position: absolute; top: -6px; right: -6px;
    min-width: 20px; height: 20px; padding: 0 5px;
    border-radius: 999px; background: #f43f5e; color: #fff;
    font-size: 11px; font-weight: 800; line-height: 20px; text-align: center;
    box-shadow: 0 0 0 2px rgb(var(--c-surface)), 0 4px 10px -2px rgba(244,63,94,.6);
    pointer-events: none;
}
.fab-badge.hidden { display: none; }
.fab-badge.pop { animation: fabPop .35s ease; }
@keyframes fabPop { 0% { transform: scale(.4); } 70% { transform: scale(1.18); } 100% { transform: scale(1); } }

/* Группы и карточка пользователя */
.grp-tag {
    display: inline-flex; align-items: center; gap: 3px;
    padding: 1px 7px; border-radius: 999px;
    font-size: 10px; font-weight: 700; line-height: 16px;
    border: 1px solid currentColor; white-space: nowrap; max-width: 140px; overflow: hidden; text-overflow: ellipsis;
    vertical-align: middle;
}
.normal-case { text-transform: none; }
.uname-click { cursor: pointer; }
.uname-click:hover { text-decoration: underline; text-underline-offset: 2px; }
.grp-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; background: rgba(var(--c-border, 51 65 85), .18); border: 1px solid rgba(var(--c-border, 51 65 85), .35); }
.grp-row .grp-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.ucard-head { display: flex; gap: 14px; align-items: center; }
.ucard-ava { width: 64px; height: 64px; border-radius: 20px; object-fit: cover; flex: none; background: rgba(var(--c-border, 51 65 85), .3); }
.ucard-acts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 480px) { .ucard-acts { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.ucard-acts button { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 8px; border-radius: 12px; font-size: 12px; font-weight: 700; }
.ucard-acts button svg { width: 15px; height: 15px; flex: none; }
.ucard-sec { font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: rgba(var(--c-text), .55); margin: 4px 0 8px; }
.mute-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.gchat-del { opacity: 0; transition: opacity .15s; }
.gchat-msg:hover .gchat-del, .gchat-del:focus { opacity: 1; }
@media (hover: none) { .gchat-del { opacity: .7; } }
.py-6 { padding-top: 1.5rem; padding-bottom: 1.5rem; }

/* ---------- Настройка 3X-UI ---------- */
.fld { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.fld > label:first-child { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); }
.fld small { font-size: 11px; color: var(--faint); line-height: 1.35; }
.fld-row { display: flex; gap: 8px; align-items: stretch; }
.fld-row .icon-btn { height: auto; min-height: 44px; }
.fld-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 640px) { .fld-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .fld-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.chk { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); cursor: pointer; user-select: none; }
.chk input { width: 16px; height: 16px; accent-color: rgb(var(--c-accent)); }
.toggle-track:focus-visible { outline: 2px solid rgb(var(--c-accent)); outline-offset: 2px; }

/* ---------- Пользователи ---------- */
.ustat-row { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; margin-bottom: 12px; }
.ustat-row::-webkit-scrollbar { display: none; }
.ustat { flex: none; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 8px 12px; border-radius: 14px; border: 1px solid var(--line); background: rgba(var(--c-border), .07); color: rgb(var(--c-text)); text-align: left; min-width: 96px; }
.ustat b { font-size: 18px; font-weight: 800; line-height: 1.1; }
.ustat span { font-size: 11px; color: var(--muted); white-space: nowrap; }
.ustat.ok b { color: rgb(var(--c-ok)); }
.ustat.warn b { color: rgb(var(--c-warn)); }
.ustat.bad b { color: rgb(var(--c-bad)); }
.ustat.is-active { border-color: rgba(var(--c-accent), .55); background: rgba(var(--c-accent), .13); }
.ufilters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.ufilters .user-search { flex: 1 1 220px; width: auto; }
.ufilters select { flex: 0 1 auto; min-width: 140px; }
.row-acts { display: inline-flex; align-items: center; justify-content: flex-end; gap: 6px; flex-wrap: wrap; }
.row-acts .icon-btn { height: 34px; min-width: 34px; padding: 0 8px; }
.row-acts .icon-btn svg { width: 16px; height: 16px; }
.kv > div.kv-copy { position: relative; padding-right: 38px; }
.kv-btn { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 28px; height: 28px; display: grid; place-items: center; border: 0; border-radius: 8px; background: transparent; color: var(--faint); }
.kv-btn:hover { color: rgb(var(--c-accent)); background: rgba(var(--c-accent), .12); }
.kv-btn svg { width: 14px; height: 14px; }
.xui-link { display: flex; align-items: center; gap: 6px; padding: 6px 6px 6px 10px; border-radius: 12px; background: rgba(var(--c-border), .07); border: 1px solid var(--line); }
.xui-link span { flex: 1; min-width: 0; font-size: 11px; color: rgb(var(--c-accent)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xui-link .icon-btn { height: 32px; min-width: 32px; padding: 0 7px; }
.xui-link .icon-btn svg { width: 15px; height: 15px; }
.pick-row { width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; border: 1px solid var(--line); background: rgba(var(--c-border), .06); color: rgb(var(--c-text)); }
.pick-row:hover:not(:disabled) { border-color: rgba(var(--c-accent), .45); background: rgba(var(--c-accent), .08); }
.pick-row:disabled { opacity: .5; cursor: not-allowed; }
.pick-row.is-here { border-color: rgba(var(--c-ok), .45); }
@media (max-width: 767px) {
    .rtable td .row-acts { justify-content: flex-start; }
}

/* ---------- Плотность, эффекты, светлая тема ---------- */
html.compact { --pad-card: 14px; --r-card: 18px; }
html.compact .p-6 { padding: 1rem; }
html.compact .space-y-6 > :not([hidden]) ~ :not([hidden]) { margin-top: 1rem; }
html.compact .sub-card, html.compact .stat { padding: 12px; }
html.lite *, html.lite *::before, html.lite *::after { animation: none !important; transition: none !important; }
html.lite .surface-card, html.lite .btn-3d-primary, html.lite .btn-3d-emerald, html.lite .btn-3d-danger { box-shadow: none; }
html.lite .backdrop-blur-sm, html.lite .backdrop-blur-md { backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }
@media (max-width: 1023px) {
    .backdrop-blur-sm, .backdrop-blur-md { backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

html.is-light .text-white { color: rgb(var(--c-text)); }
html.is-light .text-slate-200, html.is-light .text-slate-300 { color: rgba(var(--c-text), .85); }
html.is-light .text-slate-400, html.is-light .text-slate-500 { color: rgba(var(--c-text), .62); }
html.is-light .text-slate-600 { color: rgba(var(--c-text), .45); }
html.is-light .text-sky-300, html.is-light .text-sky-400, html.is-light .text-sky-200 { color: rgb(var(--c-accent-deep)); }
html.is-light .text-emerald-300, html.is-light .text-emerald-400 { color: #047857; }
html.is-light .text-rose-300, html.is-light .text-rose-400 { color: #be123c; }
html.is-light .text-amber-300, html.is-light .text-amber-400 { color: #92400e; }
html.is-light .bg-\[\#090d16\], html.is-light .bg-\[\#0a0e19\], html.is-light .bg-\[\#101624\], html.is-light .bg-\[\#101624\]\/90, html.is-light .bg-\[\#080b12\]\/50, html.is-light .bg-\[\#080b12\]\/40, html.is-light .bg-\[\#0a0e19\]\/90 { background-color: var(--well); }
html.is-light .bg-\[\#1e293b\], html.is-light .bg-slate-800 { background-color: rgba(var(--c-border), .18); }
html.is-light .border-slate-800, html.is-light .border-slate-800\/80, html.is-light .border-slate-800\/60, html.is-light .border-slate-700, html.is-light .border-slate-700\/50 { border-color: var(--line-strong); }
html.is-light .divide-slate-800\/60 > :not([hidden]) ~ :not([hidden]) { border-color: var(--line); }
html.is-light .hover\:bg-slate-800:hover, html.is-light .hover\:bg-slate-800\/30:hover, html.is-light .hover\:bg-slate-800\/20:hover { background-color: rgba(var(--c-border), .12); }
html.is-light .btn-3d-emerald.text-white, html.is-light .btn-3d-danger.text-white, html.is-light .btn-3d-emerald .text-white { color: #fff; }
html.is-light .btn-3d-primary.text-white, html.is-light .btn-3d-primary .text-white { color: rgb(var(--c-on-accent)); }
html.is-light .bg-sky-600.text-white, html.is-light .bg-rose-500.text-white, html.is-light .bg-rose-600.text-white, html.is-light .nav-badge { color: #fff; }
html.is-light .bg-slate-700.text-white { color: rgb(var(--c-text)); background-color: rgba(var(--c-border), .25); }
html.is-light .surface-card { box-shadow: 0 10px 30px -18px rgba(15,23,42,.35); }

.srv-card { min-width: 0; border-radius: 16px; padding: 16px; background: var(--well); border: 1px solid var(--line); color: rgb(var(--c-text)); }
.srv-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.srv-head b { min-width: 0; line-height: 1.35; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.srv-head .pill { margin-top: 1px; }
.srv-meters { display: flex; flex-direction: column; gap: 8px; }
.srv-meter { display: grid; grid-template-columns: 64px 1fr 42px; gap: 8px; align-items: center; font-size: 12px; }
.srv-meter span { color: var(--muted); }
.srv-meter b { text-align: right; }
.srv-track { height: 6px; border-radius: 99px; background: rgba(var(--c-border), .18); overflow: hidden; }
.srv-fill { height: 100%; border-radius: 99px; background: rgb(var(--c-accent)); transition: width .4s ease; }
.srv-fill.warn { background: rgb(var(--c-warn)); }
.srv-fill.bad { background: rgb(var(--c-bad)); }
.srv-note { font-size: 11px; color: var(--faint); }
.srv-gap { margin-top: 12px; }
.srv-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.srv-top > div { min-width: 0; }
.srv-form { display: flex; flex-direction: column; gap: 14px; margin-top: 18px; padding: 18px; border-radius: 18px; background: var(--well); border: 1px solid var(--line); }
.srv-form-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
.srv-test { font-size: 13px; line-height: 1.5; padding: 10px 12px; border-radius: 12px; overflow-wrap: anywhere; }
.srv-test.ok { background: rgba(var(--c-ok), .12); color: rgb(var(--c-ok)); }
.srv-test.bad { background: rgba(var(--c-bad), .12); color: rgb(var(--c-bad)); }
.srv-err { display: flex; gap: 6px; align-items: flex-start; margin-top: 8px; font-size: 11px; line-height: 1.4; color: rgb(var(--c-bad)); overflow-wrap: anywhere; }
.srv-err svg { width: 13px; height: 13px; flex: none; margin-top: 1px; }
.srv-tools { display: flex; justify-content: flex-end; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.srv-tools .icon-btn { height: 30px; min-width: 30px; padding: 0 6px; }
.srv-tools .icon-btn svg { width: 15px; height: 15px; }
.srv-tools .icon-btn:disabled { opacity: .35; cursor: default; }
@media (max-width: 640px) {
    #tabServers > .surface-card { padding: 14px; border-radius: 20px; }
    #serversGrid { margin-top: 14px; gap: 10px; }
    .srv-card { padding: 14px; }
    .srv-meter { grid-template-columns: 54px minmax(0, 1fr) 36px; }
    .srv-top .chip-btn { width: 100%; justify-content: center; }
    .srv-form { padding: 14px; margin-top: 14px; }
    .srv-form .fld-grid { grid-template-columns: minmax(0, 1fr); }
    .srv-form-actions .chip-btn { flex: 1 1 auto; justify-content: center; }
}

.emo-picker { position: fixed; z-index: 100; width: 312px; max-width: calc(100vw - 16px); max-height: 260px; overflow-y: auto; border-radius: 16px; padding: 8px; display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; }
.emo-pick { height: 36px; border: 0; border-radius: 10px; background: transparent; font-size: 22px; line-height: 1; cursor: pointer; }
.emo-pick:hover { background: rgba(var(--c-border), .18); }
.emo-ico { font-size: 18px; line-height: 1; display: inline-block; }

.news-wrap, .news-col { display: flex; flex-direction: column; gap: 12px; }
.news-head, .news-editor, .news-post, .news-comments { border-radius: var(--r-card); padding: var(--pad-card); }
.news-head { display: flex; flex-direction: column; gap: 14px; }
.news-head-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.news-head-row > div, .news-post-head > div { min-width: 0; }
.news-search { position: relative; }
.news-search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--faint); pointer-events: none; }
.news-search input { width: 100%; padding: 12px 14px 12px 42px; border-radius: var(--r-ctl); background: var(--well); border: 1px solid var(--line-strong); color: rgb(var(--c-text)); font-size: 14px; }
.news-search input:focus, .news-input:focus { outline: none; border-color: rgb(var(--c-accent)); }
.news-editor { display: flex; flex-direction: column; gap: 12px; }
.news-input { width: 100%; padding: 12px 14px; border-radius: var(--r-ctl); font-size: 14px; }
textarea.news-input { resize: vertical; min-height: 160px; line-height: 1.5; padding-right: 52px; }
.news-ta-wrap { position: relative; }
.news-drop-hint { display: none; position: absolute; inset: 0; border-radius: 14px; border: 2px dashed rgb(var(--c-accent)); background: rgba(var(--c-accent), .14); backdrop-filter: blur(2px); align-items: center; justify-content: center; gap: 8px; font-weight: 800; font-size: 14px; color: rgb(var(--c-text)); pointer-events: none; }
.news-drop-hint svg { width: 20px; height: 20px; }
.news-ta-wrap.drag .news-drop-hint { display: flex; }
.news-img-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.nip { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--well); border: 1px solid var(--line); }
.nip img { width: 100%; height: 100%; object-fit: cover; display: block; }
.nip.busy img { opacity: .45; filter: blur(1px); }
.nip.busy::after { content: ""; position: absolute; left: 50%; top: 50%; width: 22px; height: 22px; margin: -11px; border-radius: 99px; border: 2px solid rgba(255,255,255,.3); border-top-color: #fff; animation: nip-spin .8s linear infinite; }
@keyframes nip-spin { to { transform: rotate(360deg); } }
.nip-tools { position: absolute; top: 5px; right: 5px; display: flex; gap: 4px; opacity: 0; transition: opacity .15s; }
.nip:hover .nip-tools, .nip:focus-within .nip-tools { opacity: 1; }
@media (hover: none) { .nip-tools { opacity: 1; } }
.nip-tools button { width: 24px; height: 24px; border-radius: 99px; border: 0; display: grid; place-items: center; background: rgba(0,0,0,.6); color: #fff; cursor: pointer; }
.nip-tools button.del:hover { background: rgb(var(--c-bad)); }
.nip-tools svg { width: 14px; height: 14px; }
.nip-cover { position: absolute; left: 5px; bottom: 5px; font-size: 9.5px; font-weight: 800; text-transform: uppercase; padding: 2px 6px; border-radius: 6px; background: rgba(0,0,0,.6); color: #fff; }
.nip-add { display: grid; place-items: center; cursor: pointer; border: 2px dashed var(--line-strong, rgba(var(--c-border), .35)); background: transparent; color: var(--muted); transition: border-color .15s, color .15s; }
.nip-add:hover { border-color: rgb(var(--c-accent)); color: rgb(var(--c-accent)); }
.nip-add svg { width: 26px; height: 26px; }

.ngal { --ar: 1.5; --max-h: min(560px, 72vh); display: grid; gap: 3px; margin-top: 8px; border-radius: 16px; overflow: hidden; width: 100%; aspect-ratio: var(--ar); max-height: var(--max-h); background: var(--well); isolation: isolate; }
.ngal.n1 { grid-template-columns: 1fr; }
.ngal.n2 { grid-template-columns: 1fr 1fr; }
.ngal.n3 { grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; }
.ngal.n3.tall { grid-template-columns: 1fr 1fr; }
.ngal.n3 .ngal-i:first-child { grid-row: span 2; }
.ngal.n4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.ngal-i { position: relative; display: block; padding: 0; border: 0; margin: 0; overflow: hidden; cursor: zoom-in; background: rgba(var(--c-border), .1); min-height: 0; min-width: 0; }
.ngal-i img { position: relative; width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .35s ease, filter .2s; }
.ngal.n1 .ngal-i img { object-fit: contain; }
.ngal-bg { position: absolute; inset: -24px; background-size: cover; background-position: center; filter: blur(22px) brightness(.55) saturate(1.2); transform: scale(1.1); }
.ngal-i:hover img { transform: scale(1.03); filter: brightness(1.06); }
.ngal.n1 .ngal-i:hover img { transform: none; }
.ngal-more { position: absolute; inset: 0; display: grid; place-items: center; font-size: 28px; font-weight: 800; color: #fff; background: rgba(0,0,0,.5); backdrop-filter: blur(2px); }
.news-post .ngal { --max-h: min(680px, 78vh); margin-top: 0; }
@media (max-width: 640px) {
    .ngal { --max-h: 70vh; border-radius: 0; gap: 2px; }
    .news-row .ngal { width: calc(100% + 14px + 46px + 14px); margin: 8px -14px 0 calc(-14px - 46px); }
    .news-post .ngal { --max-h: 75vh; width: calc(100% + 2 * var(--pad-card)); margin: 0 calc(-1 * var(--pad-card)); }
    .ngal-more { font-size: 22px; }
}
.news-excerpt.solo { color: rgb(var(--c-text)); font-size: 14px; }
.news-more-link { display: none; width: fit-content; margin-top: 2px; font-size: 13px; font-weight: 700; color: rgb(var(--c-accent)); }
.news-row:hover .news-more-link { text-decoration: underline; text-underline-offset: 3px; }
.news-ex-wrap.cut .news-more-link { display: block; }
.news-ex-wrap.cut .news-excerpt {
    -webkit-mask-image: linear-gradient(#000, #000), linear-gradient(90deg, #000 45%, transparent 92%);
    -webkit-mask-size: 100% calc(100% - 1.5em), 100% 1.5em;
    -webkit-mask-position: top, bottom;
    -webkit-mask-repeat: no-repeat;
    mask-image: linear-gradient(#000, #000), linear-gradient(90deg, #000 45%, transparent 92%);
    mask-size: 100% calc(100% - 1.5em), 100% 1.5em;
    mask-position: top, bottom;
    mask-repeat: no-repeat;
}

.nlb { position: fixed; inset: 0; z-index: 9999; display: none; align-items: center; justify-content: center; background: rgba(6, 3, 8, .93); backdrop-filter: blur(6px); }
.nlb.open { display: flex; animation: nlb-in .18s ease; }
@keyframes nlb-in { from { opacity: 0; } }
.nlb img { max-width: 94vw; max-height: 86vh; border-radius: 10px; box-shadow: 0 30px 80px rgba(0,0,0,.6); opacity: 0; transform: scale(.98); transition: opacity .2s, transform .2s; user-select: none; }
.nlb img.in { opacity: 1; transform: none; }
.nlb-top { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; color: rgba(255,255,255,.85); font-size: 14px; font-weight: 700; }
.nlb-btn, .nlb-nav { display: grid; place-items: center; border: 0; border-radius: 99px; background: rgba(255,255,255,.1); color: #fff; cursor: pointer; transition: background .15s; }
.nlb-btn { width: 40px; height: 40px; }
.nlb-btn:hover, .nlb-nav:hover { background: rgba(255,255,255,.22); }
.nlb-btn svg { width: 20px; height: 20px; }
.nlb-nav { position: absolute; top: 50%; width: 48px; height: 48px; margin-top: -24px; }
.nlb-nav.prev { left: 16px; }
.nlb-nav.next { right: 16px; }
.nlb-nav svg { width: 26px; height: 26px; }
.nlb-dots { position: absolute; bottom: 18px; left: 0; right: 0; display: flex; justify-content: center; gap: 6px; }
.nlb-dots i { width: 7px; height: 7px; border-radius: 99px; background: rgba(255,255,255,.3); transition: background .15s, transform .15s; }
.nlb-dots i.on { background: #fff; transform: scale(1.25); }
@media (max-width: 640px) { .nlb-nav { display: none; } .nlb img { max-width: 100vw; border-radius: 0; } }
body.nlb-lock { overflow: hidden; }
.news-emo { position: absolute; right: 8px; top: 8px; width: 36px; height: 36px; border-radius: 10px; border: 0; background: rgba(var(--c-border), .12); }
.news-file-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.news-file-row label { cursor: pointer; }
.news-file-name { font-size: 12px; min-width: 0; word-break: break-all; }
.news-file-row .icon-btn { height: 32px; min-width: 32px; padding: 0 6px; }
.news-editor-actions { display: flex; justify-content: flex-end; gap: 8px; }
.news-list { display: flex; flex-direction: column; gap: 10px; }
.news-empty { border-radius: var(--r-card); padding: 28px; text-align: center; font-size: 14px; }
.news-more { align-self: center; }
.news-row { display: flex; gap: 14px; border-radius: var(--r-card); padding: 16px; cursor: pointer; transition: border-color .15s ease; }
.news-row:hover { border-color: var(--line-strong); }
.news-row.is-new { border-color: rgba(var(--c-accent), .5); box-shadow: 0 0 0 1px rgba(var(--c-accent), .25), 0 18px 40px -24px rgba(0,0,0,.6); }
.news-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.news-row-title { display: flex; align-items: center; gap: 8px; font-size: 16px; color: rgb(var(--c-text)); }
.news-row-title b { min-width: 0; overflow-wrap: anywhere; }
.news-pin { width: 16px; height: 16px; color: rgb(var(--c-accent)); flex: none; }
.news-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 12px; color: var(--muted); }
.news-meta .uname-click { font-weight: 700; }
.news-excerpt { font-size: 13px; color: var(--muted); line-height: 1.5; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.news-excerpt mark, .news-row-title mark { background: rgba(var(--c-warn), .3); color: inherit; border-radius: 3px; padding: 0 1px; }
.news-row-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 4px; font-size: 12px; }
.news-stat { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); }
.news-stat svg { width: 14px; height: 14px; }
.news-ava { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; flex: none; cursor: pointer; }
.news-ava.sm { width: 34px; height: 34px; }
.news-ava-fb { display: flex; align-items: center; justify-content: center; background: rgba(var(--c-accent), .18); color: rgb(var(--c-accent)); font-weight: 800; font-size: 15px; }
.news-back { align-self: flex-start; }
.news-post { display: flex; flex-direction: column; gap: 14px; }
.news-post-head { display: flex; align-items: center; gap: 12px; }
.news-admin { margin-left: auto; display: flex; gap: 6px; flex: none; }
.news-admin .icon-btn { height: 36px; min-width: 36px; padding: 0 8px; }
.news-title { display: flex; align-items: center; gap: 8px; font-size: 22px; font-weight: 800; line-height: 1.3; color: rgb(var(--c-text)); overflow-wrap: anywhere; }
.news-body, .news-comment-body { font-size: 15px; line-height: 1.6; color: rgb(var(--c-text)); overflow-wrap: anywhere; }
.news-comment-body { font-size: 14px; }
.news-body a, .news-comment-body a { color: rgb(var(--c-accent)); text-decoration: underline; text-underline-offset: 2px; }
.news-attach { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--well); border: 1px solid var(--line); color: rgb(var(--c-text)); }
.news-attach:hover { border-color: rgb(var(--c-accent)); }
.news-attach > svg { width: 22px; height: 22px; flex: none; color: rgb(var(--c-accent)); }
.news-attach span { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.news-attach b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.news-attach small { font-size: 11px; color: var(--muted); }
.news-attach-img { display: flex; flex-direction: column; gap: 6px; }
.news-attach-img img { max-width: 100%; max-height: 520px; border-radius: 14px; border: 1px solid var(--line); object-fit: contain; background: var(--well); }
.news-file-dl { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.news-file-dl svg { width: 14px; height: 14px; }
.news-rx { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.react-chip { display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line); background: rgba(var(--c-border), .1); color: rgb(var(--c-text)); font-size: 15px; line-height: 1; cursor: pointer; }
.react-chip b { font-size: 12px; font-weight: 700; color: var(--muted); }
.react-chip.mine { border-color: rgba(var(--c-accent), .6); background: rgba(var(--c-accent), .16); }
.react-chip.mine b { color: rgb(var(--c-accent)); }
.react-chip.static { height: 24px; padding: 0 8px; font-size: 13px; cursor: default; }
.react-add { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 999px; border: 1px dashed var(--line-strong); background: transparent; color: var(--muted); cursor: pointer; }
.react-add svg { width: 16px; height: 16px; }
.react-add:hover { color: rgb(var(--c-accent)); border-color: rgb(var(--c-accent)); }
.news-comments { display: flex; flex-direction: column; gap: 14px; }
.news-comment-list { display: flex; flex-direction: column; }
.news-comment { display: flex; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); }
.news-comment:first-child { border-top: 0; padding-top: 0; }
.news-comment-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.news-c-del { margin-left: auto; display: inline-flex; border: 0; background: transparent; color: var(--faint); cursor: pointer; padding: 2px; }
.news-c-del:hover { color: rgb(var(--c-bad)); }
.news-c-del svg { width: 14px; height: 14px; }
.news-no-c, .news-muted { font-size: 13px; }
.news-muted { color: rgb(var(--c-warn)); }
.news-reply { display: flex; align-items: flex-end; gap: 8px; }
.news-reply textarea { flex: 1; min-width: 0; resize: none; padding: 10px 12px; border-radius: var(--r-ctl); font-size: 14px; line-height: 1.4; max-height: 160px; }
.news-reply .icon-btn { flex: none; height: 42px; min-width: 42px; }
.icon-btn.primary { background: rgba(var(--c-accent), .18); border-color: rgba(var(--c-accent), .45); color: rgb(var(--c-accent)); }
@media (max-width: 640px) {
    .news-row { padding: 14px; gap: 10px; }
    .news-ava { width: 36px; height: 36px; }
    .news-title { font-size: 19px; }
}

.dm-msg { display: flex; flex-direction: column; }
.dm-msg.out { align-items: flex-end; }
.dm-msg.in { align-items: flex-start; }
.dm-line { display: flex; align-items: center; gap: 4px; max-width: 86%; min-width: 0; }
.dm-msg .dm-bubble { max-width: 100%; min-width: 0; margin: 0; }
.msg-react { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 999px; border: 0; background: transparent; color: var(--faint); cursor: pointer; opacity: 0; transition: opacity .15s, color .15s; }
.msg-react svg { width: 16px; height: 16px; }
.msg-react:hover, .msg-react:focus { color: rgb(var(--c-accent)); opacity: 1; }
.gchat-msg:hover .msg-react, .dm-msg:hover .msg-react { opacity: 1; }
@media (hover: none) { .msg-react { opacity: .55; } }
.msg-rx { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.msg-rx:empty { display: none; }
.msg-rx .react-chip { height: 24px; padding: 0 8px; font-size: 13px; gap: 4px; }
.msg-rx .react-chip b { font-size: 11px; }

.log-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.log-search { flex: 1 1 220px; min-width: 0; }
.log-stats { display: flex; flex-wrap: wrap; gap: 6px; }
.log-list { display: flex; flex-direction: column; gap: 8px; }
.log-top { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 13px; }
.log-top .log-msg { flex: 1; min-width: 0; margin: 0; }
.log-cnt { flex: none; font-size: 11px; white-space: nowrap; }
.log-row { border-radius: 18px; padding: 12px 14px; }
.log-row summary { list-style: none; cursor: pointer; }
.log-row summary::-webkit-details-marker { display: none; }
.log-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 12px; }
.log-time { font-size: 11px; }
.log-dev { display: inline-flex; align-items: center; gap: 5px; font-weight: 700; }
.log-dev svg { width: 14px; height: 14px; }
.log-who { margin-left: auto; font-weight: 700; color: rgb(var(--c-accent)); }
.log-msg { margin-top: 6px; font-size: 13px; color: rgb(var(--c-text)); word-break: break-word; }
.log-flags { margin-top: 4px; font-size: 11px; }
.log-det { margin: 10px 0 0; padding: 10px; border-radius: 12px; background: rgba(var(--c-border), .1); font-size: 11px; white-space: pre-wrap; word-break: break-all; max-height: 320px; overflow: auto; color: var(--muted); }
