/* ==========================================================================
   Acelle Mail — Layout Styles (authenticated pages)
   Sidebar, topbar, content area, responsive.
   All values from variables.css.
   ========================================================================== */

@import url('variables.css');

/* ==========================================================================
   App Shell
   ========================================================================== */

.mc-app {
    display: flex;
    min-height: 100vh;
}

.mc-app-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    margin-left: var(--sidebar-width);
    transition: margin-left var(--transition-base);
}

.mc-app.sidebar-collapsed .mc-app-body {
    margin-left: var(--sidebar-collapsed);
}

/* ─── Pre-paint collapsed state (FOUC fix) ───────────────────────────────────
   Mirror of the dark-mode pre-paint script pattern. Inline <script> in
   admin.blade + app.blade <head> reads `localStorage.mc-sidebar-collapsed`
   and sets `data-sidebar-collapsed="true"` on <html> BEFORE first paint.
   These rules apply the collapsed dimensions + label-hiding + zero
   transition during that initial paint, so the sidebar already paints
   collapsed instead of flashing expanded → collapsed via the JS-driven
   class swap that happens on DOMContentLoaded.

   Sidebar.js#init mirrors the html attr to `.mc-app.sidebar-collapsed`
   then strips the html marker — future toggles use the canonical class.
   ────────────────────────────────────────────────────────────────────── */
html[data-sidebar-collapsed="true"] .mc-sidebar,
html[data-sidebar-collapsed="true"] .mc-app-body {
    transition: none !important;
}
html[data-sidebar-collapsed="true"] .mc-sidebar {
    width: var(--sidebar-collapsed);
}
html[data-sidebar-collapsed="true"] .mc-app-body {
    margin-left: var(--sidebar-collapsed);
}
html[data-sidebar-collapsed="true"] .mc-nav-item-label,
html[data-sidebar-collapsed="true"] .mc-nav-group-label,
html[data-sidebar-collapsed="true"] .mc-nav-arrow,
html[data-sidebar-collapsed="true"] .mc-nav-badge,
html[data-sidebar-collapsed="true"] .mc-nav-submenu,
html[data-sidebar-collapsed="true"] .mc-sidebar-logo-text,
html[data-sidebar-collapsed="true"] .mc-sidebar-logo-content {
    display: none;
}

/* ==========================================================================
   Sidebar
   ========================================================================== */

.mc-sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--sidebar-width);
    background: var(--color-card-bg);
    border-right: var(--space-px) solid var(--color-border);
    display: flex;
    flex-direction: column;
    z-index: var(--z-sidebar);
    transition: width var(--transition-base);
    overflow: hidden;
}

.mc-app.sidebar-collapsed .mc-sidebar { width: var(--sidebar-collapsed); }

/* Logo + collapse toggle in header */
.mc-sidebar-logo {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    height: var(--topbar-height);
    border-bottom: var(--space-px) solid var(--color-border);
    flex-shrink: 0;
    color: inherit;
    text-decoration: none;
}
.mc-sidebar-logo:hover { text-decoration: none; color: inherit; }
.mc-sidebar-logo-content {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    min-width: 0;
    overflow: hidden;
}
.mc-sidebar-logo img { height: var(--space-7); width: auto; object-fit: contain; }
.mc-sidebar-logo-text {
    font-size: var(--text-md);
    font-weight: var(--weight-bold);
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
}
.mc-app.sidebar-collapsed .mc-sidebar-logo-text { display: none; }

/* Nav area */
.mc-sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: var(--space-2) 0;
}
.mc-sidebar-nav::-webkit-scrollbar { width: var(--space-1); }
.mc-sidebar-nav::-webkit-scrollbar-thumb { background: transparent; }
.mc-sidebar-nav:hover::-webkit-scrollbar-thumb { background: var(--color-border); }

/* Nav group */
.mc-nav-group { margin-bottom: var(--space-1); }
.mc-nav-group-label {
    padding: var(--space-2) var(--space-4);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    white-space: nowrap;
    overflow: hidden;
}

/* F8.4 follow-up: inline "NEW" badge variant for the AI group label.
   Pastel teal pill with a leading dot — pulled straight from /rui/ui
   `mc-badge mc-badge-teal mc-badge-sm mc-badge-dot`. The wrapping label
   becomes inline-flex so the badge sits next to the text instead of
   wrapping onto a new line. Subtle pulse on the dot draws the eye
   without becoming noisy. */
.mc-nav-group-label-with-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    text-transform: none;
    letter-spacing: 0;
}

.mc-nav-group-label-with-badge > span:first-child {
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.mc-nav-group-badge-new {
    /* High-contrast pastel — pale violet bg, BOLD dark-violet text + 1px
       border so the pill pops out of the muted sidebar without being a
       solid block. The all-saturation `--chart-6` (#C3B1E1) is too soft
       to read as "stand out", so we hardcode the brighter Tailwind
       violet-600 text + a 10%-tinted bg of the same hue. Dark mode
       lightens the text to violet-300 for legibility on the dark sidebar. */
    background: rgba(124, 58, 237, 0.12) !important;
    color: #6D28D9 !important;
    border: 1px solid rgba(124, 58, 237, 0.45) !important;
    text-transform: none;
    letter-spacing: 0.2px;
    font-weight: var(--weight-bold);
    padding-inline: var(--space-2);
    gap: var(--space-1);
}

[data-theme="dark"] .mc-nav-group-badge-new {
    background: rgba(167, 139, 250, 0.18) !important;
    color: #C4B5FD !important;
    border-color: rgba(167, 139, 250, 0.55) !important;
}

.mc-nav-group-badge-new .mc-nav-group-badge-icon {
    flex-shrink: 0;
    /* gentle bob so the flask reads as “experimental / brewing” without
       being noisy. Keeps the badge visually alive in the sidebar. */
    animation: mc-nav-group-badge-flask-bob 3.2s ease-in-out infinite;
    transform-origin: center 70%;
}

@keyframes mc-nav-group-badge-flask-bob {
    0%, 100% { transform: rotate(-4deg); }
    50%      { transform: rotate(4deg); }
}

@media (prefers-reduced-motion: reduce) {
    .mc-nav-group-badge-new .mc-nav-group-badge-icon {
        animation: none;
    }
}

/* Nav item */
.mc-nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    margin: var(--space-px) var(--space-2);
    color: var(--color-text);
    font-size: var(--text-base);
    font-weight: var(--weight-normal);
    border-radius: var(--radius-input);
    text-decoration: none;
    white-space: nowrap;
    transition: all var(--transition-fast);
    cursor: pointer;
}
.mc-nav-item:hover {
    background: var(--color-hover-bg);
    color: var(--color-text);
    text-decoration: none;
}
.mc-nav-item.active {
    background: var(--color-hover-bg);
    color: var(--color-teal);
    font-weight: var(--weight-medium);
}

.mc-nav-item-icon {
    width: var(--space-5);
    height: var(--space-5);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    font-size: var(--text-lg);
}
.mc-nav-item-icon svg { width: 20px; height: 20px; }
.mc-nav-item-label { flex: 1; overflow: hidden; text-overflow: ellipsis; }

/* Nav arrow & submenu */
.mc-nav-arrow {
    width: var(--space-4); height: var(--space-4);
    transition: transform var(--transition-fast);
    color: var(--color-text-muted);
}
.mc-nav-item.expanded .mc-nav-arrow { transform: rotate(90deg); }
.mc-nav-submenu { display: none; padding-left: var(--space-8); }
.mc-nav-item.expanded + .mc-nav-submenu { display: block; }

/* Nav badge */
.mc-nav-badge {
    font-size: var(--text-xs);
    background: var(--color-teal);
    color: var(--color-white);
    padding: var(--space-px) var(--space-1-5);
    border-radius: var(--radius-full);
    font-weight: var(--weight-medium);
}

/* Sidebar collapsed overrides */
.mc-app.sidebar-collapsed .mc-nav-item-label,
.mc-app.sidebar-collapsed .mc-nav-group-label,
.mc-app.sidebar-collapsed .mc-nav-arrow,
.mc-app.sidebar-collapsed .mc-nav-badge,
.mc-app.sidebar-collapsed .mc-nav-submenu { display: none; }

.mc-app.sidebar-collapsed .mc-nav-item {
    justify-content: center;
    padding: var(--space-2-5);
    margin: var(--space-px) var(--space-1);
}

/* Collapsed icons — larger but thinner strokes for clean look */
.mc-app.sidebar-collapsed .mc-nav-item-icon .material-symbols-rounded {
    font-size: var(--text-xl);
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 48;
}
.mc-app.sidebar-collapsed .mc-nav-item-icon .mc-icon svg { width: 22px; height: 22px; }

.mc-app.sidebar-collapsed .mc-sidebar-logo-content { display: none; }

/* Sidebar footer / user */
.mc-sidebar-footer {
    padding: var(--space-2) var(--space-4);
    border-top: var(--space-px) solid var(--color-border);
    flex-shrink: 0;
}
.mc-sidebar-user {
    display: flex; align-items: center; gap: var(--space-2);
    padding: var(--space-2);
    border-radius: var(--radius-input);
    cursor: pointer;
    transition: background var(--transition-fast);
}
.mc-sidebar-user:hover { background: var(--color-hover-bg); }
.mc-sidebar-user-info { flex: 1; min-width: 0; }
.mc-sidebar-user-name {
    font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--color-text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mc-sidebar-user-email {
    font-size: var(--text-xs); color: var(--color-text-muted);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mc-app.sidebar-collapsed .mc-sidebar-user-info { display: none; }
.mc-app.sidebar-collapsed .mc-sidebar-footer { padding: var(--space-2) var(--space-1); }
.mc-app.sidebar-collapsed .mc-sidebar-user { justify-content: center; }

/* User menu (expanded dropdown) */
.mc-user-menu { min-width: 260px; }

.mc-user-menu-header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4);
}

.mc-user-menu-info { flex: 1; min-width: 0; }

.mc-user-menu-name {
    font-size: var(--text-base);
    font-weight: var(--weight-semibold);
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mc-user-menu-email {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: var(--space-1);
}

.mc-avatar-md {
    width: var(--space-10);
    height: var(--space-10);
    border-radius: var(--radius-full);
    background: var(--color-teal-light);
    color: var(--color-teal);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-md);
    font-weight: var(--weight-semibold);
    flex-shrink: 0;
}

/* Favicon element (hidden by default, shown when collapsed) */
.mc-sidebar-favicon {
    display: none;
    align-items: center;
    justify-content: center;
}
.mc-sidebar-favicon img {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    object-fit: contain;
}

/* Collapsed: show favicon centered */
.mc-app.sidebar-collapsed .mc-sidebar-favicon { display: flex; }
.mc-app.sidebar-collapsed .mc-sidebar-logo {
    justify-content: center;
    padding: var(--space-3) var(--space-2);
}

/* Sidebar toggle (in topbar — always visible) */
.mc-sidebar-toggle {
    display: flex;
    align-items: center; justify-content: center;
    width: var(--space-9); height: var(--space-9);
    margin-left: calc(-1 * var(--space-3));
    background: none; border: none; color: var(--color-text-muted);
    cursor: pointer; border-radius: var(--radius-input);
    transition: all var(--transition-fast);
}
.mc-sidebar-toggle:hover { background: var(--color-hover-bg); color: var(--color-text); }
.mc-sidebar-toggle svg { width: 20px; height: 20px; }

/* ==========================================================================
   Topbar
   ========================================================================== */

.mc-topbar {
    display: flex;
    align-items: center;
    height: var(--topbar-height);
    padding: 0 var(--space-6);
    background: var(--color-card-bg);
    border-bottom: var(--space-px) solid var(--color-border);
    gap: var(--space-4);
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: var(--z-topbar);
}

.mc-topbar-left   { display: flex; align-items: center; gap: var(--space-2); }
.mc-topbar-center { flex: 1; display: flex; justify-content: center; max-width: 480px; margin: 0 auto; }
.mc-topbar-right  { display: flex; align-items: center; gap: var(--space-2); }

/* Search */
.mc-topbar-search { position: relative; width: 100%; }
.mc-topbar-search-icon {
    position: absolute; left: var(--space-3-5); top: 50%;
    transform: translateY(-50%); color: var(--color-text-muted);
    pointer-events: none; width: var(--space-4); height: var(--space-4);
}
.mc-topbar-search input {
    width: 100%;
    padding: var(--space-2) var(--space-3-5) var(--space-2) var(--space-10);
    font-family: var(--font-family);
    font-size: var(--text-sm);
    color: var(--color-text);
    background: var(--color-subtle-bg);
    border: var(--space-px) solid transparent;
    border-radius: var(--radius-full);
    outline: none;
    transition: all var(--transition-fast);
}
.mc-topbar-search input::placeholder { color: var(--color-text-muted); }
.mc-topbar-search input:focus {
    background: var(--color-card-bg);
    border-color: var(--color-border);
    box-shadow: var(--shadow-sm);
}

/* Search dropdown */
.mc-search-dropdown {
    position: absolute;
    top: calc(100% + var(--space-2));
    left: 0;
    right: 0;
    background: var(--color-card-bg);
    border: var(--space-px) solid var(--color-border);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-dropdown);
    max-height: 400px;
    overflow-y: auto;
    z-index: var(--z-dropdown);
}

.mc-search-group-label {
    padding: var(--space-2) var(--space-4);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: var(--space-px) solid var(--color-border);
}

.mc-search-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2-5) var(--space-4);
    font-size: var(--text-sm);
    color: var(--color-text);
    text-decoration: none;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.mc-search-item:hover {
    background: var(--color-hover-bg);
    text-decoration: none;
}

.mc-search-item-icon {
    width: var(--space-5);
    height: var(--space-5);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-muted);
    flex-shrink: 0;
}

.mc-search-item-icon svg { width: var(--space-4); height: var(--space-4); }

.mc-search-empty {
    padding: var(--space-6) var(--space-4);
    text-align: center;
    font-size: var(--text-sm);
    color: var(--color-text-muted);
}

.mc-search-loading {
    padding: var(--space-4);
    text-align: center;
}

.mc-search-group-count {
    float: right;
    font-weight: var(--weight-normal);
    color: var(--color-teal);
    font-size: var(--text-xs);
}

.mc-search-item-detail {
    flex: 1;
    min-width: 0;
}

.mc-search-item-title {
    font-weight: var(--weight-medium);
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mc-search-item-meta {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    margin-top: var(--space-0-5);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.mc-search-item-sub {
    font-size: var(--text-xs);
    color: var(--color-text-disabled);
    margin-top: var(--space-0-5);
}

.mc-search-thumb {
    width: var(--space-10);
    height: var(--space-10);
    border-radius: var(--radius-input);
    background: var(--color-hover-bg);
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-disabled);
}

.mc-search-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Notification panel — clean, Mailchimp-inspired */
.mc-notification-panel {
    min-width: 360px;
    max-height: 480px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 0;
}

/* Mobile notification panel styles moved to main @media (max-width: 767px) block below */

.mc-notification-header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3-5) var(--space-4);
    border-bottom: var(--space-px) solid var(--color-border);
}

.mc-notification-header-title {
    font-size: var(--text-base);
    font-weight: var(--weight-semibold);
    color: var(--color-text);
}

.mc-notification-header-count {
    font-size: var(--text-xs);
    font-weight: var(--weight-medium);
    color: var(--color-teal);
    background: var(--color-teal-light);
    padding: var(--space-0-5) var(--space-2);
    border-radius: var(--radius-full);
}

.mc-notification-list {
    overflow-y: auto;
    max-height: 360px;
    flex: 1;
}

.mc-notification-item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    transition: background var(--transition-fast);
    border-bottom: var(--space-px) solid var(--color-border);
}

.mc-notification-item:last-child { border-bottom: none; }
.mc-notification-item:hover { background: var(--color-hover-bg); }

.mc-notification-icon {
    width: var(--space-8);
    height: var(--space-8);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-input);
    background: var(--color-hover-bg);
    color: var(--color-text-muted);
    flex-shrink: 0;
}

.mc-notification-icon .material-symbols-rounded { font-size: var(--text-md); }

.mc-notification-content {
    flex: 1;
    min-width: 0;
}

.mc-notification-text {
    font-size: var(--text-sm);
    color: var(--color-text);
    line-height: var(--leading-normal);
}

.mc-notification-meta {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-top: var(--space-1);
}

.mc-notification-type {
    font-size: var(--text-xs);
    color: var(--color-teal);
    font-weight: var(--weight-medium);
}

.mc-notification-time {
    font-size: var(--text-xs);
    color: var(--color-text-disabled);
}

.mc-notification-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-1);
    padding: var(--space-3);
    border-top: var(--space-px) solid var(--color-border);
    color: var(--color-teal);
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    text-decoration: none;
    transition: background var(--transition-fast);
}

.mc-notification-footer:hover {
    background: var(--color-hover-bg);
    text-decoration: none;
}

.mc-notification-footer .material-symbols-rounded { font-size: var(--text-sm); }

.mc-notification-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-8) var(--space-4);
    color: var(--color-text-muted);
    font-size: var(--text-sm);
}

.mc-notification-empty .material-symbols-rounded {
    font-size: var(--text-2xl);
    color: var(--color-border-strong);
}

.mc-notification-empty-sub {
    font-size: var(--text-xs);
    color: var(--color-text-disabled);
}

/* Icon buttons */
.mc-topbar-icon-btn {
    display: flex; align-items: center; justify-content: center;
    width: var(--space-9); height: var(--space-9);
    background: none; border: none; color: var(--color-text);
    cursor: pointer; border-radius: var(--radius-full);
    transition: background var(--transition-fast);
    position: relative;
}
.mc-topbar-icon-btn:hover { background: var(--color-hover-bg); }
.mc-topbar-icon-btn svg { width: 20px; height: 20px; }
.mc-topbar-icon-btn .material-symbols-rounded { font-size: var(--text-xl); }
.mc-topbar-icon-btn .mc-notification-dot {
    position: absolute; top: var(--space-1-5); right: var(--space-1-5);
    width: var(--space-2); height: var(--space-2);
    background: var(--color-error); border-radius: 50%;
    border: var(--space-0-5) solid var(--color-card-bg);
}

/* User */
.mc-topbar-user {
    display: flex; align-items: center; gap: var(--space-2);
    padding: var(--space-1) var(--space-2);
    cursor: pointer; border-radius: var(--radius-full);
    transition: background var(--transition-fast);
}
.mc-topbar-user:hover { background: var(--color-hover-bg); }

/* Breadcrumb */
.mc-breadcrumb {
    display: flex; align-items: center; gap: var(--space-1);
    font-size: var(--text-sm); color: var(--color-text-muted);
    padding: var(--space-2) 0;
}
.mc-breadcrumb a { color: var(--color-text-muted); text-decoration: none; }
.mc-breadcrumb a:hover { color: var(--color-teal); }
.mc-breadcrumb-separator { color: var(--color-border); }
.mc-breadcrumb-current { color: var(--color-text); font-weight: var(--weight-medium); }

/* ==========================================================================
   Content Header (edge-to-edge white bar for page titles)
   ========================================================================== */

.mc-content-header {
    background: var(--color-card-bg);
    border-bottom: var(--space-px) solid var(--color-border);
    padding: var(--space-3-5) var(--space-6);
}

.mc-content-header-inner {
    max-width: var(--content-max-width);
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: var(--space-3);
}
.mc-content-header-inner > :first-child { flex: 1; min-width: 0; }

/* ==========================================================================
   Content Area
   ========================================================================== */

.mc-content { flex: 1; padding: var(--space-6); }
.mc-content-inner { max-width: var(--content-max-width); margin: 0 auto; }

/* White background variant — opt-in per page for cleaner listing views */
.mc-content.mc-page-white-bg { background: var(--color-card-bg); }

/* ==========================================================================
   Mobile overlay
   ========================================================================== */

.mc-sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: var(--color-overlay);
    z-index: calc(var(--z-sidebar) - 1);
}

/* ==========================================================================
   Responsive — Tablet + Mobile (sidebar collapsed / hidden, overlay open)
   ========================================================================== */

@media (max-width: 1199px) {
    .mc-sidebar { width: var(--sidebar-collapsed); }
    .mc-app-body { margin-left: var(--sidebar-collapsed); }

    .mc-sidebar-logo-content,
    .mc-nav-item-label,
    .mc-nav-group-label,
    .mc-nav-arrow,
    .mc-nav-badge,
    .mc-sidebar-user-info,
    .mc-nav-submenu { display: none; }

    .mc-sidebar-logo {
        justify-content: center;
        padding: var(--space-3) var(--space-1);
    }

    .mc-sidebar-favicon { display: flex; }

    .mc-nav-item {
        justify-content: center;
        padding: var(--space-2-5);
        margin: var(--space-px) var(--space-1);
    }

    .mc-nav-item-icon .material-symbols-rounded {
        font-size: var(--text-xl);
    }

    .mc-sidebar-footer { padding: var(--space-2) var(--space-1); }
    .mc-sidebar-user { justify-content: center; }

    /* --- Overlay open: restore full sidebar as overlay --- */
    .mc-app.sidebar-mobile-open .mc-sidebar {
        width: var(--sidebar-width);
        z-index: calc(var(--z-sidebar) + 1);
    }
    .mc-app.sidebar-mobile-open .mc-sidebar-overlay { display: block; }

    .mc-app.sidebar-mobile-open .mc-sidebar-logo {
        justify-content: flex-start;
        padding: var(--space-3) var(--space-4);
    }
    .mc-app.sidebar-mobile-open .mc-sidebar-logo-content { display: flex; }
    .mc-app.sidebar-mobile-open .mc-sidebar-favicon { display: none; }
    .mc-app.sidebar-mobile-open .mc-sidebar-logo-text,
    .mc-app.sidebar-mobile-open .mc-nav-item-label,
    .mc-app.sidebar-mobile-open .mc-nav-group-label,
    .mc-app.sidebar-mobile-open .mc-nav-arrow,
    .mc-app.sidebar-mobile-open .mc-nav-badge,
    .mc-app.sidebar-mobile-open .mc-sidebar-user-info { display: block; }

    .mc-app.sidebar-mobile-open .mc-nav-item {
        justify-content: flex-start;
        padding: var(--space-2) var(--space-4);
        margin: var(--space-px) var(--space-2);
    }

    .mc-app.sidebar-mobile-open .mc-nav-item-icon .material-symbols-rounded {
        font-size: inherit;
    }

    .mc-app.sidebar-mobile-open .mc-sidebar-user-info { display: block; }
    .mc-app.sidebar-mobile-open .mc-sidebar-footer { padding: var(--space-2) var(--space-4); }
    .mc-app.sidebar-mobile-open .mc-sidebar-user { justify-content: flex-start; }
}

/* ==========================================================================
   Responsive — Mobile (sidebar fully hidden by default)
   ========================================================================== */

@media (max-width: 767px) {
    html, body { overflow-x: hidden; }

    /* Content header: stack title and actions vertically on mobile */
    .mc-content-header {
        padding: var(--space-3) var(--space-4);
    }
    .mc-content-header-inner {
        flex-wrap: wrap;
        gap: var(--space-2);
    }
    /* Title block always takes the full width so actions go to a new row */
    .mc-content-header-inner > :first-child {
        min-width: 0;
        flex-basis: 100%;
    }

    .mc-sidebar {
        width: var(--sidebar-width);
        transform: translateX(-100%);
        transition: transform var(--transition-base);
    }

    .mc-app.sidebar-mobile-open .mc-sidebar { transform: translateX(0); }

    /* Sidebar footer: allow user menu dropdown to escape overflow */
    .mc-app.sidebar-mobile-open .mc-sidebar { overflow: visible; }
    .mc-app.sidebar-mobile-open .mc-sidebar-nav { max-height: calc(100vh - var(--topbar-height) - 80px); }

    /* User menu in sidebar: full-width bottom sheet on mobile */
    .mc-sidebar .mc-user-menu {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        top: auto;
        min-width: 0;
        width: 100%;
        border-radius: var(--radius-card) var(--radius-card) 0 0;
        box-shadow: var(--shadow-modal);
        z-index: calc(var(--z-sidebar) + 10);
        transform: translateY(100%);
        margin-bottom: 0;
    }
    .mc-sidebar .mc-user-menu.active {
        transform: translateY(0);
    }

    .mc-app-body { margin-left: 0; overflow-x: hidden; }

    .mc-topbar-center { display: none; }
    .mc-content { padding: var(--space-4); overflow-x: hidden; }

    /* Topbar: reduce gap between icons for mobile */
    .mc-topbar-right { gap: var(--space-0-5); }

    /* Topbar icon buttons: ensure min 44px touch target */
    .mc-topbar-icon-btn {
        width: 44px;
        height: 44px;
        min-width: 44px;
    }

    /* User avatar in topbar: proper touch target */
    .mc-topbar-user { padding: var(--space-1); }

    /* Topbar: remove sticky on mobile so fixed dropdowns work correctly */
    .mc-topbar {
        position: relative;
    }

    /* Notification panel: full-width fixed on mobile (topbar is relative, not sticky) */
    .mc-dropdown-menu.mc-notification-panel {
        position: fixed;
        top: var(--topbar-height);
        left: 0;
        right: 0;
        width: 100vw;
        min-width: 0;
        max-height: 80vh;
        border-radius: 0 0 var(--radius-card) var(--radius-card);
        box-shadow: var(--shadow-modal);
        z-index: calc(var(--z-topbar) + 10);
        margin-top: 0;
        transform: none;
    }
    .mc-dropdown-menu.mc-notification-panel.active {
        transform: none;
    }

    /* User menu from topbar: full-width bottom sheet */
    .mc-topbar-user .mc-dropdown-menu.mc-user-menu {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        min-width: 0;
        width: 100vw;
        border-radius: var(--radius-card) var(--radius-card) 0 0;
        box-shadow: var(--shadow-modal);
        z-index: calc(var(--z-topbar) + 10);
        margin-top: 0;
        max-height: 85vh;
        overflow-y: auto;
    }
}
