/* ================================
   🔄 CSS RESET
   ================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-family);
    background: var(--color-white);
    color: var(--color-text);
    /* Prevent accidental whole-page horizontal scrolling; wide tables must scroll in their own containers. */
    overflow-x: hidden;
}

/* ================================
     🧩 UTILITY HELPERS (TAILWIND BRIDGE)
     ================================ */
.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.flex-1 {
    flex: 1 1 0%;
    min-width: 0;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.justify-center {
    justify-content: center;
}

.gap-4 {
    gap: 16px;
}

.gap-6 {
    gap: 24px;
}

.w-full {
    width: 100%;
}

.w-8 {
    width: 32px;
}

.h-8 {
    height: 32px;
}

.w-6 {
    width: 24px;
}

.h-6 {
    height: 24px;
}

.w-5 {
    width: 20px;
}

.h-5 {
    height: 20px;
}

.h-screen {
    min-height: 100vh;
}

.overflow-hidden {
    overflow: hidden;
}

.relative {
    position: relative;
}

.absolute {
    position: absolute;
}

.-top-1 {
    top: -4px;
}

.-right-1 {
    right: -4px;
}

.mt-4 {
    margin-top: 16px;
}

.mt-2 {
    margin-top: 8px;
}

.mb-4 {
    margin-bottom: 16px;
}

.mb-2 {
    margin-bottom: 8px;
}

.p-4 {
    padding: 16px;
    box-sizing: border-box;
}

.rounded-lg {
    border-radius: var(--radius-lg);
}

.rounded-full {
    border-radius: 9999px;
}

.bg-white {
    background: var(--color-white);
}

.bg-gray-50 {
    background: var(--color-neutral-100);
}

.bg-gray-300 {
    background: var(--color-neutral-300);
}

.bg-red-500 {
    background: var(--color-primary);
}

.border {
    border: 1px solid var(--color-border);
}

.border-gray-200 {
    border-color: var(--color-neutral-200);
}

.text-white {
    color: var(--color-white);
}

.text-gray-900 {
    color: var(--color-black);
}

.text-gray-600 {
    color: #4b5563;
}

.text-red-500 {
    color: var(--color-primary);
}

.text-pink-500 {
    color: var(--color-secondary);
}

.text-blue-500 {
    color: var(--color-info);
}

.text-orange-500 {
    color: var(--color-warning);
}

.text-sm {
    font-size: var(--body-sm-size);
    line-height: var(--body-sm-line-height);
    letter-spacing: var(--body-sm-letter-spacing);
}

.text-xs {
    font-size: 0.75rem;
    line-height: 1rem;
}

.font-semibold {
    font-weight: 600;
}

.grid {
    display: grid;
}

.grid-cols-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.space-y-3>*+* {
    margin-top: 12px;
}

/* ================================
   🎨 DESIGN TOKENS
   ================================ */
:root {
    /* --- Neutral Colors (your set, renamed) --- */
    --color-white: #ffffff;
    --color-neutral-100: #f4f6f7;
    --color-neutral-200: #ebebeb;
    --color-neutral-300: #cccccc;
    --color-neutral-400: #999999;
    --color-black: #3F3F3F;
    --color-light-red: #ffecec;
    --color-red: #fa3e3e;

    /* --- Main Color Scale (HSL driven for theming) --- */
    --color-main-h: 225;
    --color-main-s: 100%;
    --color-main-l: 58%;

    --color-main-50: hsl(var(--color-main-h) var(--color-main-s) 95%);
    --color-main-100: hsl(var(--color-main-h) var(--color-main-s) 90%);
    --color-main-200: hsl(var(--color-main-h) var(--color-main-s) 80%);
    --color-main-300: hsl(var(--color-main-h) var(--color-main-s) 70%);
    --color-main-400: hsl(var(--color-main-h) var(--color-main-s) 60%);
    --color-main-500: hsl(var(--color-main-h) var(--color-main-s) var(--color-main-l));
    --color-main-600: hsl(var(--color-main-h) var(--color-main-s) 35%);
    --color-main-700: hsl(var(--color-main-h) var(--color-main-s) 25%);
    --color-main-800: hsl(var(--color-main-h) var(--color-main-s) 20%);
    --color-main-900: hsl(var(--color-main-h) var(--color-main-s) 15%);

    /* --- Secondary Color Scale (HSL driven for theming) --- */
    --color-secondary-h: 340;
    /* example: pink/red hue */
    --color-secondary-s: 80%;
    --color-secondary-l: 50%;

    --color-secondary-50: hsl(var(--color-secondary-h) var(--color-secondary-s) 95%);
    --color-secondary-100: hsl(var(--color-secondary-h) var(--color-secondary-s) 90%);
    --color-secondary-200: hsl(var(--color-secondary-h) var(--color-secondary-s) 80%);
    --color-secondary-300: hsl(var(--color-secondary-h) var(--color-secondary-s) 70%);
    --color-secondary-400: hsl(var(--color-secondary-h) var(--color-secondary-s) 60%);
    --color-secondary-500: hsl(var(--color-secondary-h) var(--color-secondary-s) var(--color-secondary-l));
    --color-secondary-600: hsl(var(--color-secondary-h) var(--color-secondary-s) 40%);
    --color-secondary-700: hsl(var(--color-secondary-h) var(--color-secondary-s) 30%);
    --color-secondary-800: hsl(var(--color-secondary-h) var(--color-secondary-s) 20%);
    --color-secondary-900: hsl(var(--color-secondary-h) var(--color-secondary-s) 15%);

    /* --- Semantic Aliases --- */
    --color-primary: var(--color-main-500);
    --color-primary-lighter: var(--color-main-400);
    --color-primary-light: var(--color-main-100);
    --color-primary-dark: var(--color-main-700);

    --color-secondary: var(--color-secondary-500);
    --color-secondary-lighter: var(--color-secondary-400);
    --color-secondary-light: var(--color-secondary-100);
    --color-secondary-dark: var(--color-secondary-700);

    --color-success: #16a34a;
    --color-success-medium: #19B853;
    --color-success-lighter: #c0f6d4;
    --color-success-light: #e9fcf0;

    --color-info: #2563eb;
    --color-info-medium: #4077ED;
    --color-info-lighter: #bed0f9;
    --color-info-light: #e8eefd;

    --color-warning: #f59e0b;
    --color-warning-medium: #F7B036;
    --color-warning-lighter: #fce4ba;
    --color-warning-light: #fef5e7;

    --color-danger: #dc2626;
    --color-danger-medium: #E24B4B;
    --color-danger-lighter: #f5c2c2;
    --color-danger-light: #fbe9e9;

    /* --- Text --- */
    --color-text: var(--color-black);
    --color-text-muted: var(--color-neutral-400);

    /* --- Borders & Backgrounds --- */
    --color-border: var(--color-neutral-200);
    --color-bg-light: var(--color-neutral-100);
    --color-bg-white: var(--color-white);

    /* --- Effects --- */
    --shadow: 0 4px 30px rgba(0, 0, 0, 0.05);
    --grey-out: rgba(0, 0, 0, 0.4);

    /* --- Typography: Inter Scale --- */
    --font-family: Inter, sans-serif;

    --display-lg-size: 2.44rem;
    --display-lg-weight: 800;
    --display-lg-line-height: 1.55;
    --display-lg-letter-spacing: 0.015em;

    --display-md-size: 2.18rem;
    --display-md-weight: 800;
    --display-md-line-height: 1.55;
    --display-md-letter-spacing: 0.015em;

    --h1-size: 1.95rem;
    --h1-weight: 700;
    --h1-line-height: 1.55;
    --h1-letter-spacing: 0.02em;

    --h2-size: 1.56rem;
    --h2-weight: 600;
    --h2-line-height: 1.55;
    --h2-letter-spacing: 0.02em;

    --h3-size: 1.4rem;
    --h3-weight: 600;
    --h3-line-height: 1.6;
    --h3-letter-spacing: 0.025em;

    --h4-size: 1.25rem;
    --h4-weight: 500;
    --h4-line-height: 1.6;
    --h4-letter-spacing: 0.025em;

    --h5-size: 1.18rem;
    --h5-weight: 500;
    --h5-line-height: 1.6;
    --h5-letter-spacing: 0.03em;

    --h6-size: 1.12rem;
    --h6-weight: 500;
    --h6-line-height: 1.6;
    --h6-letter-spacing: 0.03em;

    --body-xl-size: 1.06rem;
    --body-xl-weight: 400;
    --body-xl-line-height: 1.6;
    --body-xl-letter-spacing: 0.03em;

    --body-size: 1rem;
    --body-weight: 400;
    --body-line-height: 1.6;
    --body-letter-spacing: 0.03em;

    --body-sm-size: 0.89rem;
    --body-sm-weight: 400;
    --body-sm-line-height: 1.65;
    --body-sm-letter-spacing: 0.03em;

    --caption-lg-size: 0.8rem;
    --caption-lg-weight: 400;
    --caption-lg-line-height: 1.65;
    --caption-lg-letter-spacing: 0.03em;

    --caption-size: 0.72rem;
    --caption-weight: 400;
    --caption-line-height: 1.65;
    --caption-letter-spacing: 0.03em;

    --caption-sm-size: 0.64rem;
    --caption-sm-weight: 300;
    --caption-sm-line-height: 1.65;
    --caption-sm-letter-spacing: 0.03em;

    --overline-size: 0.57rem;
    --overline-weight: 500;
    --overline-line-height: 1.65;
    --overline-letter-spacing: 0.03em;

    /* --- Radius --- */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    /* --- Form Design Tokens --- */
    --form-input-height: 40px;
    --form-input-padding: 8px 12px;
    --form-input-font-size: 14px;
    --form-multiline-min-height: 116px;
    --form-multiline-font-size: 15px;
    --form-label-gap: 4px;
    --form-row-gap: 16px;
    --form-group-min-width: 200px;

    /* --- Form State Colors --- */
    --form-border-default: var(--color-neutral-300);
    --form-border-focus: var(--color-primary);
    --form-border-error: var(--color-danger);
    --form-border-success: var(--color-success);
    --form-bg-default: var(--color-white);
    --form-bg-disabled: var(--color-neutral-100);
    --form-bg-focus: var(--color-white);
    --form-text-default: var(--color-text);
    --form-text-disabled: var(--color-text-muted);
    --form-text-error: var(--color-danger);
    --form-text-success: var(--color-success);

    /* --- Popup Design Tokens --- */
    --popup-header-padding: 24px 24px 16px;
    --popup-body-padding: 24px;
    --popup-footer-padding: 16px 24px 24px;
    --popup-z-index: 1001;
    --popup-overlay-z-index: 1000;
    --popup-max-width: 90vw;

    /* --- Popup State Colors --- */
    --popup-bg: var(--color-white);
    --popup-border: var(--color-border);
    --popup-overlay-bg: var(--grey-out);
    --popup-shadow: var(--shadow);

    /* --- Chip Design Tokens --- */
    --chip-padding: 6px 8px;
    --chip-gap: 8px;
    --chip-border-radius: 16px;
    --chip-icon-size: 16px;
    --chip-min-height: 24px;

    /* --- Chip Variant Colors --- */
    --chip-info-bg: var(--color-info-light);
    --chip-info-text: var(--color-info);
    --chip-info-icon: var(--color-info);
    --chip-success-bg: var(--color-success-light);
    --chip-success-text: var(--color-success);
    --chip-success-icon: var(--color-success);
    --chip-warning-bg: var(--color-warning-light);
    --chip-warning-text: var(--color-warning);
    --chip-warning-icon: var(--color-warning);
    --chip-danger-bg: var(--color-danger-light);
    --chip-danger-text: var(--color-danger);
    --chip-danger-icon: var(--color-danger);
    --chip-neutral-bg: var(--color-bg-light);
    --chip-neutral-text: var(--color-text);
    --chip-neutral-icon: var(--color-text-muted);

    /* --- Button Design Tokens --- */
    --btn-height: 40px;
    --btn-padding: 10px 14px;
    --btn-gap: 8px;
    --btn-font-size: 14px;
    --btn-font-weight: 600;
    --btn-border-radius: 10px;
    --btn-icon-size: 16px;
    --btn-transition: background 0.2s, border 0.2s, color 0.2s;

    /* --- Button State Colors --- */
    --btn-primary-bg: var(--color-primary);
    --btn-primary-text: var(--color-white);
    --btn-primary-hover: var(--color-primary-lighter);
    --btn-primary-active: var(--color-primary-dark);
    --btn-primary-border: var(--color-primary);

    --btn-secondary-bg: var(--color-primary-light);
    --btn-secondary-text: var(--color-primary);
    --btn-secondary-hover: var(--color-main-200);
    --btn-secondary-active: var(--color-main-300);
    --btn-secondary-border: transparent;

    --btn-outline-bg: var(--color-white);
    --btn-outline-text: var(--color-neutral-400);
    --btn-outline-hover: var(--color-neutral-100);
    --btn-outline-active: var(--color-neutral-200);
    --btn-outline-border: var(--color-neutral-400);

    --btn-ghost-bg: transparent;
    --btn-ghost-text: var(--color-text);
    --btn-ghost-hover: var(--color-bg-light);
    --btn-ghost-active: var(--color-neutral-200);
    --btn-ghost-border: transparent;

    --btn-disabled-bg: var(--color-neutral-100);
    --btn-disabled-text: var(--color-text-muted);
    --btn-disabled-border: var(--color-neutral-200);

    /* --- Icon Button Design Tokens --- */
    --icon-btn-size: 40px;
    --icon-btn-padding: 12px;
    --icon-btn-border-radius: 10px;
    --icon-btn-icon-size: 16px;
    --icon-btn-transition: background 0.2s;

    /* --- Icon Button State Colors --- */
    --icon-btn-delete-bg: var(--color-danger-light);
    --icon-btn-delete-hover: var(--color-danger-lighter);
    --icon-btn-delete-icon: var(--color-danger);

    --icon-btn-back-bg: var(--color-neutral-100);
    --icon-btn-back-hover: var(--color-neutral-200);
    --icon-btn-back-icon: var(--color-neutral-400);

    /* --- Searchbox Design Tokens --- */
    --searchbox-width: 320px;
    --searchbox-height: 40px;
    --searchbox-gap: 8px;
    --searchbox-padding: 8px 12px;
    --searchbox-icon-size: 16px;
    --searchbox-border-radius: 10px;
    --searchbox-transition: border 0.2s, background 0.2s;

    /* --- Searchbox State Colors --- */
    --searchbox-bg: var(--color-white);
    --searchbox-border: var(--color-neutral-200);
    --searchbox-border-focus: var(--color-primary);
    --searchbox-text: var(--color-text);
    --searchbox-placeholder: var(--color-neutral-400);
    --searchbox-icon: var(--color-neutral-400);

    /* --- Sidebar Design Tokens --- */
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 72px;
    --sidebar-header-height: 80px;
    --sidebar-item-height: 44px;
    --sidebar-item-padding: 0 16px;
    --sidebar-item-gap: 4px;
    --sidebar-icon-size: 20px;
    --sidebar-transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    /* --- Sidebar State Colors --- */
    --sidebar-bg: var(--color-white);
    --sidebar-border: var(--color-border);
    --sidebar-item-bg: transparent;
    --sidebar-item-hover: var(--color-neutral-100);
    --sidebar-item-active: var(--color-primary);
    --sidebar-item-text: var(--color-neutral-600);
    --sidebar-item-text-active: var(--color-white);
    --sidebar-item-icon: var(--color-neutral-400);
    --sidebar-item-icon-active: var(--color-white);
}

/* ================================
     ✍️ TYPOGRAPHY UTILITIES
     ================================ */
.display-lg {
    font-family: var(--font-family);
    font-size: var(--display-lg-size);
    font-weight: var(--display-lg-weight);
    line-height: var(--display-lg-line-height);
    letter-spacing: var(--display-lg-letter-spacing);
}

.display-md {
    font-family: var(--font-family);
    font-size: var(--display-md-size);
    font-weight: var(--display-md-weight);
    line-height: var(--display-md-line-height);
    letter-spacing: var(--display-md-letter-spacing);
}

.h1 {
    font-size: var(--h1-size);
    font-weight: var(--h1-weight);
    line-height: var(--h1-line-height);
    letter-spacing: var(--h1-letter-spacing);
}

.h2 {
    font-size: var(--h2-size);
    font-weight: var(--h2-weight);
    line-height: var(--h2-line-height);
    letter-spacing: var(--h2-letter-spacing);
}

.h3 {
    font-size: var(--h3-size);
    font-weight: var(--h3-weight);
    line-height: var(--h3-line-height);
    letter-spacing: var(--h3-letter-spacing);
}

.h4 {
    font-size: var(--h4-size);
    font-weight: var(--h4-weight);
    line-height: var(--h4-line-height);
    letter-spacing: var(--h4-letter-spacing);
}

.h5 {
    font-size: var(--h5-size);
    font-weight: var(--h5-weight);
    line-height: var(--h5-line-height);
    letter-spacing: var(--h5-letter-spacing);
}

.h6 {
    font-size: var(--h6-size);
    font-weight: var(--h6-weight);
    line-height: var(--h6-line-height);
    letter-spacing: var(--h6-letter-spacing);
}

.body-xl {
    font-size: var(--body-xl-size);
    font-weight: var(--body-xl-weight);
    line-height: var(--body-xl-line-height);
    letter-spacing: var(--body-xl-letter-spacing);
}

.body {
    font-size: var(--body-size);
    font-weight: var(--body-weight);
    line-height: var(--body-line-height);
    letter-spacing: var(--body-letter-spacing);
}

.body-sm {
    font-size: var(--body-sm-size);
    font-weight: var(--body-sm-weight);
    line-height: var(--body-sm-line-height);
    letter-spacing: var(--body-sm-letter-spacing);
}

.caption-lg {
    font-size: var(--caption-lg-size);
    font-weight: var(--caption-lg-weight);
    line-height: var(--caption-lg-line-height);
    letter-spacing: var(--caption-lg-letter-spacing);
}

.caption {
    font-size: var(--caption-size);
    font-weight: var(--caption-weight);
    line-height: var(--caption-line-height);
    letter-spacing: var(--caption-letter-spacing);
}

.caption-sm {
    font-size: var(--caption-sm-size);
    font-weight: var(--caption-sm-weight);
    line-height: var(--caption-sm-line-height);
    letter-spacing: var(--caption-sm-letter-spacing);
}

.overline {
    font-size: var(--overline-size);
    font-weight: var(--overline-weight);
    line-height: var(--overline-line-height);
    letter-spacing: var(--overline-letter-spacing);
    text-transform: uppercase;
}

/* ================================
     📦 LAYOUT COMPONENTS
     ================================ */
.empty-group {
    padding: 0;
    margin: 0;
}

/* Main App Layout */
.app-layout {
    display: flex;
    height: 100vh;
    background: var(--color-neutral-100);
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    /* Prevent whole-page horizontal scrolling; wide tables must scroll inside their own containers. */
    overflow-x: hidden;
    background: var(--color-white);
}

.page-header {
    width: 100%;
    height: 72px;
    padding: 24px 32px;
    background: var(--color-white);
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-sizing: border-box;
    position: sticky;
    top: 0;
    z-index: 10;
}

.page-header-greeting {
    display: flex;
    align-items: center;
    color: var(--color-text);
}

.profile-picture {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    cursor: pointer;
    transition: opacity 0.2s;
}

.profile-picture:hover {
    opacity: 0.8;
}

.profile-picture-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-white);
    color: var(--color-neutral-400);
    font-size: 40px;
}

.profile-picture-icon:hover {
    opacity: 0.8;
}

.profile-dropdown-container {
    position: relative;
}

.profile-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow);
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.2s, visibility 0.2s, transform 0.2s;
    z-index: 1000;
    overflow: hidden;
}

.profile-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.profile-dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--color-text);
    text-decoration: none;
    font-size: var(--body-size);
    font-weight: var(--body-weight);
    transition: background 0.2s;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
}

.profile-dropdown-item:hover {
    background: var(--color-neutral-100);
}

.profile-dropdown-item i {
    width: 16px;
    color: var(--color-text-secondary);
}

.profile-dropdown-item:last-child {
    border-top: 1px solid var(--color-border);
}

.profile-dropdown-item:last-child i {
    color: var(--color-danger);
}

.page-container {
    width: 100%;
    flex: 1;
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-top-left-radius: 24px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    /* Allow inner flex children to create their own scroll areas. */
    min-height: 0;
}

.header-group {
    width: 100%;
    height: 72px;
    display: flex;
    gap: 16px;
    padding: 16px 32px;
    border-bottom: 1px solid var(--color-border);
    background: none;
    box-sizing: border-box;
    justify-content: flex-start;
}

.header-left-group {
    display: flex;
    align-items: center;
    gap: 16px;
}

.body-group {
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 16px 32px;
    background: var(--color-white);
    box-sizing: border-box;
    /* Critical for nested overflow containers (Job list / KPI table) */
    min-height: 0;
}

.kanban-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    height: 100%;
}

.kanban-column {
    background: var(--color-white);
    border-radius: var(--radius-lg);
    padding: 16px;
    border: 1px solid var(--color-border);
}

.kanban-column-title {
    font-size: var(--h4-size);
    font-weight: 700;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid;
    text-align: center;
}

.kanban-column-title.proposal {
    color: var(--color-red);
    border-bottom-color: var(--color-red);
}

.kanban-column-title.tender {
    color: var(--color-secondary-500);
    border-bottom-color: var(--color-secondary-500);
}

.kanban-column-title.awarded {
    color: var(--color-info);
    border-bottom-color: var(--color-info);
}

.kanban-column-title.ongoing {
    color: var(--color-warning);
    border-bottom-color: var(--color-warning);
}

.kanban-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.project-card {
    background: var(--color-white);
    border-radius: var(--radius-md);
    padding: 16px;
    border: 1px solid var(--color-border);
    transition: box-shadow 0.2s;
}

.project-card:hover {
    box-shadow: var(--shadow);
}

.project-name {
    font-size: var(--body-size);
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 8px;
}

.project-category {
    margin-bottom: 8px;
    font-size: var(--body-sm-size);
    font-weight: 400;
    color: var(--color-info);
}

.project-assigned {
    font-size: var(--body-sm-size);
    color: var(--color-text-muted);
    margin: 0;
}

.footer-group {
    width: 100%;
    height: 72px;
    display: flex;
    gap: 16px;
    padding: 16px 32px;
    background: var(--color-white);
    border-left: 1px solid var(--color-border);
    box-sizing: border-box;
    justify-content: flex-end;
}

.container-group {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 24px 32px 32px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    background: var(--color-white);
    box-sizing: border-box;
    margin-bottom: 24px;
}

/* Form Layout Structure */
.form-row {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--form-row-gap);
}

.form-group {
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: var(--form-label-gap);
    /* space between label and input */
    min-width: var(--form-group-min-width);
    /* prevent too-small fields */
    align-items: flex-start;
    /* align labels at the top */
}

.form-group-span-2 {
    grid-column: span 2;
    /* span 2 columns */
}

.form-group-span-3 {
    grid-column: span 3;
    /* span 3 columns */
}

.form-group-span-4 {
    grid-column: span 4;
    /* span all 4 columns */
}

.form-group label {
    font-size: var(--body-size);
    font-weight: 500;
    color: var(--color-text);
    font-family: var(--font-family);
}

/* Required field asterisk styling - use <span class="required-asterisk">*</span> in labels */
.required-asterisk {
    color: var(--color-danger);
}

/* Keep existing input-row-group for backward compatibility */
.input-row-group {
    width: 100%;
    display: flex;
    gap: var(--form-row-gap);
}

.variance-order-list {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: var(--form-row-gap);
}

/* ================================
     🧭 NAVIGATION
     ================================ */
.tab-group {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 16px 32px 0;
    gap: 16px;
}

.navbar-container-group {
    display: flex;
    width: fit-content;
    height: fit-content;
    gap: 0;
    padding: 4px;
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
}

.navbar-btn-group {
    display: flex;
    gap: 0;
}

.navbar-btn {
    width: fit-content;
    height: fit-content;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    background: transparent;
    font-weight: 400;
    font-family: var(--font-family);
    color: var(--color-text);
    border: none;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.navbar-btn.active {
    background: var(--color-primary-light);
    color: var(--color-primary);
    font-weight: 600;
}

.navbar-btn:not(.active):hover {
    background: var(--color-main-50);
}

.navbar-btn a {
    color: inherit;
    text-decoration: none;
}

.navbar-btn a:hover {
    color: inherit;
    text-decoration: none;
}

.tab-panels {
    width: 100%;
}

.tab-panel {
    display: none;
    width: 100%;
}

.tab-panel.active {
    display: block;
}

/* ================================
     📊 TABLES
     ================================ */
.table-group {
    width: 100%;
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    overflow: hidden;
}

.table-content-group {
    width: 100%;
    min-height: 52px;
    display: flex;
    gap: 0;
    padding: 0 16px;
    border-bottom: 1px solid var(--color-border);
    align-items: stretch;
    transition: background 0.2s;
    font-size: var(--body-size);
}

.table-group.table-header {
    font-weight: 500 !important;
    color: var(--color-text);
    font-size: var(--body-size);
}

.table-content-group:hover {
    background: var(--color-bg-light);
}

.table-content-group.table-header {
    background: var(--color-bg-light);
    font-weight: 600;
    color: var(--color-text);
    font-size: var(--body-size);
    border-bottom: 2px solid var(--color-border);
}

.table-content-group.table-header .table-cell-group {
    justify-content: flex-start;
    font-weight: 600;
}

.table-content-group .table-cell-group {
    font-weight: 300;
}

.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    transition: background-color 0.2s;
}

.sortable:hover {
    background-color: var(--color-bg-light);
}

.sort-indicator {
    margin-left: 4px;
    font-weight: 600;
    color: var(--color-primary);
}

.table-content-group.table-header:hover {
    background: var(--color-bg-light);
}

.table-cell-group {
    width: fit-content;
    min-height: 52px;
    padding: 16px;
    display: flex;
    align-items: center;
    font-size: var(--body-size);
    /* Allow text to wrap instead of truncating */
    word-wrap: break-word;
    overflow-wrap: break-word;
    min-width: 0;
    /* Important: allows flex items to shrink below content size */
}

/* Text inside cells should wrap */
.table-cell-group>span,
.table-cell-group>a,
.table-cell-group>div:not(.action-dropdown) {
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    max-width: 100%;
}

.table-footer-group {
    width: 100%;
    height: 62px;
    display: flex;
    gap: 12px;
    padding: 14px 24px 16px;
    align-items: center;
    border-top: 1px solid var(--color-border);
}

.payment-table .table-content-group {
    padding: 0 8px;
}

.payment-table .table-cell-group {
    flex: 1;
    padding: 16px;
    font-size: var(--body-size);
    min-width: 0;
    /* Ensures cells can shrink below content width */
}

.payment-table .table-content-group:last-of-type {
    border-bottom: none;
}

.payment-table .table-cell-customer {
    flex: 2;
}

.payment-table .table-cell-amount,
.payment-table .table-cell-balance {
    justify-content: flex-end;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.payment-table .table-cell-date {
    flex: 1.2;
}

.payment-table .table-cell-company {
    flex: 2;
}

.payment-table .table-cell-contact {
    flex: 1.5;
}

.payment-table .table-cell-category {
    flex: 1.2;
}

.payment-table .table-cell-sales {
    flex: 1.5;
}

.payment-table .table-cell-name {
    flex: 2;
}

.payment-table .table-cell-role {
    flex: 1;
}

.payment-table .table-cell-email {
    flex: 2;
}

.payment-table .table-cell-status {
    flex: 1;
}

.payment-table-footer {
    justify-content: space-between;
}

.table-footer-text {
    font-size: var(--body-sm-size);
    color: var(--color-text-muted);
}

.table-pagination {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.pagination-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    background: var(--color-white);
    color: var(--color-text);
    font-size: var(--body-sm-size);
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border 0.2s;
    padding: 6px;
    min-width: 32px;
}

.pagination-btn:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.pagination-btn.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: var(--color-white);
}

.pagination-btn:disabled,
.pagination-btn.disabled {
    cursor: not-allowed;
    background: var(--color-bg-light);
    border-color: var(--color-border);
    color: var(--color-text-muted);
}

.pagination-btn.icon svg {
    display: block;
}

.table-cell-actions {
    justify-content: center;
    gap: 4px;
}

.table-cell-actions i {
    font-size: 20px;
    line-height: 1;
    color: var(--color-black);
    padding: 8px;
    border-radius: 10px;
    transition: background 0.2s;
    cursor: pointer;
}

.table-cell-actions i:hover {
    background: var(--color-neutral-200);
}

.panel-placeholder {
    width: 100%;
    min-height: 320px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-white);
    border: 1px dashed var(--color-border);
    border-radius: var(--radius-lg);
    color: var(--color-text-muted);
    font-size: var(--body-size);
    font-family: var(--font-family);
}

/* ================================
     📋 FORMS
     ================================ */
.input,
.date-input,
.dropdown {
    width: 100%;
    height: var(--form-input-height);
    padding: var(--form-input-padding);
    background: var(--form-bg-default);
    border: 1px solid var(--form-border-default);
    border-radius: var(--radius-md);
    font-size: var(--form-input-font-size);
    color: var(--form-text-default);
    font-family: var(--font-family);
    box-sizing: border-box;
    transition: background 0.2s, border 0.2s, color 0.2s;
}

.input:focus,
.date-input:focus,
.dropdown:focus {
    outline: none;
    border-color: var(--form-border-focus);
    background: var(--form-bg-focus);
}

.input:disabled,
.date-input:disabled,
.dropdown:disabled {
    background: var(--form-bg-disabled);
    color: var(--form-text-disabled);
    cursor: not-allowed;
}

.input[readonly],
.date-input[readonly] {
    background: var(--color-neutral-100);
    cursor: default;
}

.multiline {
    width: 100%;
    min-height: var(--form-multiline-min-height);
    padding: var(--form-input-padding);
    background: var(--form-bg-default);
    border: 1px solid var(--form-border-default);
    border-radius: var(--radius-md);
    font-size: var(--form-multiline-font-size);
    color: var(--form-text-default);
    font-family: var(--font-family);
    box-sizing: border-box;
    resize: vertical;
    transition: background 0.2s, border 0.2s, color 0.2s;
}

.multiline:focus {
    outline: none;
    border-color: var(--form-border-focus);
    background: var(--form-bg-focus);
}

.multiline:disabled {
    background: var(--form-bg-disabled);
    color: var(--form-text-disabled);
    cursor: not-allowed;
}

.multiline[readonly] {
    background: var(--color-neutral-100);
    cursor: default;
}

/* Form State Classes */
.input.error,
.date-input.error,
.dropdown.error,
.multiline.error {
    border-color: var(--form-border-error);
    color: var(--form-text-error);
}

.input.success,
.date-input.success,
.dropdown.success,
.multiline.success {
    border-color: var(--form-border-success);
    color: var(--form-text-success);
}

.form-group.error label {
    color: var(--form-text-error);
}

.form-group.success label {
    color: var(--form-text-success);
}

/* ================================
     💬 POPUPS
     ================================ */
.popup {
    width: 50vw;
    /* Keep as requested - will be modified per case */
    max-width: var(--popup-max-width);
    background: var(--popup-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--popup-shadow);
    overflow: hidden;
    z-index: var(--popup-z-index);
}

.popup-greyout {
    position: fixed;
    inset: 0;
    background: var(--popup-overlay-bg);
    z-index: var(--popup-overlay-z-index);
    display: flex;
    align-items: center;
    justify-content: center;
}

.popup-header-group {
    width: 100%;
    padding: var(--popup-header-padding);
    border-bottom: 1px solid var(--popup-border);
    box-sizing: border-box;
}

.popup-body-group {
    width: 100%;
    padding: var(--popup-body-padding);
    box-sizing: border-box;
}

.popup-footer-group {
    width: 100%;
    padding: var(--popup-footer-padding);
    border-top: 1px solid var(--popup-border);
    box-sizing: border-box;
}

/* ================================
     🏷️ CHIPS
     ================================ */
.chip {
    display: inline-flex;
    align-items: center;
    gap: var(--chip-gap);
    padding: var(--chip-padding);
    border-radius: var(--chip-border-radius);
    background: var(--chip-info-bg);
    width: fit-content;
    min-height: var(--chip-min-height);
    font-size: var(--body-sm-size);
    font-weight: var(--body-weight);
    line-height: var(--body-line-height);
    letter-spacing: var(--body-letter-spacing);
    font-family: var(--font-family);
    color: var(--chip-info-text);
    box-sizing: border-box;
}

.chip .chip-icon {
    width: var(--chip-icon-size);
    height: var(--chip-icon-size);
    color: var(--chip-info-icon);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Chip Variant Classes */
.chip.success {
    background: var(--chip-success-bg);
    color: var(--chip-success-text);
}

.chip.success .chip-icon {
    color: var(--chip-success-icon);
}

.chip.warning {
    background: var(--chip-warning-bg);
    color: var(--chip-warning-text);
}

.chip.warning .chip-icon {
    color: var(--chip-warning-icon);
}

.chip.danger {
    background: var(--chip-danger-bg);
    color: var(--chip-danger-text);
}

.chip.danger .chip-icon {
    color: var(--chip-danger-icon);
}

.chip.neutral {
    background: var(--chip-neutral-bg);
    color: var(--chip-neutral-text);
}

.chip.neutral .chip-icon {
    color: var(--chip-neutral-icon);
}

/* ================================
     🔘 BUTTONS
     ================================ */
/* Base Button Styles */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--btn-gap);
    height: var(--btn-height);
    padding: var(--btn-padding);
    font-size: var(--btn-font-size);
    font-weight: var(--btn-font-weight);
    font-family: var(--font-family);
    border: 1px solid transparent;
    border-radius: var(--btn-border-radius);
    cursor: pointer;
    transition: var(--btn-transition);
    box-sizing: border-box;
    text-decoration: none;
    outline: none;
}

.btn .icon {
    width: var(--btn-icon-size);
    height: var(--btn-icon-size);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Button Variants */
.btn-primary {
    background: var(--btn-primary-bg);
    color: var(--btn-primary-text);
    border-color: var(--btn-primary-border);
}

.btn-primary:hover {
    background: var(--btn-primary-hover);
    color: var(--btn-primary-text);
}

.btn-primary:active {
    background: var(--btn-primary-active);
    color: var(--btn-primary-text);
}

.btn-primary .icon {
    color: var(--btn-primary-text);
}

.btn-secondary {
    background: var(--btn-secondary-bg);
    color: var(--btn-secondary-text);
    border-color: var(--btn-secondary-border);
}

.btn-secondary:hover {
    background: var(--btn-secondary-hover);
    color: var(--btn-secondary-text);
}

.btn-secondary:active {
    background: var(--btn-secondary-active);
    color: var(--btn-secondary-text);
}

.btn-secondary .icon {
    color: var(--btn-secondary-text);
}

.btn-outline {
    background: var(--btn-outline-bg);
    color: var(--btn-outline-text);
    border-color: var(--btn-outline-border);
}

.btn-outline:hover {
    background: var(--btn-outline-hover);
    color: var(--btn-outline-text);
    border-color: var(--btn-outline-border);
}

.btn-outline:active {
    background: var(--btn-outline-active);
    color: var(--btn-outline-text);
}

.btn-outline .icon {
    color: var(--btn-outline-text);
}

.btn-ghost {
    background: var(--btn-ghost-bg);
    color: var(--btn-ghost-text);
    border-color: var(--btn-ghost-border);
}

.btn-ghost:hover {
    background: var(--btn-ghost-hover);
    color: var(--btn-ghost-text);
}

.btn-ghost:active {
    background: var(--btn-ghost-active);
    color: var(--btn-ghost-text);
}

.btn-ghost .icon {
    color: var(--btn-ghost-text);
}

/* Button States */
.btn:disabled,
.btn.disabled {
    background: var(--btn-disabled-bg);
    color: var(--btn-disabled-text);
    border-color: var(--btn-disabled-border);
    cursor: not-allowed;
    opacity: 0.6;
}

.btn:disabled .icon,
.btn.disabled .icon {
    color: var(--btn-disabled-text);
}

/* Button Sizes */
.btn-sm {
    height: 32px;
    padding: 6px 10px;
    font-size: 12px;
    gap: 6px;
}

.btn-sm .icon {
    width: 14px;
    height: 14px;
}

.btn-lg {
    height: 48px;
    padding: 14px 18px;
    font-size: 16px;
    gap: 10px;
}

.btn-lg .icon {
    width: 18px;
    height: 18px;
}

/* Legacy Button Classes (for backward compatibility) */
.btn-save {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--btn-gap);
    height: var(--btn-height);
    padding: var(--btn-padding);
    font-size: var(--btn-font-size);
    font-weight: var(--btn-font-weight);
    font-family: var(--font-family);
    border-radius: var(--btn-border-radius);
    cursor: pointer;
    transition: var(--btn-transition);
    box-sizing: border-box;
    text-decoration: none;
    outline: none;
    background: var(--color-primary);
    color: var(--color-white);
}

.btn-save:hover {
    background: var(--color-primary-lighter);
    color: var(--color-white);
}

.btn-save .icon {
    width: var(--btn-icon-size);
    height: var(--btn-icon-size);
    color: var(--color-white);
}

.btn-add-row {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--btn-gap);
    height: var(--btn-height);
    padding: var(--btn-padding);
    font-size: var(--btn-font-size);
    font-weight: var(--btn-font-weight);
    font-family: var(--font-family);
    border: 1px solid var(--color-primary);
    border-radius: var(--btn-border-radius);
    cursor: pointer;
    transition: var(--btn-transition);
    box-sizing: border-box;
    text-decoration: none;
    outline: none;
    background: var(--color-white);
    color: var(--color-primary);
    width: fit-content;
}

.btn-add-row:hover {
    background: var(--color-main-50);
    color: var(--color-primary);
}

.btn-add-row .icon {
    width: var(--btn-icon-size);
    height: var(--btn-icon-size);
    color: var(--color-primary);
}

/* Icon Buttons */
.btn-delete {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--icon-btn-size);
    height: var(--icon-btn-size);
    padding: var(--icon-btn-padding);
    background: var(--icon-btn-delete-bg);
    border: none;
    border-radius: var(--icon-btn-border-radius);
    cursor: pointer;
    transition: var(--icon-btn-transition);
    box-sizing: border-box;
}

.btn-delete:hover {
    background: var(--icon-btn-delete-hover);
}

.btn-delete .icon {
    width: var(--icon-btn-icon-size);
    height: var(--icon-btn-icon-size);
    color: var(--icon-btn-delete-icon);
}

.btn-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--icon-btn-size);
    height: var(--icon-btn-size);
    padding: var(--icon-btn-padding);
    background: var(--icon-btn-back-bg);
    border: none;
    border-radius: var(--icon-btn-border-radius);
    cursor: pointer;
    transition: var(--icon-btn-transition);
    box-sizing: border-box;
}

.btn-back:hover {
    background: var(--icon-btn-back-hover);
}

.btn-back .icon {
    width: var(--icon-btn-icon-size);
    height: var(--icon-btn-icon-size);
    color: var(--icon-btn-back-icon);
}

/* ================================
     🔍 SEARCHBOX
     ================================ */
.searchbox {
    display: flex;
    align-items: center;
    gap: var(--searchbox-gap);
    width: var(--searchbox-width);
    height: var(--searchbox-height);
    padding: var(--searchbox-padding);
    background: var(--searchbox-bg);
    border: 1px solid var(--searchbox-border);
    border-radius: var(--searchbox-border-radius);
    box-sizing: border-box;
    transition: var(--searchbox-transition);
}

.searchbox:focus-within {
    border-color: var(--searchbox-border-focus);
    outline: none;
}

.searchbox-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    color: var(--searchbox-text);
    font-family: var(--font-family);
    font-size: var(--body-size);
    font-weight: var(--body-weight);
    line-height: var(--body-line-height);
    letter-spacing: var(--body-letter-spacing);
}

.searchbox-input::placeholder {
    color: var(--searchbox-placeholder);
}

.searchbox-icon {
    width: var(--searchbox-icon-size);
    height: var(--searchbox-icon-size);
    color: var(--searchbox-icon);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* ================================
     📋 FORM SECTIONS
     ================================ */
.form-section {
    width: 100%;
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
    box-sizing: border-box;
}

.form-section-title {
    font-size: var(--h4-size);
    font-weight: var(--h4-weight);
    color: var(--color-text);
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--color-border);
}

.form-actions {
    width: 100%;
    display: flex;
    justify-content: flex-end;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--color-border);
}

.date-input-wrapper {
    position: relative;
    width: 100%;
}

.date-input-wrapper .date-input {
    width: 100%;
    padding-right: 40px;
}

.date-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--color-neutral-400);
    pointer-events: none;
}

/* ================================
     📱 SIDEBAR
     ================================ */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    transition: var(--sidebar-transition);
    box-sizing: border-box;
    overflow: hidden;
    position: relative;
    border-right: 1px solid var(--sidebar-border);
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.sidebar.collapsed .sidebar-header {
    display: flex;
    justify-content: center;
    align-items: center;
}

.sidebar-header {
    height: var(--sidebar-header-height);
    padding: 16px;
    border-bottom: 1px solid var(--sidebar-header-border);
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: var(--h4-size);
    font-weight: var(--h4-weight);
    color: var(--color-text);
    text-decoration: none;
    transition: opacity 0.2s;
    width: 100%;
    height: 100%;
}

.sidebar-logo img {
    width: 100%;
    height: auto;
    display: block;
}

.sidebar-logo-collapsed {
    display: none;
}

.sidebar.collapsed .sidebar-logo {
    opacity: 1;
    pointer-events: auto;
    width: 100%;
    min-width: auto;
    margin: 0;
    flex-basis: auto;
}

.sidebar.collapsed .sidebar-logo-full {
    display: none;
}

.sidebar.collapsed .sidebar-logo-collapsed {
    display: block;
}

.sidebar-toggle {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-muted);
    transition: background 0.2s, color 0.2s;
    flex-shrink: 0;
}

.sidebar-toggle:hover {
    background: var(--color-bg-light);
    color: var(--color-text);
}

.sidebar.collapsed .sidebar-toggle {
    opacity: 1;
    pointer-events: auto;
    display: flex;
    visibility: visible;
    position: relative;
    z-index: 10;
}

.sidebar-nav {
    flex: 1;
    padding: 0;
    padding-bottom: 72px;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
}

.sidebar-footer {
    padding: 2px 10px 8px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    box-sizing: border-box;
    width: fit-content;
    background: none;
    position: absolute;
    bottom: 0;
    left: 0;
    z-index: 10;
}

.sidebar-section {
    margin-bottom: 24px;
}

.sidebar-section-title {
    padding: 24px 28px 8px;
    font-size: 11px;
    font-weight: 700;
    color: var(--color-neutral-400);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 0;
    transition: opacity 0.2s;
}

.sidebar.collapsed .sidebar-section-title {
    opacity: 0;
    pointer-events: none;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 12px;
    height: var(--sidebar-item-height);
    padding: var(--sidebar-item-padding);
    margin: 4px 12px;
    border-radius: 8px;
    background: var(--sidebar-item-bg);
    color: var(--sidebar-item-text);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    font-family: var(--font-family);
    transition: background 0.2s, color 0.2s, box-shadow 0.2s;
    cursor: pointer;
    box-sizing: border-box;
    position: relative;
}

.sidebar-item.sidebar-item--sub {
    margin-left: 24px;
    font-size: 13px;
    height: calc(var(--sidebar-item-height) - 6px);
    opacity: 0.95;
}

.sidebar-item.sidebar-item--sub .sidebar-item-icon {
    width: 14px;
    height: 14px;
    font-size: 14px;
}

.sidebar-item:hover {
    background: var(--sidebar-item-hover);
    color: var(--sidebar-item-text);
}

.sidebar-item.active {
    background: var(--sidebar-item-active);
    color: var(--sidebar-item-text-active);
    font-weight: 600;
    box-shadow: 0 4px 6px -1px var(--color-primary-light);
}

.sidebar-item-icon {
    width: var(--sidebar-icon-size);
    height: var(--sidebar-icon-size);
    font-size: var(--sidebar-icon-size);
    color: var(--sidebar-item-icon);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: color 0.2s;
}

.sidebar-item.active .sidebar-item-icon {
    color: var(--sidebar-item-icon-active);
}

.sidebar-item-text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    transition: opacity 0.2s;
}

.sidebar.collapsed .sidebar-item-text {
    opacity: 0;
    pointer-events: none;
    flex: 0;
    width: 0;
    max-width: 0;
}

.sidebar-item-badge {
    background: var(--color-primary);
    color: var(--color-white);
    font-size: var(--caption-size);
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
}

.sidebar.collapsed .sidebar-item-badge {
    opacity: 0;
    pointer-events: none;
}

.sidebar-footer {
    padding: 2px 10px 8px;
    width: fit-content;
    background: none;
    position: absolute;
    bottom: 0;
    left: 0;
    z-index: 10;
}

/* ================================
   🔽 ACTION DROPDOWN
   ================================ */
.action-dropdown {
    position: relative;
    display: inline-flex;
}

.action-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--color-text-muted);
    transition: background 0.2s, color 0.2s;
}

.action-trigger:hover {
    background: var(--color-neutral-100);
    color: var(--color-text);
}

.action-menu {
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 100;
    min-width: 140px;
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.15s, visibility 0.15s, transform 0.15s;
}

.action-dropdown.active .action-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(4px);
}

.action-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 14px;
    background: none;
    border: none;
    text-align: left;
    font-size: var(--body-sm-size);
    font-weight: 500;
    color: var(--color-text);
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s;
}

.action-menu-item:first-child {
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.action-menu-item:last-child {
    border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.action-menu-item:hover {
    background: var(--color-neutral-100);
}

.action-menu-item.action-delete {
    color: var(--color-danger);
}

.action-menu-item.action-delete:hover {
    background: var(--color-danger-light);
}

.action-menu-item i {
    width: 14px;
    font-size: 12px;
}

/* ================================
   🗑️ DELETE CONFIRMATION MODAL
   ================================ */
.delete-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1100;
}

.delete-modal {
    background: var(--color-white);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
    width: 400px;
    max-width: 90vw;
    overflow: hidden;
}

.delete-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border);
}

.delete-modal-header h3 {
    margin: 0;
    font-size: var(--h4-size);
    font-weight: 600;
}

.delete-modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: none;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--color-text-muted);
    transition: background 0.2s;
}

.delete-modal-close:hover {
    background: var(--color-neutral-100);
}

.delete-modal-body {
    padding: 24px 20px;
    text-align: center;
}

.delete-modal-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 16px;
    background: var(--color-danger-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.delete-modal-icon i {
    font-size: 24px;
    color: var(--color-danger);
}

.delete-modal-body p {
    margin: 0 0 8px;
    font-size: var(--body-size);
    color: var(--color-text);
}

.delete-modal-warning {
    font-size: var(--body-sm-size);
    color: var(--color-text-muted);
}

.delete-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid var(--color-border);
    background: var(--color-neutral-100);
}

/* Danger Button */
.btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--btn-gap);
    height: var(--btn-height);
    padding: var(--btn-padding);
    font-size: var(--btn-font-size);
    font-weight: var(--btn-font-weight);
    border-radius: var(--btn-border-radius);
    border: 1px solid var(--color-danger);
    background: var(--color-danger);
    color: var(--color-white);
    cursor: pointer;
    transition: var(--btn-transition);
}

.btn-danger:hover {
    background: var(--color-danger-medium);
    border-color: var(--color-danger-medium);
}

/* ================================
     ⏱️ ON-TIME KPI
     ================================ */
.otkpi-page {
    /* Shared sizing tokens so left/right headers always align */
    --otkpi-row-h: 52px;
    --otkpi-head-group-h: 24px;
    --otkpi-head-col-h: 44px;
    --otkpi-head-total-h: calc(var(--otkpi-head-group-h) + var(--otkpi-head-col-h));

    /* Split ratio is handled on `.otkpi-split` (60/40). Keep no fixed width here. */

    /*
     * UX: allow this module to extend vertically and use the main page scroll.
     * Users want to view larger row counts (e.g. 50) without being constrained to a tiny
     * viewport inside the split panels.
     */
    flex: 0 0 auto;
    /* Top offset for sticky table headers: stick under the global `.page-header`. */
    --otkpi-sticky-top: var(--app-page-header-h, 72px);

    /* Keep within the content area; wide tables must scroll inside their own containers. */
    max-width: 100%;
}

.otkpi-page .body-group {
    flex: 0 0 auto;
    min-height: auto;
}

.otkpi-page .otkpi-root {
    flex: 0 0 auto;
    min-height: auto;
}

/* Expand the split panels to show all rows for the current page (uses page scroll). */
.otkpi-page .otkpi-table-body,
.otkpi-page .otkpi-kpi-body-scroll {
    flex: 0 0 auto;
    height: calc(var(--otkpi-visible-rows, 10) * var(--otkpi-row-h));
}

.otkpi-live-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 999px;
    background: var(--color-success-light);
    color: var(--color-success);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
    border: 1px solid rgba(22, 163, 74, 0.15);
}

.otkpi-live-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--color-success);
    box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.12);
}

.otkpi-root {
    display: flex;
    flex-direction: column;
    gap: 16px;
    flex: 1;
    min-height: 0;
}

.otkpi-summary-top {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.otkpi-filters {
    background: white;
    border: 1px solid var(--color-border);
    border-radius: 16px;
    padding: 16px 16px 12px;
    box-shadow: var(--shadow);
}

/* Pending actions panel (unclassified delay reasons) */
.otkpi-pending-frame {
    background: white;
    border: 1px solid var(--color-border);
    border-radius: 16px;
    padding: 14px 16px;
    box-shadow: var(--shadow);
}

.otkpi-pending-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.otkpi-pending-title {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.otkpi-pending-title .main {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 950;
    color: var(--color-text);
}

.otkpi-pending-title .count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 18px;
    padding: 0 7px;
    border-radius: 999px;
    background: rgba(245, 158, 11, 0.16);
    border: 1px solid rgba(245, 158, 11, 0.22);
    color: #b45309;
    font-size: 11px;
    font-weight: 950;
    font-variant-numeric: tabular-nums;
}

.otkpi-pending-title .sub {
    font-size: 11px;
    color: var(--color-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.otkpi-pending-actions {
    flex: 0 0 auto;
}

.otkpi-pending-list {
    margin-top: 10px;
    display: flex;
    gap: 8px;
    overflow: auto;
    padding-bottom: 2px;
}

.otkpi-pending-item {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 14px;
    border: 1px solid var(--color-border);
    background: linear-gradient(180deg, #ffffff 0%, #fbfbfb 100%);
    color: var(--color-text);
    cursor: pointer;
    font-size: 12px;
    font-weight: 850;
    transition: background 0.15s, border-color 0.15s, transform 0.05s ease-in-out;
    max-width: 320px;
}

.otkpi-pending-item:hover {
    border-color: rgba(59, 130, 246, 0.35);
    background: rgba(59, 130, 246, 0.06);
}

.otkpi-pending-item:active {
    transform: translateY(1px);
}

.otkpi-pending-item .job {
    font-weight: 950;
}

.otkpi-pending-item .customer {
    color: var(--color-text-muted);
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.otkpi-pending-item .pill {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 18px;
    padding: 0 7px;
    border-radius: 999px;
    background: rgba(239, 68, 68, 0.10);
    border: 1px solid rgba(239, 68, 68, 0.16);
    color: var(--color-danger);
    font-size: 11px;
    font-weight: 950;
    font-variant-numeric: tabular-nums;
}

.otkpi-pending-item--more {
    background: var(--color-neutral-100);
    color: var(--color-text-muted);
}

.otkpi-pending-empty {
    margin-top: 10px;
    font-size: 12px;
    color: var(--color-text-muted);
}

.otkpi-filters-row {
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr 0.4fr auto;
    gap: 12px;
    align-items: end;
}

.otkpi-filters-row--secondary {
    grid-template-columns: 1.3fr 0.5fr 0.5fr 0.45fr 0.45fr 0.35fr 1fr;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--color-border);
}

.otkpi-filters-row--issues {
    grid-template-columns: 0.65fr 1.2fr 1.2fr 0.35fr;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--color-border);
}

.otkpi-filters-row--saved-view {
    grid-template-columns: 1fr 1fr;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--color-border);
}

.otkpi-filter {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.otkpi-filter--actions {
    justify-content: flex-end;
}

.otkpi-filter--compact select,
.otkpi-filter--compact input {
    min-width: 0;
}

.otkpi-filter--toggle {
    align-items: flex-start;
}

.otkpi-filter--meta {
    justify-content: flex-end;
    min-width: 0;
}

.otkpi-filter--saved-view-select,
.otkpi-filter--saved-view-name {
    min-width: 0;
}

.otkpi-saved-view-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
}

.otkpi-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-secondary);
}

.otkpi-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.otkpi-pill-btn {
    height: 32px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid var(--color-border);
    background: white;
    color: var(--color-text);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.otkpi-pill-btn:hover {
    border-color: var(--color-primary);
    background: var(--color-main-50);
}

.otkpi-pill-btn.active {
    border-color: rgba(59, 130, 246, 0.35);
    background: var(--color-primary-light);
    color: var(--color-primary);
}

.otkpi-report-breakdowns {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

/* ================================
     📊 ON-TIME KPI Issues Report
     ================================ */
.otkpi-report-tabs {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px 12px;
    margin: -6px -6px 10px;
    border-bottom: 1px dashed var(--color-border);
    flex-wrap: wrap;
}

.otkpi-report-tab {
    height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid var(--color-border);
    background: white;
    color: var(--color-text-muted);
    font-size: 12px;
    font-weight: 900;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.otkpi-report-tab:hover {
    border-color: rgba(59, 130, 246, 0.35);
    background: rgba(59, 130, 246, 0.06);
    color: var(--color-primary);
}

.otkpi-report-tab.active {
    border-color: rgba(59, 130, 246, 0.35);
    background: var(--color-primary-light);
    color: var(--color-primary);
}

.otkpi-report-sections {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.otkpi-report-section {
    border: 1px solid var(--color-border);
    border-radius: 16px;
    /* Sticky table headers should stick to the page scroll; do not create a new scroll container here. */
    overflow: visible;
    background: white;
    max-width: 100%;
    min-width: 0;
}

.otkpi-report-section-head {
    padding: 12px 14px;
    border-bottom: 1px solid var(--color-border);
    background: linear-gradient(180deg, #ffffff 0%, #fafafa 100%);
}

.otkpi-report-section-head-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.otkpi-report-jumps {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.otkpi-report-section-head .t {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 950;
    color: var(--color-text);
}

.otkpi-report-section-head .t .n {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 18px;
    padding: 0 7px;
    border-radius: 999px;
    background: var(--color-neutral-100);
    border: 1px solid var(--color-border);
    color: var(--color-text-muted);
    font-size: 11px;
    font-weight: 950;
    font-variant-numeric: tabular-nums;
}

.otkpi-report-section-head .s {
    margin-top: 3px;
    font-size: 11px;
    color: var(--color-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* New report table layout: sticky header wrapper + horizontally scrollable body (mirrors On-Time KPI page) */
.otkpi-report-table-frame {
    max-width: 100%;
    background: white;
}

.otkpi-report-head-scroll {
    position: sticky;
    top: var(--otkpi-sticky-top, 0px);
    z-index: 20;
    background: white;
    overflow: hidden;
    max-width: 100%;
    box-shadow: 0 10px 28px -26px rgba(15, 23, 42, 0.45);
}

.otkpi-report-head-inner {
    width: max-content;
}

.otkpi-report-body-scroll {
    overflow-x: auto;
    overflow-y: visible;
    max-width: 100%;
    background: white;
}

.otkpi-report-body-inner {
    width: max-content;
}

.otkpi-report-sizer th,
.otkpi-report-sizer td {
    padding: 0 !important;
    border: 0 !important;
    height: 0 !important;
    line-height: 0 !important;
    font-size: 0 !important;
}

.otkpi-report-table {
    /* Prefer horizontal scrolling (readable) over squeezing columns (unreadable). */
    /* Fixed width prevents the browser from squeezing the table to fit the viewport. */
    width: max-content;
    min-width: max-content;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
    --otkpi-report-group-h: 38px;
}

.otkpi-report-table,
.otkpi-report-table th,
.otkpi-report-table td,
.otkpi-report-table col {
    box-sizing: border-box;
}

.otkpi-report-table thead tr.otkpi-report-groups th {
    height: var(--otkpi-report-group-h);
    padding: 0 12px;
    background: linear-gradient(135deg, #fff7ed 0%, #ffffff 100%);
    border-bottom: 1px solid var(--color-border);
    border-right: 1px solid var(--color-border);
    font-size: 11px;
    font-weight: 950;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    text-align: left;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.otkpi-report-table thead tr.otkpi-report-groups th:last-child {
    border-right: none;
}

.otkpi-report-table thead tr.otkpi-report-cols th {
    background: linear-gradient(180deg, #ffffff 0%, #fafafa 100%);
    border-bottom: 1px solid var(--color-border);
    border-right: 1px solid var(--color-border);
    font-size: 11px;
    font-weight: 950;
    padding: 10px 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: left;
}

.otkpi-report-table thead tr.otkpi-report-cols th:last-child {
    border-right: none;
}

.otkpi-report-th-sub {
    margin-left: 6px;
    font-size: 10px;
    font-weight: 950;
    color: var(--color-text-muted);
}

.otkpi-report-table tbody td {
    border-bottom: 1px solid var(--color-border);
    border-right: 1px solid var(--color-border);
    padding: 10px 12px;
    font-size: 12px;
    vertical-align: top;
    background: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.otkpi-report-table tbody td:last-child {
    border-right: none;
}

.otkpi-report-table tbody tr:hover td {
    background: var(--color-neutral-100);
}

.otkpi-report-table td.job,
.otkpi-report-table th.job {
    background: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.otkpi-report-table col.job.status,
.otkpi-report-table th.job.status,
.otkpi-report-table td.job.status {
    width: 170px;
    min-width: 170px;
    max-width: 170px;
}

.otkpi-report-table col.job.job_no,
.otkpi-report-table th.job.job_no,
.otkpi-report-table td.job.job_no {
    width: 170px;
    min-width: 170px;
    max-width: 170px;
}

.otkpi-report-table col.job.container_no,
.otkpi-report-table th.job.container_no,
.otkpi-report-table td.job.container_no {
    width: 180px;
    min-width: 180px;
    max-width: 180px;
}

.otkpi-report-table col.job.customer,
.otkpi-report-table th.job.customer,
.otkpi-report-table td.job.customer {
    width: 250px;
    min-width: 250px;
    max-width: 250px;
}

.otkpi-report-table col.job.pic,
.otkpi-report-table th.job.pic,
.otkpi-report-table td.job.pic {
    width: 150px;
    min-width: 150px;
    max-width: 150px;
}

.otkpi-report-table col.job.eta,
.otkpi-report-table th.job.eta,
.otkpi-report-table td.job.eta {
    width: 140px;
    min-width: 140px;
    max-width: 140px;
}

.otkpi-report-table col.job.ata,
.otkpi-report-table th.job.ata,
.otkpi-report-table td.job.ata {
    width: 200px;
    min-width: 200px;
    max-width: 200px;
}

.otkpi-report-table col.job.doc,
.otkpi-report-table th.job.doc,
.otkpi-report-table td.job.doc {
    width: 210px;
    min-width: 210px;
    max-width: 210px;
    color: var(--color-text-muted);
    font-variant-numeric: tabular-nums;
}

.otkpi-report-table col.job.doc.copy_ori_fe,
.otkpi-report-table th.job.doc.copy_ori_fe,
.otkpi-report-table td.job.doc.copy_ori_fe {
    width: 230px;
    min-width: 230px;
    max-width: 230px;
}

.otkpi-report-table col.milestone,
.otkpi-report-table th.milestone,
.otkpi-report-table td.milestone {
    width: 200px;
    min-width: 200px;
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--color-text-muted);
    font-variant-numeric: tabular-nums;
}

.otkpi-report-table col.metric,
.otkpi-report-table th.metric,
.otkpi-report-table td.metric {
    width: 280px;
    min-width: 280px;
    max-width: 280px;
    font-variant-numeric: tabular-nums;
}

.otkpi-report-table td.metric.status-on_time {
    background: var(--color-success-light);
    color: var(--color-success);
    font-weight: 900;
}

.otkpi-report-table td.metric.status-delay {
    background: var(--color-danger-light);
    color: var(--color-danger);
    font-weight: 900;
}

.otkpi-report-table td.metric.status-pending {
    background: var(--color-neutral-100);
    color: var(--color-text-muted);
    font-weight: 700;
}

.otkpi-report-table td.metric.status-monitor {
    background: #f8fafc;
    color: #64748b;
    font-weight: 850;
}

.otkpi-report-metric-top {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: space-between;
}

.otkpi-report-metric-top .v {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.otkpi-report-flag {
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: rgba(255, 255, 255, 0.55);
    font-size: 11px;
    font-weight: 950;
    color: inherit;
    user-select: none;
    flex: 0 0 auto;
}

.otkpi-report-flag.party-unclassified {
    border-color: rgba(245, 158, 11, 0.28);
    background: rgba(245, 158, 11, 0.18);
    color: #b45309;
}

.otkpi-report-flag.party-customer {
    border-color: rgba(59, 130, 246, 0.22);
    background: rgba(59, 130, 246, 0.12);
    color: var(--color-primary);
}

.otkpi-report-flag.party-team {
    border-color: rgba(34, 197, 94, 0.22);
    background: rgba(34, 197, 94, 0.14);
    color: var(--color-success);
}

.otkpi-report-flag.party-other {
    border-color: rgba(245, 158, 11, 0.24);
    background: rgba(245, 158, 11, 0.16);
    color: #b45309;
}

.otkpi-report-reason {
    margin-top: 6px;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 8px;
    border-radius: 999px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: rgba(148, 163, 184, 0.10);
    color: rgba(15, 23, 42, 0.72);
    font-size: 11px;
    font-weight: 850;
    min-width: 0;
}

.otkpi-report-reason .txt {
    flex: 1 1 auto;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.otkpi-report-reason.is-pending {
    border-color: rgba(245, 158, 11, 0.26);
    background: rgba(245, 158, 11, 0.12);
    color: #b45309;
}

.otkpi-report-reason-sub {
    flex: 0 0 auto;
    padding: 2px 6px;
    border-radius: 999px;
    border: 1px solid rgba(59, 130, 246, 0.22);
    background: rgba(59, 130, 246, 0.12);
    color: var(--color-primary);
    font-size: 10px;
    font-weight: 950;
    line-height: 1.1;
}

.otkpi-report-select {
    margin-top: 6px;
    width: 100%;
    min-width: 220px;
    height: 34px;
    font-size: 12px;
    font-weight: 700;
}

.otkpi-report-noopts {
    margin-top: 6px;
    font-size: 11px;
    color: var(--color-text-muted);
}

.otkpi-report-hint {
    margin-top: 6px;
    font-size: 11px;
    color: var(--color-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 280px;
}

.otkpi-toggle {
    position: relative;
    width: 44px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
}

.otkpi-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.otkpi-toggle-ui {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: var(--color-neutral-300);
    transition: background 0.2s;
}

.otkpi-toggle-ui::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 999px;
    background: white;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
    transition: transform 0.2s;
}

.otkpi-toggle input:checked + .otkpi-toggle-ui {
    background: var(--color-primary);
}

.otkpi-toggle input:checked + .otkpi-toggle-ui::after {
    transform: translateX(18px);
}

.otkpi-meta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 12px;
    background: var(--color-neutral-100);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    font-size: 12px;
    color: var(--color-text-muted);
    white-space: nowrap;
    max-width: 100%;
    overflow: hidden;
}

.otkpi-meta-v {
    color: var(--color-text);
    font-weight: 700;
}

.otkpi-meta-updated {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.otkpi-meta-sep {
    margin: 0 6px;
    color: var(--color-neutral-400);
}

.otkpi-split {
    display: grid;
    /* 50/50 split (Job table / KPI table) */
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    align-items: stretch;
    flex: 1;
    min-width: 0;
    min-height: 0;
}

.otkpi-split.is-collapsed {
    grid-template-columns: 1fr 84px;
}

.otkpi-panel {
    background: white;
    border: 1px solid var(--color-border);
    border-radius: 18px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    /* Critical: allow grid items to shrink so wide tables don't force page horizontal scroll. */
    min-width: 0;
    min-height: 0;
    /*
     * Sticky headers rely on overflow being visible on ancestors so they stick to the page scroll.
     * Horizontal overflow is clipped by `.main-content` (and tables scroll inside their own bodies).
     */
    overflow: visible;
}

.otkpi-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--color-border);
    background: linear-gradient(180deg, #ffffff 0%, #fafafa 100%);
    /* Preserve rounded panel corners without relying on overflow clipping. */
    border-top-left-radius: 18px;
    border-top-right-radius: 18px;
}

.otkpi-panel-title {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.otkpi-panel-title-main {
    font-size: 14px;
    font-weight: 800;
    color: var(--color-text);
}

.otkpi-panel-title-sub {
    font-size: 12px;
    color: var(--color-text-muted);
}

.otkpi-panel-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.otkpi-panel-divider {
    width: 1px;
    height: 22px;
    background: var(--color-border);
    margin: 0 4px;
}

.otkpi-split.is-collapsed .otkpi-panel--right .otkpi-kpi-frame {
    display: none;
}

.otkpi-split.is-collapsed .otkpi-panel--right .otkpi-panel-actions .btn-ghost {
    display: none;
}

.otkpi-collapsed-hint {
    padding: 12px 12px 16px;
    font-size: 12px;
    color: var(--color-text-muted);
    text-align: center;
}

.otkpi-table-frame {
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
    flex: 1;
    /* Match KPI panel: .otkpi-kpi-frame has 12px top padding before header. */
    padding-top: 12px;
}

.otkpi-table-head {
    flex: 0 0 auto;
    /* Sticky column header while the *page* scrolls. */
    position: sticky;
    top: var(--otkpi-sticky-top, 0px);
    z-index: 20;
    background: white;
    box-shadow: 0 10px 28px -26px rgba(15, 23, 42, 0.45);
}

.otkpi-jobs-head {
    /* Keep Job List header aligned with horizontally scrollable body */
    overflow-x: auto;
    overflow-y: hidden;
    max-width: 100%;
    scrollbar-width: none; /* Firefox */
}

.otkpi-jobs-head::-webkit-scrollbar {
    height: 0; /* Chrome/Safari */
}

.otkpi-table-body {
    flex: 1;
    min-height: 0;
    overflow: auto;
    max-width: 100%;
}

.otkpi-table-foot {
    flex: 0 0 auto;
}

.otkpi-jobs-row {
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--color-border);
    background: white;
    /* Force horizontal overflow to be scrollable (instead of squeezing columns). */
    width: max-content;
    min-width: 100%;
}

.otkpi-jobs-row--head {
    /* Fine-tune alignment: slightly taller than KPI header. */
    height: 70px;
    background: var(--color-bg-light);
    font-weight: 800;
    color: var(--color-text);
    border-bottom: 2px solid var(--color-border);
}

.otkpi-jobs-row--body {
    height: var(--otkpi-row-h);
}

.otkpi-jobs-row--body:hover {
    background: var(--color-neutral-100);
}

.otkpi-jobs-row--body.status-delay {
    border-left: 4px solid var(--color-danger);
    background: var(--color-danger-light);
}

.otkpi-jobs-row--body.status-on_time {
    border-left: 4px solid var(--color-success);
}

.otkpi-jobs-row--body.status-pending {
    border-left: 4px solid var(--color-neutral-300);
}

.otkpi-jobs-cell {
    padding: 0 12px;
    font-size: 12px;
    color: var(--color-text);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.otkpi-jobs-cell.jobno { flex: 0 0 120px; }
.otkpi-jobs-cell.container { flex: 0 0 140px; }
.otkpi-jobs-cell.customer { flex: 0 0 260px; }
.otkpi-jobs-cell.booking { flex: 0 0 160px; color: var(--color-text-muted); }
.otkpi-jobs-cell.inv { flex: 0 0 160px; color: var(--color-text-muted); }
.otkpi-jobs-cell.eta { flex: 0 0 100px; color: var(--color-text-muted); }
.otkpi-jobs-cell.ata { flex: 0 0 170px; color: var(--color-text-muted); }
.otkpi-jobs-cell.draft_bl { flex: 0 0 170px; color: var(--color-text-muted); }
.otkpi-jobs-cell.bl { flex: 0 0 170px; color: var(--color-text-muted); }
.otkpi-jobs-cell.draft_invoice { flex: 0 0 180px; color: var(--color-text-muted); }
.otkpi-jobs-cell.invoice { flex: 0 0 170px; color: var(--color-text-muted); }
.otkpi-jobs-cell.packing_list { flex: 0 0 190px; color: var(--color-text-muted); }
.otkpi-jobs-cell.copy_ori_fe { flex: 0 0 200px; color: var(--color-text-muted); }
.otkpi-jobs-cell.others { flex: 0 0 170px; color: var(--color-text-muted); }
.otkpi-jobs-cell.issue { flex: 0 0 84px; display: flex; justify-content: flex-end; }

/* Pinned (sticky) Job No + Issue columns while scrolling horizontally */
.otkpi-jobs-cell.jobno {
    position: sticky;
    left: 0;
    z-index: 5;
    background: inherit;
    border-right: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: 10px 0 14px -14px rgba(15, 23, 42, 0.28);
}

.otkpi-jobs-cell.issue {
    position: sticky;
    right: 0;
    z-index: 5;
    background: inherit;
    border-left: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: -10px 0 14px -14px rgba(15, 23, 42, 0.28);
}

.otkpi-jobs-row--head .otkpi-jobs-cell.jobno,
.otkpi-jobs-row--head .otkpi-jobs-cell.issue {
    z-index: 7;
}

.otkpi-jobno {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    max-width: 100%;
}

.otkpi-jobno-link {
    color: inherit;
    text-decoration: none;
    display: block;
    min-width: 0;
    max-width: 100%;
}

.otkpi-jobno-link:hover {
    color: var(--color-primary);
    text-decoration: underline;
}

.otkpi-jobno-main {
    display: block;
    min-width: 0;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.otkpi-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--color-primary-light);
    color: var(--color-primary);
    font-size: 11px;
    font-weight: 800;
    border: 1px solid rgba(59, 130, 246, 0.18);
}

.otkpi-go-btn {
    height: 32px;
    padding: 0 10px;
    border-radius: 10px;
    border: 1px solid var(--color-border);
    background: white;
    color: var(--color-text);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background 0.15s, border-color 0.15s;
}

.otkpi-go-btn:hover {
    background: var(--color-main-50);
    border-color: var(--color-primary);
}

.otkpi-go-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.otkpi-empty {
    padding: 32px 16px;
    text-align: center;
    color: var(--color-text-muted);
}

.otkpi-card {
    border: 1px solid var(--color-border);
    border-radius: 16px;
    padding: 12px 14px;
    background: linear-gradient(180deg, #ffffff 0%, #fbfbfb 100%);
}

.otkpi-card-k {
    font-size: 12px;
    color: var(--color-text-muted);
    font-weight: 700;
}

.otkpi-card-v {
    margin-top: 6px;
    font-size: 20px;
    font-weight: 900;
    color: var(--color-text);
    font-variant-numeric: tabular-nums;
}

.otkpi-card-v.danger { color: var(--color-danger); }
.otkpi-card-v.neutral { color: var(--color-text-muted); }

.otkpi-card-h {
    margin-top: 6px;
    font-size: 11px;
    color: var(--color-text-muted);
}

.otkpi-kpi-frame {
    flex: 1;
    min-height: 0;
    min-width: 0;
    padding: 12px 16px 16px;
    display: flex;
    flex-direction: column;
}

.otkpi-kpi {
    flex: 1;
    min-height: 0;
    height: 100%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--color-border);
    border-radius: 16px;
    background: white;
    /* Sticky header needs to escape clipping when the page scrolls. */
    overflow: visible;
}

.otkpi-kpi-head-scroll {
    flex: 0 0 auto;
    background: var(--color-bg-light);
    border-bottom: 1px solid var(--color-border);
    overflow: hidden;
    max-width: 100%;
    /* Ensure KPI headers stay visible while scrolling the KPI rows */
    position: sticky;
    top: var(--otkpi-sticky-top, 0px);
    z-index: 20;
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    box-shadow: 0 10px 28px -26px rgba(15, 23, 42, 0.45);
}

.otkpi-kpi-head-inner {
    width: max-content;
}

.otkpi-kpi-groups,
.otkpi-kpi-cols,
.otkpi-kpi-row {
    display: flex;
    width: max-content;
}

.otkpi-kpi-body-inner {
    width: max-content;
}

.otkpi-kpi-groups {
    border-bottom: 1px solid var(--color-border);
}

.otkpi-kpi-group {
    height: var(--otkpi-head-group-h);
    padding: 0 12px;
    display: flex;
    align-items: center;
    font-size: 12px;
    font-weight: 900;
    color: var(--color-text);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-right: 1px solid var(--color-border);
    background: linear-gradient(135deg, #fff7ed 0%, #ffffff 100%);
}

.otkpi-kpi-group:last-child {
    border-right: none;
}

.otkpi-kpi-col {
    height: var(--otkpi-head-col-h);
    padding: 6px 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-right: 1px solid var(--color-border);
    overflow: hidden;
}

.otkpi-kpi-col:last-child {
    border-right: none;
}

.otkpi-kpi-col-label {
    font-size: 11px;
    font-weight: 800;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.otkpi-kpi-col-target {
    margin-top: 2px;
    font-size: 10px;
    color: var(--color-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.otkpi-kpi-body-scroll {
    flex: 1;
    min-height: 0;
    overflow: auto;
    /* Allow page scroll chaining when the KPI body itself doesn't need vertical scrolling. */
    overscroll-behavior: auto;
    max-width: 100%;
    border-bottom-left-radius: 16px;
    border-bottom-right-radius: 16px;
}

.otkpi-kpi-row {
    height: var(--otkpi-row-h);
    border-bottom: 1px solid var(--color-border);
    background: white;
}

.otkpi-kpi-cell {
    height: var(--otkpi-row-h);
    padding: 0 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-right: 1px solid var(--color-border);
    font-size: 13px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--color-text);
    background: white;
    white-space: nowrap;
}

.otkpi-kpi-flag {
    margin-left: auto;
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    border: 1px solid var(--color-border);
    font-size: 11px;
    font-weight: 950;
    line-height: 1;
    user-select: none;
    font-variant-numeric: tabular-nums;
}

.otkpi-kpi-flag.party-unclassified {
    background: rgba(245, 158, 11, 0.18);
    border-color: rgba(245, 158, 11, 0.28);
    color: #b45309;
}

.otkpi-kpi-flag.party-customer {
    background: rgba(59, 130, 246, 0.12);
    border-color: rgba(59, 130, 246, 0.22);
    color: var(--color-primary);
}

.otkpi-kpi-flag.party-team {
    background: rgba(34, 197, 94, 0.14);
    border-color: rgba(34, 197, 94, 0.22);
    color: var(--color-success);
}

.otkpi-kpi-flag.party-other {
    background: rgba(245, 158, 11, 0.16);
    border-color: rgba(245, 158, 11, 0.24);
    color: #b45309;
}

.otkpi-kpi-cell:last-child {
    border-right: none;
}

.otkpi-kpi-cell.status-delay {
    background: var(--color-danger-light);
    color: var(--color-danger);
}

.otkpi-kpi-cell.status-on_time {
    background: var(--color-success-light);
    color: var(--color-success);
}

.otkpi-kpi-cell.status-pending {
    background: var(--color-neutral-100);
    color: var(--color-text-muted);
    font-weight: 600;
}

.otkpi-kpi-cell.status-monitor {
    background: #f8fafc;
    color: #64748b;
    font-weight: 650;
}

.otkpi-flash {
    outline: 2px solid rgba(59, 130, 246, 0.55);
    outline-offset: -2px;
    animation: otkpiFlash 1.1s ease-out;
}

@keyframes otkpiFlash {
    0% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.45); }
    60% { box-shadow: 0 0 0 8px rgba(59, 130, 246, 0.12); }
    100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
}

.otkpi-card-h-sub {
    display: block;
    margin-top: 4px;
    color: var(--color-text-muted);
}

.otkpi-pill-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 18px;
    padding: 0 6px;
    border-radius: 999px;
    background: rgba(239, 68, 68, 0.12);
    color: var(--color-danger);
    border: 1px solid rgba(239, 68, 68, 0.18);
    font-size: 11px;
    font-weight: 900;
    margin-left: 6px;
    font-variant-numeric: tabular-nums;
}

.otkpi-jobs-row--body.status-excluded {
    border-left: 4px solid var(--color-primary);
    background: rgba(59, 130, 246, 0.06);
}

/* Issues drawer */
.otkpi-issue-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--grey-out);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    z-index: 1200;
}

.otkpi-issue-overlay.show {
    opacity: 1;
    visibility: visible;
}

.otkpi-issue-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: min(1040px, 100vw);
    max-width: 100vw;
    height: 100vh;
    background: var(--color-white);
    box-shadow: -4px 0 30px rgba(0, 0, 0, 0.1);
    transform: translateX(100%);
    transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1201;
    display: flex;
    flex-direction: column;
}

.otkpi-issue-panel.show {
    transform: translateX(0);
}

.otkpi-issue-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-white);
    flex-shrink: 0;
}

.otkpi-issue-panel-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 900;
    color: var(--color-text);
}

.otkpi-issue-panel-title i {
    color: var(--color-danger);
}

.otkpi-issue-panel-sub {
    margin-left: 8px;
    font-size: 12px;
    font-weight: 700;
    color: var(--color-text-muted);
}

.otkpi-issue-panel-body {
    padding: 14px 16px 18px;
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
}

.otkpi-issue-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.otkpi-issue-search {
    position: relative;
    flex: 1 1 340px;
    min-width: 240px;
}

.otkpi-issue-search i {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    color: var(--color-text-muted);
    pointer-events: none;
}

.otkpi-issue-search input {
    padding-left: 30px;
}

.otkpi-issue-pending-only {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 12px;
    border: 1px solid var(--color-border);
    background: var(--color-neutral-100);
    font-size: 12px;
    font-weight: 900;
    color: var(--color-text-muted);
    cursor: pointer;
    user-select: none;
}

.otkpi-issue-pending-only input {
    width: 16px;
    height: 16px;
    accent-color: var(--color-primary);
}

.otkpi-issue-pending {
    border: 1px solid var(--color-border);
    border-radius: 16px;
    padding: 12px 12px 10px;
    background: linear-gradient(180deg, #ffffff 0%, #fbfbfb 100%);
}

.otkpi-issue-pending-head .t {
    font-size: 12px;
    font-weight: 950;
    color: var(--color-text);
}

.otkpi-issue-pending-head .s {
    margin-top: 2px;
    font-size: 11px;
    color: var(--color-text-muted);
}

.otkpi-issue-pending-list {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.otkpi-issue-pending-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 14px;
    border: 1px solid var(--color-border);
    background: white;
    color: var(--color-text);
    cursor: pointer;
    font-size: 12px;
    font-weight: 850;
    max-width: 100%;
}

.otkpi-issue-pending-item:hover {
    border-color: rgba(59, 130, 246, 0.35);
    background: rgba(59, 130, 246, 0.06);
}

.otkpi-issue-pending-item .job {
    font-weight: 950;
}

.otkpi-issue-pending-item .customer {
    color: var(--color-text-muted);
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.otkpi-issue-pending-item .pill {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 18px;
    padding: 0 7px;
    border-radius: 999px;
    background: rgba(239, 68, 68, 0.10);
    border: 1px solid rgba(239, 68, 68, 0.16);
    color: var(--color-danger);
    font-size: 11px;
    font-weight: 950;
    font-variant-numeric: tabular-nums;
}

.otkpi-issue-pending-empty {
    margin-top: 10px;
    font-size: 12px;
    color: var(--color-text-muted);
}

.otkpi-issue-stats {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
}

.otkpi-issue-stat {
    border: 1px solid var(--color-border);
    border-radius: 16px;
    padding: 10px 12px;
    background: linear-gradient(180deg, #ffffff 0%, #fbfbfb 100%);
}

.otkpi-issue-stat .k {
    font-size: 11px;
    color: var(--color-text-muted);
    font-weight: 800;
}

.otkpi-issue-stat .v {
    margin-top: 4px;
    font-size: 16px;
    font-weight: 950;
    color: var(--color-text);
    font-variant-numeric: tabular-nums;
}

.otkpi-issue-stat .h {
    margin-top: 2px;
    font-size: 11px;
    color: var(--color-text-muted);
}

.otkpi-issue-stat .v.neutral { color: var(--color-text-muted); }
.otkpi-issue-stat .v.customer { color: var(--color-primary); }
.otkpi-issue-stat .v.team { color: var(--color-success); }
.otkpi-issue-stat .v.other { color: #b45309; }

.otkpi-issue-breakdown {
    border: 1px solid var(--color-border);
    border-radius: 16px;
    background: white;
    overflow: hidden;
}

.otkpi-issue-breakdown > summary {
    cursor: pointer;
    padding: 12px 14px;
    font-weight: 900;
    font-size: 12px;
    background: var(--color-bg-light);
    border-bottom: 1px solid var(--color-border);
}

.otkpi-issue-breakdown-body {
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.otkpi-issue-breakdown-row {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: flex-start;
    border-bottom: 1px dashed var(--color-border);
    padding-bottom: 10px;
}

.otkpi-issue-breakdown-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.otkpi-issue-breakdown-row .name {
    min-width: 0;
}

.otkpi-issue-breakdown-row .label {
    font-size: 12px;
    font-weight: 900;
    color: var(--color-text);
}

.otkpi-issue-breakdown-row .meta {
    margin-top: 2px;
    font-size: 11px;
    color: var(--color-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 420px;
}

.otkpi-issue-breakdown-row .counts {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-end;
    flex: 0 0 auto;
}

.otkpi-issue-breakdown-row .pill {
    font-size: 11px;
    font-weight: 900;
    padding: 3px 8px;
    border-radius: 999px;
    background: var(--color-neutral-100);
    border: 1px solid var(--color-border);
    color: var(--color-text-muted);
    font-variant-numeric: tabular-nums;
}

.otkpi-issue-breakdown-row .pill.neutral {
    background: var(--color-neutral-100);
    color: var(--color-text-muted);
}

.otkpi-issue-breakdown-row .pill.customer {
    background: rgba(59, 130, 246, 0.10);
    border-color: rgba(59, 130, 246, 0.18);
    color: var(--color-primary);
}

.otkpi-issue-breakdown-row .pill.team {
    background: rgba(34, 197, 94, 0.12);
    border-color: rgba(34, 197, 94, 0.18);
    color: var(--color-success);
}

.otkpi-issue-breakdown-row .pill.other {
    background: rgba(245, 158, 11, 0.14);
    border-color: rgba(245, 158, 11, 0.2);
    color: #b45309;
}

.otkpi-issue-joblist {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.otkpi-issue-job {
    border: 1px solid var(--color-border);
    border-radius: 16px;
    background: white;
    overflow: hidden;
}

.otkpi-issue-job-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 12px;
    border-bottom: 1px solid var(--color-border);
    background: linear-gradient(180deg, #ffffff 0%, #fafafa 100%);
}

.otkpi-issue-job-head .lhs {
    min-width: 0;
}

.otkpi-issue-jobno {
    display: inline-block;
    font-size: 13px;
    font-weight: 950;
    color: inherit;
    text-decoration: none;
}

.otkpi-issue-jobno:hover {
    color: var(--color-primary);
    text-decoration: underline;
}

.otkpi-issue-job-head .meta {
    margin-top: 3px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--color-text-muted);
    min-width: 0;
}

.otkpi-issue-job-head .meta .container,
.otkpi-issue-job-head .meta .customer {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 340px;
}

.otkpi-issue-job-head .rhs {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.otkpi-priority {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    border: 1px solid var(--color-border);
    font-size: 11px;
    font-weight: 950;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.otkpi-priority.action_needed {
    background: rgba(245, 158, 11, 0.16);
    border-color: rgba(245, 158, 11, 0.22);
    color: #b45309;
}

.otkpi-priority.team_delay {
    background: rgba(239, 68, 68, 0.10);
    border-color: rgba(239, 68, 68, 0.16);
    color: var(--color-danger);
}

.otkpi-priority.other_delay {
    background: rgba(245, 158, 11, 0.14);
    border-color: rgba(245, 158, 11, 0.20);
    color: #b45309;
}

.otkpi-priority.customer_delay {
    background: rgba(59, 130, 246, 0.10);
    border-color: rgba(59, 130, 246, 0.18);
    color: var(--color-primary);
}

.otkpi-priority.with_issues {
    background: rgba(100, 116, 139, 0.12);
    border-color: rgba(100, 116, 139, 0.22);
    color: #334155;
}

.otkpi-issue-job-mini {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 24px;
    padding: 0 9px;
    border-radius: 999px;
    background: var(--color-neutral-100);
    border: 1px solid var(--color-border);
    color: var(--color-text-muted);
    font-size: 11px;
    font-weight: 900;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.otkpi-issue-job-mini.pending {
    background: rgba(245, 158, 11, 0.14);
    border-color: rgba(245, 158, 11, 0.20);
    color: #b45309;
}

.otkpi-issue-job-body {
    display: flex;
    flex-direction: column;
}

.otkpi-issue-row {
    display: grid;
    grid-template-columns: 260px 92px 92px 1fr 140px 84px;
    gap: 10px;
    align-items: start;
    padding: 10px 12px;
    border-bottom: 1px dashed var(--color-border);
}

.otkpi-issue-row:last-child {
    border-bottom: none;
}

.otkpi-issue-row.party-unclassified {
    background: rgba(245, 158, 11, 0.08);
}

.otkpi-issue-row .cond .label {
    font-size: 12px;
    font-weight: 950;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.otkpi-issue-row .cond .meta {
    margin-top: 2px;
    font-size: 11px;
    color: var(--color-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.otkpi-issue-row .num .k {
    font-size: 10px;
    font-weight: 900;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.otkpi-issue-row .num .v {
    margin-top: 2px;
    font-size: 12px;
    font-weight: 950;
    color: var(--color-text);
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.otkpi-issue-row .reason {
    min-width: 0;
}

.otkpi-issue-row .focus {
    display: flex;
    justify-content: flex-end;
}

.otkpi-issue-row .party {
    display: flex;
    justify-content: flex-end;
}

.otkpi-jump-highlight {
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25), 0 10px 26px rgba(59, 130, 246, 0.08);
    animation: otkpiJump 1.4s ease-out;
}

@keyframes otkpiJump {
    0% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.0); }
    35% { box-shadow: 0 0 0 6px rgba(59, 130, 246, 0.10); }
    100% { box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25), 0 10px 26px rgba(59, 130, 246, 0.08); }
}

.otkpi-issue-select {
    width: 100%;
    min-width: 260px;
}

.otkpi-issue-table-wrap {
    border: 1px solid var(--color-border);
    border-radius: 16px;
    background: white;
    overflow: auto;
}

.otkpi-issue-table {
    width: 100%;
    min-width: 1200px;
    border-collapse: separate;
    border-spacing: 0;
}

.otkpi-issue-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: linear-gradient(180deg, #ffffff 0%, #fafafa 100%);
    border-bottom: 1px solid var(--color-border);
    text-align: left;
    font-size: 12px;
    font-weight: 900;
    padding: 10px 12px;
    white-space: nowrap;
}

.otkpi-issue-table tbody td {
    border-bottom: 1px solid var(--color-border);
    padding: 10px 12px;
    font-size: 12px;
    vertical-align: top;
}

.otkpi-issue-table tbody tr:hover {
    background: var(--color-neutral-100);
}

.otkpi-issue-table tbody td.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.otkpi-issue-link {
    color: inherit;
    text-decoration: none;
    font-weight: 900;
    display: block;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.otkpi-issue-link:hover {
    color: var(--color-primary);
    text-decoration: underline;
}

.otkpi-issue-cond .label {
    font-weight: 900;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 240px;
}

.otkpi-issue-cond .meta {
    margin-top: 2px;
    font-size: 11px;
    color: var(--color-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 240px;
}

.otkpi-issue-party {
    display: inline-flex;
    flex-direction: column;
    gap: 2px;
    padding: 6px 10px;
    border-radius: 14px;
    border: 1px solid var(--color-border);
    font-size: 11px;
    font-weight: 950;
    text-align: left;
    line-height: 1.1;
}

.otkpi-issue-party .sub {
    font-size: 10px;
    font-weight: 900;
    color: var(--color-text-muted);
}

.otkpi-issue-party.unclassified {
    background: var(--color-neutral-100);
    color: var(--color-text-muted);
}

.otkpi-issue-party.customer {
    background: rgba(59, 130, 246, 0.10);
    border-color: rgba(59, 130, 246, 0.18);
    color: var(--color-primary);
}

.otkpi-issue-party.team {
    background: rgba(34, 197, 94, 0.12);
    border-color: rgba(34, 197, 94, 0.18);
    color: var(--color-success);
}

.otkpi-issue-party.other {
    background: rgba(245, 158, 11, 0.14);
    border-color: rgba(245, 158, 11, 0.2);
    color: #b45309;
}

.otkpi-issue-hint {
    margin-top: 6px;
    font-size: 11px;
    color: var(--color-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.otkpi-issue-noopts {
    font-size: 11px;
    color: var(--color-text-muted);
    line-height: 1.25;
}

.otkpi-issue-settings-link {
    margin-left: 6px;
    color: var(--color-primary);
    font-weight: 800;
    text-decoration: none;
}

.otkpi-issue-settings-link:hover {
    text-decoration: underline;
}

.otkpi-issue-empty {
    padding: 14px 12px;
    color: var(--color-text-muted);
    text-align: center;
}

@media (max-width: 1200px) {
    .otkpi-split {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1100px) {
    .otkpi-filters-row {
        grid-template-columns: 1fr 1fr;
    }

    .otkpi-filters-row--secondary {
        grid-template-columns: 1fr 1fr;
    }

    .otkpi-filters-row--issues {
        grid-template-columns: 1fr 1fr;
    }

    .otkpi-filters-row--saved-view {
        grid-template-columns: 1fr;
    }

    /* Give ATA presets and meta row full width when space is tight */
    .otkpi-filters-row--secondary .otkpi-filter--wide {
        grid-column: 1 / -1;
    }

    .otkpi-filters-row--secondary .otkpi-filter--meta {
        grid-column: 1 / -1;
        justify-content: flex-start;
    }

    .otkpi-report-breakdowns {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 700px) {
    .otkpi-filters-row,
    .otkpi-filters-row--secondary,
    .otkpi-filters-row--saved-view {
        grid-template-columns: 1fr;
    }

    .otkpi-saved-view-actions {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1000px) {
    .otkpi-summary-top {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}


.btn-danger:active {
    background: #b91c1c;
    border-color: #b91c1c;
}

/* ================================
   🔔 NOTIFICATION PANEL
   ================================ */

/* Notification Bell Button */
.notification-bell-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    background: var(--color-neutral-100);
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
    color: var(--color-neutral-400);
    font-size: 18px;
}

.notification-bell-btn:hover {
    background: var(--color-neutral-200);
    color: var(--color-text);
    transform: scale(1.05);
}

.notification-bell-btn:active {
    transform: scale(0.95);
}

/* Notification Badge */
.notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-danger);
    color: var(--color-white);
    font-size: 10px;
    font-weight: 700;
    border-radius: 9px;
    border: 2px solid var(--color-white);
}

.notification-badge-critical {
    background: var(--color-danger);
}

.notification-badge-warning {
    background: var(--color-warning);
}

.notification-badge-notice {
    background: var(--color-info);
}

/* Notification Panel Overlay */
.notification-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--grey-out);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 998;
}

.notification-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* Notification Panel - Full Height Slide-in Drawer */
.notification-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 420px;
    max-width: 100vw;
    height: 100vh;
    background: var(--color-white);
    box-shadow: -4px 0 30px rgba(0, 0, 0, 0.1);
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 999;
    display: flex;
    flex-direction: column;
}

.notification-panel.show {
    transform: translateX(0);
}

/* Panel Header */
.notification-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-white);
    flex-shrink: 0;
}

.notification-panel-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: var(--h4-size);
    font-weight: 600;
    color: var(--color-text);
}

.notification-panel-title i {
    color: var(--color-primary);
}

.notification-panel-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.notification-more-details-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: linear-gradient(135deg, var(--color-primary-light) 0%, #e0e7ff 100%);
    color: var(--color-primary);
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.2s;
}

.notification-more-details-btn:hover {
    background: var(--color-primary);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.notification-more-details-btn i {
    font-size: 11px;
}

.notification-panel-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: var(--color-neutral-100);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.2s;
    color: var(--color-neutral-400);
}

.notification-panel-close:hover {
    background: var(--color-neutral-200);
    color: var(--color-text);
}

/* Panel Content */
.notification-panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

/* Loading & Empty States */
.notification-loading,
.notification-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 48px 24px;
    text-align: center;
    color: var(--color-text-muted);
}

.notification-loading i,
.notification-empty i {
    font-size: 32px;
}

.notification-empty i {
    color: var(--color-success);
}

.notification-empty p {
    margin: 0;
    font-size: var(--body-sm-size);
}

/* Notification Categories */
.notification-category {
    margin-bottom: 16px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.notification-category-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--color-neutral-100);
    cursor: pointer;
    transition: background 0.2s;
    user-select: none;
}

.notification-category-header:hover {
    background: var(--color-neutral-200);
}

.notification-category-title {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: var(--body-size);
    color: var(--color-text);
}

.notification-category-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: var(--color-primary);
    color: var(--color-white);
    font-size: 11px;
    font-weight: 600;
    border-radius: 10px;
}

.notification-category-dept {
    font-size: var(--body-sm-size);
    color: var(--color-text-muted);
}

.notification-category-arrow {
    color: var(--color-neutral-400);
    transition: transform 0.2s;
}

.notification-category-items {
    max-height: 450px;
    overflow-y: auto;
    transition: max-height 0.3s ease;
}

.notification-category-items.collapsed {
    max-height: 0;
    overflow: hidden;
}

/* Notification Items */
.notification-item {
    display: block;
    padding: 16px;
    border-top: 1px solid var(--color-border);
    text-decoration: none;
    color: var(--color-text);
    transition: background 0.2s;
}

.notification-item:hover {
    background: var(--color-neutral-100);
}

.notification-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.notification-item-level {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.notification-item-level-1 .notification-item-level {
    background: var(--color-info-light);
    color: var(--color-info);
}

.notification-item-level-2 .notification-item-level {
    background: var(--color-warning-light);
    color: var(--color-warning);
}

.notification-item-level-3 .notification-item-level {
    background: var(--color-danger-light);
    color: var(--color-danger);
}

.notification-item-time {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: var(--caption-lg-size);
    color: var(--color-text-muted);
}

.notification-item-job {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.notification-item-job-number {
    font-weight: 600;
    color: var(--color-primary);
}

.notification-item-customer {
    font-size: var(--body-sm-size);
    color: var(--color-text-muted);
}

.notification-item-message {
    font-size: var(--body-sm-size);
    color: var(--color-text);
    line-height: 1.5;
    margin-bottom: 8px;
}

.notification-item-message-zh {
    font-size: var(--caption-lg-size);
    color: var(--color-text-muted);
    line-height: 1.5;
}

/* Urgency Level Borders */
.notification-item-level-1 {
    border-left: 3px solid var(--color-info);
}

.notification-item-level-2 {
    border-left: 3px solid var(--color-warning);
}

.notification-item-level-3 {
    border-left: 3px solid var(--color-danger);
    background: var(--color-danger-light);
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    .notification-panel {
        width: 100vw;
    }
}

/* ================================
   🔔 NOTIFICATION TOAST POPUP
   ================================ */

/* Toast Container for Stacking */
.notification-toast-container {
    position: fixed;
    top: 80px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 1100;
    pointer-events: none;
    max-height: calc(100vh - 100px);
    overflow: hidden;
}

.notification-toast {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-width: 380px;
    max-width: 440px;
    padding: 14px 16px;
    background: var(--color-white);
    border-radius: var(--radius-md);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    border-left: 4px solid var(--color-info);
    cursor: pointer;
    transform: translateX(120%);
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease, margin 0.3s ease;
    pointer-events: auto;
    flex-shrink: 0;
}

.notification-toast.show {
    transform: translateX(0);
    opacity: 1;
}

.notification-toast-notice {
    border-left-color: var(--color-info);
}

.notification-toast-warning {
    border-left-color: var(--color-warning);
    background: var(--color-warning-light);
}

.notification-toast-critical {
    border-left-color: var(--color-danger);
    background: var(--color-danger-light);
    animation: pulse-critical 1s ease-in-out infinite;
}

@keyframes pulse-critical {

    0%,
    100% {
        box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    }

    50% {
        box-shadow: 0 8px 30px rgba(220, 38, 38, 0.3);
    }
}

.notification-toast-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--color-info-light);
    color: var(--color-info);
    font-size: 14px;
    flex-shrink: 0;
}

.notification-toast-notice .notification-toast-icon {
    background: var(--color-info-light);
    color: var(--color-info);
}

.notification-toast-warning .notification-toast-icon {
    background: var(--color-warning-lighter);
    color: var(--color-warning);
}

.notification-toast-critical .notification-toast-icon {
    background: var(--color-danger-lighter);
    color: var(--color-danger);
}

.notification-toast-content {
    flex: 1;
    min-width: 0;
}

/* Individual Notification Toast Styles */
.notification-toast-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.notification-toast-level {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.notification-toast-notice .notification-toast-level {
    color: var(--color-info);
}

.notification-toast-warning .notification-toast-level {
    color: var(--color-warning);
}

.notification-toast-critical .notification-toast-level {
    color: var(--color-danger);
}

.notification-toast-time {
    font-size: 11px;
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

.notification-toast-job {
    font-size: var(--body-sm-size);
    color: var(--color-text);
    margin-bottom: 4px;
}

.notification-toast-job strong {
    color: var(--color-primary);
}

.notification-toast-title {
    font-size: var(--body-size);
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 4px;
}

.notification-toast-message {
    font-size: 12px;
    color: var(--color-text-muted);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.notification-toast-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: var(--color-neutral-400);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background 0.2s, color 0.2s;
    flex-shrink: 0;
}

.notification-toast-close:hover {
    background: var(--color-neutral-200);
    color: var(--color-text);
}

/* Mobile toast positioning */
@media (max-width: 480px) {
    .notification-toast-container {
        top: auto;
        bottom: 24px;
        right: 16px;
        left: 16px;
    }

    .notification-toast {
        min-width: auto;
        max-width: none;
    }
}

/* ================================
   📊 ENTRIES TABLE (Financial Summary)
   ================================ */
.entries-table-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.entries-table {
    min-width: 1400px;
    /* Ensures minimum width for the table */
}

.entries-table .table-content-group {
    min-width: 1400px;
}

.entries-table .table-cell-group {
    padding: 12px 8px;
    white-space: normal;
    /* Allow text to wrap */
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Job Index - Documents completion pill */
.job-docs-index-pill {
    display: inline-flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 0;
    box-sizing: border-box;
    min-height: 24px;
    padding: 3px 10px;
    border-radius: 999px;
    border: 1px solid var(--color-border);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.2px;
    line-height: 1.1;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    max-width: 100%;
    min-width: 0;
}

.job-docs-index-count {
    font-weight: 900;
    line-height: 1;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.job-docs-index-check {
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.job-docs-index-check svg {
    width: 18px;
    height: 18px;
    display: block;
}

.table-cell-group > .job-docs-index-pill {
    /* Override generic `.table-cell-group > span` wrapping rules. */
    white-space: nowrap;
}

.job-docs-index-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    flex: 0 0 auto;
}

.job-docs-index-pill.complete .job-docs-index-dot {
    background: #22c55e;
}

.job-docs-index-pill.incomplete .job-docs-index-dot {
    background: #f59e0b;
}

.job-docs-index-label {
    font-weight: 900;
    letter-spacing: 0;
    text-transform: none;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.job-docs-index-pill.complete {
    background: var(--color-success-light, #dcfce7);
    color: #166534;
    border-color: #bbf7d0;
}

.job-docs-index-pill.incomplete {
    background: rgba(245, 158, 11, 0.10);
    color: #92400e;
    border-color: rgba(245, 158, 11, 0.25);
}

.job-docs-index-pill-count {
    box-sizing: border-box;
    min-height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.06);
    border: 1px solid rgba(15, 23, 42, 0.10);
    font-size: 11px;
    font-weight: 900;
    color: rgba(15, 23, 42, 0.75);
    line-height: 1;
    font-variant-numeric: tabular-nums;
    flex: 0 0 auto;
    white-space: nowrap;
}

/* ================================
     🧾 JOB HISTORY LOG
   ================================ */
.empty-state {
    border: 1px dashed var(--color-neutral-300);
    border-radius: 12px;
    background: var(--color-neutral-100);
}

.empty-title {
    font-weight: 800;
    color: var(--color-text);
    margin-bottom: 4px;
}

.empty-sub {
    color: var(--color-neutral-400);
    font-size: 13px;
}

.job-history {
    position: relative;
    padding-left: 28px;
    margin-top: 14px;
}

.job-history::before {
    content: "";
    position: absolute;
    left: 12px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--color-neutral-200);
}

.job-history-item {
    position: relative;
    padding: 14px 16px;
    margin: 0 0 12px 0;
    background: var(--color-white);
    border: 1px solid var(--color-neutral-200);
    border-radius: 12px;
}

.job-history-item::before {
    content: "";
    position: absolute;
    left: -22px;
    top: 20px;
    width: 12px;
    height: 12px;
    border-radius: 999px;
    background: var(--color-white);
    border: 2px solid var(--color-primary);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.03);
}

.job-history-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    color: var(--color-neutral-400);
    margin-bottom: 6px;
}

.job-history-meta-left {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.job-history-meta-right {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.job-history-title {
    font-size: 14px;
    font-weight: 800;
    color: var(--color-text);
    margin-bottom: 4px;
}

.job-history-context {
    font-size: 12px;
    color: var(--color-neutral-400);
}

.job-history-changes {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed var(--color-neutral-200);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.job-history-change {
    display: grid;
    grid-template-columns: 160px minmax(0, 1fr) 20px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    font-size: 12px;
}

.job-history-field {
    color: var(--color-neutral-400);
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.job-history-from,
.job-history-to {
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.job-history-arrow {
    text-align: center;
    color: var(--color-neutral-300);
    font-weight: 900;
}

.job-history-snapshot {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed var(--color-neutral-200);
    font-size: 12px;
    color: var(--color-neutral-400);
}

.job-history-snapshot-k {
    font-weight: 900;
    margin-bottom: 4px;
}

.job-history-snapshot-v {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 12px;
    color: rgba(15, 23, 42, 0.75);
    word-break: break-word;
}

/* ================================
     ⏱️ ON-TIME KPI HISTORY TABLE
   ================================ */
.otkpi-history-table-wrap {
    overflow: auto;
    background: white;
    border: 1px solid var(--color-border);
    border-radius: 14px;
}

.otkpi-history-table {
    width: 100%;
    min-width: 2100px; /* allow horizontal scroll for dense audit info */
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
}

.otkpi-history-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: linear-gradient(180deg, #ffffff 0%, #fafafa 100%);
    border-bottom: 1px solid var(--color-border);
    border-right: 1px solid var(--color-border);
    font-size: 11px;
    font-weight: 950;
    padding: 10px 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: left;
}

.otkpi-history-table thead th:last-child {
    border-right: none;
}

.otkpi-history-table tbody td {
    border-bottom: 1px solid var(--color-border);
    border-right: 1px solid var(--color-border);
    padding: 10px 12px;
    font-size: 12px;
    vertical-align: top;
    background: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.otkpi-history-table tbody td:last-child {
    border-right: none;
}

.otkpi-history-table tbody tr:hover td {
    background: var(--color-neutral-100);
}
