/* RSStT Web — design system
   Neutral paper surfaces, ink text, one warm signal colour (RSS orange)
   and a cool counterpart (Telegram blue) used only for delivery data. */

:root {
    --bg: #f5f5f2;
    --surface: #ffffff;
    --surface-2: #fafaf8;
    --surface-3: #f0efeb;
    --line: #e6e4de;
    --line-strong: #d3d0c8;
    --text: #18181b;
    --text-2: #55555e;
    --text-3: #8b8b94;
    --accent: #e8590c;
    --accent-hover: #d14e08;
    --accent-soft: #fdebdf;
    --accent-text: #b8450a;
    --blue: #2481cc;
    --blue-soft: #e3f0fb;
    --green: #15803d;
    --green-soft: #e3f4e8;
    --amber: #b45309;
    --amber-soft: #fcf0d9;
    --red: #c9302c;
    --red-soft: #fbe5e3;
    --violet: #6d4fc2;
    --violet-soft: #ece7fa;
    --shadow-sm: 0 1px 2px rgb(24 24 27 / 5%);
    --shadow: 0 1px 2px rgb(24 24 27 / 4%), 0 4px 16px -4px rgb(24 24 27 / 8%);
    --shadow-lg: 0 8px 24px -6px rgb(24 24 27 / 14%), 0 24px 64px -12px rgb(24 24 27 / 18%);
    --ring: 0 0 0 3px rgb(232 89 12 / 22%);
    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 14px;
    --sidebar: 236px;
    --font:
        -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
        "Noto Sans CJK SC", system-ui, sans-serif;
    --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
    color-scheme: light;
}

:root[data-theme="dark"] {
    --bg: #0f0f11;
    --surface: #17171a;
    --surface-2: #1b1b1f;
    --surface-3: #232328;
    --line: #2a2a30;
    --line-strong: #3a3a42;
    --text: #ececef;
    --text-2: #a3a3ad;
    --text-3: #71717b;
    --accent: #ff7a2e;
    --accent-hover: #ff8c4a;
    --accent-soft: #3a2216;
    --accent-text: #ff9a5c;
    --blue: #4ea7ec;
    --blue-soft: #15283a;
    --green: #4ac07a;
    --green-soft: #16291e;
    --amber: #e5a43b;
    --amber-soft: #2f2414;
    --red: #f06a62;
    --red-soft: #351a19;
    --violet: #a18cf0;
    --violet-soft: #241d3b;
    --shadow-sm: none;
    --shadow: 0 0 0 1px rgb(255 255 255 / 2%);
    --shadow-lg: 0 24px 64px -12px rgb(0 0 0 / 60%);
    --ring: 0 0 0 3px rgb(255 122 46 / 30%);
    color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0f0f11;
        --surface: #17171a;
        --surface-2: #1b1b1f;
        --surface-3: #232328;
        --line: #2a2a30;
        --line-strong: #3a3a42;
        --text: #ececef;
        --text-2: #a3a3ad;
        --text-3: #71717b;
        --accent: #ff7a2e;
        --accent-hover: #ff8c4a;
        --accent-soft: #3a2216;
        --accent-text: #ff9a5c;
        --blue: #4ea7ec;
        --blue-soft: #15283a;
        --green: #4ac07a;
        --green-soft: #16291e;
        --amber: #e5a43b;
        --amber-soft: #2f2414;
        --red: #f06a62;
        --red-soft: #351a19;
        --violet: #a18cf0;
        --violet-soft: #241d3b;
        --shadow-sm: none;
        --shadow: 0 0 0 1px rgb(255 255 255 / 2%);
        --shadow-lg: 0 24px 64px -12px rgb(0 0 0 / 60%);
        --ring: 0 0 0 3px rgb(255 122 46 / 30%);
        color-scheme: dark;
    }
}

*,
*::before,
*::after {
    box-sizing: border-box;
}
html {
    -webkit-text-size-adjust: 100%;
}
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 14px/1.5 var(--font);
    -webkit-font-smoothing: antialiased;
    font-feature-settings: "cv11", "ss01";
}
button,
input,
select,
textarea {
    font: inherit;
    color: inherit;
}
a {
    color: inherit;
}
h1,
h2,
h3,
h4,
p {
    margin: 0;
}
.mono {
    font-family: var(--mono);
    font-size: 0.92em;
    letter-spacing: -0.01em;
}
.muted {
    color: var(--text-3);
}
.num {
    font-variant-numeric: tabular-nums;
}
.icon {
    flex: none;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
:focus-visible {
    outline: none;
    box-shadow: var(--ring);
}
.boot {
    display: grid;
    place-items: center;
    min-height: 100vh;
    color: var(--text-3);
}

/* ---------- shell ---------- */
.shell {
    display: grid;
    grid-template-columns: var(--sidebar) minmax(0, 1fr);
    min-height: 100vh;
}
.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 18px 12px 14px;
    border-right: 1px solid var(--line);
    background: var(--surface-2);
}
.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 2px 8px 18px;
    text-decoration: none;
}
.brand b {
    display: block;
    font-size: 15px;
    letter-spacing: -0.01em;
}
.brand small {
    display: block;
    color: var(--text-3);
    font-size: 11.5px;
}
.mark {
    display: block;
    border-radius: 9px;
}
.nav {
    display: grid;
    gap: 2px;
}
.nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 36px;
    padding: 0 10px;
    border-radius: 8px;
    color: var(--text-2);
    text-decoration: none;
    font-weight: 500;
    transition:
        background 0.12s,
        color 0.12s;
}
.nav a:hover {
    background: var(--surface-3);
    color: var(--text);
}
.nav a.on {
    background: var(--surface);
    color: var(--text);
    box-shadow:
        var(--shadow-sm),
        inset 0 0 0 1px var(--line);
}
.nav a.on .icon {
    color: var(--accent);
}
.nav .count {
    margin-left: auto;
    min-width: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: var(--red-soft);
    color: var(--red);
    font-size: 11.5px;
    font-weight: 600;
    text-align: center;
    line-height: 18px;
}
.sidebar-foot {
    margin-top: auto;
    display: grid;
    gap: 8px;
}
.bot-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    min-width: 0;
}
.bot-card .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex: none;
    background: var(--text-3);
    box-shadow: 0 0 0 3px var(--surface-3);
}
.bot-card .status-dot.online {
    background: var(--green);
    box-shadow: 0 0 0 3px var(--green-soft);
}
.bot-card .status-dot.preview {
    background: var(--amber);
    box-shadow: 0 0 0 3px var(--amber-soft);
}
.bot-card div {
    min-width: 0;
}
.bot-card b {
    display: block;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.bot-card small {
    display: block;
    color: var(--text-3);
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.prefs {
    display: flex;
    gap: 4px;
}
.prefs .pref {
    flex: 1;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 32px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text-2);
    font-size: 12.5px;
    cursor: pointer;
}
.pref-select {
    position: relative;
}
.pref-select select {
    appearance: none;
    border: 0;
    background: transparent;
    color: inherit;
    font-size: 12.5px;
    padding: 0 2px;
    cursor: pointer;
    outline: none;
}
.pref-select:focus-within {
    box-shadow: var(--ring);
}
.prefs .pref:hover {
    background: var(--surface-3);
    color: var(--text);
}

.main {
    min-width: 0;
}
.topbar {
    display: none;
}
.banner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 32px;
    border-bottom: 1px solid var(--line);
    background: var(--amber-soft);
    color: var(--amber);
    font-size: 13px;
}
.page {
    max-width: 1240px;
    margin: 0 auto;
    padding: 28px 32px 64px;
}
.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
}
.page-head h1 {
    font-size: 24px;
    line-height: 1.2;
    letter-spacing: -0.02em;
    font-weight: 650;
}
.page-head p {
    margin-top: 6px;
    color: var(--text-2);
}
.page-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ---------- cards ---------- */
.card {
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow);
}
.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px 0;
}
.card-head h2,
.card-head h3 {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.01em;
}
.card-head .sub {
    color: var(--text-3);
    font-size: 12.5px;
    margin-top: 2px;
}
.card-body {
    padding: 16px 18px 18px;
}
.grid {
    display: grid;
    gap: 16px;
}
.grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
.grid-main {
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
}
.stack {
    display: grid;
    gap: 16px;
}
.row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.row.wrap {
    flex-wrap: wrap;
}
.spacer {
    flex: 1;
}

/* KPI tiles */
.kpis {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}
.kpi {
    position: relative;
    padding: 16px 18px 16px;
    text-align: left;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow);
    min-width: 0;
}
button.kpi,
a.kpi {
    cursor: pointer;
    text-decoration: none;
    transition:
        border-color 0.15s,
        transform 0.15s;
}
button.kpi:hover,
a.kpi:hover {
    border-color: var(--line-strong);
}
.kpi-label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-2);
    font-size: 13px;
    font-weight: 500;
}
.kpi-label .icon {
    color: var(--text-3);
}
.kpi-value {
    margin-top: 10px;
    font-size: 30px;
    line-height: 1.1;
    font-weight: 650;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
}
.kpi-meta {
    margin-top: 8px;
    color: var(--text-3);
    font-size: 12.5px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
}
.kpi-meta b {
    color: var(--text-2);
    font-weight: 600;
}
.kpi.warn .kpi-value {
    color: var(--amber);
}
.kpi.bad .kpi-value {
    color: var(--red);
}
.kpi.good .kpi-value {
    color: var(--text);
}

/* breakdown bar */
.split {
    display: flex;
    height: 6px;
    margin-top: 12px;
    border-radius: 3px;
    overflow: hidden;
    background: var(--surface-3);
}
.split span {
    height: 100%;
}
.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    color: var(--text-2);
    font-size: 12.5px;
}
.legend i {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 2px;
    margin-right: 6px;
    vertical-align: 0;
}

/* chart */
.chart {
    position: relative;
    height: 220px;
}
.chart svg {
    display: block;
    width: 100%;
    height: 100%;
    overflow: visible;
}
.chart .grid-line {
    stroke: var(--line);
    stroke-dasharray: 2 4;
}
.chart .axis {
    fill: var(--text-3);
    font-size: 11px;
    font-family: var(--font);
}
.chart .bar {
    fill: var(--blue);
    opacity: 0.85;
}
.chart .bar.gap {
    fill: var(--surface-3);
    opacity: 1;
}
.chart .line {
    fill: none;
    stroke: var(--accent);
    stroke-width: 2;
    stroke-linejoin: round;
}
.chart .hover-col {
    fill: var(--text);
    opacity: 0.04;
}
.chart-tip {
    position: absolute;
    top: 0;
    pointer-events: none;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    font-size: 12.5px;
    white-space: nowrap;
    transform: translateX(-50%);
    z-index: 2;
}
.chart-tip b {
    display: block;
    margin-bottom: 4px;
}
.chart-sum {
    display: flex;
    gap: 22px;
    margin-bottom: 14px;
}
.chart-sum div small {
    display: block;
    color: var(--text-3);
    font-size: 12px;
}
.chart-sum div b {
    font-size: 20px;
    font-weight: 650;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}

/* list rows */
.list {
    display: grid;
}
.list-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 18px;
    border-top: 1px solid var(--line);
    min-width: 0;
    text-align: left;
    background: none;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
    width: 100%;
}
.list-row:first-child {
    border-top: 0;
}
button.list-row {
    cursor: pointer;
}
button.list-row:hover {
    background: var(--surface-2);
}
.list-row .grow {
    flex: 1;
    min-width: 0;
}
.list-row .title {
    display: block;
    font-weight: 550;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.list-row .meta {
    display: block;
    color: var(--text-3);
    font-size: 12.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---------- toolbar & table ---------- */
.toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 12px;
    border-bottom: 1px solid var(--line);
}
.toolbar .search {
    flex: 1 1 240px;
}
.target-filter {
    flex: 0 1 260px;
    min-width: 200px;
}
@media (max-width: 560px) {
    .target-filter {
        flex: 1 1 100%;
    }
}
.toolbar .total {
    margin-left: auto;
    color: var(--text-3);
    font-size: 13px;
    white-space: nowrap;
}
.table {
    width: 100%;
    border-collapse: collapse;
}
.table th {
    padding: 9px 12px;
    color: var(--text-3);
    font-size: 12px;
    font-weight: 500;
    text-align: left;
    white-space: nowrap;
    border-bottom: 1px solid var(--line);
    background: var(--surface-2);
}
.table td {
    padding: 11px 12px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}
.table tr:last-child td {
    border-bottom: 0;
}
.table tbody tr {
    transition: background 0.1s;
}
.table tbody tr.clickable {
    cursor: pointer;
}
.table tbody tr:hover {
    background: var(--surface-2);
}
.table tbody tr.selected {
    background: var(--accent-soft);
}
.table .check {
    width: 40px;
    padding-right: 0;
}
.table .end {
    text-align: right;
    white-space: nowrap;
}
.cell-main {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.cell-main > div {
    min-width: 0;
}
.cell-title {
    display: block;
    font-weight: 550;
    max-width: 420px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cell-sub {
    display: block;
    color: var(--text-3);
    font-size: 12.5px;
    max-width: 420px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.table-wrap {
    overflow-x: auto;
}
.checkbox {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
    cursor: pointer;
}
.batchbar {
    position: sticky;
    bottom: 16px;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 8px;
    width: fit-content;
    margin: 16px auto 0;
    padding: 8px 8px 8px 16px;
    border-radius: 12px;
    background: var(--text);
    color: var(--bg);
    box-shadow: var(--shadow-lg);
}
.batchbar .btn {
    background: transparent;
    color: var(--bg);
    border-color: color-mix(in srgb, var(--bg) 25%, transparent);
}
.batchbar .btn:hover {
    background: color-mix(in srgb, var(--bg) 12%, transparent);
}
.batchbar .btn-danger {
    color: #ffb4ad;
}
.pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-top: 1px solid var(--line);
    font-size: 13px;
}
.pager-buttons {
    display: flex;
    align-items: center;
    gap: 6px;
}
.pager-num {
    min-width: 54px;
    text-align: center;
    color: var(--text-2);
    font-variant-numeric: tabular-nums;
}

/* ---------- controls ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 34px;
    padding: 0 13px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    font-weight: 550;
    font-size: 13.5px;
    white-space: nowrap;
    cursor: pointer;
    transition:
        background 0.12s,
        border-color 0.12s,
        color 0.12s,
        transform 0.06s;
    box-shadow: var(--shadow-sm);
}
.btn:hover {
    background: var(--surface-2);
    border-color: var(--text-3);
}
.btn:active {
    transform: translateY(1px);
}
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}
.btn-primary {
    border-color: var(--accent);
    background: var(--accent);
    color: #fff;
}
.btn-primary:hover {
    border-color: var(--accent-hover);
    background: var(--accent-hover);
}
.btn-danger {
    color: var(--red);
}
.btn-danger:hover {
    border-color: var(--red);
    background: var(--red-soft);
}
.btn-solid-danger {
    border-color: var(--red);
    background: var(--red);
    color: #fff;
}
.btn-solid-danger:hover {
    border-color: var(--red);
    background: color-mix(in srgb, var(--red) 88%, #000);
}
.btn-ghost {
    border-color: transparent;
    background: transparent;
    box-shadow: none;
    color: var(--text-2);
}
.btn-ghost:hover {
    background: var(--surface-3);
    border-color: transparent;
    color: var(--text);
}
.btn-sm {
    height: 28px;
    padding: 0 10px;
    font-size: 12.5px;
    border-radius: 7px;
}
.btn-lg {
    height: 42px;
    padding: 0 18px;
    font-size: 14.5px;
}
.btn.is-loading {
    cursor: progress;
}
.icon-btn {
    display: inline-grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text-2);
    cursor: pointer;
}
.icon-btn:hover {
    background: var(--surface-3);
    color: var(--text);
}
.icon-btn:disabled {
    opacity: 0.35;
    cursor: default;
}
.link-btn {
    padding: 0;
    border: 0;
    background: none;
    color: var(--accent-text);
    font-weight: 550;
    cursor: pointer;
}
.link-btn:hover {
    text-decoration: underline;
}

.field {
    display: grid;
    gap: 6px;
    min-width: 0;
    align-content: start;
}
.field-label {
    color: var(--text);
    font-size: 13px;
    font-weight: 550;
}
.field-hint {
    color: var(--text-3);
    font-size: 12.5px;
}
.field-error {
    color: var(--red);
    font-size: 12.5px;
}
.input {
    width: 100%;
    height: 36px;
    padding: 0 11px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: var(--surface);
    transition:
        border-color 0.12s,
        box-shadow 0.12s;
}
.input:hover {
    border-color: var(--text-3);
}
.input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: var(--ring);
}
.input::placeholder {
    color: var(--text-3);
}
.textarea {
    min-height: 88px;
    height: auto;
    padding: 9px 11px;
    resize: vertical;
    line-height: 1.5;
}
.select {
    position: relative;
    display: inline-flex;
    align-items: center;
    min-width: 0;
}
.select select {
    appearance: none;
    width: 100%;
    height: 36px;
    padding: 0 32px 0 11px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: var(--surface);
    cursor: pointer;
}
.select select:hover {
    border-color: var(--text-3);
}
.select select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: var(--ring);
}
.select .icon {
    position: absolute;
    right: 10px;
    pointer-events: none;
    color: var(--text-3);
}
.field .select {
    display: flex;
}
.search {
    position: relative;
    display: flex;
    align-items: center;
    min-width: 0;
}
.search .icon {
    position: absolute;
    left: 11px;
    color: var(--text-3);
    pointer-events: none;
}
.search input {
    width: 100%;
    height: 36px;
    padding: 0 11px 0 34px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: var(--surface);
}
.search input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: var(--ring);
}
.segmented {
    display: inline-flex;
    padding: 3px;
    gap: 2px;
    border-radius: 9px;
    background: var(--surface-3);
}
.segmented button {
    height: 30px;
    padding: 0 12px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--text-2);
    font-size: 13px;
    font-weight: 550;
    cursor: pointer;
    white-space: nowrap;
}
.segmented button:hover {
    color: var(--text);
}
.segmented button.on {
    background: var(--surface);
    color: var(--text);
    box-shadow:
        var(--shadow-sm),
        0 0 0 1px var(--line);
}
.segmented-sm button {
    height: 26px;
    padding: 0 10px;
    font-size: 12.5px;
}
.switch-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 0;
    cursor: pointer;
}
.switch-row + .switch-row {
    border-top: 1px solid var(--line);
}
.switch-row.is-disabled {
    opacity: 0.55;
    cursor: default;
}
.switch-text {
    display: grid;
    gap: 2px;
}
.switch-label {
    font-weight: 550;
}
.switch-desc {
    color: var(--text-3);
    font-size: 12.5px;
}
.switch {
    appearance: none;
    flex: none;
    position: relative;
    width: 36px;
    height: 20px;
    margin: 0;
    border-radius: 10px;
    background: var(--line-strong);
    cursor: pointer;
    transition: background 0.15s;
}
.switch::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 2px rgb(0 0 0 / 25%);
    transition: transform 0.15s;
}
.switch:checked {
    background: var(--accent);
}
.switch:checked::after {
    transform: translateX(16px);
}
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px 14px;
}
.form-grid .full {
    grid-column: 1 / -1;
}
.form-section {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--line);
}
.form-section h4 {
    margin-bottom: 4px;
    font-size: 13.5px;
    font-weight: 600;
}
.form-section > p {
    margin-bottom: 14px;
    color: var(--text-3);
    font-size: 12.5px;
}

/* ---------- badges ---------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 22px;
    padding: 0 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 550;
    white-space: nowrap;
    background: var(--surface-3);
    color: var(--text-2);
}
.badge .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}
.badge-green {
    background: var(--green-soft);
    color: var(--green);
}
.badge-amber {
    background: var(--amber-soft);
    color: var(--amber);
}
.badge-red {
    background: var(--red-soft);
    color: var(--red);
}
.badge-blue {
    background: var(--blue-soft);
    color: var(--blue);
}
.badge-accent {
    background: var(--accent-soft);
    color: var(--accent-text);
}
.badge-violet {
    background: var(--violet-soft);
    color: var(--violet);
}
.kind {
    color: var(--text-2);
    font-size: 12.5px;
    white-space: nowrap;
}
.avatar {
    display: inline-grid;
    place-items: center;
    flex: none;
    width: var(--s);
    height: var(--s);
    border-radius: 50%;
    font-size: calc(var(--s) * 0.42);
    font-weight: 650;
    color: #fff;
    background: linear-gradient(140deg, #9a9aa3, #6d6d76);
}
.avatar-private {
    background: linear-gradient(140deg, #5aa9ea, #2481cc);
}
.avatar-group {
    background: linear-gradient(140deg, #8a73e0, #6247c4);
}
.avatar-channel {
    background: linear-gradient(140deg, #ff9a52, #e8590c);
}
.avatar-unknown {
    background: linear-gradient(140deg, #f0a35e, #c26a2b);
}
.feed-icon {
    display: inline-grid;
    place-items: center;
    flex: none;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--accent-soft);
    color: var(--accent-text);
    font-weight: 700;
    font-size: 13px;
}
.feed-icon.paused {
    background: var(--surface-3);
    color: var(--text-3);
}
.feed-icon.error {
    background: var(--red-soft);
    color: var(--red);
}
.copy {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 1px 6px;
    margin-left: -6px;
    border: 0;
    border-radius: 5px;
    background: none;
    color: var(--text-3);
    cursor: pointer;
}
.copy:hover {
    background: var(--surface-3);
    color: var(--text-2);
}

/* ---------- notices & empty ---------- */
.notice {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 11px 14px;
    border-radius: var(--radius);
    background: var(--blue-soft);
    color: var(--text);
    font-size: 13px;
}
.notice > .icon {
    margin-top: 2px;
    color: var(--blue);
}
.notice strong {
    display: block;
    margin-bottom: 2px;
}
.notice > div {
    flex: 1;
    min-width: 0;
}
.notice-warn {
    background: var(--amber-soft);
}
.notice-warn > .icon {
    color: var(--amber);
}
.notice-error {
    background: var(--red-soft);
}
.notice-error > .icon {
    color: var(--red);
}
.empty {
    display: grid;
    justify-items: center;
    gap: 6px;
    padding: 48px 24px;
    text-align: center;
    color: var(--text-2);
}
.empty-icon {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    margin-bottom: 6px;
    border-radius: 12px;
    background: var(--surface-3);
    color: var(--text-3);
}
.empty strong {
    color: var(--text);
    font-size: 14.5px;
}
.empty p {
    max-width: 420px;
    font-size: 13px;
    color: var(--text-3);
}
.empty .btn {
    margin-top: 10px;
}
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 40px;
    color: var(--text-3);
}
.spinner {
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    opacity: 0.7;
}
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ---------- overlays ---------- */
.drawer-backdrop,
.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 40;
    background: rgb(15 15 17 / 32%);
    animation: fade 0.16s ease-out;
}
.modal-backdrop {
    z-index: 60;
    display: grid;
    place-items: center;
    padding: 20px;
}
@keyframes fade {
    from {
        opacity: 0;
    }
}
.drawer {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(620px, 100vw);
    display: flex;
    flex-direction: column;
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    animation: slide 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
    outline: none;
}
.drawer-wide {
    width: min(760px, 100vw);
}
@keyframes slide {
    from {
        transform: translateX(32px);
        opacity: 0;
    }
}
.drawer-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 20px 20px 14px 24px;
}
.drawer-title {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}
.drawer-title h2 {
    font-size: 18px;
    font-weight: 650;
    letter-spacing: -0.01em;
    overflow-wrap: anywhere;
}
.drawer-sub {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 10px;
    margin-top: 3px;
    color: var(--text-3);
    font-size: 12.5px;
}
.drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 0 24px 24px;
}
.drawer-foot {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 24px;
    border-top: 1px solid var(--line);
    background: var(--surface-2);
}
.drawer-foot .dirty {
    margin-right: auto;
    color: var(--amber);
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.tabs {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    gap: 2px;
    margin: 0 -24px 20px;
    padding: 0 20px;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
    overflow-x: auto;
    scrollbar-width: none;
}
.tabs button {
    position: relative;
    display: flex;
    align-items: center;
    gap: 6px;
    height: 40px;
    padding: 0 10px;
    border: 0;
    background: none;
    color: var(--text-2);
    font-weight: 550;
    white-space: nowrap;
    cursor: pointer;
}
.tabs button:hover {
    color: var(--text);
}
.tabs button.on {
    color: var(--text);
}
.tabs button.on::after {
    content: "";
    position: absolute;
    left: 8px;
    right: 8px;
    bottom: -1px;
    height: 2px;
    border-radius: 2px;
    background: var(--accent);
}
.tab-badge {
    min-width: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--surface-3);
    color: var(--text-2);
    font-size: 11px;
    line-height: 18px;
    text-align: center;
}
.modal {
    width: min(480px, 100%);
    max-height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    animation: pop 0.18s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.modal-lg {
    width: min(640px, 100%);
}
@keyframes pop {
    from {
        transform: scale(0.97);
        opacity: 0;
    }
}
.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 16px 4px 20px;
}
.modal-head h3 {
    font-size: 16px;
    font-weight: 650;
}
.modal-body {
    padding: 8px 20px 18px;
    overflow-y: auto;
    display: grid;
    gap: 14px;
}
.confirm-body {
    color: var(--text-2);
    line-height: 1.6;
}
.modal-foot {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 20px 16px;
}
.toasts {
    position: fixed;
    bottom: 20px;
    left: 50%;
    z-index: 80;
    display: grid;
    gap: 8px;
    transform: translateX(-50%);
    width: max-content;
    max-width: calc(100vw - 32px);
}
.toast {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 10px 14px;
    border-radius: 10px;
    background: var(--text);
    color: var(--bg);
    box-shadow: var(--shadow-lg);
    font-size: 13.5px;
    animation: pop 0.2s ease-out;
}
.toast-ok .icon {
    color: #6fdc96;
}
.toast-error .icon {
    color: #ff958d;
}

/* ---------- chat picker ---------- */
.picker {
    position: relative;
}
.picker-control {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;
    min-height: 36px;
    padding: 4px 30px 4px 6px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: var(--surface);
    cursor: text;
    position: relative;
}
.picker.is-open .picker-control {
    border-color: var(--accent);
    box-shadow: var(--ring);
}
.picker-control > .icon {
    position: absolute;
    right: 10px;
    top: 11px;
    color: var(--text-3);
}
.picker-control input {
    flex: 1;
    min-width: 120px;
    height: 26px;
    padding: 0 5px;
    border: 0;
    background: none;
    outline: none;
}
.picker-current {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding-left: 4px;
    font-weight: 550;
}
.chip {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    height: 24px;
    padding: 0 3px 0 8px;
    border-radius: 6px;
    background: var(--surface-3);
    font-size: 12.5px;
    font-weight: 550;
}
.chip button {
    display: grid;
    place-items: center;
    width: 18px;
    height: 18px;
    border: 0;
    border-radius: 4px;
    background: none;
    color: var(--text-3);
    cursor: pointer;
}
.chip button:hover {
    background: var(--line);
    color: var(--text);
}
.picker-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 20;
    max-height: 280px;
    overflow-y: auto;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    box-shadow: var(--shadow-lg);
}
.picker-option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 7px 8px;
    border: 0;
    border-radius: 7px;
    background: none;
    text-align: left;
    cursor: pointer;
}
.picker-option:hover {
    background: var(--surface-3);
}
.picker-option.on .icon {
    color: var(--accent);
}
.picker-text {
    flex: 1;
    min-width: 0;
}
.picker-text b {
    display: block;
    font-weight: 550;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.picker-text small {
    display: block;
    color: var(--text-3);
    font-size: 12px;
}
.picker-empty {
    padding: 16px;
    color: var(--text-3);
    text-align: center;
}

/* ---------- detail blocks ---------- */
.facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 1px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--line);
    margin-bottom: 20px;
}
.facts > div {
    padding: 11px 14px;
    background: var(--surface);
    min-width: 0;
}
.facts small {
    display: block;
    color: var(--text-3);
    font-size: 12px;
}
.facts b {
    display: block;
    margin-top: 2px;
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: 22px 0 10px;
}
.section-title:first-child {
    margin-top: 0;
}
.section-title h3 {
    font-size: 13.5px;
    font-weight: 600;
}
.section-title p {
    color: var(--text-3);
    font-size: 12.5px;
}
.panel {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
}
.panel .list-row {
    padding: 10px 14px;
}
.action-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}
.action-card + .action-card {
    margin-top: 10px;
}
.action-card > div {
    flex: 1;
    min-width: 0;
}
.action-card b {
    display: block;
    font-weight: 600;
}
.action-card p {
    color: var(--text-3);
    font-size: 12.5px;
    margin-top: 2px;
}
.action-card.danger {
    border-color: color-mix(in srgb, var(--red) 30%, var(--line));
}
.timeline {
    display: grid;
}
.event {
    display: grid;
    grid-template-columns: 16px minmax(0, 1fr);
    gap: 12px;
    padding: 12px 0;
    border-top: 1px solid var(--line);
}
.event:first-child {
    border-top: 0;
}
.event .lvl {
    width: 8px;
    height: 8px;
    margin: 6px 4px;
    border-radius: 50%;
    background: var(--text-3);
}
.lvl-info {
    background: var(--blue) !important;
}
.lvl-warning {
    background: var(--amber) !important;
}
.lvl-error {
    background: var(--red) !important;
}
.lvl-ok {
    background: var(--green) !important;
}
.event-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 10px;
}
.event-head b {
    font-weight: 550;
}
.event-meta {
    color: var(--text-3);
    font-size: 12.5px;
    margin-top: 2px;
}
.kv {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    gap: 4px 14px;
    margin-top: 8px;
    padding: 10px 12px;
    border-radius: 8px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    font-size: 12.5px;
}
.kv dt {
    color: var(--text-3);
}
.kv dd {
    margin: 0;
    overflow-wrap: anywhere;
}
.article {
    padding: 14px 0;
    border-top: 1px solid var(--line);
}
.article:first-child {
    border-top: 0;
    padding-top: 0;
}
.article-head {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    justify-content: space-between;
}
.article h4 {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
}
.article h4 a {
    text-decoration: none;
}
.article h4 a:hover {
    text-decoration: underline;
}
.article p {
    margin-top: 6px;
    color: var(--text-2);
    font-size: 13px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.article .meta {
    margin-top: 6px;
    color: var(--text-3);
    font-size: 12px;
}
.option-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}
.inherit {
    color: var(--text-3);
    font-size: 12px;
    font-weight: 450;
}
.settings-layout {
    display: grid;
    grid-template-columns: 200px minmax(0, 1fr);
    gap: 28px;
    align-items: start;
}
.subnav {
    position: sticky;
    top: 24px;
    display: grid;
    gap: 2px;
}
.subnav button {
    display: flex;
    align-items: center;
    gap: 9px;
    height: 34px;
    padding: 0 10px;
    border: 0;
    border-radius: 8px;
    background: none;
    color: var(--text-2);
    font-weight: 550;
    text-align: left;
    cursor: pointer;
}
.subnav button:hover {
    background: var(--surface-3);
    color: var(--text);
}
.subnav button.on {
    background: var(--surface);
    color: var(--text);
    box-shadow:
        var(--shadow-sm),
        inset 0 0 0 1px var(--line);
}
.subnav button.on .icon {
    color: var(--accent);
}
.secret {
    padding: 12px;
    border: 1px dashed var(--accent);
    border-radius: 8px;
    background: var(--accent-soft);
    font-family: var(--mono);
    font-size: 12.5px;
    overflow-wrap: anywhere;
    user-select: all;
}
.dropzone {
    display: grid;
    justify-items: center;
    gap: 6px;
    padding: 24px;
    border: 1.5px dashed var(--line-strong);
    border-radius: var(--radius);
    color: var(--text-3);
    text-align: center;
    cursor: pointer;
}
.dropzone:hover {
    border-color: var(--accent);
    color: var(--text-2);
}
.dropzone input {
    display: none;
}
.chk {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 9px 0;
    cursor: pointer;
}
.chk input {
    margin-top: 3px;
}
.chk small {
    display: block;
    color: var(--text-3);
    font-size: 12.5px;
}

/* ---------- login ---------- */
.login {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    min-height: 100vh;
}
.login-art {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 40px 48px;
    overflow: hidden;
    background: #141416;
    color: #f4f4f5;
}
.login-art::before {
    content: "";
    position: absolute;
    inset: auto -20% -40% -20%;
    height: 90%;
    background:
        radial-gradient(closest-side, rgb(232 89 12 / 38%), transparent 70%),
        radial-gradient(closest-side at 80% 60%, rgb(36 129 204 / 30%), transparent 70%);
    filter: blur(20px);
}
.login-art > * {
    position: relative;
}
.login-art .brand small {
    color: #a1a1aa;
}
.login-art h1 {
    font-size: clamp(30px, 3.6vw, 44px);
    line-height: 1.1;
    letter-spacing: -0.035em;
    font-weight: 700;
    max-width: 12em;
}
.login-art p {
    margin-top: 14px;
    max-width: 30em;
    color: #b4b4bc;
    font-size: 15px;
}
.flow {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 40px;
}
.flow-node {
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: rgb(255 255 255 / 6%);
    border: 1px solid rgb(255 255 255 / 10%);
}
.flow-line {
    flex: 0 1 60px;
    height: 1px;
    background: linear-gradient(90deg, rgb(255 255 255 / 0%), rgb(255 255 255 / 40%), rgb(255 255 255 / 0%));
}
.login-art footer {
    color: #71717a;
    font-size: 12.5px;
}
.login-form {
    display: grid;
    place-items: center;
    padding: 40px 24px;
}
.login-form form {
    width: min(360px, 100%);
    display: grid;
    gap: 18px;
}
.login-form h2 {
    font-size: 24px;
    font-weight: 650;
    letter-spacing: -0.02em;
}
.login-form .lead {
    color: var(--text-2);
    margin-top: 6px;
}
.login-prefs {
    position: absolute;
    top: 20px;
    right: 24px;
    display: flex;
    gap: 4px;
}

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
    .kpis {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .grid-main {
        grid-template-columns: minmax(0, 1fr);
    }
}
@media (max-width: 860px) {
    .shell {
        grid-template-columns: minmax(0, 1fr);
    }
    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        z-index: 50;
        width: 272px;
        transform: translateX(-100%);
        transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
        box-shadow: var(--shadow-lg);
    }
    .menu-open .sidebar {
        transform: none;
    }
    .scrim {
        position: fixed;
        inset: 0;
        z-index: 45;
        background: rgb(15 15 17 / 35%);
    }
    .topbar {
        position: sticky;
        top: 0;
        z-index: 30;
        display: flex;
        align-items: center;
        gap: 10px;
        height: 54px;
        padding: 0 12px;
        border-bottom: 1px solid var(--line);
        background: color-mix(in srgb, var(--bg) 88%, transparent);
        backdrop-filter: blur(12px);
    }
    .topbar b {
        font-size: 15px;
    }
    .page {
        padding: 20px 16px 56px;
    }
    .banner {
        padding: 8px 16px;
    }
    .page-head {
        flex-direction: column;
        align-items: stretch;
    }
    .settings-layout {
        grid-template-columns: minmax(0, 1fr);
        gap: 14px;
    }
    .subnav {
        position: static;
        display: flex;
        overflow-x: auto;
        scrollbar-width: none;
    }
    .subnav button {
        white-space: nowrap;
    }
    .login {
        grid-template-columns: minmax(0, 1fr);
    }
    .login-art {
        padding: 28px 24px 32px;
        min-height: 0;
    }
    .login-art .flow,
    .login-art footer {
        display: none;
    }
    .login-art h1 {
        margin-top: 28px;
        font-size: 28px;
    }
    /* table → cards */
    .table.responsive thead {
        display: none;
    }
    .table.responsive,
    .table.responsive tbody,
    .table.responsive tr,
    .table.responsive td {
        display: block;
        width: 100%;
    }
    .table.responsive tr {
        position: relative;
        padding: 12px 14px;
        border-bottom: 1px solid var(--line);
    }
    .table.responsive td {
        padding: 2px 0;
        border: 0;
    }
    .table.responsive td.check {
        position: absolute;
        top: 14px;
        right: 12px;
        width: auto;
    }
    .table.responsive td[data-label] {
        display: flex;
        justify-content: space-between;
        gap: 12px;
        font-size: 13px;
    }
    .table.responsive td[data-label]::before {
        content: attr(data-label);
        color: var(--text-3);
    }
    .table.responsive td.end {
        text-align: left;
        padding-top: 8px;
    }
    .cell-title,
    .cell-sub {
        max-width: calc(100vw - 120px);
    }
    .table.responsive td.chev {
        display: none;
    }
}
@media (max-width: 560px) {
    .kpis {
        grid-template-columns: minmax(0, 1fr);
    }
    .form-grid,
    .option-grid,
    .grid-2 {
        grid-template-columns: minmax(0, 1fr);
    }
    .toolbar .select,
    .toolbar .segmented {
        flex: 1 1 auto;
    }
    .toolbar .select select {
        width: 100%;
    }
    .drawer-body {
        padding: 0 16px 20px;
    }
    .tabs {
        margin: 0 -16px 16px;
        padding: 0 12px;
    }
    .drawer-head {
        padding: 16px 12px 12px 16px;
    }
    .drawer-foot {
        padding: 12px 16px;
    }
    .chart {
        height: 180px;
    }
}
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
    }
}

/* runtime configuration rows */
.rt-list {
    display: grid;
}
.rt-row {
    display: grid;
    gap: 6px;
    padding: 16px 0;
    border-top: 1px solid var(--line);
}
.rt-row:first-child {
    border-top: 0;
    padding-top: 0;
}
.rt-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
}
.rt-head b {
    font-weight: 600;
}
.rt-key {
    font-size: 11.5px;
}
.rt-help {
    color: var(--text-2);
    font-size: 13px;
    line-height: 1.6;
    max-width: 72ch;
}
.rt-current {
    font-size: 12.5px;
    color: var(--text-2);
}
.rt-control {
    margin-top: 4px;
    max-width: 560px;
}
.rt-control .segmented {
    flex-wrap: wrap;
}
