:root {
    font-size: 14px;
    --navy: #111827;
    --ink: #172033;
    --muted: #687387;
    --line: #e3e8ef;
    --surface: #fff;
    --canvas: #f4f6f8;
    --accent: #2563eb;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--ink); font: 1rem/1.45 Inter, ui-sans-serif, system-ui, sans-serif; }
button, input { font: inherit; }

.admin-shell { min-height: 100vh; display: flex; }
.admin-sidebar { position: fixed; inset: 0 auto 0 0; z-index: 20; width: 210px; display: flex; flex-direction: column; background: var(--navy); color: #fff; }
.admin-brand { height: 66px; display: flex; align-items: center; gap: 11px; padding: 0 18px; border-bottom: 1px solid rgba(255,255,255,.08); }
.admin-brand-mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 7px; background: #2563eb; font-size: .857rem; font-weight: 800; letter-spacing: .03em; }
.admin-brand strong, .admin-brand small { display: block; line-height: 1.2; }
.admin-brand strong { font-size: 1rem; }
.admin-brand small { margin-top: 3px; color: #8794a9; font-size: .857rem; text-transform: uppercase; letter-spacing: .08em; }
.admin-nav { padding: 14px 10px; flex: 1; }
.admin-nav-link { display: flex; align-items: center; gap: 10px; margin-bottom: 3px; padding: 10px; border-radius: 6px; color: #a8b3c4; font-size: .929rem; font-weight: 600; text-decoration: none; transition: .15s; }
.admin-nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.admin-nav-link.active { background: #2563eb; color: #fff; }
.admin-nav-icon { width: 18px; text-align: center; font-size: 1.143rem; }
.admin-signout { padding: 12px 10px 16px; border-top: 1px solid rgba(255,255,255,.08); }
.admin-signout button { width: 100%; display: flex; gap: 10px; border: 0; background: transparent; color: #9ba7ba; padding: 10px; border-radius: 6px; cursor: pointer; font-size: .929rem; }
.admin-signout button:hover { background: rgba(255,255,255,.06); color: #fff; }

.admin-main { width: calc(100% - 210px); min-width: 0; margin-left: 210px; padding: 28px 32px 44px; }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 21px; }
.page-header h1 { margin: 3px 0 0; font-size: 1.857rem; line-height: 1.15; letter-spacing: -.025em; font-weight: 700; }
.eyebrow { font-size: .857rem; line-height: 1; text-transform: uppercase; letter-spacing: .11em; font-weight: 750; color: #7d8899; }
.header-actions { display: flex; align-items: center; gap: 12px; }
.live-indicator { font-size: .929rem; color: #737f91; }
.live-indicator i { display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 3px #dcfce7; }
.admin-button { border: 1px solid #d2d9e3; border-radius: 6px; background: #fff; color: #354052; padding: 8px 12px; cursor: pointer; font-size: .929rem; font-weight: 650; box-shadow: 0 1px 1px rgba(15,23,42,.03); }
.admin-button:hover { border-color: #aeb8c7; background: #fafbfc; }

.admin-panel { overflow: visible; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: 0 1px 2px rgba(15,23,42,.025); }
.metric-strip { display: grid; grid-template-columns: repeat(5, 1fr); margin-bottom: 16px; border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: 0 1px 2px rgba(15,23,42,.025); }
.metric { padding: 16px 18px; border-right: 1px solid var(--line); }
.metric:last-child { border: 0; }
.metric-strip.host-strip { grid-template-columns: repeat(3, 1fr); }
.metric span, .metric small { display: block; }
.metric span { font-size: .857rem; color: #707c8f; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
.metric strong { display: block; margin: 5px 0 2px; font-size: 1.714rem; line-height: 1.15; letter-spacing: -.02em; }
.metric small { font-size: .929rem; color: #8994a5; }
.status-ok { color: #159447; }
.status-warn { color: #d97706; }
.status-muted { color: #8994a5; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0,1.6fr) minmax(270px,.7fr); gap: 16px; margin-bottom: 16px; }
.admin-panel-header { min-height: 60px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 16px; border-bottom: 1px solid #edf0f4; }
.admin-panel-header h2 { margin: 0; font-size: 1rem; font-weight: 700; }
.admin-panel-header p { margin: 3px 0 0; font-size: .929rem; color: #7e899a; }
.panel-total { font-size: 1.286rem; }
.text-link { font-size: .929rem; color: var(--accent); font-weight: 650; text-decoration: none; }
.text-link:hover { text-decoration: underline; }
.compact-list { padding: 8px 16px 11px; }
.compact-row { min-height: 33px; display: grid; grid-template-columns: minmax(150px,1fr) minmax(70px,1.5fr) 48px; align-items: center; gap: 13px; border-bottom: 1px solid #f0f2f5; font-size: .929rem; }
.compact-row:last-child { border: 0; }
.compact-row span { display: flex; align-items: center; min-width: 0; }
.compact-row strong { text-align: right; font-size: 1rem; }
.module-dot { width: 8px; height: 8px; flex: 0 0 auto; margin-right: 9px; border-radius: 2px; }
.dot-blue { background:#3b82f6; } .dot-violet { background:#8b5cf6; } .dot-cyan { background:#06b6d4; } .dot-orange { background:#f97316; } .dot-emerald { background:#10b981; } .dot-pink { background:#ec4899; } .dot-yellow { background:#eab308; } .dot-red { background:#ef4444; } .dot-sky { background:#0ea5e9; } .dot-rose { background:#f43f5e; } .dot-lime { background:#84cc16; }
.row-bar { height: 4px; overflow: hidden; border-radius: 3px; background: #eef1f5; }
.row-bar i { display: block; height: 100%; border-radius: 3px; background: #8795aa; }
.instruments-list .compact-row { grid-template-columns: 1fr 55px; min-height: 38px; }

.table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th { padding: 10px 14px; background: #f8f9fb; border-bottom: 1px solid var(--line); text-align: left; font-size: .857rem; color: #737f91; text-transform: uppercase; letter-spacing: .05em; font-weight: 750; white-space: nowrap; }
.admin-table td { padding: 10px 14px; border-bottom: 1px solid #edf0f4; color: #475267; font-size: .929rem; vertical-align: middle; }
.admin-table tbody tr:last-child td { border-bottom: 0; }
.admin-table tbody tr:hover td { background: #fafbfd; }
.admin-table .num { text-align: right; }
.primary-cell { font-weight: 650; color: #263247; font-size: 1rem; }
.secondary-cell { margin-top: 2px; font-size: .857rem; color: #8994a5; }
.mono { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; font-size: .929em; }
.count-pill { display: inline-grid; place-items: center; min-width: 28px; height: 22px; padding: 0 6px; border-radius: 5px; background: #edf4ff; color: #2563eb; font-weight: 750; }
.empty-cell, .empty-state { text-align: center !important; color: #7d899a !important; }
.empty-state { padding: 46px 20px; font-size: 1rem; }

/* Connections workspace */
.connection-kpis { display: grid; grid-template-columns: repeat(4,minmax(140px,1fr)); margin-bottom: 14px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.connection-kpis div { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 12px 15px; border-right: 1px solid var(--line); }
.connection-kpis div:last-child { border: 0; }
.connection-kpis span { color: #6f7a8c; font-size: .929rem; }
.connection-kpis strong { font-size: 1.286rem; color: #202b3f; }
.connections-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.search-box { width: min(530px,100%); height: 38px; display: flex; align-items: center; gap: 9px; padding: 0 11px; border: 1px solid #d2d9e3; border-radius: 7px; background: #fff; color: #7d899a; box-shadow: 0 1px 2px rgba(15,23,42,.025); }
.search-box:focus-within { border-color: #7aa5f8; box-shadow: 0 0 0 3px #e5efff; }
.search-box > span { font-size: 1.286rem; line-height: 1; }
.search-box input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; color: #263247; font-size: 1rem; }
.search-box input::placeholder { color: #929cac; }
.search-box button { border: 0; background: transparent; color: #7e8999; cursor: pointer; font-size: 1.286rem; line-height: 1; }
.result-count { color: #778294; font-size: .929rem; white-space: nowrap; }
.connection-list { display: grid; gap: 12px; }
.connection-user { overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: 0 1px 2px rgba(15,23,42,.025); }
.connection-user-header { display: grid; grid-template-columns: 36px minmax(220px,1fr) minmax(170px,.55fr) 110px 100px; align-items: center; gap: 11px; padding: 12px 15px; border-bottom: 1px solid var(--line); background: #fbfcfd; }
.user-avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; background: #e7eefb; color: #315ea8; font-size: 1rem; font-weight: 800; }
.user-main { min-width: 0; }
.user-main strong, .user-main span, .user-telegram span, .user-telegram strong, .user-total strong, .user-total span { display: block; }
.user-main strong { overflow: hidden; text-overflow: ellipsis; color: #202b3f; font-size: 1rem; white-space: nowrap; }
.user-main span { margin-top: 2px; overflow: hidden; text-overflow: ellipsis; color: #7d899a; font-size: .857rem; white-space: nowrap; }
.user-telegram span, .user-total span { color: #7d899a; font-size: .857rem; }
.user-telegram strong { margin-top: 2px; color: #465269; font-size: .929rem; }
.user-total { text-align: right; }
.user-total strong { font-size: 1.143rem; color: #202b3f; }
.connection-columns, .connection-row { display: grid; grid-template-columns: minmax(260px,.9fr) 155px minmax(300px,1.5fr) 100px; align-items: center; gap: 15px; }
.connection-columns { padding: 8px 15px; border-bottom: 1px solid #edf0f4; background: #f7f9fb; color: #707c8e; font-size: .857rem; font-weight: 700; text-transform: uppercase; letter-spacing: .045em; }
.connection-record { border-bottom: 1px solid #edf0f4; }
.connection-record:last-child { border-bottom: 0; }
.connection-record.expanded { background: #fbfdff; }
.connection-row { min-height: 54px; padding: 8px 15px; }
.connection-row:hover { background: #fafbfd; }
.connection-name { min-width: 0; display: flex; align-items: center; gap: 7px; }
.connection-name strong { overflow: hidden; text-overflow: ellipsis; color: #344157; font-size: .929rem; white-space: nowrap; }
.client-version { flex: 0 0 auto; font-size: .786rem; color: #667287; }
.client-environment { padding: 12px 15px; border-bottom: 1px solid #dfe5ed; }
.client-environment p { margin: 5px 0 10px; color: #707c8e; font-size: .857rem; }
.client-environment dd { overflow-wrap: anywhere; }
.copy-id { flex: 0 0 auto; padding: 2px 5px; border: 1px solid #dce2ea; border-radius: 4px; background: #fff; color: #7b8697; cursor: pointer; font-size: .786rem; font-weight: 700; }
.connection-time { display: flex; align-items: baseline; gap: 5px; white-space: nowrap; }
.connection-time strong { color: #465269; font-size: .929rem; font-weight: 600; }
.connection-time span { color: #7d899a; font-size: .857rem; }
.module-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.module-chip { display: inline-flex; align-items: center; gap: 5px; min-height: 24px; padding: 3px 7px; border-radius: 5px; background: #eef2f6; color: #536076; font-size: .857rem; white-space: nowrap; }
.module-chip strong { font-size: .857rem; }
.chip-iceberg { background: #e5f8fb; color: #087e91; } .chip-activity { background: #eaf2ff; color: #2862ad; } .chip-deals { background: #f1ebff; color: #6b42ab; } .chip-price { background: #fff0e6; color: #b55417; } .chip-volume { background: #e7f8f0; color: #187a51; } .chip-slabs { background: #fceaf3; color: #a33d6e; } .chip-futures { background: #fff7d9; color: #8c6b06; } .chip-robots { background: #feecec; color: #af3a3a; } .chip-robotsv2 { background: #ffe9ee; color: #b3305a; } .chip-telegramers { background: #e6f5ff; color: #1677a8; } .chip-pulse { background: #f1f9e3; color: #4d7a0f; }
.no-subscriptions { color: #9a6d28; font-size: .929rem; }
.details-button { display: flex; align-items: center; justify-content: flex-end; gap: 5px; width: 100%; border: 0; background: transparent; color: #2563eb; cursor: pointer; font-size: .929rem; font-weight: 650; }
.details-button span { display: grid; place-items: center; min-width: 24px; height: 22px; padding: 0 5px; border-radius: 5px; background: #edf4ff; }
.details-button i { font-size: 1.286rem; font-style: normal; transition: transform .15s; }
.connection-record.expanded .details-button i { transform: rotate(90deg); }
.details-button:disabled { color: #a0a8b4; cursor: default; }
.subscription-inspector { border-top: 1px solid #dce4ef; background: #f7f9fc; }
.subscription-module { display: grid; grid-template-columns: 155px minmax(0,1fr); border-bottom: 1px solid #dfe5ed; }
.subscription-module:last-child { border-bottom: 0; }
.subscription-module-header { display: flex; align-items: flex-start; gap: 8px; padding: 11px 12px 10px 15px; border-right: 1px solid #dfe5ed; color: #354157; font-size: .929rem; }
.subscription-module-header .module-dot { margin: 5px 0 0; }
.subscription-module-header strong { min-width: 0; flex: 1; }
.subscription-module-count { display: grid; place-items: center; min-width: 23px; height: 21px; padding: 0 5px; border-radius: 4px; background: #e8edf4; color: #667287; font-size: .857rem; font-weight: 700; }
.subscription-entries { min-width: 0; background: #fff; }
.activity-subscriptions { padding: 10px 13px; color: #455268; font-size: .929rem; line-height: 1.5; overflow-wrap: anywhere; }
.subscription-entry { display: grid; grid-template-columns: minmax(170px, .65fr) minmax(0, 2.35fr); align-items: start; gap: 14px; padding: 9px 13px; border-bottom: 1px solid #edf0f4; }
.subscription-entry:last-child { border-bottom: 0; }
.subscription-id { min-width: 0; }
.subscription-id span { display: block; margin-bottom: 2px; color: #7a8698; font-size: .786rem; text-transform: uppercase; letter-spacing: .04em; }
.subscription-id strong { display: block; overflow: hidden; text-overflow: ellipsis; color: #263247; font-size: .929rem; font-weight: 650; white-space: nowrap; }
.parameter-flow { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 5px 16px; min-width: 0; margin: 0; }
.parameter-pair { display: flex; align-items: baseline; gap: 5px; min-width: 0; margin: 0; }
.parameter-pair dt { flex: 0 0 auto; color: #7a8698; font-size: .857rem; }
.parameter-pair dt::after { content: ":"; }
.parameter-pair dd { min-width: 0; margin: 0; color: #455268; font-size: .929rem; line-height: 1.45; overflow-wrap: anywhere; }
.parameter-assets { flex: 1 1 420px; }
.parameter-assets dd { columns: 2 230px; column-gap: 18px; }
.parameter-list { flex: 1 1 100%; }
.parameter-list dd { line-height: 1.6; word-spacing: 4px; }

/* Database users */
.database-indicator i { background: #64748b; box-shadow: 0 0 0 3px #e2e8f0; }
.user-kpis { display: grid; grid-template-columns: repeat(5,minmax(130px,1fr)); margin-bottom: 14px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.user-kpis div { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 12px 15px; border-right: 1px solid var(--line); }
.user-kpis div:last-child { border-right: 0; }
.user-kpis span { color: #6f7a8c; font-size: .929rem; }
.user-kpis strong { color: #202b3f; font-size: 1.286rem; }
.users-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.users-search { width: min(520px,100%); }
.status-filter { display: inline-flex; padding: 3px; border: 1px solid #d5dce5; border-radius: 7px; background: #fff; }
.status-filter button { border: 0; border-radius: 5px; background: transparent; padding: 6px 10px; color: #657186; cursor: pointer; font-size: .929rem; }
.status-filter button:hover { color: #263247; }
.status-filter button.active { background: #eaf1fd; color: #245cae; font-weight: 650; }
.users-panel { overflow: hidden; }
.users-table { min-width: 1290px; }
.sort-header { width: 100%; display: inline-flex; align-items: center; justify-content: space-between; gap: 8px; margin: -10px -14px; padding: 10px 14px; border: 0; background: transparent; color: inherit; cursor: pointer; font: inherit; font-weight: inherit; letter-spacing: inherit; text-align: left; text-transform: inherit; white-space: nowrap; }
.sort-header:hover { background: #eef2f7; color: #344157; }
.sort-header span { color: #a0a9b6; font-size: .929rem; }
th[aria-sort="ascending"] .sort-header, th[aria-sort="descending"] .sort-header { color: #245cae; }
th[aria-sort="ascending"] .sort-header span, th[aria-sort="descending"] .sort-header span { color: #2563eb; }
.users-table td { height: 54px; }
.user-name-cell { display: flex; align-items: center; gap: 7px; color: #263247; font-size: 1rem; font-weight: 650; }
.online-dot { width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 3px #dcfce7; }
.user-handle { margin-top: 2px; color: #7d899a; font-size: .857rem; }
.user-status { display: inline-flex; align-items: center; min-height: 24px; padding: 3px 8px; border-radius: 999px; font-size: .857rem; font-weight: 650; white-space: nowrap; }
.current-activity-heading { min-width: 145px; }
.current-activity { white-space: nowrap; }
.current-activity strong { display: inline-grid; place-items: center; min-width: 28px; height: 24px; padding: 0 6px; border-radius: 5px; background: #edf4ff; color: #2563eb; font-size: .929rem; }
.current-activity span { margin: 0 5px; color: #9aa4b2; }
.status-paid { background: #e7f8ef; color: #17784d; }
.status-expired { background: #fff1e5; color: #a85418; }
.status-disabled { background: #f0f2f5; color: #687386; }
.status-none { background: #f4efff; color: #7147a9; }
.date-primary, .date-relative { display: block; white-space: nowrap; }
.date-primary { color: #465269; font-size: .929rem; }
.date-relative { margin-top: 2px; color: #8490a1; font-size: .857rem; }
.database-id { max-width: 145px; overflow: hidden; text-overflow: ellipsis; color: #657186 !important; white-space: nowrap; }
.users-footer { min-height: 50px; display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 9px 13px; border-top: 1px solid var(--line); color: #707c8e; font-size: .929rem; }
.pagination { display: flex; align-items: center; gap: 10px; }
.pagination button { border: 1px solid #d5dce5; border-radius: 5px; background: #fff; padding: 6px 9px; color: #465269; cursor: pointer; font-size: .857rem; }
.pagination button:hover:not(:disabled) { border-color: #aeb8c7; }
.pagination button:disabled { opacity: .45; cursor: default; }
.users-error { display: flex; flex-direction: column; gap: 5px; padding: 16px; border-color: #fecaca; color: #991b1b; font-size: .929rem; }

/* Instruments */
.instrument-loading i { background: #f59e0b; box-shadow: 0 0 0 3px #fef3c7; }
.instrument-kpis { display: grid; grid-template-columns: repeat(5,minmax(120px,1fr)); margin-bottom: 14px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.instrument-kpis div { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 12px 15px; border-right: 1px solid var(--line); }
.instrument-kpis div:last-child { border-right: 0; }
.instrument-kpis span { color: #6f7a8c; font-size: .929rem; }
.instrument-kpis strong { color: #202b3f; font-size: 1.286rem; }
.instruments-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.instruments-search { flex: 1; }
.instrument-type-filter { height: 38px; display: flex; align-items: center; gap: 8px; padding: 0 9px 0 11px; border: 1px solid #d2d9e3; border-radius: 7px; background: #fff; color: #737f91; font-size: .929rem; }
.instrument-type-filter select { border: 0; outline: 0; background: transparent; color: #354052; }
.instruments-toolbar .result-count { margin-left: auto; }
.instruments-panel { overflow: hidden; }
.instruments-table { min-width: 1560px; }
.instruments-table td { height: 58px; }
.instruments-table .numeric-sort { justify-content: flex-end; }
.instrument-name { max-width: 230px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.instrument-type { display: inline-flex; padding: 3px 7px; border-radius: 5px; background: #edf4ff; color: #245cae; font-size: .857rem; font-weight: 650; white-space: nowrap; }
.short-status { display: inline-flex; min-width: 34px; justify-content: center; margin-right: 4px; padding: 3px 7px; border-radius: 999px; font-size: .857rem; font-weight: 650; }
.short-status.enabled { background: #e7f8ef; color: #17784d; }
.short-status.disabled { background: #f0f2f5; color: #687386; }
.instrument-uid { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.instrument-tags { min-width: 260px; }
.tag-editor { display: flex; align-items: center; gap: 5px; }
.tag-input { width: 100%; max-width: 220px; padding: 6px 9px; border: 1px solid #d2d9e3; border-radius: 6px; background: #fff; color: #263247; font: inherit; font-size: .929rem; }
.tag-input:focus { border-color: #7aa5f8; box-shadow: 0 0 0 3px #e5efff; outline: 0; }
.tag-auto { width: 26px; height: 30px; flex: 0 0 auto; border: 1px solid #cfe0cf; border-radius: 6px; background: #e7f8ef; color: #17784d; cursor: pointer; font-weight: 700; }
.tag-auto.off { border-color: #eccdd5; background: #fdf3f5; color: #b0304a; text-decoration: line-through; }
.tag-note { display: inline-block; margin-top: 4px; padding: 0; border: 0; background: none; font-size: .857rem; text-align: left; }
.tag-note.suggest { color: #4a6a9c; cursor: pointer; }
.tag-note.suggest:hover { text-decoration: underline; }
.tag-note.conflict { color: #a4682a; }

@media (max-width: 1000px) {
    .admin-sidebar { position: static; width: 100%; height: auto; display: block; }
    .admin-shell { display: block; }
    .admin-brand { display: none; }
    .admin-nav { display: flex; padding: 8px; }
    .admin-nav-link { margin: 0; }
    .admin-signout { display: none; }
    .admin-main { width: 100%; margin: 0; padding: 22px 17px 36px; }
    .dashboard-grid { grid-template-columns: 1fr; }
    .connection-user-header { grid-template-columns: 36px minmax(180px,1fr) 155px 100px 90px; }
    .connection-columns, .connection-row { grid-template-columns: minmax(180px,.8fr) 145px minmax(250px,1.4fr) 90px; }
    .user-kpis { grid-template-columns: repeat(3,1fr); }
    .instrument-kpis { grid-template-columns: repeat(2,1fr); }
    .user-kpis div:nth-child(3) { border-right: 0; }
    .user-kpis div:nth-child(-n+3) { border-bottom: 1px solid var(--line); }
}

.telegramers-panel { margin-top: 14px; }
.user-kpis.telegramer-kpis { grid-template-columns: repeat(6,minmax(120px,1fr)); }
.telegramer-create { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.telegramer-create > span { color: #778296; font-size: .857rem; }
.telegramers-table { min-width: 1880px; }
.telegramer-destinations { display: flex; flex-direction: column; gap: 6px; }
.telegramer-destinations label { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; cursor: pointer; }
.telegramer-name, .telegramer-source { width: 100%; padding: 6px 9px; border: 1px solid #d2d9e3; border-radius: 6px; background: #fff; color: #263247; font: inherit; font-size: .929rem; }
.telegramer-removals { width: 280px; min-height: 62px; resize: vertical; padding: 6px 9px; border: 1px solid #d2d9e3; border-radius: 6px; background: #fff; color: #263247; font: inherit; font-size: .857rem; line-height: 1.35; }
.telegramer-name { max-width: 240px; }
.telegramer-new-id { width: min(240px,100%); padding: 6px 9px; border: 1px solid #d2d9e3; border-radius: 6px; background: #fff; color: #263247; font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; font-size: .929rem; }
.telegramer-create .telegramer-name { width: min(280px,100%); max-width: none; }
.telegramer-new-id:focus { border-color: #7aa5f8; box-shadow: 0 0 0 3px #e5efff; outline: 0; }
.telegramer-source { min-width: 230px; }
.telegramer-source-row { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.telegramer-source-row > span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.telegramer-source-row > button { flex: none; }
.telegramer-name:focus, .telegramer-source:focus, .telegramer-removals:focus { border-color: #7aa5f8; box-shadow: 0 0 0 3px #e5efff; outline: 0; }
.telegramer-images { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; cursor: pointer; }
.telegramer-id { max-width: 145px; overflow: hidden; text-overflow: ellipsis; }
.telegramer-order { white-space: nowrap; }
.telegramer-order button { width: 24px; height: 24px; margin-right: 3px; border: 1px solid #d2d9e3; border-radius: 5px; background: #fff; color: #505c70; cursor: pointer; line-height: 1; }
.telegramer-order button:disabled { opacity: .35; cursor: default; }
.telegramer-actions { white-space: nowrap; text-align: right; }
.telegramer-actions .admin-button { padding: 5px 9px; font-size: .857rem; }
.telegramer-actions .admin-button + .admin-button { margin-left: 5px; }
.admin-button.danger { color: #b0304a; border-color: #eccdd5; }
.admin-button.danger:hover { background: #fdf3f5; border-color: #dda8b5; }

@media (max-width: 1000px) {
    .user-kpis.telegramer-kpis { grid-template-columns: repeat(3,1fr); }
}

@media (max-width: 720px) {
    .user-kpis.telegramer-kpis { grid-template-columns: repeat(2,1fr); }
    .metric-strip, .connection-kpis { grid-template-columns: repeat(2,1fr); }
    .metric:nth-child(even), .connection-kpis div:nth-child(even) { border-right: 0; }
    .metric, .connection-kpis div { border-bottom: 1px solid var(--line); }
    .metric:last-child, .connection-kpis div:last-child { border-bottom: 0; }
    .metric-strip.host-strip { grid-template-columns: 1fr; }
    .host-strip .metric { border-right: 0; }
    .connections-toolbar { align-items: stretch; flex-direction: column; gap: 7px; }
    .users-toolbar { align-items: stretch; flex-direction: column; gap: 8px; }
    .instruments-toolbar { align-items: stretch; flex-direction: column; gap: 8px; }
    .instrument-type-filter { width: fit-content; }
    .instruments-toolbar .result-count { margin-left: 0; }
    .status-filter { width: fit-content; }
    .result-count { padding-left: 2px; }
    .connection-user-header { grid-template-columns: 36px 1fr 85px 75px; }
    .user-telegram { display: none; }
    .connection-columns { display: none; }
    .connection-row { grid-template-columns: 1fr auto; gap: 8px 12px; padding: 12px; }
    .connection-time { grid-column: 2; grid-row: 1; justify-content: flex-end; text-align: right; }
    .module-chips { grid-column: 1 / -1; }
    .details-button { grid-column: 1 / -1; justify-content: flex-start; width: auto; }
    .telegramer-create { align-items: stretch; flex-direction: column; }
    .telegramer-create > span { line-height: 1.35; }
}

@media (max-width: 500px) {
    .page-header { align-items: flex-start; }
    .live-indicator { display: none; }
    .connection-user-header { grid-template-columns: 36px 1fr 75px; }
    .user-total:last-child { display: none; }
    .subscription-module { grid-template-columns: 1fr; }
    .subscription-module-header { align-items: center; padding: 8px 11px; border-right: 0; border-bottom: 1px solid #e5e9ef; }
    .subscription-module-header .module-dot { margin-top: 0; }
    .subscription-entry { grid-template-columns: 1fr; gap: 6px; }
    .parameter-assets dd { columns: 1; }
    .user-kpis { grid-template-columns: repeat(2,1fr); }
    .user-kpis div { border-bottom: 1px solid var(--line); }
    .user-kpis div:nth-child(odd) { border-right: 1px solid var(--line); }
    .user-kpis div:nth-child(even) { border-right: 0; }
    .user-kpis div:last-child { border-bottom: 0; }
    .users-footer { align-items: flex-start; flex-direction: column; }
}

/* Access */
.admin-button.primary { border-color: #2563eb; background: #2563eb; color: #fff; }
.admin-button.primary:hover { border-color: #1d4ed8; background: #1d4ed8; }
.admin-button.primary:disabled, .admin-button:disabled { opacity: .5; cursor: default; }
.access-banner { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; padding: 12px 15px; border-color: #cfe0f8; background: #f5f9ff; color: #24457c; font-size: .929rem; }
.access-banner strong { font-size: .857rem; text-transform: uppercase; letter-spacing: .06em; }
.access-heading { min-width: 210px; }
.user-access { min-width: 210px; }
.access-chip { display: inline-flex; align-items: baseline; gap: 6px; margin: 0 5px 3px 0; padding: 3px 8px; border-radius: 999px; font-size: .857rem; white-space: nowrap; }
.access-chip strong { font-weight: 700; }
.access-chip.active { background: #e7f8ef; color: #17784d; }
.access-chip.expired { background: #f0f2f5; color: #687386; }
.access-actions { white-space: nowrap; text-align: right; }
.access-actions .admin-button { padding: 5px 9px; font-size: .857rem; }
.users-table tr.access-open td { background: #f6f9ff; }
.access-editor-row td { padding: 0 !important; background: #f7f9fc; }
.access-editor { display: grid; gap: 13px; padding: 15px; border-top: 1px solid #dce4ef; }
.access-editor-error { padding: 9px 12px; border: 1px solid #fecaca; border-radius: 6px; background: #fef4f4; color: #991b1b; font-size: .929rem; }
.access-plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 11px; }
.access-plan { display: grid; gap: 9px; padding: 12px 13px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.access-plan-head strong { display: block; color: #202b3f; font-size: 1rem; }
.access-plan-head span { display: block; margin-top: 2px; color: #7d899a; font-size: .857rem; }
.access-plan-state { display: flex; align-items: center; gap: 9px; min-height: 26px; }
.access-plan-state .date-relative { margin: 0; }
.access-plan-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.access-plan-actions .admin-button { padding: 5px 9px; font-size: .857rem; }
.access-date { width: 145px; padding: 5px 8px; border: 1px solid #d2d9e3; border-radius: 6px; background: #fff; color: #263247; font: inherit; font-size: .857rem; }
.access-date:focus { border-color: #7aa5f8; box-shadow: 0 0 0 3px #e5efff; outline: 0; }
.access-hint { color: #778296; font-size: .857rem; }
.telegramer-channel-access { min-width: 0; margin: 0; padding: 12px 13px; border: 1px solid var(--line); border-radius: 8px; }
.telegramer-channel-access legend { padding: 0 5px; font-weight: 600; }
.telegramer-channel-summary { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 10px 0; }
.telegramer-channel-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 9px 16px; max-height: 280px; overflow-y: auto; }
.telegramer-channel-list label { display: flex; align-items: flex-start; gap: 7px; min-width: 0; overflow-wrap: anywhere; }
.telegramer-channel-list small { display: block; }
.access-history h3 { margin: 0 0 6px; color: #202b3f; font-size: .929rem; font-weight: 700; }
.access-history-row { display: grid; grid-template-columns: 150px 110px minmax(0, 1fr) 90px; align-items: baseline; gap: 12px; padding: 5px 0; border-bottom: 1px solid #e8ecf2; color: #475267; font-size: .857rem; }
.access-history-row:last-child { border-bottom: 0; }
.access-history-row .date-primary, .access-history-row .date-relative { margin: 0; }

@media (max-width: 720px) {
    .access-history-row { grid-template-columns: 1fr; gap: 2px; }
}
.access-bulk { margin-bottom: 12px; padding: 12px 14px; }
.access-bulk-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.access-bulk-row > strong { margin-right: 4px; color: #202b3f; font-size: .929rem; }
.access-bulk select { padding: 5px 8px; border: 1px solid #d2d9e3; border-radius: 6px; background: #fff; color: #263247; font: inherit; font-size: .857rem; }
.access-bulk select:focus, .access-days:focus { border-color: #7aa5f8; box-shadow: 0 0 0 3px #e5efff; outline: 0; }
.access-days { width: 72px; padding: 5px 8px; border: 1px solid #d2d9e3; border-radius: 6px; background: #fff; color: #263247; font: inherit; font-size: .857rem; }
.access-bulk .admin-button { padding: 5px 9px; font-size: .857rem; }
.access-bulk-target { color: #778296; font-size: .857rem; }
.access-bulk-question { color: #8a5a12; font-size: .857rem; font-weight: 650; }
.access-bulk-result { color: #17784d; font-size: .857rem; font-weight: 650; }
.access-bulk .access-hint { margin-top: 7px; }

/* Tariffs */
.tariff-list { display: grid; gap: 12px; padding: 14px; }
.tariff { display: grid; gap: 11px; padding: 13px 14px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.tariff.disabled { background: #fafbfc; opacity: .75; }
.tariff-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.tariff-head .telegramer-name { width: min(260px, 100%); }
.tariff-actions { margin-left: auto; white-space: nowrap; }
.tariff-actions .admin-button { padding: 5px 9px; font-size: .857rem; }
.tariff-actions .admin-button + .admin-button { margin-left: 5px; }
.tariff-widgets { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 9px 11px; border: 1px solid #edf0f4; border-radius: 6px; background: #fbfcfd; }
.tariff-widget { display: inline-flex; align-items: center; gap: 6px; color: #455268; font-size: .929rem; cursor: pointer; }
.tariff-widget input { width: 14px; height: 14px; margin: 0; accent-color: #2563eb; }
.tariff-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; color: #6f7a8c; font-size: .857rem; }
.tariff-row label { display: inline-flex; align-items: center; gap: 6px; }
.tariff-row .access-days { width: 90px; }
.tariff-trial { margin-left: auto; }
.trade-days { display: flex; flex-wrap: wrap; gap: 6px; }
.trade-days .admin-button { padding: 4px 9px; text-decoration: none; font-variant-numeric: tabular-nums; }

/* Шпаргалка по тегам (Shared/TagsHelp.razor) */
.tags-help { margin: 0 0 16px; }
.tags-help summary { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; padding: 12px 16px; cursor: pointer; list-style: none; }
.tags-help summary::-webkit-details-marker { display: none; }
.tags-help summary::before { content: "›"; display: inline-block; width: 10px; color: var(--muted); font-weight: 700; transition: transform .15s; }
.tags-help[open] summary::before { transform: rotate(90deg); }
.tags-help summary strong { font-size: 1rem; }
.tags-help summary span { color: #7e899a; font-size: .929rem; }
.tags-help-body { padding: 0 16px 16px; border-top: 1px solid #edf0f4; }
.tags-help-table { width: 100%; margin-top: 12px; }
.tags-help-table td { vertical-align: top; }
.tags-help-table td:first-child { white-space: nowrap; }
.tags-help code { padding: 1px 5px; border-radius: 4px; background: #f1f4f8; font: .929rem ui-monospace, SFMono-Regular, Menlo, monospace; }
.tags-help-notes { margin: 14px 0 0; padding-left: 18px; }
.tags-help-notes li { margin-bottom: 6px; }
@media (max-width: 760px) { .tags-help-table td:first-child { white-space: normal; } }

/* Client connection audit */
.connection-identity { min-width: 0; display: grid; gap: 5px; }
.connection-environment { min-width: 0; }
.connection-environment-summary, .audit-user-runtime { margin: 0; display: grid; gap: 3px; font-size: .857rem; }
.connection-environment-summary > div, .audit-user-runtime > div { display: flex; align-items: baseline; gap: 7px; min-width: 0; }
.connection-environment-summary dt, .audit-user-runtime dt { flex-shrink: 0; color: var(--muted); font-weight: 400; }
.connection-environment-summary dd, .audit-user-runtime dd { margin: 0; min-width: 0; color: var(--ink); overflow-wrap: anywhere; }
.environment-missing { display: block; margin-top: 3px; color: var(--muted); font-size: .786rem; }
.audit-history-controls, .audit-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.audit-history-controls { padding: 12px 14px; margin-bottom: 16px; box-shadow: none; }
.audit-history-controls label, .audit-toolbar label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .929rem; }
.audit-history-controls input, .audit-history-controls select, .audit-toolbar select { padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px; background: white; color: var(--ink); font: inherit; }
.audit-history-controls input { width: 175px; }
.audit-history-controls .audit-hint { margin: 0; }
.audit-hint { color: var(--muted); font-size: .857rem; margin: 10px 0; line-height: 1.5; }
.audit-alert { padding: 12px 14px; margin: 12px 0; border: 1px solid #f4d49c; border-radius: 7px; background: #fffbeb; color: #85520d; }
.audit-overview { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 20px; margin: 16px 0; }
.audit-overview span { color: var(--muted); font-size: .929rem; }
.audit-toolbar .search-box { flex: 1; min-width: 230px; }
.audit-list { border: 1px solid var(--line); border-radius: 8px; background: white; overflow: hidden; }
.audit-user-group + .audit-user-group { border-top: 1px solid var(--line); }
.audit-user-summary { display: grid; grid-template-columns: minmax(140px,1fr) 95px minmax(200px,1.1fr) 165px 12px; gap: 14px; align-items: center; padding: 13px 16px; }
.audit-user-summary, .audit-connection-row { cursor: pointer; list-style: none; }
.audit-user-summary::-webkit-details-marker, .audit-connection-row::-webkit-details-marker { display: none; }
.audit-user-summary:hover, .audit-connection-row:hover { background: #f8fafc; }
.audit-user-summary:focus-visible, .audit-connection-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.audit-user, .audit-user-counts, .audit-session-identity, .audit-session-time, .audit-session-check { min-width: 0; display: grid; gap: 4px; overflow-wrap: anywhere; }
.audit-user strong { font-weight: 650; }
.audit-user > span, .audit-user-counts, .audit-session-identity > span, .audit-session-time, .audit-expand { color: var(--muted); font-size: .857rem; }
.audit-user-counts b { color: var(--ink); font-weight: 600; }
.audit-user-runtime dd { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.audit-chevron { color: var(--muted); font-size: 1.4rem; transition: transform .12s; }
.audit-user-group[open] > summary .audit-chevron { transform: rotate(90deg); }
.audit-user-content { border-top: 1px solid var(--line); background: #fbfcfe; }
.audit-user-links { display: flex; flex-wrap: wrap; gap: 8px 20px; padding: 11px 16px; font-size: .857rem; }
.audit-user-links > span { margin-left: auto; color: var(--muted); }
.audit-connection-columns, .audit-connection-row { display: grid; grid-template-columns: minmax(145px,.9fr) 155px minmax(220px,1.2fr) 165px; gap: 14px; align-items: center; }
.audit-connection-columns { padding: 8px 16px; color: var(--muted); font-size: .786rem; background: #f1f4f8; }
.audit-connection-row { padding: 12px 16px; }
.audit-session + .audit-session { border-top: 1px solid var(--line); }
.audit-session-identity strong { font-weight: 500; font-size: .929rem; }
.audit-session-identity .audit-connected { color: #187a51; }
.audit-session-time > span { font-size: .786rem; }
.audit-session-check { justify-items: start; }
.audit-badge { display: inline-block; width: fit-content; padding: 3px 7px; border-radius: 4px; font-size: .786rem; font-weight: 600; line-height: 1.35; }
.audit-review { background: #feecec; color: #a42b2b; }
.audit-incomplete { background: #fff5dc; color: #8d6116; }
.audit-neutral { background: #eef2f6; color: #536076; }
.audit-expand { color: var(--accent); }
.audit-details { padding: 14px 16px; border-top: 1px solid var(--line); background: #f4f7fb; }
.audit-details dd { overflow-wrap: anywhere; }
.audit-reasons { padding-left: 18px; margin: 0 0 14px; font-size: .929rem; line-height: 1.5; }
.audit-reasons li + li { margin-top: 3px; }
.audit-links { display: flex; flex-wrap: wrap; gap: 20px; margin-top: 14px; font-size: .857rem; }
.audit-help { margin-top: 16px; max-width: 1000px; font-size: .857rem; line-height: 1.6; color: var(--muted); }
.audit-help summary { cursor: pointer; color: var(--accent); width: fit-content; }
.audit-help p { margin: 9px 0; }
@media (max-width: 1150px) {
    .connection-columns { display: none; }
    .connection-row { grid-template-columns: minmax(0,1fr) auto; gap: 8px 12px; }
    .connection-time { grid-column: 2; grid-row: 1; justify-content: flex-end; text-align: right; }
    .module-chips { grid-column: 1 / -1; }
    .details-button { grid-column: 1 / -1; justify-content: flex-start; width: auto; }
    .audit-user-summary { grid-template-columns: minmax(140px,1fr) 90px minmax(190px,1fr) 12px; }
    .audit-user-summary > .audit-badge { grid-column: 1 / 4; grid-row: 2; }
    .audit-chevron { grid-column: 4; grid-row: 1; }
    .audit-connection-columns { display: none; }
    .audit-connection-row { grid-template-columns: minmax(140px,1fr) minmax(210px,1fr); }
    .audit-connection-row .connection-environment { grid-column: 2; grid-row: 1 / 3; }
    .audit-session-check { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; }
}
@media (max-width: 700px) {
    .connection-identity { grid-column: 1 / -1; }
    .connection-time { grid-column: 1 / -1; grid-row: auto; justify-content: flex-start; text-align: left; }
    .audit-user-summary { grid-template-columns: minmax(0,1fr) 85px 12px; gap: 10px; padding: 12px; }
    .audit-user-runtime { grid-column: 1 / 3; grid-row: 2; }
    .audit-user-summary > .audit-badge { grid-column: 1 / 3; grid-row: 3; }
    .audit-chevron { grid-column: 3; }
    .audit-user-links > span { margin-left: 0; width: 100%; }
    .audit-connection-row { grid-template-columns: 1fr; padding: 12px; gap: 9px; }
    .audit-connection-row .connection-environment { grid-column: auto; grid-row: auto; }
    .audit-session-check { grid-column: auto; flex-wrap: wrap; }
    .audit-toolbar { align-items: stretch; }
    .audit-toolbar .search-box { flex-basis: 100%; }
}
.telegramers-panel { margin-bottom: 16px; }
.telegramers-panel .telegramer-create { border-bottom: 0; }
.telegramer-create .telegramer-delay { width: 110px; }
