.sticky_th {
    background-color: #242735 !important;
    color: #FFFFFF !important;
    position: sticky;
    top: 6px;
    z-index: 10;
}

.sticky_header_title {
    background-color: #ffffff; /* Match modal background */
    position: sticky;
    top: -16px;
    z-index: 15;
    font-size: 1.1rem;
}

/* Sticky left Reference# column */
#mo-table th.sticky-th-left,
#mo-table td.sticky-col {
    position: sticky;
    left: 0;
    z-index: 11;
    background: white;
    border-right: 1px solid #dee2e6;
}

/* Increase z-index for top-left corner cell
#mo-table thead th.sticky-th-left {
    z-index: 4;
} */

#mo-table {
  table-layout: auto !important;
  width: 100%;
  min-width: 900px;  /* Ensure enough space for scrolling */
}

#mo-table th, #mo-table td {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  vertical-align: middle;
}


/* Increase z-index for top-left corner cell
#mo-table thead th.sticky-th-left {
    z-index: 4;
} */

/* ══════════════════════════════════════════════════════════════
   MO Portal Styles — style.css
   Path: manufacturing/static/src/css/style.css
   ══════════════════════════════════════════════════════════════ */

/* ── Wrapper ── */
.mo-portal-wrapper { margin: 0 -12px; }

/* ── Toolbar ── */
.mo-toolbar { background: #fff; border-bottom: 1px solid #e4e7ec; }
.mo-toolbar-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 20px; flex-wrap: wrap; gap: 10px;
}
.mo-toolbar-row:first-child { border-bottom: 1px solid #f0f1f4; }
.mo-toolbar-filters { padding: 8px 20px 12px; }

/* Breadcrumb */
.mo-breadcrumb-nav .breadcrumb { font-size: 15px; font-weight: 600; }
.mo-breadcrumb-nav .breadcrumb-item a { color: #1a1a2e; text-decoration: none; }
.mo-breadcrumb-nav .breadcrumb-item.active { color: #1a1a2e; }

/* ══════════════════════════════════════
   CUSTOM DROPDOWN (Branch)
   ══════════════════════════════════════ */
.mo-dropdown { position: relative; display: inline-block; }
.mo-dropdown-toggle {
    display: inline-flex; align-items: center; gap: 8px;
    background: #f8f9fc; border: 1px solid #d0d5dd; border-radius: 10px;
    padding: 8px 14px; font-size: 13px; font-weight: 500; color: #344054;
    cursor: pointer; min-width: 210px; transition: all .2s; outline: none;
}
.mo-dropdown-toggle:hover {
    background: #1a1a2e; border-color: #1a1a2e; color: #fff;
}
.mo-dropdown-toggle:hover .mo-dd-icon,
.mo-dropdown-toggle:hover .mo-dd-arrow { color: #fff; }
.mo-dd-icon { color: #1a1a2e; font-size: 13px; transition: color .2s; }
.mo-dd-label { flex: 1; text-align: left; }
.mo-dd-arrow { font-size: 10px; color: #667085; transition: all .2s; margin-left: auto; }

/* Open state */
.mo-dropdown.open .mo-dropdown-toggle {
    background: #1a1a2e; border-color: #1a1a2e; color: #fff;
    border-radius: 10px 10px 0 0;
}
.mo-dropdown.open .mo-dd-icon,
.mo-dropdown.open .mo-dd-arrow { color: #fff; }
.mo-dropdown.open .mo-dd-arrow { transform: rotate(180deg); }

/* Menu */
.mo-dropdown-menu {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    background: #fff; border: 1px solid #e4e7ec; border-top: none;
    border-radius: 0 0 10px 10px; box-shadow: 0 8px 24px rgba(0,0,0,.1);
    z-index: 1050; max-height: 240px; overflow-y: auto; padding: 4px 0;
}
.mo-dropdown.open .mo-dropdown-menu { display: block; }

.mo-dd-item {
    display: flex; align-items: center; padding: 9px 14px;
    font-size: 13px; color: #344054; cursor: pointer;
    transition: all .12s; border-left: 3px solid transparent;
}
.mo-dd-item:hover { background: #f4f5f9; border-left-color: #1a1a2e; color: #1a1a2e; }
.mo-dd-item.active { background: #1a1a2e; color: #fff; border-left-color: #1a1a2e; font-weight: 600; }
.mo-dd-item.active:hover { background: #2a2a4e; color: #fff; }
.mo-dd-item i { width: 18px; text-align: center; font-size: 12px; }

/* Scrollbar */
.mo-dropdown-menu::-webkit-scrollbar { width: 5px; }
.mo-dropdown-menu::-webkit-scrollbar-track { background: transparent; }
.mo-dropdown-menu::-webkit-scrollbar-thumb { background: #d0d5dd; border-radius: 4px; }

/* ── Live Search ── */
.mo-live-search {
    position: relative; display: flex; align-items: center; min-width: 300px;
}
.mo-search-icon {
    position: absolute; left: 12px; color: #98a2b3; font-size: 13px; pointer-events: none;
}
.mo-search-input {
    width: 100%; border: 1px solid #d0d5dd; border-radius: 10px;
    padding: 8px 36px 8px 34px; font-size: 13px; color: #344054;
    outline: none; background: #fff; transition: all .2s;
}
.mo-search-input:focus {
    border-color: #1a1a2e; box-shadow: 0 0 0 3px rgba(26,26,46,.08);
}
.mo-search-input::placeholder { color: #98a2b3; }
.mo-search-clear {
    position: absolute; right: 8px; background: #e4e7ec; border: none;
    border-radius: 50%; width: 22px; height: 22px;
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: 11px; color: #667085;
}
.mo-search-clear:hover { background: #1a1a2e; color: #fff; }

/* ── Pagination ── */
.mo-pagination { display: flex; align-items: center; gap: 10px; }
.mo-page-info { font-size: 13px; color: #475467; font-weight: 500; }
.mo-page-range { font-weight: 700; color: #1a1a2e; }
.mo-page-of { color: #98a2b3; margin: 0 3px; }
.mo-page-btns { display: flex; gap: 4px; }
.mo-page-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border: 1px solid #d0d5dd; border-radius: 8px;
    color: #344054; text-decoration: none; font-size: 14px;
    transition: all .15s; background: #fff;
}
.mo-page-btn:hover:not(.disabled) {
    background: #1a1a2e; color: #fff; border-color: #1a1a2e;
}
.mo-page-btn.disabled { opacity: .3; pointer-events: none; }
.mo-ppg-select {
    border: 1px solid #d0d5dd; border-radius: 8px; padding: 5px 8px;
    font-size: 12px; font-weight: 500; color: #344054; background: #fff; cursor: pointer;
}

/* Bottom Pagination */
.mo-pagination-bottom {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 20px; background: #fff; border-top: 1px solid #e4e7ec;
}
.mo-page-info-bottom { font-size: 13px; color: #667085; }
.mo-page-nav-bottom { display: flex; align-items: center; gap: 4px; }
.mo-page-current {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 56px; height: 32px; font-size: 13px; font-weight: 600;
    color: #1a1a2e; background: #f4f5f9; border: 1px solid #e4e7ec;
    border-radius: 8px; padding: 0 10px;
}
.mo-page-sep { color: #98a2b3; margin: 0 4px; }

/* ── Table ── */
.mo-table-card {
    background: #fff; border-radius: 0; overflow: hidden;
    border-top: 1px solid #e4e7ec; border-bottom: 1px solid #e4e7ec;
}
.mo-table { margin-bottom: 0; font-size: 13px; border-collapse: collapse; }
.mo-table td {
    padding: 8px 12px; vertical-align: middle;
    border-bottom: 1px solid #f0f1f4; border-top: none;
}
.mo-th {
    background: #1a1a2e !important; color: #fff !important;
    font-size: 11px; font-weight: 700; text-transform: uppercase;
    letter-spacing: .5px; padding: 10px 12px !important;
    border: none !important; white-space: nowrap;
}
.mo-table img { max-height: 44px; max-width: 44px; border-radius: 6px; }
.mo-group-header td {
    padding: 9px 12px !important; font-size: 13px;
    background: #f4f5f9 !important;
    border-bottom: 1px solid #e4e7ec !important; border-top: none !important;
}
.mo-sub-group-header td {
    padding: 7px 12px !important; font-size: 12px;
    background: #fafbfd !important;
    border-bottom: 1px solid #f0f1f4 !important; border-top: none !important;
}
.mo-table tbody tr.mo-sub-row:hover td { background: #f4f5f9; }

/* Hide default portal pager */
.o_portal_pager { display: none !important; }

/* ══════════════════════════════════════
   FLOATING MESSENGER
   ══════════════════════════════════════ */

/* Chat Bubble */
.mo-chat-bubble {
    position: fixed; bottom: 24px; right: 24px; width: 56px; height: 56px;
    background: #1a1a2e; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 22px; cursor: pointer; z-index: 9998;
    box-shadow: 0 4px 16px rgba(26,26,46,.35); transition: all .25s ease;
}
.mo-chat-bubble:hover {
    transform: scale(1.1); box-shadow: 0 6px 24px rgba(26,26,46,.45);
}

/* Unread Badge */
.mo-chat-badge {
    position: absolute; top: -2px; right: -2px;
    min-width: 20px; height: 20px; padding: 0 5px;
    background: #e74c3c; color: #fff; border-radius: 10px;
    font-size: 11px; font-weight: 700; line-height: 20px;
    text-align: center; border: 2px solid #fff;
    display: none;
    animation: moBadgePop .3s ease;
}
.mo-chat-badge.show { display: block; }
@keyframes moBadgePop {
    0% { transform: scale(0); } 50% { transform: scale(1.2); } 100% { transform: scale(1); }
}

/* Chat Window */
.mo-chat-window {
    position: fixed; bottom: 92px; right: 24px; width: 380px;
    background: #fff; border-radius: 16px;
    box-shadow: 0 12px 48px rgba(0,0,0,.15);
    z-index: 9999; display: flex; flex-direction: column; overflow: hidden;
    border: 1px solid #e4e7ec; animation: moChatSlideUp .25s ease;
    max-height: calc(100vh - 140px);
}
@keyframes moChatSlideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Header */
.mo-chat-header {
    background: #1a1a2e; color: #fff; padding: 14px 16px;
    display: flex; align-items: center; justify-content: space-between;
}
.mo-chat-header-info { display: flex; align-items: center; gap: 10px; }
.mo-chat-avatar {
    width: 36px; height: 36px; background: rgba(255,255,255,.15);
    border-radius: 50%; display: flex; align-items: center;
    justify-content: center; font-size: 16px;
}
.mo-chat-name { font-size: 14px; font-weight: 600; }
.mo-chat-status {
    font-size: 11px; color: rgba(255,255,255,.7);
    display: flex; align-items: center; gap: 4px;
}
.mo-status-dot {
    width: 7px; height: 7px; background: #2ecc71;
    border-radius: 50%; display: inline-block;
}
.mo-chat-header-actions { display: flex; gap: 4px; }
.mo-chat-header-actions button {
    background: rgba(255,255,255,.1); border: none; color: #fff;
    width: 28px; height: 28px; border-radius: 6px; cursor: pointer;
    font-size: 12px; transition: all .15s;
    display: flex; align-items: center; justify-content: center;
}
.mo-chat-header-actions button:hover { background: rgba(255,255,255,.25); }

/* Body */
.mo-chat-body {
    flex: 1; overflow-y: auto; padding: 16px;
    min-height: 250px; max-height: 300px; background: #f8f9fc;
}
.mo-chat-loading {
    text-align: center; color: #98a2b3; padding: 40px 0; font-size: 13px;
}

/* Message Bubbles */
.mo-msg { display: flex; gap: 8px; margin-bottom: 12px; max-width: 90%; }
.mo-msg.me { margin-left: auto; flex-direction: row-reverse; }
.mo-msg-avatar {
    width: 30px; height: 30px; border-radius: 50%;
    flex-shrink: 0; object-fit: cover;
    background: #e4e7ec;
}
.mo-msg-content { max-width: calc(100% - 40px); }
.mo-msg-bubble {
    padding: 8px 12px; border-radius: 12px; font-size: 13px;
    line-height: 1.45; word-break: break-word;
}
.mo-msg:not(.me) .mo-msg-bubble {
    background: #fff; border: 1px solid #e4e7ec; border-radius: 4px 12px 12px 12px;
}
.mo-msg.me .mo-msg-bubble {
    background: #1a1a2e; color: #fff; border-radius: 12px 4px 12px 12px;
}
.mo-msg-author { font-size: 11px; font-weight: 600; color: #1a1a2e; margin-bottom: 2px; }

/* Reply-to quote */
.mo-reply-quote {
    background: #eef0f5; border-left: 3px solid #1a1a2e;
    border-radius: 4px; padding: 5px 8px; margin-bottom: 4px;
    font-size: 11px; max-width: 100%;
}
.mo-msg.me .mo-reply-quote {
    background: rgba(255,255,255,.15); border-left-color: rgba(255,255,255,.5);
}
.mo-reply-author { font-weight: 600; color: #1a1a2e; margin-bottom: 1px; }
.mo-msg.me .mo-reply-author { color: rgba(255,255,255,.8); }
.mo-reply-text {
    color: #667085; white-space: nowrap; overflow: hidden;
    text-overflow: ellipsis; max-width: 220px;
}
.mo-msg.me .mo-reply-text { color: rgba(255,255,255,.6); }
.mo-msg-bubble ul { margin: 4px 0; padding-left: 18px; font-size: 12px; }
.mo-msg-bubble p { margin: 0 0 4px; }
.mo-msg-bubble p:last-child { margin-bottom: 0; }
.mo-msg-time { font-size: 10px; color: #98a2b3; margin-top: 3px; }
.mo-msg.me .mo-msg-time { text-align: right; }

/* New message indicator */
.mo-new-msg-indicator {
    text-align: center; padding: 6px; font-size: 11px; color: #1a1a2e;
    font-weight: 600; background: #eef0f5; cursor: pointer;
    border-bottom: 1px solid #e4e7ec; display: none;
}
.mo-new-msg-indicator:hover { background: #e4e7ec; }
.mo-new-msg-indicator.show { display: block; }

/* MO Tag Suggestions */
.mo-tag-suggestions {
    max-height: 180px; overflow-y: auto; border-top: 1px solid #e4e7ec;
    background: #fff; padding: 0;
}
.mo-tag-item {
    display: flex; align-items: center; gap: 10px; padding: 8px 14px;
    cursor: pointer; font-size: 12px; border-bottom: 1px solid #f5f5f5;
    transition: all .1s;
}
.mo-tag-item:hover { background: #f4f5f9; }
.mo-tag-item-name { font-weight: 600; color: #1a1a2e; }
.mo-tag-item-product { color: #667085; font-size: 11px; flex: 1; }
.mo-tag-item-state {
    font-size: 10px; padding: 2px 6px; border-radius: 8px;
    background: #e4e7ec; color: #475467;
}

/* Tagged MOs chips */
.mo-tagged-mos {
    padding: 6px 12px; background: #f8f9fc; border-top: 1px solid #e4e7ec;
    display: flex; flex-wrap: wrap; gap: 4px;
}
.mo-tag-chip {
    display: inline-flex; align-items: center; gap: 4px;
    background: #1a1a2e; color: #fff; padding: 3px 10px 3px 8px;
    border-radius: 12px; font-size: 11px; font-weight: 500;
}
.mo-tag-chip-remove {
    cursor: pointer; font-size: 10px; opacity: .7;
    transition: opacity .15s; margin-left: 2px;
}
.mo-tag-chip-remove:hover { opacity: 1; }

/* Footer */
.mo-chat-footer {
    padding: 10px 12px 8px; background: #fff; border-top: 1px solid #e4e7ec;
}
.mo-chat-input-wrap {
    display: flex; align-items: center; gap: 6px;
    background: #f8f9fc; border: 1px solid #e4e7ec;
    border-radius: 10px; padding: 4px 6px 4px 12px;
}
.mo-chat-input {
    flex: 1; border: none; background: transparent; font-size: 13px;
    color: #344054; outline: none; padding: 6px 0;
}
.mo-chat-input::placeholder { color: #98a2b3; }
.mo-chat-send {
    background: #1a1a2e; border: none; color: #fff;
    width: 34px; height: 34px; border-radius: 8px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; transition: all .15s; flex-shrink: 0;
}
.mo-chat-send:hover { background: #2a2a4e; transform: scale(1.05); }
.mo-chat-hint {
    font-size: 10px; color: #98a2b3; margin-top: 4px; padding-left: 4px;
}
.mo-chat-hint kbd {
    background: #e4e7ec; border: 1px solid #d0d5dd; border-radius: 3px;
    padding: 0 4px; font-size: 10px; color: #475467;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .mo-toolbar-row { flex-direction: column; align-items: stretch; }
    .mo-toolbar-filters { flex-direction: column; gap: 8px; }
    .mo-live-search { min-width: 100%; }
    .mo-pagination-bottom { flex-direction: column; gap: 8px; text-align: center; }
}
@media (max-width: 480px) {
    .mo-chat-window { width: calc(100vw - 20px); right: 10px; bottom: 80px; }
}