/* Дополнения к site.css (взят из develop/max-hub) для панели агентов. */
.form-select {
    min-height: 46px;
    padding: 10px 36px 10px 12px;
    border: 1px solid var(--input-border);
    border-radius: 8px;
    color: var(--text);
    background-color: var(--surface);
    font-size: 14px;
}
.form-select:focus {
    color: var(--text);
    background-color: var(--surface);
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.table code { font-size: 13px; }
.table details summary { cursor: pointer; color: var(--text); }
.table details summary::marker { color: var(--muted); }
.card > .card-body + .card-body { border-top: 1px solid var(--border); }
.card .table-responsive { border-radius: 11px 11px 0 0; }
.page-heading h1 { font-size: 30px; letter-spacing: -.8px; font-weight: 700; margin: 0 0 6px; }
.metric strong { font-variant-numeric: tabular-nums; }
.eyebrow { text-transform: uppercase; }
@media (max-width: 767px) {
    .page-heading { flex-direction: column; align-items: stretch; }
    .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .table-responsive { overflow-x: auto; }
}

/* Окно «Инструкция роли»: почти на весь экран, с отступами от краёв */
dialog.prompt-dialog {
    width: min(1180px, 94vw);
    height: min(90vh, 900px);
    max-width: none;
    max-height: none;
    padding: 0;
    border: 1px solid var(--bs-border-color, rgba(128, 128, 128, 0.35));
    border-radius: 14px;
    background: var(--bs-body-bg, #fff);
    color: inherit;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
    overflow: hidden;
}
dialog.prompt-dialog::backdrop {
    background: rgba(12, 14, 20, 0.62);
    backdrop-filter: blur(2px);
}
.prompt-dialog-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}
.prompt-dialog-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.1rem 1.4rem 0.9rem;
    border-bottom: 1px solid var(--bs-border-color, rgba(128, 128, 128, 0.25));
}
.prompt-dialog-head h2 { margin: 0 0 0.15rem; font-size: 1.15rem; }
.prompt-dialog-body {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    padding: 1rem 1.4rem;
}
.prompt-dialog-body textarea.prompt-text {
    flex: 1 1 auto;
    width: 100%;
    height: 100%;
    min-height: 12rem;
    resize: none;
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.84rem;
    line-height: 1.55;
    white-space: pre;
    overflow: auto;
}
.prompt-dialog-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 1.4rem 1.1rem;
    border-top: 1px solid var(--bs-border-color, rgba(128, 128, 128, 0.25));
}
.prompt-dialog-foot .prompt-status { font-size: 0.86rem; }
@media (max-width: 640px) {
    dialog.prompt-dialog { width: 96vw; height: 92vh; }
    .prompt-dialog-head, .prompt-dialog-foot { padding-left: 0.9rem; padding-right: 0.9rem; }
    .prompt-dialog-body { padding: 0.75rem 0.9rem; }
}

/* Лимиты Ollama в карточке метрик */
.metric-quota { gap: 0.35rem; }
.metric-quota .quota-row { display: flex; flex-direction: column; gap: 0.15rem; margin-top: 0.3rem; }
.metric-quota .quota-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 0.76rem;
}
.metric-quota .quota-head strong { font-size: 0.82rem; }
.metric-quota .quota-bar {
    height: 5px;
    border-radius: 999px;
    background: var(--bs-secondary-bg, rgba(128, 128, 128, 0.2));
    overflow: hidden;
}
.metric-quota .quota-fill {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--bs-primary, #0d6efd);
}
.metric-quota .quota-reset { font-size: 0.7rem; line-height: 1.3; opacity: 0.65; }

/* Компактные карточки метрик: те же данные, вдвое меньше места по высоте */
.metrics-grid { gap: 12px; }
.metrics-grid .metric { padding: 12px 14px; }
.metrics-grid .metric-label {
    font-size: 12.5px;
    line-height: 1.3;
    align-items: center;
    min-height: 0;
}
.metrics-grid .metric-icon { width: 24px; height: 24px; border-radius: 6px; }
.metrics-grid .metric-icon .icon { width: 15px; height: 15px; }
.metrics-grid .metric strong { font-size: 21px; line-height: 1.15; margin: 6px 0 3px; }
.metrics-grid .metric > span { font-size: 12px; line-height: 1.35; }

/* Сводка среды: три показателя одной строкой */
.metric-summary .metric-inline {
    display: flex;
    flex-wrap: nowrap;
    align-items: baseline;
    gap: 0 10px;
    margin: 4px 0 5px;
    white-space: nowrap;
    overflow: hidden;
}
.metric-summary .metric-cell {
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
    color: var(--muted);
    font-size: 11.5px;
    line-height: 1.2;
}
.metric-summary .metric-cell + .metric-cell::before {
    content: "·";
    color: var(--muted);
    opacity: 0.6;
    margin-right: 4px;
}
.metrics-grid .metric-summary .metric-cell strong {
    display: inline;
    font-size: 19px;
    line-height: 1;
    margin: 0;
    color: var(--bs-body-color, inherit);
    font-variant-numeric: tabular-nums;
}

/* Кто работает: строка на агента */
.metric-agents .agent-list { display: flex; flex-direction: column; gap: 3px; margin-top: 3px; }
.metric-agents .agent-row { display: flex; align-items: center; gap: 6px; }
.metric-agents .agent-badge {
    font-size: 10.5px;
    font-weight: 600;
    padding: 2px 6px;
    letter-spacing: 0.02em;
}
.metric-agents .agent-task {
    font-size: 12.5px;
    font-weight: 600;
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Что делают: мелкий шрифт, побольше строк */
.metric-feed .agent-feed { display: flex; flex-direction: column; gap: 5px; margin-top: 3px; }
.metric-feed .feed-row { display: flex; flex-direction: column; gap: 2px; }
.metric-feed .feed-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 6px;
    font-size: 10.5px;
    line-height: 1.25;
}
.metric-feed .feed-who {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.metric-feed .feed-stage { color: var(--accent); white-space: nowrap; }
.metric-feed .agent-bar {
    height: 3px;
    border-radius: 999px;
    background: var(--bs-secondary-bg, rgba(128, 128, 128, 0.2));
    overflow: hidden;
}
.metric-feed .agent-fill {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--bs-primary, #0d6efd);
    transition: width 0.4s ease;
}
.metric-feed .feed-meta { font-size: 10px; line-height: 1.25; color: var(--muted); opacity: 0.75; }
.agent-idle { font-size: 12px; color: var(--muted); }
