/* ── Lead-requests inbox (JARVIS-134) ─────────────────────
   Two-pane list + detail in the existing Jarvis palette, phone-first.
   Colours are the custom properties from style.css :root — nothing new. */

.req-shell {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 1rem;
    height: calc(100vh - 8rem);
    min-height: 420px;
}

/* ── Left pane ─────────────────────────────────────────── */
.req-list-pane {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.req-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 0.875rem;
    border-bottom: 1px solid var(--border-light);
}

.req-title {
    font-size: 1rem;
    color: var(--text-bright);
    margin: 0;
}

.req-list {
    flex: 1;
    overflow-y: auto;
}

.req-row {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    border-bottom: 1px solid var(--border-light);
    padding: 0.625rem 0.875rem;
    cursor: pointer;
    font: inherit;
    color: inherit;
}

.req-row:hover { background: var(--surface-hover); }

.req-row-title {
    display: block;
    color: var(--text-bright);
    font-size: 0.875rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.req-row-meta {
    display: block;
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-top: 0.125rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Right pane ────────────────────────────────────────── */
.req-detail-pane {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.req-placeholder[hidden],
.req-detail[hidden] { display: none; }

.req-placeholder {
    display: flex;
    flex: 1;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.req-detail {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
    padding: 1rem 1.25rem;
    overflow-y: auto;
}

.req-detail-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.req-detail-header h2 {
    flex: 1;
    min-width: 0;
    font-size: 1.0625rem;
    color: var(--text-bright);
    margin: 0;
}

.req-type {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.125rem 0.5rem;
    border-radius: 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.req-type-merge { color: var(--accent); }
.req-type-decision { color: var(--purple); }
.req-type-run_command { color: var(--green); }
.req-type-approve_tool,
.req-type-approve_mcp { color: var(--yellow); }

.req-meta {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-top: 0.25rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-light);
}

.req-subhead {
    font-size: 0.6875rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 0.875rem 0 0.375rem;
}

.req-rationale {
    color: var(--text);
    font-size: 0.875rem;
    line-height: 1.6;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.625rem 0.75rem;
}

/* JARVIS-155: typed-resolution-action notice — what approving will execute.
   Amber callout so the "this changes state" signal is impossible to miss. */
.req-action-notice {
    margin-top: 0.625rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--text-bright);
    background: rgba(255, 193, 7, 0.12);
    border: 1px solid rgba(255, 193, 7, 0.4);
    border-radius: var(--radius-sm);
}

.req-note-input {
    width: 100%;
    min-height: 72px;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.15s;
}

.req-note-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.15);
}

.req-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    margin-top: 0.75rem;
}

/* JARVIS-151: payload surface — a copyable command block plus a generic
   definition list for any other payload keys. */
.req-command-wrap {
    position: relative;
    margin-bottom: 0.625rem;
}

.req-command-label {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.6875rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.req-command {
    margin: 0;
    padding: 0.625rem 0.75rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-bright);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.8125rem;
    line-height: 1.5;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    max-height: 16rem;
    overflow-y: auto;
}

.req-copy {
    position: absolute;
    top: 1.4rem;
    right: 0.5rem;
    font-size: 0.6875rem;
}

.req-payload-dl {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.375rem 0.75rem;
    margin: 0 0 0.75rem;
    font-size: 0.8125rem;
}

.req-payload-dl dt {
    color: var(--text-muted);
    font-weight: 600;
    white-space: nowrap;
}

.req-payload-dl dd {
    margin: 0;
    color: var(--text);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.req-action:disabled { opacity: 0.5; cursor: default; }

/* JARVIS-141: mobile-only toggle bar for the requests pop-out drawer.
   Desktop-hidden; the drawer mechanics live in the narrow-screen query. */
.req-mobile-bar { display: none; }

/* ── Narrow screens: the list becomes a pop-out drawer ──
   JARVIS-141: instead of stacking a 40vh strip above the detail pane, the
   open-request list slides in from the left on demand. The detail pane gets
   the whole viewport; the drawer overlays it. */
@media (max-width: 800px) {
    .req-shell {
        grid-template-columns: 1fr;
        height: calc(100vh - 8rem);
    }
    .req-list-pane {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: min(86vw, 320px);
        border-radius: 0;
        transform: translateX(-100%);
        transition: transform 0.22s ease;
        z-index: 150;
    }
    .req-list-pane.open { transform: translateX(0); }
    .req-list { max-height: none; }
    .req-detail-pane { min-height: 60vh; }
    .req-mobile-bar {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        padding: 0.5rem 0.75rem;
        border-bottom: 1px solid var(--border-light);
    }
}
@media (prefers-reduced-motion: reduce) {
    .req-list-pane { transition: none; }
}
