/**
 * mobile_workbench_v4.css — chrome for the mobile Trade Workbench shell.
 * Styles only the mobile-owned shell (overlay, header, bottom tab bar, FAB,
 * sheets, filter chips). The trade cards + editor are the SHARED .jt-wb-*
 * markup from trade_workbench_v4.css (already loaded); we add only light,
 * scoped touch-ups for the full-width mobile context.
 */

/* Lock the page behind the full-screen overlay. */
body.mwb-lock-scroll { overflow: hidden; }

.mwb-overlay {
    position: fixed;
    inset: 0;
    /* Above the mobile bottom toolbar (1000) + its panels (1100), but BELOW the
       surfaces this shell opens on top of itself: the Compare modal (1150), the
       Thread overlay (1200), the eval modal (9000) and the pitch composer
       (99999). Desktop dodges Compare's z-order by minimizing to a pill; mobile
       instead sits under it. */
    z-index: 1130;
    display: flex;
    flex-direction: column;
    background: var(--jt-bg-primary, #0f172a);
    color: var(--jt-text-primary, #e2e8f0);
}

/* ── Header ─────────────────────────────────────────────────────────────── */
.mwb-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    background: linear-gradient(90deg, #134e4a, #155e75);
    flex: 0 0 auto;
}
.mwb-hicon { font-size: 1.15rem; }
.mwb-title { font-size: 1.02rem; font-weight: 700; flex: 1; color: #fff; }
.mwb-header .mwb-help.jt-help-i { color: #cbd5e1; border-color: #94a3b8; }
.mwb-x {
    background: none; border: none; color: #cbd5e1;
    font-size: 1.15rem; padding: 2px 6px; cursor: pointer;
}

/* ── Perspective strip (Trades tab) ─────────────────────────────────────── */
.mwb-persp {
    padding: 7px 14px;
    background: var(--jt-bg-secondary, #172033);
    border-bottom: 1px solid var(--jt-border-primary, #334155);
    font-size: 0.76rem;
    color: var(--jt-text-secondary, #94a3b8);
    flex: 0 0 auto;
}
.mwb-persp[hidden] { display: none; }
.mwb-persp b { color: var(--jt-text-primary, #e2e8f0); font-weight: 600; }

/* ── Body (scroll region) ───────────────────────────────────────────────── */
.mwb-body {
    flex: 1 1 auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 8px 12px calc(14px + env(safe-area-inset-bottom, 0px));
}

/* ── Filter chips (Trades) ──────────────────────────────────────────────── */
.mwb-chips {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 2px 0 10px;
    scrollbar-width: none;
}
.mwb-chips::-webkit-scrollbar { display: none; }
.mwb-chip {
    flex: 0 0 auto;
    font-size: 0.72rem;
    padding: 5px 11px;
    border-radius: 14px;
    background: var(--jt-bg-secondary, #243247);
    color: var(--jt-text-secondary, #94a3b8);
    border: 1px solid transparent;
    white-space: nowrap;
    cursor: pointer;
}
.mwb-chip.on {
    background: rgba(29, 158, 117, 0.16);
    color: #7fe0c0;
    border-color: rgba(29, 158, 117, 0.4);
}

/* ── Trades list — reuses .jt-wb-tc cards, full-width + roomier taps ─────── */
.mwb-list .jt-wb-tc { margin-bottom: 10px; }
.mwb-list .jt-wb-tc-body { padding: 11px 12px; }
.mwb-list .jt-wb-tc-r1 { gap: 8px; margin-bottom: 5px; }
.mwb-list .jt-wb-tc-cmp { width: 20px; height: 20px; }
.mwb-list .jt-wb-tc-ic { font-size: 15px; padding: 4px 4px; opacity: .7; }
.mwb-list .jt-wb-tc-nm { font-size: 14px; }
.mwb-empty {
    text-align: center;
    color: var(--jt-text-muted, #64748b);
    font-size: 0.85rem;
    padding: 2.5rem 1rem;
    line-height: 1.5;
}

/* ── Editor screen ──────────────────────────────────────────────────────── */
.mwb-ed-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: -2px 0 8px;
}
.mwb-back {
    background: none; border: none; color: var(--jt-text-secondary, #cbd5e1);
    font-size: 1.6rem; line-height: 1; padding: 0 4px; cursor: pointer;
}
.mwb-ed-title { font-weight: 600; font-size: 0.95rem; }
/* The shared editor stacks legs on its own (@media in trade_workbench_v4.css);
   just let the action buttons wrap and fill on a phone. */
.mwb-editor .jt-wb-buildfoot { flex-wrap: wrap; }
.mwb-editor .jt-wb-buildfoot .jt-wb-btn { flex: 1 1 46%; }
.mwb-editor .jt-wb-buildhead { flex-wrap: wrap; }

/* ── Compare FAB ────────────────────────────────────────────────────────── */
.mwb-fab {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: calc(64px + env(safe-area-inset-bottom, 0px));
    z-index: 4;
    background: var(--jt-accent-green, #1d9e75);
    color: #fff;
    font-weight: 700;
    font-size: 0.86rem;
    text-align: center;
    padding: 13px;
    border: none;
    border-radius: 11px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
    cursor: pointer;
}
.mwb-fab[hidden] { display: none; }

/* ── Bottom tab bar ─────────────────────────────────────────────────────── */
.mwb-tabbar {
    display: flex;
    flex: 0 0 auto;
    background: var(--jt-bg-secondary, #1e293b);
    border-top: 1px solid var(--jt-border-primary, #334155);
    padding-bottom: env(safe-area-inset-bottom, 0px);
}
.mwb-bt {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 8px 2px 9px;
    font-size: 0.62rem;
    color: var(--jt-text-secondary, #94a3b8);
    background: none;
    border: none;
    position: relative;
    cursor: pointer;
}
.mwb-bt-ic { font-size: 1.15rem; line-height: 1; }
.mwb-bt--on { color: var(--jt-text-primary, #fff); }
.mwb-bt--on::before {
    content: "";
    position: absolute;
    top: 0; left: 22%; right: 22%;
    height: 2.5px;
    background: var(--jt-accent-green, #1d9e75);
    border-radius: 0 0 3px 3px;
}
.mwb-bdot {
    position: absolute;
    top: 4px;
    right: calc(50% - 22px);
    min-width: 15px;
    height: 15px;
    border-radius: 8px;
    background: #ef4444;
    color: #fff;
    font-size: 0.55rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}
.mwb-bdot.pur { background: #8b5cf6; }

/* ── Bottom sheets (⋯ More, perspective picker) ─────────────────────────── */
.mwb-sheet-scrim {
    position: absolute;
    inset: 0;
    z-index: 6;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: flex-end;
}
.mwb-sheet {
    width: 100%;
    background: var(--jt-bg-secondary, #1e293b);
    border-radius: 16px 16px 0 0;
    border-top: 1px solid var(--jt-border-primary, #334155);
    padding: 8px 0 calc(12px + env(safe-area-inset-bottom, 0px));
    max-height: 70vh;
    overflow-y: auto;
}
.mwb-sheet-grip {
    width: 36px; height: 4px; border-radius: 2px;
    background: #475569; margin: 6px auto 10px;
}
.mwb-sheet-h {
    padding: 4px 18px 8px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--jt-text-muted, #64748b);
}
.mwb-sheet-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 14px 18px;
    font-size: 0.92rem;
    background: none;
    border: none;
    color: var(--jt-text-primary, #e2e8f0);
    text-align: left;
    cursor: pointer;
}
.mwb-sheet-item:active { background: rgba(255, 255, 255, 0.05); }
.mwb-sheet-item .ic { font-size: 1.15rem; width: 24px; text-align: center; }
.mwb-sheet-cnt { margin-left: auto; font-size: 0.7rem; color: var(--jt-text-muted, #64748b); }
