/* © Элвис · Telegram: @ElvisOnlyDev · ofdev.net */

.panel {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: clip;
    scroll-margin-top: 84px;
}
.panel-head {
    display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border);
}
.panel-head h2, .panel-head h3 { display: flex; align-items: center; gap: var(--space-2); }
.panel-head .sub { color: var(--text-muted); font-size: 12px; font-weight: 400; }
.panel-body { padding: var(--space-4); }
.panel-body.flush { padding: 0; }
.panel-note { color: var(--text-secondary); font-size: 13px; padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border); background: var(--bg-surface); }

.journal-filter { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--space-2) var(--space-3); padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border); background: var(--bg-surface); }
.journal-filter .field.narrow { max-width: 150px; }

.period-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--space-2) var(--space-3); margin-bottom: var(--space-4); }
.period-bar .field.narrow { max-width: 150px; }
.period-bar .field.period-field { max-width: none; flex: 0 0 auto; }

.period-bar .btn, .journal-filter .btn { height: 38px; }
.period-bar input, .journal-filter input { height: 38px; padding-top: 0; padding-bottom: 0; }
.period-bar > .small, .journal-filter > .small { padding-bottom: 10px; }

.seg { display: inline-flex; height: 38px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; background: var(--bg-surface); }
.seg-item {
    display: inline-flex; align-items: center; padding: 0 14px;
    font-size: 12px; font-weight: 600; color: var(--text-secondary);
    text-decoration: none; cursor: pointer; white-space: nowrap;
    border-right: 1px solid var(--border-strong);
    transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.seg-item:last-child { border-right: 0; }
.seg-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.seg-item.active { background: var(--accent-strong); color: var(--accent-ink); }


.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    background: var(--bg-elevated); color: var(--text-primary);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    padding: 8px 14px; font-weight: 600; font-size: 13px; font-family: inherit;
    cursor: pointer; white-space: nowrap; user-select: none;
    transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.btn svg { width: 15px; height: 15px; }
.btn:hover { background: var(--bg-hover); border-color: var(--text-muted); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn.is-loading { opacity: .55; cursor: not-allowed; pointer-events: none; }
.btn.primary { background: var(--accent-strong); border-color: var(--accent-strong); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent); border-color: var(--accent); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-secondary); }
.btn.ghost:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn.subtle { background: transparent; border-color: var(--border-strong); }
.btn.danger { color: var(--danger); border-color: transparent; background: transparent; }
.btn.danger:hover { background: var(--danger-bg); border-color: var(--danger); }
.btn.sm { padding: 5px 10px; font-size: 12px; border-radius: var(--radius-sm); }
.btn.icon { padding: 7px; }
.btn.icon.sm { padding: 5px; }
.btn.block { display: flex; width: 100%; }
.btn.is-loading { position: relative; color: transparent; }
.btn.is-loading::after { content: ""; position: absolute; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .6s linear infinite; color: var(--accent-ink); }
@keyframes spin { to { transform: rotate(360deg); } }

.field { display: flex; flex-direction: column; gap: 6px; }
.field[hidden] { display: none; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-primary); cursor: pointer; }
.check[hidden] { display: none; }
.check input { width: 15px; height: 15px; accent-color: var(--accent); flex: 0 0 auto; }

.field.narrow { max-width: 100px; }
.test-block { margin-top: var(--space-4); padding-top: var(--space-4); border-top: 1px solid var(--border); }
.test-block .flex { align-items: flex-end; }
.test-block .flex .btn { height: 41px; }
.test-results { display: flex; flex-direction: column; gap: var(--space-2); margin-top: var(--space-3); }
.test-result { padding: 10px 12px; border-radius: var(--radius-md); background: var(--bg-elevated); border: 1px solid var(--border); font-size: 13px; }
.test-result-head { font-weight: 600; font-size: 11px; color: var(--text-secondary); margin-bottom: 4px; }
.test-result.is-error { border-color: var(--danger); }
.test-result.is-error .test-result-text { color: var(--danger); }
.field > span, label.field > span { font-weight: 600; font-size: 12px; color: var(--text-secondary); }
.field .hint { font-weight: 400; font-size: 11px; color: var(--text-muted); }
.hint { font-weight: 400; font-size: 11px; line-height: 1.5; color: var(--text-muted); }
p.check-hint { margin: -8px 0 0 23px; font-size: 11px; line-height: 1.5; color: var(--text-muted); }
p.check-hint[hidden] { display: none; }
.delay-human { font-style: normal; font-weight: 500; color: var(--accent); margin-left: 4px; }
.callout { display: flex; align-items: flex-start; gap: 8px; padding: 10px 12px; border-radius: var(--radius-md); background: var(--accent-soft); border: 1px solid var(--border); font-size: 12px; line-height: 1.5; color: var(--text-secondary); }
.callout .ic { flex: none; width: 15px; height: 15px; margin-top: 2px; color: var(--accent); }
.form-section { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-3); border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg-surface); }
.form-section-title { display: flex; align-items: center; gap: 7px; font-weight: 600; font-size: 12px; color: var(--text-secondary); }
.form-section-title .ic { width: 14px; height: 14px; color: var(--accent); }
.how-it-works { margin-bottom: var(--space-4); }
.how-it-works > summary { font-size: 13px; color: var(--text-secondary); }
.how-it-works > summary .ic { width: 15px; height: 15px; color: var(--accent); }
.how-it-works .acc-body { display: flex; flex-direction: column; gap: 6px; }

.branch-legend { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: var(--space-3) 0 var(--space-4); }
.branch-tag { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: var(--radius-pill); background: var(--bg-elevated); border: 1px solid var(--border); }
.branch-tag .ic { width: 13px; height: 13px; }
.branch-tag.ok { color: var(--success); }
.branch-tag.off { color: var(--text-muted); }
.branch-tag.info { color: var(--info); }

.branch-map { display: flex; flex-direction: column; gap: var(--space-3); }
.branch-step { display: flex; gap: var(--space-3); padding: var(--space-3) var(--space-4); background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-md); }
.branch-step.is-disabled { opacity: 0.6; border-style: dashed; }
.branch-num { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 700; background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent); }
.branch-step.is-disabled .branch-num { background: var(--border); color: var(--text-muted); border-color: var(--border-strong); }
.branch-step-body { flex: 1 1 auto; min-width: 0; }
.branch-step-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-bottom: var(--space-2); }
.branch-step-head .strong { font-size: 13.5px; }
.branch-when { font-size: 11px; color: var(--text-muted); font-variant-numeric: tabular-nums; }

.branch-row { display: flex; gap: var(--space-2); padding: 7px 0; border-top: 1px solid var(--border); }
.branch-row:first-of-type { border-top: 0; padding-top: 0; }
.branch-dot { flex: none; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; margin-top: 1px; background: var(--bg-surface); border: 1px solid var(--border-strong); color: var(--text-muted); }
.branch-dot .ic { width: 12px; height: 12px; }
.branch-dot.ok { background: var(--success-bg); border-color: var(--success); color: var(--success); }
.branch-dot.info { background: var(--info-bg); border-color: var(--info); color: var(--info); }
.branch-row-body { flex: 1 1 auto; min-width: 0; font-size: 12.5px; }
.branch-row-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 3px 8px; }
.branch-cond { font-weight: 600; color: var(--text-primary); }
.branch-act { font-size: 11.5px; color: var(--text-secondary); }
.branch-row.ok .branch-act { color: var(--success); }
.branch-row.info .branch-act { color: var(--info); }
.branch-row.is-skip .branch-cond { color: var(--text-muted); }
.branch-prompt { margin-top: 2px; font-size: 12px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.branch-off { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); }
.branch-off .ic { width: 13px; height: 13px; }
.branch-note { margin-top: var(--space-2); font-size: 11px; line-height: 1.5; color: var(--text-muted); }

input, select, textarea {
    width: 100%;
    background: var(--bg-base);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 9px 12px;
    color: var(--text-primary);
    font-size: 14px; font-family: inherit;
    transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
input::placeholder, textarea::placeholder { color: var(--text-muted); }
input:hover, select:hover, textarea:hover { border-color: var(--border-strong); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent-strong); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { min-height: 96px; resize: vertical; line-height: 1.55; }
select, input.combo { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%239EA9C6' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 32px; }
.input-mono { font-family: var(--font-mono); }

.form-grid { display: grid; gap: var(--space-4); }
.form-grid.two { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.form-actions { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; }

.badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 2px 9px; border-radius: var(--radius-sm);
    font-size: 11px; font-weight: 600; line-height: 1.6;
    border: 1px solid transparent;
}
.badge.ok, .badge.on, .badge.sent, .badge.success { color: var(--success); background: var(--success-bg); }
.badge.off, .badge.muted { color: var(--text-secondary); background: var(--bg-elevated); }
.badge.warn { color: var(--warning); background: var(--warning-bg); }
.badge.err, .badge.danger { color: var(--danger); background: var(--danger-bg); }
.badge.info { color: var(--info); background: var(--info-bg); }
.badge.accent { color: var(--accent); background: var(--accent-soft); }
.badge.link { text-decoration: none; cursor: pointer; transition: filter var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease); }
.badge.link:hover { filter: brightness(1.25); }
.badge.link:active { transform: translateY(1px); }

@keyframes ftl-item-enter {
    0% { opacity: 0; transform: translateY(8px) scale(.98); filter: blur(3px); }
    100% { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}
@keyframes ftl-chip-enter {
    0% { opacity: 0; transform: scale(.8) translateX(8px); }
    100% { opacity: 1; transform: scale(1) translateX(0); }
}

.ftl-combo { position: relative; }
.ftl-combo-head {
    display: flex; align-items: center; gap: 4px;
    height: 41px; padding: 0 4px 0 12px;
    background: var(--bg-surface); border: 1px solid var(--border-strong); border-radius: var(--radius-md);
    transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.ftl-combo[data-state="open"] .ftl-combo-head { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.ftl-combo-input { flex: 1; min-width: 0; height: 100%; border: none; background: transparent; outline: none; color: inherit; font: inherit; font-size: 13px; }
.ftl-combo-toggle {
    flex: none; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
    border: none; background: transparent; border-radius: 50%; cursor: pointer; color: var(--text-secondary);
    transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.ftl-combo-toggle:hover { background: var(--bg-elevated); color: var(--text-primary); }
.ftl-combo-toggle .ic { width: 16px; height: 16px; transition: transform .3s var(--ease); }
.ftl-combo[data-state="open"] .ftl-combo-toggle .ic { transform: rotate(180deg); }

.ftl-combo-chips { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.ftl-combo-chip-track { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; padding: 2px 0; }
.ftl-combo-chip-track::-webkit-scrollbar { display: none; }
.ftl-combo-chip {
    animation: ftl-chip-enter .2s cubic-bezier(.2, .8, .2, 1) both;
    display: inline-flex; align-items: center; gap: 6px; flex: none;
    height: 24px; padding: 0 10px; border: none; border-radius: 999px; cursor: pointer;
    background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 600; white-space: nowrap;
    transition: filter var(--dur-fast) var(--ease);
}
.ftl-combo-chip:hover { filter: brightness(1.2); }
.ftl-combo-chip .ic { width: 10px; height: 10px; }
.ftl-combo-chip > span { max-width: 140px; overflow: hidden; text-overflow: ellipsis; }
.ftl-combo-clear {
    flex: none; border: none; background: transparent; cursor: pointer;
    font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-secondary);
    padding: 6px 10px; border-radius: 999px; transition: background var(--dur-fast) var(--ease);
}
.ftl-combo-clear:hover { background: var(--bg-elevated); }

.ftl-combo-panel {
    display: grid; grid-template-rows: 0fr; opacity: 0;
    transition: grid-template-rows .3s cubic-bezier(.2, .8, .2, 1), opacity .3s cubic-bezier(.2, .8, .2, 1);
}
.ftl-combo[data-state="open"] .ftl-combo-panel { grid-template-rows: 1fr; opacity: 1; }
.ftl-combo-panel-inner { overflow: hidden; }
.ftl-combo-list {
    margin: 8px 0 2px; padding: 4px; list-style: none;
    max-height: 240px; overflow-y: auto;
    background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-md);
    box-shadow: 0 12px 24px rgba(4, 8, 14, .18);
}
.ftl-combo-item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 10px; border-radius: var(--radius-sm); cursor: pointer;
}
.ftl-combo[data-state="open"] .ftl-combo-item { animation: ftl-item-enter .35s cubic-bezier(.1, .8, .2, 1) both; }
.ftl-combo[data-state="open"] .ftl-combo-item:nth-child(1) { animation-delay: 40ms; }
.ftl-combo[data-state="open"] .ftl-combo-item:nth-child(2) { animation-delay: 80ms; }
.ftl-combo[data-state="open"] .ftl-combo-item:nth-child(3) { animation-delay: 120ms; }
.ftl-combo[data-state="open"] .ftl-combo-item:nth-child(4) { animation-delay: 160ms; }
.ftl-combo[data-state="open"] .ftl-combo-item:nth-child(n+5) { animation-delay: 200ms; }
.ftl-combo-item.is-active { background: var(--bg-elevated); }
.ftl-combo-check { flex: none; width: 16px; height: 16px; color: var(--accent); opacity: 0; transform: scale(.6); transition: opacity var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease); }
.ftl-combo-check .ic { width: 16px; height: 16px; }
.ftl-combo-item.is-selected .ftl-combo-check { opacity: 1; transform: scale(1); }
.ftl-combo-item.is-selected .ftl-combo-item-name { color: var(--accent); }
.ftl-combo-item-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ftl-combo-item-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ftl-combo-item-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 11px; color: var(--text-muted); }
.ftl-combo-item-tag { flex: none; text-transform: uppercase; letter-spacing: .05em; color: var(--warning); }
.ftl-combo-status { display: flex; align-items: center; gap: 10px; padding: 14px 12px; font-size: 12px; color: var(--text-secondary); }

.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; display: inline-block; background: var(--text-muted); }
.dot.ok { background: var(--success); box-shadow: 0 0 0 3px var(--success-bg); }
.dot.off { background: var(--text-muted); }
.dot.warn { background: var(--warning); box-shadow: 0 0 0 3px var(--warning-bg); }
.dot.err { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-bg); }
.dot.live { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); animation: pulse 1.8s var(--ease) infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

.switch { position: relative; display: inline-flex; align-items: center; width: 40px; height: 22px; padding: 2px; border-radius: 999px; background: var(--bg-hover); border: 1px solid var(--border-strong); cursor: pointer; flex: none; transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease); }
.switch:hover { border-color: var(--accent); }
.switch:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.switch.is-on { background: var(--accent-strong); border-color: var(--accent-strong); }
.switch-thumb { width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.45); transition: transform var(--dur) var(--ease); transform: translateX(0); }
.switch.is-on .switch-thumb { transform: translateX(18px); }
.switch.is-loading { opacity: .55; pointer-events: none; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: var(--radius-pill); font-size: 11px; font-weight: 600; background: var(--bg-elevated); color: var(--text-secondary); }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.new_fan { color: var(--info); }
.pill.reply { color: var(--success); }
.pill.ppv, .pill.manual { color: var(--warning); }
.pill.error { color: var(--danger); }

table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl thead th {
    position: sticky; top: 0; z-index: 1;
    text-align: left; font-weight: 600; font-size: 11px; letter-spacing: .04em; text-transform: uppercase;
    color: var(--text-muted);
    padding: 9px 14px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
table.tbl tbody td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.tbl tbody tr { transition: background var(--dur-fast) var(--ease); }
table.tbl tbody tr:nth-child(even) { background: color-mix(in srgb, var(--bg-surface) 45%, transparent); }
table.tbl tbody tr:hover { background: var(--bg-hover); }
table.tbl tbody tr:last-child td { border-bottom: 0; }
table.tbl.dense tbody td { padding: 7px 14px; }
.cell-id { font-family: var(--font-mono); color: var(--text-secondary); font-size: 12px; }
.cell-actions { display: flex; gap: 6px; align-items: center; justify-content: flex-end; }
.act-divider { width: 1px; align-self: stretch; margin: 2px 2px; background: var(--border); }
table.tbl td.cell-flush { padding: 0; }
table.tbl tbody tr:hover td.cell-flush details.acc { background: transparent; }
.table-wrap { overflow: auto; max-height: 70vh; }

table.tbl thead th[data-sort] { cursor: pointer; user-select: none; }
table.tbl thead th[data-sort]:hover { color: var(--text-secondary); }
table.tbl thead th[data-sort]::after {
    content: ""; display: inline-block; width: 0; height: 0; margin-left: 6px; vertical-align: middle;
    border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 5px solid currentColor; opacity: .3;
}
table.tbl thead th[data-sort].right::after { margin-left: 6px; }
table.tbl thead th[aria-sort="ascending"]::after { border-top: 0; border-bottom: 5px solid var(--accent-hover); opacity: 1; }
table.tbl thead th[aria-sort="descending"]::after { border-top: 5px solid var(--accent-hover); opacity: 1; }
table.tbl thead th[aria-sort] { color: var(--text-secondary); }
table.tbl tbody tr.is-filtered { display: none; }
tr.filter-empty td { text-align: center; color: var(--text-muted); padding: var(--space-6) var(--space-4); }

.tbl-search { position: relative; display: inline-flex; align-items: center; }
.tbl-search > svg { position: absolute; left: 10px; width: 15px; height: 15px; color: var(--text-muted); pointer-events: none; }
.tbl-search input { width: min(260px, 100%); padding-left: 32px; padding-top: 6px; padding-bottom: 6px; font-size: 13px; }
.tbl-search input::-webkit-search-cancel-button { appearance: none; }

.avatar {
    width: 38px; height: 38px; border-radius: 50%; flex: 0 0 auto;
    background: var(--bg-elevated); border: 1px solid var(--border);
    color: var(--text-secondary); font-weight: 650; font-size: 14px;
    display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.sm { width: 24px; height: 24px; font-size: 11px; }
.avatar.xs { width: 16px; height: 16px; font-size: 8px; }
.model-cell { display: flex; align-items: center; gap: 10px; }

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--space-3); }
.metric {
    background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--radius-lg);
    padding: var(--space-4); display: flex; flex-direction: column; gap: 4px;
    position: relative; overflow: clip;
}
.metric::before { content: ""; position: absolute; left: 0; top: var(--space-4); bottom: var(--space-4); width: 3px; border-radius: var(--radius-pill); background: var(--border-strong); }
.metric.accent::before { background: var(--accent); }
.metric.ok::before { background: var(--success); }
.metric.warn::before { background: var(--warning); }
.metric .metric-top { display: flex; align-items: center; gap: 7px; color: var(--text-muted); font-size: 12px; font-weight: 500; }
.metric .metric-top svg { width: 15px; height: 15px; }
.stat-num, .metric-num { font-size: 28px; font-weight: 700; color: var(--text-primary); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.metric-of { font-size: 16px; font-weight: 600; color: var(--text-muted); letter-spacing: 0; }
.metric-delta { font-size: 12px; font-weight: 600; }
.metric-delta.up { color: var(--success); } .metric-delta.down { color: var(--danger); }

.funnel { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-4); }
.funnel-row { display: grid; grid-template-columns: 96px minmax(0, 1fr) 46px; align-items: center; gap: var(--space-3); }
.funnel-label { font-size: 12px; font-weight: 600; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.funnel-track { height: 22px; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.funnel-bar { display: block; height: 100%; min-width: 8px; border-radius: var(--radius-sm) 0 0 var(--radius-sm); background: var(--accent); transition: width var(--dur) var(--ease); }
.funnel-bar.ok { background: var(--success); }
.funnel-bar.info { background: var(--info); }
.funnel-val { font-family: var(--font-mono); font-size: 13px; font-weight: 650; text-align: right; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.funnel-row.outcome { padding-top: var(--space-2); margin-top: var(--space-1); border-top: 1px dashed var(--border); }
.funnel-row.empty .funnel-track { background: transparent; border-style: dashed; }
.funnel-row.empty .funnel-label { color: var(--text-muted); }
.funnel-row.empty .funnel-val { color: var(--text-muted); font-weight: 500; }

.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(94px, 1fr)); gap: var(--space-4); padding: var(--space-4); }
.figure { display: flex; flex-direction: column; gap: 3px; }
.figure-val { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; color: var(--text-primary); font-variant-numeric: tabular-nums; line-height: 1.1; }
.figure-val.ok { color: var(--success); } .figure-val.warn { color: var(--warning); } .figure-val.err { color: var(--danger); }
.figure-key { font-size: 11px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }

.health-name { display: flex; flex-direction: column; line-height: 1.35; }
.health-name b { font-weight: 600; font-size: 13px; }
.health-name span { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); }

.alert { display: flex; gap: 10px; padding: 10px 14px; border-radius: var(--radius-md); font-size: 13px; border: 1px solid transparent; }
.alert svg { width: 16px; height: 16px; flex: none; margin-top: 1px; }
.alert.error { background: var(--danger-bg); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.alert.ok { background: var(--success-bg); color: var(--success); border-color: color-mix(in srgb, var(--success) 35%, transparent); }
.alert.info { background: var(--info-bg); color: var(--info); border-color: color-mix(in srgb, var(--info) 35%, transparent); }

.empty { display: flex; flex-direction: column; align-items: center; gap: var(--space-3); text-align: center; padding: var(--space-8) var(--space-4); color: var(--text-secondary); }
.empty svg { width: 30px; height: 30px; color: var(--text-muted); }
.empty .empty-title { font-weight: 600; color: var(--text-primary); }
td .empty { padding: var(--space-6) var(--space-4); }

.skeleton { background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--bg-hover) 37%, var(--bg-elevated) 63%); background-size: 400% 100%; border-radius: var(--radius-sm); animation: shimmer 1.4s ease infinite; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
.skeleton.line { height: 12px; margin: 6px 0; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); }
.tab { padding: 9px 14px; font-weight: 600; font-size: 13px; color: var(--text-secondary); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; background: none; border-top: 0; border-left: 0; border-right: 0; }
.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--text-primary); border-bottom-color: var(--accent); }
.tab-panel[hidden] { display: none; }

details.acc { border: 1px solid var(--border); border-radius: var(--radius-md); overflow: clip; }
details.acc + details.acc { margin-top: var(--space-2); }
details.acc > summary { list-style: none; cursor: pointer; padding: 10px 14px; display: flex; align-items: center; gap: var(--space-2); font-weight: 600; background: var(--bg-surface); }
details.acc > summary::-webkit-details-marker { display: none; }
details.acc > summary .chev { margin-left: auto; transition: transform var(--dur) var(--ease); color: var(--text-muted); display: inline-flex; }
details.acc[open] > summary .chev { transform: rotate(90deg); }
details.acc > .acc-body { padding: var(--space-4); border-top: 1px solid var(--border); }
details.acc.flush { border: 0; border-radius: 0; }
details.acc.flush > summary { background: transparent; }
.panel-foot { padding: var(--space-3) var(--space-4); border-top: 1px solid var(--border); }

.dropdown { position: relative; }
.dropdown-menu {
    position: absolute; right: 0; top: calc(100% + 6px); z-index: var(--z-dropdown);
    min-width: 180px; background: var(--bg-elevated); border: 1px solid var(--border-strong);
    border-radius: var(--radius-md); box-shadow: var(--shadow-2); padding: 5px;
    opacity: 0; transform: translateY(-4px); pointer-events: none; transition: opacity var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.dropdown.open .dropdown-menu { opacity: 1; transform: none; pointer-events: auto; }
.dropdown-menu button, .dropdown-menu a { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--text-primary); background: none; border: 0; font: inherit; cursor: pointer; }
.dropdown-menu button:hover, .dropdown-menu a:hover { background: var(--bg-hover); }

.combo-wrap { position: relative; }
.combo-menu {
    position: fixed; z-index: var(--z-dropdown);
    max-height: 240px; overflow-y: auto; background: var(--bg-elevated); border: 1px solid var(--border-strong);
    border-radius: var(--radius-md); box-shadow: var(--shadow-2); padding: 5px;
    opacity: 0; transform: translateY(-4px); pointer-events: none; transition: opacity var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.combo-wrap.open .combo-menu { opacity: 1; transform: none; pointer-events: auto; }
.combo-menu button { display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--text-primary); background: none; border: 0; font: inherit; cursor: pointer; }
.combo-menu button:hover { background: var(--bg-hover); }
.combo-menu:empty::after { content: 'Список пуст — нажмите «Тест»'; display: block; padding: 8px 10px; color: var(--text-muted); font-size: 13px; }

.modal-overlay { position: fixed; inset: 0; z-index: var(--z-modal); display: grid; place-items: center; padding: var(--space-4); background: rgba(4,8,14,.6); backdrop-filter: blur(4px); opacity: 0; transition: opacity var(--dur) var(--ease); }
.modal-overlay[hidden] { display: none; }
.modal.wide { width: min(520px, 100%); }
.modal .modal-body.form-body { padding: var(--space-4); color: var(--text-primary); }
.modal-overlay.open { opacity: 1; }
.modal {
    width: min(440px, 100%); max-height: min(640px, calc(100vh - 48px));
    display: flex; flex-direction: column;
    background: var(--bg-panel); border: 1px solid var(--border-strong); border-radius: var(--radius-lg); box-shadow: var(--shadow-2);
    transform: translateY(8px) scale(.98); transition: transform var(--dur) var(--ease);
}
.modal > form { display: contents; }
.modal-overlay.open .modal { transform: none; }
.modal-head { padding: var(--space-4); display: flex; align-items: center; gap: var(--space-2); font-weight: 650; font-size: 16px; flex: 0 0 auto; }
.modal-body { padding: 0 var(--space-4); color: var(--text-secondary); overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.modal-foot { padding: var(--space-4); display: flex; justify-content: flex-end; gap: var(--space-2); }

.toast-wrap { position: fixed; right: var(--space-4); bottom: var(--space-4); z-index: var(--z-toast); display: flex; flex-direction: column; gap: var(--space-2); max-width: 360px; }
.toast { display: flex; align-items: flex-start; gap: 10px; padding: 11px 14px; border-radius: var(--radius-md); background: var(--bg-elevated); border: 1px solid var(--border-strong); box-shadow: var(--shadow-2); color: var(--text-primary); font-size: 13px; transform: translateX(12px); opacity: 0; transition: transform var(--dur) var(--ease), opacity var(--dur) var(--ease); }
.toast.show { transform: none; opacity: 1; }
.toast svg { width: 16px; height: 16px; flex: none; margin-top: 1px; }
.toast.ok { border-left: 3px solid var(--success); } .toast.ok svg { color: var(--success); }
.toast.error { border-left: 3px solid var(--danger); } .toast.error svg { color: var(--danger); }
.toast.info { border-left: 3px solid var(--info); } .toast.info svg { color: var(--info); }

.pagination { display: flex; align-items: center; gap: 4px; justify-content: flex-end; padding: var(--space-3) var(--space-4); }
.pagination .pg { min-width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; padding: 0 8px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--bg-surface); color: var(--text-secondary); font-size: 13px; font-weight: 600; cursor: pointer; }
.pagination .pg:hover { border-color: var(--border-strong); color: var(--text-primary); }
.pagination .pg.active { background: var(--accent-soft); border-color: var(--accent); color: var(--text-primary); }
.pagination .pg:disabled { opacity: .4; pointer-events: none; }

.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: var(--space-4); background:
    radial-gradient(1px 1px at 20% 30%, var(--border-strong) 50%, transparent 50%),
    radial-gradient(1px 1px at 70% 70%, var(--border) 50%, transparent 50%), var(--bg-base); background-size: 42px 42px; }
.auth-card { width: 380px; max-width: 100%; background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--space-8); box-shadow: var(--shadow-2); }
.auth-card .brand { justify-content: center; font-size: 18px; margin-bottom: var(--space-2); }
.auth-card .auth-sub { text-align: center; color: var(--text-muted); font-size: 13px; margin-bottom: var(--space-6); }

.error-box { display: flex; flex-direction: column; align-items: center; gap: var(--space-3); text-align: center; padding: var(--space-8); }
.error-code { font-size: 60px; font-weight: 800; color: var(--accent); letter-spacing: -0.03em; line-height: 1; }
.error-title { font-size: 18px; font-weight: 650; }

.step-chain { display: flex; flex-direction: column; gap: var(--space-3); }
.step-card { display: flex; align-items: flex-start; gap: var(--space-3); padding: var(--space-3) var(--space-4); background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-md); }
.link-copy { background: none; border: 0; padding: 0; font: inherit; color: var(--accent-hover); cursor: pointer; }
.link-copy:hover { color: var(--accent); text-decoration: underline; }
.step-card.is-disabled { opacity: 0.55; border-style: dashed; }
.step-card.is-disabled .step-num { background: var(--border); color: var(--text-muted); }
.step-num { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 650; font-size: 13px; }
.step-body { flex: 1 1 auto; min-width: 0; }
.step-prompt { color: var(--text-primary); font-size: 13.5px; line-height: 1.5; white-space: pre-wrap; }
.panel-foot.center { display: flex; justify-content: center; }
.form-actions.center { justify-content: center; }

.cal-head { flex-wrap: wrap; row-gap: var(--space-2); }
.cal-nav { display: flex; align-items: center; gap: var(--space-2); }
.cal-month { font-weight: 650; font-size: 14px; min-width: 150px; text-align: center; }

.cal-toolbar { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border); background: var(--bg-surface); }
.cal-filters { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.cal-pill { display: inline-flex; align-items: center; gap: 7px; padding: 3px 12px 3px 3px; border-radius: var(--radius-pill); border: 1px solid var(--border-strong); background: var(--bg-elevated); color: var(--text-secondary); font-size: 12.5px; font-weight: 600; cursor: pointer; transition: all var(--dur-fast) var(--ease); }
.cal-pill .avatar { border-color: var(--pill-c, var(--accent)); }
.cal-pill.active { border-color: var(--pill-c, var(--accent)); color: var(--text-primary); background: var(--bg-hover); }
.cal-pill:not(.active) { opacity: .45; }
.cal-legend { display: flex; flex-wrap: wrap; gap: var(--space-4); font-size: 12px; color: var(--text-secondary); }

.cal-grid { padding: var(--space-6) var(--space-4); max-width: 1040px; margin: 0 auto; width: 100%; box-sizing: border-box; }
.cal-weekdays { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); margin-bottom: var(--space-3); }
.cal-weekday { text-align: center; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); padding: 4px 0; }
.cal-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.cal-day { aspect-ratio: 1 / 1; min-width: 0; background: var(--bg-elevated); padding: var(--space-3); display: flex; flex-direction: column; gap: 6px; cursor: pointer; transition: background var(--dur-fast) var(--ease); }
.cal-day:hover { background: var(--bg-hover); }
.cal-day.is-muted { background: var(--bg-surface); }
.cal-day.is-muted .cal-day-num { color: var(--text-muted); }
.cal-day-num { font-size: 13px; font-weight: 650; color: var(--text-secondary); width: 25px; height: 25px; display: flex; align-items: center; justify-content: center; border-radius: 50%; flex: none; }
.cal-day.is-today { background: var(--accent-soft); }
.cal-day.is-today .cal-day-num { background: var(--accent); color: var(--accent-ink); }

.cal-chips { display: flex; flex-direction: column; gap: 5px; overflow: hidden; }
.cal-chip {
    display: flex; align-items: center; gap: 6px; padding: 4px 7px 4px 4px;
    border-radius: var(--radius-sm); background: var(--pill-c, var(--accent)); color: var(--accent-ink);
    font-size: 12px; font-weight: 650; box-shadow: var(--shadow-1);
    transition: transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.cal-chip:hover { transform: translateY(-1px); box-shadow: var(--shadow-2); }
.cal-chip[hidden] { display: none; }
.cal-chip .avatar { width: 18px; height: 18px; font-size: 9px; font-weight: 700; border: none; background: rgba(4,8,14,.22); color: inherit; }
.cal-chip-text { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-chip-x { flex: none; display: flex; align-items: center; justify-content: center; width: 15px; height: 15px; padding: 0; background: none; border: none; color: inherit; opacity: .55; cursor: pointer; border-radius: 50%; }
.cal-chip-x:hover { opacity: 1; background: rgba(4,8,14,.18); }
.cal-chip-x .ic { width: 10px; height: 10px; }
.cal-more { font-size: 11px; color: var(--text-muted); padding: 0 2px; cursor: pointer; }

.modal .modal-body.view-body { padding: var(--space-4); color: var(--text-primary); }
.view-body { display: flex; flex-direction: column; gap: var(--space-4); }
.view-model { display: flex; align-items: center; gap: 10px; }
.view-model .avatar { border-width: 2px; }
.view-row { display: flex; align-items: center; gap: 10px; }
.view-row .ic { width: 20px; height: 20px; color: var(--text-secondary); flex: none; }

@media (max-width: 720px) {
    .cal-grid { padding: var(--space-3) var(--space-2); }
    .cal-day { aspect-ratio: unset; min-height: 58px; padding: 4px; }
    .cal-weekday { font-size: 9px; }
    .cal-chip-text { display: none; }
    .cal-chip { justify-content: center; padding: 3px; }
    .cal-chip .avatar { width: 14px; height: 14px; }
    .cal-month { min-width: 0; }
}
