/* ============================================================
   POSPro Business Header (new topbar design)
   ============================================================ */

.main-header-section.pospro-topbar {
    --pt-panel: #FFFFFF;
    --pt-panel-2: #F6F8FC;
    --pt-line: #E2E6F0;
    --pt-line-soft: #EFF2F8;
    --pt-ink: #10142A;
    --pt-dim: #545D78;
    --pt-faint: #8891A8;
    --pt-primary: var(--clr-primary, #c52127);

    padding: 0;
    background: var(--pt-panel);
    border-bottom: 1px solid var(--pt-line);
    box-shadow: 0 1px 0 rgba(20, 25, 55, .02), 0 6px 24px rgba(20, 25, 55, .04);
    z-index: 60;
}

html[data-theme="dark"] .main-header-section.pospro-topbar {
    --pt-panel: var(--dm-surface, #171530);
    --pt-panel-2: var(--dm-bg-secondary, #171530);
    --pt-line: var(--dm-border, #2A2A35);
    --pt-line-soft: var(--dm-input-bg, #1A1A23);
    --pt-ink: var(--dm-text-primary, #E4E4E8);
    --pt-dim: var(--dm-text-secondary, #A0A0A8);
    --pt-faint: var(--dm-text-muted, #6B6B75);
    background: var(--pt-panel);
}

/* ---------- 3-column bar ---------- */
.pospro-topbar .pt-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 13px 28px;
    flex-wrap: nowrap;
}

.pospro-topbar .pt-left {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    flex: none;
}

.pospro-topbar .pt-actions {
    display: flex;
    align-items: center;
    gap: 13px;
    flex: none;
}

/* ---------- icon button ---------- */
.pospro-topbar .pt-icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    background: var(--pt-panel);
    border: 1px solid var(--pt-line);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--pt-dim);
    cursor: pointer;
    position: relative;
    padding: 0;
    line-height: 0;
    transition: background .18s ease, border-color .18s ease, color .18s ease;
}

.pospro-topbar .pt-icon-btn:hover {
    color: var(--pt-primary);
    border-color: var(--pt-primary);
}

.pospro-topbar .pt-icon-btn svg {
    width: 16px;
    height: 16px;
}

.pospro-topbar .pt-icon-btn .pt-ico-dots { display: none; }

.pospro-topbar .pt-icon-btn .pt-dot {
    position: absolute;
    top: -3px;
    right: -3px;
    min-width: 15px;
    height: 15px;
    padding: 0 3px;
    background: #FF5C93;
    border-radius: 9px;
    font-size: 9px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    border: 2px solid var(--pt-panel);
    box-sizing: content-box;
}

/* theme toggle icons */
.pospro-topbar #globalThemeToggle .theme-icon-dark,
.pospro-topbar #globalThemeToggle .theme-icon-light {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
}

/* ---------- branch chip ---------- */
.pospro-topbar .pt-branch {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px 6px 7px;
    background: var(--pt-panel);
    border: 1px solid var(--pt-line);
    border-radius: 9px;
    cursor: pointer;
    flex: none;
    text-decoration: none;
    color: inherit;
    transition: border-color .18s ease;
}

.pospro-topbar .pt-branch:hover {
    border-color: var(--pt-primary);
}

.pospro-topbar .pt-branch .pt-b-icon {
    width: 26px;
    height: 26px;
    border-radius: 7px;
    background: color-mix(in srgb, var(--pt-primary) 14%, transparent);
    color: var(--pt-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex: none;
}

.pospro-topbar .pt-branch .pt-b-icon svg {
    width: 14px;
    height: 14px;
}

.pospro-topbar .pt-branch .pt-b-name {
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.2;
    color: var(--pt-ink);
}

.pospro-topbar .pt-branch .pt-b-sub {
    font-size: 10px;
    color: var(--pt-faint);
}

.pospro-topbar .pt-branch .pt-chev {
    opacity: .5;
    margin-left: 2px;
    color: var(--pt-dim);
}

/* ---------- site link (admin) ---------- */
.pospro-topbar .pt-site-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 12px;
    background: var(--pt-panel);
    border: 1px solid var(--pt-line);
    border-radius: 9px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--pt-primary);
    text-decoration: none;
    flex: none;
    transition: background .18s ease, border-color .18s ease;
}

.pospro-topbar .pt-site-link:hover {
    background: color-mix(in srgb, var(--pt-primary) 8%, transparent);
    border-color: var(--pt-primary);
}

.pospro-topbar .pt-site-link svg { flex: none; }

@media (max-width: 560px) {
    .pospro-topbar .pt-site-link span { display: none; }
    .pospro-topbar .pt-site-link { padding: 8px; }
}

/* ---------- search ---------- */
.pospro-topbar .pt-search {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--pt-panel);
    border: 1px solid var(--pt-line);
    border-radius: 9px;
    padding: 8px 12px;
    flex: 1 1 320px;
    max-width: 480px;
    min-width: 140px;
}

.pospro-topbar .pt-search svg {
    width: 15px;
    height: 15px;
    color: var(--pt-faint);
    flex: none;
}

.pospro-topbar .pt-search input {
    background: none;
    border: none;
    outline: none;
    color: var(--pt-ink);
    font-family: 'Inter', sans-serif;
    font-size: 12.9px;
    width: 100%;
}

.pospro-topbar .pt-search input::placeholder {
    color: var(--pt-faint);
}

.pospro-topbar .pt-search { position: relative; }

.pospro-topbar .pt-search-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    z-index: 90;
    background: var(--pt-panel);
    border: 1px solid var(--pt-line);
    border-radius: 12px;
    box-shadow: 0 24px 48px -16px rgba(20, 25, 55, .18);
    padding: 6px;
    max-height: 400px;
    overflow-y: auto;
}

.pospro-topbar .pt-search-dropdown.open { display: block; }

.pospro-topbar .pt-search-group { padding-bottom: 4px; }

.pospro-topbar .pt-search-group + .pt-search-group {
    border-top: 1px solid var(--pt-line-soft);
    margin-top: 4px;
    padding-top: 4px;
}

.pospro-topbar .pt-search-label {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--pt-faint);
    padding: 6px 10px 4px;
}

.pospro-topbar .pt-search-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    transition: background .12s ease;
}

.pospro-topbar .pt-search-item:hover { background: var(--pt-panel-2); }

.pospro-topbar .pt-search-thumb {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: var(--pt-panel-2);
    border: 1px solid var(--pt-line);
    color: var(--pt-faint);
    display: flex;
    align-items: center;
    justify-content: center;
    flex: none;
    object-fit: cover;
}

.pospro-topbar .pt-search-thumb.tint-party { color: var(--pt-primary); }

.pospro-topbar .pt-search-thumb svg { width: 15px; height: 15px; }

.pospro-topbar .pt-search-info {
    flex: 1;
    min-width: 0;
}

.pospro-topbar .pt-search-info b {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--pt-ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pospro-topbar .pt-search-info span {
    display: block;
    font-size: 11.5px;
    color: var(--pt-faint);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pospro-topbar .pt-search-empty {
    padding: 18px 12px;
    text-align: center;
    font-size: 12.5px;
    color: var(--pt-faint);
}

/* ---------- language chip ---------- */
.pospro-topbar .pt-lang {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 10px;
    border-radius: 9px;
    background: var(--pt-panel);
    border: 1px solid var(--pt-line);
    cursor: pointer;
    flex: none;
    position: relative;
    color: inherit;
    transition: border-color .18s ease;
}

.pospro-topbar .pt-lang:hover { border-color: var(--pt-primary); }

.pospro-topbar .pt-lang .pt-flag {
    width: 17px;
    height: 17px;
    border-radius: 50%;
    object-fit: cover;
    flex: none;
}

.pospro-topbar .pt-lang span.pt-lang-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--pt-dim);
}

.pospro-topbar .pt-lang .pt-chev {
    opacity: .5;
    color: var(--pt-dim);
}

/* ---------- user chip ---------- */
.pospro-topbar .pt-user {
    display: flex;
    align-items: center;
    gap: 9px;
    padding-left: 13px;
    border-left: 1px solid var(--pt-line);
    position: relative;
    cursor: pointer;
}

.pospro-topbar .pt-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(140deg, #5AA9E6, #9089E0);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    color: #fff;
    text-transform: uppercase;
    flex: none;
}

.pospro-topbar .pt-user .pt-who {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--pt-ink);
    line-height: 1.25;
}

.pospro-topbar .pt-user .pt-who span {
    display: block;
    color: var(--pt-faint);
    font-size: 10.5px;
    font-weight: 400;
}

.pospro-topbar .pt-avatar.lg {
    width: 40px;
    height: 40px;
    font-size: 15px;
}

/* ---------- dropdown panels ---------- */
.pospro-topbar .pt-panel {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 220px;
    background: var(--pt-panel);
    border: 1px solid var(--pt-line);
    border-radius: 10px;
    box-shadow: 0 16px 36px rgba(0, 0, 0, .14);
    padding: 6px 0;
    z-index: 95;
    text-align: left;
}

html[data-theme="dark"] .pospro-topbar .pt-panel {
    box-shadow: 0 16px 36px rgba(0, 0, 0, .5);
}

.pospro-topbar .pt-panel.open { display: block; }

.pospro-topbar .pt-dd-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    font-size: 12.6px;
    font-weight: 500;
    color: var(--pt-dim);
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
}

.pospro-topbar .pt-dd-item svg {
    width: 15px;
    height: 15px;
    flex: none;
    opacity: .85;
}

.pospro-topbar .pt-dd-item:hover {
    background: var(--pt-line-soft);
    color: var(--pt-ink);
}

.pospro-topbar .pt-dd-item.active {
    color: var(--pt-primary);
    font-weight: 600;
}

.pospro-topbar .pt-dd-item .pt-flag { font-size: 15px; }

.pospro-topbar .pt-dd-item.danger { color: var(--pt-primary); }

.pospro-topbar .pt-dd-item.danger:hover {
    background: color-mix(in srgb, var(--pt-primary) 10%, transparent);
}

.pospro-topbar .pt-dd-sep {
    height: 1px;
    background: var(--pt-line);
    margin: 6px 0;
}

.pospro-topbar .pt-lang-panel {
    min-width: 210px;
    max-height: 400px;
    overflow-y: auto;
    padding: 6px 0;
}

.pospro-topbar .pt-lang-panel .pt-dd-item img {
    width: 17px;
    height: 17px;
    border-radius: 50%;
    object-fit: cover;
    flex: none;
}

/* panel scrollbars */
.pospro-topbar .pt-panel::-webkit-scrollbar,
.pospro-topbar .pt-notif-list::-webkit-scrollbar { width: 6px; }
.pospro-topbar .pt-panel::-webkit-scrollbar-thumb,
.pospro-topbar .pt-notif-list::-webkit-scrollbar-thumb {
    background: var(--pt-line);
    border-radius: 4px;
}
.pospro-topbar .pt-panel::-webkit-scrollbar-track,
.pospro-topbar .pt-notif-list::-webkit-scrollbar-track { background: transparent; }

/* notification panel */
.pospro-topbar .pt-notif-panel { width: 340px; padding: 0; }

.pospro-topbar .pt-dd-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 22px 16px;
    border-bottom: 1px solid var(--pt-line);
    font-weight: 700;
    font-size: 13px;
    color: var(--pt-ink);
}

.pospro-topbar .pt-dd-head .pt-view-all { font-weight: 600; }

.pospro-topbar .pt-notif-list {
    max-height: 404px;
    overflow-y: auto;
    padding: 6px 0;
}

.pospro-topbar .pt-notif-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 36px 16px;
    text-align: center;
    color: var(--pt-faint);
    font-size: 12.5px;
}

.pospro-topbar .pt-notif-empty svg {
    width: 30px;
    height: 30px;
    opacity: .45;
}

.pospro-topbar .pt-notif-row {
    display: flex;
    gap: 11px;
    align-items: flex-start;
    padding: 12px 16px;
    cursor: pointer;
    text-decoration: none;
}

.pospro-topbar .pt-notif-row:hover { background: var(--pt-line-soft); }

.pospro-topbar .pt-notif-row.unread {
    background: color-mix(in srgb, var(--pt-primary) 5%, transparent);
}

.pospro-topbar .pt-notif-body { min-width: 0; flex: 1; }

.pospro-topbar .pt-notif-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--pt-primary);
    flex: none;
    margin-top: 4px;
}

.pospro-topbar .pt-notif-row:not(.unread) .pt-notif-dot { visibility: hidden; }

.pospro-topbar .pt-notif-icon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pospro-topbar .pt-notif-icon svg { width: 14px; height: 14px; }

.pospro-topbar .pt-notif-icon.sales    { background: rgba(144, 137, 224, .15); color: #9089E0; }
.pospro-topbar .pt-notif-icon.purchase { background: rgba(240, 169, 78, .15); color: #F0A94E; }
.pospro-topbar .pt-notif-icon.stock    { background: rgba(255, 92, 147, .15); color: #FF5C93; }
.pospro-topbar .pt-notif-icon.due      { background: rgba(90, 169, 230, .15); color: #5AA9E6; }
.pospro-topbar .pt-notif-icon.system   { background: rgba(63, 199, 168, .15); color: #3FC7A8; }

.pospro-topbar .pt-notif-text {
    font-size: 12.4px;
    color: var(--pt-ink);
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.pospro-topbar .pt-notif-time {
    font-size: 10.5px;
    color: var(--pt-faint);
    margin-top: 3px;
    display: block;
}

.pospro-topbar .pt-dd-foot {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 16px;
    border-top: 1px solid var(--pt-line);
    background: var(--pt-panel-2);
}

.pospro-topbar .pt-view-all {
    font-size: 11.5px;
    color: var(--pt-primary);
    font-weight: 600;
    text-decoration: none;
}

/* profile panel */
.pospro-topbar .pt-profile-panel { width: 250px; }

.pospro-topbar .pt-profile-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px 14px;
    border-bottom: 1px solid var(--pt-line);
    margin-bottom: 6px;
}

.pospro-topbar .pt-profile-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--pt-ink);
}

.pospro-topbar .pt-profile-email {
    font-size: 11px;
    color: var(--pt-faint);
    word-break: break-all;
}

/* ---------- responsive ---------- */
@media (max-width: 1199px) {
    .pospro-topbar .pt-search {
        flex: 1 1 240px;
        max-width: 340px;
    }
}

@media (max-width: 991px) {
    .pospro-topbar .pt-topbar {
        flex-wrap: wrap;
        gap: 10px;
        padding: 12px 16px;
    }

    .pospro-topbar .pt-search {
        order: 5;
        flex: 1 1 100%;
        max-width: none;
        min-width: 0;
    }
}

@media (max-width: 640px) {
    /* Main Branch text hidden on small device - only icon visible */
    .pospro-topbar .pt-branch .pt-b-name,
    .pospro-topbar .pt-branch .pt-b-sub,
    .pospro-topbar .pt-branch .pt-chev { display: none !important; }
    .pospro-topbar .pt-branch {
        padding: 7px;
        gap: 0;
        width: 36px;
        height: 36px;
        justify-content: center;
        border-radius: 9px;
    }
    .pospro-topbar .pt-branch > div:nth-child(2) { display: none !important; }
}

@media (max-width: 560px) {
    .pospro-topbar .pt-user .pt-who { display: none; }
    .pospro-topbar .pt-lang span.pt-lang-label { display: none; }
    .pospro-topbar .pt-notif-panel { width: 88vw; right: -70px; }
    .pospro-topbar .pt-profile-panel { right: -6px; }
    .pospro-topbar .pt-lang-panel { right: -40px; }
    .pospro-topbar .pt-actions { gap: 10px; }
}

/* ---------- small screens: 3-dot sidebar opener ---------- */
@media (max-width: 767px) {
    .pospro-topbar .pt-icon-btn.sidebar-opner { display: flex !important; }
    .pospro-topbar .pt-icon-btn .pt-ico-hamb { display: none; }
    .pospro-topbar .pt-icon-btn .pt-ico-dots { display: block; }
}

/* ---------- opened sidebar overlays the navbar ---------- */
@media (max-width: 1150px) {
    .side-bar.active {
        z-index: 1000 !important;
    }
}

/* ---------- RTL ---------- */
[dir="rtl"] .main-header-section.pospro-topbar {
    z-index: 60;
}

[dir="rtl"] .pospro-topbar .pt-panel {
    left: 0;
    right: auto;
}

[dir="rtl"] .pospro-topbar .pt-user {
    padding-left: 0;
    padding-right: 13px;
    border-left: none;
    border-right: 1px solid var(--pt-line);
}

[dir="rtl"] .pospro-topbar .pt-icon-btn .pt-dot {
    right: auto;
    left: -3px;
}

[dir="rtl"] .pospro-topbar .pt-notif-panel,
[dir="rtl"] .pospro-topbar .pt-lang-panel {
    left: auto;
    right: 0;
}