.bot-admin{display:grid;gap:16px;padding:0;overflow:hidden}
.bot-admin-head{display:flex;align-items:flex-start;justify-content:space-between;gap:18px;padding:22px 22px 0}
.bot-admin-head h2{font-size:24px;margin:4px 0 8px;letter-spacing:-.04em}
.bot-admin-head p{max-width:780px;margin:0;color:#68778b;line-height:1.55}
.bot-eyebrow{display:inline-flex;width:max-content;border-radius:999px;background:#eef6ff;color:var(--blue);font-size:11px;font-weight:800;text-transform:uppercase;letter-spacing:.04em;padding:5px 10px}
.version-pill{border-radius:999px;background:#eafaf0;color:#16834f;font-weight:800;padding:8px 12px;white-space:nowrap}
.bot-tabs{display:flex;gap:26px;overflow:auto;padding:0 22px 0;border-bottom:1px solid #edf2f8;position:relative}
.bot-tab{border:0;background:transparent;color:#5f6f84;border-radius:0;padding:12px 2px 14px;font-weight:800;cursor:pointer;white-space:nowrap;box-shadow:none;transition:color .2s ease}
.bot-tab:hover{color:#1f73e0;background:transparent;box-shadow:none}
.bot-tab.active{color:#1f73e0;background:transparent;box-shadow:none}
/* скользящая линия-индикатор под активным табом (позиция из JS: --ink-left/--ink-width) */
.bot-tabs::after{content:"";position:absolute;bottom:-1px;left:var(--ink-left,0);width:var(--ink-width,0);height:2.5px;background:#1f73e0;border-radius:3px;transition:left .28s cubic-bezier(.4,0,.2,1),width .28s cubic-bezier(.4,0,.2,1)}
.bot-tab-content{padding:20px 22px 22px}
.bot-overview{display:grid;gap:16px}
.bot-status-card{display:flex;align-items:center;justify-content:space-between;gap:20px;padding:20px;border-radius:18px;background:linear-gradient(135deg,#eef6ff,#fff);border:1px solid #d7e8ff}
.bot-status-card h3,.test-config h3,.settings-toolbar h3,.bot-funnel-board h3,.system-toolbar h3{margin:6px 0 8px;font-size:22px;letter-spacing:-.04em}
.bot-status-card p{margin:0;color:#536174;line-height:1.55}
.bot-switch{display:grid;place-items:center;gap:6px;color:#16834f;font-weight:800}
.bot-switch i{display:block;position:relative;width:68px;height:36px;border-radius:999px;background:#20b26b}
.bot-switch i:after{content:'';position:absolute;top:5px;left:37px;width:26px;height:26px;border-radius:50%;background:#fff;box-shadow:0 4px 12px rgba(32,54,86,.14)}
.bot-metrics{display:grid;grid-template-columns:repeat(7,1fr);gap:12px}
.bot-metric{border:1px solid var(--stroke-soft);border-radius:18px;padding:16px;background:#fff;box-shadow:0 8px 18px rgba(32,54,86,.04)}
.bot-metric span{display:block;min-height:32px;color:#65758a;font-size:12px;font-weight:800}
.bot-metric strong{display:block;font-size:25px;margin:8px 0 5px;letter-spacing:-.04em}
.bot-metric small{color:#7d8998;font-weight:700;word-break:break-word}
.bot-metric.blue{background:#eef6ff}.bot-metric.softblue{background:#f3f7ff}.bot-metric.amber{background:#fff8e8}.bot-metric.green,.bot-metric.success{background:#eefbf4}.bot-metric.red{background:#fff0f0}
.bot-action-row{display:flex;gap:10px;flex-wrap:wrap;align-items:center}
.bot-action-row button,.settings-toolbar button,.chat-head button,.template-form button,.test-examples button,.add-template,.bot-funnel-board button,.system-toolbar button{border:1px solid var(--stroke);background:#fff;border-radius:12px;padding:10px 14px;color:#344154;font-weight:800;cursor:pointer}
.bot-action-row.compact{margin-top:12px}.bot-primary,.chat-head button{background:var(--blue)!important;border-color:var(--blue)!important;color:#fff!important}
.bot-danger{background:#fdecec!important;border-color:#ffd0d0!important;color:var(--red)!important}
.bot-sources{display:grid;grid-template-columns:repeat(3,1fr);gap:12px}
.bot-sources article{padding:16px;border-radius:16px;background:#f8fbff;border:1px solid var(--stroke-soft)}
.bot-sources b,.bot-sources span,.bot-sources small{display:block}
.bot-sources span{margin:7px 0;color:#172033;font-weight:800}.bot-sources small{color:#7d8998}
.bot-testing{display:grid;grid-template-columns:320px minmax(0,1fr);gap:16px}
.test-config,.bot-chat-window,.settings-card,.topic-board,.template-editor,.stage-card,.system-table,.system-health,.system-toolbar,.system-note,.system-error,.system-loading{border:1px solid var(--stroke-soft);border-radius:18px;background:#fff;box-shadow:0 8px 18px rgba(32,54,86,.04)}
.test-config{padding:18px}
.test-config label,.settings-card label,.template-form label{display:block;margin:14px 0 7px;color:#65758a;font-size:12px;font-weight:800}
.test-config select,.test-config textarea,.test-config input,.settings-card textarea,.template-form textarea,.template-form input{width:100%;border:1px solid #dfe8f3;border-radius:14px;background:#f9fbfe;padding:12px;color:#243044;font:inherit;outline:none}
.test-config textarea{min-height:130px;resize:vertical}
.test-warning{margin-top:14px;border-radius:14px;background:#fff8e8;color:#9a6500;line-height:1.45;padding:12px;font-weight:800;font-size:12px}
.bot-chat-window{overflow:hidden}
.chat-head{display:flex;align-items:center;justify-content:space-between;gap:14px;padding:16px 18px;border-bottom:1px solid #edf2f8;background:#f8fbff}
.chat-head b,.chat-head span{display:block}.chat-head span{color:#7d8998;font-size:12px;margin-top:3px}
.chat-body{display:grid;gap:12px;padding:18px}
.chat-message{max-width:78%;border-radius:18px;padding:12px 14px;line-height:1.45;background:#eef6ff;color:#243044}
.candidate-message{width:100%;min-height:92px;border:1px solid #dfe8f3;border-radius:18px;background:#fff;padding:14px;font:inherit;resize:vertical}
.test-examples{display:flex;gap:8px;flex-wrap:wrap}.test-examples button{font-size:12px;padding:8px 10px;background:#f7fafd}
.brain-result{border-top:1px solid #edf2f8;padding:18px;background:#fbfdff}
.brain-grid{display:grid;grid-template-columns:1.1fr .9fr;gap:16px}.brain-grid h4{margin:0 0 10px;font-size:14px}
.preview-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
.brain-grid pre{margin:0;white-space:pre-wrap;border-radius:16px;background:#172033;color:#dcecff;padding:14px;font-size:12px;line-height:1.5;overflow:auto}
.brain-grid p{margin:0 0 14px;color:#344154;line-height:1.55}
.bot-settings{display:grid;gap:16px}.settings-toolbar{display:flex;align-items:center;justify-content:space-between;gap:16px}.settings-toolbar h3{margin:5px 0 0}.settings-toolbar>div:last-child{display:flex;gap:10px;flex-wrap:wrap}
.settings-grid{display:grid;grid-template-columns:minmax(0,1fr) 360px;gap:16px}
.settings-card{padding:18px}.settings-card h4,.topic-board h4,.template-list h4,.template-form h4,.stop-rules h4,.system-health h3{margin:0 0 14px;font-size:17px;letter-spacing:-.03em}
.settings-card textarea{min-height:92px;resize:vertical}
.check-list{display:grid;gap:9px;padding:0;margin:0 0 14px;list-style:none}.check-list li{position:relative;padding-left:24px;color:#344154;line-height:1.45}.check-list li:before{content:'✓';position:absolute;left:0;top:0;color:var(--green);font-weight:900}
.topic-board{display:grid;grid-template-columns:repeat(3,1fr);gap:12px;padding:18px}.topic-board h4{grid-column:1/-1}.topic-column{display:grid;gap:10px;align-content:start}.topic-column>b{color:#536174}
.topic-card{border-radius:16px;padding:13px;border:1px solid var(--stroke-soft)}.topic-card strong{display:block;margin-bottom:7px}.topic-card p{margin:0;color:#5d6a7c;font-size:12px;line-height:1.45}
.topic-card.allowed{background:#eefbf4}.topic-card.careful{background:#fff8e8}.topic-card.blocked{background:#fff0f0}
.template-editor{display:grid;grid-template-columns:310px minmax(0,1fr);gap:0;overflow:hidden}
.template-list{border-right:1px solid #edf2f8;padding:18px;background:#fbfdff}
.template-list button{width:100%;display:block;text-align:left;border:1px solid transparent;background:transparent;border-radius:14px;padding:12px;margin-bottom:8px;cursor:pointer}
.template-list button:hover,.template-list button.active{background:#eef6ff;border-color:#d8e9ff}
.template-list b,.template-list small{display:block}.template-list small{margin-top:3px;color:#7d8998}.template-list .add-template{text-align:center;background:#fff;border-color:var(--stroke)}
.template-form{padding:18px}.template-form textarea{min-height:160px;resize:vertical}
.bot-funnel-board{display:grid;gap:16px}.kanban-scroll{display:grid;grid-template-columns:repeat(7,270px);gap:12px;overflow:auto;padding-bottom:6px}
.stage-card{padding:16px;min-height:230px}.stage-top{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:12px}.stage-top b{font-size:16px}.stage-top span{display:grid;place-items:center;min-width:32px;height:32px;border-radius:12px;background:#eef6ff;color:var(--blue);font-weight:800}
.stage-card p{margin:10px 0;color:#536174;line-height:1.45;font-size:12px}.stage-card strong{color:#202632}
.stop-rules{border-radius:18px;background:#f8fbff;border:1px solid var(--stroke-soft);padding:18px}.stop-rules div{display:flex;gap:8px;flex-wrap:wrap}.stop-rules span{border-radius:999px;background:#fff0f0;color:#bd3434;font-weight:800;font-size:12px;padding:7px 10px}
.bot-system{display:grid;gap:16px}.system-toolbar{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;padding:18px;background:linear-gradient(135deg,#f8fbff,#fff)}
.system-toolbar p{margin:0;color:#68778b}.system-toolbar code{font-size:12px;background:#eef6ff;border-radius:8px;padding:3px 6px;color:#1f73e0}
.system-kpis{display:grid;grid-template-columns:repeat(4,1fr);gap:12px}.system-kpi{border:1px solid var(--stroke-soft);border-radius:18px;padding:15px;background:#fff}.system-kpi span{display:block;color:#65758a;font-size:12px;font-weight:800}.system-kpi strong{display:block;margin-top:8px;font-size:24px}.system-kpi.blue{background:#eef6ff}.system-kpi.green{background:#eefbf4}.system-kpi.amber{background:#fff8e8}.system-kpi.softblue{background:#f3f7ff}.system-kpi.red{background:#fff0f0}
.system-grid{display:grid;grid-template-columns:minmax(0,.9fr) minmax(0,1.1fr);gap:16px}.system-table,.system-health,.system-note,.system-error,.system-loading{padding:18px;overflow:hidden}.system-note{background:#f8fbff;color:#344154}.system-loading{color:#536174;font-weight:800}.system-error{background:#fff0f0;color:#9f2525}.system-error p{margin:8px 0}.system-error small{color:#7d4b4b;word-break:break-word}
.system-badge{border-radius:999px;background:#eef6ff;color:var(--blue);font-size:11px;font-weight:800;padding:5px 9px}.bot-log-table{min-width:900px}.bot-log-table th{background:#f7f9fd}.bot-log-table td small{display:block;color:#7d8998;margin-top:4px}
.system-bars{display:grid;gap:10px}.system-bars p{display:flex;justify-content:space-between;gap:14px;margin:0;border-bottom:1px solid #edf2f8;padding:9px 0;color:#536174}.system-bars p:last-child{border-bottom:0}.system-bars b{color:#172033}
.change-row{border-top:1px solid #edf2f8;padding:14px 0}.change-row:first-of-type{border-top:0;padding-top:0}.change-row b,.change-row span{display:block}.change-row span{margin-top:4px;color:#7d8998;font-size:12px}.change-row p,.system-health p{margin:8px 0 0;color:#536174;line-height:1.55}
@media(max-width:1366px){.bot-metrics{grid-template-columns:repeat(4,1fr)}.kanban-scroll{grid-template-columns:repeat(7,250px)}.system-kpis{grid-template-columns:repeat(2,1fr)}}
@media(max-width:1180px){.bot-testing,.settings-grid,.template-editor,.bot-system,.system-grid{grid-template-columns:1fr}.template-list{border-right:0;border-bottom:1px solid #edf2f8}.bot-sources,.topic-board{grid-template-columns:1fr}}
@media(max-width:900px){.bot-admin-head,.bot-status-card,.settings-toolbar,.chat-head,.system-toolbar{display:block}.version-pill{display:inline-block;margin-top:12px}.bot-metrics,.bot-sources,.brain-grid,.system-kpis{grid-template-columns:1fr}.bot-tab-content{padding:16px}.bot-admin-head{padding:18px 18px 0}.bot-tabs{padding:0 18px 12px}}
/* L4c — «Настройки бота» business-config editor */
.cfg-screen .settings-toolbar p{margin:6px 0 0;color:#68778b;max-width:560px;line-height:1.5}
.cfg-toolbar-act{display:flex;gap:10px;flex-wrap:wrap}
.cfg-subtabs{display:flex;gap:8px;flex-wrap:wrap;margin:2px 0 4px}
.cfg-subtab{border:1px solid var(--stroke-soft);background:#fff;color:#5f6f84;border-radius:999px;padding:8px 14px;font-weight:800;cursor:pointer}
.cfg-subtab:hover,.cfg-subtab.active{background:#eef6ff;border-color:#d8e9ff;color:var(--blue)}
.cfg-empty,.cfg-muted{color:#68778b;line-height:1.55}
.cfg-empty{padding:22px;border:1px dashed var(--stroke);border-radius:16px;background:#fbfdff;text-align:center}
.cfg-list{display:grid;gap:18px}
.cfg-group h4{margin:0 0 10px;font-size:15px;letter-spacing:-.02em;color:#344154}
.cfg-row{display:grid;grid-template-columns:minmax(0,1.3fr) minmax(0,1fr) auto;grid-template-areas:'main val act' 'desc desc act';gap:6px 16px;align-items:center;border:1px solid var(--stroke-soft);border-radius:14px;padding:12px 14px;margin-bottom:8px;background:#fff}
.cfg-row.is-off{opacity:.62;background:#fafbfc}
.cfg-row__main{grid-area:main;display:flex;align-items:center;gap:10px;flex-wrap:wrap;min-width:0}
.cfg-row__main b{font-size:14px}
.cfg-row__main code{color:#94a3b8;font-size:12px}
.cfg-type{border-radius:999px;background:#eef6ff;color:var(--blue);font-size:11px;font-weight:800;padding:3px 8px}
.cfg-row__val{grid-area:val;color:#172033;font-weight:700;word-break:break-word}
.cfg-row__desc{grid-area:desc;color:#7d8998;font-size:12px;line-height:1.45}
.cfg-row__act{grid-area:act;display:flex;align-items:center;gap:8px;flex-wrap:wrap;justify-content:flex-end}
.cfg-row__act button{border:1px solid var(--stroke);background:#fff;border-radius:10px;padding:7px 11px;color:#344154;font-weight:800;cursor:pointer;font-size:12px}
.cfg-row__act button:hover{background:#f3f7ff}
.cfg-danger{color:#bd3434!important;border-color:#f3c9c9!important}
.cfg-danger:hover{background:#fff0f0!important}
.cfg-badge{border-radius:999px;background:#eef1f5;color:#7d8998;font-size:11px;font-weight:800;padding:4px 9px}
.cfg-badge.on{background:#eefbf4;color:#1f8a4c}
.cfg-form{border:1px solid #d8e9ff;border-radius:16px;padding:16px;background:#fbfdff;margin-bottom:8px}
.cfg-form__head{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin-bottom:14px}
.cfg-form__head b{font-size:15px}
.cfg-advisory{border-radius:999px;background:#fff8e8;color:#9a6a00;font-size:11px;font-weight:800;padding:4px 10px}
.cfg-form__grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.cf-field{display:flex;flex-direction:column;gap:5px;font-weight:800;color:#536174;font-size:12px}
.cf-field.cf-wide{grid-column:1/-1}
.cf-field input,.cf-field select,.cf-field textarea{border:1px solid var(--stroke);border-radius:10px;padding:9px 11px;font:inherit;color:#172033;font-weight:600;background:#fff}
.cf-field input:disabled{background:#f1f4f8;color:#94a3b8}
.cf-field textarea{resize:vertical;min-height:74px}
.cfg-form__act{display:flex;gap:10px;margin-top:14px}
.cfg-flags{display:grid;gap:10px}
.cfg-flag{display:flex;align-items:center;justify-content:space-between;gap:14px;border:1px solid var(--stroke-soft);border-radius:12px;padding:11px 14px;background:#fff}
.cfg-flag code{color:#344154;font-size:13px;font-weight:700}
.cfg-history .bot-log-table{min-width:560px}
@media(max-width:900px){.cfg-form__grid{grid-template-columns:1fr}.cfg-row{grid-template-columns:1fr;grid-template-areas:'main' 'val' 'desc' 'act'}.cfg-row__act{justify-content:flex-start}}

/* L4f — «Агент и тестирование»: editor + clean preview */
.agent-tab{display:grid;grid-template-columns:minmax(0,1.1fr) minmax(0,1fr);gap:18px}
.agent-col{min-width:0}
.agent-editor{display:grid;gap:12px}
.ag-head{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}
.ag-pick{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.ag-pick select{border:1px solid var(--stroke);border-radius:10px;padding:8px 11px;font:inherit;font-weight:700;color:#172033;background:#fff;min-width:220px}
.ag-badge{border-radius:999px;background:#eef1f5;color:#7d8998;font-size:11px;font-weight:800;padding:4px 9px}
.ag-badge.on{background:#eefbf4;color:#1f8a4c}
.agent-editor textarea[data-ag-prompt]{font-family:ui-monospace,Menlo,Consolas,monospace;font-size:12.5px;line-height:1.5}
.ag-params{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.ag-rules{display:grid;gap:8px}
.ag-rules h4{margin:4px 0 2px;font-size:15px;letter-spacing:-.02em}
.ag-rule{display:grid;grid-template-columns:minmax(120px,1fr) 130px minmax(0,1.4fr);gap:10px;align-items:center;border:1px solid var(--stroke-soft);border-radius:10px;padding:8px 12px;background:#fff}
.ag-rule__st{font-weight:700;color:#344154}
.ag-rule__term{grid-column:2/-1;color:#94a3b8;font-size:12px}
.ag-rule select,.ag-rule input{border:1px solid var(--stroke);border-radius:9px;padding:7px 9px;font:inherit;color:#172033;background:#fff}
.ag-actions{display:flex;gap:10px;flex-wrap:wrap;margin-top:4px}
.ag-actions button{border:1px solid var(--stroke);background:#fff;border-radius:11px;padding:9px 14px;color:#344154;font-weight:800;cursor:pointer}
.agent-preview{display:grid;gap:12px;align-content:start;border:1px solid var(--stroke-soft);border-radius:16px;padding:16px;background:#fbfdff}
.agent-preview h4{margin:0;font-size:16px;letter-spacing:-.02em}
.ag-test-form{display:grid;gap:10px}
.ag-test-row{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.ag-test-form label{display:flex;flex-direction:column;gap:5px;font-weight:800;color:#536174;font-size:12px}
.ag-test-form input,.ag-test-form select,.ag-test-form textarea{border:1px solid var(--stroke);border-radius:10px;padding:9px 11px;font:inherit;color:#172033;background:#fff}
.ag-test-form button{justify-self:start}
.ag-result{display:grid;gap:8px}
.ag-decision{display:flex;align-items:baseline;gap:12px}
.ag-decision span{color:#65758a;font-size:12px;font-weight:800}
.ag-decision b{font-size:18px;color:#1f73e0}
.ag-result p{margin:0;color:#344154;line-height:1.5}
.ag-details{border-top:1px solid #e7eef7;padding-top:8px}
.ag-details summary{cursor:pointer;color:#536174;font-weight:800;font-size:12px}
.ag-details h5{margin:10px 0 4px;font-size:12px;color:#65758a}
.ag-details pre{margin:0;white-space:pre-wrap;word-break:break-word;background:#172033;color:#dcecff;border-radius:10px;padding:10px;font-size:11.5px;line-height:1.45;max-height:240px;overflow:auto}
.ag-noteline{color:#94a3b8;font-size:11.5px}
@media(max-width:1180px){.agent-tab{grid-template-columns:1fr}.ag-params,.ag-test-row{grid-template-columns:1fr}.ag-rule{grid-template-columns:1fr}}

/* L4g — «Агент и тестирование» точь-в-точь по макету (3 колонки) */
.agent-tab3{display:grid;grid-template-columns:250px minmax(0,1.15fr) minmax(0,0.92fr);gap:18px;align-items:start}
.agent-rail{display:flex;flex-direction:column;gap:12px}
.ag-search{display:flex;align-items:center;gap:8px;border:1px solid var(--stroke);border-radius:12px;padding:9px 12px;background:#fff;color:#94a3b8}
.ag-search input{border:0;outline:0;font:inherit;width:100%;color:#172033}
.ag-rail-head{display:flex;align-items:center;justify-content:space-between;padding:0 2px}
.ag-rail-head b{font-size:15px}
.ag-rail-add{width:28px;height:28px;border:1px solid var(--stroke);border-radius:9px;background:#fff;color:var(--blue);font-size:18px;line-height:1;cursor:pointer}
.ag-bot-list{display:flex;flex-direction:column;gap:10px}
.ag-bot{display:flex;flex-direction:column;gap:6px;align-items:flex-start;text-align:left;border:1px solid var(--stroke-soft);border-radius:14px;padding:14px;background:#fff;cursor:pointer;position:relative}
.ag-bot:hover{border-color:#d8e9ff}
.ag-bot.is-active{border-color:#bcd7ff;background:#f4f8ff;box-shadow:0 0 0 1px #bcd7ff}
.ag-bot__name{font-weight:800;color:#172033}
.ag-bot__status{display:flex;align-items:center;gap:6px;font-size:12px;color:#7d8998}
.ag-dot{width:8px;height:8px;border-radius:50%;background:#cbd5e1}
.ag-dot.on{background:#16a34a}
.ag-bot__chev{position:absolute;right:12px;top:14px;color:var(--blue);font-size:18px;font-weight:800}
.ag-add-bot{border:1px dashed var(--stroke);border-radius:14px;padding:12px;background:#fff;color:var(--blue);font-weight:800;cursor:pointer}
.agent-editor{display:flex;flex-direction:column;gap:14px}
.ag-head{display:flex;align-items:center;gap:10px}
.ag-head .ag-pick{display:flex;align-items:center;gap:10px;flex:1}
.ag-pick select{border:1px solid var(--stroke);border-radius:12px;padding:10px 12px;font:inherit;font-weight:800;color:#172033;background:#fff;min-width:240px}
.ag-head>button{margin-left:auto;border:1px solid var(--stroke);background:#fff;border-radius:11px;padding:9px 14px;font-weight:800;color:#344154;cursor:pointer}
.ag-name input{font-weight:700}
.ag-block{border:1px solid var(--stroke-soft);border-radius:14px;padding:14px;background:#fff;position:relative}
.ag-block-head{margin-bottom:10px}
.ag-block-head b{font-size:15px}
.ag-block textarea{width:100%;border:1px solid var(--stroke);border-radius:10px;padding:11px;font:inherit;font-size:13px;line-height:1.55;color:#344154;resize:vertical;box-sizing:border-box}
.ag-counter{position:absolute;right:22px;bottom:22px;color:#94a3b8;font-size:11px}
.ag-acc{border:1px solid var(--stroke-soft);border-radius:14px;background:#fff;overflow:hidden}
.ag-acc-head{width:100%;display:flex;align-items:center;justify-content:space-between;gap:10px;padding:14px;background:#fff;border:0;font:inherit;font-weight:800;color:#172033;cursor:pointer;font-size:15px}
.ag-acc-head.static{cursor:default}
.ag-acc-meta{color:#94a3b8;font-weight:700;font-size:13px}
.ag-acc-body{padding:0 14px 14px;display:flex;flex-direction:column;gap:10px}
.ag-acc-d{border:1px solid var(--stroke-soft);border-radius:14px;background:#fff;padding:0}
.ag-acc-d>summary{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:14px;font-weight:800;cursor:pointer;list-style:none;font-size:15px}
.ag-acc-d>summary::-webkit-details-marker{display:none}
.ag-acc-d[open]>summary{border-bottom:1px solid #eef2f8}
.ag-params{display:grid;grid-template-columns:1fr 1fr;gap:12px;padding:14px}
.ag-params .cf-field input{border:1px solid var(--stroke);border-radius:10px;padding:9px 11px;font:inherit}
.ag-rules{display:flex;flex-direction:column;gap:8px;padding:14px}
.ag-rule{display:grid;grid-template-columns:minmax(110px,1fr) 130px minmax(0,1.3fr);gap:10px;align-items:center}
.ag-rule__st{font-weight:700;color:#344154}
.ag-rule__term{grid-column:2/-1;color:#94a3b8;font-size:12px}
.ag-rule select,.ag-rule input{border:1px solid var(--stroke);border-radius:9px;padding:7px 9px;font:inherit;background:#fff}
.ag-kb-block{display:flex;align-items:center;gap:12px;border:1px solid var(--stroke-soft);border-radius:12px;padding:12px;background:#fff}
.ag-kb-block.is-forbidden{background:#fbfdff}
.ag-kb-ic{width:38px;height:38px;border-radius:11px;background:#eef6ff;color:var(--blue);display:grid;place-items:center;font-size:16px;flex-shrink:0}
.ag-kb-block.is-forbidden .ag-kb-ic{background:#eef1f5;color:#64748b}
.ag-kb-main{min-width:0;flex:1}
.ag-kb-main b{display:block;font-size:14px}
.ag-kb-main span{display:block;color:#7d8998;font-size:12px;line-height:1.45;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.ag-kb-act{display:flex;gap:6px}
.ag-kb-act button{width:30px;height:30px;border:1px solid var(--stroke);border-radius:9px;background:#fff;cursor:pointer;color:#64748b}
.ag-kb-add{border:1px dashed var(--stroke);border-radius:12px;padding:12px;background:#fff;color:var(--blue);font-weight:800;cursor:pointer}
.ag-kb-edit{border:1px solid #d8e9ff;border-radius:12px;padding:12px;background:#fbfdff;display:flex;flex-direction:column;gap:10px}
.ag-kb-edit input,.ag-kb-edit textarea{border:1px solid var(--stroke);border-radius:10px;padding:9px 11px;font:inherit;background:#fff;box-sizing:border-box;width:100%}
.ag-kb-forbidden{display:flex;align-items:center;gap:8px;font-size:12px;color:#536174;font-weight:700}
.ag-actions{display:flex;gap:10px;flex-wrap:wrap}
.ag-actions button{border:1px solid var(--stroke);background:#fff;border-radius:11px;padding:10px 14px;color:#344154;font-weight:800;cursor:pointer}
.agent-preview{display:flex;flex-direction:column;gap:14px;border:1px solid var(--stroke-soft);border-radius:16px;padding:18px;background:#fff;position:sticky;top:12px}
.agent-preview h3{margin:0;font-size:18px;letter-spacing:-.03em}
.ag-test-form{display:flex;flex-direction:column;gap:10px}
.ag-test-form .cf-field{display:flex;flex-direction:column;gap:5px;font-weight:800;color:#536174;font-size:12px}
.ag-test-form select,.ag-test-form textarea{border:1px solid var(--stroke);border-radius:10px;padding:10px 11px;font:inherit;color:#172033;background:#fff;box-sizing:border-box}
.ag-test-form>button{align-self:flex-start}
.ag-res-card{border:1px solid var(--stroke-soft);border-radius:14px;min-height:160px;display:flex;flex-direction:column;overflow:hidden}
.ag-empty-preview{margin:auto;text-align:center;color:#94a3b8;padding:30px}
.ag-empty-ic{font-size:30px;opacity:.5;margin-bottom:10px}
.ag-res-tabs{display:flex;gap:18px;border-bottom:1px solid #eef2f8;padding:0 16px}
.ag-res-tab{border:0;background:0;padding:13px 2px;font:inherit;font-weight:800;color:#7d8998;cursor:pointer;border-bottom:2px solid transparent;margin-bottom:-1px}
.ag-res-tab.active{color:var(--blue);border-bottom-color:var(--blue)}
.ag-res-body{padding:16px}
.ag-reply{color:#172033;line-height:1.6}
.ag-reasoning h5{margin:0 0 10px;font-size:14px}
.ag-steps{list-style:none;margin:0;padding:0;display:flex;flex-direction:column}
.ag-step{display:flex;gap:12px;padding:0 0 16px;position:relative}
.ag-step:not(:last-child)::before{content:"";position:absolute;left:11px;top:24px;bottom:0;width:2px;background:#e4ecf5}
.ag-step-no{width:24px;height:24px;border-radius:50%;background:#eef1f5;color:#cbd5e1;display:grid;place-items:center;font-size:13px;font-weight:800;flex-shrink:0;z-index:1}
.ag-step.ok .ag-step-no{background:#e6f7ee;color:#16a34a}
.ag-step b{font-size:13px;color:#172033}
.ag-step p{margin:3px 0 0;color:#5d6a7c;font-size:12px;line-height:1.45}
.ag-tokens{padding:8px 16px 4px;color:#94a3b8;font-size:11.5px;display:flex;justify-content:space-between;flex-wrap:wrap;gap:8px}
.ag-tokens .ag-cost{color:#536174;font-weight:700}
.ag-success{display:flex;align-items:center;justify-content:space-between;gap:10px;background:#e6f7ee;color:#1f8a4c;font-weight:800;font-size:12px;padding:10px 16px}
.ag-success span{color:#5a9a76;font-weight:600}
.ag-retest{border:0;border-top:1px solid #eef2f8;background:#fff;padding:12px;color:#344154;font-weight:800;cursor:pointer;width:100%}
@media(max-width:1280px){.agent-tab3{grid-template-columns:220px 1fr}.agent-preview{grid-column:1/-1;position:static}}
@media(max-width:820px){.agent-tab3{grid-template-columns:1fr}.ag-params,.ag-rule{grid-template-columns:1fr}}

/* L4h — Testing tab layout aligned to the approved mockup */
.bot-tab-content:has(.agent-tab3){padding:0}
.agent-tab3{grid-template-columns:280px minmax(560px,1fr) minmax(420px,.82fr);gap:0;min-height:760px;border-top:1px solid #e7edf7}
.agent-tab3 .system-error{grid-column:1/-1;margin:18px 22px 0}
.agent-rail{padding:22px 24px;border-right:1px solid #e7edf7;background:#fff;gap:18px}
.ag-search{height:48px;border-radius:10px;padding:0 14px;box-shadow:none}
.ag-search span{font-size:20px;color:#5369b3}
.ag-search input::placeholder{color:#7380ad}
.ag-rail-head{padding:4px 0 0}.ag-rail-head b{font-size:18px;letter-spacing:-.02em}
.ag-rail-add{width:34px;height:34px;border-radius:11px;font-size:24px}
.ag-bot-list{gap:12px}
.ag-bot{min-height:72px;border-radius:10px;padding:16px 18px;box-shadow:0 8px 20px rgba(32,54,86,.03)}
.ag-bot.is-active{border-color:#0b58ff;background:#f8fbff;box-shadow:0 0 0 1px rgba(11,88,255,.5)}
.ag-bot__name{font-size:15px;color:#06153a}
.ag-bot__status{font-weight:800;color:#6876a6}.ag-dot{width:6px;height:6px}.ag-bot__chev{right:16px;top:28px;font-size:30px;line-height:1}
.ag-add-bot{height:52px;border:1px solid #a9bfff;border-radius:10px;font-size:16px;background:#fff}
.agent-editor{padding:22px 24px;border-right:1px solid #e7edf7;background:#fff;gap:14px}
.ag-head{gap:18px}.ag-pick select{height:48px;min-width:240px;border-radius:8px}
.ag-head>button{height:48px;border-radius:8px;padding:0 22px;color:#536174}
.ag-badge{border-radius:999px;background:#e7f8ee;color:#16834f;font-size:12px;font-weight:900;padding:6px 11px}
.ag-name{display:none}
.ag-current{border:1px solid #dce7f6;border-radius:10px;background:#f8fbff;padding:14px 18px;display:grid;gap:10px}
.ag-current b,.ag-current span{display:block}.ag-current b{font-size:15px;color:#06153a}.ag-current>div>span{margin-top:4px;color:#5369b3;font-weight:800;font-size:13px}
.ag-current-flags{display:flex;gap:8px;flex-wrap:wrap}.ag-current-flags span{border-radius:999px;background:#eef2f8;color:#6876a6;padding:5px 9px;font-size:11px;font-weight:900}.ag-current-flags span.on{background:#e8f8ed;color:#16834f}.ag-current-flags span.off{background:#fff0f0;color:#bd3434}
.ag-block{border-radius:10px;padding:0;overflow:hidden}.ag-block-head{height:58px;margin:0;display:flex;align-items:center;padding:0 20px;border-bottom:1px solid #eef2f8}.ag-block textarea{border:0;border-radius:0;min-height:130px;padding:16px 20px}.ag-counter{right:18px;bottom:12px}
.ag-block-head{justify-content:space-between;gap:12px}.ag-block-head span{color:#6876a6;font-size:12px;font-weight:800}
.ag-acc,.ag-acc-d{border-radius:10px}.ag-acc-head,.ag-acc-d>summary{min-height:58px;padding:0 20px;font-size:16px}.ag-acc-meta{color:#4f62a3}
.ag-rules-view{border:1px solid var(--stroke-soft);border-radius:10px;background:#fff;overflow:hidden}
.ag-rule-snapshot{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;padding:0 20px 18px}.ag-rule-snapshot p{margin:0;border:1px solid #eef2f8;border-radius:9px;padding:10px 12px;background:#fbfdff}.ag-rule-snapshot b,.ag-rule-snapshot span{display:block}.ag-rule-snapshot b{font-size:12px;color:#06153a}.ag-rule-snapshot span{margin-top:4px;color:#536174;font-size:12px;line-height:1.35}
.ag-info{display:inline-grid;place-items:center;width:16px;height:16px;margin-left:5px;border-radius:50%;border:1px solid #90a0d6;color:#5369b3;font-size:11px}
.ag-acc-body{padding:0 20px 20px;gap:10px}
.ag-kb-block{min-height:58px;border-radius:10px;padding:12px 14px;box-shadow:0 8px 18px rgba(32,54,86,.025)}
.ag-kb-ic{width:38px;height:38px;border-radius:10px;background:#eef6ff;color:#0b58ff;font-weight:900}
.ag-kb-main b{font-size:14px;color:#06153a}.ag-kb-main span{font-size:13px;color:#536174}
.ag-kb-act button{border:0;background:transparent;color:#5369b3;font-size:18px}
.ag-kb-add{display:grid;grid-template-columns:34px 1fr;grid-template-areas:'plus title' 'plus sub';align-items:center;text-align:left;border-radius:10px;border:1px dashed #b9c9e8;padding:13px 16px}
.ag-kb-add span{grid-area:plus;font-size:26px;color:#0b58ff}.ag-kb-add b{grid-area:title;color:#0b58ff}.ag-kb-add small{grid-area:sub;color:#6876a6}
.ag-params{display:block;padding:0 20px 16px}.ag-params .cf-field{display:none}.ag-params:before{content:"Температура: 0.1  ·  Макс. длина ответа (токенов): 320";color:#5369b3;font-weight:800;font-size:13px}
.ag-acc-d:not([open]) summary .ag-acc-meta:before{content:""}.ag-rules{padding:16px 20px}
.ag-actions{padding:28px 10px 0;gap:16px}.ag-actions button{height:48px;border-radius:8px;padding:0 20px}.ag-actions .bot-primary{min-width:250px}
.agent-preview{position:static;border:0;border-radius:0;padding:28px 24px;background:#fff;gap:18px}
.agent-preview h3{font-size:20px;margin:0 0 6px;color:#06153a}
.ag-test-form{gap:12px}.ag-test-row{grid-template-columns:1fr 1fr;gap:18px}
.ag-test-form input,.ag-test-form select,.ag-test-form textarea{border:1px solid #d8e2f1;border-radius:8px;padding:12px 14px;font-weight:700}
.ag-test-form textarea{min-height:102px}.ag-test-form>button{height:40px;border-radius:7px;padding:0 20px}
.ag-res-card{min-height:168px;border-radius:8px;border-color:#dce5f2;background:#fff}
.ag-empty-preview{min-height:132px;display:grid;place-items:center;align-content:center}.ag-empty-ic{font-size:28px;color:#6270a8}
.ag-res-tabs{padding:0;border-bottom:1px solid #e5ebf5;gap:24px}.ag-res-tab{padding:16px 12px 12px;font-size:13px}
.ag-res-tab.active{border-bottom-width:3px}
.ag-res-body{padding:18px}.ag-reply{background:#f6f9ff;border-radius:10px;padding:18px 20px;font-weight:700;color:#06153a}
.ag-reasoning{padding:0 0 2px}.ag-reasoning h5{font-size:16px;margin:0 0 18px;color:#06153a}
.ag-step{padding-bottom:18px}.ag-step:not(:last-child)::before{left:9px;top:22px;background:#bfe8cf}.ag-step-no{width:20px;height:20px;background:#ecfdf3;color:#16a34a;border:2px solid #16a34a;font-size:11px}
.ag-step b{font-size:14px}.ag-step p{font-size:13px;color:#536174}
.ag-tokens{padding:10px 0 12px;font-weight:800;color:#5369b3}.ag-tokens .ag-cost{margin-left:auto;color:#5369b3}
.ag-success{margin:0 0 12px;border-radius:8px;background:#e8f8ed;padding:14px 18px}.ag-retest{height:52px;border:1px solid #a9bfff;border-radius:8px;color:#0b58ff;font-size:15px}
@media(max-width:1440px){.agent-tab3{grid-template-columns:250px minmax(500px,1fr) minmax(390px,.85fr)}}
@media(max-width:1180px){.bot-tab-content:has(.agent-tab3){padding:16px}.agent-tab3{grid-template-columns:1fr;border:0;gap:16px}.agent-rail,.agent-editor{border-right:0;padding:0}.agent-preview{padding:0}.ag-rule-snapshot{grid-template-columns:1fr}}

/* L4k — Testing tab visual pass to match the approved agent editor mockup */
.agent-tab3{grid-template-columns:280px minmax(620px,1fr) minmax(430px,.82fr);min-height:790px;background:#fff}
.agent-rail{padding:22px 24px 24px;background:#fff}
.ag-search{height:48px;border-color:#dce6f4;border-radius:8px;background:#fff}
.ag-search span{font-size:18px}
.ag-bot{border-color:#e2e9f4;border-radius:8px;background:#fff;min-height:74px}
.ag-bot.is-active{border-color:#1c62ff;background:#f8fbff;box-shadow:0 0 0 1px rgba(28,98,255,.65)}
.ag-bot__name{font-size:15px;letter-spacing:0}
.ag-bot__chev{top:25px;right:16px}
.ag-add-bot{height:52px;border-radius:8px;border-color:#9fb7ff;background:#fff}
.agent-editor{padding:20px 24px 28px;background:#fff;gap:14px}
.ag-head{display:grid;grid-template-columns:minmax(220px,290px) auto 1fr;align-items:center;gap:16px}
.ag-head .ag-pick{display:contents}
.ag-pick select{height:48px;min-width:0;width:100%;border-radius:7px;border-color:#dce6f4;padding:0 18px;font-size:15px}
.ag-head>button{grid-column:3;justify-self:end;height:48px;min-width:132px;border-radius:7px;border-color:#dce6f4;background:#fff}
.ag-badge{height:26px;display:inline-flex;align-items:center;width:max-content}
.ag-current,.agent-editor>.cfg-muted{display:none!important}
.ag-name{display:flex!important;border:1px solid #dce6f4;border-radius:8px;background:#fff;padding:12px 14px;margin:0;color:#5267a8}
.ag-name input{margin-top:6px;border:1px solid #dce6f4;border-radius:7px;padding:10px 12px;color:#06153a;font-weight:900}
.ag-block{border-radius:8px;border-color:#dce6f4;min-height:56px}
.ag-block>summary{list-style:none;cursor:pointer}
.ag-block>summary::-webkit-details-marker{display:none}
.ag-block-head{height:56px;border-bottom:0;padding:0 20px}
.ag-block-head b{font-size:17px;color:#06153a}
.ag-block-head span{display:block;color:#5267a8;font-size:12px}
.ag-block textarea[data-ag-prompt]{display:block;border-top:1px solid #eef2f8;min-height:138px;font-family:ui-monospace,Menlo,Consolas,monospace;font-size:12.5px;line-height:1.55}
.ag-block .ag-counter{display:block}
.ag-acc,.ag-acc-d{border-radius:8px;border-color:#dce6f4;background:#fff}
.ag-acc-head,.ag-acc-d>summary{height:56px;min-height:56px;padding:0 20px;font-size:17px;color:#06153a}
.ag-acc-meta{color:#5267a8;font-weight:800}
.ag-info{width:15px;height:15px;font-size:10px}
.ag-acc-body{padding:0 20px 20px;gap:12px}
.ag-kb-pills{display:flex;gap:10px;flex-wrap:wrap;padding:0 0 10px}
.ag-kb-pill{height:36px;border:1px solid #e1e9f6;border-radius:999px;background:#f7faff;color:#0b58ff;padding:0 18px;font-weight:900;cursor:pointer}
.ag-kb-pill.active{background:#eef5ff;border-color:#d6e5ff}
.ag-kb-pill.add{background:#fff;color:#0b58ff}
.ag-kb-expanded{display:flex;flex-direction:column;gap:12px}
.ag-topic-summary{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.ag-topic-summary section{border:1px solid #e4ebf6;border-radius:8px;background:#fbfdff;padding:12px;display:flex;gap:8px;flex-wrap:wrap;align-content:start;min-height:68px}
.ag-topic-summary b{width:100%;color:#06153a;font-size:13px}
.ag-topic-summary span{border-radius:999px;background:#eef5ff;color:#0b58ff;padding:5px 10px;font-size:12px;font-weight:900}
.ag-topic-summary section:last-child span{background:#fff0f0;color:#bd3434}
.ag-topic-summary small{color:#6979a9;font-weight:800}
.ag-kb-block{display:block;border:1px solid #dce6f4;border-radius:8px;padding:0;background:#fff;box-shadow:none;min-height:0;position:relative;overflow:hidden}
.ag-kb-block>summary{list-style:none;cursor:pointer}
.ag-kb-block>summary::-webkit-details-marker{display:none}
.ag-kb-block-head{display:grid;grid-template-columns:42px minmax(0,1fr) auto;align-items:center;gap:12px;padding:14px 16px}
.ag-kb-ic{width:36px;height:36px;border-radius:9px;background:#eef5ff;color:#0b58ff;display:grid;place-items:center;font-weight:900}
.ag-kb-title{min-width:0}.ag-kb-title small{display:block;margin-top:3px;color:#6979a9;font-size:12px;font-weight:800}
.ag-kb-block-head input{border:0;outline:0;background:transparent;color:#06153a;font:inherit;font-size:15px;font-weight:900;width:100%;padding:0}
.ag-kb-block textarea{display:block;width:100%;box-sizing:border-box;border:1px solid #dce6f4;border-radius:8px;margin:0 12px 12px;width:calc(100% - 24px);padding:12px 13px;color:#06153a;font:inherit;font-size:14px;line-height:1.55;resize:vertical;background:#fff}
.ag-kb-count{position:absolute;right:22px;bottom:22px;color:#6979a9;font-size:12px}
.ag-kb-act{display:flex;gap:8px}
.ag-kb-act button{width:26px;height:26px;border:0;background:transparent;color:#5369b3;font-size:16px}
.ag-kb-act i{display:grid;place-items:center;width:24px;color:#5369b3;font-style:normal;font-size:16px}
.ag-kb-add{grid-template-columns:30px 1fr;border-radius:8px;border-color:#c8d7ee;background:#fff;margin-top:0}
.ag-params{padding:0 20px 16px}
.ag-params .cf-field{display:flex!important}
.ag-rules-body{display:grid;gap:12px;padding:0 20px 18px}
.ag-rules-combined .ag-acc-meta{margin-left:auto}
.ag-rules-combined summary{gap:16px}
.ag-refresh{height:36px;border:0;border-radius:7px;background:#0b58ff;color:#fff;font-weight:900;padding:0 18px;cursor:pointer}
.ag-rules-combined .ag-rule-snapshot{display:none}
.ag-rules-combined .ag-rules{padding:0;gap:8px}
.ag-rules-combined .ag-rule{display:grid;grid-template-columns:42px minmax(180px,1fr) 150px minmax(180px,1fr) 42px;gap:8px;align-items:center;border:1px solid #dce6f4;border-radius:8px;background:#fff;padding:10px 12px}
.ag-rule__icon{width:32px;height:32px;border-radius:9px;background:#eef5ff;color:#0b58ff;display:grid;place-items:center;font-weight:900;font-size:16px}
.ag-rule__main{min-width:0}.ag-rule__main b{display:block;color:#06153a;font-size:14px}.ag-rule__main small{display:block;margin-top:3px;color:#6979a9;font-size:12px;font-weight:800;line-height:1.3}
.ag-rules-combined .ag-rule select,.ag-rules-combined .ag-rule input{height:38px;border:1px solid #dce6f4;border-radius:7px;background:#fff;color:#06153a;font:inherit;font-weight:800;padding:0 12px;min-width:0}
.ag-rules-combined .ag-rule select:disabled{background:#f8fbff;color:#06153a}
.ag-rule__del{width:38px;height:38px;border:1px solid #e1e9f6;border-radius:8px;background:#fff;color:#263b78;font-size:17px;cursor:pointer}
.ag-acc-d>summary{border-bottom:0}
.ag-acc-d[open]>summary{border-bottom:1px solid #eef2f8}
.ag-actions{padding:26px 10px 0;display:grid;grid-template-columns:minmax(150px,190px) minmax(220px,270px) minmax(170px,210px) minmax(90px,120px);gap:18px}
.ag-actions button{height:48px;border-radius:7px;padding:0 18px;white-space:nowrap}
.ag-actions .bot-primary{min-width:0}
.agent-preview{padding:24px 26px 28px;border-left:0;background:#fff}
.agent-preview h3{font-size:20px;margin:0 0 8px}
.ag-test-form{gap:12px}
.ag-test-row{gap:18px}
.ag-test-form input,.ag-test-form select,.ag-test-form textarea{border-radius:7px;border-color:#dce6f4;background:#fff}
.ag-test-form textarea{min-height:112px}
.ag-test-form>button{height:38px;border-radius:6px}
.ag-res-card{border-radius:8px;border-color:#dce6f4;min-height:142px}
.ag-empty-preview{min-height:138px}
@media(max-width:1440px){.agent-tab3{grid-template-columns:260px minmax(560px,1fr) minmax(400px,.82fr)}.ag-actions{grid-template-columns:1fr 1.35fr 1.1fr auto;gap:12px}.ag-actions button{padding:0 14px}}
@media(max-width:1180px){.agent-tab3{grid-template-columns:1fr}.ag-head{grid-template-columns:1fr}.ag-head .ag-pick{display:flex}.ag-head>button{grid-column:auto;justify-self:start}.ag-actions{grid-template-columns:1fr}.ag-kb-pill{height:34px}}

/* L4g-UX — dirty badge, inline validation, source hints, rule groups */
.ag-err{display:block;color:#d6336c;font-size:11.5px;font-weight:700;margin-top:4px;min-height:0}
.ag-err:empty{display:none}
.ag-src{color:#94a3b8;font-size:11px;font-weight:700;margin:0}
.ag-block-head .ag-src{margin-left:auto}
.ag-rule-group{display:flex;flex-direction:column;gap:8px}
.ag-rule-group+.ag-rule-group{margin-top:6px}
.ag-group-label{font-size:11px;font-weight:900;letter-spacing:.04em;text-transform:uppercase;color:#8aa0c8;padding:0 20px}
.ag-sys-limits{display:flex;flex-direction:column;gap:6px;padding:2px 20px 16px}
.ag-sys-limits span{color:#536174;font-size:12.5px}
.ag-sys-limits b{color:#06153a}
.ag-rule__del.placeholder{border:0;background:0;cursor:default;width:38px;height:38px}
.ag-rule__del{font-size:12px;font-weight:800;width:auto;min-width:38px;padding:0 10px}

/* L4h — окно проверки = чат с историей */
.ag-chat-head{display:flex;align-items:center;justify-content:space-between;gap:10px}
.ag-chat-clear{border:1px solid var(--stroke);background:#fff;border-radius:9px;padding:6px 12px;font-weight:800;color:#536174;cursor:pointer;font-size:12px}
.ag-chat-pick{display:flex;flex-direction:column;gap:5px;font-weight:800;color:#536174;font-size:12px}
.ag-chat-pick select{border:1px solid var(--stroke);border-radius:10px;padding:9px 11px;font:inherit;font-weight:700;color:#172033;background:#fff}
.ag-chat-thread{display:flex;flex-direction:column;gap:10px;max-height:460px;overflow:auto;padding:4px 2px}
.ag-msg{display:flex}
.ag-msg.candidate{justify-content:flex-end}
.ag-msg.bot{justify-content:flex-start}
.ag-bubble{max-width:86%;border-radius:14px;padding:11px 13px;line-height:1.5;font-size:13.5px}
.ag-msg.candidate .ag-bubble{background:var(--blue);color:#fff;border-bottom-right-radius:5px}
.ag-msg.bot .ag-bubble{background:#f3f6fb;color:#172033;border:1px solid var(--stroke-soft);border-bottom-left-radius:5px}
/* Серое системное сообщение (как на проде: «Кандидат откликнулся…»/«Работодатель заинтересовался…») */
.ag-msg.note{justify-content:center}
.ag-note{display:inline-block;max-width:92%;background:#eef1f5;color:#64748b;font-size:12px;line-height:1.4;padding:5px 12px;border-radius:10px;text-align:center}
/* Кнопки «Начать как на проде» */
.ag-scenario-row{display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin:2px 0 4px}
.ag-scenario-lbl{font-size:12px;color:#64748b}
.ag-scenario-btn{border:1px solid var(--stroke);background:#fff;color:#172033;font-size:12.5px;padding:6px 12px;border-radius:9px;cursor:pointer;font-weight:700;transition:background .15s,border-color .15s}
.ag-scenario-btn:hover{background:#f3f6fb;border-color:var(--blue)}
.ag-scenario-btn.is-on{background:var(--blue);color:#fff;border-color:var(--blue)}
.ag-typing{color:#7d8998;font-style:italic}
.ag-msg-meta{margin-top:7px;color:#8aa0c8;font-size:11px;font-weight:700}
.ag-msg.bot .ag-why{margin-top:8px;border-top:1px solid #e4ecf5;padding-top:8px}
.ag-why summary{cursor:pointer;color:#536174;font-weight:800;font-size:12px;list-style:none}
.ag-why summary::-webkit-details-marker{display:none}
.ag-why summary::before{content:'▸ ';color:#94a3b8}
.ag-why[open] summary::before{content:'▾ '}
.ag-why .ag-steps{margin-top:8px}
.ag-chat-error{background:#fff0f0;color:#9f2525;border-radius:10px;padding:9px 12px;font-size:12.5px;font-weight:700}
.ag-chat-error__detail{display:block;margin-top:5px;font-family:ui-monospace,Menlo,Consolas,monospace;font-weight:600;font-size:11.5px;color:#b5564f;word-break:break-word}
.ag-chat-input{display:flex;gap:8px;align-items:flex-end}
.ag-chat-input textarea{flex:1;border:1px solid var(--stroke);border-radius:10px;padding:10px 11px;font:inherit;resize:vertical;color:#172033;background:#fff;box-sizing:border-box}
.ag-chat-input>button{height:42px;white-space:nowrap}
@media(max-width:1180px){.ag-chat-thread{max-height:340px}}

/* L4o — right-side agent test drawer + calmer editor density */
.agent-tab3 button,
.agent-tab3 input,
.agent-tab3 textarea,
.agent-tab3 select,
.agent-tab3 details,
.agent-tab3 .ag-bot,
.agent-tab3 .ag-kb-block{
  transition:border-color .18s ease, background-color .18s ease, color .18s ease, box-shadow .18s ease, transform .12s ease;
}
.agent-tab3 button:active{transform:translateY(1px) scale(.99)}
.agent-tab3 input:focus,
.agent-tab3 textarea:focus,
.agent-tab3 select:focus{
  border-color:#7fa5ff!important;
  box-shadow:0 0 0 3px rgba(11,88,255,.08);
  outline:0;
}
.agent-tab3{
  grid-template-columns:280px minmax(620px,1fr);
  padding-right:482px;
  position:relative;
}
.agent-editor{border-right:0}
.agent-preview{
  position:fixed;
  top:26px;
  right:18px;
  bottom:20px;
  width:436px;
  z-index:45;
  display:flex;
  flex-direction:column;
  border:1px solid #dce6f4;
  border-radius:10px;
  padding:28px 26px;
  background:#fff;
  box-shadow:0 18px 44px rgba(32,54,86,.10);
  overflow:hidden;
}
.ag-chat-head{flex-shrink:0}
.ag-chat-head h3{margin:0;font-size:20px;color:#06153a}
.ag-chat-actions{display:flex;align-items:center;gap:8px}
.ag-preview-close{
  width:34px;
  height:34px;
  border:0;
  background:#fff;
  color:#263b78;
  font-size:28px;
  line-height:1;
  cursor:pointer;
}
.ag-preview-open{
  position:fixed;
  top:18px;
  right:18px;
  z-index:46;
  border:1px solid #dce6f4;
  border-radius:10px;
  background:#fff;
  color:#0b58ff;
  padding:12px 16px;
  font-weight:900;
  box-shadow:0 12px 30px rgba(32,54,86,.10);
}
.ag-chat-pick{margin-top:10px}
.ag-chat-thread{
  flex:1;
  max-height:none;
  min-height:180px;
  margin:2px 0 6px;
  padding:6px 2px;
}
.ag-chat-input{flex-shrink:0}
.ag-chat-input textarea{
  min-height:56px;
  max-height:96px;
  padding:10px 12px;
}
.ag-chat-input>button{height:40px}
.ag-chat-clear{
  border-color:#dce6f4;
  color:#5267a8;
  background:#fff;
}
.ag-block textarea[data-ag-prompt]{
  min-height:188px;
  padding:18px 20px 28px;
  font-family:inherit;
  font-size:15px;
  line-height:1.65;
  color:#06153a;
}
.ag-forbidden-panel{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
  border:1px solid #ffd5d5;
  border-radius:8px;
  background:#fff8f8;
  color:#bd3434;
  padding:11px 13px;
}
.ag-forbidden-panel b{width:100%;font-size:13px;color:#8f2222}
.ag-forbidden-panel span{
  border-radius:999px;
  background:#fff;
  border:1px solid #ffd5d5;
  color:#bd3434;
  padding:5px 10px;
  font-size:12px;
  font-weight:900;
}
.ag-forbidden-panel small{color:#9a6262;font-weight:800}
.ag-save-ok{
  display:flex;
  align-items:center;
  gap:8px;
  width:max-content;
  max-width:100%;
  border-radius:8px;
  background:#e8f8ed;
  color:#16834f;
  padding:12px 16px;
  font-size:13px;
  font-weight:900;
}
@media(max-width:1440px){
  .agent-tab3{grid-template-columns:250px minmax(540px,1fr);padding-right:438px}
  .agent-preview{width:396px}
}
@media(max-width:1180px){
  .agent-tab3{grid-template-columns:1fr;padding-right:0}
  .agent-preview{position:static;width:auto;min-height:560px;box-shadow:none}
  .ag-preview-open{position:static;margin:0 0 16px auto;display:block}
}

/* «Что сейчас у бота в работе» плашка + dirty-warn + заметка генерации (2026-08-13) */
.ag-live-strip { display:flex; align-items:center; gap:8px; margin:10px 0 4px; padding:8px 12px; border-radius:10px; background:#eef4ff; border:1px solid #d4e2fb; color:#25406e; font-size:13px; font-weight:600; }
.ag-live-strip.none { background:#fff3f3; border-color:#f3cfcf; color:#a4312a; }
.ag-live-dot { width:8px; height:8px; border-radius:50%; background:#c0342b; flex:none; }
.ag-live-dot.on { background:#1f9d55; box-shadow:0 0 0 3px rgba(31,157,85,.18); }
.ag-live-warn { color:#b26a00; }
.ag-gen-note { margin:0 0 12px; font-size:12.5px; color:#8a93ad; }
