/*
 * Агенты человека: лицо агента, выбор агента, «Мои агенты», профиль и окно создания.
 * Цвет агента принадлежит агенту (кольцо, плашка), лавандовый акцент — приложению (кнопки, выделение).
 */

/* ---------- цвета агентов ---------- */

.hermes-dashboard {
    --agent-face-xs: 1.25rem;
    --agent-face-message: 1.75rem;
    --agent-face-header: 2rem;
    --agent-face-picker: 2.5rem;
    --agent-face-card: 3.5rem;
    --agent-face-hero: 4.5rem;
    --agent-face-profile: 6rem;
}

.hermes-dashboard .agent-hue--blue { --agent-hue: #4f7cf0; --agent-hue-2: #8fb0ff; --agent-tint: rgb(79 124 240 / 0.16); }
.hermes-dashboard .agent-hue--green { --agent-hue: #23a36b; --agent-hue-2: #7fdcb0; --agent-tint: rgb(35 163 107 / 0.16); }
.hermes-dashboard .agent-hue--violet { --agent-hue: #8a5cf0; --agent-hue-2: #c2a8ff; --agent-tint: rgb(138 92 240 / 0.16); }
.hermes-dashboard .agent-hue--orange { --agent-hue: #e07a1f; --agent-hue-2: #ffc07f; --agent-tint: rgb(224 122 31 / 0.16); }
.hermes-dashboard .agent-hue--rose { --agent-hue: #e04679; --agent-hue-2: #ff9fbf; --agent-tint: rgb(224 70 121 / 0.16); }
.hermes-dashboard .agent-hue--slate { --agent-hue: #6b7891; --agent-hue-2: #b3bdd0; --agent-tint: rgb(107 120 145 / 0.18); }

:root[data-hermes-theme="light"] .hermes-dashboard .agent-hue--blue { --agent-hue: #2a5bd7; --agent-hue-2: #6f93ef; }
:root[data-hermes-theme="light"] .hermes-dashboard .agent-hue--green { --agent-hue: #13704a; --agent-hue-2: #3fae7c; }
:root[data-hermes-theme="light"] .hermes-dashboard .agent-hue--violet { --agent-hue: #6a3fd1; --agent-hue-2: #9a78ea; }
:root[data-hermes-theme="light"] .hermes-dashboard .agent-hue--orange { --agent-hue: #a8500c; --agent-hue-2: #de8a3c; }
:root[data-hermes-theme="light"] .hermes-dashboard .agent-hue--rose { --agent-hue: #c22a5f; --agent-hue-2: #e8709a; }
:root[data-hermes-theme="light"] .hermes-dashboard .agent-hue--slate { --agent-hue: #3b4658; --agent-hue-2: #7a879e; }

/* ---------- лицо агента: круг в кольце из двух дуг (крылья знака Гермеса) ---------- */

.hermes-dashboard .agent-face {
    --face: var(--agent-face-picker);
    position: relative;
    display: inline-grid;
    flex: 0 0 auto;
    place-items: center;
    width: var(--face);
    height: var(--face);
}

.hermes-dashboard .agent-face--xs { --face: var(--agent-face-xs); }
.hermes-dashboard .agent-face--message { --face: var(--agent-face-message); }
.hermes-dashboard .agent-face--header { --face: var(--agent-face-header); }
.hermes-dashboard .agent-face--picker { --face: var(--agent-face-picker); }
.hermes-dashboard .agent-face--card { --face: var(--agent-face-card); }
.hermes-dashboard .agent-face--hero { --face: var(--agent-face-hero); }
.hermes-dashboard .agent-face--profile { --face: var(--agent-face-profile); }

.hermes-dashboard .agent-face__ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    /* Две дуги с просветами сверху-справа и снизу-слева — как раскрытые крылья. */
    background: conic-gradient(from 20deg, var(--agent-hue) 0deg 140deg, transparent 140deg 180deg, var(--agent-hue-2) 180deg 320deg, transparent 320deg 360deg);
    -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - max(2px, calc(var(--face) * 0.06))), #000 calc(100% - max(2px, calc(var(--face) * 0.06)) + 0.5px));
    mask: radial-gradient(farthest-side, transparent calc(100% - max(2px, calc(var(--face) * 0.06))), #000 calc(100% - max(2px, calc(var(--face) * 0.06)) + 0.5px));
}

.hermes-dashboard .agent-face--xs .agent-face__ring {
    display: none;
}

.hermes-dashboard .agent-face__core {
    position: absolute;
    inset: max(3px, calc(var(--face) * 0.1));
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: 50%;
    color: var(--agent-hue);
    background: var(--agent-tint);
    font-size: calc(var(--face) * 0.42);
    font-weight: 700;
    line-height: 1;
}

.hermes-dashboard .agent-face--xs .agent-face__core {
    inset: 0;
}

.hermes-dashboard .agent-face__core img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hermes-dashboard .agent-face__emoji {
    font-size: calc(var(--face) * 0.4);
}

.hermes-dashboard .agent-face__letter {
    font-size: calc(var(--face) * 0.36);
}

.hermes-dashboard .agent-face__mark {
    width: 62%;
    height: 62%;
    fill: currentColor;
}

/* Агент отвечает: кольцо медленно поворачивается и дышит. */
.hermes-dashboard .agent-face--busy .agent-face__ring {
    animation: agent-face-breathe 2.4s ease-in-out infinite;
}

@keyframes agent-face-breathe {
    0% { transform: rotate(0deg) scale(1); opacity: 1; }
    50% { transform: rotate(180deg) scale(1.06); opacity: 0.7; }
    100% { transform: rotate(360deg) scale(1); opacity: 1; }
}

/* ---------- агент в боковой панели ---------- */

.hermes-dashboard .agent-switcher {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    width: 100%;
    min-height: 3rem;
    margin: 0 0 0.5rem;
    padding: 0.375rem 0.5rem;
    border: 1px solid var(--hermes-line);
    border-radius: 0.75rem;
    color: var(--hermes-text);
    background: transparent;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.hermes-dashboard .agent-switcher:hover {
    background: var(--hermes-hover);
}

.hermes-dashboard .agent-switcher[aria-expanded="true"] {
    background: var(--hermes-active);
}

.hermes-dashboard .agent-switcher__text,
.hermes-dashboard .agent-chip__text,
.hermes-dashboard .agent-picker__text,
.hermes-dashboard .agent-card__text {
    display: grid;
    flex: 1 1 auto;
    min-width: 0;
}

.hermes-dashboard .agent-switcher__text strong,
.hermes-dashboard .agent-switcher__text small,
.hermes-dashboard .agent-chip__text strong,
.hermes-dashboard .agent-chip__text small,
.hermes-dashboard .agent-picker__text strong,
.hermes-dashboard .agent-picker__text small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hermes-dashboard .agent-switcher__text strong,
.hermes-dashboard .agent-chip__text strong,
.hermes-dashboard .agent-picker__text strong {
    font-size: 0.875rem;
    font-weight: 650;
}

.hermes-dashboard .agent-switcher__text small,
.hermes-dashboard .agent-chip__text small,
.hermes-dashboard .agent-picker__text small {
    color: var(--hermes-muted);
    font-size: 0.75rem;
    line-height: 1.35;
}

.hermes-dashboard .agent-switcher__chevron,
.hermes-dashboard .agent-chip__chevron,
.hermes-dashboard .agent-picker__check,
.hermes-dashboard .agents-panel svg,
.hermes-dashboard .agent-picker svg:not(.agent-face__mark) {
    flex: 0 0 auto;
    width: 1rem;
    height: 1rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.hermes-dashboard .agents-panel .agent-face__mark,
.hermes-dashboard .agent-picker .agent-face__mark {
    width: 62%;
    height: 62%;
    fill: currentColor;
    stroke: none;
}

/* ---------- агент в шапке чата ---------- */

.hermes-dashboard .agent-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
    max-width: min(22rem, 100%);
    min-height: 2.75rem;
    padding: 0.25rem 0.625rem 0.25rem 0.25rem;
    border: 0;
    border-radius: 999px;
    color: var(--hermes-text);
    background: transparent;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.hermes-dashboard .agent-chip:hover:not(:disabled),
.hermes-dashboard .agent-chip[aria-expanded="true"] {
    background: var(--hermes-hover);
}

.hermes-dashboard .agent-chip:disabled {
    cursor: default;
}

/* ---------- выбор агента ---------- */

.hermes-dashboard .agent-picker-backdrop {
    position: fixed;
    inset: 0;
    z-index: 65;
    background: transparent;
}

.hermes-dashboard .agent-picker {
    position: fixed;
    top: 3.5rem;
    left: calc(var(--hermes-sidebar-width) + 1rem);
    display: grid;
    gap: 0.25rem;
    width: min(23rem, calc(100vw - 2rem));
    max-height: min(34rem, calc(100dvh - 5rem));
    padding: 0.5rem;
    overflow: hidden;
    border: 1px solid var(--hermes-line);
    border-radius: 1rem;
    color: var(--hermes-text);
    background: var(--hermes-panel-raised);
    box-shadow: 0 1.25rem 3rem rgb(var(--hermes-shadow-rgb) / 0.32);
    animation: agent-picker-in 140ms ease-out;
}

.hermes-dashboard .agent-picker--from-sidebar {
    top: 4.25rem;
    left: 0.75rem;
}

@keyframes agent-picker-in {
    from { opacity: 0; transform: translateY(-0.25rem); }
}

.hermes-dashboard .agent-picker__grip {
    display: none;
}

.hermes-dashboard .agent-picker__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.125rem 0.25rem 0.25rem 0.5rem;
}

.hermes-dashboard .agent-picker__header h2 {
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 650;
}

.hermes-dashboard .agent-picker__list {
    display: grid;
    gap: 0.125rem;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    list-style: none;
}

.hermes-dashboard .agent-picker__row {
    display: flex;
    align-items: center;
    gap: 0.125rem;
}

.hermes-dashboard .agent-picker__agent,
.hermes-dashboard .agent-picker__create {
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
    min-height: 4rem;
    padding: 0.5rem;
    border: 0;
    border-radius: 0.75rem;
    color: var(--hermes-text);
    background: transparent;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.hermes-dashboard .agent-picker__agent:hover:not(:disabled),
.hermes-dashboard .agent-picker__create:hover:not(:disabled) {
    background: var(--hermes-hover);
}

.hermes-dashboard .agent-picker__agent--active {
    background: var(--hermes-active);
}

.hermes-dashboard .agent-picker__agent:disabled,
.hermes-dashboard .agent-picker__create:disabled {
    cursor: default;
    opacity: 0.65;
}

.hermes-dashboard .agent-picker__check {
    color: var(--hermes-accent-hi);
}

.hermes-dashboard .agent-picker__more {
    flex: 0 0 auto;
}

.hermes-dashboard .agent-picker__footer {
    display: grid;
    gap: 0.25rem;
    padding-top: 0.25rem;
    border-top: 1px solid var(--hermes-line);
}

.hermes-dashboard .agent-picker__plus,
.hermes-dashboard .agent-card__plus {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    width: var(--agent-face-picker);
    height: var(--agent-face-picker);
    border: 1.5px dashed var(--hermes-line-strong);
    border-radius: 50%;
    color: var(--hermes-muted);
}

.hermes-dashboard .agent-picker__all {
    justify-self: stretch;
}

.hermes-dashboard .agent-picker__note {
    margin: 0;
    padding: 0.5rem;
    color: var(--hermes-muted);
    font-size: 0.8125rem;
}

.hermes-dashboard .agent-picker__retry {
    padding: 0;
    border: 0;
    color: var(--hermes-accent-hi);
    background: none;
    font: inherit;
    text-decoration: underline;
    cursor: pointer;
}

/* ---------- сообщение о создании ---------- */

.hermes-dashboard .agent-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.hermes-dashboard .agent-banner__actions {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 0.25rem;
}

/* ---------- «Мои агенты» ---------- */

.hermes-dashboard .agents-panel {
    width: min(100%, 60rem);
    margin: 0 auto;
    padding: 1.5rem 1.25rem 3rem;
}

.hermes-dashboard .agents-panel__header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.hermes-dashboard .agents-panel__header h1,
.hermes-dashboard .agent-profile h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
}

.hermes-dashboard .agents-panel__header .button {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

.hermes-dashboard .agents-panel__slots,
.hermes-dashboard .agents-panel__blocked {
    margin: 0.25rem 0 0;
    color: var(--hermes-muted);
    font-size: 0.875rem;
}

.hermes-dashboard .agents-panel__blocked {
    margin-bottom: 1rem;
}

.hermes-dashboard .agents-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(15.5rem, 1fr));
    gap: 0.875rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.hermes-dashboard .agent-card {
    position: relative;
    display: grid;
    grid-template-rows: auto 1fr auto;
    gap: 0.75rem;
    padding: 1rem;
    overflow: hidden;
    border: 1px solid var(--hermes-line);
    border-radius: 1rem;
    background: var(--hermes-panel-soft);
}

/* Цвет агента — тонкой полосой сверху, без заливки всей карточки. */
.hermes-dashboard .agent-card::before {
    position: absolute;
    inset: 0 0 auto;
    height: 3px;
    background: linear-gradient(90deg, var(--agent-hue), var(--agent-hue-2));
    content: "";
}

.hermes-dashboard .agent-card--current {
    border-color: var(--hermes-line-strong);
}

.hermes-dashboard .agent-card--new {
    place-content: center;
    border-style: dashed;
    background: transparent;
}

.hermes-dashboard .agent-card--new::before {
    display: none;
}

.hermes-dashboard .agent-card__open {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    min-width: 0;
    padding: 0;
    border: 0;
    color: var(--hermes-text);
    background: none;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.hermes-dashboard .agent-card__open:disabled {
    cursor: default;
}

.hermes-dashboard .agent-card__text strong {
    overflow: hidden;
    font-size: 1rem;
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hermes-dashboard .agent-card__text small {
    display: -webkit-box;
    overflow: hidden;
    color: var(--hermes-muted);
    font-size: 0.8125rem;
    line-height: 1.4;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.hermes-dashboard .agent-card__meta,
.hermes-dashboard .agent-profile__status {
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 0.375rem;
}

.hermes-dashboard .agent-chip-tag {
    display: inline-flex;
    align-items: center;
    min-height: 1.5rem;
    padding: 0.125rem 0.5rem;
    border-radius: 999px;
    color: var(--hermes-muted);
    background: var(--hermes-hover);
    font-size: 0.75rem;
    font-weight: 600;
}

.hermes-dashboard .agent-chip-tag--accent {
    color: var(--hermes-accent-ink);
    background: var(--hermes-accent);
}

.hermes-dashboard .agent-chip-tag--warning {
    color: var(--hermes-warn-ink);
    background: rgb(var(--hermes-warn-rgb) / 0.16);
}

.hermes-dashboard .agent-card__write {
    justify-self: start;
}

/* ---------- профиль агента ---------- */

.hermes-dashboard .agents-panel__bar {
    margin-bottom: 0.75rem;
}

.hermes-dashboard .agents-panel__back {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.hermes-dashboard .agent-profile {
    display: grid;
    gap: 1.5rem;
    width: min(100%, 40rem);
    margin: 0 auto;
}

.hermes-dashboard .agent-profile__hero {
    display: grid;
    justify-items: center;
    gap: 0.75rem;
    text-align: center;
}

.hermes-dashboard .agent-profile__status {
    justify-content: center;
    margin: 0;
}

.hermes-dashboard .agent-profile__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
}

.hermes-dashboard .agent-profile__section h2 {
    margin: 0 0 0.5rem;
    color: var(--hermes-muted);
    font-size: 0.8125rem;
    font-weight: 650;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.hermes-dashboard .agent-profile__instructions {
    margin: 0;
    padding: 1rem;
    border: 1px solid var(--hermes-line);
    border-radius: 0.75rem;
    background: var(--hermes-panel-soft);
    font-size: 0.9375rem;
    line-height: 1.55;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.hermes-dashboard .agent-profile__empty {
    margin: 0;
    color: var(--hermes-muted);
}

.hermes-dashboard .agent-profile__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin: 0;
}

.hermes-dashboard .agent-profile__links {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
    gap: 0.5rem;
}

.hermes-dashboard .agent-profile__link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 3rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--hermes-line);
    border-radius: 0.75rem;
    color: var(--hermes-text);
    background: transparent;
    font: inherit;
    font-size: 0.875rem;
    text-align: left;
    cursor: pointer;
}

.hermes-dashboard .agent-profile__link:hover {
    background: var(--hermes-hover);
}

.hermes-dashboard .agent-profile__delete {
    justify-self: center;
}

/* ---------- окно создания и правки ---------- */

.hermes-dashboard .agent-start {
    display: grid;
    gap: 1.25rem;
}

.hermes-dashboard .agent-start__describe {
    display: grid;
    gap: 0.625rem;
}

.hermes-dashboard .agent-start__describe label,
.hermes-dashboard .agent-start__ideas p {
    margin: 0;
    color: var(--hermes-muted);
    font-size: 0.875rem;
    font-weight: 600;
}

.hermes-dashboard .agent-start__describe .button {
    justify-self: start;
}

.hermes-dashboard .agent-start__ideas {
    display: grid;
    gap: 0.625rem;
}

.hermes-dashboard .agent-start__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.hermes-dashboard .agent-idea {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    min-height: 2.5rem;
    padding: 0.375rem 0.875rem 0.375rem 0.625rem;
    border: 1px solid var(--hermes-line);
    border-radius: 999px;
    color: var(--hermes-text);
    background: var(--agent-tint);
    font: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
}

.hermes-dashboard .agent-idea:hover:not(:disabled) {
    border-color: var(--agent-hue);
}

.hermes-dashboard .agent-start__manual {
    justify-self: start;
}

.hermes-dashboard .agent-dialog__identity {
    display: grid;
    justify-items: center;
}

.hermes-dashboard .agent-dialog__photo {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.hermes-dashboard .agent-dialog__photo-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.hermes-dashboard .agent-crop {
    display: grid;
    justify-items: center;
    gap: 0.625rem;
    width: 100%;
}

.hermes-dashboard .agent-crop__canvas {
    width: min(16rem, 70vw);
    aspect-ratio: 1;
    border-radius: 50%;
    background: var(--hermes-panel-strong);
    box-shadow: 0 0 0 1px var(--hermes-line);
    cursor: grab;
    touch-action: none;
}

.hermes-dashboard .agent-crop__canvas:active {
    cursor: grabbing;
}

.hermes-dashboard .agent-crop__zoom {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: min(16rem, 70vw);
    color: var(--hermes-muted);
    font-size: 0.8125rem;
}

.hermes-dashboard .agent-crop__zoom input {
    flex: 1 1 auto;
    accent-color: var(--hermes-accent);
}

.hermes-dashboard .agent-crop__actions {
    display: flex;
    gap: 0.5rem;
}

.hermes-dashboard .agent-dialog__look summary {
    color: var(--hermes-muted);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
}

.hermes-dashboard .agent-dialog__look[open] summary {
    margin-bottom: 0.625rem;
}

.hermes-dashboard .agent-dialog__colors {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.625rem;
}

.hermes-dashboard .agent-swatch {
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: 2px solid transparent;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--agent-hue), var(--agent-hue-2));
    cursor: pointer;
}

.hermes-dashboard .agent-swatch--active {
    box-shadow: 0 0 0 2px var(--hermes-panel), 0 0 0 4px var(--agent-hue);
}

.hermes-dashboard .agent-dialog__danger {
    padding-top: 0.75rem;
    border-top: 1px solid var(--hermes-line);
}

.hermes-dashboard .agent-dialog__danger-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.hermes-dashboard .agent-dialog__delete {
    justify-self: start;
    color: var(--hermes-danger-ink);
}

.hermes-dashboard .agent-options {
    display: grid;
    gap: 0.375rem;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.hermes-dashboard .agent-options legend {
    padding: 0;
    margin-bottom: 0.375rem;
    color: var(--hermes-muted);
    font-size: 0.8125rem;
    font-weight: 600;
}

.hermes-dashboard .agent-option {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    padding: 0.5rem 0.625rem;
    border: 1px solid var(--hermes-line);
    border-radius: 0.625rem;
    cursor: pointer;
}

/* Поля окна растягиваются на всю ширину (.project-dialog input) — переключателю это не нужно. */
.hermes-dashboard .agent-option input[type="checkbox"] {
    flex: none;
    width: 1rem;
    height: 1rem;
    min-height: 0;
    margin: 0.125rem 0 0;
    padding: 0;
    accent-color: var(--hermes-accent);
}

.hermes-dashboard .agent-option span {
    display: grid;
    min-width: 0;
}

.hermes-dashboard .agent-option small {
    color: var(--hermes-muted);
    font-size: 0.8125rem;
}

.hermes-dashboard .agent-skills {
    display: grid;
    gap: 0.375rem;
    max-height: 12rem;
    overflow-y: auto;
}

.hermes-dashboard .agent-skills__search {
    width: 100%;
}

/* ---------- телефон ---------- */

@media (max-width: 760px) {
    .hermes-dashboard .agent-switcher {
        min-height: 3.25rem;
    }

    .hermes-dashboard .agent-chip {
        max-width: 100%;
        margin-inline: auto;
    }

    /* Выбор агента — шторка снизу. */
    .hermes-dashboard .agent-picker-backdrop {
        background: var(--hermes-scrim);
        animation: hermes-fade-in 140ms ease-out;
    }

    .hermes-dashboard .agent-picker,
    .hermes-dashboard .agent-picker--from-sidebar {
        top: auto;
        right: 0;
        bottom: 0;
        left: 0;
        width: 100%;
        max-height: 85dvh;
        padding: 0.5rem 0.75rem calc(0.75rem + env(safe-area-inset-bottom));
        border-width: 1px 0 0;
        border-radius: 1.25rem 1.25rem 0 0;
        animation: agent-sheet-in 200ms cubic-bezier(0.2, 0.8, 0.2, 1);
    }

    .hermes-dashboard .agent-picker__grip {
        display: block;
        justify-self: center;
        width: 2.5rem;
        height: 0.25rem;
        margin-bottom: 0.25rem;
        border-radius: 999px;
        background: var(--hermes-line-strong);
    }

    .hermes-dashboard .agent-picker__more {
        width: 2.75rem;
        height: 2.75rem;
    }

    .hermes-dashboard .agents-panel {
        padding: 1rem 1rem 2.5rem;
    }

    .hermes-dashboard .agents-gallery {
        grid-template-columns: 1fr;
    }

    .hermes-dashboard .agents-panel__header .button {
        width: 100%;
        justify-content: center;
    }

    .hermes-dashboard .agent-dialog__photo {
        flex-direction: column;
    }
}

@keyframes agent-sheet-in {
    from { transform: translateY(100%); }
}

@media (prefers-reduced-motion: reduce) {
    .hermes-dashboard .agent-face--busy .agent-face__ring,
    .hermes-dashboard .agent-picker,
    .hermes-dashboard .agent-picker-backdrop {
        animation: none;
    }
}

/* ---------- агент в чате ---------- */

.hermes-dashboard .chat-intro__agent {
    display: grid;
    justify-items: center;
    margin-bottom: 0.75rem;
}

.hermes-dashboard .message-author {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.5rem 0 -0.25rem;
    color: var(--hermes-muted);
    font-size: 0.8125rem;
    font-weight: 650;
}

.hermes-dashboard .templates-avatar-toggle {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    min-height: 2.75rem;
    font-size: 0.875rem;
    cursor: pointer;
}

.hermes-dashboard .templates-avatar-toggle input {
    flex: 0 0 auto;
    width: 1.125rem;
    height: 1.125rem;
    margin: 0;
    accent-color: var(--hermes-accent);
}

/* ---------- общие чаты ---------- */

.hermes-dashboard .group-panel {
    display: flex;
    flex-direction: column;
    width: min(100%, 52rem);
    min-height: 100%;
    margin: 0 auto;
    padding: 1.5rem 1.25rem 0;
}

.hermes-dashboard .group-panel svg:not(.agent-face__mark) {
    width: 1rem;
    height: 1rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.hermes-dashboard .group-panel .agents-panel__header .button {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

.hermes-dashboard .group-faces {
    display: inline-flex;
    flex: 0 0 auto;
}

.hermes-dashboard .group-faces > .agent-face + .agent-face {
    margin-left: calc(var(--face) * -0.32);
}

.hermes-dashboard .group-faces > .agent-face .agent-face__core {
    box-shadow: 0 0 0 2px var(--hermes-panel);
}

.hermes-dashboard .group-list {
    display: grid;
    gap: 0.5rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.hermes-dashboard .group-list__item {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    width: 100%;
    min-height: 4rem;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--hermes-line);
    border-radius: 0.875rem;
    color: var(--hermes-text);
    background: var(--hermes-panel-soft);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.hermes-dashboard .group-list__item:hover {
    background: var(--hermes-hover);
}

.hermes-dashboard .group-panel__bar {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.25rem 0 0.75rem;
    border-bottom: 1px solid var(--hermes-line);
    background: var(--hermes-panel);
}

.hermes-dashboard .group-panel__heading {
    display: grid;
    flex: 1 1 auto;
    min-width: 0;
}

.hermes-dashboard .group-panel__heading strong,
.hermes-dashboard .group-panel__heading small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hermes-dashboard .group-panel__heading small {
    color: var(--hermes-muted);
    font-size: 0.75rem;
}

.hermes-dashboard .group-feed {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem 0;
}

.hermes-dashboard .group-feed__older {
    align-self: center;
}

.hermes-dashboard .group-feed__empty {
    display: grid;
    justify-items: center;
    gap: 1rem;
    margin: 3rem auto;
    max-width: 30rem;
    color: var(--hermes-muted);
    text-align: center;
}

.hermes-dashboard .group-feed__notice {
    align-self: center;
    margin: 0;
    color: var(--hermes-muted);
    font-size: 0.8125rem;
    text-align: center;
}

.hermes-dashboard .group-feed__state {
    margin: 0.25rem 0 0;
    color: var(--hermes-muted);
    font-size: 0.8125rem;
}

.hermes-dashboard .group-feed__state--failed {
    color: var(--hermes-warn-ink);
}

.hermes-dashboard .group-feed__typing small {
    font-weight: 500;
}

.hermes-dashboard .group-feed__agent--live {
    opacity: 0.85;
}

.hermes-dashboard .group-composer {
    position: sticky;
    bottom: 0;
    display: grid;
    gap: 0.5rem;
    padding: 0.75rem 0 calc(1rem + env(safe-area-inset-bottom));
    background: var(--hermes-panel);
}

.hermes-dashboard .group-composer__to {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.375rem;
    color: var(--hermes-muted);
    font-size: 0.8125rem;
}

.hermes-dashboard .group-target {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    min-height: 2rem;
    padding: 0.25rem 0.625rem 0.25rem 0.3125rem;
    border: 1px solid var(--hermes-line);
    border-radius: 999px;
    color: var(--hermes-text);
    background: transparent;
    font: inherit;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
}

.hermes-dashboard .group-target--on {
    border-color: var(--agent-hue);
    background: var(--agent-tint);
}

.hermes-dashboard .group-target small {
    display: inline-grid;
    place-items: center;
    width: 1.125rem;
    height: 1.125rem;
    border-radius: 50%;
    color: #fff;
    background: var(--agent-hue);
    font-size: 0.6875rem;
}

.hermes-dashboard .group-target--all {
    padding-left: 0.625rem;
    color: var(--hermes-muted);
}

/* Поле ввода — тот же composer-shell, что у основного чата (hermes-shell.css); здесь только вписываем его в панель. */
.hermes-dashboard .group-composer .composer-shell {
    grid-row: auto;
    width: 100%;
    margin: 0;
    padding: 0;
}

.hermes-dashboard .group-composer.chat-main--drop-active .composer-shell__surface {
    border-style: dashed;
    border-color: rgb(var(--hermes-accent-rgb) / 0.6);
}

.hermes-dashboard .group-feed__files {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.hermes-dashboard .group-feed__files:not(:first-child) {
    margin-top: 0.5rem;
}

.hermes-dashboard .group-pick {
    display: grid;
    gap: 0.25rem;
    margin: 0;
    padding: 0;
    border: 0;
}

.hermes-dashboard .group-pick legend {
    margin-bottom: 0.375rem;
    color: var(--hermes-muted);
    font-size: 0.875rem;
    font-weight: 600;
}

.hermes-dashboard .group-pick__row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 3.5rem;
    padding: 0.375rem 0.5rem;
    border-radius: 0.75rem;
    cursor: pointer;
}

.hermes-dashboard .group-pick__row:hover,
.hermes-dashboard .group-pick__row--on {
    background: var(--hermes-hover);
}

.hermes-dashboard .group-pick__row input {
    flex: 0 0 auto;
    width: 1.125rem;
    height: 1.125rem;
    margin: 0;
    accent-color: var(--hermes-accent);
}

.hermes-dashboard .group-pick__order {
    display: inline-grid;
    flex: 0 0 auto;
    place-items: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    color: var(--hermes-accent-ink);
    background: var(--hermes-accent);
    font-size: 0.75rem;
    font-weight: 700;
}

@media (max-width: 760px) {
    .hermes-dashboard .group-panel {
        padding: 0.75rem 1rem 0;
    }

    .hermes-dashboard .group-panel__bar .button {
        padding-inline: 0.625rem;
    }
}

.hermes-dashboard .group-composer__to {
    margin: 0;
    padding: 0;
    border: 0;
}

.hermes-dashboard .group-composer__to legend {
    float: left;
    margin-right: 0.25rem;
    padding: 0;
}
