/* ============================================================
   QAIOS Bridge Panel — Workspace UI Styles
   v3.2.0
   ============================================================ */

/* ── Panel section in sidebar ─────────────────────────────── */

.is-bp-section {
    margin-top: 12px;
    border-top: 1px solid var(--q-border, rgba(255,255,255,.12));
    padding-top: 10px;
}

.is-bp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px 6px;
    cursor: pointer;
    user-select: none;
}

.is-bp-header-title {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--q-muted2, rgba(255,255,255,.45));
}

.is-bp-toggle {
    background: none;
    border: none;
    color: var(--q-muted2, rgba(255,255,255,.45));
    cursor: pointer;
    padding: 0;
    font-size: 12px;
    line-height: 1;
    transition: transform .2s ease;
}

.is-bp-toggle.is--open {
    transform: rotate(180deg);
}

/* ── Seat list ──────────────────────────────────────────────── */

.is-bp-seat-list {
    padding: 0 8px 8px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.is-bp-seat-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 9px;
    border-radius: 6px;
    cursor: pointer;
    transition: background .15s ease;
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
    color: var(--q-text, #e9ecef);
}

.is-bp-seat-item:hover {
    background: var(--q-surface2, rgba(255,255,255,.08));
}

.is-bp-seat-icon {
    font-size: 14px;
    flex-shrink: 0;
    width: 20px;
    text-align: center;
}

.is-bp-seat-info {
    flex: 1;
    min-width: 0;
}

.is-bp-seat-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--q-text, #e9ecef);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.is-bp-seat-sub {
    font-size: 10px;
    color: var(--q-muted2, rgba(255,255,255,.45));
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
}

/* Status dot */
.is-bp-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

.is-bp-status-dot[data-status="interim_active"]          { background: #50c878; }
.is-bp-status-dot[data-status="human_active_with_helper"] { background: #4da6ff; }
.is-bp-status-dot[data-status="helper_promoted"]          { background: #f6c344; }
.is-bp-status-dot[data-status="vacant"]                  { background: rgba(255,255,255,.25); }
.is-bp-status-dot[data-status="disabled"]                { background: rgba(255,255,255,.15); }

/* ── Seat Modal ─────────────────────────────────────────────── */

.is-bp-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(2px);
}

.is-bp-modal {
    background: var(--q-surface, #1e2330);
    border: 1px solid var(--q-border, rgba(255,255,255,.12));
    border-radius: 12px;
    width: 100%;
    max-width: 540px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,.5);
    overflow: hidden;
}

.is-bp-modal-head {
    padding: 20px 22px 16px;
    border-bottom: 1px solid var(--q-border, rgba(255,255,255,.1));
    display: flex;
    align-items: flex-start;
    gap: 14px;
    flex-shrink: 0;
}

.is-bp-modal-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--q-primary, #3d7eff);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
    overflow: hidden;
}

.is-bp-modal-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.is-bp-modal-title-block {
    flex: 1;
    min-width: 0;
}

.is-bp-modal-seat-name {
    font-size: 17px;
    font-weight: 700;
    color: var(--q-text, #e9ecef);
    line-height: 1.2;
}

.is-bp-modal-seat-role {
    font-size: 12px;
    color: var(--q-muted, #8a9bbf);
    margin-top: 2px;
}

.is-bp-modal-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 20px;
    margin-top: 6px;
}

.is-bp-modal-status-badge[data-status="interim_active"] {
    background: rgba(80,200,120,.15);
    color: #50c878;
}

.is-bp-modal-status-badge[data-status="human_active_with_helper"] {
    background: rgba(77,166,255,.15);
    color: #4da6ff;
}

.is-bp-modal-status-badge[data-status="helper_promoted"] {
    background: rgba(246,195,68,.15);
    color: #f6c344;
}

.is-bp-modal-close {
    background: none;
    border: none;
    color: var(--q-muted, #8a9bbf);
    cursor: pointer;
    font-size: 18px;
    padding: 0;
    line-height: 1;
    flex-shrink: 0;
    margin-top: 2px;
    transition: color .15s;
}

.is-bp-modal-close:hover { color: var(--q-text, #e9ecef); }

/* ── Modal tabs ─────────────────────────────────────────────── */

.is-bp-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--q-border, rgba(255,255,255,.1));
    padding: 0 22px;
    flex-shrink: 0;
}

.is-bp-tab {
    font-size: 12px;
    font-weight: 600;
    color: var(--q-muted, #8a9bbf);
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: color .15s, border-color .15s;
    white-space: nowrap;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
}

.is-bp-tab:hover { color: var(--q-text, #e9ecef); }

.is-bp-tab.is--active {
    color: var(--q-primary, #4da6ff);
    border-bottom-color: var(--q-primary, #4da6ff);
}

/* ── Modal body ─────────────────────────────────────────────── */

.is-bp-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 18px 22px;
    scroll-behavior: smooth;
}

.is-bp-tab-panel { display: none; }
.is-bp-tab-panel.is--active { display: block; }

/* Overview panel */
.is-bp-overview-persona {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: var(--q-surface2, rgba(255,255,255,.05));
    border-radius: 8px;
    margin-bottom: 14px;
}

.is-bp-overview-persona-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--q-text, #e9ecef);
}

.is-bp-overview-persona-sub {
    font-size: 11px;
    color: var(--q-muted, #8a9bbf);
    margin-top: 1px;
}

.is-bp-overview-desc {
    font-size: 13px;
    color: var(--q-muted, #8a9bbf);
    line-height: 1.6;
    margin-bottom: 14px;
}

.is-bp-recent-decisions h5 {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--q-muted2, rgba(255,255,255,.4));
    margin: 0 0 8px;
}

.is-bp-decision-chip {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 10px;
    background: var(--q-surface2, rgba(255,255,255,.05));
    border-radius: 6px;
    margin-bottom: 6px;
}

.is-bp-decision-chip-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-top: 5px;
    flex-shrink: 0;
}

.is-bp-decision-chip-dot[data-status="advisory"]          { background: var(--q-muted, #8a9bbf); }
.is-bp-decision-chip-dot[data-status="approved"]          { background: #50c878; }
.is-bp-decision-chip-dot[data-status="denied"]            { background: #e05757; }
.is-bp-decision-chip-dot[data-status="guardrail_warning"] { background: #f6c344; }
.is-bp-decision-chip-dot[data-status="escalated"]         { background: #ff8c42; }

.is-bp-decision-chip-text {
    flex: 1;
    min-width: 0;
}

.is-bp-decision-chip-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--q-text, #e9ecef);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.is-bp-decision-chip-date {
    font-size: 10px;
    color: var(--q-muted2, rgba(255,255,255,.4));
    margin-top: 1px;
}

/* Ask panel */
.is-bp-ask-label {
    font-size: 12px;
    color: var(--q-muted, #8a9bbf);
    margin-bottom: 8px;
}

.is-bp-ask-textarea {
    width: 100%;
    min-height: 90px;
    background: var(--q-input-bg, rgba(255,255,255,.06));
    border: 1px solid var(--q-border, rgba(255,255,255,.12));
    border-radius: 8px;
    color: var(--q-text, #e9ecef);
    font-size: 13px;
    padding: 10px 12px;
    resize: vertical;
    font-family: inherit;
    transition: border-color .15s;
    box-sizing: border-box;
}

.is-bp-ask-textarea:focus {
    outline: none;
    border-color: var(--q-primary, #4da6ff);
}

.is-bp-ask-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
}

.is-bp-ask-hint {
    font-size: 11px;
    color: var(--q-muted2, rgba(255,255,255,.35));
}

.is-bp-ask-response {
    margin-top: 16px;
    padding: 14px;
    background: var(--q-surface2, rgba(255,255,255,.05));
    border-radius: 8px;
    border-left: 3px solid var(--q-primary, #4da6ff);
    font-size: 13px;
    line-height: 1.6;
    color: var(--q-text, #e9ecef);
    display: none;
}

.is-bp-ask-response.is--visible { display: block; }

.is-bp-ask-response-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--q-primary, #4da6ff);
    margin-bottom: 6px;
}

/* Decisions panel */
.is-bp-decisions-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.is-bp-decision-row {
    background: var(--q-surface2, rgba(255,255,255,.05));
    border-radius: 8px;
    padding: 12px 14px;
    border-left: 3px solid transparent;
}

.is-bp-decision-row[data-status="approved"]          { border-left-color: #50c878; }
.is-bp-decision-row[data-status="denied"]            { border-left-color: #e05757; }
.is-bp-decision-row[data-status="guardrail_warning"] { border-left-color: #f6c344; }
.is-bp-decision-row[data-status="advisory"]          { border-left-color: var(--q-border, rgba(255,255,255,.15)); }
.is-bp-decision-row[data-status="escalated"]         { border-left-color: #ff8c42; }

.is-bp-decision-row-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.is-bp-decision-row-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--q-text, #e9ecef);
}

.is-bp-decision-row-meta {
    font-size: 10px;
    color: var(--q-muted2, rgba(255,255,255,.4));
    white-space: nowrap;
    margin-left: 8px;
}

.is-bp-decision-row-body {
    font-size: 12px;
    color: var(--q-muted, #8a9bbf);
    line-height: 1.5;
}

/* Apply panel */
.is-bp-apply-info {
    font-size: 13px;
    color: var(--q-muted, #8a9bbf);
    line-height: 1.6;
    margin-bottom: 14px;
}

.is-bp-apply-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--q-text, #e9ecef);
    margin-bottom: 6px;
}

.is-bp-apply-textarea {
    width: 100%;
    min-height: 80px;
    background: var(--q-input-bg, rgba(255,255,255,.06));
    border: 1px solid var(--q-border, rgba(255,255,255,.12));
    border-radius: 8px;
    color: var(--q-text, #e9ecef);
    font-size: 13px;
    padding: 10px 12px;
    resize: vertical;
    font-family: inherit;
    transition: border-color .15s;
    box-sizing: width;
    box-sizing: border-box;
}

.is-bp-apply-textarea:focus {
    outline: none;
    border-color: var(--q-primary, #4da6ff);
}

.is-bp-apply-notice {
    font-size: 11px;
    color: var(--q-muted2, rgba(255,255,255,.4));
    margin-top: 8px;
    font-style: italic;
}

.is-bp-apply-success {
    padding: 12px 14px;
    background: rgba(80,200,120,.1);
    border: 1px solid rgba(80,200,120,.25);
    border-radius: 8px;
    font-size: 13px;
    color: #50c878;
    display: none;
}

.is-bp-apply-success.is--visible { display: block; }

/* ── Agent messages in workspace feed ───────────────────────── */

.is-ws-msg.is--agent {
    border-left: 3px solid var(--q-primary, #4da6ff);
    background: rgba(77,166,255,.04);
    border-radius: 0 8px 8px 0;
    padding-left: 12px !important;
}

.is-ws-msg.is--agent .is-ws-msg-avatar {
    background: var(--q-primary, #3d7eff);
    font-size: 14px;
}

.is-ws-msg.is--agent .is-ws-msg-name {
    color: var(--q-primary, #4da6ff);
}

.is-ws-msg-agent-seat {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--q-primary, #4da6ff);
    background: rgba(77,166,255,.12);
    padding: 1px 6px;
    border-radius: 10px;
    margin-left: 5px;
    vertical-align: middle;
}

/* ── Panel loading / empty states ───────────────────────────── */

.is-bp-loading {
    text-align: center;
    padding: 14px 0;
    color: var(--q-muted2, rgba(255,255,255,.35));
    font-size: 12px;
}

.is-bp-error {
    padding: 10px 14px;
    font-size: 12px;
    color: #e05757;
}

/* ── Buttons inside panel modal ─────────────────────────────── */

.is-bp-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 14px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: opacity .15s, transform .1s;
}

.is-bp-btn:active { transform: scale(.97); }

.is-bp-btn--primary {
    background: var(--q-primary, #3d7eff);
    color: #fff;
}

.is-bp-btn--primary:hover { opacity: .9; }

.is-bp-btn--ghost {
    background: var(--q-surface2, rgba(255,255,255,.08));
    color: var(--q-text, #e9ecef);
}

.is-bp-btn--ghost:hover { background: rgba(255,255,255,.13); }

.is-bp-btn--danger {
    background: rgba(224,87,87,.15);
    color: #e05757;
}

.is-bp-btn--danger:hover { background: rgba(224,87,87,.25); }

.is-bp-btn:disabled {
    opacity: .5;
    cursor: not-allowed;
}

/* ── Spinner ────────────────────────────────────────────────── */

@keyframes is-bp-spin {
    to { transform: rotate(360deg); }
}

.is-bp-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,.25);
    border-top-color: #fff;
    border-radius: 50%;
    animation: is-bp-spin .7s linear infinite;
    vertical-align: middle;
}

/* ============================================================
   QAIOS Bridge Panel — Governance Strip (workspace top bar)
   v3.2.1
   ============================================================ */

.is-ws-governance-strip {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 16px 7px;
    background: var(--q-surface2, rgba(255,255,255,.04));
    border-bottom: 1px solid var(--q-border, rgba(255,255,255,.08));
    min-height: 40px;
}

/* Seat chip */
.is-ws-gov-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px 4px 7px;
    background: var(--q-surface, rgba(255,255,255,.06));
    border: 1px solid var(--q-border, rgba(255,255,255,.1));
    border-radius: 20px;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease;
    user-select: none;
}

.is-ws-gov-chip:hover {
    background: rgba(77,166,255,.12);
    border-color: rgba(77,166,255,.3);
}

.is-ws-gov-chip__dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.is-ws-gov-chip__dot.is--ai     { background: #50c878; }
.is-ws-gov-chip__dot.is--human  { background: #4da6ff; }

.is-ws-gov-chip__icon {
    font-size: 13px;
    line-height: 1;
}

.is-ws-gov-chip__label {
    font-size: 11px;
    font-weight: 600;
    color: var(--q-text, #e9ecef);
    letter-spacing: .02em;
}

/* Helper text */
.is-ws-gov-hint {
    font-size: 10px;
    color: var(--q-muted2, rgba(255,255,255,.3));
    margin-left: auto;
    white-space: nowrap;
    font-style: italic;
}

/* ── Agent message — passive alert variant ───────────────────────────── */
.is-ws-msg.is--agent.is--passive {
    border-left-color: var(--q-warning, #f6c344);
    background: rgba(246,195,68,.04);
}

.is-ws-msg.is--agent.is--passive .is-ws-msg-name {
    color: var(--q-warning, #f6c344);
}

/* ── Responsive: strip wraps gracefully on smaller widths ─────────────── */
@media (max-width: 680px) {
    .is-ws-governance-strip {
        padding: 6px 10px;
        gap: 4px;
    }
    .is-ws-gov-chip {
        padding: 3px 8px 3px 5px;
    }
    .is-ws-gov-chip__label {
        display: none;
    }
    .is-ws-gov-hint {
        display: none;
    }
}
