/* Flusso dei messaggi degli agenti (home) e pagina Agenti - vedi
   public/js/components/agent-feed.js e agents-board.js. */
.agent-feed__header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.agent-feed__header > div:first-child {
    flex: 1;
    min-width: 0;
}

.agent-feed__eyebrow {
    display: block;
    font-family: var(--font-body);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.13em;
    text-transform: uppercase;
    color: rgba(18, 51, 63, 0.63);
}

.agent-feed__title {
    margin: 4px 0 0;
    font-size: 18px;
}

.agent-feed__count {
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--color-accent);
    color: var(--color-petrol);
    font-size: 11.5px;
    font-weight: 600;
}

.agent-feed__count[hidden] {
    display: none;
}

.agent-feed__list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.agent-feed__empty,
.agent-feed__demo,
.agents-board__demo {
    margin: 0;
    font-size: 12.5px;
    color: rgba(18, 51, 63, 0.55);
}

.agent-feed__demo {
    margin-top: 14px;
}

.agent-msg {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.agent-msg__avatar {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
}

.agent-msg__avatar svg,
.agent-card__avatar svg {
    display: block;
}

.agent-msg__main {
    flex: 1;
    min-width: 0;
}

.agent-msg__head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 8px;
    margin-bottom: 4px;
}

.agent-msg__name {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 14px;
    color: var(--color-petrol);
}

.agent-msg__role,
.agent-msg__time {
    font-size: 12px;
    color: rgba(18, 51, 63, 0.55);
}

.agent-msg__time {
    margin-left: auto;
}

.agent-msg__bubble {
    padding: 11px 14px;
    border-radius: 4px var(--radius-lg) var(--radius-lg) var(--radius-lg);
    background: rgba(18, 51, 63, 0.05);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.agent-msg.is-done .agent-msg__bubble {
    background: rgba(79, 123, 92, 0.1);
}

.agent-msg__text {
    margin: 0;
    font-size: 14px;
    line-height: 1.55;
    color: var(--color-petrol);
}

.agent-msg__draft {
    margin: 0;
    padding: 9px 12px;
    border-left: 3px solid var(--color-lilac);
    background: var(--color-panel);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    font-size: 13px;
    line-height: 1.5;
    white-space: pre-line;
    color: rgba(18, 51, 63, 0.78);
}

.agent-msg__result {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    font-weight: 600;
    color: #3d6b4f;
}

.agent-msg__result .icon {
    display: inline-flex;
    width: 16px;
}

.agent-msg__result svg {
    width: 100%;
    height: 100%;
}

.agent-msg__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* --- Pagina Agenti --- */
.agents-board {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.agents-board__intro {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.agents-board__title {
    margin: 0;
    font-size: 20px;
}

.agents-board__sub {
    margin: 4px 0 0;
    max-width: 560px;
    font-size: 13.5px;
    line-height: 1.55;
    color: rgba(18, 51, 63, 0.66);
}

.agents-board__tools {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}

.agents-board__note {
    font-size: 12px;
    color: var(--color-moss);
}

.agents-board__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.agent-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.agent-card.is-off {
    opacity: 0.6;
}

.agent-card__head {
    display: flex;
    align-items: center;
    gap: 12px;
}

.agent-card__avatar {
    flex: 0 0 auto;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    overflow: hidden;
}

.agent-card__who {
    flex: 1;
    min-width: 0;
}

.agent-card__name {
    margin: 0;
    font-size: 17px;
}

.agent-card__role {
    font-size: 12.5px;
    color: rgba(18, 51, 63, 0.6);
}

.agent-card__bio {
    margin: 6px 0 4px;
    font-size: 13px;
    line-height: 1.5;
    color: rgba(18, 51, 63, 0.72);
}

.agent-card__label {
    margin-top: 8px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(18, 51, 63, 0.55);
}

.agent-card__select {
    height: 38px;
    font-size: 13.5px;
}

.agent-card__segs {
    display: flex;
    gap: 4px;
    padding: 3px;
    border-radius: var(--radius-md);
    background: rgba(18, 51, 63, 0.06);
}

.agent-card__seg {
    flex: 1;
    border: none;
    background: transparent;
    padding: 7px 4px;
    border-radius: var(--radius-sm);
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 11.5px;
    color: rgba(18, 51, 63, 0.62);
    cursor: pointer;
}

.agent-card__seg.is-active {
    background: var(--color-panel);
    color: var(--color-petrol);
    box-shadow: 0 1px 3px rgba(18, 51, 63, 0.15);
}

.agent-card__hint {
    margin: 2px 0 0;
    font-size: 12.5px;
    color: rgba(18, 51, 63, 0.58);
}

.agent-card__rule {
    font-size: 13px;
    font-family: var(--font-body);
}

.agent-card__foot {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
}

.agent-card__status {
    font-size: 12px;
    color: var(--color-moss);
}

.agent-card__run-result {
    min-height: 0;
    font-size: 12.5px;
    color: rgba(18, 51, 63, 0.7);
}

.agent-card__run-result:empty {
    display: none;
}

/* Home: flusso compatto a righe (stile "Da approvare" del design) e, a
   destra, gli agenti al lavoro - meta' dello spazio dei fumetti di prima. */
.agent-feed__body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
@media (min-width: 1100px) {
    .agent-feed__body { grid-template-columns: minmax(0, 1.75fr) minmax(260px, 1fr); }
}
.agent-feed .agent-feed__list { gap: 8px; }

.agent-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid rgba(18, 51, 63, 0.08);
}
.agent-row.is-done { background: rgba(79, 123, 92, 0.08); }
.agent-row__avatar { flex: 0 0 36px; width: 36px; height: 36px; border-radius: 50%; overflow: hidden; align-self: flex-start; }
.agent-row__avatar svg { display: block; }
.agent-row__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.agent-row__head { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.agent-row__name { font-family: var(--font-heading); font-weight: 600; font-size: 13.5px; color: var(--color-petrol); }
.agent-row__role { padding: 1px 7px; border-radius: 999px; background: rgba(18, 51, 63, 0.06); font-size: 11px; color: rgba(18, 51, 63, 0.62); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agent-row__time { margin-left: auto; font-size: 11.5px; color: rgba(18, 51, 63, 0.5); white-space: nowrap; }
.agent-row__text {
    margin: 0;
    font-size: 13px;
    line-height: 1.45;
    color: rgba(18, 51, 63, 0.82);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.agent-row .agent-msg__draft { margin-top: 6px; }
.agent-row .agent-msg__draft[hidden] { display: none; }
.agent-row .agent-msg__result { margin-top: 4px; }
.agent-row__actions { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; }
.agent-row__dismiss {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: rgba(18, 51, 63, 0.45);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}
.agent-row__dismiss:hover { background: rgba(18, 51, 63, 0.07); color: var(--color-petrol); }
@media (max-width: 640px) {
    .agent-row { flex-wrap: wrap; }
    .agent-row__actions { width: 100%; justify-content: flex-end; }
}

.agent-team {
    padding: 14px 14px 6px;
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.55);
    border: 1px solid rgba(18, 51, 63, 0.08);
}
.agent-team__head { margin-bottom: 8px; }
.agent-team__list { list-style: none; margin: 0; padding: 0; }
.agent-team__item { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-top: 1px solid rgba(18, 51, 63, 0.06); }
.agent-team__item:first-child { border-top: none; }
.agent-team__item.is-off { opacity: 0.55; }
.agent-team__avatar { flex: 0 0 28px; width: 28px; height: 28px; border-radius: 50%; overflow: hidden; }
.agent-team__avatar svg { display: block; }
.agent-team__who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.agent-team__name { font-family: var(--font-heading); font-weight: 600; font-size: 13px; color: var(--color-petrol); }
.agent-team__role { font-size: 11.5px; color: rgba(18, 51, 63, 0.55); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agent-team__pending { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--color-accent); color: var(--color-petrol); font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.agent-team__chip { padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.agent-team__chip--auto { background: #e1efe5; color: #3d6b4f; }
.agent-team__chip--approval { background: #fbf0cf; color: #8a6510; }
.agent-team__chip--suggest { background: #e8e6f2; color: #5f5786; }
.agent-team__chip--off { background: rgba(18, 51, 63, 0.06); color: rgba(18, 51, 63, 0.55); }

/* Operato agente per agente (agent-activity.js). */
.agent-activity { display: flex; flex-direction: column; gap: 16px; }
.agent-activity__heading { margin: 0; font-family: var(--font-heading); font-size: 19px; font-weight: 600; letter-spacing: -0.3px; }
.agent-activity__subtitle { margin: 4px 0 0; font-size: 13px; color: rgba(18, 51, 63, 0.6); }
.agent-activity__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.agent-activity__item {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px 16px;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(18, 51, 63, 0.08);
    background:
        radial-gradient(110% 80% at 0% 0%, rgba(18, 51, 63, 0.06), transparent 45%),
        radial-gradient(110% 80% at 100% 100%, rgba(229, 201, 121, 0.2), transparent 50%),
        #fff;
}
.agent-activity__who { display: flex; align-items: center; gap: 10px; }
.agent-activity__who > div { display: flex; flex-direction: column; min-width: 0; }
.agent-activity__avatar { flex: 0 0 40px; width: 40px; height: 40px; border-radius: 50%; overflow: hidden; }
.agent-activity__avatar svg { display: block; }
.agent-activity__name { font-family: var(--font-heading); font-weight: 600; font-size: 14px; color: var(--color-petrol); }
.agent-activity__role { font-size: 12px; color: rgba(18, 51, 63, 0.58); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agent-activity__bars { display: flex; flex-direction: column; gap: 6px; }
.agent-activity__bar { display: grid; grid-template-columns: 78px minmax(0, 1fr) 24px; align-items: center; gap: 8px; }
.agent-activity__bar-label { font-size: 11.5px; color: rgba(18, 51, 63, 0.6); }
.agent-activity__bar-value { font-family: var(--font-heading); font-size: 13px; text-align: right; }
.agent-activity__track { height: 7px; border-radius: 999px; background: rgba(18, 51, 63, 0.07); overflow: hidden; }
.agent-activity__fill { display: block; height: 100%; border-radius: 999px; }
.agent-activity__fill--now { background: var(--color-petrol); }
.agent-activity__fill--before { background: rgba(18, 51, 63, 0.28); }
.agent-activity__chips { display: flex; flex-wrap: wrap; gap: 6px; }
.agent-activity__chip { padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: rgba(18, 51, 63, 0.06); color: rgba(18, 51, 63, 0.6); }
.agent-activity__chip--done { background: #e1efe5; color: #3d6b4f; }
.agent-activity__chip--pending { background: #fbf0cf; color: #8a6510; }
