/* Final application chrome layer: mobile identity header and legal footer. */
.mobile-account-trigger,
.mobile-account-meta {
    display: none !important;
}

/* The invoice is the primary desktop action; secondary utilities stay circular. */
.top-invoice-action {
    min-width: 116px;
    height: 58px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 5px 17px 5px 7px;
    border: 1px solid rgba(17, 21, 34, .92);
    border-radius: 999px;
    background: #111522;
    color: #fff;
    box-shadow: 0 10px 24px rgba(17, 21, 34, .13);
    text-decoration: none;
    font-size: 13px;
    font-weight: 760;
    line-height: 1;
    white-space: nowrap;
    transition: transform .18s ease, background-color .18s ease, box-shadow .18s ease;
}

.top-invoice-action-icon {
    width: 44px;
    height: 44px;
    min-width: 44px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, .12);
}

.top-invoice-action-icon svg {
    width: 20px;
    height: 20px;
    stroke-width: 1.9;
}

.top-invoice-action:is(:hover, :focus-visible) {
    background: #080b13;
    color: #fff;
    box-shadow: 0 14px 30px rgba(17, 21, 34, .18);
    transform: translateY(-1px);
}

.top-invoice-action:focus-visible {
    outline: 3px solid rgba(37, 99, 235, .2);
    outline-offset: 3px;
}

@media screen and (max-width: 760px) {
    .top-invoice-action {
        display: none !important;
    }
}

.app-footer {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 24px;
    margin-top: 22px;
    padding: 18px 4px 5px;
    border-top: 1px solid rgba(100, 116, 139, .18);
    color: #69758a;
    font-size: 11.5px;
    line-height: 1.45;
}

.app-footer-primary {
    min-width: 0;
    display: grid;
    gap: 9px;
}

.app-footer-product,
.app-footer-legal,
.app-footer-rights {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}

.app-footer-product {
    gap: 9px;
    color: #4b5669;
}

.app-footer-product img {
    width: 67px;
    height: auto;
    display: block;
    object-fit: contain;
    filter: grayscale(1) brightness(0);
    opacity: .9;
}

.app-footer-legal {
    gap: 7px 15px;
}

.app-footer a {
    color: #596579;
    text-decoration: none;
    text-underline-offset: 3px;
    transition: color .18s ease;
}

.app-footer a:is(:hover, :focus-visible) {
    color: #111522;
    text-decoration: underline;
}

.app-footer-rights {
    justify-content: flex-end;
    gap: 6px 14px;
    text-align: right;
    white-space: nowrap;
}

.app-footer-rights a {
    font-weight: 700;
}

body.auth-screen {
    grid-template-rows: auto auto;
    align-content: center;
    gap: 14px;
}

body.auth-screen > .app-footer {
    width: min(1180px, 100%);
    margin-top: 0;
}

@media screen and (max-width: 760px) {
    :root {
        --mobile-shell-height: 96px;
        --gdx-mobile-workspace-gradient:
            radial-gradient(34rem 27rem at -12% -2%, rgba(197, 216, 255, .94) 0%, rgba(197, 216, 255, 0) 66%),
            radial-gradient(31rem 27rem at 108% 24%, rgba(224, 216, 255, .76) 0%, rgba(224, 216, 255, 0) 70%),
            radial-gradient(21rem 17rem at 112% 104%, rgba(255, 244, 210, .28) 0%, rgba(255, 244, 210, 0) 64%),
            linear-gradient(158deg, #f3f7ff 0%, #edf3ff 52%, #f7f3ff 88%, #fffaf0 100%);
    }

    body:not(.auth-screen) {
        --mobile-shell-height: 96px;
        background-color: #f1f5ff !important;
        background-image: var(--gdx-mobile-workspace-gradient) !important;
        background-position: center top !important;
        background-size: cover !important;
        background-attachment: fixed !important;
    }

    .mobile-bar {
        position: relative !important;
        inset: auto !important;
        z-index: 75 !important;
        width: 100% !important;
        height: 96px !important;
        min-height: 96px !important;
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) 48px !important;
        align-items: center !important;
        justify-content: stretch !important;
        gap: 12px !important;
        padding: 17px 18px 15px !important;
        border: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
        -webkit-backdrop-filter: none !important;
        backdrop-filter: none !important;
    }

    .mobile-brand-mark {
        width: 38px !important;
        height: 50px !important;
        min-width: 38px !important;
        display: grid !important;
        place-items: center !important;
        padding: 0 !important;
        border: 0 !important;
        border-radius: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
    }

    .mobile-brand-mark img {
        width: 33px !important;
        height: 33px !important;
        display: block !important;
        object-fit: contain !important;
    }

    .mobile-user-slot {
        min-width: 0 !important;
        min-height: 50px !important;
        flex: 1 1 auto !important;
        display: flex !important;
        align-items: center !important;
        justify-content: flex-start !important;
    }

    .mobile-user-slot .user-menu {
        width: 100% !important;
        height: auto !important;
        min-width: 0 !important;
        min-height: 0 !important;
        flex: 1 1 auto !important;
        margin: 0 !important;
        padding: 0 !important;
        border-radius: 0 !important;
        overflow: visible !important;
    }

    .mobile-user-slot .user-menu > summary.account-pill {
        width: 100% !important;
        max-width: none !important;
        height: auto !important;
        min-width: 0 !important;
        min-height: 50px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: flex-start !important;
        gap: 10px !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: visible !important;
        border: 0 !important;
        border-radius: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
    }

    .mobile-user-slot .user-menu > summary.account-pill > .account-avatar,
    .mobile-user-slot .user-menu > summary.account-pill > .account-meta,
    .mobile-user-slot .user-menu > summary.account-pill > .account-chevron {
        display: none !important;
    }

    .mobile-account-trigger {
        width: 54px !important;
        height: 46px !important;
        min-width: 54px;
        min-height: 46px !important;
        display: flex !important;
        align-items: center;
        gap: 5px;
        padding: 0;
        border: 0;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
    }

    .mobile-account-avatar {
        width: 36px;
        height: 36px;
        min-width: 36px;
        display: grid;
        place-items: center;
        overflow: hidden;
        border-radius: 50%;
        background: #e8edf7;
    }

    .mobile-account-avatar img {
        width: 100% !important;
        height: 100% !important;
        display: block !important;
        object-fit: cover !important;
        object-position: center !important;
    }

    .mobile-account-trigger > svg {
        width: 13px !important;
        height: 13px !important;
        color: #111522 !important;
        stroke-width: 1.8 !important;
        transition: transform .2s ease;
    }

    .mobile-user-slot .user-menu[open] .mobile-account-trigger > svg {
        transform: rotate(180deg);
    }

    .mobile-account-meta {
        min-width: 0;
        width: auto !important;
        max-width: none;
        height: auto !important;
        min-height: 0 !important;
        flex: 1 1 auto;
        display: grid !important;
        align-items: start !important;
        justify-items: stretch;
        gap: 2px;
        overflow: visible;
        border: 0 !important;
        border-radius: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
        text-align: left;
    }

    .mobile-account-meta strong,
    .mobile-account-meta small {
        width: 100% !important;
        height: auto !important;
        min-height: 0 !important;
        display: block;
        min-width: 0;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
    }

    .mobile-account-meta strong {
        color: #111522;
        font-size: 16px;
        font-weight: 520;
        line-height: 1.24;
        letter-spacing: -.01em;
    }

    .mobile-account-meta small {
        color: #718096;
        font-size: 10.5px;
        font-weight: 540;
        line-height: 1.3;
    }

    .mobile-user-slot .user-menu-panel {
        top: calc(var(--mobile-shell-height) + 4px) !important;
        right: 10px !important;
        left: 10px !important;
        width: auto !important;
        max-width: none !important;
    }

    body:not(.auth-screen) > .user-menu-panel.gdx-floating-overlay-panel {
        top: calc(var(--mobile-shell-height) + 4px) !important;
        right: 10px !important;
        left: 10px !important;
        width: auto !important;
        max-width: none !important;
    }

    .mobile-notification-slot {
        width: 48px;
        height: 48px;
        min-width: 48px;
        display: grid;
        place-items: center;
    }

    .mobile-notification-slot .notification-menu,
    .mobile-notification-slot .notification-button {
        width: 48px !important;
        height: 48px !important;
        min-width: 48px !important;
        min-height: 48px !important;
        margin: 0 !important;
        padding: 0 !important;
        border-radius: 50% !important;
    }

    .mobile-notification-slot .notification-button {
        position: relative !important;
        display: grid !important;
        place-items: center !important;
        border: 1px solid rgba(255, 255, 255, .96) !important;
        color: #111522 !important;
        background: rgba(255, 255, 255, .72) !important;
        box-shadow: 0 7px 20px rgba(33, 52, 85, .06) !important;
        -webkit-backdrop-filter: blur(14px) saturate(1.12) !important;
        backdrop-filter: blur(14px) saturate(1.12) !important;
    }

    .mobile-notification-slot .notification-button > svg {
        width: 18px !important;
        height: 18px !important;
        stroke-width: 1.85 !important;
    }

    .mobile-notification-slot .notification-dot {
        position: absolute !important;
        top: 7px !important;
        right: 7px !important;
        width: 8px !important;
        height: 8px !important;
        min-width: 8px !important;
        min-height: 8px !important;
        border: 2px solid #fff !important;
        border-radius: 50% !important;
        background: #ef4444 !important;
        box-shadow: 0 0 0 1px rgba(239, 68, 68, .18) !important;
    }

    .mobile-notification-slot .notification-dot:not([hidden]) {
        display: block !important;
        opacity: 1 !important;
        visibility: visible !important;
    }

    .mobile-notification-slot .notification-panel {
        position: fixed !important;
        top: calc(var(--mobile-shell-height) + 4px) !important;
        right: 10px !important;
        left: 10px !important;
        width: auto !important;
        max-width: none !important;
        z-index: 120 !important;
    }

    body:not(.auth-screen) > .notification-panel.gdx-floating-overlay-panel {
        top: calc(var(--mobile-shell-height) + 4px) !important;
        right: 10px !important;
        left: 10px !important;
        width: auto !important;
        max-width: none !important;
    }

    body:not(.auth-screen) .main,
    body:not(.auth-screen) .main:not(.dashboard-main),
    body:not(.auth-screen) .main.dashboard-main,
    body:not(.auth-screen).ai-chat-open .main {
        border-radius: 26px 26px 0 0 !important;
        background-color: rgba(255, 255, 255, .4) !important;
        background-image: linear-gradient(165deg, rgba(255, 255, 255, .24), rgba(240, 243, 255, .08)) !important;
        border-top: 1px solid rgba(255, 255, 255, .72) !important;
    }

    .app-footer {
        grid-template-columns: minmax(0, 1fr);
        justify-items: center;
        gap: 12px;
        margin-top: 24px;
        padding: 18px 16px 16px;
        text-align: center;
        font-size: 10.5px;
    }

    .app-footer-primary {
        justify-items: center;
        gap: 10px;
    }

    .app-footer-product,
    .app-footer-legal,
    .app-footer-rights {
        justify-content: center;
    }

    .app-footer-product {
        max-width: 310px;
        flex-direction: column;
        gap: 7px;
    }

    .app-footer-product img {
        width: 61px;
    }

    .app-footer-legal {
        width: min(280px, 100%);
        gap: 6px 13px;
    }

    .app-footer-rights {
        gap: 5px 12px;
        white-space: normal;
        text-align: center;
    }

body.auth-screen > .app-footer {
        width: 100%;
        margin-top: 0;
    }
}

/* The expanded desktop navigation is the top application surface. */
@media screen and (min-width: 761px) {
    #app-sidebar.sidebar:is(:hover, :focus-within, .is-menu-open) {
        z-index: 2147483640 !important;
        isolation: isolate;
    }
}

/*
 * Neutral action elevation.
 * The action colour changed from blue to near-black, so component-level blue
 * shadows must not leak through on buttons or active horizontal navigation.
 */
:root {
    --gdx-action-shadow: 0 10px 24px rgba(9, 11, 18, .15), 0 2px 7px rgba(9, 11, 18, .08);
    --gdx-action-shadow-hover: 0 14px 30px rgba(9, 11, 18, .20), 0 4px 10px rgba(9, 11, 18, .10);
    --gdx-action-shadow-compact: 0 8px 19px rgba(9, 11, 18, .14), 0 2px 6px rgba(9, 11, 18, .07);
}

@media screen {
    body:not(.auth-screen) :is(
        .button:not(.secondary):not(.danger):not(.success):not(.warning),
        .pill-button:not(.secondary):not(.danger):not(.success):not(.warning),
        .primary-button,
        .btn-primary,
        .button-primary,
        .documents-filter-popover-apply,
        .mobile-create-button
    ) {
        box-shadow: var(--gdx-action-shadow) !important;
    }

    body:not(.auth-screen) :is(
        .button:not(.secondary):not(.danger):not(.success):not(.warning),
        .pill-button:not(.secondary):not(.danger):not(.success):not(.warning),
        .primary-button,
        .btn-primary,
        .button-primary,
        .documents-filter-popover-apply,
        .mobile-create-button
    ):is(:hover, :focus-visible) {
        box-shadow: var(--gdx-action-shadow-hover) !important;
    }

    body:not(.auth-screen) :is(
        .sidebar nav a.active,
        .main-nav a.active,
        .main .subnav a.active,
        .main .employees-subnav a.active,
        .payroll-subnav a.active,
        .subnav-item.active,
        .segmented-button.active,
        .invoice-type-tabs button.is-active,
        .employee-editor-section-nav a.is-active,
        .dashboard-workspace .dashboard-period-switch button.active
    ) {
        box-shadow: var(--gdx-action-shadow-compact) !important;
    }

    /*
     * Horizontal navigation needs its shadow inside the scrolling viewport.
     * Padding creates that breathing room; compensated margins retain the
     * existing rhythm around the menu instead of making the section taller.
     */
    body:not(.auth-screen) .main .subnav-scroll-shell {
        margin: -8px 0 12px !important;
        overflow: visible !important;
    }

    body:not(.auth-screen) .main .subnav-scroll-shell > :is(
        .subnav,
        [class*="-subnav"],
        .project-browser-tabs,
        .project-tools-tabs,
        .teamwork-project-tabs
    ),
    body:not(.auth-screen) .main .subnav-scroll-shell.has-overflow > :is(
        .subnav,
        [class*="-subnav"],
        .project-browser-tabs,
        .project-tools-tabs,
        .teamwork-project-tabs
    ) {
        padding: 9px 10px 13px !important;
        scroll-padding-inline: 48px;
    }

    body:not(.auth-screen) .main .subnav-scroll-shell :is(
        .subnav,
        [class*="-subnav"],
        .project-browser-tabs,
        .project-tools-tabs,
        .teamwork-project-tabs
    ) :is(a.active, button.active, button.is-active) {
        box-shadow: var(--gdx-action-shadow-compact) !important;
    }

    body:not(.auth-screen) .main .subnav-scroll-shell.can-scroll-left::before,
    body:not(.auth-screen) .main .subnav-scroll-shell.can-scroll-right::after {
        top: 9px !important;
        bottom: 13px !important;
    }
}

/* Shared notification dropdown layout: identical density on desktop and mobile. */
.notification-panel {
    display: block !important;
    padding: 0 !important;
    gap: 0 !important;
    border-radius: 18px !important;
    overflow: hidden !important;
}

.notification-panel .notification-list {
    min-height: 0 !important;
    max-height: min(320px, 42dvh) !important;
    padding: 8px 12px !important;
}

.notification-panel .notification-list > .empty-cell:only-child {
    min-height: 0 !important;
    margin: 0 !important;
    padding: 18px 8px !important;
    font-size: 12px !important;
    line-height: 1.25 !important;
}

.notification-panel .notification-actions {
    min-height: 48px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 12px !important;
    padding: 7px 14px !important;
    flex-wrap: nowrap !important;
}

.notification-panel .notification-actions :is(button, a) {
    width: auto !important;
    min-width: 0 !important;
    min-height: 32px !important;
    display: inline-flex !important;
    grid-template-columns: none !important;
    align-items: center !important;
    margin: 0 !important;
    padding: 0 !important;
    font-size: 11px !important;
    line-height: 1 !important;
    white-space: nowrap !important;
}

@media print {
    .mobile-bar,
    .mobile-app-dock,
    .app-footer {
        display: none !important;
    }
}
/* AI speech action belongs to message metadata, not the message body. */
.ai-message-meta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.ai-message-speech {
    width: 28px;
    height: 28px;
    display: inline-grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 999px;
    color: #667085;
    background: #eef1f5;
    box-shadow: none;
    cursor: pointer;
}

.ai-message-speech :is(svg, i) { width: 14px; height: 14px; }
.ai-message-speech:is(:hover, :focus-visible) { color: #111827; background: #e4e8ee; }
.ai-message-speech.is-loading { opacity: .55; cursor: progress; }

/* One field surface across the application. Keep geometry owned by each
   component; this layer only normalizes the cool blue-grey fill. */
@media screen {
    body:not(.auth-screen) .main :is(
        input:not(.global-search-input):not(.invoice-exchange-rate-input):not(.invoice-discount-input):not(.product-gallery-metadata-input):not([data-package-manual-quantity]):not([data-package-line-discount]):not(#payment-amount):not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]):not([type="button"]):not([type="submit"]):not([type="reset"]):not(.gendox-table-search input),
        select,
        textarea,
        .choices__inner,
        .file-picker-control,
        .settings-upload-field,
        .settings-accent-field,
        .product-relation-picker
    ),
    body:not(.auth-screen) .main :is(
        input:not(.global-search-input):not(.invoice-exchange-rate-input):not(.invoice-discount-input):not(.product-gallery-metadata-input):not([data-package-manual-quantity]):not([data-package-line-discount]):not(#payment-amount):not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]):not([type="button"]):not([type="submit"]):not([type="reset"]):not(.gendox-table-search input),
        select,
        textarea,
        .choices__inner
    ):focus,
    body:not(.auth-screen) .main .ts-wrapper:is(.focus, .input-active, .dropdown-active) .ts-control,
    body:not(.auth-screen) .main :is(.file-picker-control, .settings-upload-field, .settings-accent-field, .product-relation-picker):focus-within {
        background-color: var(--gdx-field-surface) !important;
    }

    body:not(.auth-screen) .main .ts-wrapper .ts-control {
        background-color: var(--gdx-field-surface) !important;
    }

    /* Table search is one component, not a generic form field nested inside
       another field. Keep the shared pill as the only painted surface so the
       input can never split its colour or square off the trailing edge. */
    body:not(.auth-screen) .main :is(.gendox-table-search, label.gendox-table-search) {
        border-radius: 999px !important;
        background: var(--content-pill, #e7e9ee) !important;
        background-color: var(--content-pill, #e7e9ee) !important;
        overflow: hidden !important;
    }

    body:not(.auth-screen) .main :is(.gendox-table-search, label.gendox-table-search) > input[type="search"] {
        border: 0 !important;
        border-radius: inherit !important;
        background: transparent !important;
        background-color: transparent !important;
        box-shadow: none !important;
    }

    /* The page-size select is part of the surrounding rows-control pill. Its
       Tom Select control must not paint a second field surface inside it. */
    body:not(.auth-screen) .main .documents-rows-control .ts-wrapper .ts-control,
    body:not(.auth-screen) .main .documents-rows-control .ts-wrapper:is(.focus, .input-active, .dropdown-active) .ts-control {
        border-color: transparent !important;
        background: transparent !important;
        background-color: transparent !important;
        background-image: none !important;
        box-shadow: none !important;
    }
}
