/* ============================================================================
 * subagents-ui.css — Settings → Sub-Agents.
 *
 *  Sits inside the .stg-shell settings panel (styled in app-windows.css) and
 *  follows its design language: quiet cards, 12.5px meta text, the shared
 *  toggle component. Only the pieces the shared classes don't cover live here.
 * ========================================================================== */

/* ── Agent cards ─────────────────────────────────────────────────────────── */
.sub-agent-card {
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.12));
    border-radius: 14px;
    padding: 12px 14px;
    margin: 0 2px 10px;
    background: var(--secondary-color, rgba(255, 255, 255, 0.03));
    transition: opacity .18s ease, border-color .18s ease;
}

.sub-agent-card.is-off {
    opacity: .55;
}

.sub-agent-card.is-off .sub-card-emoji {
    filter: grayscale(1);
}

.sub-card-head {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.sub-card-emoji {
    font-size: 22px;
    line-height: 1;
    flex-shrink: 0;
    width: 30px;
    text-align: center;
}

.sub-card-title {
    flex: 1;
    min-width: 0;
}

.sub-card-title h4 {
    margin: 0 0 2px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-color);
    display: flex;
    align-items: center;
}

.sub-card-title p {
    margin: 0;
    font-size: 12.5px;
    line-height: 1.45;
    color: var(--subheading-color, #9aa0a6);
}

.sub-card-head .toggle-container {
    flex-shrink: 0;
    margin-top: 2px;
}

/* ── Meta chips: mode, output shape, tool allowance ──────────────────────── */
.sub-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 10px 0 0 42px;
}

.sub-meta-chip {
    font-size: 11px;
    padding: 2px 9px;
    border-radius: 999px;
    background: var(--secondary-hover-color, rgba(255, 255, 255, 0.06));
    color: var(--subheading-color, #9aa0a6);
    white-space: nowrap;
}

.sub-meta-chip-mode {
    color: var(--text-color);
    background: var(--secondary-hover-color, rgba(255, 255, 255, .06));
    border: 1px solid color-mix(in srgb, var(--accent-color, #6d5efc) 42%, transparent);
}

/* ── Section label with a trailing action (the "New sub-agent" row) ───────── */
.stg-section-label--row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

/* ── Buttons ──────────────────────────────────────────────────────────────
 * Iconed, theme-driven pills. No button here uses the generic .ripple styling
 * any more — that was the source of the flat "default blue" look. Exactly one
 * filled button exists per view (the primary action, in the app accent); every
 * other action is a quiet ghost that only fills in on hover. */
.sub-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 15px;
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1;
    border-radius: 999px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-color);
    cursor: pointer;
    white-space: nowrap;
    transition: background .16s ease, border-color .16s ease, color .16s ease, transform .05s ease;
    -webkit-tap-highlight-color: transparent;
}
.sub-btn:hover { transform: translateY(-1px); }
.sub-btn:active { transform: translateY(0); }
.sub-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--accent-ring, rgba(120, 160, 255, .35));
}
.sub-btn .material-symbols-rounded { font-size: 17px; line-height: 1; }

/* Primary = the app accent, so it follows the user's theme (never a baked-in
   blue). */
.sub-btn--primary {
    background: var(--accent-color, #6d5efc);
    color: var(--on-accent-color, #fff);
}
.sub-btn--primary:hover {
    background: color-mix(in srgb, var(--accent-color, #6d5efc) 88%, #000);
}

/* Ghost = the default for every secondary action. */
.sub-btn--ghost {
    border-color: var(--border-color, rgba(255, 255, 255, .16));
    color: var(--text-color);
}
.sub-btn--ghost:hover {
    background: var(--secondary-hover-color, rgba(255, 255, 255, .06));
    border-color: var(--subheading-color, #9aa0a6);
}

/* Danger = ghost until hovered, then a restrained red. */
.sub-btn--danger {
    border-color: var(--border-color, rgba(255, 255, 255, .16));
    color: #e5675f;
}
.sub-btn--danger:hover {
    background: rgba(229, 72, 77, .12);
    border-color: rgba(229, 72, 77, .5);
    color: #e5484d;
}

.sub-btn--sm { padding: 5px 11px; font-size: 12px; }
.sub-btn--sm .material-symbols-rounded { font-size: 15px; }

/* ── Card actions row ────────────────────────────────────────────────────── */
.sub-card-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 12px;
}

/* ── The editor form ─────────────────────────────────────────────────────── */
.sub-editor-grid {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 4px;
}

.sub-editor-row {
    display: grid;
    grid-template-columns: 1fr 1.4fr;
    gap: 12px;
    align-items: center;
}

.sub-editor-row .stg-row-text h4 {
    margin: 0 0 2px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-color);
}

.sub-editor-row .stg-row-text p {
    margin: 0;
    font-size: 12px;
    line-height: 1.4;
    color: var(--subheading-color, #9aa0a6);
}

.sub-tool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 6px;
    margin-top: 6px;
}

.sub-tool-check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    color: var(--text-color);
    padding: 6px 10px;
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
    border-radius: 10px;
    cursor: pointer;
    transition: background .14s ease, border-color .14s ease;
}

.sub-tool-check:hover {
    background: var(--secondary-hover-color, rgba(255, 255, 255, 0.06));
}

.sub-tool-check:has(input:checked) {
    border-color: var(--accent-color, #0b57d0);
}

.sub-tool-check input {
    accent-color: var(--accent-color, #0b57d0);
    flex-shrink: 0;
}

.sub-tool-check em {
    font-style: normal;
    color: var(--subheading-color, #9aa0a6);
}

/* ── Editor action row (Cancel / Create-or-Save) ─────────────────────────── */
.sub-editor-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid var(--border-color, rgba(255, 255, 255, .1));
}

/* Narrow screens: the settings panel itself collapses first (see
 * app-windows.css), so these only matter on small phones. */
@media (max-width: 480px) {
    .sub-editor-row {
        grid-template-columns: 1fr;
    }

    .sub-card-meta {
        margin-left: 0;
    }
}
