/* ============================================================================
   LCARS TABLET MODALS (.bm-* = bridge-modal)
   Shared across all modules. Uses CSS custom properties --bm-accent / --bm-accent-rgb
   Extracted from starbase.css for global reuse.
   ============================================================================ */
.bm-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(8px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}
.bm-overlay.active { display: flex; }
/* Tablet device shell */
.bm-shell {
    background: #06060c;
    border: none;
    border-radius: 24px;
    width: 90%; max-width: 500px;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: row;
    box-shadow:
        0 0 0 2px #1e1e35,
        0 0 0 4px rgba(var(--bm-accent-rgb),0.12),
        0 24px 80px rgba(0,0,0,0.8),
        0 0 60px rgba(var(--bm-accent-rgb),0.06);
    animation: bmTabletIn 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes bmTabletIn {
    from { opacity: 0; transform: scale(0.9) translateY(20px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}
/* ─── Left LCARS sidebar frame ─── */
.bm-frame {
    flex-shrink: 0;
    width: 48px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 0;
    background: transparent;
}
.bm-frame-elbow-top {
    height: 52px;
    background: var(--bm-accent);
    border-radius: 20px 0 0 0;
    position: relative;
}
.bm-frame-elbow-top::after {
    content: '';
    position: absolute;
    bottom: 0; right: 0;
    width: 18px; height: 18px;
    background: #06060c;
    border-radius: 0 10px 0 0;
}
.bm-frame-seg {
    height: 28px;
    border-radius: 0 8px 8px 0;
    margin-right: 6px;
    background: var(--bm-accent);
}
.bm-frame-seg.dim { opacity: 0.6; }
.bm-frame-seg.dimmer { opacity: 0.3; }
.bm-frame-seg.amber { background: #FFAA00; }
.bm-frame-seg.cyan { background: #00d4ff; }
.bm-frame-seg.green { background: #10b981; }
.bm-frame-seg.red { background: #ff6b6b; }
.bm-frame-seg.purple { background: #8b5cf6; }
.bm-frame-light {
    width: 10px; height: 10px;
    border-radius: 50%;
    margin: 4px auto;
    animation: bmLightPulse 2s ease-in-out infinite;
}
.bm-frame-light.on { background: #10b981; box-shadow: 0 0 8px #10b981; }
.bm-frame-light.amber { background: #FFAA00; box-shadow: 0 0 8px #FFAA00; animation-delay: 0.7s; }
.bm-frame-light.cyan { background: #00d4ff; box-shadow: 0 0 8px #00d4ff; animation-delay: 1.4s; }
@keyframes bmLightPulse {
    0%, 100% { opacity: 1; }
    40% { opacity: 0.3; }
    60% { opacity: 0.3; }
}
.bm-frame-fill {
    flex: 1;
    background: rgba(var(--bm-accent-rgb),0.25);
    border-radius: 0 8px 0 0;
    margin-right: 6px;
    min-height: 20px;
}
.bm-frame-elbow-bottom {
    height: 36px;
    background: var(--bm-accent);
    border-radius: 0 0 0 20px;
    position: relative;
}
.bm-frame-elbow-bottom::after {
    content: '';
    position: absolute;
    top: 0; right: 0;
    width: 18px; height: 14px;
    background: #06060c;
    border-radius: 0 0 0 10px;
}
/* ─── Right content column ─── */
.bm-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}
.bm-header {
    display: flex;
    align-items: stretch;
    gap: 3px;
    padding: 0;
    border-bottom: none;
    background: transparent;
    min-height: 44px;
    flex-shrink: 0;
}
.bm-header-title {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 18px;
    background: var(--bm-accent);
    font-family: 'Antonio', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: #fff;
    white-space: nowrap;
}
.bm-header-strip {
    flex: 1;
    background: rgba(var(--bm-accent-rgb),0.18);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 8px;
    border-radius: 0 20px 0 0;
    gap: 6px;
}
.bm-header-pip {
    height: 8px;
    border-radius: 4px;
    flex-shrink: 0;
}
.bm-header-pip.w1 { width: 20px; background: rgba(var(--bm-accent-rgb),0.35); }
.bm-header-pip.w2 { width: 35px; background: rgba(255,170,0,0.3); }
.bm-header-pip.w3 { width: 14px; background: rgba(0,212,255,0.3); }
.bm-close {
    background: rgba(var(--bm-accent-rgb),0.15);
    border: 1px solid rgba(var(--bm-accent-rgb),0.3);
    color: rgba(255,255,255,0.6);
    font-size: 1rem;
    width: 30px; height: 30px;
    border-radius: 8px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.15s, color 0.15s, box-shadow 0.15s;
    flex-shrink: 0;
    position: relative;
    z-index: 2;
}
.bm-close:hover {
    background: rgba(var(--bm-accent-rgb),0.3);
    color: #fff;
    box-shadow: 0 0 10px rgba(var(--bm-accent-rgb),0.2);
}
/* Screen area */
.bm-body {
    padding: 20px 24px;
    overflow-y: auto;
    flex: 1;
    background: transparent;
    font-family: 'Antonio', sans-serif;
}
.bm-body * { font-family: 'Antonio', sans-serif; }
.bm-body code, .bm-body pre { font-family: 'IBM Plex Mono', monospace; }
.bm-body::-webkit-scrollbar { width: 4px; }
.bm-body::-webkit-scrollbar-thumb { background: rgba(var(--bm-accent-rgb),0.3); border-radius: 2px; }
.bm-body::-webkit-scrollbar-track { background: transparent; }
.bm-body label {
    font-family: 'Antonio', sans-serif;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-size: 0.72rem;
    color: rgba(var(--bm-accent-rgb),0.6);
    display: block;
    margin-bottom: 4px;
}
.bm-body input[type="text"],
.bm-body input[type="number"],
.bm-body input[type="password"],
.bm-body input[type="date"],
.bm-body select,
.bm-body textarea {
    width: 100%;
    padding: 8px 10px;
    background: rgba(var(--bm-accent-rgb),0.06);
    border: 1px solid rgba(var(--bm-accent-rgb),0.2);
    border-radius: 8px;
    color: #fff;
    font-family: 'Antonio', sans-serif;
    font-size: 0.85rem;
    letter-spacing: 0.03em;
    margin-bottom: 12px;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.bm-body input:focus,
.bm-body select:focus,
.bm-body textarea:focus {
    outline: none;
    border-color: var(--bm-accent);
    box-shadow: 0 0 12px rgba(var(--bm-accent-rgb),0.15);
}
/* Actions bar */
.bm-actions {
    display: flex;
    gap: 10px;
    padding: 10px 24px;
    border-top: 1px solid rgba(var(--bm-accent-rgb),0.12);
    background: rgba(0,0,0,0.2);
    flex-shrink: 0;
    flex-wrap: wrap;
}
.bm-actions button {
    padding: 10px 16px;
    border-radius: 6px;
    font-family: 'Antonio', sans-serif;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.bm-actions .btn-cancel {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.15);
    color: var(--archie-text-muted, #8892a4);
}
.bm-actions .btn-cancel:hover {
    background: rgba(255,255,255,0.05);
}
.bm-actions .btn-submit {
    background: rgba(var(--bm-accent-rgb),0.2);
    border: 1px solid rgba(var(--bm-accent-rgb),0.5);
    color: #fff;
}
.bm-actions .btn-submit:hover {
    background: rgba(var(--bm-accent-rgb),0.35);
    box-shadow: 0 0 16px rgba(var(--bm-accent-rgb),0.2);
}
.bm-actions .btn-delete {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    border: none;
    color: #fff;
    flex: 0 0 auto;
    padding: 10px 20px;
}
.bm-actions .btn-danger {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #ef4444;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 6px;
}
.bm-actions .btn-danger:hover {
    background: rgba(239, 68, 68, 0.3);
}
/* Footer decorative strip */
.bm-footer {
    display: flex;
    align-items: stretch;
    min-height: 14px;
    flex-shrink: 0;
    gap: 3px;
}
.bm-footer-strip {
    flex: 1;
    background: rgba(var(--bm-accent-rgb),0.18);
    border-radius: 0 0 20px 0;
    display: flex;
    align-items: center;
    padding: 0 12px;
    gap: 4px;
}
.bm-footer-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}
.bm-footer-dot.cyan { background: rgba(0,212,255,0.4); }
.bm-footer-dot.gold { background: rgba(255,170,0,0.4); }
.bm-footer-dot.green { background: rgba(16,185,129,0.4); }
.bm-footer-dot.purple { background: rgba(139,92,246,0.5); }
.bm-footer-dot.red { background: rgba(255,107,107,0.4); }
/* Responsive */
@media (max-width: 768px) {
    .bm-shell { width: 95%; max-height: 90vh; border-radius: 16px; }
    .bm-frame { width: 32px; }
    .bm-frame-elbow-top { height: 38px; border-radius: 14px 0 0 0; }
    .bm-frame-elbow-bottom { height: 26px; border-radius: 0 0 0 14px; }
    .bm-frame-seg { height: 20px; }
    .bm-header { min-height: 36px; }
    .bm-header-title { font-size: 0.75rem; padding: 0 10px; }
    .bm-header-pip.w2 { display: none; }
    .bm-body { padding: 16px; }
    .bm-actions { padding: 8px 16px; }
}
/* Light mode */
body.light-mode .bm-shell,
[data-theme="light"] .bm-shell {
    background: #f0f0f5;
    box-shadow: 0 0 0 2px #d0d0e0, 0 24px 80px rgba(0,0,0,0.2);
}
body.light-mode .bm-body input,
body.light-mode .bm-body select,
body.light-mode .bm-body textarea,
[data-theme="light"] .bm-body input,
[data-theme="light"] .bm-body select,
[data-theme="light"] .bm-body textarea {
    background: rgba(var(--bm-accent-rgb),0.04);
    color: #1a1a2e;
    border-color: rgba(var(--bm-accent-rgb),0.25);
}
