/* ============================================================================
   E-BILLING MODERN SHELL — INSPIRED BY POS_BACKEND (MOZZA POS)
   Dark Icon-Rail Sidebar (70px -> 250px) + Slide-out Card-Grid Panels (320px)
   + Clean Sticky Top Navbar (48px) + Multi-Tab Bar + Dark Mode Support
   ============================================================================ */

:root {
    --pos-sidebar-width: 70px;
    --pos-sidebar-expanded-width: 250px;
    --pos-sidebar-bg: #0F172A;
    --pos-sidebar-bg-alt: #1E293B;
    --pos-sidebar-text: #CBD5E1;
    --pos-sidebar-text-muted: #64748B;
    --pos-sidebar-hover: #1E293B;
    --pos-sidebar-active: var(--primary-color, #1E40AF);
    --pos-sidebar-active-glow: rgba(59, 130, 246, 0.18);
    --pos-sidebar-border: rgba(255, 255, 255, 0.07);
    --pos-sidebar-transition: 280ms cubic-bezier(0.4, 0, 0.2, 1);
    --pos-topbar-height: 48px;
}

/* ============================================================================
   1. DARK ICON-RAIL SIDEBAR (70px -> 250px)
   ============================================================================ */
aside.sidebar.modern-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--pos-sidebar-width);
    height: 100vh;
    background: var(--pos-sidebar-bg);
    color: var(--pos-sidebar-text);
    padding: 0;
    margin: 0;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: width var(--pos-sidebar-transition);
    box-shadow: 1px 0 0 var(--pos-sidebar-border), 4px 0 16px rgba(0, 0, 0, 0.2);
}

aside.sidebar.modern-sidebar.expanded {
    width: var(--pos-sidebar-expanded-width);
}

aside.sidebar.modern-sidebar::-webkit-scrollbar { width: 4px; }
aside.sidebar.modern-sidebar::-webkit-scrollbar-track { background: transparent; }
aside.sidebar.modern-sidebar::-webkit-scrollbar-thumb { background: var(--pos-sidebar-text-muted); border-radius: 4px; }
aside.sidebar.modern-sidebar::-webkit-scrollbar-thumb:hover { background: var(--pos-sidebar-text); }

/* Brand Section */
aside.sidebar.modern-sidebar .sidebar-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 62px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--pos-sidebar-border);
    text-decoration: none;
    flex-shrink: 0;
}

aside.sidebar.modern-sidebar .sidebar-brand .sidebar-logo {
    display: block;
    max-width: 36px;
    max-height: 36px;
    width: auto;
    height: auto;
    object-fit: contain;
    transition: all var(--pos-sidebar-transition);
    filter: brightness(1.1) drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

aside.sidebar.modern-sidebar.expanded .sidebar-brand .sidebar-logo {
    max-width: 145px;
    max-height: 34px;
}

aside.sidebar.modern-sidebar .sidebar-brand h4 {
    display: none;
    margin: 4px 0 0 0;
    font-size: 11.5px;
    font-weight: 600;
    white-space: nowrap;
    color: #94A3B8;
    text-align: center;
    letter-spacing: 0.02em;
}

aside.sidebar.modern-sidebar.expanded .sidebar-brand h4 {
    display: block;
}

/* User Section inside Sidebar */
aside.sidebar.modern-sidebar .sidebar-user {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 12px;
    border-bottom: 1px solid var(--pos-sidebar-border);
    min-height: 54px;
    flex-shrink: 0;
}

aside.sidebar.modern-sidebar.expanded .sidebar-user {
    justify-content: flex-start;
}

aside.sidebar.modern-sidebar .sidebar-user .avatar {
    min-width: 34px;
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    overflow: hidden;
    flex-shrink: 0;
    border: 1.5px solid rgba(255, 255, 255, 0.18);
}

aside.sidebar.modern-sidebar .sidebar-user .avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

aside.sidebar.modern-sidebar .sidebar-user .sidebar-text {
    display: none;
    margin-left: 10px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

aside.sidebar.modern-sidebar.expanded .sidebar-user .sidebar-text {
    display: block;
}

aside.sidebar.modern-sidebar .sidebar-user .sidebar-text .su-name {
    font-weight: 600;
    font-size: 12px;
    color: #F1F5F9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

aside.sidebar.modern-sidebar .sidebar-user .sidebar-text small {
    display: block;
    font-size: 10.5px;
    color: var(--pos-sidebar-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Menu List */
aside.sidebar.modern-sidebar .sidebar-menu {
    padding: 8px 0 16px 0;
    flex: 1;
}

aside.sidebar.modern-sidebar .sidebar-menu .nav {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
}

aside.sidebar.modern-sidebar .nav-item {
    display: flex;
    align-items: center;
    list-style: none;
    padding: 0;
    margin: 2px 7px;
    position: relative;
}

aside.sidebar.modern-sidebar .nav-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 10px 11px;
    color: var(--pos-sidebar-text);
    text-decoration: none;
    transition: all 180ms ease;
    position: relative;
    white-space: nowrap;
    overflow: visible;
    font-size: 12.5px;
    font-weight: 500;
    border-left: 3px solid transparent;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
}

aside.sidebar.modern-sidebar.expanded .nav-link {
    justify-content: flex-start;
    overflow: hidden;
}

aside.sidebar.modern-sidebar .nav-link:hover {
    background: var(--pos-sidebar-hover);
    color: #F8FAFC;
    text-decoration: none;
}

aside.sidebar.modern-sidebar .nav-link.active,
aside.sidebar.modern-sidebar .nav-link.panel-open {
    background: var(--pos-sidebar-active-glow);
    color: #FFFFFF;
    border-left-color: var(--pos-sidebar-active);
    font-weight: 600;
}

aside.sidebar.modern-sidebar .nav-link i {
    min-width: 20px;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 15px;
    color: inherit;
}

aside.sidebar.modern-sidebar .nav-link .sidebar-text {
    display: none;
    margin-left: 11px;
    flex: 1;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

aside.sidebar.modern-sidebar.expanded .nav-link .sidebar-text {
    display: block;
}

aside.sidebar.modern-sidebar .nav-link .cat-chevron {
    display: none;
    margin-left: auto;
    font-size: 10px;
    opacity: 0.6;
    width: auto;
    min-width: auto;
}

aside.sidebar.modern-sidebar.expanded .nav-link .cat-chevron {
    display: inline-flex;
}

/* Tooltips in Icon-Only Mode */
aside.sidebar.modern-sidebar:not(.expanded) .nav-link::after,
aside.sidebar.modern-sidebar:not(.expanded) .logout-btn::after {
    content: attr(data-tooltip);
    position: fixed;
    left: 78px;
    background: #0F172A;
    color: #F1F5F9;
    padding: 5px 11px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 160ms ease;
    z-index: 2000;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

aside.sidebar.modern-sidebar:not(.expanded) .nav-link:hover::after,
aside.sidebar.modern-sidebar:not(.expanded) .logout-btn:hover::after {
    opacity: 1;
}

aside.sidebar.modern-sidebar .nav-divider {
    height: 1px;
    background: var(--pos-sidebar-border);
    margin: 8px 12px;
    list-style: none;
}

aside.sidebar.modern-sidebar .logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 10px 11px;
    color: var(--pos-sidebar-text);
    text-decoration: none;
    transition: all 180ms ease;
    font-size: 12.5px;
    font-weight: 500;
    border: none;
    border-left: 3px solid transparent;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
}

aside.sidebar.modern-sidebar.expanded .logout-btn {
    justify-content: flex-start;
}

aside.sidebar.modern-sidebar .logout-btn:hover {
    background: rgba(239, 68, 68, 0.14);
    color: #FCA5A5;
    border-left-color: #EF4444;
}

aside.sidebar.modern-sidebar .logout-btn .sidebar-text {
    display: none;
    margin-left: 11px;
}

aside.sidebar.modern-sidebar.expanded .logout-btn .sidebar-text {
    display: block;
}

/* ============================================================================
   2. SLIDE-OUT CARD-GRID MENU PANELS (320px)
   ============================================================================ */
.menu-panels {
    position: fixed;
    top: 0;
    left: var(--pos-sidebar-width);
    height: 100vh;
    z-index: 999;
    pointer-events: none;
    overflow: visible;
    transition: left var(--pos-sidebar-transition);
}

aside.sidebar.modern-sidebar.expanded ~ .menu-panels {
    left: var(--pos-sidebar-expanded-width);
}

.menu-panel {
    position: absolute;
    top: 0;
    left: 0;
    width: 320px;
    height: 100vh;
    background: var(--white, #FFFFFF);
    box-shadow: none;
    transform: translateX(-105%);
    visibility: hidden;
    pointer-events: none;
    transition: transform 280ms cubic-bezier(0.4, 0, 0.2, 1), visibility 0s linear 280ms;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-right: 1px solid var(--border-color, #E2E8F0);
}

.menu-panel.active {
    transform: translateX(0);
    visibility: visible;
    pointer-events: auto;
    box-shadow: 6px 0 28px rgba(15, 23, 42, 0.16);
    transition: transform 280ms cubic-bezier(0.4, 0, 0.2, 1), visibility 0s linear 0s;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 15px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    color: #FFFFFF;
    min-height: 48px;
    flex-shrink: 0;
}

.panel-header h5 {
    margin: 0;
    font-size: 13.5px;
    font-weight: 600;
    color: #FFFFFF !important;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: -0.01em;
}

.panel-header h5 i {
    font-size: 15px;
    opacity: 0.92;
}

.panel-close {
    background: rgba(255, 255, 255, 0.16);
    border: none;
    color: #FFFFFF;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 180ms ease;
}

.panel-close:hover {
    background: rgba(255, 255, 255, 0.28);
    transform: rotate(90deg);
}

.panel-back-btn {
    display: none;
    align-items: center;
    gap: 5px;
    background: rgba(255, 255, 255, 0.18);
    border: none;
    color: #FFFFFF;
    font-size: 12.5px;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 6px;
    cursor: pointer;
}

.panel-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px;
    padding-bottom: 24px;
    background: var(--light-bg, #F4F6F9);
}

.panel-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.panel-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px 8px;
    min-height: 78px;
    background: var(--white, #FFFFFF);
    border-radius: 8px;
    text-decoration: none !important;
    color: var(--dark-text, #0F172A);
    transition: all 200ms cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    border: 1px solid var(--border-color, #E2E8F0);
    position: relative;
    overflow: hidden;
}

.panel-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: 8px 8px 0 0;
    transition: height 200ms ease;
}

.panel-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.10);
    border-color: transparent;
    color: #FFFFFF !important;
}

.panel-item:hover::before {
    height: 100%;
}

.panel-item i {
    font-size: 18px;
    margin-bottom: 6px;
    position: relative;
    z-index: 1;
    transition: color 200ms ease;
}

.panel-item span {
    font-size: 11.5px;
    font-weight: 600;
    position: relative;
    z-index: 1;
    line-height: 1.25;
    transition: color 200ms ease;
    word-break: break-word;
}

.panel-item:hover i,
.panel-item:hover span {
    color: #FFFFFF !important;
}

.panel-item.active {
    border-color: var(--primary-color);
    background: var(--primary-soft);
    color: var(--primary-color);
}

/* 8-Color Cyclic Card Accents (matching pos_backend) */
.panel-item:nth-child(8n+1)::before { background: linear-gradient(135deg, #0288D1, #03A9F4); }
.panel-item:nth-child(8n+1) i { color: #0288D1; }
.panel-item:nth-child(8n+2)::before { background: linear-gradient(135deg, #039BE5, #29B6F6); }
.panel-item:nth-child(8n+2) i { color: #039BE5; }
.panel-item:nth-child(8n+3)::before { background: linear-gradient(135deg, #059669, #10B981); }
.panel-item:nth-child(8n+3) i { color: #059669; }
.panel-item:nth-child(8n+4)::before { background: linear-gradient(135deg, #D97706, #F59E0B); }
.panel-item:nth-child(8n+4) i { color: #D97706; }
.panel-item:nth-child(8n+5)::before { background: linear-gradient(135deg, #E11D48, #F43F5E); }
.panel-item:nth-child(8n+5) i { color: #E11D48; }
.panel-item:nth-child(8n+6)::before { background: linear-gradient(135deg, #0891B2, #06B6D4); }
.panel-item:nth-child(8n+6) i { color: #0891B2; }
.panel-item:nth-child(8n+7)::before { background: linear-gradient(135deg, #2563EB, #3B82F6); }
.panel-item:nth-child(8n+7) i { color: #2563EB; }
.panel-item:nth-child(8n+8)::before { background: linear-gradient(135deg, #0D9488, #14B8A6); }
.panel-item:nth-child(8n+8) i { color: #0D9488; }

.panel-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.32);
    backdrop-filter: blur(2px);
    z-index: 998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 260ms ease;
}

.panel-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* ============================================================================
   3. MAIN CONTENT & CLEAN STICKY TOP NAVBAR (48px)
   ============================================================================ */
.main-content {
    margin-left: var(--pos-sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--light-bg, #F4F6F9);
    transition: margin-left var(--pos-sidebar-transition);
}

aside.sidebar.modern-sidebar.expanded ~ .main-content {
    margin-left: var(--pos-sidebar-expanded-width);
}

.top-navbar {
    background: var(--white, #FFFFFF);
    padding: 0 16px;
    height: var(--pos-topbar-height);
    min-height: var(--pos-topbar-height);
    border-bottom: 1px solid var(--border-color, #E2E8F0);
    box-shadow: var(--shadow-xs);
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.top-navbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}

.top-navbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.top-navbar .sidebar-toggle {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--gray-text);
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 15px;
    flex-shrink: 0;
    transition: all 150ms ease;
}

.top-navbar .sidebar-toggle:hover {
    background: var(--surface-subtle);
    color: var(--primary-color);
}

.top-navbar h1 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--dark-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.top-navbar .top-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--gray-text);
    margin: 0;
    padding: 0;
    list-style: none;
}

.top-navbar .top-breadcrumb a {
    color: var(--primary-color);
    font-weight: 500;
}

.top-navbar .top-breadcrumb .bc-sep {
    font-size: 10px;
    color: var(--muted-text);
}

.top-navbar .app-env-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: 7px;
    background: var(--primary-soft);
    border: 1px solid var(--border-color);
    color: var(--primary-color);
    font-size: 11.5px;
    font-weight: 600;
    white-space: nowrap;
}

/* Theme toggle adapted for white/surface topbar */
.top-navbar .theme-toggle {
    background: var(--surface-subtle);
    border: 1px solid var(--border-color);
}

.top-navbar .theme-toggle:hover {
    border-color: var(--primary-color);
}

/* User Dropdown in White Topbar */
.top-navbar .pos-user-dropdown {
    position: relative;
}

.top-navbar .pos-user-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 3px 8px 3px 4px;
    border-radius: 999px;
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 150ms ease;
}

.top-navbar .pos-user-trigger:hover {
    background: var(--surface-subtle);
    border-color: var(--border-color);
}

.top-navbar .pos-user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    object-fit: cover;
    border: 1.5px solid var(--primary-color);
}

.top-navbar .pos-user-meta {
    text-align: left;
    line-height: 1.2;
}

.top-navbar .pos-user-meta .pum-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--dark-text);
    max-width: 125px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.top-navbar .pos-user-meta .pum-role {
    font-size: 10.5px;
    color: var(--gray-text);
}

.top-navbar .pos-user-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 200px;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    padding: 6px;
    list-style: none;
    margin: 0;
    z-index: 1050;
    display: none;
}

.top-navbar .pos-user-dropdown.active .pos-user-menu {
    display: block;
}

.top-navbar .pos-user-menu li a {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 11px;
    border-radius: 6px;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--dark-text);
    text-decoration: none;
    transition: background-color 140ms ease, color 140ms ease;
}

.top-navbar .pos-user-menu li a:hover {
    background: var(--primary-soft);
    color: var(--primary-color);
}

.top-navbar .pos-user-menu li a.um-logout:hover {
    background: var(--danger-soft);
    color: var(--danger-color);
}

.top-navbar .pos-user-menu li a i {
    width: 15px;
    text-align: center;
}

/* ============================================================================
   4. BROWSER-STYLE MULTI-TAB BAR
   ============================================================================ */
.tab-bar {
    background: var(--white);
    border-bottom: 1px solid var(--border-color);
    padding: 0;
    margin: 0;
    display: flex;
    align-items: center;
    min-height: 36px;
    box-shadow: var(--shadow-xs);
    position: sticky;
    top: var(--pos-topbar-height);
    z-index: 95;
}

.tab-container {
    display: flex;
    flex: 1;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
}

.tab-container::-webkit-scrollbar {
    display: none;
}

.tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border-right: 1px solid var(--border-color);
    background: var(--surface-subtle);
    color: var(--gray-text);
    cursor: pointer;
    transition: all 150ms ease;
    min-width: 110px;
    max-width: 190px;
    white-space: nowrap;
    font-size: 12px;
    font-weight: 500;
    border-bottom: 2px solid transparent;
}

.tab.active {
    background: var(--white);
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    font-weight: 600;
}

.tab:hover {
    background: var(--primary-soft);
    color: var(--primary-color);
}

.tab-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tab-close {
    width: 17px;
    height: 17px;
    border-radius: 999px;
    background: var(--muted-text);
    color: #FFFFFF;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    opacity: 0;
    transition: all 140ms ease;
    cursor: pointer;
    flex-shrink: 0;
}

.tab:hover .tab-close,
.tab.active .tab-close {
    opacity: 0.7;
}

.tab-close:hover {
    background: var(--danger-color);
    opacity: 1 !important;
}

.tab-controls {
    padding: 4px 8px;
    border-left: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 4px;
}

.tab-control-btn {
    width: 26px;
    height: 26px;
    border: none;
    background: none;
    color: var(--gray-text);
    cursor: pointer;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all 140ms ease;
}

.tab-control-btn:hover {
    background: var(--surface-subtle);
    color: var(--primary-color);
}

.page-content {
    padding: 14px 18px;
    flex: 1;
}

.tab-panel {
    display: none;
    position: relative;
    width: 100%;
}

.tab-panel.active {
    display: block;
}

.tab-iframe {
    display: block;
    width: 100%;
    height: var(--tab-iframe-height, calc(100vh - 102px));
    min-height: 420px;
    border: 0;
    background: var(--light-bg);
}

.tab-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 13px;
    color: var(--gray-text);
    background: var(--light-bg);
    z-index: 2;
    transition: opacity 180ms ease;
}

.tab-panel.loaded .tab-loading {
    opacity: 0;
    pointer-events: none;
}

/* Embedded iframe mode (also prevents nested sidebar/topbar if redirected inside iframe) */
body.embedded {
    background: var(--light-bg) !important;
}

body.embedded aside.sidebar.modern-sidebar,
body.embedded .menu-panels,
body.embedded .panel-overlay,
body.embedded .sidebar-overlay,
body.embedded .top-navbar,
body.embedded .tab-bar {
    display: none !important;
}

body.embedded .main-content {
    margin-left: 0 !important;
}

.embedded-page-content {
    padding: 14px 18px;
    min-height: 100vh;
    background: var(--light-bg);
}

/* ============================================================================
   5. RESPONSIVE (MOBILE & TABLET)
   ============================================================================ */
.sidebar-overlay {
    display: none;
}

@media (max-width: 1100px) {
    .top-navbar .top-breadcrumb {
        display: none;
    }
}

@media (max-width: 768px) {
    :root {
        --pos-sidebar-width: 0px;
        --pos-sidebar-expanded-width: 256px;
    }

    aside.sidebar.modern-sidebar {
        width: var(--pos-sidebar-expanded-width);
        transform: translateX(-100%);
        visibility: hidden;
        pointer-events: none;
        z-index: 1050;
        transition: transform var(--pos-sidebar-transition), visibility 0s linear 280ms;
    }

    aside.sidebar.modern-sidebar.expanded {
        transform: translateX(0);
        visibility: visible;
        pointer-events: auto;
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.35);
        transition: transform var(--pos-sidebar-transition), visibility 0s linear 0s;
    }

    aside.sidebar.modern-sidebar .sidebar-brand h4,
    aside.sidebar.modern-sidebar .sidebar-user .sidebar-text,
    aside.sidebar.modern-sidebar .nav-link .sidebar-text,
    aside.sidebar.modern-sidebar .nav-link .cat-chevron,
    aside.sidebar.modern-sidebar .logout-btn .sidebar-text {
        display: block;
    }

    aside.sidebar.modern-sidebar .nav-link,
    aside.sidebar.modern-sidebar .logout-btn {
        justify-content: flex-start;
    }

    aside.sidebar.modern-sidebar .nav-link::after,
    aside.sidebar.modern-sidebar .logout-btn::after {
        display: none !important;
    }

    .main-content,
    aside.sidebar.modern-sidebar.expanded ~ .main-content {
        margin-left: 0 !important;
    }

    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.5);
        backdrop-filter: blur(2px);
        z-index: 1040;
    }

    .sidebar-overlay.show {
        display: block;
    }

    .menu-panels,
    aside.sidebar.modern-sidebar.expanded ~ .menu-panels {
        left: 0 !important;
        width: 100%;
        max-width: 330px;
        z-index: 1100;
    }

    .panel-overlay {
        z-index: 1099;
    }

    .menu-panel {
        width: 100%;
        max-width: 330px;
    }

    .panel-back-btn {
        display: inline-flex;
    }

    .panel-grid {
        display: flex;
        flex-direction: column;
        gap: 7px;
    }

    .panel-item {
        flex-direction: row;
        justify-content: flex-start;
        text-align: left;
        min-height: 46px;
        padding: 10px 12px;
        gap: 11px;
    }

    .panel-item::before {
        width: 3px;
        height: 100%;
        right: auto;
        border-radius: 8px 0 0 8px;
    }

    .panel-item:hover::before {
        width: 3px;
    }

    .panel-item:hover {
        transform: none;
        background: var(--primary-soft);
        color: var(--primary-color) !important;
    }

    .panel-item:hover i,
    .panel-item:hover span {
        color: var(--primary-color) !important;
    }

    .panel-item i {
        margin-bottom: 0;
        font-size: 16px;
        width: 24px;
        text-align: center;
    }

    .panel-item span {
        font-size: 12.5px;
    }

    .top-navbar .pos-user-meta,
    .top-navbar .app-env-pill {
        display: none;
    }

    .page-content,
    .embedded-page-content {
        padding: 10px 12px;
    }
}

@media print {
    aside.sidebar.modern-sidebar,
    .menu-panels,
    .panel-overlay,
    .sidebar-overlay,
    .top-navbar,
    .tab-bar {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
    }
}
