/* ==========================================================================
   Session View - Main Terminal Area
   ========================================================================== */

/* Container holds all session views stacked */
.session-views-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* Wrapper controls visibility of each session view */
.session-view-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

.session-view-wrapper.hidden {
    display: none;
}

.session-view-wrapper.focused {
    /* Focused session is visible */
}

.session-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0; /* Prevent flex child from overflowing parent on rotation */
}

.session-view-body {
    --surface-basis: 50%;

    flex: 1;
    display: flex;
    min-height: 0;
    min-width: 0;
    overflow: hidden;
}

.session-view-chat {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
}

.session-view-body.has-surface .session-view-chat {
    flex: 1 1 calc(100% - var(--surface-basis));
}

.session-view-body.fullscreen .session-view-chat {
    display: none;
}

.session-view-body.surface-collapsed .session-view-chat {
    flex-basis: auto;
}

.session-surface-resize-handle {
    flex: 0 0 0.45rem;
    cursor: col-resize;
    position: relative;
    background: transparent;

    /* Touch drags resize instead of scrolling the page. */
    touch-action: none;
}

/* Belt and braces for pointer capture: keep the iframe from claiming the
   cursor while a resize is in flight. */
.session-view-body.surface-resizing .session-forward-frame {
    pointer-events: none;
}

.session-surface-resize-handle::before {
    content: "";
    position: absolute;
    inset: 0.5rem 0.18rem;
    border-radius: 999px;
    background: rgba(86, 95, 137, 0.55);
}

.session-surface-resize-handle:hover::before {
    background: rgba(122, 162, 247, 0.85);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.session-view-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1.5rem;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--border);
}

.session-view-header .session-name {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
}

.session-view-header .session-hostname {
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--text-secondary);
}

.session-view-header .session-path {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-family: monospace;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.session-view-header .session-model {
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-family: monospace;
    padding: 0.2rem 0.45rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: rgba(187, 154, 247, 0.08);
    white-space: nowrap;
}

.session-view-header .session-launcher-version {
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-family: monospace;
    padding: 0.2rem 0.45rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: rgba(122, 162, 247, 0.08);
    white-space: nowrap;
}

/* Header actions (Fork…) — a button, but it sits in the chip row, so it takes
   the same chip geometry as `.session-launcher-version` / `.forward-chip`
   rather than the browser default. Without this it rendered as a raw
   system-styled button: light background, square corners, wrong font. */
.session-view-header .session-header-action {
    font-size: 0.78rem;
    font-family: inherit;
    color: var(--text-secondary);
    padding: 0.2rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: rgba(187, 154, 247, 0.1);
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.session-view-header .session-header-action:hover {
    color: var(--text-primary);
    border-color: var(--accent);
    background: rgba(187, 154, 247, 0.18);
}

.session-view-header .session-header-action:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.session-view-header .work-queue-action.active {
    color: var(--success, #9ece6a);
    border-color: rgba(158, 206, 106, 0.55);
    background: rgba(158, 206, 106, 0.12);
}

.session-view-header .work-queue-action.active:hover {
    border-color: rgba(158, 206, 106, 0.76);
    background: rgba(158, 206, 106, 0.2);
}

.session-view-header .plugin-action.active {
    color: var(--text-teal, #7dcfff);
    border-color: rgba(125, 207, 255, 0.55);
    background: rgba(125, 207, 255, 0.12);
}

.session-view-header .plugin-action.active:hover {
    border-color: rgba(125, 207, 255, 0.76);
    background: rgba(125, 207, 255, 0.2);
}

/* Port-forward chips (docs/PORT_FORWARDING.md) */
.session-view-header .session-forwards {
    display: inline-flex;
    gap: 0.35rem;
    align-items: center;
    flex-wrap: wrap;
}

.session-view-header .forward-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.18rem;
    font-size: 0.78rem;
    font-family: monospace;
    padding: 0;
    border: 0;
    background: transparent;
    white-space: nowrap;
}

.session-view-header .forward-chip-open,
.session-view-header .forward-chip-external,
.session-view-header .forward-chip-revoke {
    appearance: none;
    min-height: 1.6rem;
    box-sizing: border-box;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: rgba(125, 207, 255, 0.1);
    font: inherit;
    color: var(--text-teal, #7dcfff);
    text-decoration: none;
    cursor: pointer;
}

.session-view-header .forward-chip-open {
    padding: 0.18rem 0.48rem;
}

.session-view-header .forward-chip-external,
.session-view-header .forward-chip-revoke {
    min-width: 1.6rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
}

.session-view-header .forward-chip-external {
    background: rgba(122, 162, 247, 0.12);
    border-color: rgba(122, 162, 247, 0.48);
    color: var(--text-blue, #7aa2f7);
}

.session-view-header .forward-chip-open:hover,
.session-view-header .forward-chip-external:hover {
    background: rgba(125, 207, 255, 0.18);
    color: var(--text-primary);
}

.session-view-header .forward-chip-open:focus-visible,
.session-view-header .forward-chip-external:focus-visible,
.session-view-header .forward-chip-revoke:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

/* Live port health from the proxy's background probe, conveyed by color
   alone: a subtle breathing green while the port is live, flat red when the
   last probe was refused. */
.session-view-header .forward-chip.is-up {
    animation: forward-chip-breathe 2.8s ease-in-out infinite;
}

.session-view-header .forward-chip.is-up .forward-chip-open,
.session-view-header .forward-chip.is-up .forward-chip-external {
    border-color: rgba(158, 206, 106, 0.6);
    background: rgba(158, 206, 106, 0.12);
    color: var(--success, #9ece6a);
}

@keyframes forward-chip-breathe {
    0%,
    100% {
        background: rgba(158, 206, 106, 0.08);
        box-shadow: 0 0 0 rgba(158, 206, 106, 0);
    }

    50% {
        background: rgba(158, 206, 106, 0.22);
        box-shadow: 0 0 6px rgba(158, 206, 106, 0.35);
    }
}

@media (prefers-reduced-motion: reduce) {
    .session-view-header .forward-chip.is-up {
        animation: none;
    }
}

.session-view-header .forward-chip.is-down .forward-chip-open,
.session-view-header .forward-chip.is-down .forward-chip-external {
    border-color: rgba(247, 118, 142, 0.6);
    background: rgba(247, 118, 142, 0.12);
    color: var(--error, #f7768e);
}

.session-view-header .forward-chip-revoke {
    background: rgba(192, 202, 245, 0.05);
    border-color: rgba(192, 202, 245, 0.2);
    color: var(--text-secondary);
    font-size: 0.68rem;
}

.session-view-header .forward-chip-revoke:hover {
    color: var(--error);
    background: rgba(247, 118, 142, 0.1);
    border-color: rgba(247, 118, 142, 0.45);
}

.session-forward-surface {
    flex: 0 0 var(--surface-basis);
    position: relative;
    min-width: min(28rem, 50vw);
    max-width: 70%;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: var(--bg-darker);
    border-left: 1px solid rgba(122, 162, 247, 0.45);
    box-shadow: -8px 0 24px rgba(0, 0, 0, 0.22);
}

.session-forward-surface.collapsed {
    flex-basis: 3rem;
    min-width: 3rem;
    max-width: 3rem;
}

.session-forward-surface.fullscreen {
    flex: 1 1 100%;
    min-width: 0;
    max-width: none;
    border-left: 0;
    box-shadow: none;
}

.session-forward-toolbar {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 2.4rem;
    padding: 0.35rem 0.5rem;
    border-bottom: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.18);
}

.surface-icon-button {
    appearance: none;
    flex: 0 0 auto;
    width: 1.6rem;
    height: 1.6rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 4px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 1;
}

.surface-icon-button:hover {
    color: var(--text-primary);
    border-color: var(--border);
    background: rgba(122, 162, 247, 0.08);
}

.surface-close-button:hover {
    color: var(--error);
    border-color: rgba(247, 118, 142, 0.45);
    background: rgba(247, 118, 142, 0.08);
}

.surface-status {
    flex: 0 0 auto;
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 999px;
    background: var(--text-muted);
    opacity: 0.7;
}

.surface-status.is-up {
    background: var(--success, #9ece6a);
    opacity: 1;
}

.surface-status.is-down {
    background: var(--error, #f7768e);
    opacity: 1;
}

.session-forward-title {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-secondary);
    font: 0.8rem var(--font-mono, monospace);
}

.session-forward-visit {
    flex: 0 0 auto;
    color: var(--text-teal, #7dcfff);
    font-size: 0.8rem;
    text-decoration: none;
    white-space: nowrap;
}

.session-forward-visit:hover {
    text-decoration: underline;
}

.session-forward-frame {
    flex: 1 1 auto;
    display: block;
    width: 100%;
    min-height: 0;
    border: 0;
    background: #fff;
}

.session-forward-surface.collapsed .surface-status,
.session-forward-surface.collapsed .session-forward-title,
.session-forward-surface.collapsed .surface-mode-button,
.session-forward-surface.collapsed .session-forward-visit,
.session-forward-surface.collapsed .surface-close-button {
    display: none;
}

.session-forward-surface.collapsed .session-forward-frame {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.session-work-queue-surface {
    background: var(--bg-darker);
}

.session-work-queue-surface.collapsed .edit-stack-panel {
    display: none;
}

.session-plugins-surface {
    background: var(--bg-darker);
}

.session-plugins-surface.collapsed .plugin-panel {
    display: none;
}

.session-view-header .status {
    font-size: 0.8rem;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
}

.session-view-header .status.connected {
    background: rgba(158, 206, 106, 0.2);
    color: var(--success);
}

.session-view-header .status.disconnected {
    background: rgba(247, 118, 142, 0.2);
    color: var(--error);
}

.session-view-header .session-cost {
    font-size: 0.85rem;
    font-family: monospace;
    color: var(--success);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    background: rgba(158, 206, 106, 0.1);
    transition: background 0.3s ease;
}

.session-view-header .session-cost.flash {
    animation: cost-flash 0.5s ease-out, cost-shake 0.4s ease-in-out;
}

@keyframes cost-flash {
    0% {
        background: rgba(158, 206, 106, 0.6);
    }
    100% {
        background: rgba(158, 206, 106, 0.1);
    }
}

@keyframes cost-shake {
    0%, 100% { transform: translateX(0) rotate(0deg); }
    15% { transform: translateX(-2px) rotate(-2deg); }
    30% { transform: translateX(2px) rotate(2deg); }
    45% { transform: translateX(-2px) rotate(-1deg); }
    60% { transform: translateX(2px) rotate(1deg); }
    75% { transform: translateX(-1px) rotate(-0.5deg); }
    90% { transform: translateX(1px) rotate(0.5deg); }
}

.session-view-scroll-area {
    flex: 1;
    display: flex;
    position: relative;
    overflow: hidden;
    min-height: 0;
    overscroll-behavior: contain;
}

.session-view-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1rem 0.75rem 0 0.75rem;
    min-width: 0; /* Allow flex child to shrink below content size */
    overscroll-behavior: contain; /* Prevent iOS rubber-banding from escaping this container */
}

/* Floating "Jump to live" pill shown when the user has scrolled up.
   Clicking it re-arms auto-tailing and snaps the messages view to bottom. */
.jump-to-live-pill {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
    padding: 0.4rem 0.9rem;
    background: var(--accent);
    color: var(--bg-dark);
    border: none;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
    transition: transform 0.12s ease, background 0.12s ease;
}

.jump-to-live-pill:hover {
    background: var(--accent-hover);
    transform: translateX(-50%) translateY(-1px);
}

.jump-to-live-pill:active {
    transform: translateX(-50%) translateY(0);
}

.edit-stack-panel {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: rgba(26, 27, 38, 0.96);
    overflow: hidden;
}

.edit-stack-header {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.55rem 0.65rem;
    border-bottom: 1px solid rgba(86, 95, 137, 0.42);
}

.edit-stack-title {
    display: flex;
    align-items: baseline;
    gap: 0.55rem;
    min-width: 0;
}

.edit-stack-kicker {
    color: var(--text-primary);
    font-size: 0.82rem;
    font-weight: 650;
}

.edit-stack-count {
    color: var(--text-secondary);
    font-size: 0.76rem;
    white-space: nowrap;
}

.edit-stack-actions,
.edit-stack-item-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.edit-stack-action,
.edit-stack-icon-action {
    appearance: none;
    border: 1px solid rgba(122, 162, 247, 0.35);
    border-radius: 5px;
    background: rgba(122, 162, 247, 0.08);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.75rem;
    line-height: 1;
    padding: 0.38rem 0.55rem;
}

.edit-stack-action.primary {
    background: rgba(122, 162, 247, 0.2);
    border-color: rgba(122, 162, 247, 0.62);
}

.edit-stack-action:hover:not(:disabled),
.edit-stack-icon-action:hover:not(:disabled) {
    background: rgba(122, 162, 247, 0.24);
}

.edit-stack-action:disabled,
.edit-stack-icon-action:disabled {
    cursor: not-allowed;
    opacity: 0.48;
}

.edit-stack-icon-action.compact {
    min-width: 1.8rem;
    padding: 0.35rem 0.45rem;
}

.edit-stack-tabs {
    flex: 0 0 auto;
    display: flex;
    gap: 0.35rem;
    padding: 0.45rem 0.65rem 0;
}

.edit-stack-tab {
    appearance: none;
    flex: 1 1 0;
    border: 1px solid rgba(86, 95, 137, 0.42);
    border-radius: 5px;
    background: rgba(36, 40, 59, 0.58);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.74rem;
    line-height: 1;
    padding: 0.42rem 0.5rem;
}

.edit-stack-tab:hover {
    color: var(--text-primary);
    border-color: rgba(122, 162, 247, 0.48);
    background: rgba(122, 162, 247, 0.12);
}

.edit-stack-tab.active {
    color: var(--text-primary);
    border-color: rgba(122, 162, 247, 0.72);
    background: rgba(122, 162, 247, 0.2);
}

.edit-stack-error {
    flex: 0 0 auto;
    margin: 0.55rem 0.65rem 0;
    padding: 0.45rem 0.55rem;
    border: 1px solid rgba(247, 118, 142, 0.42);
    border-radius: 6px;
    background: rgba(247, 118, 142, 0.12);
    color: var(--error);
    font-size: 0.78rem;
}

.edit-stack-list {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    overflow: auto;
    padding: 0.6rem 0.65rem;
}

.edit-stack-empty {
    padding: 0.7rem;
    border: 1px dashed rgba(86, 95, 137, 0.5);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.78rem;
    text-align: center;
}

.edit-stack-item {
    display: grid;
    grid-template-columns: 4.7rem minmax(0, 1fr);
    gap: 0.65rem;
    align-items: start;
    min-width: 0;
    padding: 0.5rem;
    border: 1px solid rgba(86, 95, 137, 0.44);
    border-radius: 7px;
    background: rgba(36, 40, 59, 0.72);
}

.edit-stack-item.active {
    border-color: rgba(158, 206, 106, 0.58);
    background: rgba(158, 206, 106, 0.08);
}

.edit-stack-thumb {
    width: 4.7rem;
    height: 3.1rem;
    object-fit: cover;
    border: 1px solid rgba(86, 95, 137, 0.62);
    border-radius: 5px;
    background: #0f111a;
}

.edit-stack-thumb.empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font: 0.72rem var(--font-mono, monospace);
}

.edit-stack-item-main {
    min-width: 0;
}

.edit-stack-item-topline {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.edit-stack-item-title {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-primary);
    font-size: 0.82rem;
    font-weight: 600;
}

.edit-stack-creator {
    flex: 0 0 auto;
    color: var(--text-secondary);
    font-size: 0.72rem;
}

.edit-stack-item-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.25rem;
}

.edit-stack-status {
    display: inline-flex;
    align-items: center;
    min-height: 1rem;
    padding: 0.12rem 0.38rem;
    border: 1px solid rgba(86, 95, 137, 0.45);
    border-radius: 999px;
    color: var(--text-secondary);
    font-size: 0.66rem;
    line-height: 1;
}

.edit-stack-status.pending {
    border-color: rgba(224, 175, 104, 0.52);
    background: rgba(224, 175, 104, 0.1);
    color: var(--warning, #e0af68);
}

.edit-stack-status.sent {
    border-color: rgba(122, 162, 247, 0.52);
    background: rgba(122, 162, 247, 0.1);
    color: var(--text-blue, #7aa2f7);
}

.edit-stack-status.completed {
    border-color: rgba(158, 206, 106, 0.5);
    background: rgba(158, 206, 106, 0.1);
    color: var(--success, #9ece6a);
}

.edit-stack-status.failed {
    border-color: rgba(247, 118, 142, 0.5);
    background: rgba(247, 118, 142, 0.1);
    color: var(--error, #f7768e);
}

.edit-stack-elapsed {
    color: var(--text-muted);
    font-size: 0.68rem;
}

.edit-stack-note {
    margin-top: 0.22rem;
    color: var(--text-secondary);
    font-size: 0.78rem;
    line-height: 1.35;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.edit-stack-context {
    margin: 0.4rem 0 0;
    max-height: 5.5rem;
    overflow: auto;
    padding: 0.4rem;
    border: 1px solid rgba(86, 95, 137, 0.36);
    border-radius: 5px;
    background: rgba(15, 17, 26, 0.64);
    color: var(--text-muted);
    font-size: 0.7rem;
    line-height: 1.3;
    white-space: pre-wrap;
}

.edit-stack-item-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
}

@media (max-width: 720px) {
    .edit-stack-header {
        align-items: stretch;
        flex-direction: column;
    }

    .edit-stack-actions,
    .edit-stack-item-actions {
        width: 100%;
    }

    .edit-stack-action,
    .edit-stack-icon-action {
        flex: 1 1 0;
    }

    .edit-stack-item {
        grid-template-columns: 4rem minmax(0, 1fr);
    }

    .edit-stack-thumb {
        width: 4rem;
        height: 3rem;
    }

    .edit-stack-item-actions {
        grid-column: 1 / -1;
    }
}

.fork-lineage-card {
    margin: 0.75rem 1rem;
    padding: 0.65rem 0.8rem;
    border: 1px solid rgba(122, 162, 247, 0.35);
    border-radius: 8px;
    background: rgba(122, 162, 247, 0.08);
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.fork-lineage-card a {
    color: var(--accent-blue);
}

.plugin-context-card {
    margin: 0.75rem 1rem;
    border: 1px solid rgba(125, 207, 255, 0.28);
    border-radius: 8px;
    background: rgba(125, 207, 255, 0.07);
    overflow: hidden;
}

.plugin-context-summary {
    appearance: none;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
    padding: 0.55rem 0.7rem;
    border: 0;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    text-align: left;
    font: inherit;
}

.plugin-context-summary:hover {
    background: rgba(125, 207, 255, 0.08);
}

.plugin-context-caret,
.plugin-context-title {
    flex: 0 0 auto;
}

.plugin-context-title {
    color: var(--text-primary);
    font-weight: 650;
}

.plugin-context-names {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.plugin-context-size {
    flex: 0 0 auto;
    margin-left: auto;
    color: var(--text-teal, #7dcfff);
    font: 0.72rem var(--font-mono, monospace);
}

.plugin-context-body {
    display: grid;
    gap: 0.45rem;
    padding: 0 0.7rem 0.7rem;
}

.plugin-context-plugin {
    display: grid;
    gap: 0.25rem;
    padding: 0.45rem 0.5rem;
    border: 1px solid rgba(86, 95, 137, 0.38);
    border-radius: 6px;
    background: rgba(26, 27, 38, 0.5);
}

.plugin-context-plugin-title {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    color: var(--text-primary);
    font-size: 0.78rem;
}

.plugin-context-plugin-title span:last-child,
.plugin-context-detail,
.plugin-context-source {
    color: var(--text-secondary);
    font-size: 0.72rem;
}

.plugin-context-source {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.plugin-panel {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: rgba(26, 27, 38, 0.96);
}

.plugin-panel-header {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.55rem 0.65rem;
    border-bottom: 1px solid rgba(86, 95, 137, 0.42);
}

.plugin-list {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    overflow: auto;
    padding: 0.65rem;
}

.plugin-card {
    display: grid;
    gap: 0.45rem;
    min-width: 0;
    padding: 0.65rem;
    border: 1px solid rgba(86, 95, 137, 0.44);
    border-radius: 7px;
    background: rgba(36, 40, 59, 0.72);
}

.plugin-card.suggested {
    border-color: rgba(125, 207, 255, 0.52);
    background: rgba(125, 207, 255, 0.08);
}

.plugin-card-topline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    min-width: 0;
}

.plugin-card-title {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-width: 0;
    color: var(--text-primary);
    font-weight: 650;
}

.plugin-card-badge {
    padding: 0.11rem 0.36rem;
    border: 1px solid rgba(158, 206, 106, 0.42);
    border-radius: 999px;
    background: rgba(158, 206, 106, 0.1);
    color: var(--success, #9ece6a);
    font-size: 0.65rem;
    font-weight: 500;
}

.plugin-card-context {
    flex: 0 0 auto;
    color: var(--text-teal, #7dcfff);
    font: 0.7rem var(--font-mono, monospace);
}

.plugin-card-description,
.plugin-card-reason {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.78rem;
    line-height: 1.35;
}

.plugin-card-reason {
    color: var(--success, #9ece6a);
}

.plugin-card-source {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-muted);
    font-size: 0.7rem;
}

.plugin-card-section {
    display: grid;
    gap: 0.3rem;
}

.plugin-card-section-title {
    color: var(--text-secondary);
    font-size: 0.68rem;
    text-transform: uppercase;
}

.plugin-skill-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.32rem;
}

.plugin-skill-pill,
.plugin-command-pill {
    max-width: 12rem;
    padding: 0.16rem 0.42rem;
    border: 1px solid rgba(122, 162, 247, 0.34);
    border-radius: 999px;
    background: rgba(122, 162, 247, 0.08);
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.7rem;
}

.plugin-command-pill {
    border-color: rgba(187, 154, 247, 0.34);
    background: rgba(187, 154, 247, 0.08);
}
