:root {
    /* ── Canonical design tokens ── */
    --bg-color: #0d1117;
    --text-color: #c9d1d9;
    --sidebar-bg: #161b22;
    --card-bg: #161b22;
    --border-color: #30363d;
    --primary-color: #238636;
    --primary-hover: #2ea043;
    --danger-color: #da3633;
    --table-header-bg: #21262d;
    --table-row-hover: #1c2128;
    --input-bg: #0d1117;
    --input-border: #30363d;
    --success: #238636;
    --info: #58a6ff;
    --text-muted: #8b949e;

    /* ── Short-hand aliases (do not redefine values) ── */
    --bg: var(--bg-color);
    --bg-body: var(--bg-color);
    --text: var(--text-color);
    --border: var(--border-color);
    --primary: var(--primary-color);
    --danger: var(--danger-color);
}

body.light-mode {
    --bg-color: #f6f8fa;
    --text-color: #24292f;
    --sidebar-bg: #ffffff;
    --card-bg: #ffffff;
    --border-color: #d0d7de;
    --primary-color: #116a2d;
    --primary-hover: #0e5a26;
    --danger-color: #cf222e;
    --table-header-bg: #f6f8fa;
    --table-row-hover: #f3f4f6;
    --input-bg: #ffffff;
    --input-border: #d0d7de;
    --success: #1a7f37;
    --info: #0969da;
    --text-muted: #57606a;

    /* ── Short-hand aliases overrides for light mode ── */
    --bg: var(--bg-color);
    --bg-body: var(--bg-color);
    --text: var(--text-color);
    --border: var(--border-color);
    --primary: var(--primary-color);
    --danger: var(--danger-color);
}

body {
    margin: 0;
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    /* Compact font size */
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background-color 0.3s, color 0.3s;
}

#app {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 220px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 20px 10px;
    transition: width 0.3s ease;
    position: relative;
    overflow: hidden;
}

#sidebar-nav {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.25) transparent;
}

#sidebar-nav::-webkit-scrollbar {
    width: 5px;
}

#sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

#sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.25);
    border-radius: 4px;
}

#sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.4);
}

body.light-mode #sidebar-nav {
    scrollbar-color: rgba(0,0,0,0.2) transparent;
}

body.light-mode #sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.2);
}

body.light-mode #sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(0,0,0,0.35);
}

.sidebar-footer {
    padding-top: 10px;
    margin-top: auto;
    border-top: 1px solid var(--border-color);
}

.sidebar.collapsed {
    width: 60px;
    padding: 20px 5px;
}

.sidebar.collapsed .sidebar-footer {
    border-top: none;
    padding-top: 5px;
}

.logo {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
    padding-left: 10px;
}

.sidebar.collapsed .logo span {
    display: none;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    color: var(--text-color);
    text-decoration: none;
    border-radius: 6px;
    margin-bottom: 5px;
    transition: all 0.2s;
    cursor: pointer;
    white-space: nowrap;
}

.nav-link:hover {
    background-color: var(--table-row-hover);
}

.nav-link.active {
    background-color: rgba(35, 134, 54, 0.15);
    color: var(--primary-color);
    font-weight: 600;
    border-left: 3px solid var(--primary-color);
    border-radius: 0 6px 6px 0;
}

.nav-link i {
    min-width: 20px;
    text-align: center;
    font-size: 1.1rem;
}

.sidebar:not(.collapsed) .nav-link i {
    margin-right: 10px;
}

.sidebar.collapsed .nav-link {
    justify-content: center;
    padding: 12px 0;
}

.sidebar.collapsed .nav-link span {
    display: none;
}

.sidebar.collapsed .nav-link i {
    margin-right: 0;
}

.spacer {
    flex: 1;
}

.sidebar-toggle {
    position: absolute;
    top: 15px;
    right: 10px;
    background: var(--sidebar-bg);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    cursor: pointer;
    font-size: 0.9rem;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    transition: all 0.2s;
}

.sidebar-toggle:hover {
    background-color: var(--primary-color);
    color: white;
}

.sidebar.collapsed .sidebar-toggle {
    right: 50%;
    transform: translateX(50%);
    top: 10px;
}

.sidebar.collapsed .logo {
    margin-top: 40px;
    padding-left: 0;
    justify-content: center;
}

.theme-toggle {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    margin-top: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    white-space: nowrap;
}

.sidebar.collapsed .theme-toggle span {
    display: none;
}


/* Content */
.main-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    overflow-x: hidden;
    /* Prevent global horizontal scroll */
    position: relative;
    box-sizing: border-box;
}

/* ─── Top Web Announcement Bar (Marquee Mode) ─── */
.top-announcement-bar {
    background: linear-gradient(90deg, #fff3bf 0%, #fef08a 50%, #fff3bf 100%);
    color: #dc2626;
    border-bottom: 2px solid #facc15;
    padding: 7px 14px;
    margin-bottom: 0;
    font-weight: 700;
    font-size: 0.9rem;
    line-height: 1.4;
    box-shadow: 0 3px 12px rgba(234, 179, 8, 0.22);
    display: flex;
    align-items: center;
    gap: 10px;
    overflow: hidden;
    position: relative;
    box-sizing: border-box;
    width: 100%;
    z-index: 20;
}

.announcement-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #ffffff;
    font-size: 0.72rem;
    font-weight: 800;
    padding: 3px 9px;
    border-radius: 999px;
    letter-spacing: 0.4px;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(220, 38, 38, 0.35);
    text-transform: uppercase;
}

.announcement-wrapper {
    width: 100%;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    mask-image: linear-gradient(to right, transparent 0%, black 24px, black calc(100% - 24px), transparent 100%);
    -webkit-mask-image: linear-gradient(to right, transparent 0%, black 24px, black calc(100% - 24px), transparent 100%);
}

.announcement-inner {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    will-change: transform;
}

.announcement-inner.is-marquee {
    animation: announcementMarquee var(--marquee-duration, 20s) linear infinite;
}

.announcement-inner.is-marquee:hover,
.announcement-inner.is-marquee:active {
    animation-play-state: paused;
}

.announcement-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.announcement-icon {
    font-size: 1rem;
    color: #dc2626;
    flex-shrink: 0;
}

.announcement-text {
    font-weight: 800;
    color: #b91c1c;
    letter-spacing: 0.15px;
}

.announcement-gap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    color: #d97706;
    font-weight: 900;
    font-size: 0.8rem;
    flex-shrink: 0;
}

@keyframes announcementMarquee {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-50%);
    }
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 1.5rem;
    cursor: pointer;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-actions .btn,
.header-actions .notif-btn {
    margin-top: 0;
    height: 38px;
}

#refresh-btn {
    padding: 0 12px;
    height: 38px;
    min-width: 44px;
}

/* Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    padding: 20px;
    border-radius: 10px;
    transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
    border-color: rgba(35, 134, 54, 0.35);
}

.stat-card .stat-icon {
    font-size: 1.1rem;
    margin-right: 6px;
    opacity: 0.85;
}

.stat-card .stat-title {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ── Referral Page ── */
.ref-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.ref-stat-card {
    padding: 18px 20px;
    border-radius: 10px;
    transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.ref-stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
}

.ref-stat-card.ref-card-green {
    background: linear-gradient(135deg, rgba(30, 215, 96, 0.12), rgba(30, 215, 96, 0.04));
    border: 1px solid rgba(30, 215, 96, 0.28);
}

.ref-stat-card.ref-card-blue {
    background: linear-gradient(135deg, rgba(88, 166, 255, 0.12), rgba(88, 166, 255, 0.04));
    border: 1px solid rgba(88, 166, 255, 0.25);
}

.ref-stat-card .stat-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 0.82rem;
    opacity: 0.85;
}

.ref-stat-card .stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.ref-stat-card.ref-card-green .stat-value { color: #3fb950; }
.ref-stat-card.ref-card-blue  .stat-value { color: #58a6ff; }

.ref-section {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    margin-bottom: 20px;
    overflow: visible;
}

.ref-section-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 18px;
    font-size: 0.95rem;
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
}

.ref-section-head .ref-icon-badge {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.ref-section-body {
    padding: 16px 18px;
}

.ref-info-banner {
    background: var(--table-row-hover);
    border-left: 3px solid var(--primary-color);
    border-radius: 0 8px 8px 0;
    padding: 11px 14px;
    font-size: 0.88rem;
    margin-bottom: 16px;
    opacity: 0.92;
    line-height: 1.5;
}

.ref-info-banner b { color: var(--primary-color); }

.ref-link-group {
    margin-bottom: 14px;
}

.ref-link-group:last-child { margin-bottom: 0; }

.ref-link-label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.55;
}

.ref-link-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.ref-link-row input {
    flex: 1;
    min-width: 0;
    margin: 0 !important;
    font-size: 0.87rem;
}

.ref-link-row .btn {
    white-space: nowrap;
    flex-shrink: 0;
    margin: 0 !important;
    padding: 10px 14px !important;
}

.ref-inviter-area {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.ref-inviter-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: #9f7aea;
}

.ref-table th { text-align: left; }
.ref-table .col-date { width: 150px; }
.ref-table .col-credit { width: 100px; }

/* API Docs */
.api-page {
    display: flex;
    flex-direction: column;
    gap: 24px;
    --api-soft-bg: rgba(255, 255, 255, 0.03);
    --api-code-bg: #0b1017;
    --api-code-text: #dbe7f3;
    --api-code-comment: #8b949e;
    --api-code-accent: #7ee787;
}

body.light-mode .api-page {
    --api-soft-bg: #f6f8fa;
    --api-code-bg: #f6f8fa;
    --api-code-text: #24292f;
    --api-code-comment: #57606a;
    --api-code-accent: #116329;
}

.api-page>.card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.api-section-card {
    margin-bottom: 0 !important;
}

.api-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    background: var(--api-soft-bg);
}

.api-empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.api-empty-state i {
    font-size: 2rem;
    margin-bottom: 15px;
}

.api-doc-body {
    padding: 16px;
}

.api-auth-box,
.api-note-box {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--api-soft-bg);
}

.api-auth-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 16px;
    margin-bottom: 16px;
}

.api-auth-box h4,
.api-note-box h4 {
    margin: 0;
    color: var(--primary-color);
}

.api-auth-box p {
    margin: 6px 0 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.api-auth-box code,
.api-route,
.api-resource-title code,
.api-key-code {
    border: 1px solid var(--border-color);
    background: var(--input-bg);
    color: var(--text-color);
    border-radius: 6px;
}

.api-auth-box code {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 10px;
    white-space: nowrap;
}

.api-doc-tabs {
    display: flex;
    align-items: center;
    gap: 0;
    overflow-x: auto;
    overflow-y: hidden;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 16px;
    padding-bottom: 2px;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.api-doc-tabs::-webkit-scrollbar {
    height: 4px;
}

.api-doc-tabs::-webkit-scrollbar-track {
    background: transparent;
}

.api-doc-tabs::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 999px;
}

.api-doc-tab-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 8px 16px 10px;
    border: 0;
    border-bottom: 2px solid transparent;
    margin-bottom: 0;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 700;
    white-space: nowrap;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.api-doc-tab-btn:hover {
    color: var(--text-color);
}

.api-doc-tab-btn.active {
    border-bottom-color: var(--primary-color);
    color: var(--primary-color);
}

.api-endpoint-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.api-resource-group {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    background: var(--card-bg);
}

.api-resource-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 16px;
    background: var(--api-soft-bg);
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    list-style: none;
    user-select: none;
}

.api-resource-head::-webkit-details-marker,
.api-resource-head::marker {
    display: none;
    content: '';
}

.api-resource-head-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
}

.api-resource-chevron {
    font-size: 0.8rem;
    color: var(--text-muted);
    transition: transform 0.25s ease;
}

.api-resource-group[open] > .api-resource-head .api-resource-chevron {
    transform: rotate(180deg);
}

.api-resource-group:not([open]) > .api-resource-head {
    border-bottom: none;
}

.api-resource-label {
    margin-bottom: 6px;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
}

.api-resource-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    color: var(--text-color);
    font-size: 1rem;
}

.api-resource-title code {
    padding: 4px 8px;
    word-break: break-all;
}

.api-resource-summary {
    margin: 8px 0 0;
    color: var(--text-muted);
    font-size: 0.88rem;
    line-height: 1.5;
}

.api-resource-count {
    flex: 0 0 auto;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    color: var(--text-muted);
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
}

.api-resource-endpoints {
    display: flex;
    flex-direction: column;
}

.api-endpoint-card {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
}

.api-endpoint-card:last-child {
    border-bottom: 0;
}

.api-endpoint-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.api-route-line {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.api-method {
    min-width: 58px;
    border-radius: 6px;
    background: var(--method-color, #6e7681);
    color: #fff;
    padding: 5px 8px;
    font-size: 0.72rem;
    font-weight: 800;
    text-align: center;
    line-height: 1;
}

.api-route {
    padding: 5px 8px;
    font-size: 0.84rem;
    line-height: 1.35;
    word-break: break-all;
}

.perm-badge {
    border-radius: 999px;
    color: #fff;
    padding: 4px 9px;
    font-size: 0.72rem;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
}

.perm-read {
    background: var(--info);
}

.perm-full {
    background: var(--success);
}

.perm-public {
    background: #6e7681;
}

.api-desc {
    margin: 10px 0 12px;
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.5;
}

.api-dropdowns {
    display: grid;
    gap: 10px;
}

.api-detail-box {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--api-soft-bg);
    overflow: hidden;
}

.api-detail-box summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    color: var(--text-color);
    cursor: pointer;
    font-size: 0.84rem;
    font-weight: 700;
    list-style: none;
}

.api-detail-box summary::-webkit-details-marker {
    display: none;
}

.api-detail-box summary span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.api-detail-box summary i {
    color: var(--primary-color);
}

.api-detail-chevron {
    transition: transform 0.2s ease;
}

.api-detail-box[open] .api-detail-chevron {
    transform: rotate(180deg);
}

.api-code-frame {
    padding: 0 12px 12px;
}

.api-code {
    margin: 0;
    max-height: 420px;
    overflow: auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--api-code-bg);
    color: var(--api-code-text);
    padding: 12px;
    font-size: 0.78rem;
    line-height: 1.6;
    white-space: pre;
}

.api-code span {
    color: var(--api-code-comment) !important;
}

.api-response {
    color: var(--api-code-accent);
}

.api-note-box {
    margin-top: 18px;
    padding: 14px 16px;
}

.api-note-box ul {
    margin: 10px 0 0;
    padding-left: 18px;
    color: var(--text-color);
    font-size: 0.88rem;
    line-height: 1.8;
}

.stat-title {
    font-size: 0.9rem;
    opacity: 0.8;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    margin-top: 5px;
}

.dashboard-tip-box {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 10px 0 0;
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(255, 193, 7, 0.08);
    border: 1px solid rgba(255, 193, 7, 0.22);
    font-size: 0.82rem;
    line-height: 1.45;
    color: var(--text-color);
    opacity: 0.92;
}

.dashboard-tip-label {
    font-weight: 700;
    white-space: nowrap;
    color: #ffc107;
}

.api-test-tip-box {
    align-items: flex-start;
    margin: 0 0 18px;
}

.api-test-tip-content {
    display: grid;
    gap: 8px;
    min-width: 0;
}

.api-test-code-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
}

.api-test-code-list span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
}

.api-test-tip-box code {
    font-size: 0.78rem;
    word-break: break-all;
}

.dashboard-filter-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 14px 0 18px;
    flex-wrap: wrap;
}

.dashboard-filter-input-wrap {
    display: flex;
    align-items: center;
    gap: 9px;
    flex: 1 1 440px;
    max-width: 760px;
    min-width: 260px;
    min-height: 42px;
    padding: 0 12px;
    border: 1px solid var(--input-border);
    border-radius: 8px;
    background: var(--input-bg);
    color: var(--text-color);
}

.dashboard-filter-input-wrap i {
    color: var(--text-muted);
    flex-shrink: 0;
}

.dashboard-filter-input-wrap input {
    flex: 1;
    min-width: 0;
    height: 40px;
    padding: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text-color);
    font-size: 0.95rem;
}

.dashboard-filter-input-wrap input:focus {
    border: 0;
    box-shadow: none;
}

.dashboard-filter-clear-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
}

.dashboard-filter-clear-btn:hover {
    background: var(--table-row-hover);
    color: var(--text-color);
}

.dashboard-filter-summary {
    font-size: 0.84rem;
    color: var(--text-muted);
}

/* Table */
.table-container {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

th,
td {
    padding: 8px 10px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
    line-height: 1.3;
}

th {
    background-color: var(--table-header-bg);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

th.sortable {
    cursor: pointer;
}

.col-check {
    width: 35px;
    text-align: center;
    padding: 8px 5px !important;
}

.col-check input[type="checkbox"] {
    cursor: pointer;
    width: 16px;
    height: 16px;
}

/* Base Column Widths (Desktop) */
.col-carrier {
    width: 60px;
    text-align: left;
}

.col-code {
    width: 170px;
    word-break: break-all;
}

.col-name {
    width: 150px;
    word-break: break-word;
}

.col-receiver {
    width: 220px;
    word-break: break-word;
}

.col-status {
    width: 280px;
}

.status-header-stack {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-start;
}

.pin-soon-delivery-toggle {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 18px;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.2;
    text-transform: none;
    letter-spacing: 0;
    color: var(--text-muted);
    cursor: pointer;
    white-space: normal;
}

.pin-soon-delivery-toggle input {
    width: 14px;
    height: 14px;
    margin: 0;
    cursor: pointer;
    accent-color: var(--primary-color);
    flex-shrink: 0;
}

.col-location {
    width: 160px;
}


.col-time {
    width: 100px;
}

.col-action {
    width: 50px;
    text-align: center;
}

.dashboard-orders-table {
    min-width: 1160px;
    table-layout: fixed;
    width: 100%;
}

.dashboard-orders-table .col-carrier {
    width: 70px;
    min-width: 70px;
}

.dashboard-orders-table .col-code {
    width: 175px;
    min-width: 175px;
}

.dashboard-orders-table .col-name {
    width: 170px;
    min-width: 170px;
}

.dashboard-orders-table .col-receiver {
    width: 220px;
    min-width: 220px;
}

.dashboard-orders-table .col-status {
    width: 260px;
    min-width: 260px;
}

.dashboard-orders-table .col-location {
    width: 150px;
    min-width: 150px;
}

.dashboard-orders-table .col-time {
    width: 110px;
    min-width: 110px;
}

.dashboard-orders-table th.col-action {
    width: 65px;
    min-width: 65px;
    text-align: center;
    position: sticky;
    right: 0;
    background-color: var(--table-header-bg);
    z-index: 6;
    box-shadow: -3px 0 6px rgba(0, 0, 0, 0.25);
}

.dashboard-orders-table td.col-action {
    width: 65px;
    min-width: 65px;
    text-align: center;
    position: sticky;
    right: 0;
    background-color: var(--card-bg);
    z-index: 5;
    box-shadow: -3px 0 6px rgba(0, 0, 0, 0.25);
}

.dashboard-orders-table tr:hover td.col-action {
    background-color: var(--table-row-hover);
}

.dashboard-orders-table tr.received-ok-row td.col-action {
    background-color: var(--card-bg);
    background-image: linear-gradient(rgba(35, 134, 54, 0.18), rgba(35, 134, 54, 0.18));
}

.dashboard-orders-table tr.received-ok-row:hover td.col-action {
    background-color: var(--table-row-hover);
    background-image: linear-gradient(rgba(35, 134, 54, 0.25), rgba(35, 134, 54, 0.25));
}

.dashboard-orders-table tr.delivering-ok-row td.col-action {
    background-color: var(--card-bg);
    background-image: linear-gradient(rgba(245, 158, 11, 0.18), rgba(245, 158, 11, 0.18));
}

.dashboard-orders-table tr.delivering-ok-row:hover td.col-action {
    background-color: var(--table-row-hover);
    background-image: linear-gradient(rgba(245, 158, 11, 0.25), rgba(245, 158, 11, 0.25));
}

tr:hover {
    background-color: var(--table-row-hover);
}

.dashboard-orders-table tr.received-ok-row td {
    background: rgba(35, 134, 54, 0.14);
}

.dashboard-orders-table tr.received-ok-row:hover td {
    background: rgba(35, 134, 54, 0.20);
}

.dashboard-orders-table tr.delivering-ok-row td {
    background: rgba(245, 158, 11, 0.16);
}

.dashboard-orders-table tr.delivering-ok-row:hover td {
    background: rgba(245, 158, 11, 0.24);
}

.dashboard-orders-table tr.trusted-shipper-row td:first-child {
    box-shadow: inset 3px 0 0 #10b981;
}

.dashboard-received-ok-toggle,
.dashboard-delivering-ok-toggle {
    display: flex;
    align-items: center;
    gap: 5px;
    width: fit-content;
    margin-top: 5px;
    font-size: 0.73rem;
    font-weight: 700;
    color: #2ea043;
    cursor: pointer;
    user-select: none;
}

.dashboard-received-ok-toggle {
    color: #2ea043;
}

.dashboard-delivering-ok-toggle {
    color: #b45309;
}

.dashboard-received-ok-toggle input,
.dashboard-delivering-ok-toggle input {
    width: 14px;
    height: 14px;
    margin: 0;
    cursor: pointer;
    flex-shrink: 0;
}

.dashboard-received-ok-toggle input {
    accent-color: #2ea043;
}

.dashboard-delivering-ok-toggle input {
    accent-color: #f59e0b;
}

.dashboard-received-ok-toggle input:disabled,
.dashboard-delivering-ok-toggle input:disabled {
    cursor: wait;
    opacity: 0.65;
}

.dashboard-source-label {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    margin-top: 4px;
    padding: 2px 7px;
    border-radius: 6px;
    font-size: 0.68rem;
    font-weight: 800;
    line-height: 1.2;
    white-space: nowrap;
}

.dashboard-source-label-tiktok {
    color: #ff5f87;
    background: rgba(238, 29, 82, 0.14);
    border: 1px solid rgba(238, 29, 82, 0.28);
}

.dashboard-source-label-shopee {
    color: #ff8a66;
    background: rgba(238, 77, 45, 0.14);
    border: 1px solid rgba(238, 77, 45, 0.28);
}

/* Status Column Compact Logic*/
.status-text-wrapper {
    display: flex;
    align-items: flex-start;
    gap: 4px;
    max-height: 3.9em;
    line-height: 1.3;
    overflow: hidden;
    position: relative;
    margin: 0;
    padding: 0;
}

.status-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    white-space: nowrap;
    padding-top: 2px;
}

.status-text-clamp {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.timeline-toggle-row {
    margin-top: 6px;
}

.timeline-modal-btn {
    height: 26px;
    padding: 0 10px;
    font-size: 0.72rem;
    font-weight: 700;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.2s ease;
}

.timeline-modal-btn:hover {
    border-color: var(--primary-color);
    color: #fff;
}

.timeline-modal-content {
    max-width: 700px;
    width: min(95vw, 700px);
    padding: 16px;
}

.dashboard-timeline-meta {
    font-size: 0.82rem;
    color: var(--text-color);
    opacity: 0.85;
}

.dashboard-timeline-list {
    margin-top: 12px;
    max-height: 64vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-right: 2px;
}

.dashboard-timeline-item {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.03);
}

.dashboard-timeline-item-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
}

.dashboard-timeline-item-index {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    color: var(--primary-color);
    font-weight: 700;
}

.dashboard-timeline-item-time {
    font-size: 0.75rem;
    opacity: 0.9;
}

.dashboard-timeline-item-status {
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.35;
}

.dashboard-timeline-item-location {
    margin-top: 4px;
    font-size: 0.82rem;
    opacity: 0.88;
}

.dashboard-timeline-empty,
.dashboard-timeline-loading {
    margin-top: 14px;
    border: 1px dashed var(--border-color);
    border-radius: 10px;
    padding: 14px;
    text-align: center;
    opacity: 0.9;
}


.driver-phone-info {
    font-size: 0.72rem;
    margin-top: 4px;
    background: rgba(35, 134, 54, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    width: fit-content;
    border: 1px solid rgba(35, 134, 54, 0.2);
}

.driver-phone-info a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: bold;
}

.carrier-phone-update-box,
.ghn-phone-update-box {
    margin-top: 6px;
    font-size: 0.76rem;
}

.carrier-phone-tooltip,
.ghn-phone-tooltip {
    display: none;
    margin-top: 4px;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.72rem;
    background: rgba(248, 81, 73, 0.15);
    color: #f85149;
    border: 1px solid rgba(248, 81, 73, 0.4);
    line-height: 1.35;
    font-weight: 500;
}

.recipient-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 0.76rem;
    line-height: 1.32;
    color: var(--text-color);
}

.recipient-name {
    font-weight: 700;
}

.recipient-price {
    margin-top: 1px;
    font-size: 0.72rem;
    opacity: 0.72;
}

.view-full-trigger {
    cursor: pointer;
    font-size: 1rem;
    margin-left: 4px;
    display: inline-block;
    vertical-align: middle;
    filter: grayscale(0.5);
    transition: all 0.2s;
}

.view-full-trigger:hover {
    filter: grayscale(0);
    transform: scale(1.2);
}

.status-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    background-color: rgba(35, 134, 54, 0.2);
    color: var(--primary-color);
}

/* Add Order Section */
.add-tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.tab-btn {
    padding: 10px 20px;
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    border-bottom: 2px solid transparent;
}

.tab-btn.active {
    border-bottom-color: var(--primary-color);
    font-weight: 600;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Desktop Form Table fix */
.form-table {
    table-layout: auto !important;
    width: 100%;
}

.form-table input {
    width: 100%;
    box-sizing: border-box;
}

textarea {
    width: 100%;
    height: 150px;
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    color: var(--text-color);
    padding: 10px;
    border-radius: 6px;
    font-family: monospace;
}

.btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    margin-top: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background-color 0.2s ease, transform 0.18s ease, box-shadow 0.2s ease;
}

.btn:hover:not(:disabled) {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(35, 134, 54, 0.38);
}

.btn:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: none;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 0.75rem;
    margin-top: 0;
    margin-left: 10px;
}

.bulk-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    display: inline-flex;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    margin-top: 20px;
}

.section-header h3 {
    margin: 0;
}

.header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.notif-btn {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 10px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 40px;
    min-width: 44px;
}

.notif-btn.enabled {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background-color: rgba(35, 134, 54, 0.1);
}

.notif-btn.enabled i {
    animation: ring 2s ease infinite;
}

@keyframes ring {
    0% {
        transform: rotate(0);
    }

    10% {
        transform: rotate(15deg);
    }

    20% {
        transform: rotate(-15deg);
    }

    30% {
        transform: rotate(10deg);
    }

    40% {
        transform: rotate(-10deg);
    }

    50% {
        transform: rotate(0);
    }

    100% {
        transform: rotate(0);
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.fa-spin {
    display: inline-block;
    animation: spin 1s linear infinite !important;
}

.fa-pulse {
    display: inline-block;
    animation: spin 1s steps(8) infinite !important;
}

.spinning i {
    animation: spin 0.6s linear;
}

.btn-danger {
    background-color: var(--danger-color);
}

.delete-btn-emoji {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: rgba(218, 54, 51, 0.12);
    color: #f85149;
    border: 1px solid rgba(218, 54, 51, 0.25);
    cursor: pointer;
    font-size: 1.05rem;
    padding: 0;
    transition: all 0.2s ease;
    line-height: 1;
}

.delete-btn-emoji:hover {
    background: rgba(218, 54, 51, 0.28);
    border-color: rgba(218, 54, 51, 0.6);
    color: #ff7b72;
    transform: scale(1.1);
}

/* Sidebar Overlay for Mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

.sidebar-overlay.active {
    display: block;
}

/* Topup Layout Base */
.topup-layout {
    display: grid;
    grid-template-columns: 1fr 1fr 2fr;
    gap: 20px;
}

/* Settings Action Rows */
.settings-action-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.settings-action-row input {
    margin: 0 !important;
}

.settings-action-row .btn {
    margin: 0 !important;
}

/* Login */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    width: 100%;
    background: radial-gradient(ellipse at 50% 40%, rgba(35, 134, 54, 0.07) 0%, transparent 65%);
}

.login-box {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    padding: 40px;
    border-radius: 16px;
    text-align: center;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5),
                0 0 0 1px rgba(35, 134, 54, 0.08);
    animation: login-box-in 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes login-box-in {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

body.light-mode .login-container {
    background: radial-gradient(ellipse at 50% 40%, rgba(35, 134, 54, 0.05) 0%, transparent 65%);
}

body.light-mode .login-box {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12),
                0 0 0 1px rgba(35, 134, 54, 0.08);
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"] {
    width: 100%;
    padding: 10px;
    margin: 10px 0;
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    color: var(--text-color);
    border-radius: 6px;
    box-sizing: border-box;
    /* Fix overflow */
}

.password-wrapper {
    position: relative;
    width: 100%;
    margin: 10px 0;
    box-sizing: border-box;
}

.password-wrapper .toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    font-size: 1.2rem;
    user-select: none;
    z-index: 10;
    line-height: 1;
}

.password-wrapper .toggle-password:hover {
    filter: brightness(1.2);
}

.password-wrapper input {
    margin: 0 !important;
    padding-right: 45px !important;
}

/* Mobile */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -320px;
        /* Hide deeper to cover shadows/borders */
        height: 100%;
        height: 100dvh;
        z-index: 1000;
        width: 280px !important;
        /* Slightly wider for better feel */
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        padding-bottom: 0;
        border-right: none;
    }

    .sidebar.open {
        left: 0;
        box-shadow: 10px 0 20px rgba(0, 0, 0, 0.4);
    }

    .sidebar-footer {
        padding-bottom: 100px;
        /* Strong padding to ensure buttons clear OS bars */
    }

    /* Force show text when open on mobile even if collapsed class exists */
    .sidebar.open .logo span,
    .sidebar.open .nav-link span,
    .sidebar.open .theme-toggle span {
        display: inline !important;
    }

    .sidebar.open .nav-link {
        justify-content: flex-start !important;
        padding: 12px 15px !important;
    }

    .sidebar.open .nav-link i {
        margin-right: 10px !important;
    }

    .sidebar-toggle {
        display: none !important;
        /* Hide desktop toggle on mobile */
    }



    .mobile-menu-btn {
        display: block;
    }

    #app {
        display: block;
    }

    table {
        table-layout: auto;
        /* Revert fixed layout on mobile to allow best fit */
    }

    .main-content {
        padding: 0 !important;
        width: 100% !important;
        max-width: 100vw !important;
        overflow-x: hidden;
    }

    .header h3 {
        font-size: 1rem;
    }

    /* Table Mobile Optimization */
    .table-container {
        font-size: 0.75rem;
        /* Smaller font on mobile */
    }

    th,
    td {
        padding: 6px 4px;
        /* Extreme compact padding */
    }


    .col-carrier {
        width: 40px;
        padding: 6px 2px;
    }

    .col-code {
        width: 100px;
        word-break: break-all;
    }

    .col-name {
        width: 120px;
        min-width: 120px;
    }

    .col-receiver {
        width: 180px;
        min-width: 180px;
    }

    .col-location {
        width: 100px;
    }

    .col-time {
        width: 80px;
    }

    .col-status {
        width: 130px;
        min-width: 130px;
    }

    /* Flexible */
    .col-action {
        width: 40px;
    }

    .dashboard-orders-table {
        min-width: 1035px;
        table-layout: fixed;
    }

    .dashboard-orders-table .col-carrier {
        width: 55px;
        min-width: 55px;
    }

    .dashboard-orders-table .col-code {
        width: 85px;
        min-width: 85px;
    }

    .dashboard-orders-table .col-name {
        width: 130px;
        min-width: 130px;
    }

    .dashboard-orders-table .col-receiver {
        width: 150px;
        min-width: 150px;
        white-space: normal;
        word-break: break-word;
    }

    .dashboard-orders-table .col-receiver .recipient-info {
        white-space: normal;
        word-break: break-word;
        overflow-wrap: anywhere;
    }

    .dashboard-orders-table .col-status {
        width: 130px;
        min-width: 130px;
    }

    .dashboard-orders-table .col-code b {
        display: -webkit-box;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        white-space: normal;
        word-break: break-all;
    }

    .dashboard-orders-table .col-code .dashboard-source-label {
        margin-top: 3px;
        padding: 1px 5px;
        font-size: 0.62rem;
    }

    .dashboard-orders-table .col-name .status-text-wrapper,
    .dashboard-orders-table .col-status .status-text-wrapper {
        max-height: 2.8em;
    }

    .dashboard-orders-table .col-name .status-text-clamp,
    .dashboard-orders-table .col-status .status-text-clamp {
        -webkit-line-clamp: 2;
        line-clamp: 2;
    }

    .dashboard-orders-table .col-location {
        width: 150px;
        min-width: 150px;
    }

    .dashboard-orders-table .col-time {
        width: 105px;
        min-width: 105px;
    }

    .dashboard-orders-table .col-action {
        width: 55px;
        min-width: 55px;
        position: sticky;
        right: 0;
    }

    .status-badge {
        padding: 2px 4px;
        font-size: 0.65rem;
    }

    .status-text-wrapper {
        padding-right: 5px;
    }

    .timeline-modal-btn {
        width: 100%;
    }

    .timeline-modal-content {
        width: 96%;
        max-width: 96%;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 10px;
        margin-bottom: 20px;
    }

    .stat-card {
        padding: 12px;
    }

    .stat-value {
        font-size: 1.4rem;
    }

    /* Clean Mobile Header: 1 Single Row, No Wrapping, No Overlapping */
    .header {
        flex-wrap: nowrap !important;
        height: 44px !important;
        padding: 0 10px !important;
        justify-content: space-between !important;
        align-items: center !important;
    }

    #page-title {
        order: unset !important;
        width: auto !important;
        margin: 0 !important;
        font-size: 0.88rem !important;
        max-width: 160px !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    .header-actions {
        gap: 6px !important;
    }

    .header-add-btn {
        padding: 0 8px !important;
        height: 30px !important;
        font-size: 0.72rem !important;
    }

    .notif-btn {
        width: 30px !important;
        height: 30px !important;
    }

    #content-area {
        padding: 8px 10px 80px 10px !important;
    }

    .btn-sm {
        margin-left: 0;
    }

    /* Add Order Mobile Fixes */
    .tab-btn {
        padding: 10px 12px;
        font-size: 0.8rem;
    }

    textarea#quickInput {
        width: 100%;
        box-sizing: border-box;
        margin-top: 10px;
        font-size: 0.85rem;
    }

    /* Better responsiveness for Add Order forms */
    .form-table-container {
        width: 100%;
        overflow-x: hidden;
    }

    .form-table,
    .form-table thead,
    .form-table tbody,
    .form-table tr,
    .form-table th,
    .form-table td {
        display: block;
        width: 100% !important;
        box-sizing: border-box;
    }

    .form-table thead {
        display: none;
        /* Hide headers on mobile */
    }

    .form-table tr {
        margin-bottom: 20px;
        border: 1px solid var(--border-color);
        padding: 10px;
        border-radius: 8px;
        background: var(--card-bg);
    }

    .form-table td {
        padding: 5px 0;
        border-bottom: none;
    }

    .form-table td:before {
        content: attr(data-label);
        font-weight: 600;
        display: block;
        font-size: 0.75rem;
        margin-bottom: 3px;
        color: var(--text-muted);
    }

    .form-table input {
        width: 100% !important;
        margin: 0 !important;
    }

    /* Topup Mobile Fixes: 1-1 Column Layout (Side-by-side) */
    .topup-layout {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 10px !important;
    }

    .topup-layout>div {
        margin-bottom: 0;
        width: auto !important;
    }

    .topup-layout input {
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .payment-qr-area {
        display: none !important;
    }

    .feature-card {
        padding: 15px !important;
    }

    .feature-card h3 {
        font-size: 1rem;
        margin-bottom: 5px;
    }

    .feature-card p {
        font-size: 0.75rem !important;
    }

    .calc-box {
        font-size: 0.8rem !important;
        padding: 8px !important;
    }

    /* Settings Mobile Fixes */
    .settings-action-row {
        display: flex;
        gap: 8px;
        align-items: center;
    }

    .settings-action-row input {
        margin: 0 !important;
        flex: 1;
        height: 38px !important;
    }

    .settings-action-row .btn {
        margin: 0 !important;
        height: 38px !important;
        padding: 0 15px !important;
        white-space: nowrap;
        font-size: 0.85rem;
    }

    /* API Page Mobile Fixes */
    .api-key-item {
        padding: 12px !important;
        gap: 8px !important;
    }

    .api-key-code {
        font-size: 0.72rem !important;
        padding: 4px 6px !important;
    }

    .api-key-item button {
        padding: 4px 10px !important;
        font-size: 0.75rem !important;
        height: 32px !important;
    }

    .api-doc-body {
        padding: 12px;
    }

    .api-auth-box,
    .api-resource-head,
    .api-endpoint-top,
    .api-route-line {
        align-items: stretch;
        flex-direction: column;
    }

    .api-auth-box code {
        width: fit-content;
        max-width: 100%;
        white-space: normal;
        word-break: break-all;
    }

    .api-resource-count {
        width: fit-content;
    }

    .api-method {
        width: fit-content;
    }

    .api-route {
        width: 100%;
        box-sizing: border-box;
    }

    .api-endpoint-card {
        padding: 12px;
    }

    .api-code {
        font-size: 0.72rem;
    }
}

/* Modal for Image Preview */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    backdrop-filter: blur(5px);
    visibility: hidden;
    opacity: 0;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    visibility: visible;
    opacity: 1;
}

.modal-content {
    background: var(--card-bg);
    padding: 10px;
    border-radius: 12px;
    max-width: 90%;
    max-height: 90%;
    position: relative;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-color);
}

.modal-content img {
    max-width: 100%;
    max-height: 80vh;
    display: block;
    border-radius: 8px;
}

.modal-close {
    position: absolute;
    top: -15px;
    right: -15px;
    background: var(--primary-color);
    color: white;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    border: 2px solid #fff;
    font-size: 1.2rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    z-index: 2001;
}

@media (max-width: 768px) {
    .modal-close {
        top: 10px;
        right: 10px;
        width: 30px;
        height: 30px;
        border-width: 1px;
    }

    .modal-content {
        padding: 15px;
        width: 95%;
        max-width: 95%;
    }
}

.photo-trigger {
    color: var(--primary-color);
    cursor: pointer;
    margin-left: 8px;
    font-size: 1.1rem;
    transition: transform 0.2s ease;
}

.photo-trigger:hover {
    transform: scale(1.2);
}

/* ── Skeleton Loader ── */
@keyframes skeleton-shimmer {
    0%   { background-position: -400px 0; }
    100% { background-position:  400px 0; }
}

.skeleton {
    display: block;
    border-radius: 6px;
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.04) 25%,
        rgba(255, 255, 255, 0.10) 50%,
        rgba(255, 255, 255, 0.04) 75%
    );
    background-size: 400px 100%;
    animation: skeleton-shimmer 1.4s ease-in-out infinite;
}

body.light-mode .skeleton {
    background: linear-gradient(
        90deg,
        rgba(0, 0, 0, 0.06) 25%,
        rgba(0, 0, 0, 0.12) 50%,
        rgba(0, 0, 0, 0.06) 75%
    );
    background-size: 400px 100%;
}

.skeleton-stat {
    height: 2rem;
    width: 56px;
    border-radius: 6px;
}

.skeleton-row td > .skeleton-cell {
    height: 13px;
    border-radius: 4px;
}

.skeleton-row td:nth-child(1) .skeleton-cell { width: 42px; }
.skeleton-row td:nth-child(2) .skeleton-cell { width: 120px; }
.skeleton-row td:nth-child(3) .skeleton-cell { width: 90%; }
.skeleton-row td:nth-child(4) .skeleton-cell { width: 80%; }
.skeleton-row td:nth-child(5) .skeleton-cell { width: 85%; }
.skeleton-row td:nth-child(6) .skeleton-cell { width: 70px; }
.skeleton-row td:nth-child(7) .skeleton-cell { width: 80px; }
.skeleton-row td:nth-child(8) .skeleton-cell { width: 24px; }

/* ── Light mode readability improvements for MVĐ & Status columns ── */
.spx-cookie-table code,
.tiktok-cookie-table code,
table code {
    font-family: ui-monospace, SFMono-Regular, SF Pro Mono, Menlo, Monaco, Consolas, monospace;
    font-size: 0.82rem;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

body.light-mode .spx-cookie-table code,
body.light-mode .tiktok-cookie-table code,
body.light-mode table code {
    background: #eaeef2;
    border: 1px solid #d0d7de;
    color: #0f1419;
    font-weight: 600;
}

body.light-mode .spx-cookie-table td div,
body.light-mode .spx-cookie-table td span,
body.light-mode .tiktok-cookie-table td div,
body.light-mode .tiktok-cookie-table td span,
body.light-mode .spx-cookie-table td strong,
body.light-mode .tiktok-cookie-table td strong {
    font-weight: 500;
}

/* Override lower opacities in light mode to keep text readable */
body.light-mode .spx-cookie-table td [style*="opacity"],
body.light-mode .tiktok-cookie-table td [style*="opacity"] {
    opacity: 0.95 !important;
}

/* Moderate opacity for specific placeholders and disabled items in light mode */
body.light-mode .spx-cookie-table td [style*="opacity:0.4"],
body.light-mode .spx-cookie-table td [style*="opacity: 0.4"],
body.light-mode .spx-cookie-table td [style*="opacity:0.45"],
body.light-mode .spx-cookie-table td [style*="opacity: 0.45"],
body.light-mode .spx-cookie-table td [style*="opacity:0.3"],
body.light-mode .spx-cookie-table td [style*="opacity: 0.3"],
body.light-mode .tiktok-cookie-table td [style*="opacity:0.4"],
body.light-mode .tiktok-cookie-table td [style*="opacity: 0.4"],
body.light-mode .tiktok-cookie-table td [style*="opacity:0.45"],
body.light-mode .tiktok-cookie-table td [style*="opacity: 0.45"],
body.light-mode .tiktok-cookie-table td [style*="opacity:0.3"],
body.light-mode .tiktok-cookie-table td [style*="opacity: 0.3"] {
    opacity: 0.65 !important;
}

/* Status colors contrast enhancement in light mode */
body.light-mode td [style*="#4caf50"],
body.light-mode .col-status [style*="#4caf50"],
body.light-mode .status-text-clamp[style*="#4caf50"] {
    color: #1b5e20 !important; /* Darker Green */
}
body.light-mode td [style*="#ff9800"],
body.light-mode .col-status [style*="#ff9800"],
body.light-mode .status-text-clamp[style*="#ff9800"] {
    color: #b76200 !important; /* Darker Orange */
}
body.light-mode td [style*="#e91e63"],
body.light-mode .col-status [style*="#e91e63"],
body.light-mode .status-text-clamp[style*="#e91e63"] {
    color: #ad1457 !important; /* Darker Pink */
}
body.light-mode td [style*="#f44336"],
body.light-mode .col-status [style*="#f44336"],
body.light-mode .status-text-clamp[style*="#f44336"] {
    color: #c62828 !important; /* Darker Red */
}
body.light-mode td [style*="#888"],
body.light-mode .col-status [style*="#888"],
body.light-mode .status-text-clamp[style*="#888"] {
    color: #4f565f !important; /* Darker Grey */
}
body.light-mode td [style*="#00bcd4"],
body.light-mode .col-status [style*="#00bcd4"],
body.light-mode .status-text-clamp[style*="#00bcd4"] {
    color: #007280 !important; /* Darker Cyan/Teal */
}

/* Tăng tương phản và độ đậm cho cột TRẠNG THÁI trên dashboard chính */
body.light-mode .col-status {
    color: #24292f;
    font-weight: 500;
}
body.light-mode .col-status [style*="opacity"] {
    opacity: 0.95 !important;
}

body.light-mode .tiktok-cookie-table td {
    border-bottom: 1px solid var(--border-color);
}

/* ── Dashboard Tabs ── */
.dashboard-tabs {
    display: flex;
    align-items: center;
    gap: 0;
    flex-wrap: wrap; /* Keep desktop style: wrap if needed */
    border-bottom: 2px solid var(--border-color, var(--border, #30363d));
    margin-bottom: 16px;
}

.dashboard-tab-btn {
    text-align: center;
    padding: 8px 18px 10px; /* Original 18px padding for desktop */
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    background: transparent;
    color: var(--text-muted, #8b949e);
    cursor: pointer;
    font-weight: 400;
    font-size: 0.9rem;
    white-space: nowrap;
    transition: color 0.15s, border-color 0.15s;
}

.dashboard-tab-btn:hover {
    color: var(--text-color, #c9d1d9);
}

body.light-mode .dashboard-tab-btn:hover {
    color: var(--text-color, #24292f);
}

.dashboard-tab-btn.active {
    border-bottom: 2px solid var(--primary-color, #238636);
    color: var(--primary-color, #238636);
    font-weight: 700;
}

.dashboard-custom-tab-item {
    position: relative;
    display: inline-flex;
    align-items: stretch;
    flex: 0 0 auto;
    margin-bottom: -2px;
    border-bottom: 2px solid transparent;
}

.dashboard-custom-tab-item.active {
    border-bottom-color: var(--primary-color, #238636);
}

.dashboard-custom-tab-item .dashboard-tab-btn {
    margin-bottom: 0;
    padding-right: 38px;
    border-bottom: none;
}

.dashboard-custom-tab-item.active .dashboard-tab-btn {
    color: var(--primary-color, #238636);
    font-weight: 700;
}

.dashboard-custom-tab-edit-btn {
    position: absolute;
    top: 3px;
    right: 6px;
    z-index: 1;
    display: inline-flex;
    width: 25px;
    height: 25px;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 5px;
    background: transparent;
    color: var(--text-muted, #8b949e);
    cursor: pointer;
    font-size: 0.68rem;
}

.dashboard-custom-tab-edit-btn:hover,
.dashboard-custom-tab-edit-btn:focus-visible {
    border-color: var(--border-color, var(--border, #30363d));
    background: rgba(139, 148, 158, 0.12);
    color: var(--primary-color, #3fb950);
    outline: none;
}

body.light-mode .dashboard-custom-tab-edit-btn:hover,
body.light-mode .dashboard-custom-tab-edit-btn:focus-visible {
    background: rgba(36, 41, 47, 0.08);
}

.dashboard-tab-add-btn {
    color: var(--text-muted, #8b949e);
    font-weight: 600;
    border-left: 1px dashed var(--border-color, var(--border, #30363d));
}

.dashboard-tab-add-btn:hover {
    color: var(--primary-color, #238636);
}

.dashboard-custom-tab-editor {
    margin: 0 0 18px;
    padding: 14px;
    border: 1px solid var(--border-color, var(--border, #30363d));
    border-radius: 10px;
    background: var(--card-bg, #161b22);
}

.dashboard-custom-tab-editor-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.dashboard-custom-tab-editor-title {
    color: var(--text-color, #e6edf3);
    font-size: 0.95rem;
    font-weight: 700;
}

.dashboard-custom-tab-editor-help {
    margin-top: 4px;
    color: var(--text-muted, #8b949e);
    font-size: 0.78rem;
    line-height: 1.45;
}

.dashboard-custom-tab-limit {
    flex: 0 0 auto;
    padding: 3px 8px;
    border: 1px solid var(--border-color, var(--border, #30363d));
    border-radius: 999px;
    color: var(--text-muted, #8b949e);
    font-size: 0.72rem;
}

.dashboard-custom-tab-name-field {
    display: grid;
    grid-template-columns: 160px minmax(220px, 1fr);
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    color: var(--text-color, #e6edf3);
    font-size: 0.82rem;
    font-weight: 600;
}

.dashboard-custom-tab-name-field input,
.dashboard-custom-filter-row input {
    width: 100%;
    min-width: 0;
    height: 36px;
    box-sizing: border-box;
    padding: 0 10px;
    border: 1px solid var(--border-color, var(--border, #30363d));
    border-radius: 7px;
    outline: none;
    background: var(--input-bg, #0d1117);
    color: var(--text-color, #e6edf3);
    font: inherit;
    font-weight: 400;
}

.dashboard-custom-tab-name-field input:focus,
.dashboard-custom-filter-row input:focus {
    border-color: var(--primary-color, #238636);
    box-shadow: 0 0 0 2px rgba(35, 134, 54, 0.2);
}

.dashboard-custom-filter-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dashboard-custom-filter-row {
    display: grid;
    grid-template-columns: 32px 220px minmax(220px, 1fr);
    align-items: center;
    gap: 8px;
}

.dashboard-custom-filter-priority {
    display: inline-flex;
    width: 26px;
    height: 26px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(35, 134, 54, 0.18);
    color: var(--primary-color, #3fb950);
    font-size: 0.78rem;
    font-weight: 800;
}

/* ── Multi-select dropdown for custom tab fields ─────────────────── */
.dcf-multi-select {
    position: relative;
    min-width: 0;
}

.dcf-multi-select-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    width: 100%;
    min-width: 0;
    height: 36px;
    box-sizing: border-box;
    padding: 0 10px;
    border: 1px solid var(--border-color, var(--border, #30363d));
    border-radius: 7px;
    outline: none;
    background: var(--input-bg, #0d1117);
    color: var(--text-color, #e6edf3);
    font: inherit;
    font-weight: 400;
    cursor: pointer;
    text-align: left;
}

.dcf-multi-select-btn:hover {
    border-color: var(--primary-color, #238636);
}

.dcf-multi-select-btn:focus {
    border-color: var(--primary-color, #238636);
    box-shadow: 0 0 0 2px rgba(35, 134, 54, 0.2);
}

.dcf-multi-select-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
    font-size: 0.82rem;
}

.dcf-multi-select-arrow {
    font-size: 0.65rem;
    opacity: 0.6;
    flex-shrink: 0;
}

.dcf-multi-select-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    z-index: 100;
    min-width: 100%;
    max-width: 320px;
    padding: 6px 0;
    border: 1px solid var(--border-color, var(--border, #30363d));
    border-radius: 8px;
    background: var(--card-bg, #161b22);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.dcf-multi-select-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    cursor: pointer;
    font-size: 0.82rem;
    color: var(--text-color, #e6edf3);
    white-space: nowrap;
    user-select: none;
}

.dcf-multi-select-option:hover {
    background: rgba(35, 134, 54, 0.12);
}

.dcf-multi-select-option input[type="checkbox"] {
    width: 15px;
    height: 15px;
    margin: 0;
    cursor: pointer;
    accent-color: var(--primary-color, #238636);
    flex-shrink: 0;
}

.dcf-multi-select-all {
    border-top: 1px solid var(--border-color, var(--border, #30363d));
    margin-top: 4px;
    padding-top: 8px;
}

.dashboard-custom-tab-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
    padding-left: 40px;
}

.dashboard-custom-cancel-btn {
    background: #3a414b;
}

.dashboard-custom-delete-btn {
    margin-left: auto;
}

.dashboard-custom-result-header {
    margin-top: 4px;
}

.dashboard-custom-result-subtitle {
    margin: 0 0 8px;
    color: var(--text-muted, #8b949e);
    font-size: 0.84rem;
    font-weight: 700;
}

.dashboard-custom-tab-empty {
    margin: 4px 0 20px;
    padding: 18px;
    border: 1px dashed var(--border-color, var(--border, #30363d));
    border-radius: 8px;
    color: var(--text-muted, #8b949e);
    text-align: center;
    font-size: 0.85rem;
}

body.light-mode .dashboard-custom-tab-editor {
    background: #ffffff;
}

body.light-mode .dashboard-custom-tab-name-field input,
body.light-mode .dashboard-custom-filter-row input {
    background: #ffffff;
    color: #24292f;
}

body.light-mode .dcf-multi-select-btn {
    background: #ffffff;
    color: #24292f;
}

body.light-mode .dcf-multi-select-dropdown {
    background: #ffffff;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

body.light-mode .dcf-multi-select-option {
    color: #24292f;
}

body.light-mode .dcf-multi-select-option:hover {
    background: rgba(35, 134, 54, 0.08);
}

@media (max-width: 768px) {
    .dashboard-tabs {
        flex-wrap: nowrap; /* Prevent tabs wrapping to next line on mobile */
        overflow-x: auto; /* Support scroll if screen is extremely narrow */
        scrollbar-width: none; /* Hide scrollbar */
    }
    .dashboard-tabs::-webkit-scrollbar {
        display: none; /* Hide scrollbar for WebKit browsers */
    }

    .dashboard-tab-btn {
        flex: 0 0 auto;
        padding: 8px 6px 10px; /* Reduced side padding on mobile */
        font-size: 0.82rem; /* Slightly smaller text for fitment */
    }

    .dashboard-custom-tab-editor {
        padding: 12px;
    }

    .dashboard-custom-tab-name-field,
    .dashboard-custom-filter-row {
        grid-template-columns: 32px minmax(0, 1fr);
    }

    .dashboard-custom-tab-name-field > span {
        grid-column: 1 / -1;
    }

    .dashboard-custom-tab-name-field input {
        grid-column: 1 / -1;
    }

    .dcf-multi-select {
        grid-column: 2;
    }

    .dashboard-custom-filter-row input {
        grid-column: 2;
    }

    .dashboard-custom-tab-actions {
        padding-left: 0;
    }

}

/* ==========================================================================
   Dashboard View Mode & Sheet (Jspreadsheet) Styling
   ========================================================================== */

.dashboard-view-mode-selector {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background: var(--card-bg, #161b22);
    border: 1px solid var(--border-color, #30363d);
    border-radius: 8px;
    padding: 6px 14px;
    font-size: 0.85rem;
    color: var(--text-color, #c9d1d9);
    user-select: none;
}

.dashboard-view-mode-selector .view-mode-label {
    font-weight: 600;
    color: var(--text-muted, #8b949e);
    margin-right: 2px;
}

.dashboard-view-mode-selector label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    font-weight: 500;
    transition: color 0.15s ease;
    margin: 0;
}

.dashboard-view-mode-selector label:hover {
    color: var(--info, #58a6ff);
}

.dashboard-view-mode-selector input[type="radio"] {
    accent-color: var(--primary-color, #238636);
    cursor: pointer;
    margin: 0;
}

.dashboard-merge-cancelled-container {
    display: inline-flex;
    align-items: center;
}

.dashboard-merge-cancelled-container .merge-cancelled-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 0.82rem;
    color: var(--muted-color, #8b949e);
    user-select: none;
    padding: 6px 12px;
    background: var(--card-bg, #161b22);
    border: 1px solid var(--border-color, #30363d);
    border-radius: 8px;
    margin: 0;
    transition: all 0.15s ease;
}

.dashboard-merge-cancelled-container .merge-cancelled-label:hover {
    color: var(--text-color, #f0f6fc);
    border-color: var(--danger, #f85149);
}

.dashboard-merge-cancelled-container input[type="checkbox"] {
    width: 15px;
    height: 15px;
    accent-color: #f85149;
    cursor: pointer;
    margin: 0;
}

@media (max-width: 600px) {
    .dashboard-view-mode-selector {
        width: 100%;
        justify-content: space-between;
        padding: 6px 12px;
        font-size: 0.82rem;
    }
    .dashboard-merge-cancelled-container {
        width: 100%;
        margin-top: 2px;
    }
    .dashboard-merge-cancelled-container .merge-cancelled-label {
        width: 100%;
        justify-content: flex-start;
        font-size: 0.8rem;
    }
}

.dashboard-sheet-wrapper {
    width: 100%;
    background: var(--card-bg, #161b22);
    border: 1px solid var(--border-color, #30363d);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    margin-top: 12px;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
}

/* Jspreadsheet Container & Structure */
.jexcel_container {
    width: 100% !important;
    background: transparent !important;
    font-family: inherit !important;
    color: var(--text-color, #c9d1d9) !important;
}

.jexcel_content {
    max-height: calc(100vh - 240px);
    overflow: auto !important;
    width: 100% !important;
    display: block !important;
    box-sizing: border-box;
    scrollbar-width: auto !important;
}

.jexcel {
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.70rem;
    background: var(--card-bg, #161b22) !important;
    color: var(--text-color, #c9d1d9) !important;
}

.jexcel_content::-webkit-scrollbar {
    width: 14px;
    height: 14px;
}

.jexcel_content::-webkit-scrollbar-track {
    background: var(--card-bg, #161b22);
    border-top: 1px solid var(--border-color, #30363d);
}

.jexcel_content::-webkit-scrollbar-thumb {
    background: #484f58;
    border-radius: 7px;
    border: 3px solid var(--card-bg, #161b22);
}

.jexcel_content::-webkit-scrollbar-thumb:hover {
    background: #6e7681;
}

.jexcel_content::-webkit-scrollbar-thumb:active {
    background: #8b949e;
}

body.light-mode .jexcel_content::-webkit-scrollbar-track {
    background: #f6f8fa;
    border-top: 1px solid #d0d7de;
}

body.light-mode .jexcel_content::-webkit-scrollbar-thumb {
    background: #afb8c1;
    border: 3px solid #f6f8fa;
}

body.light-mode .jexcel_content::-webkit-scrollbar-thumb:hover {
    background: #8c959f;
}

body.light-mode .jexcel_content::-webkit-scrollbar-thumb:active {
    background: #656d76;
}

/* Table Header - Kept at standard size for clear hierarchy */
.jexcel thead td,
.jexcel > thead > tr > td {
    background: var(--table-header-bg, #21262d) !important;
    color: var(--text-color, #f0f6fc) !important;
    font-weight: 700 !important;
    font-size: 0.83rem !important;
    border-color: var(--border-color, #30363d) !important;
    padding: 7px 6px !important;
    text-align: center !important;
    position: sticky;
    top: 0;
    z-index: 10;
    letter-spacing: 0.3px;
    cursor: default;
    user-select: none;
}

/* Sort Arrow indicator on table header */
.jexcel thead td.arrow-up,
.jexcel > thead > tr > td.arrow-up {
    background-repeat: no-repeat !important;
    background-position: calc(100% - 4px) center !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='%2358a6ff'%3E%3Cpath d='M7 14l5-5 5 5z'/%3E%3C/svg%3E") !important;
    padding-right: 18px !important;
}

.jexcel thead td.arrow-down,
.jexcel > thead > tr > td.arrow-down {
    background-repeat: no-repeat !important;
    background-position: calc(100% - 4px) center !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='%2358a6ff'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E") !important;
    padding-right: 18px !important;
}

/* Hide default Jspreadsheet built-in row index numbers and its colgroup spacer (jexcel_selectall / jexcel_row) */
.jexcel colgroup > col:first-child,
.jexcel thead td.jexcel_selectall,
.jexcel tbody td.jexcel_row,
.jexcel > thead > tr > td.jexcel_selectall,
.jexcel > tbody > tr > td.jexcel_row {
    display: none !important;
    width: 0 !important;
    max-width: 0 !important;
    min-width: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
}

/* Table Body Cells - Left aligned by default, compact font for full overview */
.jexcel tbody td,
.jexcel > tbody > tr > td {
    background: var(--card-bg, #161b22);
    border-color: var(--border-color, #30363d) !important;
    color: var(--text-color, #c9d1d9) !important;
    font-size: 0.70rem !important;
    padding: 3px 5px !important;
    vertical-align: middle;
    line-height: 1.3;
    text-align: left !important;
}

/* STT column is centered */
.jexcel tbody td[data-x="0"],
.jexcel > tbody > tr > td[data-x="0"] {
    text-align: center !important;
}

/* Alternating Rows */
body:not(.light-mode) .jexcel tbody tr:not(.received-ok-row):nth-child(even) > td,
body:not(.light-mode) .jexcel > tbody > tr:not(.received-ok-row):nth-child(even) > td {
    background-color: rgba(255, 255, 255, 0.02) !important;
}

body.light-mode .jexcel tbody tr:not(.received-ok-row):nth-child(even) > td,
body.light-mode .jexcel > tbody > tr:not(.received-ok-row):nth-child(even) > td {
    background-color: #f6f8fa !important;
}

/* Readonly cells MUST NOT fade out data - they contain primary order info */
.jexcel tbody td.readonly,
.jexcel > tbody > tr > td.readonly {
    color: var(--text-color, #c9d1d9) !important;
}

/* Row Hover */
body:not(.light-mode) .jexcel tbody tr:not(.received-ok-row):hover > td,
body:not(.light-mode) .jexcel > tbody > tr:not(.received-ok-row):hover > td {
    background-color: var(--table-row-hover, #1c2128) !important;
}

body.light-mode .jexcel tbody tr:not(.received-ok-row):hover > td,
body.light-mode .jexcel > tbody > tr:not(.received-ok-row):hover > td {
    background-color: #f1f5f9 !important;
}

/* Dark Mode: Entire Row Selection / Highlight */
body:not(.light-mode) .jexcel tbody tr:not(.received-ok-row):has(> td.highlight) > td,
body:not(.light-mode) .jexcel tbody tr:not(.received-ok-row):has(> td.selected) > td,
body:not(.light-mode) .jexcel tbody tr:not(.received-ok-row):has(> td.highlight-selected) > td,
body:not(.light-mode) .jexcel tbody tr:not(.received-ok-row).row-selected > td,
body:not(.light-mode) .jexcel > tbody > tr:not(.received-ok-row):has(> td.highlight) > td,
body:not(.light-mode) .jexcel > tbody > tr:not(.received-ok-row):has(> td.selected) > td,
body:not(.light-mode) .jexcel > tbody > tr:not(.received-ok-row):has(> td.highlight-selected) > td,
body:not(.light-mode) .jexcel > tbody > tr:not(.received-ok-row).row-selected > td,
body.dark-mode .jexcel tbody tr:not(.received-ok-row):has(> td.highlight) > td,
body.dark-mode .jexcel tbody tr:not(.received-ok-row):has(> td.selected) > td,
body.dark-mode .jexcel tbody tr:not(.received-ok-row):has(> td.highlight-selected) > td,
body.dark-mode .jexcel tbody tr:not(.received-ok-row).row-selected > td,
body.dark-mode .jexcel > tbody > tr:not(.received-ok-row):has(> td.highlight) > td,
body.dark-mode .jexcel > tbody > tr:not(.received-ok-row):has(> td.selected) > td,
body.dark-mode .jexcel > tbody > tr:not(.received-ok-row):has(> td.highlight-selected) > td,
body.dark-mode .jexcel > tbody > tr:not(.received-ok-row).row-selected > td {
    background-color: rgba(56, 139, 253, 0.16) !important;
}

/* Dark Mode: Actively selected cell gets slightly stronger highlight */
body:not(.light-mode) .jexcel tbody td.highlight.highlight-selected,
body:not(.light-mode) .jexcel tbody td.selected,
body:not(.light-mode) .jexcel > tbody > tr > td.selected,
body.dark-mode .jexcel tbody td.highlight.highlight-selected,
body.dark-mode .jexcel tbody td.selected,
body.dark-mode .jexcel > tbody > tr > td.selected {
    background-color: rgba(56, 139, 253, 0.28) !important;
}

/* Light Mode: Entire Row Selection / Highlight */
body.light-mode .jexcel tbody tr:not(.received-ok-row):has(> td.highlight) > td,
body.light-mode .jexcel tbody tr:not(.received-ok-row):has(> td.selected) > td,
body.light-mode .jexcel tbody tr:not(.received-ok-row):has(> td.highlight-selected) > td,
body.light-mode .jexcel tbody tr:not(.received-ok-row).row-selected > td,
body.light-mode .jexcel > tbody > tr:not(.received-ok-row):has(> td.highlight) > td,
body.light-mode .jexcel > tbody > tr:not(.received-ok-row):has(> td.selected) > td,
body.light-mode .jexcel > tbody > tr:not(.received-ok-row):has(> td.highlight-selected) > td,
body.light-mode .jexcel > tbody > tr:not(.received-ok-row).row-selected > td {
    background-color: rgba(9, 105, 218, 0.16) !important;
}

/* Light Mode: Actively selected cell gets slightly stronger highlight */
body.light-mode .jexcel tbody td.highlight.highlight-selected,
body.light-mode .jexcel tbody td.selected,
body.light-mode .jexcel > tbody > tr > td.selected {
    background-color: rgba(9, 105, 218, 0.28) !important;
}

/* Sheet View: Đã nhận row styling (xanh nổi bật, không bị alternating/hover làm mất màu) */
body:not(.light-mode) .jexcel tbody tr.received-ok-row > td,
body:not(.light-mode) .jexcel tbody tr.received-ok-row:nth-child(even) > td,
body:not(.light-mode) .jexcel tbody tr.received-ok-row:nth-child(odd) > td,
body:not(.light-mode) .jexcel > tbody > tr.received-ok-row > td,
body:not(.light-mode) .jexcel > tbody > tr.received-ok-row:nth-child(even) > td,
body:not(.light-mode) .jexcel > tbody > tr.received-ok-row:nth-child(odd) > td,
body.dark-mode .jexcel tbody tr.received-ok-row > td,
body.dark-mode .jexcel tbody tr.received-ok-row:nth-child(even) > td,
body.dark-mode .jexcel tbody tr.received-ok-row:nth-child(odd) > td,
body.dark-mode .jexcel > tbody > tr.received-ok-row > td,
body.dark-mode .jexcel > tbody > tr.received-ok-row:nth-child(even) > td,
body.dark-mode .jexcel > tbody > tr.received-ok-row:nth-child(odd) > td,
.jexcel tbody tr.received-ok-row > td,
.jexcel tbody tr.received-ok-row:nth-child(even) > td,
.jexcel tbody tr.received-ok-row:nth-child(odd) > td,
.jexcel > tbody > tr.received-ok-row > td,
.jexcel > tbody > tr.received-ok-row:nth-child(even) > td,
.jexcel > tbody > tr.received-ok-row:nth-child(odd) > td {
    background-color: rgba(35, 134, 54, 0.24) !important;
}

body:not(.light-mode) .jexcel tbody tr.received-ok-row:hover > td,
body:not(.light-mode) .jexcel tbody tr.received-ok-row:hover:nth-child(even) > td,
body:not(.light-mode) .jexcel tbody tr.received-ok-row:hover:nth-child(odd) > td,
body:not(.light-mode) .jexcel > tbody > tr.received-ok-row:hover > td,
body:not(.light-mode) .jexcel > tbody > tr.received-ok-row:hover:nth-child(even) > td,
body:not(.light-mode) .jexcel > tbody > tr.received-ok-row:hover:nth-child(odd) > td,
body.dark-mode .jexcel tbody tr.received-ok-row:hover > td,
body.dark-mode .jexcel tbody tr.received-ok-row:hover:nth-child(even) > td,
body.dark-mode .jexcel tbody tr.received-ok-row:hover:nth-child(odd) > td,
body.dark-mode .jexcel > tbody > tr.received-ok-row:hover > td,
body.dark-mode .jexcel > tbody > tr.received-ok-row:hover:nth-child(even) > td,
body.dark-mode .jexcel > tbody > tr.received-ok-row:hover:nth-child(odd) > td,
.jexcel tbody tr.received-ok-row:hover > td,
.jexcel tbody tr.received-ok-row:hover:nth-child(even) > td,
.jexcel tbody tr.received-ok-row:hover:nth-child(odd) > td,
.jexcel > tbody > tr.received-ok-row:hover > td,
.jexcel > tbody > tr.received-ok-row:hover:nth-child(even) > td,
.jexcel > tbody > tr.received-ok-row:hover:nth-child(odd) > td {
    background-color: rgba(35, 134, 54, 0.30) !important;
}

body:not(.light-mode) .jexcel tbody tr.received-ok-row:has(> td.highlight) > td,
body:not(.light-mode) .jexcel tbody tr.received-ok-row:has(> td.selected) > td,
body:not(.light-mode) .jexcel tbody tr.received-ok-row:has(> td.highlight-selected) > td,
body:not(.light-mode) .jexcel tbody tr.received-ok-row.row-selected > td,
body:not(.light-mode) .jexcel > tbody > tr.received-ok-row:has(> td.highlight) > td,
body:not(.light-mode) .jexcel > tbody > tr.received-ok-row:has(> td.selected) > td,
body:not(.light-mode) .jexcel > tbody > tr.received-ok-row:has(> td.highlight-selected) > td,
body:not(.light-mode) .jexcel > tbody > tr.received-ok-row.row-selected > td,
body.dark-mode .jexcel tbody tr.received-ok-row:has(> td.highlight) > td,
body.dark-mode .jexcel tbody tr.received-ok-row:has(> td.selected) > td,
body.dark-mode .jexcel tbody tr.received-ok-row:has(> td.highlight-selected) > td,
body.dark-mode .jexcel tbody tr.received-ok-row.row-selected > td,
body.dark-mode .jexcel > tbody > tr.received-ok-row:has(> td.highlight) > td,
body.dark-mode .jexcel > tbody > tr.received-ok-row:has(> td.selected) > td,
body.dark-mode .jexcel > tbody > tr.received-ok-row:has(> td.highlight-selected) > td,
body.dark-mode .jexcel > tbody > tr.received-ok-row.row-selected > td {
    background-color: rgba(35, 134, 54, 0.38) !important;
}

body.light-mode .jexcel tbody tr.received-ok-row > td,
body.light-mode .jexcel tbody tr.received-ok-row:nth-child(even) > td,
body.light-mode .jexcel tbody tr.received-ok-row:nth-child(odd) > td,
body.light-mode .jexcel > tbody > tr.received-ok-row > td,
body.light-mode .jexcel > tbody > tr.received-ok-row:nth-child(even) > td,
body.light-mode .jexcel > tbody > tr.received-ok-row:nth-child(odd) > td {
    background-color: rgba(46, 160, 67, 0.18) !important;
}

body.light-mode .jexcel tbody tr.received-ok-row:hover > td,
body.light-mode .jexcel tbody tr.received-ok-row:hover:nth-child(even) > td,
body.light-mode .jexcel tbody tr.received-ok-row:hover:nth-child(odd) > td,
body.light-mode .jexcel > tbody > tr.received-ok-row:hover > td,
body.light-mode .jexcel > tbody > tr.received-ok-row:hover:nth-child(even) > td,
body.light-mode .jexcel > tbody > tr.received-ok-row:hover:nth-child(odd) > td {
    background-color: rgba(46, 160, 67, 0.25) !important;
}

body.light-mode .jexcel tbody tr.received-ok-row:has(> td.highlight) > td,
body.light-mode .jexcel tbody tr.received-ok-row:has(> td.selected) > td,
body.light-mode .jexcel tbody tr.received-ok-row:has(> td.highlight-selected) > td,
body.light-mode .jexcel tbody tr.received-ok-row.row-selected > td,
body.light-mode .jexcel > tbody > tr.received-ok-row:has(> td.highlight) > td,
body.light-mode .jexcel > tbody > tr.received-ok-row:has(> td.selected) > td,
body.light-mode .jexcel > tbody > tr.received-ok-row:has(> td.highlight-selected) > td,
body.light-mode .jexcel > tbody > tr.received-ok-row.row-selected > td {
    background-color: rgba(46, 160, 67, 0.32) !important;
}

/* Pagination Bar */
.jexcel_pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--card-bg, #161b22);
    border-top: 1px solid var(--border-color, #30363d);
    color: var(--text-color, #c9d1d9) !important;
    font-size: 0.82rem;
}

.jexcel_pagination > div {
    display: flex;
    align-items: center;
    color: var(--text-color, #c9d1d9) !important;
}

.jexcel_pagination > div > div {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 30px;
    padding: 0 6px;
    border-radius: 6px;
    border: 1px solid var(--border-color, #30363d) !important;
    background: var(--table-header-bg, #21262d) !important;
    color: var(--text-color, #c9d1d9) !important;
    font-size: 0.82rem;
    cursor: pointer;
    transition: all 0.15s ease;
    margin: 0 2px;
}

.jexcel_pagination > div > div:hover {
    border-color: var(--info, #58a6ff) !important;
    color: var(--info, #58a6ff) !important;
}

.jexcel_pagination > div > div.jexcel_page_selected {
    background-color: var(--primary-color, #238636) !important;
    color: #ffffff !important;
    border-color: var(--primary-color, #238636) !important;
    font-weight: 700;
}

/* Dropdown Popup Container & Context Menu in Dark Mode */
.jdropdown-container,
.jdropdown-default .jdropdown-container,
.jdropdown-picker .jdropdown-container,
.jcontextmenu,
.jexcel_contextmenu {
    background: var(--card-bg, #161b22) !important;
    background-color: var(--card-bg, #161b22) !important;
    border: 1px solid var(--border-color, #30363d) !important;
    color: var(--text-color, #f0f6fc) !important;
    border-radius: 8px !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6) !important;
    padding: 4px 0 !important;
    z-index: 100000 !important;
    font-family: inherit !important;
    overflow: hidden !important;
}

/* Dropdown Content - Remove nested double border & background, add sleek scrollbar */
.jdropdown-content,
.jdropdown-default .jdropdown-content,
.jdropdown-picker .jdropdown-content {
    background: transparent !important;
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 2px 0 !important;
    margin: 0 !important;
    max-height: 240px !important;
    overflow-y: auto !important;
    scrollbar-width: thin !important;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent !important;
}

.jdropdown-content::-webkit-scrollbar,
.jdropdown-default .jdropdown-content::-webkit-scrollbar {
    width: 6px !important;
}

.jdropdown-content::-webkit-scrollbar-button,
.jdropdown-default .jdropdown-content::-webkit-scrollbar-button {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
}

.jdropdown-content::-webkit-scrollbar-track,
.jdropdown-default .jdropdown-content::-webkit-scrollbar-track {
    background: transparent !important;
}

.jdropdown-content::-webkit-scrollbar-thumb,
.jdropdown-default .jdropdown-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2) !important;
    border-radius: 4px !important;
}

.jdropdown-content::-webkit-scrollbar-thumb:hover,
.jdropdown-default .jdropdown-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.35) !important;
}

.jcontextmenu > div,
.jexcel_contextmenu > div {
    color: var(--text-color, #f0f6fc) !important;
    background: transparent !important;
    background-color: transparent !important;
    padding: 8px 16px !important;
    font-size: 0.84rem !important;
    font-family: inherit !important;
    cursor: pointer !important;
    transition: background 0.12s ease, color 0.12s ease !important;
    width: auto !important;
    min-width: 220px !important;
}

.jcontextmenu > div a,
.jexcel_contextmenu > div a,
.jcontextmenu a,
.jexcel_contextmenu a {
    color: var(--text-color, #f0f6fc) !important;
    font-size: 0.84rem !important;
    font-weight: 500 !important;
    text-decoration: none !important;
}

.jcontextmenu > div span,
.jexcel_contextmenu > div span {
    color: var(--text-muted, #8b949e) !important;
    font-size: 0.75rem !important;
}

.jcontextmenu > div:hover,
.jexcel_contextmenu > div:hover,
.jcontextmenu > div:hover a,
.jexcel_contextmenu > div:hover a {
    background: var(--primary-color, #238636) !important;
    background-color: var(--primary-color, #238636) !important;
    color: #ffffff !important;
}

.jcontextmenu > div:hover span,
.jexcel_contextmenu > div:hover span {
    color: rgba(255, 255, 255, 0.85) !important;
}

.jcontextmenu hr,
.jexcel_contextmenu hr {
    border: 0 !important;
    border-top: 1px solid var(--border-color, #30363d) !important;
    margin: 5px 0 !important;
}

.jdropdown-item,
.jdropdown-default .jdropdown-item,
.jdropdown-picker .jdropdown-item {
    color: var(--text-color, #f0f6fc) !important;
    background-color: transparent !important;
    padding: 7px 14px !important;
    margin: 1px 4px !important;
    border-radius: 4px !important;
    font-size: 0.84rem !important;
    cursor: pointer !important;
    white-space: nowrap !important;
    transition: background-color 0.12s ease, color 0.12s ease !important;
}

.jdropdown-item:hover,
.jdropdown-default .jdropdown-item:hover,
.jdropdown-picker .jdropdown-item:hover,
.jdropdown-cursor,
.jdropdown-default .jdropdown-cursor {
    background-color: rgba(56, 139, 253, 0.18) !important;
    color: var(--info, #58a6ff) !important;
}

.jdropdown-selected,
.jdropdown-default .jdropdown-selected,
.jdropdown-item.selected,
.jdropdown-picker .jdropdown-selected {
    background-color: var(--primary-color, #238636) !important;
    color: #ffffff !important;
    font-weight: 700 !important;
}

/* Light mode for Dropdown Popup & Context Menu */
body.light-mode .jdropdown-container,
body.light-mode .jdropdown-default .jdropdown-container,
body.light-mode .jdropdown-picker .jdropdown-container,
body.light-mode .jcontextmenu,
body.light-mode .jexcel_contextmenu {
    background: #ffffff !important;
    background-color: #ffffff !important;
    border: 1px solid #d0d7de !important;
    box-shadow: 0 8px 24px rgba(140, 149, 159, 0.25) !important;
}

body.light-mode .jdropdown-content,
body.light-mode .jdropdown-default .jdropdown-content,
body.light-mode .jdropdown-picker .jdropdown-content {
    background: transparent !important;
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
    scrollbar-color: #d0d7de transparent !important;
}

body.light-mode .jdropdown-content::-webkit-scrollbar-thumb,
body.light-mode .jdropdown-default .jdropdown-content::-webkit-scrollbar-thumb {
    background: #d0d7de !important;
    border-radius: 4px !important;
}

body.light-mode .jdropdown-content::-webkit-scrollbar-thumb:hover,
body.light-mode .jdropdown-default .jdropdown-content::-webkit-scrollbar-thumb:hover {
    background: #afb8c1 !important;
}

body.light-mode .jcontextmenu > div,
body.light-mode .jexcel_contextmenu > div,
body.light-mode .jcontextmenu > div a,
body.light-mode .jexcel_contextmenu > div a {
    color: #24292f !important;
}

body.light-mode .jcontextmenu > div:hover,
body.light-mode .jexcel_contextmenu > div:hover,
body.light-mode .jcontextmenu > div:hover a,
body.light-mode .jexcel_contextmenu > div:hover a {
    background: #2ea043 !important;
    background-color: #2ea043 !important;
    color: #ffffff !important;
}

body.light-mode .jcontextmenu hr,
body.light-mode .jexcel_contextmenu hr {
    border-top: 1px solid #e1e4e8 !important;
}

body.light-mode .jdropdown-item,
body.light-mode .jdropdown-default .jdropdown-item {
    color: #24292f !important;
}

body.light-mode .jdropdown-item:hover,
body.light-mode .jdropdown-default .jdropdown-item:hover,
body.light-mode .jdropdown-cursor {
    background-color: #f3f4f6 !important;
    color: #0969da !important;
}

body.light-mode .jdropdown-selected,
body.light-mode .jdropdown-default .jdropdown-selected,
body.light-mode .jdropdown-item.selected {
    background-color: #2ea043 !important;
    color: #ffffff !important;
}

/* Full-cell background coloring for MVĐ and Trạng Thái */
.jexcel tbody td.sheet-cell-delivered {
    background-color: #238636 !important;
    color: #ffffff !important;
    font-weight: 600 !important;
}

.jexcel tbody td.sheet-cell-delivered,
.jexcel tbody td.sheet-cell-delivered * {
    color: #ffffff !important;
}

.jexcel tbody td.sheet-cell-delivering {
    background-color: #cf6900 !important;
    color: #ffffff !important;
    font-weight: 600 !important;
}

.jexcel tbody td.sheet-cell-delivering,
.jexcel tbody td.sheet-cell-delivering * {
    color: #ffffff !important;
}

.jexcel tbody td.sheet-cell-cancelled {
    background-color: #cf222e !important;
    color: #ffffff !important;
    font-weight: 600 !important;
}

.jexcel tbody td.sheet-cell-cancelled,
.jexcel tbody td.sheet-cell-cancelled * {
    color: #ffffff !important;
}

body.light-mode .jexcel tbody td.sheet-cell-delivered {
    background-color: #2ea043 !important;
    color: #ffffff !important;
}

body.light-mode .jexcel tbody td.sheet-cell-delivering {
    background-color: #d97706 !important;
    color: #ffffff !important;
}

body.light-mode .jexcel tbody td.sheet-cell-cancelled {
    background-color: #d1242f !important;
    color: #ffffff !important;
}

/* Keep MVĐ and Trạng Thái highlight intact on received-ok-row in sheet */
body:not(.light-mode) .jexcel tbody tr.received-ok-row > td.sheet-cell-delivered,
body:not(.light-mode) .jexcel tbody tr.received-ok-row:hover > td.sheet-cell-delivered,
body:not(.light-mode) .jexcel tbody tr.received-ok-row.row-selected > td.sheet-cell-delivered,
body:not(.light-mode) .jexcel > tbody > tr.received-ok-row > td.sheet-cell-delivered,
body:not(.light-mode) .jexcel > tbody > tr.received-ok-row:hover > td.sheet-cell-delivered,
body:not(.light-mode) .jexcel > tbody > tr.received-ok-row.row-selected > td.sheet-cell-delivered,
body.dark-mode .jexcel tbody tr.received-ok-row > td.sheet-cell-delivered,
body.dark-mode .jexcel tbody tr.received-ok-row:hover > td.sheet-cell-delivered,
body.dark-mode .jexcel tbody tr.received-ok-row.row-selected > td.sheet-cell-delivered,
body.dark-mode .jexcel > tbody > tr.received-ok-row > td.sheet-cell-delivered,
body.dark-mode .jexcel > tbody > tr.received-ok-row:hover > td.sheet-cell-delivered,
body.dark-mode .jexcel > tbody > tr.received-ok-row.row-selected > td.sheet-cell-delivered,
.jexcel tbody tr.received-ok-row > td.sheet-cell-delivered,
.jexcel tbody tr.received-ok-row:hover > td.sheet-cell-delivered,
.jexcel tbody tr.received-ok-row.row-selected > td.sheet-cell-delivered,
.jexcel > tbody > tr.received-ok-row > td.sheet-cell-delivered,
.jexcel > tbody > tr.received-ok-row:hover > td.sheet-cell-delivered,
.jexcel > tbody > tr.received-ok-row.row-selected > td.sheet-cell-delivered {
    background-color: #238636 !important;
    color: #ffffff !important;
    font-weight: 600 !important;
}

body:not(.light-mode) .jexcel tbody tr.received-ok-row > td.sheet-cell-delivering,
body:not(.light-mode) .jexcel tbody tr.received-ok-row:hover > td.sheet-cell-delivering,
body:not(.light-mode) .jexcel tbody tr.received-ok-row.row-selected > td.sheet-cell-delivering,
body:not(.light-mode) .jexcel > tbody > tr.received-ok-row > td.sheet-cell-delivering,
body:not(.light-mode) .jexcel > tbody > tr.received-ok-row:hover > td.sheet-cell-delivering,
body:not(.light-mode) .jexcel > tbody > tr.received-ok-row.row-selected > td.sheet-cell-delivering,
body.dark-mode .jexcel tbody tr.received-ok-row > td.sheet-cell-delivering,
body.dark-mode .jexcel tbody tr.received-ok-row:hover > td.sheet-cell-delivering,
body.dark-mode .jexcel tbody tr.received-ok-row.row-selected > td.sheet-cell-delivering,
body.dark-mode .jexcel > tbody > tr.received-ok-row > td.sheet-cell-delivering,
body.dark-mode .jexcel > tbody > tr.received-ok-row:hover > td.sheet-cell-delivering,
body.dark-mode .jexcel > tbody > tr.received-ok-row.row-selected > td.sheet-cell-delivering,
.jexcel tbody tr.received-ok-row > td.sheet-cell-delivering,
.jexcel tbody tr.received-ok-row:hover > td.sheet-cell-delivering,
.jexcel tbody tr.received-ok-row.row-selected > td.sheet-cell-delivering,
.jexcel > tbody > tr.received-ok-row > td.sheet-cell-delivering,
.jexcel > tbody > tr.received-ok-row:hover > td.sheet-cell-delivering,
.jexcel > tbody > tr.received-ok-row.row-selected > td.sheet-cell-delivering {
    background-color: #cf6900 !important;
    color: #ffffff !important;
    font-weight: 600 !important;
}

body:not(.light-mode) .jexcel tbody tr.received-ok-row > td.sheet-cell-cancelled,
body:not(.light-mode) .jexcel tbody tr.received-ok-row:hover > td.sheet-cell-cancelled,
body:not(.light-mode) .jexcel tbody tr.received-ok-row.row-selected > td.sheet-cell-cancelled,
body:not(.light-mode) .jexcel > tbody > tr.received-ok-row > td.sheet-cell-cancelled,
body:not(.light-mode) .jexcel > tbody > tr.received-ok-row:hover > td.sheet-cell-cancelled,
body:not(.light-mode) .jexcel > tbody > tr.received-ok-row.row-selected > td.sheet-cell-cancelled,
body.dark-mode .jexcel tbody tr.received-ok-row > td.sheet-cell-cancelled,
body.dark-mode .jexcel tbody tr.received-ok-row:hover > td.sheet-cell-cancelled,
body.dark-mode .jexcel tbody tr.received-ok-row.row-selected > td.sheet-cell-cancelled,
body.dark-mode .jexcel > tbody > tr.received-ok-row > td.sheet-cell-cancelled,
body.dark-mode .jexcel > tbody > tr.received-ok-row:hover > td.sheet-cell-cancelled,
body.dark-mode .jexcel > tbody > tr.received-ok-row.row-selected > td.sheet-cell-cancelled,
.jexcel tbody tr.received-ok-row > td.sheet-cell-cancelled,
.jexcel tbody tr.received-ok-row:hover > td.sheet-cell-cancelled,
.jexcel tbody tr.received-ok-row.row-selected > td.sheet-cell-cancelled,
.jexcel > tbody > tr.received-ok-row > td.sheet-cell-cancelled,
.jexcel > tbody > tr.received-ok-row:hover > td.sheet-cell-cancelled,
.jexcel > tbody > tr.received-ok-row.row-selected > td.sheet-cell-cancelled {
    background-color: #cf222e !important;
    color: #ffffff !important;
    font-weight: 600 !important;
}

body.light-mode .jexcel tbody tr.received-ok-row > td.sheet-cell-delivered,
body.light-mode .jexcel tbody tr.received-ok-row:hover > td.sheet-cell-delivered,
body.light-mode .jexcel tbody tr.received-ok-row.row-selected > td.sheet-cell-delivered,
body.light-mode .jexcel > tbody > tr.received-ok-row > td.sheet-cell-delivered,
body.light-mode .jexcel > tbody > tr.received-ok-row:hover > td.sheet-cell-delivered,
body.light-mode .jexcel > tbody > tr.received-ok-row.row-selected > td.sheet-cell-delivered {
    background-color: #2ea043 !important;
    color: #ffffff !important;
}

body.light-mode .jexcel tbody tr.received-ok-row > td.sheet-cell-delivering,
body.light-mode .jexcel tbody tr.received-ok-row:hover > td.sheet-cell-delivering,
body.light-mode .jexcel tbody tr.received-ok-row.row-selected > td.sheet-cell-delivering,
body.light-mode .jexcel > tbody > tr.received-ok-row > td.sheet-cell-delivering,
body.light-mode .jexcel > tbody > tr.received-ok-row:hover > td.sheet-cell-delivering,
body.light-mode .jexcel > tbody > tr.received-ok-row.row-selected > td.sheet-cell-delivering {
    background-color: #d97706 !important;
    color: #ffffff !important;
}

body.light-mode .jexcel tbody tr.received-ok-row > td.sheet-cell-cancelled,
body.light-mode .jexcel tbody tr.received-ok-row:hover > td.sheet-cell-cancelled,
body.light-mode .jexcel tbody tr.received-ok-row.row-selected > td.sheet-cell-cancelled,
body.light-mode .jexcel > tbody > tr.received-ok-row > td.sheet-cell-cancelled,
body.light-mode .jexcel > tbody > tr.received-ok-row:hover > td.sheet-cell-cancelled,
body.light-mode .jexcel > tbody > tr.received-ok-row.row-selected > td.sheet-cell-cancelled {
    background-color: #d1242f !important;
    color: #ffffff !important;
}

/* Custom Links & Action Buttons in Sheet */
.jexcel .sheet-cell-link {
    color: var(--info, #58a6ff) !important;
    text-decoration: none;
    font-weight: 600;
}

.jexcel .sheet-cell-link:hover {
    text-decoration: underline;
}

.jexcel .sheet-btn-action {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 6px;
    font-size: 0.68rem;
    font-weight: 600;
    border-radius: 4px;
    background: var(--table-header-bg, #21262d);
    border: 1px solid var(--border-color, #30363d);
    color: var(--info, #58a6ff);
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    text-decoration: none;
}

.jexcel .sheet-btn-action:hover {
    background: var(--table-row-hover, #30363d);
    color: var(--text-color, #79c0ff);
    border-color: var(--info, #58a6ff);
}

/* Dropdown cell in Jspreadsheet */
.jexcel tbody td.jexcel_dropdown,
.jexcel > tbody > tr > td.jexcel_dropdown {
    padding-right: 28px !important;
    background-repeat: no-repeat !important;
    background-position: calc(100% - 8px) center !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='%238b949e'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E") !important;
    background-size: 14px 14px !important;
    cursor: pointer !important;
}

body.light-mode .jexcel tbody td.jexcel_dropdown,
body.light-mode .jexcel > tbody > tr > td.jexcel_dropdown {
    padding-right: 28px !important;
    background-repeat: no-repeat !important;
    background-position: calc(100% - 8px) center !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='%2357606a'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E") !important;
    background-size: 14px 14px !important;
}

/* Sheet New Row & Save Emoji Button */
.sheet-cell-save-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    right: 3px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(35, 134, 54, 0.25);
    border: 1px solid rgba(35, 134, 54, 0.55);
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    line-height: 1;
    padding: 2px 4px;
    user-select: none;
    z-index: 50;
    color: inherit;
    transition: all 0.15s ease;
}

.sheet-cell-save-btn:hover {
    background: var(--primary-color, #238636) !important;
    border-color: var(--primary-color, #238636) !important;
    transform: translateY(-50%) scale(1.15);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.sheet-cell-save-btn:active {
    transform: translateY(-50%) scale(0.92);
}

.sheet-cell-save-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    opacity: 0.65;
    margin-left: 6px;
    cursor: pointer;
    user-select: none;
    transition: transform 0.15s ease, opacity 0.15s ease;
}

.sheet-cell-save-icon:hover {
    opacity: 1;
    transform: scale(1.18);
}

.sheet-newrow-placeholder {
    display: flex;
    align-items: center;
    justify-content: space-between;
    opacity: 0.55;
    font-style: italic;
    user-select: none;
    width: 100%;
    box-sizing: border-box;
    padding-right: 2px;
}

.sheet-newrow-value {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    position: relative;
    box-sizing: border-box;
    padding-right: 22px;
}

body.light-mode .sheet-cell-save-btn {
    background: rgba(46, 160, 67, 0.18);
    border-color: rgba(46, 160, 67, 0.5);
}

body.light-mode .sheet-cell-save-btn:hover {
    background: #2ea043 !important;
    border-color: #2ea043 !important;
}

/* In-cell Editor Styles & Dropdown Input Cleanup */
.jexcel .editor,
.jexcel tbody td.editor,
.jexcel > tbody > tr > td.editor {
    background: var(--input-bg, #0d1117) !important;
    color: var(--text-color, #c9d1d9) !important;
    border: 1px solid var(--primary-color, #238636) !important;
    border-radius: 4px !important;
    box-shadow: 0 0 0 2px rgba(35, 134, 54, 0.25) !important;
    overflow: hidden !important;
    background-repeat: no-repeat !important;
}

.jexcel .editor > input,
.jexcel .editor > textarea {
    background: transparent !important;
    color: var(--text-color, #c9d1d9) !important;
    border: none !important;
    padding: 3px 6px !important;
    font-family: inherit !important;
    font-size: inherit !important;
    outline: none !important;
    box-shadow: none !important;
}

.jexcel .editor .jdropdown,
.jexcel .editor .jdropdown-container-header,
.jexcel .editor .jdropdown-header,
.jdropdown-default .jdropdown-header {
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
    color: var(--text-color, #c9d1d9) !important;
    border: none !important;
    box-shadow: none !important;
    padding: 2px 6px !important;
}

.jexcel .editor .jdropdown-header input {
    background: transparent !important;
    color: var(--text-color, #c9d1d9) !important;
    border: none !important;
    box-shadow: none !important;
}

body.light-mode .jexcel .editor {
    background: #ffffff !important;
    border: 1px solid #2ea043 !important;
    box-shadow: 0 0 0 2px rgba(46, 160, 67, 0.25) !important;
}

body.light-mode .jexcel .editor input,
body.light-mode .jexcel .editor textarea {
    color: #24292f !important;
}

body.light-mode .jexcel .editor .jdropdown,
body.light-mode .jexcel .editor .jdropdown-container-header,
body.light-mode .jexcel .editor .jdropdown-header {
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
    color: #24292f !important;
}

.jdropdown-filter {
    background: var(--input-bg, #0d1117) !important;
    color: var(--text-color, #c9d1d9) !important;
    border: 1px solid var(--border-color, #30363d) !important;
    border-radius: 4px;
    padding: 4px 8px !important;
}

body.light-mode .jdropdown-filter {
    background: #ffffff !important;
    color: #24292f !important;
    border: 1px solid #d0d7de !important;
}

/* Source Badges */
.jexcel .sheet-badge-source {
    display: inline-block;
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.jexcel .sheet-badge-shopee {
    background: rgba(238, 77, 45, 0.14);
    color: #ff7a59;
    border: 1px solid rgba(238, 77, 45, 0.3);
}

body.light-mode .jexcel .sheet-badge-shopee {
    color: #d03b1e;
    background: rgba(238, 77, 45, 0.1);
}

.jexcel .sheet-badge-tiktok {
    background: rgba(254, 44, 85, 0.14);
    color: #ff6b8b;
    border: 1px solid rgba(254, 44, 85, 0.3);
}

body.light-mode .jexcel .sheet-badge-tiktok {
    color: #d0143c;
    background: rgba(254, 44, 85, 0.1);
}

.jexcel .sheet-badge-carrier {
    background: rgba(88, 166, 255, 0.14);
    color: #79c0ff;
    border: 1px solid rgba(88, 166, 255, 0.3);
}

body.light-mode .jexcel .sheet-badge-carrier {
    color: #0969da;
    background: rgba(9, 105, 218, 0.1);
}

.jexcel .sheet-badge-jtcargo {
    background: rgba(0, 128, 55, 0.18);
    color: #2ea043;
    border: 1px solid rgba(0, 128, 55, 0.35);
}

body.light-mode .jexcel .sheet-badge-jtcargo {
    color: #008037;
    background: rgba(0, 128, 55, 0.12);
}

body.light-mode .tiktok-qr-email-input {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: var(--text-color) !important;
}

body.light-mode .tiktok-qr-email-input::placeholder {
    color: #94a3b8 !important;
    opacity: 1;
}

body.light-mode .tiktok-qr-email-input:focus {
    border-color: #3b82f6 !important;
    background: #ffffff !important;
    outline: none !important;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2) !important;
}

/* ==========================================================================
   Mobile Bottom Sheet Dropdown (jSuites Picker Mode)
   ========================================================================== */

.jdropdown-picker.jdropdown-focus .jdropdown-backdrop {
    display: block !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    min-width: 100% !important;
    min-height: 100% !important;
    background: rgba(0, 0, 0, 0.65) !important;
    backdrop-filter: blur(3px) !important;
    -webkit-backdrop-filter: blur(3px) !important;
    z-index: 99998 !important;
    animation: jdropdown-fade-in 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes jdropdown-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.jdropdown-picker .jdropdown-container {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 100% !important;
    max-height: 65vh !important;
    background: var(--card-bg, #161b22) !important;
    border: 1px solid var(--border-color, #30363d) !important;
    border-bottom: none !important;
    border-radius: 18px 18px 0 0 !important;
    box-shadow: 0 -10px 35px rgba(0, 0, 0, 0.5) !important;
    padding: 0 0 max(16px, env(safe-area-inset-bottom, 16px)) 0 !important;
    z-index: 99999 !important;
    box-sizing: border-box !important;
    transform: translateY(0) !important;
    overflow: hidden !important;
    font-family: inherit !important;
}

body.light-mode .jdropdown-picker .jdropdown-container {
    background: #ffffff !important;
    border-color: #d0d7de !important;
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.18) !important;
}

/* Close / Header bar of mobile picker */
.jdropdown-picker .jdropdown-close {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    position: relative !important;
    padding: 16px 20px 12px !important;
    background: var(--card-bg, #161b22) !important;
    border-bottom: 1px solid var(--border-color, #30363d) !important;
    box-shadow: none !important;
    cursor: pointer !important;
    user-select: none !important;
    -webkit-tap-highlight-color: transparent;
}

body.light-mode .jdropdown-picker .jdropdown-close {
    background: #f6f8fa !important;
    border-bottom-color: #d0d7de !important;
}

/* Pill drag indicator */
.jdropdown-picker .jdropdown-close::before {
    content: '' !important;
    position: absolute !important;
    top: 6px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: 36px !important;
    height: 4px !important;
    border-radius: 2px !important;
    background: rgba(255, 255, 255, 0.25) !important;
}

body.light-mode .jdropdown-picker .jdropdown-close::before {
    background: rgba(0, 0, 0, 0.18) !important;
}

.jdropdown-picker .jdropdown-close-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-color, #f0f6fc);
}

body.light-mode .jdropdown-picker .jdropdown-close-title {
    color: #24292f;
}

.jdropdown-picker .jdropdown-close-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.92rem;
    font-weight: 600;
    color: #58a6ff;
    padding: 4px 10px;
    border-radius: 6px;
    background: rgba(56, 139, 253, 0.12);
    transition: background 0.15s ease;
}

.jdropdown-picker .jdropdown-close-btn:active {
    background: rgba(56, 139, 253, 0.25);
}

body.light-mode .jdropdown-picker .jdropdown-close-btn {
    color: #0969da;
    background: rgba(9, 105, 218, 0.1);
}

/* Content list inside mobile picker */
.jdropdown-picker .jdropdown-content {
    background: transparent !important;
    border: none !important;
    max-height: calc(60vh - 60px) !important;
    height: auto !important;
    min-height: 160px !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding: 4px 0 !important;
    margin: 0 !important;
}

.jdropdown-picker .jdropdown-item {
    font-size: 0.95rem !important;
    font-weight: 500 !important;
    text-transform: none !important;
    text-align: center !important;
    padding: 14px 20px !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
    color: var(--text-color, #f0f6fc) !important;
    cursor: pointer !important;
    transition: background 0.12s ease !important;
    user-select: none !important;
    -webkit-tap-highlight-color: rgba(255, 255, 255, 0.1);
}

body.light-mode .jdropdown-picker .jdropdown-item {
    color: #24292f !important;
    border-bottom-color: #f0f2f5 !important;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.05);
}

.jdropdown-picker .jdropdown-item:active,
.jdropdown-picker .jdropdown-item:hover {
    background: rgba(255, 255, 255, 0.08) !important;
}

body.light-mode .jdropdown-picker .jdropdown-item:active,
body.light-mode .jdropdown-picker .jdropdown-item:hover {
    background: #f3f4f6 !important;
}

.jdropdown-picker .jdropdown-item.jdropdown-selected {
    color: #58a6ff !important;
    font-weight: 700 !important;
    background: rgba(56, 139, 253, 0.14) !important;
}

body.light-mode .jdropdown-picker .jdropdown-item.jdropdown-selected {
    color: #0969da !important;
    background: rgba(9, 105, 218, 0.1) !important;
}

/* Prevent Jspreadsheet textarea from causing mobile scroll jump or soft keyboard popup */
.jexcel_textarea,
#jexcel_textarea {
    position: fixed !important;
    top: 50% !important;
    left: -9999px !important;
    width: 1px !important;
    height: 1px !important;
    opacity: 0 !important;
    pointer-events: none !important;
    font-size: 16px !important;
}

/* Shipper phone cell layout & copy button */
.sheet-ship-phone-cell {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    max-width: 100%;
    vertical-align: middle;
}

.sheet-btn-copy {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 19px;
    height: 19px;
    min-width: 19px;
    padding: 0;
    margin: 0;
    font-size: 0.70rem;
    border-radius: 4px;
    background: var(--table-header-bg, #21262d);
    border: 1px solid var(--border-color, #30363d);
    color: var(--text-color, #c9d1d9);
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.15s ease;
    user-select: none;
    -webkit-user-select: none;
    vertical-align: middle;
    outline: none;
}

.sheet-btn-copy:hover {
    background: var(--table-row-hover, #30363d);
    color: var(--primary-color, #2ea043);
    border-color: var(--primary-color, #2ea043);
}

.sheet-btn-copy:active {
    transform: scale(0.9);
}

body.light-mode .sheet-btn-copy {
    background: #f6f8fa;
    border-color: #d0d7de;
    color: #57606a;
}

body.light-mode .sheet-btn-copy:hover {
    background: #eef2f5;
    color: #1a7f37;
    border-color: #1a7f37;
}


/* Global responsive table wrapper & mobile layout safeguards (Desktop > 768px untouched) */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
    .page .card {
        max-width: 100%;
    }
    .page .card-header {
        flex-wrap: wrap;
        gap: 8px;
    }
    .page .table-responsive .data-table {
        min-width: 680px;
    }
    .page div[style*="minmax(340px"],
    .page div[style*="minmax(360px"],
    .page div[style*="minmax(380px"] {
        grid-template-columns: 1fr !important;
    }
}


/* ==========================================================================
   STICKY SUB-NAVIGATION / CATEGORY TABS & STICKY TABLE HEADERS (ALL PAGES)
   ========================================================================== */

/* 1. Reset legacy .btn-sm margin inside all tables so action columns never clip */
table td .btn-sm,
.data-table td .btn-sm,
.tiktok-cookie-table td .btn-sm,
.spx-cookie-table td .btn-sm,
.dashboard-orders-table td .btn-sm {
    margin-left: 0 !important;
    margin-top: 0 !important;
}

/* 2. Ensure .main-content has zero top padding gap on Desktop so top:0 sticks flush to viewport top */
@media (min-width: 769px) {
    .main-content {
        padding-top: 0 !important;
    }
    #page-content {
        padding-top: 12px;
    }
}

/* 3. Freeze / Sticky Category & Sub-Navigation Bars across all pages */
.hm-top-sticky-bar,
#tiktok-tabs,
.tiktok-tabs,
#spx-cookie-tabs,
.spx-cookie-tabs,
.tools-nav-tabs,
.dashboard-tabs,
.add-tabs,
.admin-tabs-nav,
.api-main-tabs,
.api-doc-tabs {
    position: sticky !important;
    top: 0 !important;
    z-index: 95 !important;
    background: rgba(7, 10, 19, 0.95) !important;
    backdrop-filter: blur(14px) !important;
    -webkit-backdrop-filter: blur(14px) !important;
    padding-top: 10px !important;
    padding-bottom: 8px !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

body.light-mode .hm-top-sticky-bar,
body.light-mode #tiktok-tabs,
body.light-mode .tiktok-tabs,
body.light-mode #spx-cookie-tabs,
body.light-mode .spx-cookie-tabs,
body.light-mode .tools-nav-tabs,
body.light-mode .dashboard-tabs,
body.light-mode .add-tabs,
body.light-mode .admin-tabs-nav,
body.light-mode .api-main-tabs,
body.light-mode .api-doc-tabs {
    background: rgba(248, 250, 252, 0.95) !important;
    border-bottom: 1px solid rgba(148, 163, 184, 0.3) !important;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

/* Mobile: Freeze top mobile header at top:0 and category bars right underneath at top:44px */
@media (max-width: 768px) {
    .main-content > .header {
        position: sticky !important;
        top: 0 !important;
        z-index: 150 !important;
        background: rgba(11, 16, 30, 0.96) !important;
        backdrop-filter: blur(16px) !important;
        -webkit-backdrop-filter: blur(16px) !important;
    }
    body.light-mode .main-content > .header {
        background: rgba(255, 255, 255, 0.96) !important;
    }
    .hm-top-sticky-bar,
    #tiktok-tabs,
    .tiktok-tabs,
    #spx-cookie-tabs,
    .spx-cookie-tabs,
    .tools-nav-tabs,
    .dashboard-tabs,
    .add-tabs,
    .admin-tabs-nav,
    .api-main-tabs,
    .api-doc-tabs {
        top: 44px !important;
        padding-top: 8px !important;
        padding-bottom: 6px !important;
    }
}

/* 4. Freeze / Sticky Table Column Headers (<thead> th) across all tables */
.table-container {
    max-height: 74vh;
    overflow-y: auto;
}

table thead th,
.data-table thead th,
.dashboard-orders-table thead th,
.tiktok-cookie-table thead th,
.spx-cookie-table thead th,
.ref-table thead th {
    position: sticky !important;
    top: 0 !important;
    z-index: 20 !important;
    background-color: #131c33 !important;
    box-shadow: 0 1px 0 var(--border-color, rgba(255, 255, 255, 0.12));
}

.dashboard-orders-table th.col-action {
    z-index: 25 !important;
}

body.light-mode table thead th,
body.light-mode .data-table thead th,
body.light-mode .dashboard-orders-table thead th,
body.light-mode .tiktok-cookie-table thead th,
body.light-mode .spx-cookie-table thead th,
body.light-mode .ref-table thead th {
    background-color: #f1f5f9 !important;
    box-shadow: 0 1px 0 #cbd5e1;
}
