/* Copied verbatim from legacy layout_shell.php (main <style> block). Do not edit by hand. */
:root {
    --sidebar-width: 76px;
    --sidebar-expanded: 232px;
    --topbar-height: 62px;
    --bg-body: #f4f7fb;
    --bg-panel: #ffffff;
    --text-main: #111827;
    --text-soft: #64748b;
    --border: #e5eaf3;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --shadow-sm: 0 10px 25px rgba(15,23,42,.05);
    --footer-height: 42px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 14px;
    background: linear-gradient(180deg,#f8fbff 0%,#f3f6fb 100%);
    color: var(--text-main);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

body.sidebar-open {
    overflow: hidden;
}

a {
    text-decoration: none;
}

img,
video,
canvas,
svg {
    max-width: 100%;
    height: auto;
}

.app-shell {
    display: flex;
    min-height: 100vh;
    min-height: 100dvh;
    width: 100%;
    overflow-x: hidden;
}

.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    height: 100dvh;
    background: linear-gradient(180deg,#0f172a 0%,#172554 55%,#1e3a8a 100%);
    color: #fff;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1050;
    transition: width .25s ease, transform .25s ease;
    box-shadow: 6px 0 30px rgba(15,23,42,.15);
    overflow: hidden;
}

.sidebar-top {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 22px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}

.logo-mark {
    width: 42px;
    height: 42px;
    min-width: 42px;
    border-radius: 14px;
    background: linear-gradient(135deg,#60a5fa 0%,#22c55e 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 16px;
    color: #fff;
}

.logo-text,
.menu-text,
.dropdown-arrow {
    opacity: 0;
    white-space: nowrap;
    transition: opacity .2s ease;
}

.logo-text h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 750;
    color: #fff;
}

.logo-text p {
    margin: 3px 0 0;
    font-size: 11px;
    color: rgba(255,255,255,.72);
}

.sidebar-menu {
    padding: 18px 14px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.scroll-menu {
    height: calc(100vh - 140px);
    height: calc(100dvh - 140px);
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 4px;
}

.scroll-menu::-webkit-scrollbar {
    width: 6px;
}

.scroll-menu::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,.18);
    border-radius: 999px;
}

/* (legacy: extra scrollbar rules applied only on Supplier_management.php — not part of this page) */

.menu-item {
    display: flex;
    align-items: center;
    gap: 14px;
    color: rgba(255,255,255,.88);
    padding: 12px 14px;
    border-radius: 16px;
    transition: background .2s ease, color .2s ease;
    min-height: 50px;
}

.menu-item:hover,
.menu-item.active {
    background: rgba(255,255,255,.12);
    color: #fff;
}

.menu-icon {
    width: 34px;
    min-width: 34px;
    height: 34px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,.10);
    font-size: 14px;
    font-weight: 750;
}

.menu-text {
    font-size: 14px;
    font-weight: 650;
}

.dropdown-toggle-btn {
    width: 100%;
    border: none;
    background: transparent;
    text-align: left;
    cursor: pointer;
    font: inherit;
}

.dropdown-arrow {
    margin-left: auto;
    color: rgba(255,255,255,.8);
    font-size: 12px;
    transition: opacity .2s ease, transform .2s ease;
}

.menu-dropdown.open .dropdown-arrow {
    transform: rotate(180deg);
}

.submenu {
    display: none;
    margin: 6px 0 10px 48px;
    padding-left: 8px;
    border-left: 1px solid rgba(255,255,255,.12);
}

.menu-dropdown.open .submenu {
    display: block;
}

.submenu-item {
    display: block;
    color: rgba(255,255,255,.82);
    font-size: 13px;
    font-weight: 500;
    padding: 9px 12px;
    border-radius: 10px;
    margin-bottom: 4px;
}

.submenu-item:hover,
.submenu-item.active {
    background: rgba(255,255,255,.10);
    color: #fff;
}

.sidebar-footer {
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: 16px;
}

.logout-link {
    display: flex;
    align-items: center;
    gap: 14px;
    background: rgba(239,68,68,.16);
    color: #fff;
    border: 1px solid rgba(255,255,255,.08);
    padding: 12px 14px;
    border-radius: 16px;
}

.main-wrapper {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-width: 0;
    width: calc(100% - var(--sidebar-width));
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    min-height: var(--topbar-height);
    background: rgba(255,255,255,.92);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 28px;
    gap: 14px;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
    flex: 1 1 auto;
}

.mobile-toggle {
    display: none;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 12px;
    background: #eef4ff;
    color: var(--primary-dark);
    font-size: 22px;
    font-weight: 800;
    cursor: pointer;
    flex: 0 0 auto;
}

.page-title {
    min-width: 0;
    overflow: hidden;
}

.page-title h1 {
    margin: 0;
    font-size: 22px;
    line-height: 1.15;
    font-weight: 750;
    color: #111827;
    overflow-wrap: anywhere;
}

.page-title p {
    margin: 4px 0 0;
    font-size: 13px;
    color: var(--text-soft);
}

.header-quick-buttons {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    width: 100%;
}

.header-quick-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 1 1 0;
    min-width: 0;
    min-height: 42px;
    padding: 10px 12px;
    border: 0;
    border-radius: 10px;
    background: linear-gradient(135deg,#6d5dfc,#7c3aed);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    text-decoration: none;
    box-shadow: none;
    white-space: nowrap;
}

.header-quick-button:hover,
.header-quick-button.active {
    background: linear-gradient(135deg,#6d5dfc,#7c3aed);
    color: #fff;
    text-decoration: none;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 0 0 auto;
}

.language-selector-form {
    flex: 0 0 auto;
    margin: 0;
}

.language-selector {
    height: 38px;
    min-width: 148px;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: #fff;
    color: #111827;
    padding: 0 34px 0 12px;
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    outline: none;
}

.language-selector:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.purchase-dashboard-link {
    height: 38px;
    padding: 0 14px;
    border-radius: 13px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    font-size: 12.5px;
    font-weight: 750;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    box-shadow: 0 8px 20px rgba(37, 99, 235, .18);
    text-decoration: none;
    transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}

.purchase-dashboard-link:hover {
    color: #fff;
    text-decoration: none;
    transform: translateY(-1px);
    background: linear-gradient(135deg, var(--primary-dark), #1e40af);
    box-shadow: 0 12px 24px rgba(37, 99, 235, .24);
}

.core-crm-dashboard-link {
    background: linear-gradient(135deg, #0f766e, #0891b2);
    box-shadow: 0 8px 20px rgba(8, 145, 178, .22);
}

.core-crm-dashboard-link:hover {
    background: linear-gradient(135deg, #115e59, #0e7490);
    box-shadow: 0 12px 24px rgba(8, 145, 178, .30);
}

@media (max-width: 767px) {
    .purchase-dashboard-link {
        height: 38px;
        padding: 0 11px;
        border-radius: 12px;
        font-size: 12px;
    }
}

@media (max-width: 420px) {
    .purchase-dashboard-link {
        padding: 0 10px;
        font-size: 11.5px;
    }
}


.site-visit-shipment-header-center a {
    display: none !important;
}

.epc-dashboard-link {
    height: 38px;
    padding: 0 14px;
    border-radius: 13px;
    background: linear-gradient(135deg, #6d5dfc, #7c3aed);
    color: #fff;
    font-size: 12.5px;
    font-weight: 750;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    white-space: nowrap;
    box-shadow: 0 10px 24px rgba(124, 58, 237, .20);
    text-decoration: none;
}

.epc-dashboard-link:hover {
    color: #fff;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 14px 30px rgba(124, 58, 237, .26);
}

.epc-dashboard-link span:first-child {
    font-size: 14px;
    line-height: 1;
}

.crm-dashboard-top-link {
    background: linear-gradient(135deg, #C8412A, #C87C1A) !important;
}

.crm-dashboard-top-link:hover {
    background: linear-gradient(135deg, #b33522, #b86f16) !important;
}


.user-chip {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 8px 12px;
    box-shadow: var(--shadow-sm);
}

.avatar {
    width: 42px;
    height: 42px;
    min-width: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg,#1d4ed8 0%,#60a5fa 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 750;
    font-size: 14px;
}

.user-meta strong {
    display: block;
    font-size: 14px;
    color: #111827;
}

.user-meta span {
    font-size: 12px;
    color: var(--text-soft);
    text-transform: capitalize;
}

.page-content {
    padding: 24px;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    flex: 1 1 auto;
}

.page-content input,
.page-content select,
.page-content textarea,
.page-content button {
    max-width: 100%;
}

.bottom-bar {
    background: rgba(255,255,255,.92);
    border-top: 1px solid var(--border);
    padding: 12px 20px;
    color: var(--text-soft);
    font-size: 12.5px;
    flex: 0 0 auto;
}

.footer-inner {
    width: 100%;
    max-width: 1440px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.footer-left {
    color: #64748b;
    font-size: 12.5px;
    font-weight: 500;
}

.footer-links {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.footer-links a {
    color: #334155;
    font-size: 12.5px;
    font-weight: 650;
    text-decoration: none;
    transition: color .18s ease;
}

.footer-links a:hover {
    color: #2563eb;
}

.footer-recent-label {
    color: #94a3b8;
    font-size: 12px;
    font-weight: 650;
}


.mobile-sidebar-overlay {
    display: none;
}

.header-logo img {
    height: 85px;
    width: 100px;
    object-fit: contain;
    display: block;
}

/* DESKTOP HOVER ONLY */
@media (hover: hover) and (min-width: 992px) {
    .sidebar:hover {
        width: var(--sidebar-expanded);
    }

    .sidebar:hover .logo-text,
    .sidebar:hover .menu-text,
    .sidebar:hover .dropdown-arrow {
        opacity: 1;
    }
}

/* TABLET + MOBILE DRAWER */
@media (max-width: 991px) {
    :root {
        --topbar-height: 74px;
    }

    html,
    body {
        font-size: 16px;
    }

    .app-shell {
        display: block;
    }

    .sidebar {
        width: min(320px, 86vw);
        max-width: calc(100vw - 42px);
        transform: translate3d(-110%, 0, 0);
        box-shadow: 18px 0 40px rgba(15,23,42,.25);
        display: flex;
        flex-direction: column;
    }

    .sidebar.open {
        transform: translate3d(0, 0, 0);
    }

    .logo-text,
    .menu-text,
    .dropdown-arrow {
        opacity: 1;
    }

    .sidebar-top {
        flex: 0 0 var(--topbar-height);
        height: var(--topbar-height);
        padding: 14px 16px;
    }

    .sidebar-menu.scroll-menu {
        flex: 1 1 auto;
        height: auto;
        padding: 14px 12px 10px;
        overflow-y: auto;
        overflow-x: hidden;
    }

    .sidebar-footer {
        position: static;
        left: auto;
        right: auto;
        bottom: auto;
        padding: 10px 12px calc(14px + env(safe-area-inset-bottom));
        border-top: 1px solid rgba(255,255,255,.08);
        background: rgba(15,23,42,.08);
    }

    .main-wrapper {
        margin-left: 0;
        width: 100%;
    }

    .mobile-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .topbar {
        min-height: var(--topbar-height);
        height: auto;
        padding: 12px 16px;
    }

    .page-title h1 {
        font-size: 22px;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .page-title p {
        font-size: 13px;
    }

    .user-chip {
        padding: 7px;
        border-radius: 15px;
    }

    .avatar {
        width: 42px;
        height: 42px;
        min-width: 42px;
        font-size: 15px;
    }

    .page-content {
        padding: 18px 16px;
    }

    .mobile-sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(15,23,42,.45);
        z-index: 1040;
    }

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

    .menu-item {
        min-height: 52px;
    }

    .menu-text {
        font-size: 15px;
    }

    .submenu {
        margin-left: 44px;
    }

    .submenu-item {
        font-size: 14px;
        padding: 12px 14px;
    }
}

/* MOBILE */
@media (max-width: 767px) {
    :root {
        --topbar-height: 72px;
    }

    .topbar {
        padding: 12px 14px;
        gap: 10px;
    }

    .topbar-left {
        gap: 10px;
    }

    .topbar-right {
        gap: 8px;
    }

    .language-selector {
        min-width: 112px;
        height: 38px;
        padding-left: 10px;
        padding-right: 24px;
        font-size: 12px;
    }

    .mobile-toggle {
        width: 48px;
        height: 48px;
        min-width: 48px;
        font-size: 24px;
    }

    .page-title h1 {
        font-size: clamp(21px, 6vw, 24px);
        max-width: none;
        white-space: normal;
        text-overflow: clip;
    }

    .page-title p {
        display: none;
    }

    .header-quick-buttons {
        gap: 6px;
        margin-top: 7px;
    }

    .header-quick-button {
        min-height: 32px;
        padding: 7px 10px;
        font-size: 12px;
    }

    .user-meta {
        display: none;
    }

    .epc-dashboard-link {
        height: 38px;
        padding: 0 11px;
        border-radius: 12px;
        font-size: 0;
        gap: 0;
    }

    .epc-dashboard-link span:first-child {
        font-size: 15px;
    }

    .epc-dashboard-link span:last-child {
        display: none;
    }


    .user-chip {
        padding: 0;
        border: 0;
        background: transparent;
        box-shadow: none;
    }

    .avatar {
        width: 46px;
        height: 46px;
        min-width: 46px;
        font-size: 16px;
    }

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

    .page-content > table,
    .page-content .table,
    .page-content .data-table,
    .page-content .table-responsive table {
        display: block;
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
    }

    .bottom-bar {
        padding: 13px 14px calc(14px + env(safe-area-inset-bottom));
        font-size: 12px;
    }

    .footer-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .footer-links {
        gap: 10px 14px;
    }

    .sidebar {
        width: min(320px, 88vw);
        max-width: calc(100vw - 36px);
    }

    .sidebar-menu.scroll-menu {
        padding-top: 12px;
    }
}

/* SMALL MOBILE */
@media (max-width: 420px) {
    .topbar {
        padding: 11px 12px;
    }

    .page-title h1 {
        font-size: 21px;
    }

    .avatar {
        width: 44px;
        height: 44px;
        min-width: 44px;
    }

    .mobile-toggle {
        width: 46px;
        height: 46px;
        min-width: 46px;
    }

    .language-selector {
        min-width: 96px;
        max-width: 34vw;
    }

    .sidebar {
        width: min(310px, 90vw);
        max-width: calc(100vw - 28px);
    }

    .menu-item {
        padding: 11px 12px;
    }
}

@media (max-width: 360px) {
    .topbar-right .epc-dashboard-link,
    .topbar-right .user-chip {
        display: none;
    }

    .language-selector {
        max-width: 42vw;
    }
}

/* =========================
   COMPACT LAYOUT OPTIMIZATION
========================= */
.sidebar-top {
    height: var(--topbar-height);
    gap: 10px;
    padding: 12px 18px;
}

.logo-mark {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 12px;
    font-size: 14px;
}

.logo-text h2 {
    font-size: 14px;
}

.logo-text p {
    font-size: 10.5px;
    margin-top: 2px;
}

.sidebar-menu {
    padding: 12px 10px 10px;
    gap: 5px;
}

.scroll-menu {
    height: calc(100vh - 114px);
    height: calc(100dvh - 114px);
}

.menu-item {
    min-height: 42px;
    padding: 8px 10px;
    gap: 12px;
    border-radius: 13px;
}

.menu-icon {
    width: 30px;
    min-width: 30px;
    height: 30px;
    border-radius: 10px;
    font-size: 12px;
}

.menu-text {
    font-size: 13px;
    font-weight: 650;
}

.dropdown-arrow {
    font-size: 11px;
}

.submenu {
    margin: 4px 0 8px 40px;
}

.submenu-item {
    font-size: 12.5px;
    padding: 7px 10px;
    border-radius: 9px;
}

.sidebar-footer {
    left: 10px;
    right: 10px;
    bottom: 10px;
}

.logout-link {
    min-height: 42px;
    padding: 8px 10px;
    border-radius: 13px;
}

.topbar {
    min-height: var(--topbar-height);
    padding: 10px 20px;
    gap: 12px;
}

.topbar-left {
    gap: 12px;
}

.page-title h1 {
    font-size: 19px;
    line-height: 1.15;
}

.page-title p {
    font-size: 12px;
    margin-top: 2px;
}

.user-chip {
    gap: 9px;
    padding: 6px 10px;
    border-radius: 14px;
}

.avatar {
    width: 36px;
    height: 36px;
    min-width: 36px;
    font-size: 13px;
}

.user-meta strong {
    font-size: 13px;
}

.user-meta span {
    font-size: 11.5px;
}

.page-content {
    padding: 16px;
}

.bottom-bar {
    padding: 9px 18px;
    font-size: 12px;
}

.footer-left,
.footer-links a {
    font-size: 12px;
}

.footer-links {
    gap: 14px;
}

@media (max-width: 991px) {
    :root {
        --topbar-height: 62px;
    }

    .sidebar {
        width: 280px;
    }

    .sidebar:hover {
        width: 280px;
    }

    .mobile-toggle {
        width: 40px;
        height: 40px;
        min-width: 40px;
        font-size: 21px;
    }

    .topbar {
        padding: 9px 12px;
    }

    .page-title h1 {
        font-size: 19px;
    }

    .avatar {
        width: 38px;
        height: 38px;
    }

    .menu-item {
        min-height: 52px;
        padding: 12px 14px;
    }

    .menu-icon {
        width: 38px;
        height: 38px;
        min-width: 38px;
        font-size: 15px;
    }

    .menu-text {
        font-size: 15px;
    }

    .submenu-item {
        font-size: 14px;
        padding: 10px 12px;
    }
}

@media (max-width: 767px) {
    .page-content {
        padding: 12px;
    }

    .page-title h1 {
        font-size: 18px;
    }

    .footer-inner {
        gap: 7px;
    }

    .footer-links {
        gap: 8px 12px;
    }
}


/* Mobile/tablet header and footer alignment */
@media (max-width: 991px) {
    .topbar {
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        overflow: visible;
    }

    .topbar-left {
        flex: 1 1 auto;
        min-width: 0;
        max-width: 100%;
    }

    .topbar-right {
        flex: 0 1 auto;
        min-width: 0;
        justify-content: flex-end;
        flex-wrap: wrap;
    }

    .footer-inner {
        max-width: 100%;
        flex-wrap: wrap;
        align-items: center;
    }

    .footer-left,
    .footer-links {
        min-width: 0;
    }
}

@media (max-width: 767px) {
    .topbar {
        align-items: center;
    }

    .topbar-left {
        flex: 1 1 calc(100% - 58px);
    }

    .topbar-right {
        flex: 1 1 100%;
        width: 100%;
        justify-content: flex-end;
        margin-top: 6px;
    }

    .footer-inner {
        align-items: center;
        text-align: center;
    }

    .footer-left {
        width: 100%;
    }

    .footer-links {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 420px) {
    .topbar {
        row-gap: 8px;
    }

    .topbar-right {
        justify-content: center;
    }
}




/* =========================================================
   RESPONSIVE HEADER + SIDEBAR REFINEMENT
   Mobile and tablet only. Desktop and footer remain unchanged.
========================================================= */
@media (max-width: 991px) {
    .topbar {
        width: 100%;
        min-width: 0;
        padding: 9px 14px;
        gap: 10px;
        flex-wrap: nowrap;
        align-items: center;
    }

    .topbar-left {
        flex: 1 1 auto;
        min-width: 0;
        max-width: 100%;
        gap: 10px;
    }

    .page-title {
        flex: 1 1 auto;
        min-width: 0;
    }

    .page-title h1 {
        font-size: 18px;
        line-height: 1.2;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .page-title p {
        font-size: 11.5px;
        line-height: 1.3;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .topbar-right {
        flex: 0 1 auto;
        min-width: 0;
        max-width: 58%;
        gap: 7px;
        flex-wrap: nowrap;
        justify-content: flex-end;
    }

    .language-selector {
        min-width: 118px;
        max-width: 150px;
        height: 36px;
        padding: 0 30px 0 10px;
        font-size: 11.5px;
    }

    .purchase-dashboard-link,
    .epc-dashboard-link {
        height: 36px;
        min-width: 0;
        padding: 0 11px;
        font-size: 11.5px;
        border-radius: 11px;
    }

    .user-chip {
        min-width: 0;
        padding: 5px 8px;
        gap: 7px;
    }

    .user-meta {
        min-width: 0;
        max-width: 120px;
    }

    .user-meta strong,
    .user-meta span {
        display: block;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .sidebar-menu.scroll-menu {
        padding: 10px 10px 8px;
    }

    .menu-item {
        min-height: 44px;
        padding: 8px 10px;
        gap: 10px;
        border-radius: 12px;
    }

    .menu-icon {
        width: 32px;
        height: 32px;
        min-width: 32px;
        font-size: 12px;
        border-radius: 9px;
    }

    .menu-text {
        min-width: 0;
        font-size: 13px;
        line-height: 1.25;
        overflow-wrap: anywhere;
    }

    .submenu {
        margin: 4px 0 7px 38px;
        padding-left: 7px;
    }

    .submenu-item {
        font-size: 12px;
        line-height: 1.3;
        padding: 7px 9px;
        margin-bottom: 3px;
    }

    .logout-link {
        min-height: 44px;
        padding: 8px 10px;
    }
}

@media (max-width: 767px) {
    .topbar {
        padding: 9px 11px;
        gap: 8px;
        flex-wrap: wrap;
    }

    .topbar-left {
        flex: 1 1 100%;
        width: 100%;
        gap: 8px;
    }

    .mobile-toggle {
        width: 38px;
        height: 38px;
        min-width: 38px;
        font-size: 20px;
        border-radius: 10px;
    }

    .page-title h1 {
        font-size: 17px;
    }

    .topbar-right {
        flex: 1 1 100%;
        width: 100%;
        max-width: 100%;
        margin-top: 0;
        justify-content: flex-end;
        gap: 6px;
        flex-wrap: wrap;
    }

    .language-selector {
        min-width: 104px;
        max-width: 138px;
        height: 34px;
        font-size: 11px;
    }

    .purchase-dashboard-link,
    .epc-dashboard-link {
        height: 34px;
        padding: 0 10px;
        font-size: 11px;
    }

    .avatar {
        width: 36px;
        height: 36px;
        min-width: 36px;
        font-size: 13px;
    }

    .sidebar {
        width: min(276px, 88vw);
        max-width: calc(100vw - 28px);
    }

    .sidebar-top {
        padding: 10px 13px;
    }

    .sidebar-menu.scroll-menu {
        padding: 9px 9px 7px;
    }

    .menu-item {
        min-height: 42px;
        padding: 7px 9px;
    }

    .menu-icon {
        width: 30px;
        height: 30px;
        min-width: 30px;
        font-size: 11.5px;
    }

    .menu-text {
        font-size: 12.5px;
    }

    .submenu {
        margin-left: 35px;
    }

    .submenu-item {
        font-size: 11.75px;
        padding: 7px 8px;
    }
}

@media (max-width: 420px) {
    .topbar-right {
        justify-content: flex-start;
    }

    .language-selector {
        flex: 1 1 112px;
        max-width: 145px;
    }

    .purchase-dashboard-link,
    .epc-dashboard-link {
        flex: 0 1 auto;
    }
}

.callback-open-btn {
    width: 100%;
    border: 0;
    background: transparent;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.callback-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(15, 23, 42, .45);
}

.callback-modal-overlay.show {
    display: flex;
}

.callback-modal {
    width: min(420px, 100%);
    max-height: calc(100dvh - 32px);
    overflow-y: auto;
    background: var(--bg-panel);
    color: var(--text-main);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(15, 23, 42, .25);
    padding: 20px;
}

.callback-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.callback-modal-header h3 {
    margin: 0;
    font-size: 18px;
}

.callback-close-btn {
    border: 0;
    background: transparent;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    color: var(--text-soft);
}

.callback-form-group {
    margin-bottom: 14px;
}

.callback-form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
}

.callback-form-group input,
.callback-form-group select,
.callback-form-group textarea {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px;
    font: inherit;
    outline: none;
}

.callback-form-group select {
    display: block;
    appearance: auto;
    -webkit-appearance: menulist;
}

.callback-send-btn {
    width: 100%;
    border: 0;
    border-radius: 10px;
    padding: 11px 14px;
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}

.callback-send-btn:disabled {
    opacity: .65;
    cursor: not-allowed;
}

.callback-message {
    margin-top: 10px;
    font-size: 13px;
}



@media (max-width: 575px) {
    .callback-modal-overlay {
        align-items: flex-end;
        padding: 10px;
    }

    .callback-modal {
        width: 100%;
        max-height: calc(100dvh - 20px);
        border-radius: 14px;
        padding: 16px;
    }
}


/* Authorized quick buttons: responsive header placement */
.topbar.has-header-quick-buttons {
    height: auto !important;
    min-height: var(--topbar-height) !important;
    overflow: visible !important;
    align-items: flex-start !important;
}

.topbar.has-header-quick-buttons .topbar-left {
    align-items: flex-start !important;
    min-width: 0 !important;
}

.topbar.has-header-quick-buttons .page-title {
    flex: 1 1 auto !important;
    width: 100% !important;
    overflow: visible !important;
}

.topbar.has-header-quick-buttons .header-quick-buttons {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 8px !important;
    width: min(100%, 520px) !important;
    margin-top: 10px !important;
}

.topbar.has-header-quick-buttons .header-quick-button {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

/* Tablet/mobile: keep title first, buttons directly below it, no clipping */
@media (max-width: 991px) {
    .topbar.has-header-quick-buttons {
        flex-wrap: wrap !important;
        height: auto !important;
        min-height: 0 !important;
        padding: 12px 14px !important;
        gap: 10px !important;
    }

    .topbar.has-header-quick-buttons .topbar-left {
        flex: 1 1 100% !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    .topbar.has-header-quick-buttons .page-title h1 {
        white-space: normal !important;
        overflow: visible !important;
        text-overflow: clip !important;
        line-height: 1.2 !important;
    }

    .topbar.has-header-quick-buttons .header-quick-buttons {
        width: 100% !important;
        max-width: 100% !important;
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        gap: 7px !important;
        margin-top: 9px !important;
    }

    .topbar.has-header-quick-buttons .header-quick-button {
        min-height: 38px !important;
        padding: 9px 8px !important;
        font-size: 12px !important;
        line-height: 1.15 !important;
        white-space: normal !important;
        word-break: keep-all !important;
    }

    .topbar.has-header-quick-buttons .topbar-right {
        flex: 1 1 100% !important;
        width: 100% !important;
        max-width: 100% !important;
        justify-content: flex-end !important;
        flex-wrap: wrap !important;
    }
}

/* Very small screens: stack buttons vertically to avoid overlap */
@media (max-width: 420px) {
    .topbar.has-header-quick-buttons {
        padding: 11px 12px !important;
    }

    .topbar.has-header-quick-buttons .page-title h1 {
        text-align: center;
    }

    .topbar.has-header-quick-buttons .topbar-right {
        justify-content: center !important;
    }

    .topbar.has-header-quick-buttons .header-quick-button {
        min-height: 36px !important;
        font-size: 12px !important;
        white-space: nowrap !important;
    }
}


/* =========================================================
   FINAL MOBILE / TABLET HEADER OPTIMISATION
   Header only. Desktop styles and all functionality unchanged.
========================================================= */
@media (max-width: 991px) {
    .topbar,
    .topbar.has-header-quick-buttons {
        width: 100%;
        max-width: 100%;
        min-height: var(--topbar-height) !important;
        height: auto !important;
        padding: 10px 14px !important;
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center !important;
        column-gap: 10px !important;
        row-gap: 8px !important;
        overflow: hidden !important;
    }

    .topbar-left,
    .topbar.has-header-quick-buttons .topbar-left {
        width: auto !important;
        min-width: 0 !important;
        max-width: 100% !important;
        display: flex;
        align-items: center !important;
        gap: 9px !important;
        overflow: hidden;
    }

    .mobile-toggle {
        flex: 0 0 38px;
        width: 38px;
        min-width: 38px;
        height: 38px;
        border-radius: 10px;
        font-size: 20px;
    }

    .page-title,
    .topbar.has-header-quick-buttons .page-title {
        flex: 1 1 auto !important;
        width: auto !important;
        min-width: 0 !important;
        max-width: 100% !important;
        overflow: hidden !important;
    }

    .page-title h1,
    .topbar.has-header-quick-buttons .page-title h1 {
        margin: 0;
        max-width: 100%;
        font-size: 18px;
        line-height: 1.2 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    .page-title p {
        margin-top: 2px;
        max-width: 100%;
        font-size: 11.5px;
        line-height: 1.25;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .topbar-right,
    .topbar.has-header-quick-buttons .topbar-right {
        width: auto !important;
        min-width: 0 !important;
        max-width: min(62vw, 620px) !important;
        margin: 0 !important;
        display: flex;
        align-items: center;
        justify-content: flex-end !important;
        flex-wrap: wrap !important;
        gap: 6px !important;
        overflow: hidden;
    }

    .language-selector-form {
        min-width: 0;
    }

    .language-selector {
        width: auto;
        min-width: 104px;
        max-width: 132px;
        height: 34px;
        padding: 0 26px 0 9px;
        border-radius: 10px;
        font-size: 11px;
    }

    .purchase-dashboard-link,
    .epc-dashboard-link {
        flex: 0 1 auto;
        min-width: 0;
        max-width: 150px;
        height: 34px;
        padding: 0 9px;
        border-radius: 10px;
        font-size: 11px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .user-chip {
        flex: 0 0 auto;
        min-width: 0;
        max-width: 150px;
        padding: 4px 7px;
        gap: 6px;
        border-radius: 12px;
        overflow: hidden;
    }

    .avatar {
        flex: 0 0 34px;
        width: 34px;
        min-width: 34px;
        height: 34px;
        font-size: 12px;
    }

    .user-meta {
        min-width: 0;
        max-width: 92px;
    }

    .user-meta strong,
    .user-meta span {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .topbar.has-header-quick-buttons .header-quick-buttons {
        width: 100% !important;
        max-width: 100% !important;
        margin-top: 7px !important;
        gap: 6px !important;
    }
}

@media (max-width: 767px) {
    .topbar,
    .topbar.has-header-quick-buttons {
        grid-template-columns: minmax(0, 1fr);
        padding: 9px 11px !important;
        row-gap: 7px !important;
    }

    .topbar-left,
    .topbar.has-header-quick-buttons .topbar-left {
        width: 100% !important;
    }

    .page-title h1,
    .topbar.has-header-quick-buttons .page-title h1 {
        font-size: 17px;
    }

    .page-title p {
        display: none;
    }

    .topbar-right,
    .topbar.has-header-quick-buttons .topbar-right {
        width: 100% !important;
        max-width: 100% !important;
        justify-content: flex-end !important;
        overflow: visible;
    }

    .user-meta {
        display: none;
    }

    .user-chip {
        max-width: none;
        padding: 0;
        border: 0;
        background: transparent;
        box-shadow: none;
    }

    .purchase-dashboard-link,
    .epc-dashboard-link {
        max-width: 132px;
    }
}

@media (max-width: 575px) {
    .topbar-right,
    .topbar.has-header-quick-buttons .topbar-right {
        display: grid;
        grid-template-columns: minmax(92px, 1fr) repeat(2, minmax(0, 1fr)) auto;
        align-items: center;
        gap: 5px !important;
    }

    .language-selector-form,
    .language-selector {
        width: 100%;
        min-width: 0;
        max-width: none;
    }

    .purchase-dashboard-link,
    .epc-dashboard-link {
        width: 100%;
        max-width: none;
        padding: 0 7px;
        font-size: 10.5px;
    }

    .topbar-right .epc-dashboard-link {
        min-width: 34px;
    }

    .topbar.has-header-quick-buttons .header-quick-buttons {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    }
}

@media (max-width: 420px) {
    .topbar,
    .topbar.has-header-quick-buttons {
        padding: 8px 9px !important;
    }

    .mobile-toggle {
        flex-basis: 36px;
        width: 36px;
        min-width: 36px;
        height: 36px;
        font-size: 19px;
    }

    .page-title h1,
    .topbar.has-header-quick-buttons .page-title h1 {
        font-size: 16px;
        text-align: left;
    }

    .topbar-right,
    .topbar.has-header-quick-buttons .topbar-right {
        grid-template-columns: minmax(88px, 1fr) repeat(2, minmax(0, 1fr)) 34px;
        justify-content: stretch !important;
    }

    .language-selector {
        height: 32px;
        font-size: 10.5px;
    }

    .purchase-dashboard-link,
    .epc-dashboard-link {
        height: 32px;
        min-width: 0;
        padding: 0 6px;
        font-size: 10px;
    }

    .avatar {
        width: 32px;
        min-width: 32px;
        height: 32px;
        font-size: 11px;
    }

    .topbar.has-header-quick-buttons .header-quick-button {
        min-height: 34px !important;
        padding: 7px 5px !important;
        font-size: 11px !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }
}

