/* ====== Agents catalog (flat list, NOT a hierarchy) ====== */

.catalog {
    display: flex;
    flex-direction: column;
    gap: var(--s-4);
    margin-bottom: var(--s-3);
}

.catalog-dept {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: var(--s-3) var(--s-4);
}

.catalog-dept__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--s-2);
    margin-bottom: var(--s-1);
}

.catalog-dept__name {
    font-size: var(--fs-base);
    font-weight: 600;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.catalog-dept__count {
    font-size: var(--fs-xs);
    color: var(--text-dim);
}

.catalog-dept__desc {
    font-size: var(--fs-xs);
    color: var(--text-muted);
    margin-bottom: var(--s-3);
    line-height: 1.4;
}

.catalog-agent-list {
    display: flex;
    flex-direction: column;
    gap: var(--s-2);
}

.catalog-agent {
    width: 100%;
    text-align: left;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: var(--s-3);
    cursor: pointer;
    font-family: inherit;
    color: var(--text);
    display: flex;
    align-items: flex-start;
    gap: var(--s-3);
    transition: border-color 0.15s ease, background 0.15s ease;
}

.catalog-agent:active { background: var(--bg-elevated); }
.catalog-agent[data-active="true"]  { border-left: 3px solid var(--accent); }
.catalog-agent[data-hired="false"]  { opacity: 0.72; }

.catalog-agent__avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--r-full);
    background: var(--bg-elevated);
    border: 1.5px solid var(--accent);
    color: var(--accent);
    font-size: 11px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.catalog-agent[data-hired="false"] .catalog-agent__avatar {
    border-style: dashed;
    border-color: var(--text-dim);
    color: var(--text-dim);
}

.catalog-agent__body {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.catalog-agent__name {
    font-size: var(--fs-sm);
    color: var(--text);
    font-weight: 600;
}

.catalog-agent__role {
    font-size: var(--fs-xs);
    color: var(--text-muted);
}

.catalog-agent__badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}

.catalog-badge {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 2px var(--s-2);
    border-radius: var(--r-sm);
    background: var(--bg-elevated);
    color: var(--text-muted);
}

.catalog-badge[data-state="on"]   { background: rgba(136, 176, 106, 0.18); color: var(--success); }
.catalog-badge[data-state="off"]  { background: rgba(93, 117, 99, 0.2);    color: var(--text-dim); }
.catalog-badge[data-state="warn"] { background: rgba(212, 160, 74, 0.18);  color: var(--accent); }
.catalog-badge[data-state="risk"] { background: rgba(217, 119, 87, 0.15);  color: var(--error); }

/* ====== Org chart (compact card grid) ====== */

.org-root {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: var(--s-3);
}

.org-ceo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--s-1);
    flex-shrink: 0;
}

.org-department-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--s-2);
}

.org-department-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: var(--s-2);
    display: flex;
    flex-direction: column;
    gap: var(--s-1);
    min-height: 110px;
}

.org-department-card__title {
    font-size: 10px;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    text-align: center;
    flex-shrink: 0;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    padding: 2px 4px;
    border-radius: var(--r-sm);
}

.org-department-card__title:active { background: var(--surface); }
.org-department-card[data-active="none"] .org-department-card__title { color: var(--text-dim); }
.org-department-card[data-active="mixed"] .org-department-card__title { color: var(--warning); }

.org-agent-chips {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--s-1);
    flex: 1 1 auto;
    align-content: start;
}

.org-agent-chips--single {
    grid-template-columns: 1fr;
    place-content: center;
}

.org-agent-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    min-width: 0;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    transition: opacity 0.15s ease;
}

.org-agent-chip[data-active="false"] {
    opacity: 0.55;
}

.org-agent-chip[data-active="false"] .org-node-initial {
    border-color: var(--text-dim);
    color: var(--text-dim);
    background: transparent;
}

/* Not-yet-hired agents get a dashed circle to distinguish from
   hired-but-inactive ones. */
.org-agent-chip[data-hired="false"] .org-node-initial {
    border-style: dashed;
}

.org-agent-chip[data-hired="false"] .org-agent-name {
    font-style: italic;
}

.org-ceo {
    cursor: default;
}

.org-node-initial {
    width: 26px;
    height: 26px;
    border-radius: var(--r-full);
    background: var(--surface);
    border: 1.5px solid var(--accent);
    color: var(--accent);
    font-size: 10px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-family: inherit;
}

.org-node-initial--ceo {
    width: 52px;
    height: 52px;
    border-width: 2.5px;
    font-size: 15px;
    background: var(--surface);
}

.org-agent-name {
    font-size: 10px;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.15;
    width: 100%;
    word-break: break-word;
}

.org-ceo .org-agent-name {
    font-size: var(--fs-sm);
    color: var(--text);
    font-weight: 500;
}

/* ====== Debug pre ====== */

.debug {
    flex: 1 1 auto;
    min-height: 80px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: var(--s-3);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: var(--fs-xs);
    color: var(--text-muted);
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
    -webkit-overflow-scrolling: touch;
}

.debug--compact {
    flex: 0 0 auto;
    max-height: 25vh;
    margin-bottom: var(--s-3);
}

