/* ================================================================
   MISAC Sidebar — generic slide-in panel from right edge
================================================================ */

.msb-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 1099;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s ease;
    backdrop-filter: blur(2px);
}
.msb-backdrop--open {
    opacity: 1;
    pointer-events: auto;
}

/* ── Panel ───────────────────────────────────────────────────── */
.msb-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    max-width: 100vw;
    background: var(--m-surface, #fff);
    z-index: 1100;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform .28s cubic-bezier(.4, 0, .2, 1);
    box-shadow: -6px 0 32px rgba(15, 23, 42, 0.16), -1px 0 0 rgba(15, 23, 42, 0.06);
}
.msb-sidebar--open {
    transform: translateX(0);
}

/* ── Brand accent strip on top ──────────────────────────────── */
.msb-sidebar::before {
    content: '';
    display: block;
    height: 3px;
    flex-shrink: 0;
    background: linear-gradient(90deg, var(--m-brand, #2272b5) 0%, var(--m-brand2, #ab217f) 100%);
}

/* ── Header ─────────────────────────────────────────────────── */
.msb-header {
    display: flex;
    align-items: center;
    padding: 13px 16px 11px;
    border-bottom: 1px solid var(--m-border, #dfe3e8);
    flex-shrink: 0;
    gap: 8px;
    background: var(--m-surface, #fff);
}
.msb-header__title {
    font-weight: 700;
    font-size: 15px;
    color: var(--m-brand, #2272b5);
    margin: 0;
    flex: 1;
    letter-spacing: -0.2px;
}
.msb-header__right {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}
.msb-header__action,
.msb-header__close {
    background: none;
    border: none;
    padding: 5px 8px;
    cursor: pointer;
    color: var(--m-text-muted, #94a3b8);
    font-size: 12px;
    border-radius: var(--m-radius, 6px);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: background .15s, color .15s;
    white-space: nowrap;
    font-family: inherit;
    font-weight: 500;
}
.msb-header__action:hover {
    background: var(--m-accent-light, #edf5fb);
    color: var(--m-brand, #2272b5);
}
.msb-header__close {
    font-size: 18px;
    font-weight: 300;
    padding: 4px 7px;
    line-height: 1;
}
.msb-header__close:hover {
    background: var(--m-bg-subtle, #f1f3f5);
    color: var(--m-text, #1e293b);
}

/* ── Tabs ────────────────────────────────────────────────────── */
.msb-tabs {
    display: flex;
    border-bottom: 1px solid var(--m-border, #dfe3e8);
    flex-shrink: 0;
    padding: 0 14px;
    gap: 0;
    overflow-x: auto;
    background: var(--m-surface, #fff);
}
.msb-tab {
    padding: 10px 14px 9px;
    border: none;
    background: none;
    font-size: 13px;
    font-weight: 500;
    color: var(--m-text-muted, #94a3b8);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    white-space: nowrap;
    transition: color .15s, border-color .15s;
    font-family: inherit;
    position: relative;
}
.msb-tab:hover { color: var(--m-text, #1e293b); }
.msb-tab--active {
    color: var(--m-brand, #2272b5);
    border-bottom-color: var(--m-brand, #2272b5);
    font-weight: 600;
}

/* ── Content ─────────────────────────────────────────────────── */
.msb-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--m-surface, #fff);
}
.msb-content::-webkit-scrollbar { width: 4px; }
.msb-content::-webkit-scrollbar-track { background: transparent; }
.msb-content::-webkit-scrollbar-thumb {
    background: var(--m-border, #dfe3e8);
    border-radius: 2px;
}
.msb-content::-webkit-scrollbar-thumb:hover { background: var(--m-text-muted, #94a3b8); }

/* ── Footer ──────────────────────────────────────────────────── */
.msb-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--m-border, #dfe3e8);
    flex-shrink: 0;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    background: var(--m-bg-subtle, #f8f9fb);
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 480px) {
    .msb-sidebar { width: 100% !important; }
}

/* ── Dark mode ───────────────────────────────────────────────── */
[data-theme="dark"] .msb-sidebar {
    background: #1e293b;
    box-shadow: -6px 0 32px rgba(0, 0, 0, 0.4), -1px 0 0 rgba(255, 255, 255, 0.05);
}
[data-theme="dark"] .msb-header {
    background: #1e293b;
    border-bottom-color: rgba(255, 255, 255, 0.08);
}
[data-theme="dark"] .msb-header__title { color: #93c5fd; }
[data-theme="dark"] .msb-header__action { color: #64748b; }
[data-theme="dark"] .msb-header__action:hover {
    background: rgba(96, 165, 250, 0.1);
    color: #93c5fd;
}
[data-theme="dark"] .msb-header__close { color: #64748b; }
[data-theme="dark"] .msb-header__close:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #f1f5f9;
}
[data-theme="dark"] .msb-tabs {
    background: #1e293b;
    border-bottom-color: rgba(255, 255, 255, 0.08);
}
[data-theme="dark"] .msb-tab { color: #64748b; }
[data-theme="dark"] .msb-tab:hover { color: #f1f5f9; }
[data-theme="dark"] .msb-tab--active {
    color: #93c5fd;
    border-bottom-color: #93c5fd;
}
[data-theme="dark"] .msb-content { background: #1e293b; }
[data-theme="dark"] .msb-content::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); }
[data-theme="dark"] .msb-footer {
    background: #162032;
    border-top-color: rgba(255, 255, 255, 0.08);
}
