/* ── My Procurement app header — specs/app-navigation.md section 8.5 ──
   Loaded only by my-procurement-app.njk, after styles.css. Every rule is scoped to .mp-header so
   the public header (header.njk) and supplier header keep styles.css's shared nav rules. */

.mp-header {
    font-family: 'Public Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.06), 0 2px 8px rgba(15, 23, 42, 0.06);
}
.mp-header .container.mp-bar-inner {
    width: auto;
    max-width: 1440px;
    padding: 0 24px;
    box-sizing: border-box;
}

/* ── Top bar: brand + profile ── */
.mp-header .header-bar {
    padding: 0;
    border-bottom: 1px solid #e3e8ef;
}
.mp-header .header-bar-inner {
    height: 60px;
    gap: 12px;
}
.mp-header .site-title-link {
    gap: 10px;
    min-width: 0;
    margin-right: auto;
}
.mp-header .site-title-link:hover { opacity: 1; }
.mp-header .site-icon {
    width: 40px;
    height: 40px;
    margin: 0;
    flex-shrink: 0;
    object-fit: contain;
}
.mp-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
    min-width: 0;
}
.mp-header .site-name {
    font-size: 1.06rem;
    font-weight: 700;
    color: #0b2545;
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mp-brand-caption {
    font-size: 0.68rem;
    font-weight: 500;
    color: #64748b;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
}

/* Profile button: avatar + name/company + chevron (name/company hidden on mobile) */
.mp-header .profile-btn {
    gap: 10px;
    padding: 4px 8px 4px 4px;
    border-radius: 999px;
    font: inherit;
    color: #64748b;
    transition: background 0.15s;
}
.mp-header .profile-btn:hover { background: #f1f5fa; }
.mp-header .profile-avatar {
    width: 36px;
    height: 36px;
    font-size: 0.8rem;
    letter-spacing: 0.02em;
    box-shadow: 0 0 0 2px #fff, 0 0 0 3px #c9d8ea;
}
.mp-profile-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.2;
    max-width: 180px;
}
.mp-profile-name,
.mp-profile-company {
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mp-profile-name { font-size: 0.82rem; font-weight: 600; color: #1f2a37; }
.mp-profile-company { font-size: 0.75rem; color: #64748b; }
.mp-profile-company:empty { display: none; }
.mp-header .profile-dropdown-panel {
    top: calc(100% + 8px);
    border-color: #e3e8ef;
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.16);
    min-width: 230px;
}
.mp-header .profile-menu-link { font-size: 0.875rem; }

.mp-menu-btn { display: none; }

/* ── App nav bar: launcher + tabs ── */
.mp-header .nav-bar {
    background: #004080;
    padding: 0;
}
.mp-header .nav-bar nav.app-nav {
    display: flex;
    align-items: stretch;
    gap: 0;
    height: 48px;
    min-width: 0;
    width: 100%;
}
.mp-header .app-launcher {
    display: flex;
    align-items: center;
    padding-right: 12px;
    margin-right: 8px;
    border-right: 1px solid rgba(255, 255, 255, 0.18);
}
.mp-header .app-launcher-btn {
    width: 40px;
    height: 40px;
    border-radius: 8px;
}
.mp-header .app-launcher-dots { grid-template-columns: repeat(3, 5px); gap: 3px; }
.mp-header .app-launcher-dots i { width: 5px; height: 5px; }

.mp-header .nav-links {
    gap: 2px;
    align-items: stretch;
}
.mp-header #app-nav-links > li {
    display: flex;
    align-items: stretch;
}
.mp-header #app-nav-links > li > a {
    position: relative;
    display: flex;
    align-items: center;
    height: 48px;
    padding: 0 14px;
    box-sizing: border-box;
    color: rgba(255, 255, 255, 0.86);
    font-size: 0.875rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    border-radius: 6px 6px 0 0;
    transition: background 0.15s, color 0.15s;
}
.mp-header #app-nav-links > li > a:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}
.mp-header .nav-links li a.active {
    color: #fff !important;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.12);
}
.mp-header #app-nav-links > li > a.active::after {
    content: "";
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: 0;
    height: 3px;
    border-radius: 3px 3px 0 0;
    background: #f6a14b;
}
.mp-header .nav-skeleton > a { height: 48px; }

/* "More" overflow dropdown — white card instead of the public site's navy list */
.mp-header .nav-more > a::before {
    content: "";
    order: 2;
    width: 6px;
    height: 6px;
    margin: -3px 0 0 8px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
}
.mp-header .nav-more > .dropdown-content {
    top: 100%;
    min-width: 240px;
    padding: 6px;
    background: #fff;
    border: 0;
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18), 0 0 0 1px rgba(15, 23, 42, 0.06);
}
.mp-header .nav-more .dropdown-content li a {
    display: block;
    padding: 9px 14px;
    border-radius: 6px;
    color: #1f2a37;
    font-size: 0.875rem;
    font-weight: 500;
}
.mp-header .nav-more .dropdown-content li a:hover {
    background: #eef4fb;
    color: #004080;
}
.mp-header .nav-more .dropdown-content li a.active {
    color: #004080 !important;
    background: #e8f0fa;
}

/* ── App launcher panel ── */
.mp-header .app-launcher-panel {
    top: calc(100% + 4px);
    width: 560px;
    max-width: calc(100vw - 48px);
    padding: 0;
    border: 0;
    border-radius: 12px;
    box-shadow: 0 20px 48px rgba(15, 23, 42, 0.28);
    overflow: hidden;
}
.mp-header .app-launcher-title {
    margin: 0;
    padding: 16px 20px;
    border-bottom: 1px solid #e3e8ef;
    font-size: 1.05rem;
    font-weight: 700;
    color: #0b2545;
    text-transform: none;
    letter-spacing: 0;
}
.mp-header .app-launcher-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    padding: 16px 20px 20px;
}
.mp-header .app-tile {
    flex-direction: row;
    align-items: flex-start;
    gap: 12px;
    padding: 14px;
    border: 1px solid #e3e8ef;
    border-radius: 10px;
    text-align: left;
    color: #1f2a37;
    background: #fff;
}
.mp-header .app-tile:hover,
.mp-header .app-tile:focus {
    border-color: #2b6cb0;
    background: #fff;
    box-shadow: 0 2px 10px rgba(0, 64, 128, 0.12);
}
.mp-header .app-tile.current { border-color: #2b6cb0; background: #f2f7fd; }
.mp-header .app-tile-icon { width: 40px; height: 40px; flex-shrink: 0; }
.mp-header .app-tile-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.mp-header .app-tile-label { font-size: 0.875rem; font-weight: 700; }
.mp-header .app-tile-current {
    margin-left: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    color: #2b6cb0;
}
.mp-header .app-tile-desc {
    font-size: 0.75rem;
    line-height: 1.4;
    color: #4a5568;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Mobile-only pieces stay hidden on desktop */
.mp-context,
.mp-drawer,
.mp-drawer-scrim { display: none; }

/* ── Mobile (≤768px): one menu button, drawer holds apps + tabs ── */
@media (max-width: 768px) {
    .mp-header .container.mp-bar-inner { padding: 0 8px 0 4px; }
    .mp-header .header-bar-inner { height: 56px; gap: 4px; }
    .mp-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        flex-shrink: 0;
        border: 0;
        border-radius: 8px;
        background: transparent;
        color: #0b2545;
        cursor: pointer;
    }
    .mp-menu-btn:hover { background: #f1f5fa; }
    .mp-header .site-icon { width: 32px; height: 32px; }
    .mp-header .profile-btn { padding: 4px; }
    .mp-header .profile-avatar { width: 32px; height: 32px; }
    .mp-profile-meta,
    .mp-profile-chevron { display: none; }

    /* Launcher and tab row give way to the drawer; the bar becomes a slim "App > Tab" strip */
    .mp-header .nav-bar .container.mp-bar-inner { display: none; }
    .mp-context {
        display: flex;
        align-items: center;
        gap: 8px;
        height: 40px;
        padding: 0 16px;
        font-size: 0.82rem;
        white-space: nowrap;
        overflow: hidden;
    }
    .mp-context-app { color: rgba(255, 255, 255, 0.75); font-weight: 500; }
    .mp-context-sep { color: rgba(255, 255, 255, 0.6); flex-shrink: 0; }
    .mp-context-tab { color: #fff; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }

    .mp-drawer-scrim {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 1080;
        background: rgba(11, 37, 69, 0.5);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.2s, visibility 0.2s;
    }
    .mp-drawer-scrim.open { opacity: 1; visibility: visible; }
    .mp-drawer {
        display: flex;
        flex-direction: column;
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 1090;
        width: min(324px, 86vw);
        background: #fff;
        box-shadow: 8px 0 32px rgba(15, 23, 42, 0.3);
        transform: translateX(-105%);
        visibility: hidden;
        transition: transform 0.22s ease, visibility 0.22s;
        overflow: hidden;
    }
    .mp-drawer.open { transform: none; visibility: visible; }

    /* Setup is desktop-only (section 8.6): no Setup link in the profile menu, and a Setup page
       shows the blocked panel instead of its content. */
    .mp-header #profile-setup-link { display: none !important; }
    body[data-app-shell="setup"] .app-main { display: none !important; }
    body[data-app-shell="setup"] .mp-setup-blocked { display: flex; }
}

.mp-drawer-head {
    background: #004080;
    padding: 10px 16px 16px;
    padding-top: calc(10px + env(safe-area-inset-top, 0px));
}
.mp-drawer-title {
    flex: 1;
    min-width: 0;
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mp-drawer-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin-right: -10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #fff;
    cursor: pointer;
}
.mp-drawer-close:hover { background: rgba(255, 255, 255, 0.12); }
.mp-drawer-label {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.7);
}

/* Current app row: icon + "Current app" label + name + close */
.mp-drawer-current {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 48px;
}
.mp-drawer-current-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.mp-drawer-current-icon:empty { display: none; }

/* App icons in the drawer and picker: fixed square box, initials never overflow it */
.mp-app-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    box-sizing: border-box;
    overflow: hidden;
    border-radius: 10px;
    line-height: 1;
    letter-spacing: 0;
    white-space: nowrap;
    font-weight: 700;
    color: #fff;
    object-fit: contain;
}
.mp-app-icon-md { width: 40px; height: 40px; min-width: 40px; font-size: 0.8rem; }
.mp-app-icon-lg { width: 44px; height: 44px; min-width: 44px; font-size: 0.85rem; }
.mp-drawer-current .mp-app-icon { box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.85); }
img.mp-app-icon { background: #fff; padding: 3px; }

/* "Switch app" button: opens the picker */
.mp-drawer-switch {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 44px;
    margin-top: 14px;
    padding: 0 12px 0 14px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
}
.mp-drawer-switch:hover { background: rgba(255, 255, 255, 0.16); }
.mp-drawer-switch > span { flex: 1; }
.mp-drawer-switch-chev { opacity: 0.8; }

/* App picker screen: covers the drawer, slides in from the right */
.mp-drawer-picker {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    background: #fff;
    transform: translateX(100%);
    visibility: hidden;
    transition: transform 0.22s ease, visibility 0.22s;
}
.mp-drawer.picking .mp-drawer-picker { transform: none; visibility: visible; }
.mp-picker-head {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px 6px 6px;
    padding-top: calc(6px + env(safe-area-inset-top, 0px));
    min-height: 56px;
    background: #004080;
    color: #fff;
}
.mp-picker-back {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #fff;
    cursor: pointer;
}
.mp-picker-back:hover { background: rgba(255, 255, 255, 0.12); }
.mp-picker-title { font-size: 1rem; font-weight: 700; }
.mp-picker-list {
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
    list-style: none;
    margin: 0;
    padding: 10px;
}
.mp-picker-app {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 64px;
    padding: 10px 12px;
    border-radius: 10px;
    color: #1f2a37;
    text-decoration: none;
}
.mp-picker-app:hover { background: #f1f5fa; }
.mp-picker-app.current { background: #e8f0fa; }
.mp-picker-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.mp-picker-label { font-size: 0.94rem; font-weight: 700; }
.mp-picker-app.current .mp-picker-label { color: #004080; }
.mp-picker-desc {
    font-size: 0.78rem;
    line-height: 1.35;
    color: #4a5568;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.mp-picker-check { flex-shrink: 0; color: #004080; }

.mp-drawer-links {
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
    list-style: none;
    margin: 0;
    padding: 10px;
}
.mp-drawer-group {
    padding: 14px 14px 6px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #64748b;
}
.mp-drawer-link {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 46px;
    padding: 0 12px;
    border-radius: 8px;
    color: #1f2a37;
    font-size: 0.94rem;
    font-weight: 500;
    text-decoration: none;
}
.mp-drawer-link:hover { background: #f1f5fa; }
.mp-drawer-link.active { background: #e8f0fa; color: #004080; font-weight: 700; }
.mp-drawer-tab-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    border-radius: 7px;
    background: #eef2f7;
    color: #004080;
    font-size: 0.78rem;
    font-weight: 700;
    object-fit: contain;
}
.mp-drawer-link.active .mp-drawer-tab-icon:not(img) { background: #004080; color: #fff; }

.mp-drawer-foot {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid #e3e8ef;
}
.mp-drawer-avatar { flex-shrink: 0; }
.mp-drawer-user {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    line-height: 1.25;
}
.mp-drawer-name,
.mp-drawer-company {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mp-drawer-name { font-size: 0.875rem; font-weight: 600; color: #1f2a37; }
.mp-drawer-company { font-size: 0.75rem; color: #64748b; }
.mp-drawer-logout {
    padding: 10px 4px;
    font-size: 0.82rem;
    font-weight: 600;
    color: #b42318;
    text-decoration: none;
}

/* ── Setup blocked on mobile (section 8.6) — hidden unless the media query above shows it ── */
.mp-setup-blocked {
    display: none;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
    max-width: 420px;
    margin: 48px auto;
    padding: 32px 24px;
    box-sizing: border-box;
    background: #fff;
    border: 1px solid #e3e8ef;
    border-radius: 12px;
    color: #004080;
    font-family: 'Public Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
}
.mp-setup-blocked h1 { margin: 4px 0 0; font-size: 1.2rem; color: #0b2545; }
.mp-setup-blocked p { margin: 0; font-size: 0.9rem; line-height: 1.5; color: #4a5568; }
.mp-setup-blocked-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    margin-top: 8px;
    padding: 0 22px;
    border-radius: 8px;
    background: #004080;
    color: #fff;
    font-weight: 600;
    text-decoration: none;
}
.mp-setup-blocked-btn:hover { background: #00346a; }
