:root {
    --bg: #0b0e14;
    --surface: #0f131b;
    --surface-2: #161c28;
    --border: #252e40;
    --text: #dce3f0;
    --dim: #6f7c96;
    --accent: #38bdf8;
    --green: #4ade80;
    --yellow: #facc15;
    --blue: #60a5fa;
    --magenta: #c084fc;
    --red: #f87171;
    --select-bg: #1e293b;
    --select-text: #38bdf8;
    --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

body.fallout {
    --bg: #030a04;
    --surface: #040d05;
    --surface-2: #081c0a;
    --border: #1b5e20;
    --text: #22ff66;
    --dim: #1b8c38;
    --accent: #5cff8d;
    --green: #22ff66;
    --yellow: #7dff9c;
    --blue: #39d966;
    --magenta: #5cff8d;
    --red: #7dff9c;
    --select-bg: #22ff66;
    --select-text: #030a04;
    text-shadow: 0 0 6px rgba(34, 255, 102, 0.35);
}

body.fallout::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.16) 0px,
        rgba(0, 0, 0, 0.16) 1px,
        transparent 1px,
        transparent 3px
    );
    z-index: 9999;
}

* { box-sizing: border-box; }
html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-mono);
    font-size: clamp(11px, 1.02vw, 13px);
    line-height: 1.35;
    height: 100vh;
    height: 100dvh;
    width: 100%;
    overflow: hidden;
}
body {
    display: flex;
    flex-direction: column;
}

.hidden { display: none !important; }
.dim { color: var(--dim); }
.bold { font-weight: 700; }
.small { font-size: 12px; }
.c-cyan { color: var(--accent); }
.c-green { color: var(--green); }
.c-yellow { color: var(--yellow); }
.c-blue { color: var(--blue); }
.c-magenta { color: var(--magenta); }
.c-red { color: var(--red); }

.fallout-only { display: none; }
body.fallout .fallout-only {
    display: block;
    flex-shrink: 0;
    padding: 5px 14px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    font-size: 11px;
    letter-spacing: 0.04em;
}

#boot-overlay {
    position: fixed;
    inset: 0;
    background: #030a04;
    color: #22ff66;
    font-family: var(--font-mono);
    padding: 28px;
    z-index: 10000;
    font-size: 13px;
    text-shadow: 0 0 8px rgba(34, 255, 102, 0.5);
}

/* Buttons & Inputs */
button, .btn, input, textarea {
    font-family: var(--font-mono);
    font-size: 13px;
}
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 4px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    cursor: pointer;
    text-decoration: none;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #05080f; font-weight: 700; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--dim); }
.btn.ghost:hover { color: var(--text); background: var(--surface-2); }
.btn.sm { padding: 3px 8px; font-size: 12px; }
.btn.lg { padding: 9px 16px; }

input, textarea {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 4px;
    padding: 6px 9px;
}
input:focus, textarea:focus { outline: none; border-color: var(--accent); }

/* Gate / Terminal Paywall */
.gate-shell {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
}
.term-mobile-brand {
    display: none;
    color: var(--accent);
    font-weight: 700;
    font-size: 15px;
    letter-spacing: 0.06em;
    margin: 4px 0 10px;
}
.term-window {
    width: 100%;
    max-width: 790px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}
body.fallout .term-window {
    border-color: var(--accent);
    box-shadow: 0 0 24px rgba(34, 255, 102, 0.15);
}
.term-titlebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 14px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    font-size: 12px;
    color: var(--dim);
}
.term-dots { display: flex; gap: 7px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot.red { background: #ff5f56; }
.dot.yellow { background: #ffbd2e; }
.dot.green { background: #27c93f; }
body.fallout .dot { background: var(--accent); opacity: 0.7; }
.term-body { padding: 20px 22px 24px; }
.term-line { margin-bottom: 10px; font-weight: 700; }
.prompt { color: var(--green); margin-right: 6px; }
.accent { color: var(--accent); font-weight: 700; }
.term-ascii {
    margin: 0 0 12px;
    font-size: clamp(5px, 0.92vw, 9px);
    line-height: 1.12;
    color: var(--accent);
    overflow: hidden;
}
.term-meta { margin-bottom: 14px; font-size: 12px; display: flex; flex-direction: column; gap: 3px; }
.term-box {
    border: 1px dashed var(--border);
    border-radius: 4px;
    padding: 10px 12px;
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 12px;
}
.gate-step { border-top: 1px dashed var(--border); padding-top: 14px; margin-top: 12px; }
.gate-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.restore-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.prompt-inline { color: var(--dim); font-size: 12px; white-space: nowrap; }
.restore-row input { flex: 1; }
.cursor {
    display: inline-block;
    width: 8px;
    height: 13px;
    background: var(--accent);
    vertical-align: middle;
    margin-left: 4px;
    animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.alert { padding: 8px 12px; border-radius: 4px; margin-bottom: 12px; font-size: 12px; }
.alert.error { background: rgba(248, 113, 113, 0.12); border: 1px solid var(--red); color: var(--red); }
.alert.success { background: rgba(74, 222, 128, 0.12); border: 1px solid var(--green); color: var(--green); }

/* FULL-SCREEN CLI TERMINAL WORKSPACE */
.cli-app {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    width: 100%;
    overflow: hidden;
    padding-bottom: env(safe-area-inset-bottom, 0px);
}
.cli-screen {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 10px 14px 6px;
}
.cli-scroll-region {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
}
.cli-header-line {
    font-weight: 700;
    margin-bottom: 3px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
    overflow: hidden;
}
.cli-header-line > span:first-child {
    overflow: hidden;
    text-overflow: ellipsis;
}
.cli-subline {
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cli-divider {
    color: var(--dim);
    border: none;
    border-top: 1px solid var(--border);
    margin: 5px 0;
    flex-shrink: 0;
}
.cli-divider-heavy {
    border: none;
    border-top: 2px solid var(--border);
    margin: 5px 0;
    flex-shrink: 0;
}

/* CLI Table */
.cli-table {
    width: 100%;
    max-width: 100%;
    border-collapse: collapse;
    margin: 4px 0 6px;
    table-layout: fixed;
}
.cli-table th {
    text-align: left;
    color: var(--text);
    font-weight: 700;
    padding: 3px 6px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cli-table td {
    padding: 3px 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cli-table tbody tr { cursor: pointer; }
.cli-table tbody tr:hover { background: rgba(255, 255, 255, 0.03); }
.cli-table tbody tr.active {
    background: var(--select-bg);
    color: var(--select-text);
    font-weight: 700;
}
.cli-table tbody tr.active * {
    color: var(--select-text) !important;
}
.col-ptr { width: 22px; text-align: center; padding-left: 0 !important; padding-right: 0 !important; }
.col-sel { width: 28px; text-align: center; padding-left: 0 !important; padding-right: 0 !important; }

.stage-new { color: var(--dim); }
.stage-contacted { color: var(--blue); }
.stage-engaged { color: var(--yellow); }
.stage-qualified { color: var(--green); }
.stage-disqualified { color: var(--red); }
.stage-archived { color: var(--dim); }

/* Detail & Email Views */
.cli-kv {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    margin: 1px 0;
}
.cli-note-preview {
    padding-left: 10px;
    border-left: 2px solid var(--border);
    margin: 3px 0;
    color: var(--text);
    white-space: pre-wrap;
    max-height: 4.4em;
    overflow: hidden;
}
.cli-email-body {
    white-space: pre-wrap;
    word-break: break-word;
    margin: 8px 0;
    padding: 6px 0;
    line-height: 1.45;
}

/* Bottom Inline Prompt & Footer */
.cli-prompt-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 14px;
    background: var(--surface-2);
    border-top: 1px solid var(--accent);
    flex-shrink: 0;
}
.prompt-label { color: var(--accent); font-weight: 700; white-space: nowrap; }
.cli-prompt-bar input {
    flex: 1;
    background: var(--bg);
    border: 1px solid var(--border);
    padding: 3px 8px;
}

.cli-footer {
    padding: 6px 14px;
    background: var(--surface);
    border-top: 1px solid var(--border);
    color: var(--dim);
    font-size: clamp(10.5px, 0.95vw, 12px);
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex-shrink: 0;
}
.cli-nav-row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
}
.hotkey {
    cursor: pointer;
    white-space: nowrap;
}
.hotkey:hover { color: var(--text); }
.hotkey b { color: var(--text); font-weight: 600; }

/* Inline Terminal Panes (Zero Popups / No Modal Backdrops) */
.cli-inline-pane {
    flex-shrink: 0;
    background: var(--surface);
    border-top: 2px solid var(--accent);
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 52vh;
    overflow-y: auto;
}
.cli-pane-title {
    font-weight: 700;
    color: var(--accent);
    white-space: pre-wrap;
    border-bottom: 1px solid var(--border);
    padding-bottom: 5px;
}
.cli-menu-list {
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.cli-menu-item {
    padding: 3px 8px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    gap: 12px;
}
.cli-menu-item:hover { background: rgba(255, 255, 255, 0.04); }
.cli-menu-item.active {
    background: var(--select-bg);
    color: var(--select-text);
    font-weight: 700;
}
.cli-menu-item.active * { color: var(--select-text) !important; }
.cli-pane-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border);
    padding-top: 5px;
}
.btn-group { display: flex; gap: 8px; }

/* Docked Persistent Bottom Terminal Console (Resizable) */
.cli-console {
    flex-shrink: 0;
    height: 110px;
    min-height: 26px;
    max-height: 60vh;
    background: #07090e;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    font-size: 12px;
    position: relative;
}
body.fallout .cli-console {
    background: #020803;
    border-top-color: var(--border);
}
.cli-console-resizer {
    height: 5px;
    cursor: ns-resize;
    background: transparent;
    position: absolute;
    top: -3px;
    left: 0;
    right: 0;
    z-index: 5;
}
.cli-console-resizer:hover,
.cli-console-resizer.dragging {
    background: var(--accent);
    opacity: 0.6;
}
.cli-console-bar {
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 3px 14px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    color: var(--dim);
    font-size: 10.5px;
    letter-spacing: 0.05em;
    user-select: none;
}
.cli-console-lines {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 4px 14px;
    display: block;
}
.log-line {
    display: block;
    line-height: 1.45;
    padding: 1px 0;
    white-space: pre-wrap;
    word-break: break-word;
}
.log-line.err { color: var(--red); }
.log-line.ok { color: var(--green); }
.log-line.warn { color: var(--yellow); }
.log-line.info { color: var(--dim); }

.cli-desktop-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.cli-mobile-nav {
    display: none;
}
.m-app {
    display: none;
}

/* =========================================================
   NATIVE MOBILE APP EXPERIENCE (<= 768px)
   Desktop (>768px) remains 100% the keyboard CLI terminal.
   ========================================================= */
@media (max-width: 768px) {
    html, body {
        font-size: 14px;
        font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
    }
    body.fallout {
        font-family: var(--font-mono);
    }

    /* Hide desktop terminal workspace on mobile; show native mobile app */
    #app-view {
        display: none !important;
    }
    .m-app:not(.hidden) {
        display: flex;
        flex-direction: column;
        flex: 1;
        min-height: 0;
        width: 100%;
        background: var(--bg);
        position: relative;
        overflow: hidden;
    }

    /* Landing page mobile polish */
    .gate-shell {
        padding: 12px;
        align-items: flex-start;
        font-family: var(--font-mono);
    }
    .term-window { border-radius: 10px; }
    .term-titlebar { padding: 8px 12px; font-size: 11px; }
    .term-body { padding: 14px; font-size: 13px; }
    .term-ascii { display: none; }
    .term-mobile-brand { display: block; }
    .term-box { padding: 10px 12px; font-size: 12px; gap: 6px; }
    .restore-row { flex-direction: column; align-items: stretch; gap: 6px; }
    .gate-actions .btn, .restore-row .btn { width: 100%; min-height: 44px; justify-content: center; }

    /* Prevent iOS Safari zoom on input focus */
    input, textarea, select { font-size: 16px; }

    /* Native Top Bar (Gmail-style search pill + chips) */
    .m-topbar {
        flex-shrink: 0;
        background: var(--surface);
        border-bottom: 1px solid var(--border);
        padding: 10px 12px 8px;
        display: flex;
        flex-direction: column;
        gap: 8px;
        z-index: 10;
    }
    .m-search-pill {
        display: flex;
        align-items: center;
        gap: 8px;
        background: var(--surface-2);
        border: 1px solid var(--border);
        border-radius: 999px;
        padding: 6px 12px;
    }
    .m-search-pill input {
        flex: 1;
        background: transparent;
        border: none;
        padding: 2px 0;
        color: var(--text);
        font-size: 15px;
        min-width: 0;
    }
    .m-search-pill input:focus { outline: none; }
    .m-status-dot {
        width: 9px;
        height: 9px;
        border-radius: 50%;
        flex-shrink: 0;
        background: var(--green);
    }
    .m-status-dot.offline { background: var(--red); }
    .m-status-dot.pending { background: var(--yellow); }

    .m-seg-row {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
    }
    .m-segmented {
        display: inline-flex;
        background: var(--surface-2);
        border: 1px solid var(--border);
        border-radius: 8px;
        padding: 2px;
        flex: 1;
    }
    .m-seg-btn {
        flex: 1;
        border: none;
        background: transparent;
        color: var(--dim);
        padding: 6px 8px;
        border-radius: 6px;
        font-size: 12.5px;
        font-weight: 600;
        cursor: pointer;
    }
    .m-seg-btn.active {
        background: var(--accent);
        color: #05080f;
    }

    .m-chips {
        display: flex;
        gap: 6px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 2px;
    }
    .m-chips::-webkit-scrollbar { display: none; }
    .m-chip {
        flex-shrink: 0;
        background: var(--surface-2);
        border: 1px solid var(--border);
        color: var(--dim);
        border-radius: 999px;
        padding: 5px 11px;
        font-size: 12px;
        font-weight: 500;
        cursor: pointer;
    }
    .m-chip.active {
        background: var(--select-bg);
        color: var(--select-text);
        border-color: var(--accent);
        font-weight: 700;
    }

    /* Pull-to-refresh banner */
    .m-pull-indicator {
        height: 0;
        overflow: hidden;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 12px;
        color: var(--accent);
        background: var(--surface);
        transition: height 0.15s ease;
        flex-shrink: 0;
    }
    .m-pull-indicator.visible {
        height: 34px;
        border-bottom: 1px solid var(--border);
    }

    /* Main Infinite-Scroll Feed */
    .m-content {
        flex: 1;
        min-height: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 84px;
    }

    /* Gmail-style Contact Card with Swipe */
    .m-card-wrap {
        position: relative;
        overflow: hidden;
        border-bottom: 1px solid var(--border);
    }
    .m-card-bg {
        position: absolute;
        inset: 0;
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0 20px;
        font-size: 12px;
        font-weight: 700;
        pointer-events: none;
    }
    .m-card-bg-left { color: var(--green); }
    .m-card-bg-right { color: var(--yellow); }

    .m-card {
        position: relative;
        background: var(--bg);
        padding: 12px 14px;
        display: flex;
        align-items: flex-start;
        gap: 12px;
        transition: transform 0.18s ease;
        cursor: pointer;
    }
    .m-card.selected {
        background: rgba(56, 189, 248, 0.12);
    }
    .m-avatar {
        width: 42px;
        height: 42px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: 700;
        font-size: 15px;
        flex-shrink: 0;
        border: 1.5px solid var(--border);
        background: var(--surface-2);
        color: var(--text);
        user-select: none;
    }
    .m-avatar.checked {
        background: var(--accent);
        color: #05080f;
        border-color: var(--accent);
    }
    .m-avatar.stage-qualified { border-color: var(--green); color: var(--green); }
    .m-avatar.stage-engaged { border-color: var(--yellow); color: var(--yellow); }
    .m-avatar.stage-contacted { border-color: var(--blue); color: var(--blue); }
    .m-avatar.stage-disqualified { border-color: var(--red); color: var(--red); }

    .m-card-main {
        flex: 1;
        min-width: 0;
        display: flex;
        flex-direction: column;
        gap: 3px;
    }
    .m-card-top {
        display: flex;
        justify-content: space-between;
        align-items: baseline;
        gap: 8px;
    }
    .m-card-name {
        font-weight: 700;
        font-size: 15px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .m-card-date {
        font-size: 11.5px;
        color: var(--dim);
        flex-shrink: 0;
    }
    .m-card-sub {
        font-size: 13px;
        color: var(--dim);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .m-card-tags {
        display: flex;
        align-items: center;
        gap: 6px;
        flex-wrap: wrap;
        margin-top: 2px;
    }
    .m-badge {
        font-size: 10.5px;
        font-weight: 600;
        padding: 1px 7px;
        border-radius: 999px;
        border: 1px solid var(--border);
        background: var(--surface-2);
        text-transform: uppercase;
    }
    .m-badge.reply {
        border-color: var(--yellow);
        color: var(--yellow);
    }
    .m-badge.camp {
        border-color: var(--magenta);
        color: var(--magenta);
        text-transform: none;
    }

    .m-sentinel {
        text-align: center;
        padding: 18px;
        color: var(--dim);
        font-size: 12px;
    }

    /* Bulk Selection Floating Bar */
    .m-bulk-bar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 8px 12px;
        background: var(--select-bg);
        color: var(--select-text);
        border-radius: 8px;
        font-size: 13px;
        font-weight: 600;
    }

    /* Native Detail View */
    .m-detail-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
    }
    .m-quick-actions {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
        padding: 12px 14px;
        border-bottom: 1px solid var(--border);
    }
    .m-qa-btn {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 4px;
        padding: 10px 4px;
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: 10px;
        color: var(--text);
        font-size: 11.5px;
        cursor: pointer;
    }
    .m-qa-btn span:first-child { font-size: 17px; }

    .m-section {
        padding: 14px;
        border-bottom: 1px solid var(--border);
    }
    .m-section-title {
        font-size: 11.5px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.06em;
        color: var(--dim);
        margin-bottom: 10px;
    }
    .m-info-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    .m-info-item {
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: 8px;
        padding: 8px 10px;
    }
    .m-info-item.full { grid-column: 1 / -1; }
    .m-info-lbl { font-size: 10.5px; color: var(--dim); text-transform: uppercase; margin-bottom: 2px; }
    .m-info-val { font-size: 13.5px; word-break: break-word; }

    .m-timeline-card {
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: 10px;
        padding: 11px 12px;
        margin-bottom: 8px;
        cursor: pointer;
    }

    /* Native Campaign / Discovery / Console Cards */
    .m-panel-card {
        margin: 10px 12px;
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: 12px;
        padding: 14px;
    }
    .m-progress {
        height: 6px;
        background: var(--surface-2);
        border-radius: 999px;
        overflow: hidden;
        margin: 8px 0 4px;
    }
    .m-progress-fill {
        height: 100%;
        background: var(--green);
    }

    /* Floating Action Button (Gmail-style) */
    .m-fab {
        position: fixed;
        right: 18px;
        bottom: calc(74px + env(safe-area-inset-bottom, 0px));
        width: 54px;
        height: 54px;
        border-radius: 16px;
        background: var(--accent);
        color: #05080f;
        border: none;
        font-size: 28px;
        font-weight: 600;
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
        cursor: pointer;
        z-index: 25;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Native 5-Tab Bottom Navigation (Instagram / Gmail style) */
    .m-tabbar {
        flex-shrink: 0;
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        background: var(--surface);
        border-top: 1px solid var(--border);
        padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
        z-index: 20;
    }
    .m-tab {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        background: transparent;
        border: none;
        color: var(--dim);
        font-size: 10.5px;
        font-weight: 500;
        padding: 4px 2px;
        cursor: pointer;
        position: relative;
    }
    .m-tab .m-tab-ico { font-size: 18px; line-height: 1.1; }
    .m-tab.active { color: var(--accent); font-weight: 700; }
    .m-tab-dot {
        position: absolute;
        top: 2px;
        right: 18%;
        background: var(--red);
        color: #fff;
        font-size: 9px;
        font-weight: 700;
        min-width: 15px;
        height: 15px;
        border-radius: 999px;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0 3px;
    }

    /* Native Bottom Sheet (for Edit, Compose, Bulk, More) */
    .m-sheet-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.55);
        z-index: 70;
    }
    .m-sheet {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        max-height: 88dvh;
        background: var(--surface);
        border-top: 1px solid var(--accent);
        border-radius: 16px 16px 0 0;
        padding: 12px 16px calc(18px + env(safe-area-inset-bottom, 0px));
        z-index: 80;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        display: flex;
        flex-direction: column;
        gap: 12px;
    }
    .m-sheet-handle {
        width: 38px;
        height: 4px;
        border-radius: 999px;
        background: var(--border);
        margin: 0 auto 4px;
    }
    .m-sheet-title {
        font-size: 16px;
        font-weight: 700;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    .m-form-stack {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }
    .m-form-stack label {
        display: flex;
        flex-direction: column;
        gap: 4px;
        font-size: 12px;
        color: var(--dim);
    }
    .m-sheet-item {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 13px 12px;
        background: var(--surface-2);
        border: 1px solid var(--border);
        border-radius: 10px;
        color: var(--text);
        font-size: 14px;
        cursor: pointer;
    }
}
