/* ИИ-агент workspace: панель под доской, вкладка «Агент» в правой панели, подсветка карточек. */

.ws-agent-panel {
    border: 1px solid #263449;
    background: #0f172a;
    border-radius: 16px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, .18);
    padding: 16px 18px;
    flex-shrink: 0;
}

.ws-agent-panel .agent-messages {
    max-height: 520px;
    min-height: 160px;
}

.ws-dock-tabs button.ws-dock-tab-agent {
    color: #c4b5fd;
}

.ws-dock-tabs button.ws-dock-tab-agent.active {
    background: #2e1065;
    color: #fff;
}

.agent-chat {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
    color: #e5edf8;
}

.agent-chat.is-compact {
    flex: 1;
    height: 100%;
}

.agent-chat.is-compact .agent-messages {
    flex: 1;
    min-height: 0;
}

.agent-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.agent-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.agent-icon {
    color: #a78bfa;
    font-size: 18px;
}

.agent-model {
    font-size: 11px;
    color: #9fb0c7;
    border: 1px solid #334155;
    border-radius: 999px;
    padding: 2px 8px;
}

.agent-head-actions {
    display: flex;
    gap: 10px;
}

.agent-link {
    border: 0;
    background: transparent;
    color: #93c5fd;
    cursor: pointer;
    font-size: 12px;
    padding: 0;
}

.agent-link:disabled {
    color: #475569;
    cursor: default;
}

.agent-warning {
    font-size: 12px;
    border: 1px solid rgba(245, 158, 11, .5);
    background: rgba(245, 158, 11, .1);
    color: #fde68a;
    border-radius: 10px;
    padding: 8px 10px;
}

.agent-warning code {
    color: #fff;
    word-break: break-all;
}

.agent-messages {
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 4px;
}

.agent-empty {
    color: #9fb0c7;
    font-size: 13px;
}

.agent-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.agent-suggestions button {
    border: 1px solid #334155;
    background: #111c30;
    color: #cbd5e1;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 12px;
    cursor: pointer;
    text-align: left;
}

.agent-suggestions button:hover:not(:disabled) {
    border-color: #7c3aed;
    color: #fff;
}

.agent-msg {
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 13px;
    line-height: 1.5;
    max-width: 100%;
    box-sizing: border-box;
}

.agent-msg.role-user {
    align-self: flex-end;
    background: #1e3a8a;
    max-width: 85%;
    white-space: pre-wrap;
}

.agent-msg.role-assistant {
    align-self: stretch;
    background: #111c30;
    border: 1px solid #263449;
}

.agent-msg.is-error {
    border-color: rgba(220, 38, 38, .6);
}

.agent-text p {
    margin: 0 0 6px;
}

.agent-text p:last-child {
    margin-bottom: 0;
}

.agent-text ul {
    margin: 4px 0 8px;
    padding-left: 18px;
}

.agent-text li {
    margin: 2px 0;
}

.agent-note {
    color: #9fb0c7;
    font-style: italic;
}

.agent-ref {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    max-width: min(320px, 100%);
    box-sizing: border-box;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
    margin: 1px 2px;
    padding: 1px 8px;
    border-radius: 999px;
    border: 1px solid #6d28d9;
    background: rgba(124, 58, 237, .18);
    color: #ddd6fe;
    font-size: 12px;
    cursor: pointer;
}

.agent-ref:hover {
    background: rgba(124, 58, 237, .38);
    color: #fff;
}

.agent-ref.off-board {
    border-style: dashed;
}

.agent-ref.is-unknown {
    border-color: #475569;
    background: transparent;
    color: #94a3b8;
}

.agent-ref.ref-c {
    border-color: #ca8a04;
    background: rgba(250, 204, 21, .12);
    color: #fef08a;
}

.agent-activity {
    font-size: 11px;
    color: #8193ab;
    margin-bottom: 6px;
}

.agent-activity summary {
    cursor: pointer;
}

.agent-activity ul {
    margin: 4px 0 0;
    padding-left: 16px;
}

.agent-live-activity {
    font-size: 11px;
    color: #a78bfa;
    margin-bottom: 6px;
}

.agent-typing {
    display: inline-flex;
    gap: 4px;
}

.agent-typing span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #a78bfa;
    animation: agent-typing 1s infinite ease-in-out;
}

.agent-typing span:nth-child(2) { animation-delay: .15s; }
.agent-typing span:nth-child(3) { animation-delay: .3s; }

@keyframes agent-typing {
    0%, 80%, 100% { opacity: .25; transform: translateY(0); }
    40% { opacity: 1; transform: translateY(-3px); }
}

.agent-proposal {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
    padding: 8px 10px;
    border: 1px dashed #7c3aed;
    border-radius: 10px;
    font-size: 12px;
}

.agent-proposal-params,
.agent-proposal-reason {
    color: #9fb0c7;
    word-break: break-all;
}

.agent-proposal button {
    border: 0;
    border-radius: 8px;
    padding: 6px 10px;
    background: #7c3aed;
    color: #fff;
    cursor: pointer;
    white-space: nowrap;
}

.agent-proposal button:disabled {
    background: #334155;
    cursor: default;
}

.agent-input {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.agent-input textarea {
    flex: 1;
    resize: vertical;
    min-height: 44px;
    border: 1px solid #334155;
    border-radius: 12px;
    background: #0b1220;
    color: #e5edf8;
    padding: 10px;
    font: inherit;
    font-size: 13px;
}

.agent-input textarea:focus {
    outline: none;
    border-color: #7c3aed;
}

/* Карточки, на которые указал агент */
.ws-node.is-agent-highlight {
    border-color: #a78bfa !important;
    box-shadow: 0 0 0 3px rgba(167, 139, 250, .75), 0 0 40px rgba(124, 58, 237, .55) !important;
    z-index: 15;
    animation: agent-highlight 1.1s ease-in-out 3;
}

@keyframes agent-highlight {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.03); }
}

/* Режим «Подписка»: агент работает в Claude Code */
.agent-subscription {
    font-size: 12px;
    line-height: 1.5;
    color: #cbd5e1;
    border: 1px solid #6d28d9;
    background: rgba(124, 58, 237, .1);
    border-radius: 10px;
    padding: 10px 12px;
}

.agent-subscription code {
    background: #020617;
    padding: 1px 6px;
    border-radius: 6px;
}

.agent-external {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    color: #c4b5fd;
}

.agent-external span {
    color: #8193ab;
    margin-right: 6px;
}

a.agent-link {
    text-decoration: none;
}

.agent-listener {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    color: #fca5a5;
    margin-bottom: 4px;
}

.agent-listener .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ef4444;
}

.agent-listener.is-online {
    color: #86efac;
}

.agent-listener.is-online .dot {
    background: #22c55e;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, .25);
}
