/* Mining Checker System - PT TEMPIRAI ENERGY RESOURCES
 * Ultra-Premium Mobile-First Stylesheet (100% Offline Ready)
 * Design System: Industrial Amber & Midnight Slate + Glassmorphism
 */

:root,
[data-bs-theme="light"] {
    --mc-bg: #eef2f7;
    --mc-bg-accent: radial-gradient(circle at 12% 10%, rgba(217, 119, 6, 0.08), transparent 42%),
                    radial-gradient(circle at 88% 85%, rgba(15, 23, 42, 0.06), transparent 45%);
    --mc-surface: #ffffff;
    --mc-surface-alt: #f1f5f9;
    --mc-glass-bg: rgba(255, 255, 255, 0.86);
    --mc-glass-border: rgba(148, 163, 184, 0.28);
    --mc-border: #cbd5e1;
    --mc-border-soft: rgba(148, 163, 184, 0.24);
    --mc-text: #0f172a;
    --mc-text-muted: #475569;
    --mc-accent: #d97706;
    --mc-accent-hover: #b45309;
    --mc-accent-contrast: #ffffff;
    --mc-accent-glow: rgba(217, 119, 6, 0.28);
    --mc-accent-gradient: linear-gradient(135deg, #f59e0b 0%, #d97706 55%, #b45309 100%);
    --mc-success-gradient: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --mc-sidebar-bg: linear-gradient(180deg, #0f172a 0%, #0b1120 100%);
    --mc-sidebar-solid: #0f172a;
    --mc-sidebar-text: #f8fafc;
    --mc-sidebar-muted: #94a3b8;
    --mc-sidebar-active-bg: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    --mc-sidebar-active-text: #ffffff;
    --mc-bottom-nav-bg: rgba(255, 255, 255, 0.92);
    --mc-shadow-sm: 0 2px 6px rgba(15, 23, 42, 0.05), 0 1px 2px rgba(15, 23, 42, 0.04);
    --mc-shadow: 0 8px 24px -6px rgba(15, 23, 42, 0.09), 0 2px 6px -1px rgba(15, 23, 42, 0.05);
    --mc-shadow-lg: 0 16px 36px -10px rgba(15, 23, 42, 0.14), 0 4px 12px rgba(15, 23, 42, 0.06);
    --mc-sidebar-width: 264px;
    --mc-topbar-height: 60px;
    --mc-bottom-nav-height: 66px;
}

[data-bs-theme="dark"] {
    --mc-bg: #070d19;
    --mc-bg-accent: radial-gradient(circle at 12% 10%, rgba(245, 158, 11, 0.09), transparent 42%),
                    radial-gradient(circle at 88% 85%, rgba(56, 189, 248, 0.07), transparent 45%);
    --mc-surface: #111c2e;
    --mc-surface-alt: #1e293b;
    --mc-glass-bg: rgba(17, 28, 46, 0.84);
    --mc-glass-border: rgba(71, 85, 105, 0.42);
    --mc-border: #334155;
    --mc-border-soft: rgba(71, 85, 105, 0.35);
    --mc-text: #f8fafc;
    --mc-text-muted: #94a3b8;
    --mc-accent: #f59e0b;
    --mc-accent-hover: #fbbf24;
    --mc-accent-contrast: #0f172a;
    --mc-accent-glow: rgba(245, 158, 11, 0.32);
    --mc-accent-gradient: linear-gradient(135deg, #fbbf24 0%, #f59e0b 55%, #d97706 100%);
    --mc-success-gradient: linear-gradient(135deg, #34d399 0%, #10b981 100%);
    --mc-sidebar-bg: linear-gradient(180deg, #040914 0%, #020617 100%);
    --mc-sidebar-solid: #040914;
    --mc-sidebar-text: #f8fafc;
    --mc-sidebar-muted: #94a3b8;
    --mc-sidebar-active-bg: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    --mc-sidebar-active-text: #0f172a;
    --mc-bottom-nav-bg: rgba(15, 23, 42, 0.90);
    --mc-shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.25);
    --mc-shadow: 0 10px 28px -6px rgba(0, 0, 0, 0.48), 0 2px 8px rgba(0, 0, 0, 0.3);
    --mc-shadow-lg: 0 18px 40px -10px rgba(0, 0, 0, 0.65);
}

/* Global Reset & Anti-Horizontal Overflow on Mobile */
html,
body {
    min-width: 320px;
    max-width: 100%;
    overflow-x: clip;
    min-height: 100vh;
    background-color: var(--mc-bg);
    background-image: var(--mc-bg-accent);
    background-attachment: fixed;
    color: var(--mc-text);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-tap-highlight-color: transparent;
}

/* Custom Thin Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.35);
    border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.55);
}

/* Monospace & Tabular Numbers for Counters and Tables */
.mc-mono,
.mc-tabular {
    font-variant-numeric: tabular-nums;
}

.mc-mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

/* Keyframe Micro-Animations (without persistent transform on containers so fixed modals never trap) */
@keyframes mcFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes mcFadeSlideUp {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes mcPulseRing {
    0% {
        box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.55);
    }
    70% {
        box-shadow: 0 0 0 6px rgba(22, 163, 74, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(22, 163, 74, 0);
    }
}

@keyframes mcShine {
    0% {
        transform: translateX(-120%) skewX(-20deg);
    }
    100% {
        transform: translateX(220%) skewX(-20deg);
    }
}

.mc-animate-in {
    animation: mcFadeSlideUp 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

main.mc-animate-in {
    animation: mcFadeIn 0.2s ease-out;
}

.modal-backdrop {
    z-index: 1050;
}

.modal {
    z-index: 1060;
}

@media (prefers-reduced-motion: reduce) {
    .mc-animate-in,
    .mc-status-online .mc-status-dot,
    .mc-btn-shine::after {
        animation: none !important;
        transition: none !important;
    }
}

/* Smart Touch Targets (Separated by Context so small UI buttons never overflow mobile) */
.btn {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    font-weight: 600;
    border-radius: 0.65rem;
    transition: transform 0.12s ease, box-shadow 0.18s ease, background-color 0.15s ease, border-color 0.15s ease;
}

.btn:active:not(:disabled) {
    transform: scale(0.975);
}

.btn-sm {
    min-height: 34px;
    padding: 0.25rem 0.65rem;
    font-size: 0.83rem;
    border-radius: 0.5rem;
}

.btn-lg,
.mc-touch-target {
    min-height: 50px;
    min-width: 48px;
    border-radius: 0.85rem;
}

.btn-icon-only {
    min-width: 40px;
    min-height: 40px;
    padding: 0.35rem;
}

.form-control,
.form-select {
    min-height: 44px;
    border-radius: 0.65rem;
    border-color: var(--mc-border);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control-sm,
.form-select-sm {
    min-height: 36px;
    border-radius: 0.5rem;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--mc-accent);
    box-shadow: 0 0 0 0.2rem var(--mc-accent-glow);
}

/* Ensure 16px input text on touch phones to prevent mobile browser auto-zoom */
@media (max-width: 767.98px) {
    .form-control:not(.form-control-sm),
    .form-select:not(.form-select-sm) {
        font-size: 16px;
    }
}

.input-group > .btn {
    min-height: auto;
}

/* Primary Brand Accent Button */
.btn-accent {
    background: var(--mc-accent-gradient);
    border-color: var(--mc-accent);
    color: var(--mc-accent-contrast);
    box-shadow: 0 4px 12px var(--mc-accent-glow);
}

.btn-accent:hover,
.btn-accent:focus {
    background: var(--mc-accent-hover);
    border-color: var(--mc-accent-hover);
    color: var(--mc-accent-contrast);
    box-shadow: 0 6px 18px var(--mc-accent-glow);
}

/* Subtle glossy shine utility for primary 1-Tap action */
.mc-btn-shine {
    position: relative;
    overflow: hidden;
}
.mc-btn-shine::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 35%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.26), transparent);
    animation: mcShine 4s infinite ease-in-out;
    pointer-events: none;
}

/* App Shell Layout */
.mc-shell {
    display: flex;
    min-height: 100vh;
    width: 100%;
    max-width: 100%;
}

/* Desktop Sidebar */
.mc-sidebar {
    width: var(--mc-sidebar-width);
    background: var(--mc-sidebar-bg);
    color: var(--mc-sidebar-text);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1030;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 4px 0 24px rgba(2, 6, 23, 0.18);
}

.mc-sidebar-brand {
    min-height: var(--mc-topbar-height);
    padding: 0.9rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.09);
    text-decoration: none;
    color: var(--mc-sidebar-text);
}

.mc-brand-icon {
    width: 40px;
    height: 40px;
    border-radius: 11px;
    background: var(--mc-accent-gradient);
    color: var(--mc-accent-contrast);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
    box-shadow: 0 4px 12px var(--mc-accent-glow);
}

.mc-sidebar-nav {
    padding: 0.85rem 0.75rem;
    flex: 1;
    overflow-y: auto;
}

.mc-sidebar-section-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--mc-sidebar-muted);
    padding: 0.9rem 0.85rem 0.35rem;
}

.mc-sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 44px;
    padding: 0.55rem 0.9rem;
    margin-bottom: 0.2rem;
    border-radius: 0.65rem;
    color: rgba(248, 250, 252, 0.88);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.92rem;
    transition: background-color 0.16s ease, color 0.16s ease, transform 0.12s ease;
}

.mc-sidebar-link i {
    font-size: 1.15rem;
    flex-shrink: 0;
}

.mc-sidebar-link:hover {
    background-color: rgba(255, 255, 255, 0.09);
    color: #ffffff;
    transform: translateX(2px);
}

.mc-sidebar-link.active {
    background: var(--mc-sidebar-active-bg);
    color: var(--mc-sidebar-active-text);
    font-weight: 700;
    box-shadow: 0 4px 14px var(--mc-accent-glow);
}

.mc-sidebar-link.active i {
    color: inherit !important;
}

.mc-sidebar-footer {
    padding: 0.85rem 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.09);
    font-size: 0.8rem;
    color: var(--mc-sidebar-muted);
    background: rgba(2, 6, 23, 0.35);
}

/* Mobile Offcanvas Glass Drawer (Full Menu Access on Phones) */
.mc-mobile-drawer {
    background: var(--mc-sidebar-bg) !important;
    color: var(--mc-sidebar-text) !important;
    border-right: 1px solid rgba(255, 255, 255, 0.12) !important;
    max-width: 84vw;
    width: 300px !important;
}

.mc-mobile-drawer .offcanvas-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1rem 1.15rem;
}

.mc-mobile-drawer .offcanvas-body {
    padding: 0.5rem 0.75rem 2rem;
}

/* Main Content Wrapper */
.mc-main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    max-width: 100%;
    width: 100%;
    overflow-x: clip;
}

@media (min-width: 768px) {
    .mc-main-wrapper {
        margin-left: var(--mc-sidebar-width);
        width: calc(100% - var(--mc-sidebar-width));
    }
}

/* Glassmorphic Top Header */
.mc-topbar {
    min-height: var(--mc-topbar-height);
    background-color: var(--mc-glass-bg);
    backdrop-filter: blur(14px) saturate(160%);
    -webkit-backdrop-filter: blur(14px) saturate(160%);
    border-bottom: 1px solid var(--mc-glass-border);
    box-shadow: var(--mc-shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1020;
    padding: 0.45rem 0.65rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem;
}

@media (min-width: 768px) {
    .mc-topbar {
        padding: 0.5rem 1.5rem;
        gap: 0.75rem;
    }
}

.mc-topbar-btn {
    min-height: 38px;
    min-width: 38px;
    padding: 0.3rem 0.55rem;
    border-radius: 0.65rem;
    font-size: 0.85rem;
}

@media (max-width: 575.98px) {
    .mc-topbar-btn {
        min-height: 36px;
        min-width: 36px;
        padding: 0.25rem 0.45rem;
    }
}

.mc-content {
    flex: 1;
    padding: 0.85rem 0.75rem;
    padding-bottom: calc(var(--mc-bottom-nav-height) + env(safe-area-inset-bottom, 0px) + 1.5rem);
}

@media (min-width: 768px) {
    .mc-content {
        padding: 1.5rem;
        padding-bottom: 2rem;
    }
}

/* Premium Cards & Surfaces */
.mc-card {
    background-color: var(--mc-surface);
    border: 1px solid var(--mc-border-soft);
    border-radius: 1rem;
    box-shadow: var(--mc-shadow);
    transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.2s ease, border-color 0.2s ease;
}

@media (hover: hover) {
    .mc-card-hover:hover {
        transform: translateY(-2px);
        box-shadow: var(--mc-shadow-lg);
    }
}

.mc-card-header {
    padding: 0.9rem 1.15rem;
    border-bottom: 1px solid var(--mc-border-soft);
    font-weight: 700;
    border-top-left-radius: 1rem;
    border-top-right-radius: 1rem;
}

.mc-card-body {
    padding: 1rem 1.15rem;
}

@media (min-width: 768px) {
    .mc-card-header {
        padding: 1rem 1.35rem;
    }
    .mc-card-body {
        padding: 1.25rem 1.35rem;
    }
}

/* KPI Icon Soft Pill */
.mc-kpi-icon {
    width: 38px;
    height: 38px;
    border-radius: 0.7rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

/* Hero Banner Gradient */
.mc-hero-card {
    background: linear-gradient(135deg, rgba(217, 119, 6, 0.1) 0%, var(--mc-surface) 55%);
    border: 1px solid var(--mc-border-soft);
    border-left: 4px solid var(--mc-accent);
}

.mc-active-session-banner {
    border-radius: 1rem;
    backdrop-filter: blur(8px);
}

/* Status Pill with Live Beacon */
.mc-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.6rem;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 700;
    border: 1px solid transparent;
    white-space: nowrap;
}

@media (min-width: 576px) {
    .mc-status-pill {
        padding: 0.35rem 0.75rem;
        font-size: 0.8125rem;
    }
}

.mc-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.mc-status-online {
    background-color: rgba(22, 163, 74, 0.14);
    color: #15803d;
    border-color: rgba(22, 163, 74, 0.35);
}

[data-bs-theme="dark"] .mc-status-online {
    background-color: rgba(34, 197, 94, 0.18);
    color: #4ade80;
    border-color: rgba(74, 222, 128, 0.38);
}

.mc-status-online .mc-status-dot {
    background-color: #16a34a;
    animation: mcPulseRing 2.2s infinite;
}

[data-bs-theme="dark"] .mc-status-online .mc-status-dot {
    background-color: #4ade80;
}

.mc-status-offline {
    background-color: rgba(220, 38, 38, 0.15);
    color: #b91c1c;
    border-color: rgba(220, 38, 38, 0.35);
}

[data-bs-theme="dark"] .mc-status-offline {
    background-color: rgba(248, 113, 113, 0.2);
    color: #f87171;
    border-color: rgba(248, 113, 113, 0.4);
}

.mc-status-offline .mc-status-dot {
    background-color: #dc2626;
}

/* Tactile Unit DT Selection Buttons (Field Quick Trip) */
.mc-dt-btn {
    min-height: 82px;
    border: 2px solid var(--mc-border);
    border-radius: 0.9rem;
    background-color: var(--mc-surface);
    color: var(--mc-text);
    padding: 0.7rem 0.8rem;
    text-align: left;
    width: 100%;
    display: block;
    box-shadow: 0 3px 0 var(--mc-border), var(--mc-shadow-sm);
    transition: transform 0.1s ease, box-shadow 0.12s ease, border-color 0.15s ease, background-color 0.15s ease;
}

.mc-dt-btn:hover,
.mc-dt-btn:focus-visible {
    border-color: var(--mc-accent);
    background-color: rgba(217, 119, 6, 0.08);
    outline: none;
}

.mc-dt-btn:active {
    transform: translateY(2px) scale(0.985);
    box-shadow: 0 1px 0 var(--mc-border);
}

.mc-dt-btn-fleet {
    border-color: #10b981;
    background: linear-gradient(145deg, rgba(16, 185, 129, 0.08) 0%, var(--mc-surface) 75%);
    box-shadow: 0 3px 0 rgba(16, 185, 129, 0.45), 0 6px 16px rgba(16, 185, 129, 0.12);
}

.mc-dt-btn-fleet:hover,
.mc-dt-btn-fleet:focus-visible {
    border-color: #059669;
    background: linear-gradient(145deg, rgba(16, 185, 129, 0.14) 0%, var(--mc-surface) 80%);
}

.mc-dt-btn-recent {
    border-color: var(--mc-accent);
    box-shadow: 0 3px 0 rgba(217, 119, 6, 0.45), var(--mc-shadow-sm);
}

/* Mobile Floating Glass Bottom Dock (< 768px) */
.mc-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: calc(var(--mc-bottom-nav-height) + env(safe-area-inset-bottom, 0px));
    padding: 0.35rem 0.35rem calc(0.35rem + env(safe-area-inset-bottom, 0px));
    background-color: var(--mc-bottom-nav-bg);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border-top: 1px solid var(--mc-glass-border);
    box-shadow: 0 -6px 24px rgba(15, 23, 42, 0.12);
    z-index: 1030;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.2rem;
}

.mc-bottom-nav-item {
    min-height: 50px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    text-decoration: none;
    color: var(--mc-text-muted);
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 0.75rem;
    padding: 0.2rem 0.15rem;
    transition: background-color 0.16s ease, color 0.16s ease, transform 0.1s ease;
    position: relative;
}

.mc-bottom-nav-item i {
    font-size: 1.25rem;
    line-height: 1;
}

.mc-bottom-nav-item span {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mc-bottom-nav-item:active {
    transform: scale(0.94);
}

.mc-bottom-nav-item.active {
    color: var(--mc-accent);
    background-color: rgba(217, 119, 6, 0.14);
    font-weight: 700;
}

.mc-bottom-nav-item.active::before {
    content: "";
    position: absolute;
    top: 2px;
    width: 24px;
    height: 3px;
    border-radius: 999px;
    background: var(--mc-accent-gradient);
}

/* Horizontal Swipeable Navigation Pills on Mobile (Master Data Tabs) */
.mc-scroll-tabs {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 0.45rem;
    padding-bottom: 0.4rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.mc-scroll-tabs::-webkit-scrollbar {
    display: none;
}
.mc-scroll-tabs > .btn {
    flex: 0 0 auto;
    white-space: nowrap;
}
@media (min-width: 768px) {
    .mc-scroll-tabs {
        flex-wrap: wrap;
        overflow-x: visible;
    }
}

/* CSS-Only Single-DOM Responsive Card-Table for Form Matrix Views (Mobile < 768px) */
@media (max-width: 767.98px) {
    .mc-mobile-card-table {
        border: 0 !important;
        display: block;
    }
    .mc-mobile-card-table thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
    }
    .mc-mobile-card-table tbody {
        display: flex;
        flex-direction: column;
        gap: 0.85rem;
    }
    .mc-mobile-card-table tbody tr {
        display: block;
        background-color: var(--mc-surface);
        border: 1px solid var(--mc-border);
        border-radius: 0.9rem;
        padding: 0.75rem 0.9rem;
        box-shadow: var(--mc-shadow-sm);
    }
    .mc-mobile-card-table tbody td {
        display: block;
        width: 100%;
        border: 0 !important;
        padding: 0.4rem 0 !important;
        text-align: left !important;
    }
    .mc-mobile-card-table tbody td[data-label]::before {
        content: attr(data-label);
        display: block;
        font-size: 0.72rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        color: var(--mc-text-muted);
        margin-bottom: 0.25rem;
    }
    .mc-mobile-card-table tbody td + td {
        border-top: 1px dashed var(--mc-border-soft) !important;
        padding-top: 0.55rem !important;
    }
    .mc-mobile-card-table tbody td.mc-td-hero {
        padding-bottom: 0.55rem !important;
    }
    .mc-mobile-card-table tbody td.mc-td-hero::before {
        display: none;
    }
}

/* High Contrast Table & DataTables Mobile Polish */
.table {
    --bs-table-bg: transparent;
}

@media (max-width: 767.98px) {
    .dt-container .row,
    .dataTables_wrapper .row {
        row-gap: 0.5rem;
    }
    .dt-container .dt-search,
    .dataTables_wrapper .dataTables_filter {
        text-align: left !important;
        width: 100%;
    }
    .dt-container .dt-search input,
    .dataTables_wrapper .dataTables_filter input {
        width: 100% !important;
        margin-left: 0 !important;
        margin-top: 0.25rem;
    }
    .dt-container .dt-paging .pagination,
    .dataTables_wrapper .dataTables_paginate .pagination {
        justify-content: center !important;
        flex-wrap: wrap;
        gap: 0.2rem;
    }
    .modal-dialog {
        margin: 0.65rem;
    }
    .modal-content {
        border-radius: 1.15rem;
    }
}

/* Login Glass Background Mesh */
.mc-login-bg {
    background:
        radial-gradient(circle at 15% 20%, rgba(217, 119, 6, 0.18), transparent 45%),
        radial-gradient(circle at 85% 80%, rgba(15, 23, 42, 0.18), transparent 48%),
        #dfe6f0;
}

[data-bs-theme="dark"] .mc-login-bg {
    background:
        radial-gradient(circle at 15% 20%, rgba(245, 158, 11, 0.16), transparent 45%),
        radial-gradient(circle at 85% 80%, rgba(14, 165, 233, 0.12), transparent 48%),
        #050a14;
}

.mc-glass-card {
    background-color: var(--mc-surface);
    background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(248, 250, 252, 0.94) 100%);
    backdrop-filter: blur(16px) saturate(160%);
    -webkit-backdrop-filter: blur(16px) saturate(160%);
    border: 1.5px solid #cbd5e1;
    border-top: 4px solid var(--mc-accent);
    box-shadow: 0 20px 45px -12px rgba(15, 23, 42, 0.22), 0 4px 14px rgba(15, 23, 42, 0.08);
    border-radius: 1.25rem;
    overflow: hidden;
}

[data-bs-theme="dark"] .mc-glass-card {
    background-color: var(--mc-surface);
    background-image: linear-gradient(180deg, rgba(17, 28, 46, 0.96) 0%, rgba(15, 23, 42, 0.95) 100%);
    border: 1.5px solid #334155;
    border-top: 4px solid var(--mc-accent);
    box-shadow: 0 24px 50px -12px rgba(0, 0, 0, 0.72), 0 0 0 1px rgba(245, 158, 11, 0.14);
}

/* Role System Compact Animated Timeline */
.mc-workflow-card {
    border-top: 4px solid var(--mc-accent);
    overflow: hidden;
}

@keyframes mcTimelinePopIn {
    0% {
        opacity: 0;
        transform: translateY(8px) scale(0.95);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes mcSpotlightIn {
    0% {
        opacity: 0.2;
        transform: translateY(4px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes mcTimelinePulse {
    0% {
        box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.55);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(245, 158, 11, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(245, 158, 11, 0);
    }
}

@keyframes mcTimelineAlertPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.58);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(220, 53, 69, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0);
    }
}

@keyframes mcTimelineBeamTravel {
    0% {
        background-position: 0% 0%;
    }
    100% {
        background-position: 200% 0%;
    }
}

.mc-tl-rail-wrap {
    position: relative;
    padding: 0.25rem 0.1rem 0.5rem;
    overflow-x: auto;
    scrollbar-width: thin;
}

.mc-tl-rail {
    position: relative;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.35rem;
    min-width: 620px;
}

.mc-tl-rail-track {
    position: absolute;
    top: 17px;
    left: 28px;
    right: 28px;
    height: 4px;
    border-radius: 999px;
    background: var(--mc-border-soft);
    z-index: 0;
    overflow: hidden;
}

.mc-tl-rail-fill {
    height: 100%;
    width: 0%;
    border-radius: 999px;
    background: linear-gradient(90deg, #10b981, #f59e0b, #fbbf24, #10b981);
    background-size: 200% 100%;
    animation: mcTimelineBeamTravel 2.8s linear infinite;
    transition: width 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

.mc-tl-milestone {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    flex: 1 1 0;
    min-width: 78px;
    background: transparent;
    border: 0;
    padding: 0.15rem 0.25rem;
    border-radius: 0.65rem;
    cursor: pointer;
    color: inherit;
    animation: mcTimelinePopIn 0.36s cubic-bezier(0.22, 1, 0.36, 1) backwards;
    animation-delay: calc(var(--wf-idx, 0) * 65ms);
    transition: background-color 0.2s ease, transform 0.18s ease;
}

.mc-tl-milestone:hover {
    background: rgba(148, 163, 184, 0.10);
    transform: translateY(-2px);
}

.mc-tl-dot {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.82rem;
    background: var(--mc-surface);
    color: var(--mc-text-muted);
    border: 2px solid var(--mc-border);
    transition: all 0.25s ease;
}

.mc-tl-milestone.is-done .mc-tl-dot {
    background: #10b981;
    border-color: #059669;
    color: #ffffff;
}

.mc-tl-milestone.is-current .mc-tl-dot {
    background: var(--mc-accent-gradient);
    border-color: var(--mc-accent-hover);
    color: #ffffff;
    animation: mcTimelinePulse 1.9s ease-out infinite;
}

.mc-tl-milestone.is-blocked .mc-tl-dot {
    background: #dc3545;
    border-color: #b91c1c;
    color: #ffffff;
    animation: mcTimelineAlertPulse 1.6s ease-out infinite;
}

.mc-tl-milestone.is-info .mc-tl-dot {
    background: #0284c7;
    border-color: #0369a1;
    color: #ffffff;
}

.mc-tl-milestone.is-selected {
    background: rgba(245, 158, 11, 0.10);
}

.mc-tl-milestone.is-selected .mc-tl-dot,
.mc-tl-milestone.is-playing .mc-tl-dot {
    transform: scale(1.18);
    box-shadow: 0 0 0 5px var(--mc-accent-glow);
}

.mc-tl-milestone.is-playing .mc-tl-dot {
    border-color: #ffffff;
}

.mc-tl-m-label {
    margin-top: 0.35rem;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.2;
    color: var(--mc-text);
    white-space: nowrap;
}

.mc-tl-m-chip {
    margin-top: 0.22rem;
    font-size: 0.65rem;
    padding: 0.12rem 0.42rem;
    border-radius: 999px;
    font-weight: 600;
    max-width: 105px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Single Focused Step Spotlight Bar */
.mc-tl-spotlight {
    margin-top: 0.45rem;
    padding: 0.7rem 0.95rem;
    border-radius: 0.8rem;
    border: 1px solid var(--mc-border);
    border-left: 4px solid var(--mc-accent);
    background: var(--mc-surface-alt);
    transition: border-color 0.25s ease, background-color 0.25s ease;
}

.mc-tl-spotlight.is-done {
    border-left-color: #10b981;
}

.mc-tl-spotlight.is-blocked {
    border-left-color: #dc3545;
}

.mc-tl-spotlight.is-animating {
    animation: mcSpotlightIn 0.28s ease;
}

.mc-tl-perm-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.1rem 0.42rem;
    border-radius: 0.35rem;
    font-size: 0.68rem;
    font-weight: 600;
    background: var(--mc-surface);
    color: var(--mc-text-muted);
    border: 1px solid var(--mc-border-soft);
}

.mc-wf-relay-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
    gap: 0.6rem;
}

.mc-wf-relay-node {
    padding: 0.55rem 0.75rem;
    border-radius: 0.65rem;
    border: 1px dashed var(--mc-border);
    background: var(--mc-surface-alt);
    font-size: 0.76rem;
}

.mc-wf-relay-node.is-active-role {
    border-style: solid;
    border-color: var(--mc-accent);
    background: rgba(245, 158, 11, 0.12);
}

[data-bs-theme="dark"] .mc-tl-spotlight {
    background: rgba(15, 23, 42, 0.58);
}

/* Dark mode contrast safety for Bootstrap light utility & alert outlines */
[data-bs-theme="dark"] .bg-light,
[data-bs-theme="dark"] .bg-white {
    background-color: var(--mc-surface-alt) !important;
    color: var(--mc-text) !important;
}

[data-bs-theme="dark"] .table-light {
    --bs-table-bg: #1e293b;
    --bs-table-color: #f1f5f9;
    --bs-table-border-color: #334155;
    color: #f1f5f9;
}

[data-bs-theme="dark"] .btn-outline-dark {
    color: #e2e8f0;
    border-color: #64748b;
}

[data-bs-theme="dark"] .btn-outline-dark:hover {
    background-color: #334155;
    border-color: #94a3b8;
    color: #ffffff;
}

@media (prefers-reduced-motion: reduce) {
    .mc-tl-milestone,
    .mc-tl-rail-fill,
    .mc-tl-milestone.is-current .mc-tl-dot,
    .mc-tl-milestone.is-blocked .mc-tl-dot,
    .mc-tl-spotlight.is-animating {
        animation: none !important;
        transition: none !important;
    }
}
