:root {
    --bg: #eef2f0;
    --bg-accent: #d9e6df;
    --surface: #ffffff;
    --ink: #15231c;
    --muted: #5d6f66;
    --line: #d5e0da;
    --brand: #0f6b4c;
    --brand-2: #14855f;
    --brand-soft: #e3f3ec;
    --warn: #9a6700;
    --warn-bg: #fff6da;
    --danger: #b42318;
    --danger-bg: #fee4e2;
    --ok: #027a48;
    --ok-bg: #dcfae6;
    --shadow: 0 18px 40px rgba(21, 35, 28, 0.08);
    --radius: 16px;
    --font: "Be Vietnam Pro", sans-serif;
    --mono: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
    font-family: var(--font);
    color: var(--ink);
    background:
        radial-gradient(1200px 500px at 10% -10%, rgba(20, 133, 95, 0.16), transparent 60%),
        radial-gradient(900px 400px at 100% 0%, rgba(21, 35, 28, 0.06), transparent 55%),
        linear-gradient(180deg, #f5f8f6 0%, var(--bg) 40%, #e7efe9 100%);
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: var(--mono); font-size: 0.86em; }

.app-shell {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: linear-gradient(180deg, #123528 0%, #0d241c 100%);
    color: #edf7f2;
    padding: 24px 18px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.brand {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 4px 8px;
}
.brand strong { display: block; font-size: 1.05rem; }
.brand small { color: #9eb9ac; }

.brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #1fa874, #0f6b4c);
    font-weight: 700;
    letter-spacing: 0.02em;
}
.brand-mark.lg { width: 56px; height: 56px; font-size: 1.2rem; margin: 0 auto 12px; }

.nav { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.nav-link {
    color: #c7ddd2;
    padding: 12px 14px;
    border-radius: 12px;
    text-decoration: none;
    transition: background .2s ease, color .2s ease, transform .2s ease;
}
.nav-link:hover { background: rgba(255,255,255,0.06); color: #fff; text-decoration: none; transform: translateX(2px); }
.nav-link.active { background: rgba(31, 168, 116, 0.22); color: #fff; }

.sidebar-foot { display: grid; gap: 10px; }
.user-chip {
    background: rgba(255,255,255,0.06);
    border-radius: 12px;
    padding: 12px;
}
.user-chip span { display: block; font-weight: 600; }
.user-chip small { color: #9eb9ac; }

.main {
    padding: 28px 32px 48px;
    min-width: 0;
    max-width: 100%;
    overflow-x: clip;
}
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}
.topbar h1 { margin: 0; font-size: 1.6rem; letter-spacing: -0.02em; }
.topbar-bot { color: var(--muted); font-size: 0.92rem; }
.bot-switcher {
    background: rgba(255,255,255,0.06);
    border-radius: 12px;
    padding: 12px;
}
.bot-switcher label { gap: 8px; }
.bot-switcher span { color: #9eb9ac; font-size: 0.8rem; }
.bot-switcher select {
    background: #0f241c;
    color: #edf7f2;
    border-color: rgba(255,255,255,0.12);
}
.settings-group {
    margin: 8px 0 4px;
    padding-top: 12px;
    border-top: 1px dashed var(--line);
    font-size: 1rem;
}
.settings-group:first-of-type {
    border-top: 0;
    padding-top: 0;
}

.config-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 0;
}
.config-tab {
    padding: 10px 14px;
    border-radius: 12px;
    background: #f3f7f5;
    color: var(--muted);
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    border: 1px solid transparent;
}
.config-tab:hover { background: var(--brand-soft); color: var(--brand); text-decoration: none; }
.config-tab.active {
    background: var(--brand);
    color: #fff;
    box-shadow: 0 8px 18px rgba(15, 107, 76, 0.2);
}
.config-lead { margin: 0 0 4px; }

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}
.form-grid .span-2 { grid-column: 1 / -1; }

.message-field { display: grid; gap: 8px; }
.field-help { margin: 0; font-weight: 400; }
.placeholder-list {
    margin: 0;
    padding: 10px 12px 10px 28px;
    background: #f5faf7;
    border: 1px solid var(--line);
    border-radius: 12px;
    color: var(--muted);
    font-size: 0.86rem;
}
.placeholder-list li { margin: 4px 0; }
.placeholder-list code {
    color: var(--brand);
    font-weight: 600;
}

.content { display: grid; gap: 20px; }

/* —— Shared config / bots layout —— */
.config-page,
.bots-page { gap: 22px; }
.config-hero .panel-head { align-items: flex-start; }
.config-hero .config-tabs { margin: 4px 0 0; }
.config-fieldset,
.bots-fieldset {
    margin: 0;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 16px 16px 18px;
    background: #f8fcfa;
}
.config-fieldset legend,
.bots-fieldset legend {
    padding: 0 8px;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--brand);
}
.col-input {
    text-transform: uppercase;
    max-width: 6rem;
}
.webhook-card {
    gap: 8px;
    margin-bottom: 16px;
}
.item-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
}
.item-card {
    display: grid;
    gap: 12px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fbfffd;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.item-card:hover {
    border-color: #b7d4c6;
    box-shadow: 0 10px 24px rgba(21, 35, 28, 0.06);
}
.item-card.is-current {
    border-color: var(--brand);
    background: linear-gradient(180deg, #eef8f3 0%, #fbfffd 55%);
}
.item-card.is-off { opacity: 0.78; }
.item-card h3 { margin: 0; font-size: 1.05rem; }
.pre-clamp {
    margin: 0;
    line-height: 1.45;
}

.bots-create .panel-head { align-items: flex-start; }
.bots-create-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 18px;
}
.bots-create-actions {
    align-items: center;
    padding-top: 4px;
}
.bots-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.6rem;
    height: 1.6rem;
    margin-left: 6px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--brand-soft);
    color: var(--brand);
    font-size: 0.85rem;
    vertical-align: middle;
}

.bot-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
}
.bot-card {
    display: grid;
    gap: 12px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fbfffd;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.bot-card:hover {
    border-color: #b7d4c6;
    box-shadow: 0 10px 24px rgba(21, 35, 28, 0.06);
}
.bot-card.is-current {
    border-color: var(--brand);
    background: linear-gradient(180deg, #eef8f3 0%, #fbfffd 55%);
    box-shadow: 0 10px 24px rgba(15, 107, 76, 0.1);
}
.bot-card.is-off { opacity: 0.78; }
.bot-card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
}
.bot-card-head h3 {
    margin: 0;
    font-size: 1.05rem;
    letter-spacing: -0.01em;
}
.bot-card-meta {
    margin-top: 4px;
    color: var(--muted);
    font-size: 0.86rem;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.bot-card-meta .muted { color: var(--muted); }
.bot-card-flags {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.bot-card-flags li {
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
}
.bot-card-flags li.ok { background: var(--ok-bg); color: var(--ok); }
.bot-card-flags li.warn { background: var(--warn-bg); color: var(--warn); }
.bot-card-webhook {
    margin: 0;
    color: var(--muted);
    word-break: break-all;
}
.bot-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    padding-top: 4px;
    border-top: 1px dashed var(--line);
}
.bot-card-actions .btn { padding: 8px 12px; font-size: 0.9rem; }
.bot-card-actions .btn-ghost {
    border-color: transparent;
    color: var(--danger);
}
.bot-card-actions .btn-ghost:hover { background: var(--danger-bg); }

/* —— Logs page —— */
.config-page.logs-page {
    min-width: 0;
    max-width: 100%;
    overflow-x: clip;
}
.logs-layout {
    display: grid;
    grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
    gap: 18px;
    align-items: start;
    min-width: 0;
    max-width: 100%;
}
.logs-list-panel,
.logs-detail-panel {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}
.logs-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: min(68vh, 720px);
    overflow-x: hidden;
    overflow-y: auto;
    padding-right: 4px;
}
.log-row {
    display: grid;
    gap: 6px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fbfffd;
    text-decoration: none;
    color: inherit;
    min-width: 0;
    max-width: 100%;
    transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.log-row:hover {
    border-color: #b7d4c6;
    text-decoration: none;
    box-shadow: 0 8px 18px rgba(21, 35, 28, 0.06);
}
.log-row.is-active {
    border-color: var(--brand);
    background: linear-gradient(180deg, #eef8f3 0%, #fbfffd 70%);
    box-shadow: 0 8px 18px rgba(15, 107, 76, 0.1);
}
.log-row-top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.log-row-id {
    font-weight: 700;
    color: var(--ink);
}
.log-row-kind {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--muted);
    padding: 3px 8px;
    border-radius: 999px;
    background: #f3f7f5;
}
.log-row-time {
    margin-left: auto;
    font-size: 0.8rem;
    color: var(--muted);
}
.log-row-preview {
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.4;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.logs-detail-panel {
    position: sticky;
    top: 16px;
}
.logs-detail-empty {
    min-height: 180px;
    display: grid;
    place-items: center;
}
.logs-code {
    max-height: min(62vh, 640px);
    margin: 0;
    max-width: 100%;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
    overflow-x: hidden;
    overflow-y: auto;
}
.logs-code-wide {
    max-height: min(36vh, 360px);
}

.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
}
.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}
.panel-head h2 { margin: 0; font-size: 1.1rem; }

.stat-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 14px;
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow);
}
.stat-card.accent {
    background: linear-gradient(160deg, #127a56, #0f6b4c);
    color: #fff;
    border-color: transparent;
}
.stat-label { color: var(--muted); font-size: 0.85rem; }
.stat-card.accent .stat-label { color: rgba(255,255,255,0.78); }
.stat-value { display: block; margin-top: 8px; font-size: 1.8rem; letter-spacing: -0.03em; }

.status-row { display: flex; flex-wrap: wrap; gap: 10px; }
.status-pill {
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 0.86rem;
    border: 1px solid transparent;
}
.status-pill.ok { background: var(--ok-bg); color: var(--ok); }
.status-pill.warn { background: var(--warn-bg); color: var(--warn); }

.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
tr.selected { background: var(--brand-soft); }
.cell-title { font-weight: 600; }
.empty, .empty-state { color: var(--muted); padding: 24px; text-align: center; }

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
}
.badge-open { background: #e0f2fe; color: #075985; }
.badge-in_progress { background: #fef3c7; color: #92400e; }
.badge-resolved { background: var(--ok-bg); color: var(--ok); }
.badge-closed { background: #eef2f6; color: #475467; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid transparent;
    border-radius: 12px;
    padding: 10px 14px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: transform .15s ease, background .15s ease, box-shadow .15s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 8px 18px rgba(15, 107, 76, 0.25); }
.btn-primary:hover { background: var(--brand-2); }
.btn-secondary { background: var(--brand-soft); color: var(--brand); }
.btn-ghost { background: transparent; color: inherit; border-color: rgba(255,255,255,0.18); }
.main .btn-ghost { border-color: var(--line); color: var(--ink); }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

label { display: grid; gap: 6px; }
label span { font-size: 0.9rem; font-weight: 500; color: var(--muted); }
input[type="text"], input[type="email"], input[type="password"], input[type="url"], input[type="number"], select, textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 11px 12px;
    font: inherit;
    background: #fbfffd;
    color: var(--ink);
}
textarea { resize: vertical; min-height: 96px; }
input:focus, select:focus, textarea:focus {
    outline: 2px solid rgba(15, 107, 76, 0.25);
    border-color: var(--brand);
}
.check { display: flex; align-items: center; gap: 10px; }
.check input { width: auto; }

.stack { display: grid; gap: 14px; }
.stack-lg { display: grid; gap: 20px; }
.narrow { max-width: 420px; }
.mt { margin-top: 16px; }
.hint { color: var(--muted); font-size: 0.9rem; }
.small { font-size: 0.85rem; }
.warn-text { color: var(--warn); }

.split {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 18px;
    align-items: start;
}

.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
    padding: 6px 10px;
    border-radius: 999px;
    background: #f3f7f5;
    color: var(--muted);
    text-decoration: none;
    font-size: 0.85rem;
}
.chip.active, .chip:hover { background: var(--brand-soft); color: var(--brand); text-decoration: none; }

.detail-list { display: grid; gap: 12px; margin: 0; }
.detail-list > div { display: grid; gap: 4px; padding-bottom: 10px; border-bottom: 1px dashed var(--line); }
.detail-list dt { color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; }
.detail-list dd { margin: 0; }
.pre { white-space: pre-wrap; }

.actions { display: flex; gap: 10px; align-items: center; }
.inline { display: inline; }
.link-danger {
    background: none;
    border: none;
    color: var(--danger);
    font: inherit;
    cursor: pointer;
    padding: 0;
}

.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}
.info-grid h3 { margin: 0 0 8px; font-size: 1rem; }

.code-block {
    background: #0f1a15;
    color: #d7ebe1;
    border-radius: 12px;
    padding: 14px;
    overflow-x: hidden;
    overflow-y: auto;
    max-height: 420px;
    max-width: 100%;
    box-sizing: border-box;
    font-family: var(--mono);
    font-size: 0.8rem;
    line-height: 1.5;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.alert {
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 16px;
    border: 1px solid transparent;
}
.alert-success { background: var(--ok-bg); color: var(--ok); border-color: #abefc6; }
.alert-error { background: var(--danger-bg); color: var(--danger); border-color: #fecdca; }

.auth-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}
.auth-card {
    width: min(420px, 100%);
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(10px);
    border: 1px solid var(--line);
    border-radius: 24px;
    box-shadow: var(--shadow);
    padding: 28px;
}
.auth-brand { text-align: center; margin-bottom: 22px; }
.auth-brand h1 { margin: 0 0 6px; font-size: 1.45rem; }
.auth-brand p { margin: 0; color: var(--muted); }

/* Replies tab — inline editors */
.reply-add-form { margin-top: 4px; }
.reply-add-grid {
    display: grid;
    grid-template-columns: minmax(100px, 140px) minmax(140px, 1fr) auto;
    gap: 12px 14px;
    align-items: end;
}
.reply-add-grid label { display: grid; gap: 6px; }
.reply-add-grid label > span,
.reply-edit-form label > span {
    font-size: 0.82rem;
    color: var(--muted);
    font-weight: 500;
}
.reply-add-admin {
    display: flex !important;
    align-items: center;
    gap: 8px;
    padding-bottom: 10px;
    white-space: nowrap;
}
.reply-add-response {
    grid-column: 1 / -2;
}
.reply-add-actions {
    display: flex;
    align-items: end;
    padding-bottom: 2px;
}
.sheet-add-grid {
    grid-template-columns: minmax(110px, 1fr) minmax(120px, 1.2fr) 72px minmax(100px, 1fr) auto auto;
}
.sheet-edit-meta {
    grid-template-columns: minmax(110px, 1.2fr) minmax(120px, 1.4fr) 72px minmax(100px, 1fr) 90px;
}
.sheet-max-grid {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 14px 18px;
    align-items: start;
}
.sheet-max-grid label {
    display: grid;
    gap: 6px;
}
.sheet-max-reply {
    min-width: 0;
}
.sheet-check-fields {
    padding: 12px 14px;
    border: 1px dashed var(--line);
    border-radius: 12px;
    background: #f7faf8;
}
.sheet-check-rules {
    display: grid;
    grid-template-columns: minmax(140px, 1.2fr) minmax(160px, 1fr);
    gap: 12px;
}
.sheet-check-rules label {
    display: grid;
    gap: 6px;
}
.sheet-check-bar {
    display: flex;
    align-items: center;
    gap: 12px 14px;
    flex-wrap: wrap;
}
.sheet-reply-fields {
    gap: 12px;
    padding-top: 4px;
}
.sheet-list-toolbar,
.cmd-list-toolbar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 0 0 12px;
}
.sheet-cmd-row.is-collapsed .sheet-cmd-body,
.cmd-row.is-collapsed .cmd-row-body {
    display: none;
}
.sheet-cmd-row.is-collapsed,
.cmd-row.is-collapsed {
    padding-bottom: 14px;
}
.sheet-collapse-btn,
.cmd-collapse-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    color: var(--muted);
    font: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
}
.sheet-collapse-btn:hover,
.cmd-collapse-btn:hover {
    border-color: #9bb5a8;
    color: var(--ink);
}
.sheet-collapse-chevron,
.cmd-collapse-chevron {
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid currentColor;
    transition: transform .15s ease;
}
.sheet-cmd-row.is-collapsed .sheet-collapse-chevron,
.cmd-row.is-collapsed .cmd-collapse-chevron {
    transform: rotate(-90deg);
}
.sheet-cmd-title,
.cmd-row-title-hint {
    margin: 0;
    font-size: 0.88rem;
}
.sheet-cmd-body,
.cmd-row-body {
    margin-top: 2px;
}
.reply-list {
    display: grid;
    gap: 12px;
}
.reply-row {
    display: grid;
    gap: 14px;
    padding: 16px 18px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fbfffd;
    transition: border-color .15s ease, box-shadow .15s ease, opacity .15s ease;
}
.reply-row:hover {
    border-color: #b7d4c6;
}
.reply-row.is-off {
    opacity: 0.72;
    background: #f6f8f7;
}
.reply-row.is-focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(15, 107, 76, 0.12);
}
.reply-row-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.reply-row-title {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    min-width: 0;
}
.reply-row-title h3 {
    margin: 0;
    font-size: 1.08rem;
}
.reply-tag {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--brand-soft);
    color: var(--brand);
}
.reply-tag.is-warn {
    background: var(--warn-bg);
    color: var(--warn);
}
.reply-toggles {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.inline-form { margin: 0; }
.switch-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin: 0;
    padding: 7px 12px 7px 8px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    color: var(--muted);
    font: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.switch-btn .switch-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #c5cec9;
    flex-shrink: 0;
}
.switch-btn.is-on {
    background: var(--ok-bg);
    border-color: #abefc6;
    color: var(--ok);
}
.switch-btn.is-on .switch-dot { background: var(--ok); }
.switch-btn.is-off {
    background: #eef1ef;
    border-color: #d5ddd8;
    color: var(--muted);
}
.switch-btn.is-warn {
    background: var(--warn-bg);
    border-color: #f5d789;
    color: var(--warn);
}
.switch-btn.is-warn .switch-dot { background: var(--warn); }
.switch-btn.is-locked {
    cursor: default;
    opacity: 0.9;
}
.switch-btn:not(.is-locked):hover {
    filter: brightness(0.98);
    border-color: #9bb5a8;
}
.reply-delete-btn {
    padding: 7px 10px;
    font-size: 0.82rem;
}
.reply-edit-form { gap: 10px; }
.reply-edit-meta {
    display: grid;
    grid-template-columns: 1fr 110px;
    gap: 12px;
}
.reply-edit-meta label,
.reply-edit-form > label {
    display: grid;
    gap: 6px;
}
.reply-edit-form textarea {
    min-height: 110px;
    font-family: var(--mono);
    font-size: 0.86rem;
    line-height: 1.5;
}
.reply-placeholders {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 8px;
    font-size: 0.8rem;
    color: var(--muted);
}
.reply-placeholders code {
    padding: 2px 6px;
    border-radius: 6px;
    background: var(--brand-soft);
    color: var(--brand);
    cursor: help;
}

@media (max-width: 1100px) {
    .stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .split, .info-grid, .form-grid, .bots-create-grid, .logs-layout, .reply-add-grid, .sheet-add-grid, .sheet-edit-meta, .sheet-check-rules, .sheet-max-grid { grid-template-columns: 1fr; }
    .reply-add-response { grid-column: 1; }
    .reply-edit-meta { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar { position: sticky; top: 0; z-index: 10; }
    .nav { flex-direction: row; flex-wrap: wrap; }
    .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .main { padding: 20px 16px 40px; }
}
