/* ============================================================
   JARVIS Side-FAB Drawer (Design C, refined v1.2)
   ============================================================
   Mounted on the right edge of .page-tabs-container.
   Drawer slides in from the right.
   Body class .jarvis-incoming-file lights everything up
   while a file is being dragged anywhere on the page.
   ============================================================ */

/* ── Trigger (lives inside .page-tabs-container) ── */
.jarvis-fab-trigger {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.85rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.18s ease;
    font-family: inherit;
    position: relative;
}
.jarvis-fab-trigger:hover {
    color: var(--accent-orange);
    border-color: var(--accent-orange);
    background: rgba(249, 115, 22, 0.08);
}
.jarvis-fab-trigger .jarvis-fab-icon {
    color: var(--accent-orange);
    font-size: 0.95rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    transition: transform 0.2s ease;
}

/* Hover greeting — bubble on the LEFT of the trigger.
   "Hi, I can help you with shipment compliance! :)"
   Hidden by default, fades in on hover. Pointer-events:none so the bubble
   itself never traps the cursor. */
.jarvis-fab-trigger .jarvis-fab-greeting {
    position: absolute;
    right: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%) translateX(8px);
    background: var(--bg-secondary);
    border: 1px solid var(--accent-orange);
    color: var(--accent-orange);
    padding: 0.45rem 0.7rem;
    border-radius: var(--radius-md);
    font-size: 0.7rem;
    font-weight: 500;
    white-space: nowrap;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35), 0 0 18px rgba(249, 115, 22, 0.18);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
    z-index: 1100;
}
/* Tail pointing toward the trigger */
.jarvis-fab-trigger .jarvis-fab-greeting::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 100%;
    transform: translateY(-50%);
    border: 6px solid transparent;
    border-left-color: var(--accent-orange);
}
.jarvis-fab-trigger:hover .jarvis-fab-greeting {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}
/* Hide the greeting while a file is being dragged — the drag-state hint
   chip at the top owns the messaging in that mode. */
body.jarvis-incoming-file .jarvis-fab-trigger .jarvis-fab-greeting { display: none; }
/* Brand glyph — simple sparkle character used in trigger + drawer header */
.jarvis-ai-glyph {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    color: inherit;
}
.jarvis-fab-trigger .jarvis-ai-glyph { font-size: 0.95rem; }
.jarvis-brand-icon .jarvis-ai-glyph { font-size: 1.1rem; }

/* ── Global drag mode: a file is being dragged anywhere on the page ── */
body.jarvis-incoming-file .jarvis-fab-trigger {
    background: rgba(249, 115, 22, 0.18);
    border-color: var(--accent-orange);
    color: #ffd6a5;
    box-shadow:
        0 0 0 1px rgba(249, 115, 22, 0.6),
        0 0 24px rgba(249, 115, 22, 0.55),
        0 0 48px rgba(249, 115, 22, 0.25);
    animation: jarvisIncomingPulse 1s ease-in-out infinite;
}
body.jarvis-incoming-file .jarvis-fab-trigger .jarvis-fab-icon {
    transform: scale(1.25);
    color: #fff7ed;
    text-shadow: 0 0 10px rgba(249, 115, 22, 0.85);
}
@keyframes jarvisIncomingPulse {
    0%, 100% {
        box-shadow:
            0 0 0 1px rgba(249, 115, 22, 0.6),
            0 0 18px rgba(249, 115, 22, 0.45),
            0 0 36px rgba(249, 115, 22, 0.18);
    }
    50% {
        box-shadow:
            0 0 0 2px rgba(249, 115, 22, 0.85),
            0 0 30px rgba(249, 115, 22, 0.7),
            0 0 60px rgba(249, 115, 22, 0.35);
    }
}

/* Hint chip that appears next to the trigger while a file is being dragged */
.jarvis-fab-hint {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--accent-orange);
    border-radius: var(--radius-md);
    padding: 0.45rem 0.7rem;
    font-size: 0.7rem;
    color: var(--accent-orange);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35), 0 0 20px rgba(249, 115, 22, 0.25);
    white-space: nowrap;
    pointer-events: none;
    z-index: 1100;
    animation: jarvisHintBounce 0.9s ease-in-out infinite;
}
.jarvis-fab-hint .hint-arrow {
    position: absolute;
    top: -6px;
    right: 24px;
    color: var(--accent-orange);
    font-size: 0.65rem;
    line-height: 1;
}
.jarvis-fab-hint[hidden] { display: none; }
@keyframes jarvisHintBounce {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-3px); }
}

/* ── Floating preview bubble (cursor-follow during drag, docked after drop) ── */
/* Lives on <body> so position:fixed can move it freely across the viewport. */
.jarvis-preview-bubble {
    position: fixed;
    top: 0;
    left: 0;
    min-width: 220px;
    max-width: 320px;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.55rem 0.7rem;
    background: var(--bg-secondary);
    border: 1px solid var(--accent-orange);
    border-radius: var(--radius-md);
    box-shadow:
        0 10px 28px rgba(0, 0, 0, 0.45),
        0 0 24px rgba(249, 115, 22, 0.35);
    pointer-events: none;     /* don't intercept the drag */
    z-index: 9999;
    transform-origin: top left;
    animation: jarvisBubbleIn 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.jarvis-preview-bubble[hidden] { display: none !important; }

/* Cursor-follow mode (during drag): no transition on left/top so the bubble
   tracks the cursor in real time without lag. Slight rotation to feel like
   a tilted card the user is carrying. */
.jarvis-preview-bubble.cursor-follow {
    transition: none;
    transform: rotate(-3deg);
    box-shadow:
        0 18px 36px rgba(0, 0, 0, 0.55),
        0 0 30px rgba(249, 115, 22, 0.55);
    animation: jarvisBubbleCarry 1.4s ease-in-out infinite;
}
@keyframes jarvisBubbleCarry {
    0%, 100% { transform: rotate(-3deg) scale(1); }
    50%      { transform: rotate(-1deg) scale(1.02); }
}

/* Docked mode (after drop): smoothly transitions into a near-trigger position
   and anchors there for the preview-bubble lifetime. */
.jarvis-preview-bubble.docked {
    transition: left 0.28s ease, top 0.28s ease, transform 0.28s ease;
    transform: rotate(0deg);
    animation: jarvisBubbleIn 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.jarvis-preview-bubble.docking {
    transition: left 0.28s ease, top 0.28s ease, transform 0.28s ease;
}
.jarvis-preview-bubble.fade-out {
    animation: jarvisBubbleOut 0.28s ease forwards;
}

@keyframes jarvisBubbleIn {
    0%   { opacity: 0; transform: translateY(-8px) scale(0.86); }
    100% { opacity: 1; transform: translateY(0)    scale(1); }
}
@keyframes jarvisBubbleOut {
    0%   { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(0.94); }
}
/* Speech-bubble pointer arrow only in docked mode (doesn't make sense at cursor) */
.jarvis-preview-bubble.docked::before {
    content: '';
    position: absolute;
    top: -7px;
    right: 22px;
    width: 12px;
    height: 12px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--accent-orange);
    border-left: 1px solid var(--accent-orange);
    transform: rotate(45deg);
}
.jarvis-preview-bubble .bubble-pdf-icon {
    flex: 0 0 auto;
    width: 30px;
    height: 36px;
    background: linear-gradient(135deg, #ef4444, #b91c1c);
    border-radius: 3px;
    color: white;
    font-size: 0.6rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 8px rgba(239, 68, 68, 0.35);
}
.jarvis-preview-bubble .bubble-body { flex: 1; min-width: 0; }
.jarvis-preview-bubble .bubble-name {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.jarvis-preview-bubble .bubble-name.muted {
    color: var(--text-secondary);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-weight: 500;
}
.jarvis-preview-bubble .bubble-meta {
    font-size: 0.66rem;
    color: var(--accent-orange);
    margin-top: 0.15rem;
}
.jarvis-preview-bubble .bubble-meta.muted { color: var(--text-muted); font-style: italic; }

.jarvis-fab-trigger.has-alerts {
    animation: jarvisFabAlertPulse 1.4s ease-in-out infinite;
    border-color: var(--accent-red);
    color: var(--accent-red);
}
@keyframes jarvisFabAlertPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.45); }
    50%      { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
}
.jarvis-fab-trigger.drag-over {
    background: rgba(249, 115, 22, 0.22);
    border-color: var(--accent-orange);
    color: var(--accent-orange);
    transform: scale(1.06);
}
.jarvis-fab-trigger .badge-count {
    background: var(--accent-orange);
    color: #1a0f00;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 0.1rem 0.35rem;
    border-radius: 8px;
    margin-left: 0.2rem;
}
.jarvis-fab-trigger .badge-count[hidden] { display: none; }

/* ── Drawer (right slide-out) ── */
.jarvis-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 400px;
    max-width: 92vw;
    height: 100vh;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    box-shadow: -8px 0 24px rgba(0, 0, 0, 0.35);
    transform: translateX(440px);
    transition: transform 0.22s ease;
    z-index: 1500;
    display: flex;
    flex-direction: column;
    font-size: 0.78rem;
}
.jarvis-drawer.open { transform: translateX(0); }

/* Header — clean two-line brand block: [AI icon]  JARVIS  v0.10
                                                    Customs Agent          [×] */
.jarvis-drawer-header {
    padding: 0.75rem 0.95rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.10), transparent 70%);
    flex: 0 0 auto;
}
.jarvis-brand {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex: 1 1 auto;
    min-width: 0;
}
.jarvis-brand-icon {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-orange);
    background: rgba(249, 115, 22, 0.12);
    border: 1px solid rgba(249, 115, 22, 0.4);
    border-radius: 9px;
    flex: 0 0 auto;
    box-shadow: 0 0 14px rgba(249, 115, 22, 0.16) inset;
}
.jarvis-brand-icon .jarvis-ai-glyph { width: 22px; height: 22px; }
.jarvis-brand-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 0.18rem;
    line-height: 1.05;
}
.jarvis-brand-meta .brand-line {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}
.jarvis-brand-meta .brand-name {
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--accent-orange);
    line-height: 1;
}
.jarvis-brand-meta .brand-version {
    font-size: 0.56rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--accent-orange);
    background: rgba(249, 115, 22, 0.14);
    border: 1px solid rgba(249, 115, 22, 0.4);
    padding: 0.12rem 0.38rem;
    border-radius: 999px;
    line-height: 1;
    text-transform: uppercase;
}
.jarvis-brand-meta .brand-tagline {
    font-size: 0.66rem;
    color: var(--text-muted);
    font-weight: 500;
    letter-spacing: 0.04em;
    line-height: 1;
}

.jarvis-drawer-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.3rem;
    cursor: pointer;
    padding: 0 0.3rem;
    line-height: 1;
    flex: 0 0 auto;
    align-self: center;
}
.jarvis-drawer-close:hover { color: var(--accent-orange); }

/* Context strip — refined, supports pills + detail row */
.jarvis-drawer-context {
    padding: 0.55rem 1rem 0.6rem;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
    flex: 0 0 auto;
}
.jarvis-drawer-context .ctx-label {
    font-size: 0.58rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.25rem;
    font-weight: 600;
}
.jarvis-drawer-context .ctx-value {
    color: var(--text-primary);
    font-size: 0.74rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
}
.jarvis-drawer-context .ctx-value.muted { color: var(--text-muted); font-style: italic; }
.jarvis-drawer-context .ctx-pill {
    display: inline-flex;
    padding: 0.18rem 0.55rem;
    font-size: 0.66rem;
    font-weight: 600;
    border-radius: 10px;
    letter-spacing: 0.02em;
}
.jarvis-drawer-context .ctx-pill.position { background: rgba(99,102,241,0.18); color: #a5b4fc; }
.jarvis-drawer-context .ctx-pill.dossier  { background: rgba(20,184,166,0.18); color: #5eead4; }
.jarvis-drawer-context .ctx-pill.dashboard{ background: rgba(168,85,247,0.18); color: #c084fc; }
.jarvis-drawer-context .ctx-muted {
    color: var(--text-muted);
    font-size: 0.68rem;
    font-style: italic;
}
.jarvis-drawer-context .ctx-details {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem 0.6rem;
    margin-top: 0.35rem;
    font-size: 0.66rem;
    color: var(--text-secondary);
}
.jarvis-drawer-context .ctx-detail {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
}

/* Today-stats widget — replaces the "Mode: Dashboard" filler when no
   position is in scope. Three counters (read / applied / held) so the
   strip carries useful info instead of repeating "you're on the dashboard". */
.jarvis-drawer-context .jarvis-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.4rem;
    margin-top: 0.3rem;
}
.jarvis-drawer-context .jarvis-stats .stat {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    padding: 0.35rem 0.45rem;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.05;
}
.jarvis-drawer-context .jarvis-stats .stat .stat-num {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}
.jarvis-drawer-context .jarvis-stats .stat .stat-lbl {
    font-size: 0.55rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-top: 0.1rem;
}
.jarvis-drawer-context .jarvis-stats .stat.success { border-color: rgba(34,197,94,0.45); }
.jarvis-drawer-context .jarvis-stats .stat.success .stat-num { color: var(--accent-green); }
.jarvis-drawer-context .jarvis-stats .stat.warn    { border-color: rgba(245,158,11,0.45); }
.jarvis-drawer-context .jarvis-stats .stat.warn    .stat-num { color: var(--accent-yellow); }

/* Body — scrollable file list */
.jarvis-drawer-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 0.9rem 1rem 1rem;
    min-height: 120px;
}

/* Drop zone — refined: bigger icon, more breathing room */
.jarvis-drop {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.4rem 1rem 1.2rem;
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 0.9rem;
    transition: all 0.18s ease;
    cursor: pointer;
    display: block;
    background: rgba(255, 255, 255, 0.01);
}
.jarvis-drop:hover {
    border-color: var(--accent-orange);
    color: var(--text-primary);
    background: rgba(249, 115, 22, 0.04);
}
.jarvis-drop.drag-over {
    border-color: var(--accent-orange);
    background: rgba(249, 115, 22, 0.1);
    color: var(--accent-orange);
    transform: scale(1.01);
}
.jarvis-drop .drop-icon {
    font-size: 1.6rem;
    line-height: 1;
    margin-bottom: 0.45rem;
    filter: grayscale(0.2);
}
.jarvis-drop.drag-over .drop-icon { filter: none; }
.jarvis-drop .drop-headline {
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.2rem;
    letter-spacing: 0.01em;
}
.jarvis-drop .drop-tip {
    font-size: 0.66rem;
    color: var(--text-muted);
    line-height: 1.4;
}
.jarvis-drop .drop-filename {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 0.7rem;
    margin-top: 0.45rem;
    color: var(--accent-orange);
    font-weight: 600;
}
.jarvis-drop input[type="file"] { display: none; }

/* Slot rows */
.jarvis-row {
    display: flex;
    gap: 0.55rem;
    padding: 0.6rem 0.7rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 0.5rem;
    background: var(--bg-primary);
    position: relative;
    overflow: hidden;
}
.jarvis-row.working { border-color: var(--accent-orange); }
.jarvis-row.working::after {
    content: '';
    position: absolute; bottom: 0; left: 0;
    height: 2px;
    background: var(--accent-orange);
    animation: jarvisProgress 1.5s linear infinite;
}
@keyframes jarvisProgress {
    0% { width: 0; }
    50% { width: 65%; }
    100% { width: 100%; }
}
.jarvis-row.done   { border-color: var(--accent-green); }
.jarvis-row.dup    { border-color: var(--accent-red); }
.jarvis-row.review { border-color: var(--accent-yellow); }
.jarvis-row.fail   { border-color: var(--accent-red); }
.jarvis-row.reverted { border-color: var(--text-muted); opacity: 0.7; }
.jarvis-row .row-num {
    flex: 0 0 auto;
    width: 22px; height: 22px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.7rem; font-weight: 600;
}
.jarvis-row .row-content { flex: 1 1 auto; min-width: 0; }
.jarvis-row .row-name {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 0.7rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.jarvis-row .row-meta {
    display: flex; gap: 0.4rem; align-items: center;
    margin-top: 0.25rem;
    font-size: 0.65rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}
.jarvis-row .doc-badge {
    font-size: 0.58rem;
    font-weight: 700;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.jarvis-row .doc-badge.T1, .jarvis-row .doc-badge.T2, .jarvis-row .doc-badge.T2L { background: rgba(99,102,241,0.18); color: #a5b4fc; }
.jarvis-row .doc-badge.EXA, .jarvis-row .doc-badge.EX1 { background: rgba(245,158,11,0.18); color: #fbbf24; }
.jarvis-row .doc-badge.EXA_FROM_STG { background: rgba(194,65,12,0.22); color: #fb923c; }
.jarvis-row .doc-badge.IM_A, .jarvis-row .doc-badge.IM_B { background: rgba(34,197,94,0.18); color: #4ade80; }
.jarvis-row .doc-badge.IM_A_STG, .jarvis-row .doc-badge.IM_B_STG { background: rgba(168,85,247,0.18); color: #c084fc; }
.jarvis-row .doc-badge.UNKNOWN { background: var(--bg-tertiary); color: var(--text-muted); }

/* Speech chip — JARVIS narrating */
.jarvis-speech {
    background: rgba(249, 115, 22, 0.07);
    border: 1px solid rgba(249, 115, 22, 0.28);
    border-radius: var(--radius-sm);
    padding: 0.4rem 0.55rem;
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: 0.45rem;
    line-height: 1.45;
}
.jarvis-speech::before {
    content: '✦ ';
    color: var(--accent-orange);
    font-weight: 700;
}
.jarvis-speech.warn { background: rgba(245,158,11,0.07); border-color: rgba(245,158,11,0.28); }
.jarvis-speech.warn::before { color: var(--accent-yellow); }
.jarvis-speech.fail { background: rgba(239,68,68,0.08); border-color: rgba(239,68,68,0.28); }
.jarvis-speech.fail::before { color: var(--accent-red); }

/* Two-row score block: PDF-read score + DB-match score
   ──────────────────────────────────────────────────────
   The two metrics are conceptually distinct: read = how cleanly
   JARVIS parsed the PDF; match = how well it maps to a DB position.
   Showing them side-by-side prevents the "we read it well so it
   looks ready to apply" illusion when no DB match exists. */
.jarvis-score-row {
    display: grid;
    grid-template-columns: 60px 1fr 38px;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.35rem;
    font-size: 0.62rem;
    color: var(--text-muted);
    line-height: 1;
}
.jarvis-score-row .score-label {
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    color: var(--text-secondary);
}
.jarvis-score-row .score-pct {
    text-align: right;
    font-weight: 700;
    font-size: 0.68rem;
    font-variant-numeric: tabular-nums;
}
.jarvis-score-row .score-pct.high { color: var(--accent-green); }
.jarvis-score-row .score-pct.mid  { color: var(--accent-yellow); }
.jarvis-score-row .score-pct.low  { color: var(--accent-red); }
.jarvis-read-row .jarvis-match-meter > div {
    /* PDF-read meter uses a quieter blue→green gradient so visually it
       reads as a "quality" bar rather than the orange "match" stoplight. */
    background: linear-gradient(90deg, #475569, #64748b, #14b8a6);
}

.jarvis-match-meter {
    height: 4px;
    border-radius: 2px;
    background: var(--bg-tertiary);
    overflow: hidden;
    margin-top: 0;
}
.jarvis-match-meter > div {
    height: 100%;
    transition: width 0.3s ease;
    background: linear-gradient(90deg, var(--accent-red), var(--accent-yellow), var(--accent-green));
}

/* Per-slot action buttons */
.jarvis-row-actions {
    display: flex;
    gap: 0.3rem;
    margin-top: 0.45rem;
    flex-wrap: wrap;
}
.jarvis-row-actions button {
    padding: 0.2rem 0.55rem;
    font-size: 0.65rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 3px;
    color: var(--text-secondary);
    cursor: pointer;
    font-family: inherit;
}
.jarvis-row-actions button:hover { color: var(--accent-orange); border-color: var(--accent-orange); }
.jarvis-row-actions button.primary {
    background: var(--accent-orange);
    color: #1a0f00;
    border-color: var(--accent-orange);
    font-weight: 600;
}
.jarvis-row-actions button.danger { color: var(--accent-red); border-color: rgba(239,68,68,0.4); }

/* Empty drop slots */
.jarvis-empty-slot {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.5rem 0.65rem;
    font-size: 0.7rem;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 0.4rem;
}

/* ── Bottom: decision-card conversation log ──
   Capped at 230px max-height with internal scroll. */
.jarvis-conv-log {
    flex: 0 0 auto;
    max-height: 230px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
}
.jarvis-conv-log-header {
    padding: 0.5rem 0.95rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    flex: 0 0 auto;
    background: var(--bg-secondary);
}
.jarvis-conv-log-header .live-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--accent-green);
    box-shadow: 0 0 6px var(--accent-green);
    animation: jarvisLivePulse 2s infinite;
    margin-right: 0.4rem;
    display: inline-block;
}
@keyframes jarvisLivePulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.35; }
}
.jarvis-conv-log-header .conv-meta {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
}
.jarvis-conv-log-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 0.5rem 0.7rem 0.6rem;
    min-height: 0;
}

/* Decision card — collapsible. Default cursor is the auto/text cursor so
   the operator can select text inside the expanded body without the whole
   card flagging itself as a button. The `.dec-head` rule below promotes
   the header row to a pointer cursor — that's the only click target. */
.jarvis-decision-card {
    border: 1px solid var(--border-color);
    border-radius: 6px;
    margin-bottom: 0.4rem;
    background: var(--bg-secondary);
    cursor: default;
    transition: border-color 0.15s ease, background 0.15s ease;
}
.jarvis-decision-card .dec-head { cursor: pointer; user-select: none; }
.jarvis-decision-card .dec-lines { user-select: text; }
.jarvis-decision-card:hover { border-color: var(--text-muted); }
.jarvis-decision-card.success { border-left: 3px solid var(--accent-green); }
.jarvis-decision-card.warn    { border-left: 3px solid var(--accent-yellow); }
.jarvis-decision-card.fail    { border-left: 3px solid var(--accent-red); }
.jarvis-decision-card.info,
.jarvis-decision-card.detail  { border-left: 3px solid var(--text-muted); }
.jarvis-decision-card.expanded { background: var(--bg-tertiary); border-color: var(--accent-orange); }

.jarvis-decision-card .dec-head {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.6rem;
    font-size: 0.7rem;
}
.jarvis-decision-card .dec-verdict-icon {
    width: 14px; flex-shrink: 0; text-align: center;
    font-weight: 700;
}
.jarvis-decision-card .dec-verdict-icon.success { color: var(--accent-green); }
.jarvis-decision-card .dec-verdict-icon.warn    { color: var(--accent-yellow); }
.jarvis-decision-card .dec-verdict-icon.fail    { color: var(--accent-red); }
.jarvis-decision-card .dec-verdict-icon.info,
.jarvis-decision-card .dec-verdict-icon.detail  { color: var(--text-muted); }

.jarvis-decision-card .dec-name {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 0.66rem;
    color: var(--text-primary);
    flex: 1 1 auto;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.jarvis-decision-card .dec-badge {
    font-size: 0.55rem;
    font-weight: 700;
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    flex-shrink: 0;
    letter-spacing: 0.04em;
}
.jarvis-decision-card .dec-badge.T1, .jarvis-decision-card .dec-badge.T2, .jarvis-decision-card .dec-badge.T2L { background: rgba(99,102,241,0.18); color: #a5b4fc; }
.jarvis-decision-card .dec-badge.EXA, .jarvis-decision-card .dec-badge.EX1 { background: rgba(245,158,11,0.18); color: #fbbf24; }
.jarvis-decision-card .dec-badge.EXA_FROM_STG { background: rgba(194,65,12,0.22); color: #fb923c; }
.jarvis-decision-card .dec-badge.IM_A, .jarvis-decision-card .dec-badge.IM_B { background: rgba(34,197,94,0.18); color: #4ade80; }
.jarvis-decision-card .dec-badge.IM_A_STG, .jarvis-decision-card .dec-badge.IM_B_STG { background: rgba(168,85,247,0.18); color: #c084fc; }
.jarvis-decision-card .dec-badge.UNKNOWN { background: var(--bg-tertiary); color: var(--text-muted); }
.jarvis-decision-card .dec-score {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 0.62rem;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    padding: 0.05rem 0.35rem;
    border-radius: 3px;
    flex-shrink: 0;
}
.jarvis-decision-card .dec-verdict {
    font-size: 0.62rem;
    flex-shrink: 0;
    margin-left: auto;
    text-align: right;
    max-width: 130px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.jarvis-decision-card .dec-verdict.success { color: var(--accent-green); }
.jarvis-decision-card .dec-verdict.warn    { color: var(--accent-yellow); }
.jarvis-decision-card .dec-verdict.fail    { color: var(--accent-red); }
.jarvis-decision-card .dec-verdict.info,
.jarvis-decision-card .dec-verdict.detail  { color: var(--text-muted); }
.jarvis-decision-card .dec-toggle {
    color: var(--text-muted);
    font-size: 0.7rem;
    flex-shrink: 0;
    width: 12px;
    text-align: center;
    margin-left: 0.2rem;
}
.jarvis-decision-card.expanded .dec-toggle { color: var(--accent-orange); }

.jarvis-decision-card .dec-lines {
    border-top: 1px dashed var(--border-color);
    padding: 0.35rem 0.6rem 0.5rem;
    background: var(--bg-primary);
    border-radius: 0 0 6px 6px;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 0.62rem;
    line-height: 1.55;
}
.jarvis-decision-card .dec-line {
    display: flex;
    gap: 0.45rem;
    padding: 0.08rem 0;
    color: var(--text-secondary);
}
.jarvis-decision-card .dec-line .ts { color: var(--text-muted); flex: 0 0 50px; }
.jarvis-decision-card .dec-line .icon { width: 14px; flex-shrink: 0; text-align: center; }
.jarvis-decision-card .dec-line .text { flex: 1; word-break: break-word; }
.jarvis-decision-card .dec-line.success .text { color: var(--accent-green); }
.jarvis-decision-card .dec-line.warn    .text { color: var(--accent-yellow); }
.jarvis-decision-card .dec-line.fail    .text { color: var(--accent-red); }
.jarvis-decision-card .dec-line.action  .text { color: #a5b4fc; }
.jarvis-decision-card .dec-line.detail  .text { color: var(--text-muted); }
.jarvis-decision-card .dec-line.info    .text { color: var(--text-secondary); }

/* ── Manual coordination picker (held docs) ──
   Renders both on the slot card (.jarvis-row .dec-picker.slot-picker) and
   inside the expanded decision card (.jarvis-decision-card .dec-picker)
   when JARVIS could not auto-resolve a position. The operator searches by
   business_id / container / file_ref / MRN, picks a candidate, and JARVIS
   proceeds to write under their name. */
.jarvis-row .dec-picker,
.jarvis-decision-card .dec-picker {
    margin-top: 0.55rem;
    padding: 0.65rem;
    background: rgba(249, 115, 22, 0.06);
    border: 1px dashed rgba(249, 115, 22, 0.45);
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.dec-picker .picker-label {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    line-height: 1.1;
}
.dec-picker .picker-title {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--accent-orange);
    letter-spacing: 0.04em;
}
.dec-picker .picker-sub {
    font-size: 0.6rem;
    color: var(--text-muted);
}
.dec-picker .picker-search,
.dec-picker .picker-reason {
    width: 100%;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 0.4rem 0.55rem;
    font-size: 0.7rem;
    color: var(--text-primary);
    font-family: inherit;
    outline: none;
}
.dec-picker .picker-search:focus,
.dec-picker .picker-reason:focus {
    border-color: var(--accent-orange);
}
.dec-picker .picker-results {
    max-height: 160px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}
.dec-picker .picker-result {
    text-align: left;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 0.35rem 0.55rem;
    font-size: 0.66rem;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    font-family: inherit;
    transition: all 0.12s ease;
}
.dec-picker .picker-result:hover {
    border-color: var(--accent-orange);
    color: var(--text-primary);
}
.dec-picker .picker-result.selected {
    background: rgba(249, 115, 22, 0.16);
    border-color: var(--accent-orange);
    color: var(--accent-orange);
    font-weight: 600;
}
.dec-picker .picker-result .result-bits {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.dec-picker .picker-result .result-id {
    flex: 0 0 auto;
    font-variant-numeric: tabular-nums;
    color: var(--text-muted);
    font-size: 0.6rem;
}
.dec-picker .picker-hint {
    font-size: 0.62rem;
    color: var(--text-muted);
    font-style: italic;
    padding: 0.3rem 0;
}
.dec-picker .picker-hint.fail { color: var(--accent-red); font-style: normal; }
.dec-picker .picker-apply {
    background: var(--accent-orange);
    color: #1a0f00;
    border: none;
    border-radius: 4px;
    padding: 0.45rem 0.6rem;
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: opacity 0.12s ease, transform 0.08s ease;
    text-align: center;
}
.dec-picker .picker-apply:disabled {
    background: var(--bg-tertiary);
    color: var(--text-muted);
    cursor: not-allowed;
}
.dec-picker .picker-apply:not(:disabled):hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(249, 115, 22, 0.35);
}

/* ── Multi-position bulk checklist (v0.29) ──
   Shown when one MRN doc resolves to ≥ 2 positions (multi-container manifest).
   Operator (un)checks rows, the weight tally + button label update live, then
   confirms with one click. */
.dec-picker.slot-bulk .bulk-rows {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    max-height: 200px;
    overflow-y: auto;
}
.dec-picker.slot-bulk .bulk-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.7rem;
    cursor: pointer;
    transition: border-color 0.12s ease, background 0.12s ease;
}
.dec-picker.slot-bulk .bulk-row:hover { border-color: var(--accent-orange); }
.dec-picker.slot-bulk .bulk-row.unresolved {
    background: rgba(239, 68, 68, 0.06);
    border-color: rgba(239, 68, 68, 0.35);
    color: var(--accent-red);
    font-style: italic;
    cursor: default;
}
.dec-picker.slot-bulk .bulk-row-cb { flex: 0 0 auto; cursor: pointer; }
.dec-picker.slot-bulk .bulk-row-id {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-weight: 700;
    color: var(--text-primary);
}
.dec-picker.slot-bulk .bulk-row-cnt { font-family: 'JetBrains Mono', ui-monospace, monospace; color: var(--text-secondary); }
.dec-picker.slot-bulk .bulk-row-ref { color: var(--accent-orange); font-size: 0.62rem; }
.dec-picker.slot-bulk .bulk-row-score {
    margin-left: auto;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 0.06rem 0.4rem;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    font-variant-numeric: tabular-nums;
}
.dec-picker.slot-bulk .bulk-row-score.score-high { color: #4ade80; border-color: rgba(34,197,94,0.45); background: rgba(34,197,94,0.10); }
.dec-picker.slot-bulk .bulk-row-score.score-mid  { color: #fbbf24; border-color: rgba(245,158,11,0.45); background: rgba(245,158,11,0.10); }
.dec-picker.slot-bulk .bulk-row-score.score-low  { color: #fca5a5; border-color: rgba(239,68,68,0.45); background: rgba(239,68,68,0.10); }
.dec-picker.slot-bulk .bulk-row-warn {
    font-size: 0.6rem;
    color: var(--accent-yellow);
    margin-left: 0.4rem;
    font-style: italic;
}

.dec-picker.slot-bulk .bulk-weight-tally {
    margin-top: 0.5rem;
    padding: 0.4rem 0.5rem;
    border-radius: 4px;
    font-size: 0.65rem;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    font-variant-numeric: tabular-nums;
}
.dec-picker.slot-bulk .bulk-weight-tally.match { border-color: var(--accent-green); color: var(--accent-green); }
.dec-picker.slot-bulk .bulk-weight-tally.warn  { border-color: var(--accent-yellow); color: var(--accent-yellow); }
.dec-picker.slot-bulk .bulk-weight-tally.fail  { border-color: var(--accent-red); color: var(--accent-red); }
.dec-picker.slot-bulk .bulk-sum, .dec-picker.slot-bulk .bulk-delta { font-weight: 700; }

.dec-picker.slot-bulk .bulk-apply {
    background: var(--accent-orange);
    color: #1a0f00;
    border: none;
    border-radius: 4px;
    padding: 0.5rem 0.7rem;
    font-size: 0.74rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    margin-top: 0.5rem;
    transition: opacity 0.12s ease, transform 0.08s ease;
}
.dec-picker.slot-bulk .bulk-apply:disabled {
    background: var(--bg-tertiary);
    color: var(--text-muted);
    cursor: not-allowed;
}
.dec-picker.slot-bulk .bulk-apply:not(:disabled):hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(249, 115, 22, 0.35);
}

/* Empty state */
.jarvis-conv-empty {
    color: var(--text-muted);
    font-style: italic;
    padding: 0.6rem 0.4rem;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 0.7rem;
    text-align: center;
}

/* Light theme tweaks */
[data-theme="light"] .jarvis-drawer { background: #ffffff; border-left-color: #d6e2ea; }
[data-theme="light"] .jarvis-drawer-header { background: linear-gradient(135deg, rgba(196, 122, 20, 0.08), transparent 70%); }
[data-theme="light"] .jarvis-fab-trigger { background: #eef4f8; border-color: #d6e2ea; color: #33465a; }
[data-theme="light"] .jarvis-fab-trigger:hover { color: #c47a14; border-color: #c47a14; background: rgba(196, 122, 20, 0.08); }
[data-theme="light"] .jarvis-conv-log { background: #f8fbfd; }
[data-theme="light"] .jarvis-decision-card { background: #ffffff; }
[data-theme="light"] .jarvis-decision-card.expanded { background: #f0f7fa; }
