:root {
    --app-bg: #eef1f4;
    --app-selection-background:
        radial-gradient(circle at 15% 20%, rgba(171, 214, 255, .72), transparent 28rem),
        radial-gradient(circle at 85% 75%, rgba(216, 190, 255, .62), transparent 30rem),
        linear-gradient(135deg, #f8fbff, #eef1f7 55%, #f9f6ff);
    --app-surface: #ffffff;
    --app-glass: rgba(255, 255, 255, .72);
    --app-glass-strong: rgba(255, 255, 255, .9);
    --app-border: rgba(17, 17, 17, .08);
    --app-shadow: 0 1rem 3rem rgba(40, 48, 58, .08);
    --app-text: #111111;
    --app-muted: #6b6b6b;
    --app-radius: 1rem;
    --app-accent-primary: #171717;
    --app-accent-success: #2f9e72;
    --app-accent-warning: #c98a24;
    --app-accent-danger: #c55463;
    --app-accent-info: #3a9aa6;
    --app-accent-neutral: #68727d;
    --app-accent-soft-primary: rgba(17, 17, 17, .08);
    --app-accent-soft-success: rgba(47, 158, 114, .12);
    --app-accent-soft-warning: rgba(201, 138, 36, .14);
    --app-accent-soft-danger: rgba(197, 84, 99, .12);
    --app-accent-soft-info: rgba(58, 154, 166, .12);
    --app-badge-primary-bg: #f4edff;
    --app-badge-primary-text: #6842c2;
    --app-badge-success-bg: #eefaf5;
    --app-badge-success-text: #087a52;
    --app-badge-warning-bg: #fff7e8;
    --app-badge-warning-text: #a85400;
    --app-badge-danger-bg: #fff1ee;
    --app-badge-danger-text: #b42318;
    --app-badge-info-bg: #eef8ff;
    --app-badge-info-text: #086b9c;
    --app-badge-neutral-bg: #f2f4f7;
    --app-badge-neutral-text: #344054;
}

@media print {
    .app-sidebar, .app-topbar, .d-print-none { display: none !important; }
    .app-shell { display: block; }
    .app-workspace, .app-main { display: block; width: 100%; }
    .print-label-page { padding: 0 !important; }
    .print-label { box-shadow: none !important; width: 90mm; }
}

body {
    min-height: 100vh;
    background:
        radial-gradient(circle at 10% 0%, rgba(255, 255, 255, .98) 0, rgba(255, 255, 255, 0) 34rem),
        radial-gradient(circle at 100% 0%, rgba(214, 222, 230, .72) 0, rgba(214, 222, 230, 0) 42rem),
        var(--app-bg);
    background-attachment: fixed;
    color: var(--app-text);
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--app-glass-strong) !important;
    backdrop-filter: blur(1.5rem) saturate(160%);
    -webkit-backdrop-filter: blur(1.5rem) saturate(160%);
}

.app-shell {
    display: grid;
    grid-template-columns: 16rem minmax(0, 1fr);
    min-height: 100vh;
}

.app-sidebar {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 1.5rem 1rem;
    overflow-y: auto;
    border-right: 1px solid rgba(255, 255, 255, .7);
    background: rgba(246, 248, 250, .7);
    box-shadow: .75rem 0 2.5rem rgba(40, 48, 58, .08);
    backdrop-filter: blur(1.75rem) saturate(170%);
    -webkit-backdrop-filter: blur(1.75rem) saturate(170%);
}

.app-sidebar .list-group {
    --bs-list-group-bg: transparent;
    --bs-list-group-color: #3f454d;
    --bs-list-group-border-width: 0;
    --bs-list-group-action-color: #3f454d;
    --bs-list-group-action-hover-color: #111111;
    --bs-list-group-action-hover-bg: rgba(255, 255, 255, .58);
    --bs-list-group-active-color: #111111;
    --bs-list-group-active-bg: rgba(255, 255, 255, .9);
    --bs-list-group-active-border-color: rgba(255, 255, 255, .9);
    gap: .25rem;
}

.app-sidebar .list-group-item {
    border-radius: .75rem;
    padding: .8rem 1rem;
    font-weight: 600;
    transition: color .15s ease, background-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

.app-sidebar [id$="-menu"] > .list-group-item {
    padding-left: 2.5rem !important;
    font-size: 1rem !important;
    font-weight: 600 !important;
}
.app-sidebar .list-group-item.ps-4[data-bs-toggle="collapse"] { padding-left: 1rem !important; }

.app-sidebar .list-group-item:hover,
.app-sidebar .list-group-item:focus-visible {
    transform: translateX(.125rem);
}

.app-sidebar .list-group-item.active {
    box-shadow: 0 .5rem 1.5rem rgba(40, 48, 58, .1);
}

.app-sidebar-footer {
    width: 100%;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--app-border);
}

.app-sidebar-copyright {
    margin-top: .75rem;
    color: var(--app-muted);
    font-size: .625rem;
    line-height: 1.35;
    text-align: center;
    opacity: .65;
}

.app-sidebar-profile {
    display: flex;
    align-items: center;
    gap: .55rem;
    min-width: 0;
    padding: .5rem .25rem;
    color: #65707c;
    border-radius: .65rem;
}

.app-sidebar-profile:hover,
.app-sidebar-profile:focus-visible {
    color: #252b33;
    background: rgba(255, 255, 255, .72);
}

.app-user-avatar {
    display: inline-flex;
    flex: 0 0 1.75rem;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    overflow: hidden;
    border-radius: 50%;
    background: rgba(255, 255, 255, .68);
}

.app-user-avatar img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.app-sidebar-profile-icon {
    flex-shrink: 0;
}

.app-sidebar-profile-name {
    min-width: 0;
    overflow: hidden;
    font-size: .875rem;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-sidebar-logout-form {
    margin-top: .5rem;
}

.app-sidebar-logout {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    width: 100%;
    min-height: 2.5rem;
    border-radius: .75rem;
}

.app-workspace {
    min-width: 0;
}

.app-sidebar-backdrop {
    display: none;
}

@media (min-width: 992px) {
    .app-shell.app-sidebar-collapsed {
        grid-template-columns: 4.75rem minmax(0, 1fr);
    }

    .app-sidebar-collapsed .app-sidebar {
        align-items: center;
        box-sizing: border-box;
        min-width: 0;
        padding-inline: 0;
        overflow-x: visible;
    }

    .app-sidebar-collapsed .app-sidebar > .d-flex:first-child,
    .app-sidebar-collapsed .app-sidebar-nav,
    .app-sidebar-collapsed .app-sidebar .list-group,
    .app-sidebar-collapsed .app-sidebar-footer {
        width: 100%;
    }

    .app-sidebar-collapsed .app-sidebar > .d-flex:first-child {
        justify-content: center !important;
    }

    .app-sidebar-collapsed .app-brand,
    .app-sidebar-collapsed .app-sidebar .eyebrow,
    .app-sidebar-collapsed .app-sidebar .collapse,
    .app-sidebar-collapsed .app-sidebar-footer .small {
        display: none;
    }

    .app-sidebar-collapsed .app-sidebar .collapse.app-sidebar-flyout-open,
    .app-sidebar-collapsed .app-sidebar .list-group-item[data-bs-toggle="collapse"]:focus + .collapse {
        display: block !important;
        position: fixed;
        z-index: 200;
        top: 1rem;
        left: 5rem;
        width: min(18rem, calc(100vw - 6rem));
        max-height: calc(100vh - 1rem);
        padding: .5rem;
        overflow-y: auto;
        box-sizing: border-box;
        border: 1px solid var(--app-border);
        border-radius: .75rem;
        background: var(--app-glass-strong);
        box-shadow: var(--app-shadow);
    }

    .app-sidebar-collapsed .app-sidebar .collapse.app-sidebar-flyout-open .list-group-item,
    .app-sidebar-collapsed .app-sidebar .list-group-item[data-bs-toggle="collapse"]:focus + .collapse .list-group-item {
        position: static;
        display: block;
        width: 100%;
        min-height: 0;
        padding: .7rem 1rem;
        font-size: .875rem;
        transform: none !important;
    }

    .app-sidebar-collapsed .app-sidebar .collapse.app-sidebar-flyout-open .list-group-item > span,
    .app-sidebar-collapsed .app-sidebar .list-group-item[data-bs-toggle="collapse"]:focus + .collapse .list-group-item > span {
        display: inline;
    }

    .app-sidebar-collapsed .app-sidebar .collapse.app-sidebar-flyout-open .list-group-item > i:first-child,
    .app-sidebar-collapsed .app-sidebar .collapse.app-sidebar-flyout-open .list-group-item > span > i:first-child,
    .app-sidebar-collapsed .app-sidebar .list-group-item[data-bs-toggle="collapse"]:focus + .collapse .list-group-item > i:first-child,
    .app-sidebar-collapsed .app-sidebar .list-group-item[data-bs-toggle="collapse"]:focus + .collapse .list-group-item > span > i:first-child {
        position: static;
        transform: none;
    }

    .app-sidebar-collapsed .app-sidebar .list-group-item,
    .app-sidebar-collapsed .app-sidebar-footer button {
        position: relative;
        width: 100%;
        padding-inline: 0;
        font-size: 0;
    }

    .app-sidebar-collapsed .app-sidebar-footer button {
        height: 3.25rem;
        min-height: 3.25rem;
    }

    .app-sidebar-collapsed .app-sidebar .list-group-item {
        min-height: 3.25rem;
    }

    .app-sidebar-collapsed .app-sidebar .list-group-item > span {
        display: contents;
    }

    .app-sidebar-collapsed .app-sidebar .list-group-item i,
    .app-sidebar-collapsed .app-sidebar-footer button i {
        margin: 0 !important;
        font-size: 1.35rem;
    }

    .app-sidebar-collapsed .app-sidebar .list-group-item > i:first-child,
    .app-sidebar-collapsed .app-sidebar .list-group-item > span > i:first-child,
    .app-sidebar-collapsed .app-sidebar-footer button > i:first-child {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
    }

    .app-sidebar-collapsed .app-sidebar .list-group-item .bx-chevron-down {
        display: none;
    }

    .app-sidebar-collapsed .app-sidebar-footer {
        border-top: 0;
        padding-top: 1rem;
    }

    .app-sidebar-collapsed .app-sidebar-profile {
        justify-content: center;
        width: 3.25rem;
        height: 3.25rem;
        margin: 0 auto;
        padding: 0;
    }

    .app-sidebar-collapsed .app-sidebar-profile-name {
        display: none;
    }

    .app-sidebar-collapsed .app-sidebar-logout-form {
        display: flex;
        justify-content: center;
    }

    .app-sidebar-collapsed .app-sidebar-logout {
        width: 3.25rem;
    }

    .app-sidebar-collapsed .app-sidebar-copyright {
        display: none;
    }
}

.app-topbar {
    position: sticky;
    top: 0;
    z-index: 90;
    background: var(--app-glass-strong);
    backdrop-filter: blur(1.5rem) saturate(160%);
    -webkit-backdrop-filter: blur(1.5rem) saturate(160%);
}

.app-main > .container-fluid {
    max-width: 100%;
}

.app-brand,
.eyebrow {
    font-weight: 700;
    letter-spacing: .08em;
}

.program-selection-brand {
    display: inline-flex;
    min-width: 0;
    align-items: center;
    gap: 1rem;
}

.program-selection-brand__logo-wrap {
    display: grid;
    flex: 0 0 auto;
    width: 4rem;
    height: 4rem;
    padding: .5rem;
    place-items: center;
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: var(--app-radius, .75rem);
    background: rgba(255, 255, 255, .72);
}

.program-selection-brand__logo {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}

.program-selection-brand__content {
    min-width: 0;
}

.program-selection-brand__name {
    overflow: hidden;
    max-width: min(36rem, 70vw);
    color: var(--app-muted);
    font-size: .875rem;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.eyebrow {
    color: var(--app-muted);
    font-size: .75rem;
}

.auth-page,
.selection-page {
    position: relative;
    min-height: 100vh;
    overflow-x: hidden;
    background: var(--app-selection-background);
}

.auth-page { display: grid; }
.selection-page { display: block; }

.auth-page::before,
.auth-page::after,
.selection-page::before,
.selection-page::after {
    position: fixed;
    width: 16rem;
    height: 16rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, .42);
    content: "";
    filter: blur(.25rem);
    pointer-events: none;
}

.auth-page::before,
.selection-page::before { top: -5rem; right: 8%; }
.auth-page::after,
.selection-page::after { bottom: -7rem; left: 6%; }

.auth-shell {
    position: relative;
    z-index: 1;
    display: flex;
    min-height: 100vh;
    align-items: center;
    justify-content: center;
    padding-block: 2rem;
}

.auth-card {
    width: min(100%, 60rem);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .78) !important;
    border-radius: 1.5rem;
    background: linear-gradient(135deg, rgba(255, 255, 255, .3), rgba(255, 255, 255, .1));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .9), 0 2rem 5rem rgba(47, 55, 75, .16);
    backdrop-filter: blur(1.75rem) saturate(180%);
    -webkit-backdrop-filter: blur(1.75rem) saturate(180%);
}

.auth-intro {
    display: flex;
    min-height: 34rem;
    flex-direction: column;
    border-right: 1px solid rgba(255, 255, 255, .72);
    background: rgba(255, 255, 255, .08);
}

.auth-brand-mark {
    display: grid;
    width: 3.25rem;
    height: 3.25rem;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, .9);
    border-radius: 1rem;
    background: rgba(255, 255, 255, .64);
    box-shadow: 0 .75rem 2rem rgba(47, 55, 75, .1);
    font-size: 1.5rem;
}

.auth-intro-status {
    display: flex;
    align-items: center;
    gap: .55rem;
    color: var(--app-muted);
    font-size: .875rem;
}

.auth-status-dot {
    width: .55rem;
    height: .55rem;
    border-radius: 50%;
    background: var(--app-accent-success);
    box-shadow: 0 0 0 .25rem var(--app-accent-soft-success);
}

.auth-input-wrap {
    position: relative;
}

.auth-input-wrap > i {
    position: absolute;
    z-index: 2;
    top: 50%;
    left: 1rem;
    color: var(--app-muted);
    font-size: 1.15rem;
    transform: translateY(-50%);
    pointer-events: none;
}

.auth-input-wrap .form-control {
    min-height: 3.25rem;
    padding-left: 3rem;
    border-color: rgba(255, 255, 255, .86);
    border-radius: .9rem;
    background: rgba(255, 255, 255, .62);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .72);
}

.auth-input-wrap .form-control:focus {
    border-color: rgba(17, 17, 17, .28);
    background: rgba(255, 255, 255, .86);
    box-shadow: 0 0 0 .2rem rgba(17, 17, 17, .08);
}

.auth-input-wrap + .invalid-feedback:not(:empty) { display: block; }
.auth-vendor-logo {
    display: block;
    width: 7.5rem;
    height: auto;
    margin-bottom: 1.25rem;
}
.auth-submit { min-height: 3.25rem; border-radius: .9rem; }
.auth-security-note { font-size: .8rem; }
.auth-copyright {
    color: var(--app-muted);
    font-size: .7rem;
    opacity: .65;
}
.auth-copyright-logo { width: 2.5rem; height: auto; vertical-align: middle; }

.selection-page main,
.selection-shell {
    position: relative;
    z-index: 1;
}

.selection-heading,
.context-card--glass {
    border: 1px solid rgba(255, 255, 255, .78) !important;
    border-radius: 1.5rem;
    background: linear-gradient(135deg, rgba(255, 255, 255, .28), rgba(255, 255, 255, .1));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .9), 0 1.5rem 4rem rgba(47, 55, 75, .14);
    backdrop-filter: blur(1.5rem) saturate(180%);
    -webkit-backdrop-filter: blur(1.5rem) saturate(180%);
}

.selection-heading__content { min-width: 0; }
.selection-vendor-logo { flex: 0 0 auto; width: clamp(5rem, 12vw, 7.5rem); height: auto; }

.selection-icon {
    display: grid;
    width: 3.25rem;
    height: 3.25rem;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, .9);
    border-radius: 1rem;
    background: rgba(255, 255, 255, .64);
    box-shadow: 0 .75rem 2rem rgba(47, 55, 75, .1);
    font-size: 1.5rem;
}

.context-card {
    width: min(100%, 30rem);
    border-radius: var(--app-radius);
}

.context-card--glass .select2-selection--single {
    background: rgba(255, 255, 255, .5);
}

@media (max-width: 991.98px) {
    .auth-intro { min-height: auto; border-right: 0; border-bottom: 1px solid rgba(255, 255, 255, .72); }
    .auth-intro .display-6 br, .auth-intro-status { display: none; }
}

.program-card {
    min-height: 13rem;
    padding: 1.5rem;
    border-radius: var(--app-radius);
    border: 1px solid rgba(255, 255, 255, .72);
    background: linear-gradient(135deg, rgba(255, 255, 255, .24), rgba(255, 255, 255, .08));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .88), 0 1.25rem 3rem rgba(47, 55, 75, .12);
    backdrop-filter: blur(1.25rem) saturate(180%);
    -webkit-backdrop-filter: blur(1.25rem) saturate(180%);
    color: var(--app-text);
    transition: transform .15s ease, box-shadow .15s ease;
}

.program-card:hover,
.program-card:focus-visible {
    transform: translateY(-3px);
    box-shadow: 0 1.75rem 3.5rem rgba(47, 55, 75, .16);
}

.program-code {
    display: grid;
    width: 3rem;
    height: 3rem;
    place-items: center;
    border: 1px solid #dedede;
    border-radius: .75rem;
    font-weight: 700;
}

.program-code i { font-size: 1.5rem; }

.workflow-map {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.workflow-canvas {
    padding: 2rem 1rem;
    border: 1px solid rgba(255, 255, 255, .72);
    border-radius: var(--app-radius);
    background-color: rgba(255, 255, 255, .28);
    background-image: radial-gradient(rgba(75, 82, 92, .16) .8px, transparent .8px);
    background-size: 18px 18px;
}

.workflow-lane {
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
}

.workflow-step {
    position: relative;
    width: min(100%, 34rem);
    margin-inline: auto;
}

.workflow-node {
    position: relative;
    min-height: 4.5rem;
    padding: .75rem !important;
    border-radius: .75rem;
    border: 1px solid rgba(255, 255, 255, .8);
    border-radius: var(--app-radius);
    background: rgba(255, 255, 255, .58);
    box-shadow: 0 .5rem 1.5rem rgba(32, 35, 42, .06);
    transition: transform .15s ease, box-shadow .15s ease;
}

.workflow-node .flex-grow-1 {
    min-width: 0;
}

.workflow-node:hover,
.workflow-node:focus-within {
    transform: translateY(-2px);
    box-shadow: 0 .75rem 1.75rem rgba(32, 35, 42, .1);
}

.workflow-step-number {
    display: inline-flex;
    flex: 0 0 2rem;
    width: 2rem;
    height: 2rem;
    min-width: 2rem;
    min-height: 2rem;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1 / 1;
    border-radius: 50% !important;
    background: var(--app-text);
    color: #fff;
    line-height: 1;
}

@media (min-width: 768px) {
    .workflow-step:not(:last-child)::after {
        position: absolute;
        bottom: -1.75rem;
        left: 50%;
        height: 1.75rem;
        border-left: 2px dashed rgba(110, 118, 129, .4);
        content: '';
    }
}

.workflow-step:not(:last-child)::before {
    position: absolute;
    z-index: 1;
    bottom: -.45rem;
    left: calc(50% - .4rem);
    width: .8rem;
    height: .8rem;
    border: 1px solid rgba(255, 255, 255, .9);
    border-radius: 50%;
    background: var(--app-text);
    box-shadow: 0 0 0 .25rem rgba(255, 255, 255, .55);
    content: '';
}

.workflow-node-action {
    display: inline-flex;
    flex: 0 0 2rem;
    width: 2rem;
    height: 2rem;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(13, 110, 253, .12);
    color: #0d6efd;
    text-decoration: none;
    transition: background-color .15s ease, transform .15s ease;
}

.workflow-node-action:hover,
.workflow-node-action:focus-visible {
    color: #0b5ed7;
    background: rgba(13, 110, 253, .2);
    transform: translateY(-1px);
    outline: 0;
}

.workflow-recovery-action {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    min-height: 2rem;
    padding: .25rem .625rem;
    border: 1px solid rgba(142, 96, 0, .35);
    border-radius: var(--app-radius);
    color: #865c00;
    font-size: .8125rem;
    font-weight: 600;
    text-decoration: none;
}

.workflow-recovery-action:hover,
.workflow-recovery-action:focus-visible {
    color: #6b4900;
    background: rgba(255, 193, 7, .12);
    outline: 0;
}

.workflow-node .btn {
    display: none;
}

.purchasing-process-scroll {
    overflow-x: auto;
    padding: .25rem .25rem 1rem;
}

.purchasing-mermaid-wrap {
    min-height: 22rem;
    overflow-x: auto;
    padding: 1rem;
    border: 1px solid rgba(17, 17, 17, .12);
    border-radius: .8rem;
    background:
        radial-gradient(circle at 12% 18%, rgba(17, 17, 17, .05), transparent 30%),
        radial-gradient(circle at 88% 82%, rgba(58, 154, 166, .08), transparent 28%),
        rgba(255, 255, 255, .52);
}

.purchasing-mermaid {
    min-width: 72rem;
    margin: 0;
    background: transparent;
    color: var(--app-text);
    font-family: 'Noto Sans Thai', 'Apple SD Gothic Neo', sans-serif;
    white-space: pre;
}

.purchasing-mermaid svg {
    max-width: none;
    min-height: 20rem;
}

.purchasing-mermaid .node rect,
.purchasing-mermaid .node polygon,
.purchasing-mermaid .node path {
    stroke-linejoin: round;
}

.purchasing-mermaid .edgePath .path {
    stroke-width: 1.5px;
}

.purchasing-mermaid .edgeLabel rect {
    fill: var(--app-surface);
    opacity: .94;
}

.module-process-diagram {
    min-height: 22rem;
    overflow-x: auto;
    padding: 1rem;
    border: 1px solid rgba(17, 17, 17, .12);
    border-radius: .8rem;
    background:
        radial-gradient(circle at 12% 18%, rgba(17, 17, 17, .05), transparent 30%),
        radial-gradient(circle at 88% 82%, rgba(58, 154, 166, .08), transparent 28%),
        rgba(255, 255, 255, .52);
}

.module-process-mermaid {
    min-width: 72rem;
    margin: 0;
    background: transparent;
    color: var(--app-text);
    font-family: 'Noto Sans Thai', 'Apple SD Gothic Neo', sans-serif;
    white-space: pre;
}

.module-process-mermaid svg {
    max-width: none;
    min-height: 20rem;
}

.module-process-mermaid .node rect,
.module-process-mermaid .node polygon,
.module-process-mermaid .node path {
    stroke-linejoin: round;
}

.module-process-mermaid .edgePath .path {
    stroke-width: 1.5px;
}

.module-process-mermaid .edgeLabel rect {
    fill: var(--app-surface);
    opacity: .94;
}

.module-process-note {
    height: 100%;
    padding: 1rem;
    border: 1px solid rgba(45, 49, 66, .12);
    border-radius: .6rem;
    background: rgba(255, 255, 255, .6);
}

.module-process-note i {
    color: #6478c8;
    font-size: 1.1rem;
}

@media (max-width: 767.98px) {
    .module-process-mermaid {
        min-width: 64rem;
    }
}

.purchasing-process-track {
    display: flex;
    min-width: 1280px;
    align-items: stretch;
    gap: 1.25rem;
}

.purchasing-process-stage {
    position: relative;
    flex: 1 1 0;
    min-width: 8.75rem;
}

.purchasing-process-stage:not(:last-child)::after {
    position: absolute;
    top: 5.8rem;
    right: -1rem;
    content: '→';
    color: var(--app-muted);
    font-size: 1.35rem;
    font-weight: 600;
}

.purchasing-process-stage-head {
    display: flex;
    align-items: center;
    gap: .5rem;
    min-height: 2rem;
    margin-bottom: .75rem;
}

.purchasing-process-number {
    display: inline-grid;
    width: 1.75rem;
    height: 1.75rem;
    place-items: center;
    border-radius: 50%;
    background: rgba(45, 49, 66, .1);
    color: var(--app-text);
    font-size: .72rem;
    font-weight: 700;
}

.purchasing-process-owner {
    color: var(--app-muted);
    font-size: .75rem;
    font-weight: 600;
}

.purchasing-process-node {
    min-height: 13rem;
    padding: 1rem;
    border: 1px solid rgba(45, 49, 66, .15);
    border-radius: .5rem;
    background: rgba(255, 255, 255, .72);
}

.purchasing-process-node p {
    color: var(--app-muted);
    font-size: .82rem;
}

.purchasing-process-io {
    display: grid;
    gap: .5rem;
    color: var(--app-text);
    font-size: .74rem;
}

.purchasing-process-io > span {
    display: grid;
    gap: .1rem;
}

.purchasing-process-io small {
    color: var(--app-muted);
    font-size: .66rem;
    text-transform: uppercase;
}

.purchasing-process-io i {
    color: var(--app-muted);
}

.purchasing-process-stage.is-focal .purchasing-process-number {
    background: var(--app-text);
    color: #fff;
}

.purchasing-process-stage.is-focal .purchasing-process-node {
    border-color: var(--app-text);
    background: rgba(45, 49, 66, .05);
}

.purchasing-process-branch {
    height: 100%;
    padding: 1rem;
    border: 1px solid rgba(45, 49, 66, .12);
    border-radius: .5rem;
    background: rgba(255, 255, 255, .45);
}

.purchasing-process-branch i {
    color: var(--app-text);
    font-size: 1.1rem;
}

.purchasing-process-branch.is-service {
    border-style: dashed;
}

@media (max-width: 767.98px) {
    .purchasing-process-track {
        min-width: 1120px;
    }
}

.card,
.btn,
.form-control,
.form-select,
.alert {
    border-radius: var(--app-radius);
}

.card {
    border: 1px solid rgba(255, 255, 255, .72) !important;
    background: var(--app-glass);
    backdrop-filter: blur(1.25rem) saturate(150%);
    -webkit-backdrop-filter: blur(1.25rem) saturate(150%);
}

/* Journal lines are intentionally wider than the viewport: keep each value
 * readable and let the existing table-responsive wrapper scroll on small screens. */
.journal-lines-table {
    min-width: 1450px;
    table-layout: auto;
}

.journal-lines-table th,
.journal-lines-table td {
    white-space: nowrap;
}

.journal-lines-table .journal-line-account { min-width: 250px; }
.journal-lines-table .select2-container { min-width: 250px; }
.journal-lines-table .journal-line-description { min-width: 190px; }
.journal-lines-table .journal-line-amount { min-width: 110px; }
.journal-lines-table .journal-line-tax-code { min-width: 150px; }
.journal-lines-table .journal-line-tax-number { min-width: 105px; }
.journal-lines-table .journal-line-date { min-width: 150px; }

/* Sales intake keeps the item selector readable; smaller screens scroll the
 * existing responsive wrapper instead of shrinking commercial inputs. */
.sales-intake-lines-table {
    min-width: 1530px;
    table-layout: auto;
}

.sales-intake-lines-table .sales-intake-item-cell {
    width: 420px;
    min-width: 420px;
}

.sales-intake-lines-table .select2-container { min-width: 0; }

@media (max-width: 767.98px) {
    .journal-lines-table { min-width: 1320px; }
    .journal-lines-table .journal-line-account { min-width: 220px; }
    .journal-lines-table .journal-line-description { min-width: 160px; }
}

/* Dense document forms keep business values readable. Their existing
 * table-responsive wrappers provide the intentional horizontal scroll. */
form:has(#purchase-lines) .table-responsive > table,
form:has(#line-rows) .table-responsive > table {
    min-width: 1420px;
    table-layout: auto;
}

/* Transfer lines are intentionally compact but must remain readable on mobile. */
form:has(#transfer-lines) .transfer-lines-table { min-width: 760px; }
form:has(#transfer-lines) .transfer-lines-table th,
form:has(#transfer-lines) .transfer-lines-table td { white-space: nowrap; }
form:has(#transfer-lines) .transfer-lines-table th:nth-child(1),
form:has(#transfer-lines) .transfer-lines-table td:nth-child(1) { min-width: 240px; }
form:has(#transfer-lines) .transfer-lines-table th:nth-child(2),
form:has(#transfer-lines) .transfer-lines-table td:nth-child(2) { min-width: 180px; }
form:has(#transfer-lines) .transfer-lines-table th:nth-child(3),
form:has(#transfer-lines) .transfer-lines-table td:nth-child(3),
form:has(#transfer-lines) .transfer-lines-table th:nth-child(4),
form:has(#transfer-lines) .transfer-lines-table td:nth-child(4) { min-width: 145px; }
form:has(#transfer-lines) .transfer-lines-table .select2-container { min-width: 100%; }

form:has(#receipt-purchase) .receipt-lines-table,
#purchase-receipts-table { min-width: 760px; }

form:has(#purchase-lines) .table-responsive th,
form:has(#purchase-lines) .table-responsive td,
form:has(#line-rows) .table-responsive th,
form:has(#line-rows) .table-responsive td,
form:has(#allocation-rows) .table-responsive th,
form:has(#allocation-rows) .table-responsive td {
    white-space: nowrap;
}

form:has(#purchase-lines) .table-responsive th:nth-child(1),
form:has(#purchase-lines) .table-responsive td:nth-child(1),
form:has(#line-rows) .table-responsive th:nth-child(1),
form:has(#line-rows) .table-responsive td:nth-child(1) { min-width: 220px; }

form:has(#purchase-lines) .table-responsive th:nth-child(2),
form:has(#purchase-lines) .table-responsive td:nth-child(2),
form:has(#purchase-lines) .table-responsive th:nth-child(4),
form:has(#purchase-lines) .table-responsive td:nth-child(4),
form:has(#line-rows) .table-responsive th:nth-child(6),
form:has(#line-rows) .table-responsive td:nth-child(6) { min-width: 210px; }

form:has(#purchase-lines) .table-responsive th:nth-child(3),
form:has(#purchase-lines) .table-responsive td:nth-child(3),
form:has(#purchase-lines) .table-responsive th:nth-child(5),
form:has(#purchase-lines) .table-responsive td:nth-child(5),
form:has(#line-rows) .table-responsive th:nth-child(7),
form:has(#line-rows) .table-responsive td:nth-child(7) { min-width: 150px; }

/* Purchase invoice values must never collapse to unreadable controls after
 * the PO/GR linkage column is inserted dynamically. */
form:has(#purchase-lines) .table-responsive th:nth-child(6),
form:has(#purchase-lines) .table-responsive td:nth-child(6) { min-width: 150px; }
form:has(#purchase-lines) .table-responsive th:nth-child(7),
form:has(#purchase-lines) .table-responsive td:nth-child(7) { min-width: 130px; }
form:has(#purchase-lines) .table-responsive th:nth-child(8),
form:has(#purchase-lines) .table-responsive td:nth-child(8) { min-width: 150px; }
form:has(#purchase-lines) .table-responsive th:nth-child(9),
form:has(#purchase-lines) .table-responsive td:nth-child(9) { min-width: 130px; }
form:has(#purchase-lines) .table-responsive th:nth-child(10),
form:has(#purchase-lines) .table-responsive td:nth-child(10) { min-width: 120px; }
form:has(#purchase-lines) .table-responsive .form-control,
form:has(#purchase-lines) .table-responsive .select2-container { width: 100%; }

/* Compact purchasing document rows group related values vertically. */
form:has(#purchase-lines) .purchase-lines-compact { min-width: 1080px !important; }
form:has(#purchase-lines) .purchase-lines-compact th:nth-child(1),
form:has(#purchase-lines) .purchase-lines-compact td:nth-child(1) { min-width: 230px; }
form:has(#purchase-lines) .purchase-lines-compact th:nth-child(2),
form:has(#purchase-lines) .purchase-lines-compact td:nth-child(2) { min-width: 145px; }
form:has(#purchase-lines) .purchase-lines-compact th:nth-child(3),
form:has(#purchase-lines) .purchase-lines-compact td:nth-child(3) { min-width: 220px; }
form:has(#purchase-lines) .purchase-lines-compact th:nth-child(4),
form:has(#purchase-lines) .purchase-lines-compact td:nth-child(4) { min-width: 220px; }
form:has(#purchase-lines) .purchase-lines-compact th:nth-child(5),
form:has(#purchase-lines) .purchase-lines-compact td:nth-child(5) { min-width: 160px; }
form:has(#purchase-lines) .purchase-lines-compact th:nth-child(6),
form:has(#purchase-lines) .purchase-lines-compact td:nth-child(6) { min-width: 110px; }
form:has(#purchase-lines) .purchase-lines-compact th:nth-child(7),
form:has(#purchase-lines) .purchase-lines-compact td:nth-child(7) { min-width: 80px; }
form:has(#purchase-lines) .purchase-lines-compact td { vertical-align: top; }
form:has(#purchase-lines) .purchase-lines-compact td > .form-control,
form:has(#purchase-lines) .purchase-lines-compact td > .form-select,
form:has(#purchase-lines) .purchase-lines-compact td > .select2-container,
form:has(#purchase-lines) .purchase-lines-compact td .js-receipt-allocation-row { margin-bottom: .35rem; }
form:has(#purchase-lines) .purchase-lines-compact td > :last-child { margin-bottom: 0; }

/* Credit Purchase uses a card editor rather than a dense spreadsheet. The
 * fields remain normal named inputs, so validation and server contracts stay
 * unchanged while each line is readable on desktop and mobile. */
form:has(#purchase-lines) .purchase-lines-compact { display: block; width: 100%; min-width: 0 !important; }
form:has(#purchase-lines) .purchase-lines-compact thead { display: none; }
form:has(#purchase-lines) .purchase-lines-compact tbody { display: block; }
form:has(#purchase-lines) .purchase-lines-compact tr.purchase-line {
    display: grid;
    grid-template-columns: minmax(250px, 1.7fr) minmax(150px, .9fr) minmax(230px, 1.45fr) minmax(220px, 1.3fr) minmax(170px, 1fr) 92px 48px;
    gap: .75rem;
    align-items: start;
    margin-bottom: 1rem;
    padding: 1rem;
    border: 1px solid var(--app-border, #e6e9ef);
    border-radius: 1rem;
    background: rgba(255, 255, 255, .72);
    box-shadow: 0 .25rem .75rem rgba(35, 42, 52, .05);
}
form:has(#purchase-lines) .purchase-lines-compact tr.purchase-line > td {
    display: block;
    width: auto;
    min-width: 0 !important;
    padding: .35rem 0;
    border: 0;
    text-align: start !important;
    white-space: normal;
}
form:has(#purchase-lines) .purchase-lines-compact tr.purchase-line > td::before {
    display: block;
    margin-bottom: .3rem;
    color: var(--bs-secondary-color, #6c757d);
    font-size: .78rem;
    font-weight: 600;
}
form:has(#purchase-lines) .purchase-lines-compact tr.purchase-line > td:nth-child(1)::before { content: 'สินค้า / รายละเอียด'; }
form:has(#purchase-lines) .purchase-lines-compact tr.purchase-line > td:nth-child(2)::before { content: 'จำนวน / หน่วย'; }
form:has(#purchase-lines) .purchase-lines-compact tr.purchase-line > td:nth-child(3)::before { content: 'PO / Goods Receipt ที่อ้างอิง'; }
form:has(#purchase-lines) .purchase-lines-compact tr.purchase-line > td:nth-child(4)::before { content: 'บัญชี / ภาษี'; }
form:has(#purchase-lines) .purchase-lines-compact tr.purchase-line > td:nth-child(5)::before { content: 'ราคา / ส่วนลด'; }
form:has(#purchase-lines) .purchase-lines-compact tr.purchase-line > td:nth-child(6)::before { content: 'รวมรายการ'; }
form:has(#purchase-lines) .purchase-lines-compact tr.purchase-line > td:nth-child(7)::before { content: 'จัดการ'; }
form:has(#purchase-lines) .purchase-lines-compact tr.purchase-line > td:nth-child(6) { font-size: 1.1rem; font-weight: 700; text-align: end !important; }
form:has(#purchase-lines) .purchase-lines-compact tr.purchase-line > td:nth-child(7) { text-align: end !important; }
form:has(#purchase-lines) .purchase-lines-compact .js-purchase-linkage-slot:empty::after {
    content: 'ไม่ผูก PO / GR (ค่าใช้จ่ายหรือบริการ)';
    display: block;
    padding: .65rem .75rem;
    border: 1px dashed var(--app-border, #dfe4ec);
    border-radius: .65rem;
    color: var(--bs-secondary-color, #6c757d);
    background: rgba(248, 249, 251, .8);
    font-size: .9rem;
}
form:has(#purchase-lines) .purchase-lines-compact .js-purchase-linkage,
form:has(#purchase-lines) .purchase-lines-compact .js-purchase-linkage .select2-container { width: 100% !important; }
form:has(#purchase-lines) .purchase-lines-compact .js-purchase-linkage .js-receipt-allocation-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(130px, .55fr);
    gap: .35rem;
    align-items: start;
}
form:has(#purchase-lines) .purchase-lines-compact .js-purchase-linkage .js-receipt-allocation-row .mt-1 { margin-top: 0 !important; }

/* Inventory lines inherit their GL account and PO/GR identity from source
 * documents. Keep those values visible for audit, but make them read-only. */
form.purchase-mode-inventory:has(#purchase-lines) .purchase-lines-compact .js-purchase-linkage .select2-container,
form.purchase-mode-inventory:has(#purchase-lines) .purchase-lines-compact td:nth-child(4) .js-purchase-account + .select2-container {
    pointer-events: none;
    opacity: .78;
}
form.purchase-mode-inventory:has(#purchase-lines) .purchase-lines-compact .js-add-receipt-allocation { display: none; }
form.purchase-mode-inventory:has(#purchase-lines) .purchase-lines-compact .js-purchase-source-text,
form.purchase-mode-inventory:has(#purchase-lines) .purchase-lines-compact .js-inventory-account-tax { display: block; }
form.purchase-mode-inventory:has(#purchase-lines) .purchase-lines-compact .js-purchase-receipt-qty { display: none; }

@media (max-width: 1199.98px) and (min-width: 768px) {
    form:has(#purchase-lines) .purchase-lines-compact tr.purchase-line {
        grid-template-columns: minmax(220px, 1.45fr) minmax(140px, .85fr) minmax(210px, 1.35fr) minmax(200px, 1.2fr) minmax(160px, 1fr) 82px 44px;
        gap: .55rem;
        padding: .8rem;
    }
}

@media (max-width: 767.98px) {
    form:has(#purchase-lines) .purchase-lines-compact tr.purchase-line {
        display: block;
    }
    form:has(#purchase-lines) .purchase-lines-compact tr.purchase-line > td {
        width: 100%;
    }
}

form:has(#allocation-rows) .table-responsive > table { min-width: 760px; }
form:has(#allocation-rows) .table-responsive th:first-child,
form:has(#allocation-rows) .table-responsive td:first-child { min-width: 500px; }
form:has(#allocation-rows) .table-responsive th:nth-child(2),
form:has(#allocation-rows) .table-responsive td:nth-child(2) { min-width: 170px; }

@media (max-width: 767.98px) {
    form:has(#purchase-lines) .table-responsive > table,
    form:has(#line-rows) .table-responsive > table { min-width: 1280px; }
    form:has(#allocation-rows) .table-responsive > table { min-width: 680px; }
    form:has(#allocation-rows) .table-responsive th:first-child,
    form:has(#allocation-rows) .table-responsive td:first-child { min-width: 420px; }
}

/* Shared semantic accents: restrained color for status and secondary actions. */
.app-status-primary,
.app-status-success,
.app-status-warning,
.app-status-danger,
.app-status-info,
.app-status-neutral,
.app-status-secondary {
    border: 0;
    font-weight: 600;
}

.app-status-primary { color: var(--app-badge-primary-text); background: var(--app-badge-primary-bg); }
.app-status-success { color: var(--app-badge-success-text); background: var(--app-badge-success-bg); }
.app-status-warning { color: var(--app-badge-warning-text); background: var(--app-badge-warning-bg); }
.app-status-danger { color: var(--app-badge-danger-text); background: var(--app-badge-danger-bg); }
.app-status-info { color: var(--app-badge-info-text); background: var(--app-badge-info-bg); }
.app-status-neutral,
.app-status-secondary { color: var(--app-badge-neutral-text); background: var(--app-badge-neutral-bg); }

/* Bootstrap text-bg names remain backward-compatible, but always render through
   the same pastel semantic tokens as app-status-* classes. */
.badge.text-bg-primary, .badge.text-bg-dark { color: var(--app-badge-primary-text) !important; background: var(--app-badge-primary-bg) !important; }
.badge.text-bg-success { color: var(--app-badge-success-text) !important; background: var(--app-badge-success-bg) !important; }
.badge.text-bg-warning { color: var(--app-badge-warning-text) !important; background: var(--app-badge-warning-bg) !important; }
.badge.text-bg-danger { color: var(--app-badge-danger-text) !important; background: var(--app-badge-danger-bg) !important; }
.badge.text-bg-info { color: var(--app-badge-info-text) !important; background: var(--app-badge-info-bg) !important; }
.badge.text-bg-secondary { color: var(--app-badge-neutral-text) !important; background: var(--app-badge-neutral-bg) !important; }
.badge.app-badge-soft { color: var(--app-badge-neutral-text) !important; background: var(--app-badge-neutral-bg) !important; }
.badge.app-badge-success { color: var(--app-badge-success-text) !important; background: var(--app-badge-success-bg) !important; }
.badge.app-badge-warning { color: var(--app-badge-warning-text) !important; background: var(--app-badge-warning-bg) !important; }
.badge.app-badge-info { color: var(--app-badge-info-text) !important; background: var(--app-badge-info-bg) !important; }
.badge.app-badge-danger { color: var(--app-badge-danger-text) !important; background: var(--app-badge-danger-bg) !important; }
.badge.app-badge-secondary { color: var(--app-badge-neutral-text) !important; background: var(--app-badge-neutral-bg) !important; }
/* Bootstrap subtle badge names in legacy/module views share the same pastel
   semantic palette as the newer app-status-* classes. */
.badge.bg-success-subtle { color: var(--app-badge-success-text) !important; background: var(--app-badge-success-bg) !important; }
.badge.bg-warning-subtle { color: var(--app-badge-warning-text) !important; background: var(--app-badge-warning-bg) !important; }
.badge.bg-danger-subtle { color: var(--app-badge-danger-text) !important; background: var(--app-badge-danger-bg) !important; }
.badge.bg-info-subtle { color: var(--app-badge-info-text) !important; background: var(--app-badge-info-bg) !important; }
.badge.bg-secondary-subtle, .badge.bg-dark-subtle { color: var(--app-badge-neutral-text) !important; background: var(--app-badge-neutral-bg) !important; }
.badge.bg-primary-subtle { color: var(--app-badge-primary-text) !important; background: var(--app-badge-primary-bg) !important; }

.shop-floor-material-list { max-height: 420px; overflow-y: auto; }
.app-cover-thumb { width: 72px; height: 72px; overflow: hidden; }
.app-cover-thumb img { object-fit: cover; }
.app-cover-thumb-sm { width: 40px; height: 40px; }
.planning-timeline-track { position: relative; height: 14px; border-radius: 999px; background: var(--bs-light); overflow: hidden; }
.planning-timeline-bar { position: absolute; top: 0; height: 100%; border-radius: 999px; }
.planning-timeline-bar.app-status-neutral { background: var(--bs-secondary); }
.planning-timeline-bar.app-status-info { background: var(--bs-info); }
.planning-timeline-bar.app-status-warning { background: var(--bs-warning); }
.planning-timeline-bar.app-status-success { background: var(--bs-success); }
.planning-timeline-bar.app-status-danger { background: var(--bs-danger); }
@media (max-width: 767.98px) {
    #planning-responsible + .select2, #planning-product + .select2 { width: 100% !important; }
    #planning-overdue, #planning-shortage { width: 1.25rem; height: 1.25rem; }
}
.shop-floor-material-list thead th { position: sticky; top: 0; z-index: 1; background: var(--app-surface, #fff); }

.btn-app-primary { color: #fff; background: var(--app-accent-primary); border-color: var(--app-accent-primary); }
.btn-app-success { color: var(--app-badge-success-text); background: var(--app-badge-success-bg); border-color: transparent; }
.btn-app-info { color: var(--app-badge-info-text); background: var(--app-badge-info-bg); border-color: transparent; }
.btn-app-warning { color: var(--app-badge-warning-text); background: var(--app-badge-warning-bg); border-color: transparent; }
.btn-app-success:hover, .btn-app-success:focus-visible,
.btn-app-info:hover, .btn-app-info:focus-visible,
.btn-app-warning:hover, .btn-app-warning:focus-visible { filter: brightness(.96); }
.btn-app-primary:hover,
.btn-app-primary:focus-visible { color: #fff; background: #000; border-color: #000; }
.btn-app-soft { color: #343a40; background: var(--app-accent-soft-primary); border-color: transparent; }
.dt-export-excel { color: var(--app-badge-primary-text) !important; background: var(--app-badge-primary-bg) !important; border-color: transparent !important; }
.dt-export-excel:hover, .dt-export-excel:focus { color: var(--app-badge-primary-text) !important; background: #d1d5db !important; border-color: transparent !important; }
.btn-app-soft:hover,
.btn-app-soft:focus-visible { color: #171717; background: rgba(17, 17, 17, .14); }
.btn-app-danger { color: #963d4a; background: var(--app-accent-soft-danger); border-color: transparent; }
.btn-app-danger:hover,
.btn-app-danger:focus-visible { color: #7f2634; background: rgba(220, 53, 69, .2); border-color: transparent; }

/* Shared DataTable surface: dense back-office tables stay usable on small screens. */
.dataTables_wrapper {
    width: 100%;
}

.app-sidebar-brand img { display: block; width: clamp(6rem, 9vw, 8rem); height: auto; }
.app-header-brand img { display: block; width: clamp(4.5rem, 8vw, 7rem); height: auto; }

.app-header-profile {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
}

.dataTables_wrapper .dt-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-bottom: .75rem;
}

.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_length {
    margin-bottom: .75rem;
}

.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
    min-height: calc(1.5em + .75rem + 2px);
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: .75rem;
    background: rgba(255, 255, 255, .78);
}

.dataTables_wrapper .dataTables_filter input {
    margin-left: .5rem;
    padding: .375rem .75rem;
}

.dataTables_wrapper .dataTables_length select {
    margin: 0 .35rem;
    padding: .25rem 2rem .25rem .65rem;
}

.dataTables_wrapper .dataTables_filter input:focus,
.dataTables_wrapper .dataTables_length select:focus {
    border-color: rgba(17, 17, 17, .55);
    box-shadow: 0 0 0 .25rem rgba(17, 17, 17, .12);
    outline: 0;
}

.dataTables_wrapper .dataTables_processing {
    z-index: 3;
    border: 1px solid rgba(17, 17, 17, .18);
    border-radius: .75rem;
    color: var(--app-text);
    background: rgba(255, 255, 255, .9);
    box-shadow: var(--app-shadow);
}

.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
    margin-top: .75rem;
}

.dataTables_wrapper .table {
    margin-bottom: 0;
    white-space: nowrap;
}

.dataTables_wrapper .table thead th {
    color: #4f5963;
    font-size: .82rem;
    font-weight: 700;
    letter-spacing: .01em;
    background: rgba(246, 248, 250, .72);
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    border-radius: .65rem !important;
}

@media (max-width: 575.98px) {
    .dataTables_wrapper .dataTables_filter,
    .dataTables_wrapper .dataTables_length {
        float: none;
        width: 100%;
        text-align: left;
    }

    .dataTables_wrapper .dataTables_filter input {
        width: min(100%, 18rem);
        margin-left: 0;
    }
}

/* Keep Select2 controls visually aligned with Bootstrap inputs. */
.select2-container {
    width: 100% !important;
    font-size: inherit;
}

.select2-container--open {
    z-index: 1100;
}

.select2-container .select2-selection--single,
.select2-container .select2-selection--multiple {
    min-height: calc(1.5em + .75rem + 2px);
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: var(--app-radius);
    background: rgba(255, 255, 255, .78);
}

.select2-container .select2-selection--single {
    height: calc(1.5em + .75rem + 2px);
}

.select2-container .select2-selection--single .select2-selection__rendered {
    padding: .375rem 2.25rem .375rem .75rem;
    color: var(--app-text);
    line-height: 1.5;
}

.select2-container .select2-selection--single .select2-selection__placeholder {
    color: var(--app-muted);
}

.select2-container .select2-selection--single .select2-selection__arrow {
    top: 0;
    right: .5rem;
    height: 100%;
}

.select2-container--focus .select2-selection--single,
.select2-container--open .select2-selection--single,
.select2-container--focus .select2-selection--multiple {
    border-color: rgba(17, 17, 17, .55);
    box-shadow: 0 0 0 .25rem rgba(17, 17, 17, .12);
    outline: 0;
}

.select2-container .select2-selection--multiple {
    padding: .125rem .375rem;
}

.select2-container .select2-selection--multiple .select2-selection__choice {
    margin-top: .2rem;
    border: 0;
    border-radius: .5rem;
    color: var(--app-badge-primary-text);
    background: var(--app-badge-primary-bg);
}

.select2-dropdown {
    z-index: 1101;
    overflow: hidden;
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: var(--app-radius);
    box-shadow: var(--app-shadow);
}

.select2-search--dropdown .select2-search__field {
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: .75rem;
    padding: .375rem .75rem;
}

.select2-results__option {
    padding: .5rem .75rem;
}

.select2-container .select2-results__option--highlighted[aria-selected] {
    background: var(--app-accent-soft-primary);
    color: var(--app-text);
}

.select2-container--disabled .select2-selection--single,
.select2-container--disabled .select2-selection--multiple {
    background: var(--bs-secondary-bg, #e9ecef);
    opacity: .85;
}

.app-workspace .card.shadow-sm,
.auth-card.shadow-sm,
.context-card.shadow-sm {
    box-shadow: var(--app-shadow) !important;
}

.platform-file-uploader .filepond--root {
    margin-bottom: .35rem;
    font-family: inherit;
}

.platform-file-uploader .filepond--drop-label {
    min-height: 5.25rem;
    color: var(--app-text, #212529);
}

.platform-file-uploader .filepond--label-action {
    color: #111;
    font-weight: 600;
    text-decoration-color: rgba(17, 17, 17, .45);
}

.platform-file-uploader .filepond--panel-root {
    border: 1px dashed var(--bs-border-color, #dee2e6);
    border-radius: var(--app-radius, .75rem);
    background: var(--bs-tertiary-bg, #f8f9fa);
}

.platform-file-uploader:has(input.is-invalid) .filepond--panel-root {
    border-color: var(--bs-form-invalid-border-color, #dc3545);
}

.platform-file-uploader__current {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .75rem;
    width: 100%;
    min-height: 12rem;
    padding: 2.75rem 1rem 1rem;
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: var(--app-radius, .75rem);
    background: var(--bs-tertiary-bg, #f8f9fa);
    overflow: hidden;
}

.platform-file-uploader__current-label {
    position: absolute;
    top: .75rem;
    left: .75rem;
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .3rem .55rem;
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: 999px;
    background: #fff;
    color: var(--app-text, #212529);
    font-size: .75rem;
    font-weight: 600;
}

.platform-file-uploader__current img {
    display: block;
    width: 100%;
    max-width: 16rem;
    height: 9rem;
    object-fit: contain;
    object-position: center;
    border-radius: .65rem;
    background: #fff;
}

.platform-file-uploader__current-help {
    color: var(--bs-secondary-color, #6c757d);
    font-size: .75rem;
    text-align: center;
}

.platform-signature-pad canvas {
    display: block;
    width: 100%;
    height: 11rem;
    border: 1px dashed var(--bs-border-color, #dee2e6);
    border-radius: var(--app-radius, .75rem);
    background: #fff;
    cursor: crosshair;
    touch-action: none;
}

.item-image-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
    gap: .75rem;
}

.item-image-gallery__item {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: .6rem;
    padding: .65rem;
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: var(--app-radius, .75rem);
    background: #fff;
    cursor: pointer;
}

.item-image-gallery__item img {
    width: 100%;
    height: 8rem;
    border-radius: .55rem;
    background: var(--bs-tertiary-bg, #f8f9fa);
    object-fit: contain;
}

.item-image-gallery__item .form-check {
    margin: 0;
}

.transfer-photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr));
    gap: .75rem;
}

.transfer-photo-card {
    overflow: hidden;
    min-width: 0;
    color: var(--bs-body-color);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    background: #fff;
    text-decoration: none;
}

.transfer-photo-card img {
    display: block;
    width: 100%;
    height: 8rem;
    background: var(--bs-tertiary-bg);
    object-fit: cover;
}

.transfer-photo-card span {
    display: block;
    overflow: hidden;
    padding: .5rem;
    color: var(--app-muted);
    font-size: .7rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.transfer-photo-empty {
    display: grid;
    min-height: 8rem;
    color: var(--app-muted);
    border: 1px dashed var(--app-border);
    border-radius: var(--app-radius);
    place-content: center;
    justify-items: center;
}

.transfer-photo-empty i { font-size: 1.75rem; }

@media (max-width: 575.98px) {
    .selection-shell {
        padding-top: 2rem !important;
    }
}

@media (max-width: 991.98px) {
    .app-shell {
        display: block;
    }

    .app-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        z-index: 1050;
        width: min(19rem, calc(100vw - 3rem));
        height: 100dvh;
        padding: 1rem;
        transform: translateX(-105%);
        transition: transform .2s ease;
        overflow-y: auto;
    }

    .app-shell.app-sidebar-mobile-open .app-sidebar {
        transform: translateX(0);
    }

    .app-sidebar-backdrop {
        position: fixed;
        z-index: 1040;
        inset: 0;
        display: block;
        width: 100%;
        border: 0;
        opacity: 0;
        visibility: hidden;
        background: rgba(20, 25, 32, .35);
        transition: opacity .2s ease, visibility .2s ease;
    }

    .app-shell.app-sidebar-mobile-open .app-sidebar-backdrop {
        opacity: 1;
        visibility: visible;
    }

    .app-sidebar-nav {
        margin-top: 1rem !important;
    }

    .app-sidebar-nav .list-group {
        flex-direction: column;
        width: 100%;
    }

    .app-sidebar-nav .list-group-item {
        width: 100%;
        white-space: normal;
    }

    .app-sidebar-footer {
        display: block;
    }
}

/* Shared light command-center treatment for module dashboards. */
.module-dashboard {
    --module-accent: #6d5ce8;
    --module-accent-rgb: 109, 92, 232;
    --module-soft: #f0edff;
    --module-ink: #172033;
    --module-muted: #7a8495;
}

.module-dashboard--wms { --module-accent: #16865f; --module-accent-rgb: 34, 168, 121; --module-soft: #eaf9f4; }
.module-dashboard--finance { --module-accent: #2777d8; --module-accent-rgb: 63, 140, 255; --module-soft: #edf5ff; }
.module-dashboard--accounting { --module-accent: #5d4dd4; --module-accent-rgb: 109, 92, 232; --module-soft: #f0edff; }
.module-dashboard--asset { --module-accent: #b66b0a; --module-accent-rgb: 231, 154, 50; --module-soft: #fff6e9; }
.module-dashboard--production { --module-accent: #c45b22; --module-accent-rgb: 196, 91, 34; --module-soft: #fff2eb; }
.production-dashboard-icon { display: inline-flex; align-items: center; justify-content: center; width: 2rem; height: 2rem; flex: 0 0 2rem; border-radius: .7rem; background: var(--module-soft); color: var(--module-accent); font-size: 1.1rem; }
.production-dashboard-icon--info { color: #2777d8; background: #edf5ff; }
.production-dashboard-icon--warning { color: #b66b0a; background: #fff6e9; }
.production-dashboard-icon--danger { color: #c43e52; background: #fff0f2; }
.production-dashboard-icon--success { color: #16865f; background: #eaf9f4; }
.production-dashboard-shortcut { display: flex; align-items: center; gap: .65rem; min-height: 3.5rem; padding: .75rem; border: 1px solid #edf0f5; border-radius: .75rem; color: var(--module-ink); text-decoration: none; font-weight: 650; }
.production-dashboard-shortcut:hover { border-color: rgba(var(--module-accent-rgb), .35); background: var(--module-soft); color: var(--module-accent); }
.production-dashboard-shortcut i { color: var(--module-accent); font-size: 1.25rem; }
.production-dashboard-status > a { display: flex; justify-content: space-between; align-items: center; padding: .75rem .2rem; border-bottom: 1px solid #edf0f5; color: var(--module-ink); text-decoration: none; }
.production-dashboard-status > a:last-child { border-bottom: 0; }
.production-dashboard-status > a:hover { color: var(--module-accent); }
.bom-line-list { display: grid; gap: 1rem; }
.bom-line-card { padding: 1rem; border: 1px solid var(--app-border); border-radius: .85rem; background: #fff; }
.bom-line-card-header { display: flex; align-items: center; gap: .6rem; margin-bottom: 1rem; }
.bom-line-card-header .js-remove-line { margin-left: auto; }
.bom-line-number { display: inline-flex; align-items: center; justify-content: center; width: 1.8rem; height: 1.8rem; border-radius: 50%; background: var(--module-soft, #f3f4f6); color: var(--module-accent, #3f454d); font-weight: 700; }
.bom-substitute-panel { margin-top: 1rem; padding: .85rem 1rem .25rem; border: 1px dashed #d9dee7; border-radius: .75rem; background: #fafbfc; }
.bom-substitute-row { display: flex; align-items: center; gap: .5rem; margin-bottom: .6rem; }
.bom-substitute-row .bom-factor { width: 7rem; flex: 0 0 7rem; }
@media (max-width: 575.98px) { .bom-substitute-panel { padding: .75rem; } .bom-substitute-row { align-items: stretch; flex-wrap: wrap; } .bom-substitute-row > .flex-grow-1 { flex: 1 1 calc(100% - 3rem); } .bom-substitute-row .bom-factor { flex: 1 1 8rem; width: auto; } }

.planning-day-page { --planning-label-width: 240px; background: var(--app-selection-background); padding: .85rem clamp(.75rem, 2vw, 1.5rem); min-height: calc(100dvh - 5rem); }
.planning-day-page :is(a,button,input,select,summary,.planning-day-scroll):focus-visible { outline: 3px solid var(--app-accent-info); outline-offset: 2px; }
.planning-day-header { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: .7rem; margin-bottom: .75rem; }
.planning-day-header h1 { font-weight: 800; font-size: clamp(1.3rem, 2.4vw, 1.85rem); margin: 0 0 .15rem; }
.planning-day-header p { font-size: .85rem; }
.planning-day-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .65rem; padding: .65rem .8rem; border-radius: .9rem; background: var(--app-glass-strong); border: 1px solid var(--app-border); }
.planning-day-picker, .planning-day-picker form, .planning-day-stats { display: flex; align-items: center; flex-wrap: wrap; gap: .45rem; }
.planning-day-picker .form-control { width: 155px; }
.planning-day-stats { gap: .6rem; font-size: .82rem; }
.planning-day-stats span { padding: .4rem .55rem; border-radius: .55rem; background: var(--app-surface); }
.planning-day-filters { margin: .55rem 0; border: 1px solid var(--app-border); border-radius: .8rem; background: var(--app-surface); }
.planning-day-filters > summary { cursor: pointer; padding: .55rem .8rem; font-weight: 650; }
.planning-day-filter-body { border-top: 1px solid var(--app-border); padding: .65rem .8rem; }
.planning-day-filter-body .form-label, .planning-day-filter-body .form-check { font-size: .82rem; }
.planning-day-board { border: 1px solid var(--app-border); border-radius: 1rem; background: var(--app-surface); overflow: hidden; }
.planning-day-caption { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .5rem; padding: .65rem .85rem; }
.planning-day-caption h2 { font-size: 1.05rem; font-weight: 750; margin: 0; }
.planning-day-caption p { font-size: .78rem; color: var(--app-muted); margin: .15rem 0 0; }
.planning-day-scroll { max-height: max(270px, calc(100dvh - 330px)); overflow: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.planning-day-inner { min-width: calc(var(--planning-label-width) + 960px); }
.planning-day-grid-head, .planning-day-row { display: grid; grid-template-columns: var(--planning-label-width) minmax(960px,1fr); }
.planning-day-grid-head { position: sticky; top: 0; z-index: 3; background: var(--app-surface); border-block: 1px solid var(--app-border); }
.planning-day-label { position: sticky; left: 0; z-index: 2; padding: .4rem .65rem; background: var(--app-surface); border-right: 1px solid var(--app-border); min-width: 0; }
.planning-day-grid-head .planning-day-label { z-index: 4; display: flex; align-items: center; font-size: .75rem; font-weight: 700; }
.planning-day-hours { display: grid; grid-template-columns: repeat(24, minmax(40px,1fr)); position: relative; min-height: 32px; color: var(--app-muted); font-size: .68rem; }
.planning-day-hours > span { border-left: 1px solid var(--app-border); padding: .45rem 0 0 .2rem; }
.planning-day-row { border-bottom: 1px solid var(--app-border); min-height: 67px; }
.planning-day-row .planning-day-label { display: flex; align-content: center; flex-wrap: wrap; column-gap: .35rem; }
.planning-day-row .planning-day-label > a { font-size: .82rem; }
.planning-day-row .badge { font-size: .63rem; }
.planning-day-item, .planning-day-time { display: block; flex-basis: 100%; font-size: .72rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.planning-day-item { color: var(--app-muted); }
.planning-day-time { font-weight: 650; }
.planning-day-more { flex-basis: 100%; font-size: .72rem; }
.planning-day-more summary { cursor: pointer; color: var(--app-badge-primary-text); }
.planning-day-more div { padding: .25rem 0; color: var(--app-muted); }
.planning-day-row .planning-timeline-track { height: auto; min-width: 0; border-radius: 0; overflow: visible; background: linear-gradient(to right, var(--app-border) 1px, transparent 1px) 0 0 / calc(100% / 24) 100%; }
.planning-day-row .planning-timeline-bar { top: 50%; transform: translateY(-50%); height: 28px; min-width: 10px; border-radius: .45rem; box-shadow: 0 .2rem .4rem rgba(0,0,0,.12); z-index: 1; }
.planning-day-row.has-overlap .planning-timeline-bar { outline: 2px solid var(--app-accent-danger); outline-offset: 2px; }
.planning-day-empty { padding: 1.5rem; text-align: center; color: var(--app-muted); }
.planning-day-unscheduled { padding: .55rem .85rem; font-size: .82rem; border-top: 1px solid var(--app-border); }
.planning-day-unscheduled summary { cursor: pointer; font-weight: 650; }
.planning-day-unscheduled-list { display: grid; grid-template-columns: repeat(auto-fit,minmax(220px,1fr)); gap: .4rem; padding-top: .5rem; }
.planning-day-unscheduled-list a { padding: .4rem; border-radius: .45rem; background: var(--app-bg); }
.planning-day-unscheduled-list small { display: block; color: var(--app-muted); }
@media (max-width: 767.98px) { .planning-day-page { --planning-label-width: 185px; } .planning-day-caption .badge { font-size: .66rem; } .planning-day-picker .form-control { width: 145px; } }

.module-dashboard--crm {
    --module-accent: #f43f75;
    --module-accent-rgb: 244, 63, 117;
    --module-soft: #fff0f6;
    --crm-blue: #3b82f6;
    --crm-blue-rgb: 59, 130, 246;
    --crm-teal: #14b8a6;
    --crm-teal-rgb: 20, 184, 166;
    --crm-amber: #f59e0b;
    --crm-amber-rgb: 245, 158, 11;
    --crm-violet: #8b5cf6;
    --crm-violet-rgb: 139, 92, 246;
}

.module-dashboard-hero {
    position: relative;
    overflow: hidden;
    min-height: 150px;
    padding: 1.65rem 1.8rem;
    border: 1px solid rgba(var(--module-accent-rgb), .11);
    border-radius: 1.35rem;
    background:
        radial-gradient(circle at 84% 15%, rgba(var(--module-accent-rgb), .14), transparent 27%),
        linear-gradient(135deg, #fff 0%, #fafaff 58%, var(--module-soft) 145%);
    box-shadow: 0 1rem 3rem rgba(48, 61, 95, .075);
}

.module-dashboard-hero::before {
    position: absolute;
    inset: 0;
    content: '';
    opacity: .32;
    pointer-events: none;
    background-image: linear-gradient(rgba(89, 99, 130, .06) 1px, transparent 1px), linear-gradient(90deg, rgba(89, 99, 130, .06) 1px, transparent 1px);
    background-size: 38px 38px;
    mask-image: linear-gradient(90deg, #000, transparent 82%);
}

.module-dashboard-hero > * { position: relative; z-index: 1; }
.module-dashboard-kicker { display: flex; align-items: center; gap: .5rem; color: var(--module-accent); font-size: .68rem; font-weight: 800; letter-spacing: .13em; }
.module-dashboard-kicker span { width: .45rem; height: .45rem; border-radius: 50%; background: var(--module-accent); box-shadow: 0 0 0 .25rem rgba(var(--module-accent-rgb), .1); }
.module-dashboard-hero h1 { margin: 0 0 .45rem; color: var(--module-ink); font-size: clamp(1.65rem, 2.5vw, 2.45rem); font-weight: 750; letter-spacing: -.035em; }
.module-dashboard-hero p:not(.module-dashboard-kicker) { max-width: 720px; color: #667085; }
.module-dashboard-actions .btn, .module-dashboard-hero > .btn { border-radius: .75rem; }

.module-dashboard .card {
    border: 1px solid rgba(30, 42, 66, .07) !important;
    border-radius: 1.12rem;
    box-shadow: 0 .65rem 2rem rgba(34, 45, 72, .055) !important;
}

.module-dashboard-summary .card {
    position: relative;
    overflow: hidden;
    transition: transform .2s ease, box-shadow .2s ease;
}

.module-dashboard-summary .card::after {
    position: absolute;
    top: -1.8rem;
    right: -1.8rem;
    width: 6rem;
    height: 6rem;
    content: '';
    border-radius: 50%;
    background: rgba(var(--module-accent-rgb), .06);
}

.module-dashboard-summary .card:hover { transform: translateY(-3px); box-shadow: 0 1rem 2.5rem rgba(34, 45, 72, .1) !important; }
.module-dashboard-summary .card-body { position: relative; z-index: 1; padding: 1.1rem !important; }
.module-dashboard-summary .small.text-secondary { color: #667085 !important; font-size: .72rem; font-weight: 600; }
.module-dashboard-summary [data-summary],
.module-dashboard-summary [data-dashboard-financial] { overflow: hidden; color: var(--module-ink); font-weight: 750; letter-spacing: -.035em; text-overflow: ellipsis; white-space: nowrap; }
.module-dashboard h2, .module-dashboard h3 { color: var(--module-ink); font-weight: 700; }
.module-dashboard .table thead th { color: var(--module-muted); background: #fafbfc; font-size: .72rem; font-weight: 650; }
.module-dashboard .table tbody td { border-color: #f0f2f6; }
.module-dashboard .table-responsive { border-radius: .75rem; }
.module-dashboard .list-group-item { border-color: #edf0f5; background: transparent; }
.module-dashboard [data-work-group] > a,
.module-dashboard .finance-work-items > a,
.module-dashboard .wms-work-list > a { padding: .65rem .2rem !important; border-color: #edf0f5 !important; }
.module-dashboard [data-aging] > div > .border { border-color: #edf0f5 !important; border-radius: .75rem !important; background: #fafbfc; }
.module-dashboard canvas { max-width: 100%; }

@media (max-width: 767.98px) {
    .module-dashboard-hero { min-height: auto; padding: 1.2rem; }
    .module-dashboard-hero .module-dashboard-actions { width: 100%; }
    .module-dashboard-hero .module-dashboard-actions .btn { flex: 1 1 auto; }
}

/* Tablet shop floor: compact identity + next action stay outside the scrolling tab. */
.shop-floor-board { --sf-ink: var(--app-text); --sf-muted: var(--app-muted); --sf-accent: var(--app-badge-primary-text); --sf-soft: var(--app-badge-primary-bg); background: var(--app-selection-background); color: var(--sf-ink); padding: 1rem; }
.sf-tablet-page .app-topbar .container-fluid { padding-block: .5rem !important; }
.shop-floor-board .btn, .shop-floor-board .form-control, .sf-touch-modal .btn, .sf-touch-modal .form-select { min-height: 46px; }
.shop-floor-board .btn { display: inline-flex; align-items: center; justify-content: center; gap: .15rem; font-size: .9rem; border-radius: .7rem; }
.shop-floor-board :is(a,button,input,textarea,[tabindex]):focus-visible { outline: 3px solid var(--app-accent-info); outline-offset: 3px; }
.sf-board-header, .sf-detail-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .75rem; }
.sf-board-header { margin-bottom: .9rem; }
.sf-board-header h1 { font-size: 1.65rem; font-weight: 800; margin: 0 0 .25rem; }
.sf-kicker { color: var(--sf-accent); font-size: .65rem; font-weight: 800; letter-spacing: .14em; margin: 0 0 .2rem; }
.sf-subtitle { color: var(--sf-muted); font-size: .88rem; margin: 0; }
.sf-header-tools, .sf-detail-heading, .sf-document-title { display: flex; align-items: center; flex-wrap: wrap; gap: .65rem; }
.sf-header-tools .badge { padding: .6rem; font-size: .8rem; }
.sf-board-controls { padding: .85rem; background: var(--app-glass-strong); border: 1px solid var(--app-glass); border-radius: 1rem; margin-bottom: .9rem; }
.sf-controls-heading { display: flex; justify-content: space-between; align-items: center; gap: .6rem; margin-bottom: .5rem; }
.sf-controls-heading .form-label { font-size: .9rem; font-weight: 650; }
.sf-search-form { display: flex; gap: .5rem; }
.sf-search-form input { min-width: 0; flex: 1; }
.sf-search-form button { flex-shrink: 0; min-width: 6rem; }
.sf-filters { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; margin-top: .65rem; }
.sf-filter { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: .55rem 1rem; border-radius: .65rem; background: var(--app-surface); color: var(--sf-muted); font-weight: 650; text-decoration: none; }
.sf-filter.is-active { background: var(--sf-soft); color: var(--sf-accent); box-shadow: inset 0 0 0 1px currentColor; }
.sf-filter:hover { color: var(--sf-accent); }
.sf-result-count { margin-left: auto; color: var(--sf-muted); font-size: .8rem; }
.sf-queue { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .75rem; }
.sf-job { display: flex; flex-direction: column; gap: .5rem; min-width: 0; padding: .85rem; border: 1px solid var(--app-border); border-top: 3px solid var(--app-accent-info); border-radius: 1rem; background: var(--app-surface); box-shadow: var(--app-shadow); }
.sf-job.is-running { border-top-color: var(--app-accent-warning); }
.sf-job.is-held { border-top-color: var(--app-accent-danger); }
.sf-job-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .4rem; }
.sf-job-heading h2 { font-size: 1rem; font-weight: 800; margin: 0; overflow-wrap: anywhere; }
.sf-job-product { display: flex; align-items: flex-start; gap: .7rem; }
.sf-job-image { flex: 0 0 3.5rem; width: 3.5rem; height: 3.5rem; }
.sf-job-product strong { display: block; font-size: 1.02rem; overflow-wrap: anywhere; }
.sf-job-product span { display: block; font-size: .78rem; color: var(--sf-muted); overflow-wrap: anywhere; }
.sf-job-figures { display: flex; justify-content: space-between; gap: .5rem; }
.sf-job-figures small { display: block; font-size: .7rem; color: var(--sf-muted); }
.sf-job-figures strong { font-size: .85rem; }
.sf-job-next { display: flex; gap: .3rem; align-items: center; border-radius: .5rem; padding: .35rem .5rem; font-size: .82rem; color: var(--sf-accent); background: var(--sf-soft); }
.sf-job-footer { display: flex; align-items: center; gap: 1rem; margin-top: auto; }
.sf-job-progress { flex: 1; min-width: 0; }
.sf-job-progress small { font-size: .7rem; color: var(--sf-muted); }
.shop-floor-board .progress { height: .4rem; background: var(--app-bg); margin-top: .3rem; }
.shop-floor-board .progress-bar { background: var(--sf-accent); }
.sf-job-footer .btn { min-width: 7rem; }
.sf-pager { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .5rem; padding: .65rem 0 0; font-size: .85rem; flex-shrink: 0; }
.sf-page-disabled { color: var(--sf-muted); padding: .6rem 1rem; opacity: .7; }
.sf-empty { grid-column: 1 / -1; padding: 2rem 1rem; text-align: center; color: var(--sf-muted); }
.sf-empty > i { display: block; color: var(--sf-accent); font-size: 2.5rem; margin-bottom: .7rem; }
.sf-empty h2, .sf-empty h3 { font-size: 1.2rem; }
.sf-cockpit { height: calc(100vh - var(--sf-toolbar-height, 66px)); height: calc(100dvh - var(--sf-toolbar-height, 66px)); min-height: 36rem; display: flex; flex-direction: column; gap: .65rem; }
.sf-cockpit > :not(.sf-detail-grid) { flex-shrink: 0; }
.sf-document-title h1 { margin: 0; font-size: 1.35rem; font-weight: 800; overflow-wrap: anywhere; }
.sf-detail-strip { display: grid; grid-template-columns: minmax(0,1.6fr) repeat(3,minmax(0,1fr)); align-items: center; gap: .75rem; background: var(--app-glass-strong); border-radius: .85rem; padding: .7rem .9rem; }
.sf-detail-strip strong { display: block; font-size: .94rem; overflow-wrap: anywhere; }
.sf-detail-strip small { display: block; font-size: .73rem; color: var(--sf-muted); }
.sf-strip-progress { grid-column: 1 / -1; }
.sf-product-summary { display: flex; align-items: center; gap: .65rem; min-width: 0; }
.sf-detail-cover, .sf-material-image { display: grid; place-items: center; flex: 0 0 2.65rem; width: 2.65rem; height: 2.65rem; overflow: hidden; border-radius: .6rem; background: var(--app-surface); font-size: 1.55rem; color: var(--sf-accent); }
.sf-detail-cover img, .sf-material-image img { width: 100%; height: 100%; object-fit: cover; }
.sf-next { display: flex; flex-direction: column; gap: .3rem; background: var(--app-surface); border: 1px solid var(--app-border); border-left: 4px solid var(--app-accent-success); border-radius: .85rem; padding: .65rem .9rem; }
.sf-next-label { display: flex; align-items: center; gap: .4rem; font-size: .72rem; color: var(--app-badge-success-text); font-weight: 750; }
.sf-next-label i { font-size: 1rem; }
.sf-next-content { display: flex; align-items: center; justify-content: space-between; gap: .8rem; }
.sf-next-content p { margin: 0; font-size: .85rem; overflow-wrap: anywhere; }
.sf-next-content form, .sf-next-content > button { flex-shrink: 0; }
.sf-next-content .btn { min-width: 12rem; }
.sf-cockpit > .alert { margin: 0; padding: .65rem; font-size: .88rem; }
.sf-detail-grid { display: flex; flex-direction: column; min-height: 0; flex: 1; border-radius: 1rem; border: 1px solid var(--app-border); background: var(--app-surface); overflow: hidden; }
.sf-tabs { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); flex-shrink: 0; gap: .25rem; padding: .4rem; border-bottom: 1px solid var(--app-border); background: var(--app-glass-strong); }
.sf-tabs .nav-link { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: .35rem; min-height: 48px; border: 0; border-radius: .65rem; color: var(--sf-muted); background: transparent; font-size: .88rem; font-weight: 700; }
.sf-tabs .nav-link.active { color: var(--sf-accent); background: var(--sf-soft); }
.sf-tabs .nav-link span { padding: .1rem .4rem; border-radius: .4rem; font-size: .78rem; background: var(--app-surface); }
.sf-tabs .nav-link i { font-size: 1.2rem; }
.sf-tab-content { min-height: 0; flex: 1; display: flex; }
.sf-tab-content > .tab-pane { width: 100%; padding: .8rem 1rem; min-height: 0; }
.sf-tab-content > .tab-pane.active { display: flex; flex-direction: column; }
.sf-panel-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem; flex-shrink: 0; margin-bottom: .5rem; }
.sf-panel-heading h2 { margin: 0; font-size: 1rem; font-weight: 750; }
.sf-panel-heading > span, .sf-panel-intro { color: var(--sf-muted); font-size: .8rem; }
.sf-panel-scroll { flex: 1; min-height: 0; overflow: auto; scrollbar-gutter: stable; overscroll-behavior: contain; }
.sf-material { display: flex; align-items: center; gap: .8rem; padding: .55rem .3rem; border-bottom: 1px solid var(--app-border); }
.sf-material-name { min-width: 0; flex: 1; }
.sf-material-name strong, .sf-material-name span { display: block; overflow-wrap: anywhere; }
.sf-material-name span { font-size: .84rem; color: var(--sf-muted); }
.sf-material-qty { text-align: right; white-space: nowrap; }
.sf-material-qty small { display: block; font-size: .7rem; color: var(--sf-muted); }
.sf-material-qty span { font-size: .8rem; }
.sf-steps { list-style: none; padding: 0; margin: 0; }
.sf-step { display: flex; gap: .8rem; align-items: center; padding: .75rem 0; border-bottom: 1px solid var(--app-border); }
.sf-step-number { display: grid; place-items: center; flex: 0 0 2rem; height: 2rem; border-radius: 50%; background: var(--sf-soft); color: var(--sf-accent); font-weight: 750; }
.sf-step-body { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.sf-step-meta { font-size: .8rem; color: var(--sf-muted); margin-top: .25rem; }
.sf-step-note { white-space: pre-wrap; font-size: .85rem; margin: .3rem 0 0; }
.sf-step-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .4rem; }
.sf-step-actions .btn { min-width: 46px; }
.sf-info-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); align-content: start; gap: 1.5rem; }
.sf-info-grid h3 { font-size: 1rem; font-weight: 750; }
.sf-metadata > div { display: flex; justify-content: space-between; gap: 1rem; padding: .4rem 0; border-bottom: 1px solid var(--app-border); font-size: .85rem; }
.sf-metadata dt { font-weight: 400; color: var(--sf-muted); }
.sf-metadata dd { text-align: right; margin: 0; }
.sf-note, .sf-issue p { white-space: pre-wrap; overflow-wrap: anywhere; }
.sf-note { padding: .75rem; border-radius: .65rem; background: var(--app-badge-info-bg); }
.sf-danger-zone { padding: 1rem; border: 1px solid var(--app-accent-soft-danger); border-radius: .7rem; }
.sf-danger-zone p { font-size: .85rem; }
.sf-issue { padding: .8rem; margin-bottom: .6rem; background: var(--app-bg); border-radius: .7rem; }
.sf-issue p { margin-bottom: .3rem; }
.sf-issue small { color: var(--sf-muted); }
@media (min-width: 1400px) { .sf-queue { grid-template-columns: repeat(3,minmax(0,1fr)); } }
@media (max-width: 991.98px) { .sf-detail-strip { grid-template-columns: minmax(0,1.4fr) repeat(3,minmax(0,1fr)); } .sf-next-content .btn { min-width: 10rem; } }
@media (max-width: 767.98px) { .shop-floor-board { padding: .75rem; } .sf-detail-strip { grid-template-columns: repeat(3,minmax(0,1fr)); } .sf-product-summary { grid-column: 1/-1; } .sf-result-count { width: 100%; margin-left: 0; } .sf-tabs .nav-link { font-size: .8rem; } .sf-tabs .nav-link i { display: none; } }
@media (max-width: 599.98px), (max-height: 599.98px) { .sf-cockpit { height: auto; min-height: 0; } .sf-detail-grid { min-height: 20rem; } .sf-panel-scroll { overflow: visible; } .sf-tab-content > .tab-pane { padding: .75rem; } .sf-info-grid { grid-template-columns: 1fr; } .sf-next-content { flex-wrap: wrap; } .sf-step { flex-wrap: wrap; } .sf-step-actions { width: 100%; justify-content: flex-end; } }
@media (max-width: 599.98px) { .sf-queue { grid-template-columns: 1fr; } .sf-next-content > form, .sf-next-content .btn { width: 100%; } .sf-controls-heading .form-label { font-size: .8rem; } .sf-pager { font-size: .75rem; } }

/* CRM calendar */
.crm-calendar{overflow:hidden;border:1px solid #dfe4ea;border-radius:1rem;background:#fff;box-shadow:0 12px 35px rgba(31,41,55,.06)}.crm-calendar-grid{display:grid}.crm-calendar.is-month .crm-calendar-grid,.crm-calendar-weekdays{grid-template-columns:repeat(7,minmax(0,1fr))}.crm-calendar.is-week .crm-calendar-grid{grid-template-columns:repeat(7,minmax(145px,1fr));overflow-x:auto}.crm-calendar.is-day .crm-calendar-grid{grid-template-columns:1fr}.crm-calendar-weekdays{display:grid;background:#f8fafc;border-bottom:1px solid #dfe4ea}.crm-calendar-weekdays span{padding:.7rem;text-align:center;font-size:.78rem;font-weight:700;color:#64748b}.crm-calendar-day{min-width:0;min-height:9rem;padding:.55rem;background:#fff;border-right:1px solid #e7ebf0;border-bottom:1px solid #e7ebf0}.crm-calendar.is-month .crm-calendar-day{min-height:10.5rem}.crm-calendar.is-week .crm-calendar-day{min-height:22rem}.crm-calendar-day:nth-child(7n){border-right:0}.crm-calendar-day.is-weekend{background:#fbfcff}.crm-calendar-day.is-outside{background:#f8fafc;color:#94a3b8}.crm-calendar-day.is-today{background:#f3f8ff;box-shadow:inset 0 0 0 2px #bfdbfe}.crm-calendar-day-header{display:flex;justify-content:space-between;align-items:center;gap:.5rem;margin-bottom:.45rem}.crm-calendar-day-header strong{display:inline-grid;place-items:center;min-width:1.85rem;height:1.85rem;font-size:.85rem}.crm-calendar-day.is-today .crm-calendar-day-header strong{border-radius:50%;background:#2563eb;color:#fff}.crm-calendar-day-tools{display:flex;align-items:center;gap:.15rem}.crm-calendar-count{font-size:.72rem;color:#64748b}.crm-calendar-day-tools .btn,.crm-calendar-event-compact .btn{display:grid;place-items:center;width:1.65rem;height:1.65rem;padding:0;border:0;border-radius:50%;color:#64748b}.crm-calendar-day-tools .btn:hover,.crm-calendar-event-compact .btn:hover{background:rgba(100,116,139,.12);color:#0f172a}.crm-calendar-event-compact[draggable=true],.crm-calendar-event[draggable=true]{cursor:grab}.crm-calendar-day:has(.crm-calendar-event-compact[draggable=true]:active){cursor:grabbing}.crm-calendar-event{padding:.8rem;margin-top:.55rem;border:1px solid #e2e8f0;border-radius:.8rem;background:#fff;box-shadow:0 4px 14px rgba(31,41,55,.05)}.crm-calendar-time{font-variant-numeric:tabular-nums}.crm-calendar-event>a{color:inherit;text-decoration:none}.crm-calendar-event>a:hover{text-decoration:underline}.crm-calendar-event-compact{display:grid;grid-template-columns:.45rem 2.7rem minmax(0,1fr) auto auto;align-items:center;gap:.32rem;margin:.28rem 0;padding:.36rem .42rem;border-radius:.48rem;background:#eef6ff;color:#1e3a5f;text-decoration:none;font-size:.75rem;line-height:1.25}.crm-calendar-event-compact:hover{filter:brightness(.97);color:inherit}.crm-calendar-event-compact time{font-weight:700;font-variant-numeric:tabular-nums}.crm-calendar-event-dot{width:.4rem;height:.4rem;border-radius:50%;background:#3b82f6}.crm-calendar-event-compact.is-meeting{background:#fff5df;color:#7c4a03}.crm-calendar-event-compact.is-meeting .crm-calendar-event-dot{background:#f59e0b}.crm-calendar-event-compact.is-task{background:#eaf8f1;color:#176142}.crm-calendar-event-compact.is-task .crm-calendar-event-dot{background:#34a878}.crm-calendar-event-compact.is-note{background:#f3efff;color:#58408d}.crm-calendar-event-compact.is-note .crm-calendar-event-dot{background:#8b6bd6}.crm-calendar-event-compact.is-next-action{background:#fff0f0;color:#8b3030}.crm-calendar-event-compact.is-next-action .crm-calendar-event-dot{background:#e56b6f}.crm-calendar-event-compact.is-completed{opacity:.58;text-decoration:line-through}.crm-calendar-more{width:100%;padding:.25rem;color:#475569;background:#f8fafc;border:0}.crm-calendar-more:hover{background:#eef2f7}@media(max-width:767.98px){.crm-calendar{border:0;background:transparent;box-shadow:none;overflow:visible}.crm-calendar-weekdays{display:none}.crm-calendar.is-week .crm-calendar-grid,.crm-calendar.is-month .crm-calendar-grid{grid-template-columns:1fr;overflow:visible;gap:.65rem}.crm-calendar.is-week .crm-calendar-day,.crm-calendar.is-month .crm-calendar-day{min-height:auto;border:1px solid #e2e8f0;border-radius:.8rem}.crm-calendar.is-week .crm-calendar-day.is-empty,.crm-calendar.is-month .crm-calendar-day.is-empty,.crm-calendar.is-month .crm-calendar-day.is-outside{display:none}.crm-calendar-event .btn{min-height:44px}.crm-calendar-event-compact{min-height:2.35rem;font-size:.82rem}}

@media (prefers-reduced-motion: reduce) {
    .module-dashboard-summary .card { transition: none; }
}

.wo-more-actions { position: relative; }
.wo-more-actions > summary { list-style: none; cursor: pointer; }
.wo-more-actions > summary::-webkit-details-marker { display: none; }
.wo-more-actions[open] > .dropdown-menu { display: block; }
.wo-more-actions .dropdown-item { white-space: nowrap; }
@media (max-width: 575.98px) {
    .wo-more-actions[open] > .dropdown-menu { right: 0; left: auto; }
    .wo-more-actions .dropdown-item { white-space: normal; }
}
