/* =========================================================
   IFFYS Desktop Enterprise Shell
   Inspinia-inspired layout geometry + IFFYS brand tokens
   ========================================================= */

:root {
    --iffys-navy: #001f3f;
    --iffys-navy-mid: #002245;
    --iffys-navy-deep: #03142E;
    --iffys-navy-hover: #0f4c75;
    --iffys-orange: #ff6600;
    --iffys-orange-soft: rgba(255, 102, 0, 0.15);
    --iffys-sidenav-width: 250px;
    --iffys-sidenav-width-full: 250px;
    --iffys-sidenav-width-sm: 78px;
    --iffys-topbar-height: 64px;
    --iffys-sidenav-bg: #001f3f;
    --iffys-sidenav-item: rgba(255, 255, 255, 0.72);
    --iffys-sidenav-item-hover: #ffffff;
    --iffys-sidenav-item-active-bg: rgba(255, 102, 0, 0.18);
    --iffys-sidenav-border: rgba(255, 255, 255, 0.08);
    --iffys-topbar-bg: #ffffff;
    --iffys-content-bg: #f5f7fa;
    --iffys-footer-height: 40px;
}

/* ----- Shell ----- */
/* Topbar + content-page share one viewport column so the footer sticks
   and dashboard bottom panels can consume leftover height. */
html:has(.iffys-desktop),
body:has(.iffys-desktop) {
    height: 100%;
    overflow: hidden;
}

.iffys-desktop.wrapper {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    background: var(--iffys-content-bg);
    overflow: hidden;
}

.iffys-desktop .app-topbar {
    flex: 0 0 auto;
}

.iffys-desktop .content-page {
    display: flex;
    flex-direction: column;
    position: relative;
    margin-inline-start: var(--iffys-sidenav-width);
    flex: 1 1 0;
    min-height: 0;
    height: auto;
    padding: 0;
    transition: margin-inline-start 0.25s ease-in-out;
    background: var(--iffys-content-bg);
    overflow: hidden;
}

.iffys-desktop .content-page > .container-fluid {
    flex: 1 1 0;
    min-height: 0;
    padding: 1.25rem 1.5rem;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Home / ops dashboard — fill content pane above footer; invoices scroll inside */
.iffys-desktop .content-page > .container-fluid:has(.enterprise-dashboard) {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: auto;
    max-height: none;
}

.iffys-desktop .content-page > .container-fluid:has(.enterprise-dashboard) > .page-container {
    flex: 1 1 0 !important;
    min-height: 0 !important;
    height: 100% !important;
    max-height: 100% !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
}

.iffys-desktop .content-page > .container-fluid:has(.enterprise-dashboard) > .page-container > .enterprise-dashboard {
    flex: 1 1 0;
    min-height: 0;
    height: 100%;
    max-height: 100%;
    overflow: hidden;
}

/* Dashboard Home fills the content pane; each Syncfusion grid scrolls internally. */
.iffys-desktop .content-page > .container-fluid:has(.dh-shell) {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: auto;
    max-height: none;
}

.iffys-desktop .content-page > .container-fluid:has(.dh-shell) > .page-container {
    flex: 1 1 0 !important;
    min-height: 0 !important;
    height: 100% !important;
    max-height: 100% !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
}

.iffys-desktop .content-page > .container-fluid:has(.dh-shell) > .page-container > .dh-shell {
    flex: 1 1 0;
    min-height: 0;
    height: 100%;
    max-height: 100%;
    overflow: hidden;
}

/* Dispatch Board — fill content pane above footer; panes scroll internally */
.iffys-desktop .content-page > .container-fluid:has(.db-board) {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: auto;
    max-height: none;
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
}

.iffys-desktop .content-page > .container-fluid:has(.db-board) > .page-container {
    flex: 1 1 0 !important;
    min-height: 0 !important;
    height: 100% !important;
    max-height: 100% !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
}

.iffys-desktop .content-page > .container-fluid:has(.db-board) > .page-container > .db-board {
    flex: 1 1 0;
    min-height: 0;
    height: 100%;
    max-height: 100%;
    overflow: hidden;
}

/* Banking — fill content pane; panels scroll internally */
.iffys-desktop .content-page > .container-fluid:has(.banking-page) {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: auto;
    max-height: none;
}

.iffys-desktop .content-page > .container-fluid:has(.banking-page) > .page-container {
    flex: 1 1 0 !important;
    min-height: 0 !important;
    height: 100% !important;
    max-height: 100% !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    padding: 0 !important;
}

.iffys-desktop .content-page > .container-fluid:has(.banking-page) > .page-container > .banking-page {
    flex: 1 1 0;
    min-height: 0;
    height: 100%;
    max-height: 100%;
    overflow: hidden;
}

/* Communications — fill content pane */
.iffys-desktop .content-page > .container-fluid:has(.comms-page) {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: auto;
    max-height: none;
}

.iffys-desktop .content-page > .container-fluid:has(.comms-page) > .page-container {
    flex: 1 1 0 !important;
    min-height: 0 !important;
    height: 100% !important;
    max-height: 100% !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    padding: 0 !important;
}

.iffys-desktop .content-page > .container-fluid:has(.comms-page) > .page-container > .comms-page {
    flex: 1 1 0;
    min-height: 0;
    height: 100%;
    max-height: 100%;
    overflow: hidden;
}

/* Reports hub — fill content pane */
.iffys-desktop .content-page > .container-fluid:has(.reports-page) {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: auto;
    max-height: none;
}

.iffys-desktop .content-page > .container-fluid:has(.reports-page) > .page-container {
    flex: 1 1 0 !important;
    min-height: 0 !important;
    height: 100% !important;
    max-height: 100% !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    padding: 0 !important;
}

.iffys-desktop .content-page > .container-fluid:has(.reports-page) > .page-container > .reports-page {
    flex: 1 1 0;
    min-height: 0;
    height: 100%;
    max-height: 100%;
    overflow: hidden;
}

/* Invoices workbench — fill content pane; grid scrolls internally */
.iffys-desktop .content-page > .container-fluid:has(.invoices-page) {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: auto;
    max-height: none;
}

.iffys-desktop .content-page > .container-fluid:has(.invoices-page) > .page-container {
    flex: 1 1 0 !important;
    min-height: 0 !important;
    height: 100% !important;
    max-height: 100% !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    padding: 0 !important;
}

.iffys-desktop .content-page > .container-fluid:has(.invoices-page) > .page-container > .invoices-page {
    flex: 1 1 0;
    min-height: 0;
    height: 100%;
    max-height: 100%;
    overflow: hidden;
}

/* Customers — fill content pane; grid scrolls internally */
.iffys-desktop .content-page > .container-fluid:has(.customers-page) {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: auto;
    max-height: none;
}

.iffys-desktop .content-page > .container-fluid:has(.customers-page) > .page-container {
    flex: 1 1 0 !important;
    min-height: 0 !important;
    height: 100% !important;
    max-height: 100% !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    padding: 0 !important;
}

.iffys-desktop .content-page > .container-fluid:has(.customers-page) > .page-container > .customers-page {
    flex: 1 1 0;
    min-height: 0;
    height: 100%;
    max-height: 100%;
    overflow: hidden;
}

/* Purchasing — fill content pane above footer; charts stay put, grids fill leftover */
.iffys-desktop .content-page > .container-fluid:has(.purchasing-page) {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: auto;
    max-height: none;
}

.iffys-desktop .content-page > .container-fluid:has(.purchasing-page) > .page-container {
    flex: 1 1 0 !important;
    min-height: 0 !important;
    height: 100% !important;
    max-height: 100% !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    padding: 0 !important;
}

.iffys-desktop .content-page > .container-fluid:has(.purchasing-page) > .page-container > .purchasing-page {
    flex: 1 1 0;
    min-height: 0;
    height: 100%;
    max-height: 100%;
    overflow: hidden;
}

/* Products — fill content pane; grid scrolls internally */
.iffys-desktop .content-page > .container-fluid:has(.products-page) {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: auto;
    max-height: none;
}

.iffys-desktop .content-page > .container-fluid:has(.products-page) > .page-container {
    flex: 1 1 0 !important;
    min-height: 0 !important;
    height: 100% !important;
    max-height: 100% !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    padding: 0 !important;
}

.iffys-desktop .content-page > .container-fluid:has(.products-page) > .page-container > .products-page {
    flex: 1 1 0;
    min-height: 0;
    height: 100%;
    max-height: 100%;
    overflow: hidden;
}

.iffys-desktop .content-page > .container-fluid:has(.inventory-page) {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: auto;
    max-height: none;
}

.iffys-desktop .content-page > .container-fluid:has(.inventory-page) > .page-container {
    flex: 1 1 0 !important;
    min-height: 0 !important;
    height: 100% !important;
    max-height: 100% !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    padding: 0 !important;
}

.iffys-desktop .content-page > .container-fluid:has(.inventory-page) > .page-container > .inventory-page {
    flex: 1 1 0;
    min-height: 0;
    height: 100%;
    max-height: 100%;
    overflow: hidden;
}

/* Inventory Usage — fill content pane above footer; grid scrolls internally */
.iffys-desktop .content-page > .container-fluid:has(.iu-page) {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: auto;
    max-height: none;
}

.iffys-desktop .content-page > .container-fluid:has(.iu-page) > .page-container {
    flex: 1 1 0 !important;
    min-height: 0 !important;
    height: 100% !important;
    max-height: 100% !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
}

.iffys-desktop .content-page > .container-fluid:has(.iu-page) > .page-container > .iu-page {
    flex: 1 1 0;
    min-height: 0;
    height: 100%;
    max-height: 100%;
    overflow: hidden;
}

/* Inventory audit — list scrolls inside the page */
.iffys-desktop .content-page > .container-fluid:has(.ia-page) {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: auto;
    max-height: none;
}

.iffys-desktop .content-page > .container-fluid:has(.ia-page) > .page-container {
    flex: 1 1 0 !important;
    min-height: 0 !important;
    height: 100% !important;
    max-height: 100% !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    padding: 0 !important;
}

.iffys-desktop .content-page > .container-fluid:has(.ia-page) > .page-container > .ia-page {
    flex: 1 1 0;
    min-height: 0;
    height: 100%;
    max-height: 100%;
    overflow: hidden;
}

/* Invoice quantity audit — list scrolls in the left column */
.iffys-desktop .content-page > .container-fluid:has(.aq-page) {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: auto;
    max-height: none;
}

.iffys-desktop .content-page > .container-fluid:has(.aq-page) > .page-container {
    flex: 1 1 0 !important;
    min-height: 0 !important;
    height: 100% !important;
    max-height: 100% !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    padding: 0 !important;
}

.iffys-desktop .content-page > .container-fluid:has(.aq-page) > .page-container > .aq-page {
    flex: 1 1 0;
    min-height: 0;
    height: 100%;
    max-height: 100%;
    overflow: hidden;
}

/* Franchise pricing audit — full-bleed split (minimal chrome) */
.iffys-desktop .content-page > .container-fluid:has(.ap-page) {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: auto;
    max-height: none;
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
}

.iffys-desktop .content-page > .container-fluid:has(.ap-page) > .page-container {
    flex: 1 1 0 !important;
    min-height: 0 !important;
    height: 100% !important;
    max-height: 100% !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    padding: 0 0.35rem !important;
}

.iffys-desktop .content-page > .container-fluid:has(.ap-page) > .page-container > .ap-page {
    flex: 1 1 0;
    min-height: 0;
    height: 100%;
    max-height: 100%;
    overflow: hidden;
}

/* Receivables page — allow scroll so charts + detail panels are reachable */
.iffys-desktop .content-page > .container-fluid:has(.receivables-page) {
    display: flex;
    flex-direction: column;
    overflow: auto;
    height: auto;
    max-height: none;
}

.iffys-desktop .content-page > .container-fluid:has(.receivables-page) > .page-container {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    display: block !important;
}

.iffys-desktop .content-page > .container-fluid:has(.receivables-page) > .page-container > .receivables-page {
    min-height: 100%;
    height: auto;
    max-height: none;
    overflow: visible;
}

.iffys-desktop .page-container {
    max-width: 100%;
}

/* ----- Topbar ----- */
.iffys-desktop .app-topbar {
    position: sticky;
    top: 0;
    z-index: 1001;
    flex: 0 0 auto;
    background: var(--iffys-topbar-bg);
    height: var(--iffys-topbar-height);
    margin-inline-start: var(--iffys-sidenav-width);
    transition: margin-inline-start 0.25s ease-in-out;
    box-shadow: 0 1px 4px rgba(0, 31, 63, 0.08);
    border-bottom: 2px solid var(--iffys-orange);
}

.iffys-desktop .topbar-menu {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    height: 100%;
    padding: 0 1rem;
    gap: 0.75rem;
}

.iffys-desktop .topbar-menu-left,
.iffys-desktop .topbar-menu-right {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
}

.iffys-desktop .topbar-menu-left {
    justify-self: start;
}

.iffys-desktop .topbar-menu-right {
    justify-self: end;
}

/* ----- Header mega menu (centered, hover drill-down) ----- */
.iffys-desktop .desktop-mega {
    justify-self: center;
    position: relative;
    z-index: 1100;
    max-width: min(920px, calc(100vw - 28rem));
}

.iffys-desktop .desktop-mega__list {
    display: flex;
    align-items: stretch;
    justify-content: center;
    flex-wrap: nowrap;
    gap: 0.15rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.iffys-desktop .desktop-mega__item {
    position: relative;
    list-style: none;
}

.iffys-desktop .desktop-mega__trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    height: 2.35rem;
    padding: 0 0.7rem;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--iffys-navy-mid);
    font-size: 0.8125rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.iffys-desktop .desktop-mega__trigger > .bi:first-child {
    font-size: 0.95rem;
    color: var(--iffys-navy-hover);
    opacity: 0.9;
}

.iffys-desktop .desktop-mega__trigger--quote {
    background: linear-gradient(180deg, #ff7a1a 0%, var(--iffys-orange) 100%);
    border-color: #e85d00;
    color: #fff;
    box-shadow: 0 1px 4px rgba(255, 102, 0, 0.28);
}

.iffys-desktop .desktop-mega__trigger--quote > .bi:first-child {
    color: #fff;
    opacity: 1;
}

.iffys-desktop .desktop-mega__item--quote.is-open > .desktop-mega__trigger--quote,
.iffys-desktop .desktop-mega__trigger--quote:hover {
    background: linear-gradient(180deg, #ff8a33 0%, #f06a00 100%);
    border-color: #d45500;
    color: #fff;
}

.iffys-desktop .desktop-mega__item--quote.is-open > .desktop-mega__trigger--quote > .bi:first-child,
.iffys-desktop .desktop-mega__trigger--quote:hover > .bi:first-child {
    color: #fff;
}

.iffys-desktop .desktop-mega__caret {
    font-size: 0.65rem;
    opacity: 0.55;
    transition: transform 0.18s ease, opacity 0.15s ease;
}

.iffys-desktop .desktop-mega__item.is-open > .desktop-mega__trigger,
.iffys-desktop .desktop-mega__item.is-active > .desktop-mega__trigger {
    background: linear-gradient(180deg, #f8fafc 0%, #eef3f8 100%);
    border-color: #d5dee8;
    color: var(--iffys-navy-deep);
    box-shadow: inset 0 -2px 0 var(--iffys-orange);
}

.iffys-desktop .desktop-mega__item.is-open > .desktop-mega__trigger > .bi:first-child,
.iffys-desktop .desktop-mega__item.is-active > .desktop-mega__trigger > .bi:first-child {
    color: var(--iffys-orange);
}

.iffys-desktop .desktop-mega__item.is-open .desktop-mega__caret {
    transform: rotate(180deg);
    opacity: 0.85;
}

.iffys-desktop .desktop-mega__panel {
    position: absolute;
    top: calc(100% - 0.15rem);
    left: 50%;
    transform: translateX(-50%) translateY(0.35rem);
    min-width: 14.5rem;
    padding-top: 0.45rem;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s;
    z-index: 1200;
}

/* Open only via .is-open (mouse enter); close on mouse leave or selection */
.iffys-desktop .desktop-mega__item.is-open > .desktop-mega__panel {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}

.iffys-desktop .desktop-mega__panel-inner {
    border: 1px solid #d7e0ea;
    border-radius: 12px;
    background: #fff;
    box-shadow:
        0 12px 28px rgba(3, 20, 46, 0.14),
        0 2px 6px rgba(3, 20, 46, 0.06);
    overflow: hidden;
}

.iffys-desktop .desktop-mega__panel-head {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.65rem 0.85rem;
    background: linear-gradient(180deg, var(--iffys-navy-deep) 0%, var(--iffys-navy-mid) 100%);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.iffys-desktop .desktop-mega__panel-head .bi {
    font-size: 0.9rem;
    color: var(--iffys-orange);
}

.iffys-desktop .desktop-mega__links {
    list-style: none;
    margin: 0;
    padding: 0.4rem;
}

.iffys-desktop .desktop-mega__link {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.55rem 0.7rem;
    border-radius: 8px;
    color: #1e293b;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.12s ease, color 0.12s ease;
}

.iffys-desktop .desktop-mega__link-dot {
    width: 0.4rem;
    height: 0.4rem;
    border-radius: 50%;
    background: #cbd5e1;
    flex-shrink: 0;
    transition: background 0.12s ease, transform 0.12s ease;
}

.iffys-desktop .desktop-mega__link:hover {
    background: #f1f5f9;
    color: var(--iffys-navy-deep);
}

.iffys-desktop .desktop-mega__link:hover .desktop-mega__link-dot {
    background: var(--iffys-orange);
    transform: scale(1.15);
}

.iffys-desktop .desktop-mega__link.is-active {
    background: rgba(255, 102, 0, 0.1);
    color: var(--iffys-navy-deep);
}

.iffys-desktop .desktop-mega__link.is-active .desktop-mega__link-dot {
    background: var(--iffys-orange);
}

@media (max-width: 1400px) {
    .iffys-desktop .desktop-mega__trigger {
        padding: 0 0.5rem;
        font-size: 0.78rem;
        gap: 0.28rem;
    }

    .iffys-desktop .company-selector-btn {
        min-width: 140px;
        max-width: 200px;
    }
}

@media (max-width: 1180px) {
    .iffys-desktop .desktop-mega__trigger > span:nth-child(2) {
        display: none;
    }

    .iffys-desktop .desktop-mega__trigger {
        width: 2.35rem;
        padding: 0;
        justify-content: center;
    }

    .iffys-desktop .desktop-mega__caret {
        display: none;
    }

    .iffys-desktop .desktop-mega__trigger--quote {
        width: auto;
        padding: 0 0.6rem;
    }

    .iffys-desktop .desktop-mega__trigger--quote > span:nth-child(2) {
        display: inline;
    }
}

.iffys-desktop .sidenav-toggle-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 8px;
    background: var(--iffys-navy-mid);
    color: #fff;
    cursor: pointer;
    transition: background 0.2s ease;
}

.iffys-desktop .sidenav-toggle-button:hover {
    background: var(--iffys-orange);
}

.iffys-desktop .company-selector-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-width: 200px;
    max-width: 320px;
    min-height: 40px;
    padding: 0.35rem 0.75rem;
    border: 1px solid #d7e0ea;
    border-radius: 8px;
    background: #fff;
    color: var(--iffys-navy-mid);
    font-weight: 700;
    font-size: 0.88rem;
    cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.iffys-desktop .company-selector-btn:hover {
    border-color: var(--iffys-orange);
    color: var(--iffys-orange);
    background: #fff7f0;
}

.iffys-desktop .company-selector-btn .company-selector-name {
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: left;
    min-width: 0;
}

.iffys-desktop .company-selector-btn .bi-building,
.iffys-desktop .company-selector-btn .bi-chevron-down {
    flex-shrink: 0;
    font-size: 0.85rem;
}

.iffys-desktop .company-selector-link {
    color: var(--iffys-navy-mid);
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    padding: 0.4rem 0.75rem;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    background: #f8fafc;
    max-width: 320px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.iffys-desktop .company-selector-link:hover {
    border-color: var(--iffys-orange);
    color: var(--iffys-orange);
}

.iffys-desktop .topbar-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    min-width: 40px;
    height: 40px;
    padding: 0 0.75rem;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--iffys-navy-deep) 0%, var(--iffys-navy-hover) 100%);
    color: #fff;
    cursor: pointer;
    position: relative;
    transition: transform 0.15s ease, box-shadow 0.2s ease;
    box-shadow: 0 2px 8px rgba(3, 20, 46, 0.18);
}

.iffys-desktop .topbar-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(3, 20, 46, 0.25);
}

.iffys-desktop .topbar-btn.tasks {
    background: #fff;
    color: var(--iffys-navy-mid);
    border: 1px solid #e5e7eb;
    box-shadow: none;
}

.iffys-desktop .topbar-btn.tasks:hover {
    border-color: var(--iffys-orange);
    color: var(--iffys-orange);
}

.iffys-desktop .tasks-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 26px;
    height: 26px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--iffys-orange);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
}

/* Pending acceptance — compact chip in topbar (no page height) */
.iffys-desktop .topbar-assigned-alert {
    display: inline-flex;
    align-items: stretch;
    max-width: min(320px, 36vw);
    min-height: 36px;
    border-radius: 8px;
    border: 1px solid #fdba74;
    background: #fff7ed;
    overflow: hidden;
    flex-shrink: 1;
}

.iffys-desktop .topbar-assigned-alert__body {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-width: 0;
    padding: 0 0.65rem;
    border: none;
    background: transparent;
    color: #9a3412;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
}

.iffys-desktop .topbar-assigned-alert__body i {
    color: var(--iffys-orange);
    flex-shrink: 0;
}

.iffys-desktop .topbar-assigned-alert__body span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.iffys-desktop .topbar-assigned-alert__dismiss {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    border: none;
    border-left: 1px solid #fdba74;
    background: transparent;
    color: #9a3412;
    cursor: pointer;
    opacity: 0.7;
    flex-shrink: 0;
}

.iffys-desktop .topbar-assigned-alert__dismiss:hover {
    opacity: 1;
    background: #ffedd5;
}

.iffys-desktop .topbar-btn .bi {
    font-size: 1.1rem;
}

/* ----- Sidenav ----- */
.iffys-desktop .sidenav-menu {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1005;
    width: var(--iffys-sidenav-width);
    background: var(--iffys-sidenav-bg);
    border-inline-end: 1px solid var(--iffys-sidenav-border);
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.12);
    transition: width 0.25s ease-in-out, transform 0.25s ease-in-out;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.iffys-desktop .sidenav-menu .logo {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.75rem;
    height: var(--iffys-topbar-height);
    padding: 0 1rem;
    text-decoration: none;
    border-bottom: 1px solid var(--iffys-sidenav-border);
    flex-shrink: 0;
}

.iffys-desktop .sidenav-menu .logo img {
    height: 36px;
    width: auto;
    object-fit: contain;
    flex-shrink: 0;
}

.iffys-desktop .sidenav-menu .logo-user-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
    text-align: center;
    line-height: 1.15;
}

.iffys-desktop .sidenav-menu .logo-user {
    color: #fff;
    font-weight: 700;
    font-size: 0.92rem;
    letter-spacing: 0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    text-align: center;
    width: 100%;
}

.iffys-desktop .sidenav-menu .logo-title {
    color: rgba(255, 255, 255, 0.72);
    font-weight: 600;
    font-size: 0.72rem;
    letter-spacing: 0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    width: 100%;
    margin-top: 0.1rem;
    text-align: center;
}

.iffys-desktop .sidenav-scroll {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.75rem 0 1.5rem;
}

.iffys-desktop .side-nav {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.iffys-desktop .side-nav-title {
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.4);
    font-weight: 700;
    font-size: 0.68rem;
    padding: 0.85rem 1.25rem 0.4rem;
    pointer-events: none;
}

.iffys-desktop .side-nav-item {
    padding: 0 0.65rem;
}

.iffys-desktop .side-nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--iffys-sidenav-item);
    text-decoration: none;
    padding: 0.7rem 0.85rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.25;
    transition: color 0.2s ease, background 0.2s ease;
    cursor: pointer;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
}

.iffys-desktop .side-nav-link:hover,
.iffys-desktop .side-nav-link:focus {
    color: var(--iffys-sidenav-item-hover);
    background: rgba(255, 255, 255, 0.06);
}

.iffys-desktop .side-nav-item.active > .side-nav-link,
.iffys-desktop .side-nav-link.active {
    color: #fff !important;
    background: var(--iffys-sidenav-item-active-bg);
    box-shadow: inset 3px 0 0 var(--iffys-orange);
}

.iffys-desktop .side-nav-link .menu-icon {
    display: inline-flex;
    width: 1.35rem;
    justify-content: center;
    font-size: 1.15rem;
    flex-shrink: 0;
}

.iffys-desktop .side-nav-link .menu-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.iffys-desktop .side-nav-link .menu-arrow {
    font-size: 0.75rem;
    opacity: 0.7;
    transition: transform 0.2s ease;
}

.iffys-desktop .side-nav-item.open > .side-nav-link .menu-arrow {
    transform: rotate(180deg);
}

.iffys-desktop .sub-menu {
    list-style: none;
    margin: 0;
    padding: 0.15rem 0 0.35rem;
    display: none;
    flex-direction: column;
    gap: 1px;
}

.iffys-desktop .side-nav-item.open > .sub-menu {
    display: flex;
}

.iffys-desktop .sub-menu .side-nav-link {
    font-size: 0.84rem;
    padding: 0.55rem 0.85rem 0.55rem 2.85rem;
    font-weight: 450;
}

.iffys-desktop .sub-menu .side-nav-link.active {
    color: #fff !important;
    background: transparent;
    box-shadow: none;
    color: var(--iffys-orange) !important;
    font-weight: 600;
}

/* ----- Footer ----- */
.iffys-desktop .app-footer {
    height: var(--iffys-footer-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    background: #fff;
    border-top: 1px solid #e5e7eb;
    color: #64748b;
    font-size: 0.78rem;
    flex-shrink: 0;
}

/* ----- Condensed sidenav (icons only; expand on hover) ----- */
.iffys-desktop.sidenav-condensed {
    --iffys-sidenav-width: var(--iffys-sidenav-width-sm);
}

.iffys-desktop.sidenav-condensed .sidenav-menu .logo-text,
.iffys-desktop.sidenav-condensed .sidenav-menu .logo-user-block,
.iffys-desktop.sidenav-condensed .sidenav-menu .logo-user,
.iffys-desktop.sidenav-condensed .side-nav-title,
.iffys-desktop.sidenav-condensed .menu-text,
.iffys-desktop.sidenav-condensed .menu-arrow {
    display: none;
}

.iffys-desktop.sidenav-condensed .side-nav-link {
    justify-content: center;
    padding: 0.75rem 0.5rem;
}

.iffys-desktop.sidenav-condensed .sub-menu {
    display: none !important;
}

.iffys-desktop.sidenav-condensed .sidenav-menu .logo {
    justify-content: center;
    padding: 0;
}

/* Overlay-expand on hover — content margin stays condensed */
.iffys-desktop.sidenav-condensed .sidenav-menu:hover {
    width: var(--iffys-sidenav-width-full);
    box-shadow: 8px 0 24px rgba(0, 0, 0, 0.22);
}

.iffys-desktop.sidenav-condensed .sidenav-menu:hover .logo-user-block {
    display: flex;
}

.iffys-desktop.sidenav-condensed .sidenav-menu:hover .logo-text,
.iffys-desktop.sidenav-condensed .sidenav-menu:hover .logo-user,
.iffys-desktop.sidenav-condensed .sidenav-menu:hover .side-nav-title,
.iffys-desktop.sidenav-condensed .sidenav-menu:hover .menu-text,
.iffys-desktop.sidenav-condensed .sidenav-menu:hover .menu-arrow {
    display: revert;
}

.iffys-desktop.sidenav-condensed .sidenav-menu:hover .side-nav-link {
    justify-content: flex-start;
    padding: 0.7rem 0.85rem;
}

.iffys-desktop.sidenav-condensed .sidenav-menu:hover .sub-menu .side-nav-link {
    padding: 0.55rem 0.85rem 0.55rem 2.85rem;
}

.iffys-desktop.sidenav-condensed .sidenav-menu:hover .side-nav-item.open > .sub-menu {
    display: flex !important;
}

.iffys-desktop.sidenav-condensed .sidenav-menu:hover .logo {
    justify-content: flex-start;
    padding: 0 1rem;
}

/* ----- Offcanvas / overlay for narrow desktop windows ----- */
.iffys-desktop.sidenav-offcanvas .sidenav-menu {
    transform: translateX(-100%);
}

.iffys-desktop.sidenav-offcanvas.sidebar-enable .sidenav-menu {
    transform: translateX(0);
}

.iffys-desktop.sidenav-offcanvas .app-topbar,
.iffys-desktop.sidenav-offcanvas .content-page {
    margin-inline-start: 0;
}

.iffys-desktop .sidenav-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 31, 63, 0.45);
    z-index: 1004;
}

.iffys-desktop.sidenav-offcanvas.sidebar-enable .sidenav-backdrop {
    display: block;
}

/* Hide mobile chrome leftovers when desktop shell is active */
.iffys-desktop .mobile-header,
.iffys-desktop .mobile-nav-bar,
.iffys-desktop .mobile-footer {
    display: none !important;
}

/* Desktop content area — avoid mobile card chrome */
.iffys-desktop .page-container {
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    background: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: visible !important;
    min-height: 0 !important;
}

/* Company modal above desktop shell */
.iffys-desktop ~ .company-modal-overlay,
body:has(.iffys-desktop) .company-modal-overlay {
    z-index: 3000 !important;
    background-color: rgba(0, 31, 63, 0.45) !important;
}

body:has(.iffys-desktop) .company-modal {
    z-index: 3001 !important;
    top: 50% !important;
    bottom: auto !important;
    left: 50% !important;
    right: auto !important;
    transform: translate(-50%, -50%) !important;
    width: min(420px, calc(100vw - 2rem)) !important;
    max-height: min(70vh, 520px) !important;
    border-radius: 12px !important;
    box-shadow: 0 16px 40px rgba(0, 31, 63, 0.25) !important;
}

/* Inventory audit dialog — homepage card/grid chrome.
   Desktop size is 60vw by 70vh. Phone uses nearly the full screen. */
.pia-dialog.e-dialog {
    position: fixed !important;
    z-index: 61000 !important;
    width: 60vw !important;
    height: 70vh !important;
    max-width: calc(100vw - 2rem) !important;
    max-height: calc(100vh - 2rem) !important;
    margin: 0 !important;
    left: 50% !important;
    top: 50% !important;
    transform: translate(-50%, -50%) !important;
    border: 1px solid #e8edf3 !important;
    border-radius: 12px !important;
    overflow: hidden !important;
    background: #ffffff !important;
    box-shadow: 0 16px 40px rgba(0, 31, 63, 0.18) !important;
    font-size: 12px !important;
    color: #0f172a;
}

.e-dlg-overlay:has(+ .pia-dialog) {
    z-index: 60990 !important;
}

.pia-dialog .e-dlg-header-content {
    padding: 0.55rem 2.4rem 0.55rem 0.9rem !important;
    background: #ffffff !important;
    border-bottom: 2px solid #ff6600 !important;
}

.pia-dialog .e-dlg-header {
    width: 100%;
    font-size: 12px !important;
    font-weight: 700 !important;
}

.pia-dialog .e-dlg-content {
    padding: 0.55rem 0.65rem 0.65rem !important;
    height: calc(100% - 3.1rem);
    background: #f5f7fa !important;
    overflow: hidden !important;
}

.pia-dialog .e-dlg-closeicon-btn {
    color: #002245 !important;
    top: 0.45rem !important;
    right: 0.45rem !important;
    z-index: 2 !important;
}

.pia-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    min-width: 0;
}

.pia-title {
    font-size: 12px !important;
    font-weight: 700 !important;
    color: #002245;
    letter-spacing: 0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pia-stats {
    display: flex;
    gap: 0.4rem;
    flex-shrink: 0;
}

.pia-stat {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    min-width: 4.25rem;
    padding: 0.2rem 0.55rem;
    border: 1px solid #e8edf3;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 31, 63, 0.04);
}

.pia-stat span,
.pia-stat b {
    font-size: 12px !important;
    font-weight: 700 !important;
    line-height: 1.15;
}

.pia-stat span {
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.pia-stat b {
    color: #002245;
}

.pia-body {
    display: flex;
    gap: 0.5rem;
    height: 100%;
    min-height: 0;
}

.pia-side {
    flex: 3 1 0;
    width: auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-height: 0;
}

.pia-card,
.pia-main {
    border: 1px solid #e8edf3;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 31, 63, 0.04);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.pia-side > .pia-card {
    flex: 1 1 0;
    min-height: 0;
}

.pia-card-body {
    flex: 1 1 0;
    min-height: 0;
    overflow: hidden;
}

.pia-main {
    flex: 7 1 0;
    min-width: 0;
}

.pia-card-title {
    padding: 0.4rem 0.7rem;
    font-size: 12px !important;
    font-weight: 700 !important;
    color: #002245;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    background: #ffffff;
    border: 0;
    border-bottom: 1px solid #e8edf3;
    text-align: left;
}

button.pia-daily-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    cursor: default;
    pointer-events: none;
}

button.pia-daily-toggle i {
    display: none;
}

.pia-empty,
.pia-error {
    padding: 1.25rem 0.75rem;
    text-align: center;
    color: #64748b;
    font-size: 12px !important;
}

.pia-error {
    color: #b91c1c;
}

.pia-neg {
    color: #b91c1c;
    font-weight: 700;
}

.ia-table-scroll {
    flex: 1 1 0;
    min-height: 0;
    height: 100%;
    overflow: auto;
}

.ia-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    color: #0f172a;
    background: #ffffff;
}

.ia-table th,
.ia-table td {
    border: 1px solid #e8edf3;
    padding: 0.28rem 0.45rem;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.25;
    vertical-align: middle;
    white-space: normal;
    word-break: break-word;
}

.ia-table tbody tr.pia-unreported td {
    color: #b91c1c;
    background: #fef2f2;
    font-weight: 600;
}

.ia-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #ffffff;
    color: #002245;
    font-weight: 700;
    text-align: center;
    line-height: 1.15;
    padding-top: 0.35rem;
    padding-bottom: 0.35rem;
}

.ia-table th button {
    appearance: none;
    border: 0;
    background: transparent;
    padding: 0;
    margin: 0;
    width: 100%;
    color: inherit;
    font: inherit;
    font-size: inherit;
    font-weight: 700;
    line-height: 1.15;
    cursor: pointer;
}

.ia-table .ia-center {
    text-align: center;
}

.ia-link {
    appearance: none;
    border: none;
    background: transparent;
    padding: 0;
    margin: 0;
    color: #0b5ed7;
    font: inherit;
    font-size: inherit !important;
    font-weight: 400;
    line-height: 1.25;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}

.ia-link:hover {
    color: #084298;
}

.ia-link.ia-qty-bad {
    color: #b91c1c;
    font-weight: 700;
}

.ia-link.ia-qty-ok {
    color: #15803d;
    font-weight: 700;
}

.ia-link.ia-qty-bad:hover,
.ia-link.ia-qty-ok:hover {
    filter: brightness(0.85);
}

.ia-table .ia-col-actions {
    width: 4.5rem;
}

.ia-table tbody tr.is-clickable {
    cursor: pointer;
}

.ia-table tbody tr.is-clickable:hover td {
    background: #f8fafc;
}

.ia-table tbody tr.is-selected td {
    background: #fff4ec;
}

.ia-qty-bad {
    color: #b91c1c;
    font-weight: 700;
}

.ia-qty-ok {
    color: #15803d;
    font-weight: 700;
}

@media (max-width: 1919.98px) {
    .ia-table,
    .ia-table th,
    .ia-table td,
    .ia-table th button {
        font-size: 10px !important;
    }
}

@media (max-width: 1399.98px) {
    .pia-dialog.e-dialog {
        width: calc(100vw - 20px) !important;
        max-width: calc(100vw - 20px) !important;
        left: 10px !important;
        right: auto !important;
        top: 84px !important;
        height: calc(100vh - 84px - 106px) !important;
        max-height: calc(100vh - 84px - 106px) !important;
        transform: none !important;
    }

    body:has(.pia-dialog) .mobile-header,
    body:has(.pia-dialog) .mobile-nav-bar,
    body:has(.pia-dialog) .mobile-footer {
        z-index: 61010 !important;
    }

    .pia-dialog.e-dialog,
    .pia-dialog .e-dlg-header,
    .pia-dialog .pia-title,
    .pia-dialog .pia-stat span,
    .pia-dialog .pia-stat b,
    .pia-dialog .pia-card-title,
    .pia-dialog .pia-empty,
    .pia-dialog .pia-error {
        font-size: 12px !important;
    }

    .ia-table,
    .ia-table th,
    .ia-table td,
    .ia-table th button {
        font-size: 11px !important;
    }
}

@media (max-width: 1023.98px) {
    .pia-dialog.e-dialog {
        height: calc(100vh - 84px - 60px) !important;
        max-height: calc(100vh - 84px - 60px) !important;
    }

    .pia-dialog.e-dialog,
    .pia-dialog .e-dlg-header,
    .pia-dialog .pia-title,
    .pia-dialog .pia-stat span,
    .pia-dialog .pia-stat b,
    .pia-dialog .pia-card-title,
    .pia-dialog .pia-empty,
    .pia-dialog .pia-error,
    .ia-table,
    .ia-table th,
    .ia-table td,
    .ia-table th button {
        font-size: 10px !important;
    }

    .pia-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .pia-dialog .e-dlg-content {
        overflow: auto !important;
    }

    .pia-body {
        flex-direction: column;
        height: auto;
    }

    .pia-side {
        width: 100%;
        flex: 0 0 auto;
    }

    .pia-side > .pia-card {
        flex: 0 0 auto;
        height: auto;
    }

    .pia-card--snapshots .pia-card-body,
    .pia-card--snapshots .ia-table-scroll {
        flex: 0 0 auto;
        height: auto;
        min-height: 0;
    }

    .pia-card--snapshots .ia-table-scroll {
        max-height: 7.6rem;
        overflow: auto;
    }

    .pia-card--daily:not(.is-open) .pia-card-body {
        display: none;
    }

    .pia-card--daily.is-open .pia-card-body,
    .pia-card--daily.is-open .ia-table-scroll {
        display: block;
        flex: 0 0 auto;
        height: auto;
        min-height: 4.5rem;
        overflow: auto;
    }

    .pia-card--daily.is-open .ia-table-scroll {
        max-height: 28vh;
    }

    button.pia-daily-toggle {
        cursor: pointer;
        pointer-events: auto;
    }

    button.pia-daily-toggle i {
        display: inline-block;
        font-size: 12px;
    }

    .pia-main {
        flex: 1 1 auto;
        min-height: 46vh;
        height: auto;
    }
}

.pie-dialog.e-dialog {
    width: min(28rem, calc(100vw - 1.5rem)) !important;
    max-width: calc(100vw - 1.5rem) !important;
}
